####Samsung Galaxy Grand Duos GT-i9082
- The path of the patch is mentioned in the file name of the patch
- Patches can be merged using "git am filename.patch"
From c615bba642b004ba931ec5919d87bc455ad6bd2c Mon Sep 17 00:00:00 2001 | |
From: Shubhang <shubhang92@gmail.com> | |
Date: Tue, 18 Mar 2014 20:19:34 +0530 | |
Subject: [PATCH] Use squisher at the end of build | |
--- | |
core/Makefile | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
diff --git a/core/Makefile b/core/Makefile | |
index 19a185e..2b5904d 100644 | |
--- a/core/Makefile | |
+++ b/core/Makefile | |
@@ -1460,9 +1460,9 @@ bacon: otapackage | |
ifneq ($(TARGET_CUSTOM_RELEASETOOL),) | |
$(error TARGET_CUSTOM_RELEASETOOL is deprecated) | |
endif | |
- $(hide) ln -f $(INTERNAL_OTA_PACKAGE_TARGET) $(CM_TARGET_PACKAGE) | |
- $(hide) $(MD5SUM) $(CM_TARGET_PACKAGE) > $(CM_TARGET_PACKAGE).md5sum | |
- @echo -e ${CL_CYN}"Package Complete: $(CM_TARGET_PACKAGE)"${CL_RST} | |
+ @echo -e ${CL_YLW}"Optimizing Resurrection Remix ROM using release tools..."${CL_RST} | |
+ | |
+ $(hide) OTAPACKAGE=$(INTERNAL_OTA_PACKAGE_TARGET) APKCERTS=$(APKCERTS_FILE) ./vendor/cm/tools/squisher | |
# ----------------------------------------------------------------- | |
# The update package | |
-- | |
1.9.0 | |
From 1ad8b5f5d66937b50e38782170b00ef61404633e Mon Sep 17 00:00:00 2001 | |
From: Pawit Pornkitprasan <p.pawit@gmail.com> | |
Date: Wed, 11 Dec 2013 20:47:31 +0700 | |
Subject: [PATCH] chromium: disable HW rendering for capri | |
Change-Id: I16b2c14eb15a3efe4d84d603c132434a5f97530a | |
--- | |
android_webview/browser/in_process_view_renderer.cc | 5 +++++ | |
1 file changed, 5 insertions(+) | |
diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc | |
index e384584..5e15022 100644 | |
--- a/android_webview/browser/in_process_view_renderer.cc | |
+++ b/android_webview/browser/in_process_view_renderer.cc | |
@@ -133,8 +133,13 @@ class ScopedPixelAccess { | |
}; | |
bool HardwareEnabled() { | |
+// HACK: CAPRI_HWC has problems with GL image upload which can lead to system crash | |
+#ifdef CAPRI_HWC | |
+ static bool g_hw_enabled = false; | |
+#else | |
static bool g_hw_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( | |
switches::kDisableWebViewGLMode); | |
+#endif | |
return g_hw_enabled; | |
} | |
-- | |
1.8.3.4 (Apple Git-47) | |
From b57e8dacd3ad7ca9d8ab67446dc3f9a247174725 Mon Sep 17 00:00:00 2001 | |
From: Pawit Pornkitprasan <p.pawit@gmail.com> | |
Date: Fri, 13 Dec 2013 21:37:01 +0700 | |
Subject: [PATCH 1/3] AudioMixer: fix artifact on 2 short sounds | |
On the I9082, when 2 short sounds are played simultaneously, there will be artifact | |
on the speaker due to the buffer not being cleared. | |
Change-Id: I8a325175e8e326a638c7f29987ae272ae8af6b66 | |
--- | |
services/audioflinger/AudioMixer.cpp | 7 ++++++- | |
1 file changed, 6 insertions(+), 1 deletion(-) | |
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp | |
index 95f7381..5f80165 100644 | |
--- a/services/audioflinger/AudioMixer.cpp | |
+++ b/services/audioflinger/AudioMixer.cpp | |
@@ -1128,8 +1128,13 @@ void AudioMixer::process__genericNoResampling(state_t* state, int64_t pts) | |
t.in = t.buffer.raw; | |
// t.in == NULL can happen if the track was flushed just after having | |
// been enabled for mixing. | |
- if (t.in == NULL) | |
+ if (t.in == NULL) { | |
enabledTracks &= ~(1<<i); | |
+ | |
+ // We need to clear buffer here or there will be strange artifact | |
+ // on I9082's speaker | |
+ memset(t.mainBuffer, 0, sizeof(int16_t) * MAX_NUM_CHANNELS * state->frameCount); | |
+ } | |
} | |
e0 = enabledTracks; | |
-- | |
1.8.3.4 (Apple Git-47) | |
From 0adf8dfc02fc982ae89e794ee9216f2149e9634e Mon Sep 17 00:00:00 2001 | |
From: Pawit Pornkitprasan <p.pawit@gmail.com> | |
Date: Tue, 17 Dec 2013 13:15:52 +0700 | |
Subject: [PATCH 2/3] OMXCodec: set default input buffer size | |
Broadcom OMX only set the buffer size to 65536 by default which | |
is not enough for higher bitrate video | |
Change-Id: I74372f3d821e41feb38b9bc0cca4ef56aa019493 | |
--- | |
media/libstagefright/OMXCodec.cpp | 12 ++++++++++++ | |
1 file changed, 12 insertions(+) | |
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp | |
index fa4643f..02c45b5 100644 | |
--- a/media/libstagefright/OMXCodec.cpp | |
+++ b/media/libstagefright/OMXCodec.cpp | |
@@ -801,6 +801,18 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) { | |
if (meta->findInt32(kKeyMaxInputSize, &maxInputSize)) { | |
setMinBufferSize(kPortIndexInput, (OMX_U32)maxInputSize); | |
} | |
+// Capri's OMX fail to set a reasonable default size from width and height | |
+#ifdef CAPRI_HWC | |
+ else { | |
+ int32_t width; | |
+ int32_t height; | |
+ if (meta->findInt32(kKeyWidth, &width) && meta->findInt32(kKeyHeight, &height)) { | |
+ setMinBufferSize(kPortIndexInput, (width * height * 3) / 2); | |
+ } else { | |
+ ALOGE("Failed to set min buffer size"); | |
+ } | |
+ } | |
+#endif | |
initOutputFormat(meta); | |
-- | |
1.8.3.4 (Apple Git-47) | |
From 3a374db88238ae39b0a38498f49f8327870edc90 Mon Sep 17 00:00:00 2001 | |
From: Pawit Pornkitprasan <p.pawit@gmail.com> | |
Date: Mon, 23 Dec 2013 18:41:44 +0700 | |
Subject: [PATCH 3/3] OMXCodec: set default input buffer size only for BCM | |
decoder | |
Change-Id: Ic554343069b47a4b66ea9e8daee684d4923ecd98 | |
--- | |
media/libstagefright/OMXCodec.cpp | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp | |
index 02c45b5..5d48f39 100644 | |
--- a/media/libstagefright/OMXCodec.cpp | |
+++ b/media/libstagefright/OMXCodec.cpp | |
@@ -803,7 +803,7 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) { | |
} | |
// Capri's OMX fail to set a reasonable default size from width and height | |
#ifdef CAPRI_HWC | |
- else { | |
+ else if (!strncmp(mComponentName, "OMX.BRCM.vc4.decoder.", 21)) { | |
int32_t width; | |
int32_t height; | |
if (meta->findInt32(kKeyWidth, &width) && meta->findInt32(kKeyHeight, &height)) { | |
-- | |
1.8.3.4 (Apple Git-47) | |
diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h | |
index 319aeaa..4264248 100644 | |
--- a/include/gui/ISurfaceComposer.h | |
+++ b/include/gui/ISurfaceComposer.h | |
@@ -122,6 +122,16 @@ public: | |
uint32_t reqWidth, uint32_t reqHeight, | |
uint32_t minLayerZ, uint32_t maxLayerZ, | |
bool isCpuConsumer) = 0; | |
+ | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ /* Capture the specified screen. requires READ_FRAME_BUFFER permission | |
+ * This function will fail if there is a secure window on screen. | |
+ */ | |
+ virtual status_t captureScreen(const sp<IBinder>& display, sp<IMemoryHeap>* heap, | |
+ uint32_t* width, uint32_t* height, | |
+ uint32_t reqWidth, uint32_t reqHeight, | |
+ uint32_t minLayerZ, uint32_t maxLayerZ) = 0; | |
+#endif | |
}; | |
// ---------------------------------------------------------------------------- | |
@@ -140,6 +150,9 @@ public: | |
GET_BUILT_IN_DISPLAY, | |
SET_TRANSACTION_STATE, | |
AUTHENTICATE_SURFACE, | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ CAPTURE_SCREEN_DEPRECATED, | |
+#endif | |
BLANK, | |
UNBLANK, | |
GET_DISPLAY_INFO, | |
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h | |
index 90d3dcd..425c111 100644 | |
--- a/include/gui/SurfaceComposerClient.h | |
+++ b/include/gui/SurfaceComposerClient.h | |
@@ -39,6 +39,9 @@ namespace android { | |
class DisplayInfo; | |
class Composer; | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+class IMemoryHeap; | |
+#endif | |
class ISurfaceComposerClient; | |
class IGraphicBufferProducer; | |
class Region; | |
@@ -179,6 +182,9 @@ public: | |
uint32_t minLayerZ, uint32_t maxLayerZ); | |
private: | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ sp<IMemoryHeap> mHeap; | |
+#endif | |
mutable sp<CpuConsumer> mCpuConsumer; | |
mutable sp<BufferQueue> mBufferQueue; | |
CpuConsumer::LockedBuffer mBuffer; | |
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp | |
index 38e019c..26e54f1 100644 | |
--- a/libs/binder/Parcel.cpp | |
+++ b/libs/binder/Parcel.cpp | |
@@ -808,6 +808,12 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) | |
return status; | |
} | |
+extern "C" status_t _ZN7android6Parcel5writeERKNS0_26FlattenableHelperInterfaceE(void *parcel, void *val); | |
+ | |
+extern "C" status_t _ZN7android6Parcel5writeERKNS_11FlattenableE(void *parcel, void *val) { | |
+ return _ZN7android6Parcel5writeERKNS0_26FlattenableHelperInterfaceE(parcel, val); | |
+} | |
+ | |
status_t Parcel::write(const FlattenableHelperInterface& val) | |
{ | |
status_t err; | |
@@ -1184,6 +1190,12 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const | |
return NO_ERROR; | |
} | |
+extern "C" status_t _ZNK7android6Parcel4readERNS0_26FlattenableHelperInterfaceE(void *parcel, void *val); | |
+ | |
+extern "C" status_t _ZNK7android6Parcel4readERNS_11FlattenableE(void *parcel, void *val) { | |
+ return _ZNK7android6Parcel4readERNS0_26FlattenableHelperInterfaceE(parcel, val); | |
+} | |
+ | |
status_t Parcel::read(FlattenableHelperInterface& val) const | |
{ | |
// size | |
diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk | |
index 7957981..356ffd2 100644 | |
--- a/libs/gui/Android.mk | |
+++ b/libs/gui/Android.mk | |
@@ -53,6 +53,10 @@ ifeq ($(BOARD_EGL_SKIP_FIRST_DEQUEUE),true) | |
LOCAL_CFLAGS += -DSURFACE_SKIP_FIRST_DEQUEUE | |
endif | |
+ifeq ($(BOARD_USE_MHEAP_SCREENSHOT),true) | |
+ LOCAL_CFLAGS += -DUSE_MHEAP_SCREENSHOT | |
+endif | |
+ | |
LOCAL_MODULE:= libgui | |
ifeq ($(TARGET_BOARD_PLATFORM), tegra) | |
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp | |
index 6d22066..ccde018 100644 | |
--- a/libs/gui/ISurfaceComposer.cpp | |
+++ b/libs/gui/ISurfaceComposer.cpp | |
@@ -102,6 +102,28 @@ public: | |
remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply); | |
} | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ virtual status_t captureScreen( | |
+ const sp<IBinder>& display, sp<IMemoryHeap>* heap, | |
+ uint32_t* width, uint32_t* height, | |
+ uint32_t reqWidth, uint32_t reqHeight, | |
+ uint32_t minLayerZ, uint32_t maxLayerZ) | |
+ { | |
+ Parcel data, reply; | |
+ data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | |
+ data.writeStrongBinder(display); | |
+ data.writeInt32(reqWidth); | |
+ data.writeInt32(reqHeight); | |
+ data.writeInt32(minLayerZ); | |
+ data.writeInt32(maxLayerZ); | |
+ remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN_DEPRECATED, data, &reply); | |
+ *heap = interface_cast<IMemoryHeap>(reply.readStrongBinder()); | |
+ *width = reply.readInt32(); | |
+ *height = reply.readInt32(); | |
+ return reply.readInt32(); | |
+ } | |
+#endif | |
+ | |
virtual status_t captureScreen(const sp<IBinder>& display, | |
const sp<IGraphicBufferProducer>& producer, | |
uint32_t reqWidth, uint32_t reqHeight, | |
@@ -278,6 +300,25 @@ status_t BnSurfaceComposer::onTransact( | |
bootFinished(); | |
return NO_ERROR; | |
} | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ case CAPTURE_SCREEN_DEPRECATED: { | |
+ CHECK_INTERFACE(ISurfaceComposer, data, reply); | |
+ sp<IBinder> display = data.readStrongBinder(); | |
+ uint32_t reqWidth = data.readInt32(); | |
+ uint32_t reqHeight = data.readInt32(); | |
+ uint32_t minLayerZ = data.readInt32(); | |
+ uint32_t maxLayerZ = data.readInt32(); | |
+ sp<IMemoryHeap> heap; | |
+ uint32_t w, h; | |
+ status_t res = captureScreen(display, &heap, &w, &h, | |
+ reqWidth, reqHeight, minLayerZ, maxLayerZ); | |
+ reply->writeStrongBinder(heap->asBinder()); | |
+ reply->writeInt32(w); | |
+ reply->writeInt32(h); | |
+ reply->writeInt32(res); | |
+ return NO_ERROR; | |
+ } | |
+#endif | |
case CAPTURE_SCREEN: { | |
CHECK_INTERFACE(ISurfaceComposer, data, reply); | |
sp<IBinder> display = data.readStrongBinder(); | |
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp | |
index a6187f5..ba0f64d 100644 | |
--- a/libs/gui/SurfaceComposerClient.cpp | |
+++ b/libs/gui/SurfaceComposerClient.cpp | |
@@ -699,6 +699,14 @@ status_t ScreenshotClient::capture( | |
uint32_t minLayerZ, uint32_t maxLayerZ) { | |
sp<ISurfaceComposer> s(ComposerService::getComposerService()); | |
if (s == NULL) return NO_INIT; | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ int format = 0; | |
+ producer->query(NATIVE_WINDOW_FORMAT,&format); | |
+ if (format == PIXEL_FORMAT_RGBA_8888) { | |
+ /* For some reason, this format fails badly */ | |
+ return BAD_VALUE; | |
+ } | |
+#endif | |
return s->captureScreen(display, producer, | |
reqWidth, reqHeight, minLayerZ, maxLayerZ, | |
SS_CPU_CONSUMER); | |
@@ -734,6 +742,19 @@ status_t ScreenshotClient::update(const sp<IBinder>& display, | |
uint32_t minLayerZ, uint32_t maxLayerZ) { | |
sp<ISurfaceComposer> s(ComposerService::getComposerService()); | |
if (s == NULL) return NO_INIT; | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ int ret = -1; | |
+ mHeap = 0; | |
+ ret = s->captureScreen(display, &mHeap, | |
+ &mBuffer.width, &mBuffer.height, reqWidth, reqHeight, | |
+ minLayerZ, maxLayerZ); | |
+ if (ret == NO_ERROR) { | |
+ mBuffer.format = PIXEL_FORMAT_RGBA_8888; | |
+ mBuffer.stride = mBuffer.width; | |
+ mBuffer.data = (uint8_t *)mHeap->getBase(); | |
+ } | |
+ return ret; | |
+#else | |
sp<CpuConsumer> cpuConsumer = getCpuConsumer(); | |
if (mHaveBuffer) { | |
@@ -752,6 +773,7 @@ status_t ScreenshotClient::update(const sp<IBinder>& display, | |
} | |
} | |
return err; | |
+#endif | |
} | |
status_t ScreenshotClient::update(const sp<IBinder>& display) { | |
@@ -764,12 +786,16 @@ status_t ScreenshotClient::update(const sp<IBinder>& display, | |
} | |
void ScreenshotClient::release() { | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ mHeap = 0; | |
+#else | |
if (mHaveBuffer) { | |
mCpuConsumer->unlockBuffer(mBuffer); | |
memset(&mBuffer, 0, sizeof(mBuffer)); | |
mHaveBuffer = false; | |
} | |
mCpuConsumer.clear(); | |
+#endif | |
} | |
void const* ScreenshotClient::getPixels() const { | |
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk | |
index e33daa2..807c149 100644 | |
--- a/services/surfaceflinger/Android.mk | |
+++ b/services/surfaceflinger/Android.mk | |
@@ -60,6 +60,10 @@ ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true) | |
LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK | |
endif | |
+ifeq ($(BOARD_USE_MHEAP_SCREENSHOT),true) | |
+ LOCAL_CFLAGS += -DUSE_MHEAP_SCREENSHOT | |
+endif | |
+ | |
# See build/target/board/generic/BoardConfig.mk for a description of this setting. | |
ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),) | |
LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS) | |
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp | |
index 02c8f9b..dc14bdc 100644 | |
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp | |
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp | |
@@ -1178,13 +1178,18 @@ public: | |
//getLayer()->compositionType = HWC_FRAMEBUFFER; | |
} | |
virtual void setPlaneAlpha(uint8_t alpha) { | |
+// CAPRI_HWC does not respect planeAlpha despite being v1.2 | |
+#ifndef CAPRI_HWC | |
if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_2)) { | |
getLayer()->planeAlpha = alpha; | |
} else { | |
+#endif | |
if (alpha < 0xFF) { | |
getLayer()->flags |= HWC_SKIP_LAYER; | |
} | |
+#ifndef CAPRI_HWC | |
} | |
+#endif | |
} | |
virtual void setDefaultState() { | |
hwc_layer_1_t* const l = getLayer(); | |
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp | |
index 73b3f84..547e315 100644 | |
--- a/services/surfaceflinger/Layer.cpp | |
+++ b/services/surfaceflinger/Layer.cpp | |
@@ -1183,6 +1183,8 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const | |
void Layer::updateTransformHint(const sp<const DisplayDevice>& hw) const { | |
uint32_t orientation = 0; | |
+// CAPRI_HWC has display problem in landscape mode when transform is used | |
+#ifndef CAPRI_HWC | |
if (!mFlinger->mDebugDisableTransformHint) { | |
// The transform hint is used to improve performance, but we can | |
// only have a single transform hint, it cannot | |
@@ -1193,6 +1195,7 @@ void Layer::updateTransformHint(const sp<const DisplayDevice>& hw) const { | |
orientation = 0; | |
} | |
} | |
+#endif | |
mSurfaceFlingerConsumer->setTransformHint(orientation); | |
} | |
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp | |
index 3842d9c..9f102a8 100644 | |
--- a/services/surfaceflinger/SurfaceFlinger.cpp | |
+++ b/services/surfaceflinger/SurfaceFlinger.cpp | |
@@ -23,6 +23,9 @@ | |
#include <dlfcn.h> | |
#include <EGL/egl.h> | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+#include <GLES/gl.h> | |
+#endif | |
#include <cutils/log.h> | |
#include <cutils/properties.h> | |
@@ -1105,6 +1108,7 @@ void SurfaceFlinger::setUpHWComposer() { | |
sp<const DisplayDevice> hw(mDisplays[dpy]); | |
const int32_t id = hw->getHwcDisplayId(); | |
if (id >= 0) { | |
+#ifdef QCOM_HARDWARE | |
// Get the layers in the current drawying state | |
const LayerVector& layers(mDrawingState.layersSortedByZ); | |
bool freezeSurfacePresent = false; | |
@@ -1124,6 +1128,7 @@ void SurfaceFlinger::setUpHWComposer() { | |
} | |
} | |
} | |
+#endif | |
const Vector< sp<Layer> >& currentLayers( | |
hw->getVisibleLayersSortedByZ()); | |
@@ -1137,6 +1142,7 @@ void SurfaceFlinger::setUpHWComposer() { | |
*/ | |
const sp<Layer>& layer(currentLayers[i]); | |
layer->setPerFrameData(hw, *cur); | |
+#ifdef QCOM_HARDWARE | |
if(freezeSurfacePresent) { | |
// if freezeSurfacePresent, set ANIMATING flag | |
cur->setAnimating(true); | |
@@ -1157,6 +1163,7 @@ void SurfaceFlinger::setUpHWComposer() { | |
} | |
} | |
} | |
+#endif | |
} | |
} | |
} | |
@@ -2792,6 +2799,9 @@ status_t SurfaceFlinger::onTransact( | |
const int pid = ipc->getCallingPid(); | |
const int uid = ipc->getCallingUid(); | |
if ((uid != AID_GRAPHICS) && | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ (uid != AID_SYSTEM) && | |
+#endif | |
!PermissionCache::checkPermission(sAccessSurfaceFlinger, pid, uid)) { | |
ALOGE("Permission Denial: " | |
"can't access SurfaceFlinger pid=%d, uid=%d", pid, uid); | |
@@ -2800,6 +2810,9 @@ status_t SurfaceFlinger::onTransact( | |
break; | |
} | |
case CAPTURE_SCREEN: | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ case CAPTURE_SCREEN_DEPRECATED: | |
+#endif | |
{ | |
// codes that require permission check | |
IPCThreadState* ipc = IPCThreadState::self(); | |
@@ -3043,9 +3056,18 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display, | |
Mutex::Autolock _l(flinger->mStateLock); | |
sp<const DisplayDevice> hw(flinger->getDisplayDevice(display)); | |
bool useReadPixels = this->useReadPixels && !flinger->mGpuToCpuSupported; | |
- result = flinger->captureScreenImplLocked(hw, | |
- producer, reqWidth, reqHeight, minLayerZ, maxLayerZ, | |
- useReadPixels); | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ if (!useReadPixels) { | |
+#endif | |
+ result = flinger->captureScreenImplLocked(hw, | |
+ producer, reqWidth, reqHeight, minLayerZ, maxLayerZ, | |
+ useReadPixels); | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ } else { | |
+ // Should never get here | |
+ return BAD_VALUE; | |
+ } | |
+#endif | |
static_cast<GraphicProducerWrapper*>(producer->asBinder().get())->exit(result); | |
return true; | |
} | |
@@ -3140,6 +3162,11 @@ status_t SurfaceFlinger::captureScreenImplLocked( | |
{ | |
ATRACE_CALL(); | |
+// Rotation artifact problems when useReadPixels is false | |
+#ifdef CAPRI_HWC | |
+ useReadPixels = true; | |
+#endif | |
+ | |
// get screen geometry | |
const uint32_t hw_w = hw->getWidth(); | |
const uint32_t hw_h = hw->getHeight(); | |
@@ -3278,6 +3305,108 @@ void SurfaceFlinger::checkScreenshot(size_t w, size_t s, size_t h, void const* v | |
} | |
} | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+status_t SurfaceFlinger::captureScreenImplCpuConsumerLocked( | |
+ const sp<const DisplayDevice>& hw, | |
+ sp<IMemoryHeap>* heap, uint32_t* w, uint32_t* h, | |
+ uint32_t reqWidth, uint32_t reqHeight, | |
+ uint32_t minLayerZ, uint32_t maxLayerZ) | |
+{ | |
+ ATRACE_CALL(); | |
+ | |
+ // get screen geometry | |
+ const uint32_t hw_w = hw->getWidth(); | |
+ const uint32_t hw_h = hw->getHeight(); | |
+ | |
+ if ((reqWidth > hw_w) || (reqHeight > hw_h)) { | |
+ ALOGE("size mismatch (%d, %d) > (%d, %d)", | |
+ reqWidth, reqHeight, hw_w, hw_h); | |
+ return BAD_VALUE; | |
+ } | |
+ | |
+ reqWidth = (!reqWidth) ? hw_w : reqWidth; | |
+ reqHeight = (!reqHeight) ? hw_h : reqHeight; | |
+ | |
+ status_t result = NO_ERROR; | |
+ | |
+ renderScreenImplLocked(hw, reqWidth, reqHeight, minLayerZ, maxLayerZ, true); | |
+ | |
+ size_t size = reqWidth * reqHeight * 4; | |
+ // allocate shared memory large enough to hold the | |
+ // screen capture | |
+ sp<MemoryHeapBase> base( | |
+ new MemoryHeapBase(size, 0, "screen-capture") ); | |
+ void *vaddr = base->getBase(); | |
+ glReadPixels(0, 0, reqWidth, reqHeight, | |
+ GL_RGBA, GL_UNSIGNED_BYTE, vaddr); | |
+ if (glGetError() == GL_NO_ERROR) { | |
+ *heap = base; | |
+ *w = reqWidth; | |
+ *h = reqHeight; | |
+ result = NO_ERROR; | |
+ } else { | |
+ result = INVALID_OPERATION; | |
+ } | |
+ | |
+ return result; | |
+} | |
+ | |
+status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display, | |
+ sp<IMemoryHeap>* heap, | |
+ uint32_t* outWidth, uint32_t* outHeight, | |
+ uint32_t reqWidth, uint32_t reqHeight, | |
+ uint32_t minLayerZ, uint32_t maxLayerZ) | |
+{ | |
+ if (CC_UNLIKELY(display == 0)) | |
+ return BAD_VALUE; | |
+ | |
+ class MessageCaptureScreen : public MessageBase { | |
+ SurfaceFlinger* flinger; | |
+ sp<IBinder> display; | |
+ sp<IMemoryHeap>* heap; | |
+ uint32_t* outWidth; | |
+ uint32_t* outHeight; | |
+ uint32_t reqWidth; | |
+ uint32_t reqHeight; | |
+ uint32_t minLayerZ; | |
+ uint32_t maxLayerZ; | |
+ status_t result; | |
+ public: | |
+ MessageCaptureScreen(SurfaceFlinger* flinger, | |
+ const sp<IBinder>& display, sp<IMemoryHeap>* heap, | |
+ uint32_t* outWidth, uint32_t* outHeight, | |
+ uint32_t reqWidth, uint32_t reqHeight, | |
+ uint32_t minLayerZ, uint32_t maxLayerZ) | |
+ : flinger(flinger), display(display), heap(heap), | |
+ outWidth(outWidth), outHeight(outHeight), | |
+ reqWidth(reqWidth), reqHeight(reqHeight), | |
+ minLayerZ(minLayerZ), maxLayerZ(maxLayerZ), | |
+ result(PERMISSION_DENIED) | |
+ { | |
+ } | |
+ status_t getResult() const { | |
+ return result; | |
+ } | |
+ virtual bool handler() { | |
+ Mutex::Autolock _l(flinger->mStateLock); | |
+ sp<const DisplayDevice> hw(flinger->getDisplayDevice(display)); | |
+ result = flinger->captureScreenImplCpuConsumerLocked(hw, heap, | |
+ outWidth, outHeight, | |
+ reqWidth, reqHeight, minLayerZ, maxLayerZ); | |
+ return true; | |
+ } | |
+ }; | |
+ | |
+ sp<MessageBase> msg = new MessageCaptureScreen(this, display, heap, | |
+ outWidth, outHeight, reqWidth, reqHeight, minLayerZ, maxLayerZ); | |
+ status_t res = postMessageSync(msg); | |
+ if (res == NO_ERROR) { | |
+ res = static_cast<MessageCaptureScreen*>( msg.get() )->getResult(); | |
+ } | |
+ return res; | |
+} | |
+#endif | |
+ | |
// --------------------------------------------------------------------------- | |
SurfaceFlinger::LayerVector::LayerVector() { | |
@@ -3324,6 +3453,7 @@ SurfaceFlinger::DisplayDeviceState::DisplayDeviceState(DisplayDevice::DisplayTyp | |
}; // namespace android | |
+#ifndef USE_MHEAP_SCREENSHOT | |
#if defined(__gl_h_) | |
#error "don't include gl/gl.h in this file" | |
#endif | |
@@ -3331,3 +3461,4 @@ SurfaceFlinger::DisplayDeviceState::DisplayDeviceState(DisplayDevice::DisplayTyp | |
#if defined(__gl2_h_) | |
#error "don't include gl2/gl2.h in this file" | |
#endif | |
+#endif | |
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h | |
index 8c28962..ada2914 100644 | |
--- a/services/surfaceflinger/SurfaceFlinger.h | |
+++ b/services/surfaceflinger/SurfaceFlinger.h | |
@@ -208,6 +208,11 @@ private: | |
const sp<IGraphicBufferProducer>& producer, | |
uint32_t reqWidth, uint32_t reqHeight, | |
uint32_t minLayerZ, uint32_t maxLayerZ, bool isCpuConsumer); | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ virtual status_t captureScreen(const sp<IBinder>& display, sp<IMemoryHeap>* heap, | |
+ uint32_t* width, uint32_t* height, uint32_t reqWidth, | |
+ uint32_t reqHeight, uint32_t minLayerZ, uint32_t maxLayerZ); | |
+#endif | |
// called when screen needs to turn off | |
virtual void blank(const sp<IBinder>& display); | |
// called when screen is turning back on | |
@@ -324,6 +329,14 @@ private: | |
uint32_t minLayerZ, uint32_t maxLayerZ, | |
bool useReadPixels); | |
+#ifdef USE_MHEAP_SCREENSHOT | |
+ status_t captureScreenImplCpuConsumerLocked( | |
+ const sp<const DisplayDevice>& hw, | |
+ sp<IMemoryHeap>* heap, uint32_t* width, uint32_t* height, | |
+ uint32_t reqWidth, uint32_t reqHeight, | |
+ uint32_t minLayerZ, uint32_t maxLayerZ); | |
+#endif | |
+ | |
/* ------------------------------------------------------------------------ | |
* EGL | |
*/ |
From 9ea34a45b82771a564ba9549752d152fbd529acf Mon Sep 17 00:00:00 2001 | |
From: Pawit Pornkitprasan <p.pawit@gmail.com> | |
Date: Tue, 10 Dec 2013 20:09:12 +0700 | |
Subject: [PATCH] libbt: switch to N_BRCM_HCI line disclipline for userial | |
ioctl | |
Change-Id: I12c297c6b26fc0cb6f0a36ed8f5d04d4d36a4092 | |
--- | |
src/userial_vendor.c | 11 +++++++++++ | |
1 file changed, 11 insertions(+) | |
diff --git a/src/userial_vendor.c b/src/userial_vendor.c | |
index 5233d19..86d98e8 100755 | |
--- a/src/userial_vendor.c | |
+++ b/src/userial_vendor.c | |
@@ -183,6 +183,10 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) | |
uint16_t parity; | |
uint8_t stop_bits; | |
+#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) | |
+ int ldisc; | |
+#endif | |
+ | |
vnd_userial.fd = -1; | |
if (!userial_to_tcio_baud(p_cfg->baud, &baud)) | |
@@ -252,6 +256,13 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) | |
tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios); | |
#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) | |
+ // TODO: check for breakage on tuna (Galaxy Nexus). It defines this, | |
+ // but does not contain the kernel code to support it. | |
+ | |
+ // Switch to N_BRCM_HCI line disclipline for ioctl to work | |
+ ldisc = 25; // N_BRCM_HCI | |
+ ioctl(vnd_userial.fd, TIOCSETD, &ldisc); | |
+ | |
userial_ioctl_init_bt_wake(vnd_userial.fd); | |
#endif | |
-- | |
1.8.3.4 (Apple Git-47) | |
From 302a0f17846371ebbc34cd3600ff34ff8f5d66a4 Mon Sep 17 00:00:00 2001 | |
From: Shubhang <shubhang92@gmail.com> | |
Date: Sun, 13 Apr 2014 15:07:59 +0530 | |
Subject: [PATCH] add vendor tools | |
--- | |
tools/changelog | 32 +++++++++++ | |
tools/functions | 15 ++++++ | |
tools/getdate | 2 + | |
tools/opticharger | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++ | |
tools/squisher | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
5 files changed, 354 insertions(+) | |
create mode 100755 tools/changelog | |
create mode 100755 tools/functions | |
create mode 100755 tools/getdate | |
create mode 100755 tools/opticharger | |
create mode 100755 tools/squisher | |
diff --git a/tools/changelog b/tools/changelog | |
new file mode 100755 | |
index 0000000..59dd665 | |
--- /dev/null | |
+++ b/tools/changelog | |
@@ -0,0 +1,32 @@ | |
+#!/bin/sh | |
+ | |
+# Exports | |
+export Changelog=changelog.txt | |
+ | |
+if [ -f $Changelog ]; | |
+then | |
+ rm -f $Changelog | |
+fi | |
+ | |
+touch $Changelog | |
+ | |
+# Print something to build output | |
+echo "Generating changelog..." | |
+ | |
+for i in $(seq 7); | |
+do | |
+export After_Date=`date --date="$i days ago" +%d-%m-%Y` | |
+k=$(expr $i - 1) | |
+ export Until_Date=`date --date="$k days ago" +%d-%m-%Y` | |
+ | |
+ # Line with after --- until was too long for a small ListView | |
+ echo '-- ' $Until_Date >> $Changelog | |
+ echo >> $Changelog; | |
+ | |
+ # Cycle through every repo to find commits between 2 dates | |
+ repo forall -pc 'git log --format="| Commit: %h | Title: %s | By: %an " --reverse --after=$After_Date --until=$Until_Date' >> $Changelog | |
+ echo >> $Changelog; | |
+done | |
+ | |
+# Let squisher handle the zipping part | |
+cp $Changelog $OUT/repack.d/ota/ | |
diff --git a/tools/functions b/tools/functions | |
new file mode 100755 | |
index 0000000..30ef005 | |
--- /dev/null | |
+++ b/tools/functions | |
@@ -0,0 +1,15 @@ | |
+#!/bin/bash | |
+# Common functions for CM otatools | |
+# | |
+# cdesai | |
+ | |
+if [ ! "$BUILD_WITH_COLORS" = "0" ]; | |
+then | |
+CL_RED="\033[31m" | |
+CL_GRN="\033[32m" | |
+CL_YLW="\033[33m" | |
+CL_BLU="\033[34m" | |
+CL_MAG="\033[35m" | |
+CL_CYN="\033[36m" | |
+CL_RST="\033[0m" | |
+fi | |
diff --git a/tools/getdate b/tools/getdate | |
new file mode 100755 | |
index 0000000..cfb662d | |
--- /dev/null | |
+++ b/tools/getdate | |
@@ -0,0 +1,2 @@ | |
+#!/bin/sh | |
+LC_ALL=C date +%Y-%m-%d | |
diff --git a/tools/opticharger b/tools/opticharger | |
new file mode 100755 | |
index 0000000..a8998b8 | |
--- /dev/null | |
+++ b/tools/opticharger | |
@@ -0,0 +1,148 @@ | |
+#!/bin/sh | |
+# | |
+# Super-mega opticharger of doom | |
+# Shrinks apks by running pngcrush or optipng or pngout on png images | |
+# | |
+# Point APKCERTS at the full path to a generated apkcerts.txt file | |
+# | |
+# cyanogen - shade@chemlab.org | |
+# ChrisSoyars - me@ctso.me | |
+ | |
+set -e | |
+QUIET=1 | |
+BASE=`pwd` | |
+BRUTECRUSH="-brute" | |
+TMPDIR=/tmp/opticharge-$$ | |
+. $ANDROID_BUILD_TOP/vendor/cm/tools/functions | |
+ | |
+if [ -z "$BRUTE_PNGCRUSH" ] | |
+then | |
+ BRUTECRUSH="" | |
+fi | |
+ | |
+if [ "$APKCERTS" = "" ]; | |
+then | |
+ if [ "$TARGET_BUILD_VARIANT" = "userdebug" ]; then | |
+ TARGET_BUILD_VARIANT="eng" | |
+ elif [ "$TARGET_BUILD_VARIANT" = "user" ]; then | |
+ TARGET_BUILD_VARIANT="eng" | |
+ fi | |
+ | |
+ APKCERTS=$OUT/obj/PACKAGING/target_files_intermediates/$TARGET_PRODUCT-target_files-$TARGET_BUILD_VARIANT.$USER/META/apkcerts.txt | |
+ if [ ! -f "$APKCERTS" ]; | |
+ then | |
+ echo $CL_RED"Set APKCERTS to the path to your apkcerts.txt file"$CL_RST | |
+ exit 1; | |
+ fi | |
+fi | |
+ | |
+if [ ! -f "$APKCERTS" ]; | |
+then | |
+ echo $CL_RED"Invalid path to apkcerts.txt, set APKCERTS to the correct path."$CL_RST | |
+fi | |
+ | |
+if [ "$(which pngcrush)" != "" ]; | |
+then | |
+ optimize_png () { | |
+ pngcrush -q ${BRUTECRUSH} $1 ${1}.out 1> /dev/null 2> /dev/null | |
+ mv ${1}.out ${1} | |
+ } | |
+elif [ "$(which optipng)" != "" ]; | |
+then | |
+ optimize_png () { | |
+ optipng -o7 -quiet $1 1> /dev/null 2> /dev/null | |
+ } | |
+elif [ "$(which pngout-static)" != "" ]; | |
+then | |
+ optimize_png () { | |
+ pngout-static $1 | |
+ } | |
+elif [ "$(which pngout)" != "" ]; | |
+then | |
+ optimize_png () { | |
+ pngout $1 | |
+ } | |
+else | |
+ echo $CL_RED"Please install pngcrush, optipng, or pngout"$CL_RST | |
+ exit 1; | |
+fi | |
+ | |
+if [ "`which aapt`" = "" ]; | |
+then | |
+ echo $CL_RED"Please ensure aapt is in your \$PATH"$CL_RST | |
+ exit 1; | |
+fi | |
+ | |
+if [ "`which zipalign`" = "" ]; | |
+then | |
+ echo $CL_RED"Please ensure zipalign is in your \$PATH"$CL_RST | |
+ exit 1; | |
+fi | |
+ | |
+if [ -e "$1" ]; | |
+then | |
+ NAME=`basename $1`; | |
+ echo $CL_YLW"Optimize:"$CL_RST" $NAME.."; | |
+ | |
+ if [ "$2" != "" ]; | |
+ then | |
+ CERT=build/target/product/security/$2.x509.pem | |
+ KEY=build/target/product/security/$2.pk8 | |
+ if [ ! -f "$ANDROID_BUILD_TOP/$CERT" ]; | |
+ then | |
+ echo $CL_RED"$CERT does not exist!"$CL_RST; | |
+ exit 1; | |
+ fi | |
+ else | |
+ APKINFO=`grep "name=\"$NAME\"" $APKCERTS`; | |
+ [ $QUIET ] || echo "APKINFO: $APKINFO"; | |
+ if [ "$APKINFO" = "" ]; | |
+ then | |
+ echo $CL_RED"No apk info for $NAME"$CL_RST; | |
+ exit 1; | |
+ fi | |
+ CERT=`echo $APKINFO | awk {'print $2'} | cut -f 2 -d "=" | tr -d "\""`; | |
+ KEY=`echo $APKINFO | awk {'print $3'} | cut -f 2 -d "=" | tr -d "\""`; | |
+ if [ "$CERT" = "" ]; | |
+ then | |
+ echo $CL_RED"Unable to find certificate for $NAME"$CL_RST | |
+ exit 1; | |
+ fi | |
+ if [ "$CERT" = "PRESIGNED" ]; | |
+ then | |
+ echo $CL_YLW"$NAME is presigned, skipping"$CL_RST | |
+ exit 1; | |
+ fi | |
+ fi | |
+ | |
+ [ $QUIET ] || echo $CL_YLW"Certificate:"$CL_RST" $CERT"; | |
+ | |
+ [ -d $TMPDIR/$NAME ] && rm -rf $TMPDIR/$NAME | |
+ mkdir -p $TMPDIR/$NAME | |
+ trap "rm -rf $TMPDIR; exit" INT TERM EXIT | |
+ cd $TMPDIR/$NAME | |
+ unzip -q $BASE/$1 | |
+ for x in `find . -name "*.png" | grep -v "\.9.png$" | tr "\n" " "` | |
+ do | |
+ [ $QUIET ] || echo $CL_YLW"Crushing $x"$CL_RST | |
+ optimize_png $x | |
+ done | |
+ cp $BASE/$1 $BASE/$1.old | |
+ | |
+ [ $QUIET ] || echo $CL_YLW"Repacking apk.."$CL_RST | |
+ aapt p -0 .dat -0 .dict -0 .arsc -F $NAME . | |
+ | |
+ [ $QUIET ] || echo $CL_YLW"Resigning with cert: `echo $CERT`"$CL_RST | |
+ | |
+ [ $QUIET ] || echo java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME | |
+ java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME | |
+ [ $QUIET ] || echo $CL_YLW"Zipaligning.."$CL_RST | |
+ zipalign -f 4 signed_$NAME $BASE/$1 | |
+ if [ ! $QUIET ]; then | |
+ ls -l $BASE/$1.old | |
+ ls -l $BASE/$1 | |
+ fi | |
+ rm $BASE/$1.old | |
+else | |
+ echo "Usage: $0 [apk file]" | |
+fi | |
diff --git a/tools/squisher b/tools/squisher | |
new file mode 100755 | |
index 0000000..b62d87d | |
--- /dev/null | |
+++ b/tools/squisher | |
@@ -0,0 +1,157 @@ | |
+#!/bin/sh | |
+# | |
+# Squish a CM otapackage for distribution | |
+# cyanogen | |
+# | |
+. $ANDROID_BUILD_TOP/vendor/cm/tools/functions | |
+ | |
+BUILD_DATE=`date +%Y%m%d` | |
+OUT_TARGET_HOST=`uname -a | grep Darwin` | |
+if [ -z "$OUT_TARGET_HOST" ] | |
+then | |
+ OUT_TARGET_HOST=linux-x86 | |
+ MD5=md5sum | |
+ XARGS="xargs --max-args=1 --max-procs `grep 'processor' /proc/cpuinfo|wc -l`" | |
+ SED=sed | |
+else | |
+ OUT_TARGET_HOST=darwin-x86 | |
+ MD5=md5 | |
+ XARGS="xargs -n 1 -P `sysctl hw.ncpu | awk '{print $2}'`" | |
+ SED=gsed | |
+fi | |
+ | |
+if [ -z "$OUT" -o ! -d "$OUT" ]; then | |
+ echo $CL_RED"ERROR: $0 only works with a full build environment. $OUT should exist."$CL_RST | |
+ exit 1 | |
+fi | |
+ | |
+OPTICHARGER=$ANDROID_BUILD_TOP/vendor/cm/tools/opticharger | |
+QUIET=-q | |
+DELETE_BINS="applypatch applypatch_static check_prereq recovery updater" | |
+DELETE_LIBS="libc_malloc_debug_leak.so libc_malloc_debug_qemu.so" | |
+DELETE_FONTS="MTLmr3m.ttf" | |
+DELETE_MEDIA="*.qmg" | |
+ | |
+REPACK=$OUT/repack.d | |
+printf "Sanitizing Environment..." | |
+rm -rf $REPACK | |
+mkdir -p $REPACK | |
+echo | |
+ | |
+ | |
+# Unpack the otapackage and opticharge all apks | |
+mkdir $REPACK/ota | |
+( | |
+cd $REPACK/ota | |
+printf "Unpacking $OTAPACKAGE..." | |
+unzip $QUIET $OTAPACKAGE | |
+echo | |
+ | |
+# Move all apks to the same directory so xargs can | |
+# use also with framework-res.apk. This allow process | |
+# framework-res.apk in parallel with other apks | |
+mkdir -p $REPACK/parallel | |
+cd $REPACK/parallel | |
+cp $REPACK/ota/system/framework/framework-res.apk . | |
+cp $REPACK/ota/system/app/*.apk . | |
+ | |
+# Do optimization in parallel | |
+find ./ -name \*.apk | $XARGS $OPTICHARGER | |
+ | |
+# Move optimized apks to repack directory | |
+mv -f $REPACK/parallel/framework-res.apk $REPACK/ota/system/framework/framework-res.apk | |
+mv -f $REPACK/parallel/*.apk $REPACK/ota/system/app/ | |
+ | |
+# Optimize /priv-app/ | |
+cp $REPACK/ota/system/priv-app/*.apk . | |
+find ./ -name \*.apk | $XARGS $OPTICHARGER | |
+mv -f $REPACK/parallel/*.apk $REPACK/ota/system/priv-app/ | |
+ | |
+# Return to directory | |
+cd $REPACK/ota | |
+rm -rf $REPACK/parallel | |
+) | |
+ | |
+# Fix build.prop | |
+$SED -i \ | |
+ -e '/ro\.kernel\.android\.checkjni/d' \ | |
+ -e '/ro\.build\.type/s/eng/user/' \ | |
+ $REPACK/ota/system/build.prop | |
+ | |
+# Determine what to name the new signed package | |
+MODVERSION=`sed -n -e'/ro\.rr_modversion/s/^.*=//p' $OUT/system/build.prop` | |
+TARGET_PRODUCT_FINAL=`echo $TARGET_PRODUCT | cut -d '_' -f2` | |
+echo $CL_CYN"MODVERSION: $MODVERSION"$CL_RST | |
+OUTFILE=$OUT/$MODVERSION-$BUILD_DATE-$TARGET_PRODUCT_FINAL.zip | |
+ | |
+# Delete unnecessary binaries | |
+( cd $REPACK/ota/system/bin; echo $DELETE_BINS | xargs rm -f; ) | |
+ | |
+# Delete unnecessary libraries | |
+( cd $REPACK/ota/system/lib; echo $DELETE_LIBS | xargs rm -f; ) | |
+ | |
+# Delete Offline charging mode files | |
+( cd $REPACK/ota/system/media; echo $DELETE_MEDIA | xargs rm -f; ) | |
+ | |
+if [ "$TARGET_PRODUCT_FINAL" != "infuse4g" ] | |
+then | |
+# No need for modem.bin | |
+rm -f $REPACK/ota/modem.bin | |
+fi | |
+ | |
+# No need for media/video | |
+rm -rf $REPACK/ota/system/media/video | |
+ | |
+# Delete Unnecessary Fonts | |
+( cd $REPACK/ota/system/fonts; echo $DELETE_FONTS | xargs rm -f; ) | |
+ | |
+# No need for tts | |
+rm -rf $REPACK/ota/system/tts | |
+ | |
+# No need for srec | |
+rm -rf $REPACK/ota/system/usr/srec | |
+ | |
+# No need for recovery | |
+rm -rf $REPACK/ota/recovery | |
+rm -rf $REPACK/ota/system/etc/recovery-resource.dat | |
+ | |
+# Strip modules | |
+[ -d $REPACK/ota/system/lib/modules ] && \ | |
+ find $REPACK/ota/system/lib/modules -name "*.ko" -print0 | xargs -0 arm-eabi-strip --strip-unneeded | |
+ | |
+if [ "$CARBON_CHANGELOG" = true ] | |
+then | |
+# Add changelog | |
+. $ANDROID_BUILD_TOP/vendor/cm/tools/changelog | |
+else | |
+printf "No changelog..." | |
+echo | |
+fi | |
+ | |
+# Pack it up and sign | |
+printf "Zipping package..." | |
+( cd $REPACK/ota; zip $QUIET -r $REPACK/update.zip . ) | |
+echo | |
+printf "Signing package..." | |
+SECURITYDIR=$ANDROID_BUILD_TOP/build/target/product/security | |
+java -Xmx1024m \ | |
+ -jar $OUT/../../../host/$OUT_TARGET_HOST/framework/signapk.jar \ | |
+ -w $SECURITYDIR/testkey.x509.pem $SECURITYDIR/testkey.pk8 \ | |
+ $REPACK/update.zip $OUTFILE | |
+echo | |
+printf "Cleaning up..." | |
+rm -rf $REPACK | |
+echo | |
+ | |
+# Create a md5 checksum image of the repacked package | |
+( | |
+img=`basename $OUTFILE` | |
+cd `dirname $OUTFILE` | |
+$MD5 $img >$img.md5sum | |
+echo | |
+echo $CL_GRN"Package complete: $OUTFILE"$CL_RST | |
+echo $CL_GRN"md5: $(cat $img.md5sum | awk '{ print $1 }')"$CL_RST | |
+echo | |
+) | |
+ | |
+exit 0 | |
-- | |
1.9.2 | |