From 7d6a702e8eb67ae7a4ade66a716a9229ea76639b Mon Sep 17 00:00:00 2001 From: ghsr Date: Wed, 28 Oct 2015 13:52:28 +0600 Subject: [PATCH] Update build_tools for CM-13.0 --- README | 14 +- build | 25 +- patch | 4 +- patches/bootable_recovery.patch | 31 - patches/frameworks_av.patch | 163 ++--- patches/frameworks_base.patch | 142 +++- patches/frameworks_native.patch | 585 +++++++++++++++- patches/frameworks_opt_telephony.patch | 795 +++++++++++++++++++++- patches/hardware_broadcom_libbt.patch | 11 +- patches/packages_apps_Camera2.patch | 33 +- patches/packages_apps_Trebuchet.patch | 94 +-- patches/packages_services_Telephony.patch | 76 ++- patches/system_core.patch | 264 ++++++- patches/vendor_cm.patch | 24 - resync | 1 + 15 files changed, 1926 insertions(+), 336 deletions(-) delete mode 100644 patches/bootable_recovery.patch delete mode 100644 patches/vendor_cm.patch diff --git a/README b/README index 482c565..9797a0b 100644 --- a/README +++ b/README @@ -1,15 +1,19 @@ -Scripts and patches to build ROMs for S II Plus +Scripts and patches to build ROMs for Samsung Galaxy S2 Plus and Samsung Galaxy Mega 5.8 +================================== How to get: -Run "git clone https://github.com/andixlm/android_build-tools_galaxys2plus-common build-tools" in root of ROM sources directory. +------------- +Run "git clone https://github.com/ghsr/build_tools.git -b cm-13.0" in root of ROM sources directory. Description of scripts: +------------- resync - reset all changes in ROM sources, sync and get prebuilts. Use "-o" to reset changes only. ----------- + patch - patch ROM sources. ----------- -build - build ROM. It asks for cleaning of out directory (make clean) and device (i9105 or i9105p), then build for chosen device. Also it handles 1st option ("i9105" or "i9105p" or "s2plus"). To build with cleaning use "-c" as a 2nd option. To build boot image (or recovery image) for device defined in 1st option w/o whole ROM building use 2nd option "-b" ("-r" for recovery). + +build - build ROM. It asks for cleaning of out directory (make clean) and device (i9105 or i9105p or i9152), then build for chosen device. Also it handles 1st option ("i9105" or "i9105p" or "s2plus" or "i9152"). To build with cleaning use "-c" as a 2nd option. To build boot image (or recovery image) for device defined in 1st option w/o whole ROM building use 2nd option "-b" ("-r" for recovery). Credits: +------------- pawitp - patches luk1337 - initial implementation of scripts diff --git a/build b/build index 3c8a6f3..a051af3 100755 --- a/build +++ b/build @@ -1,8 +1,5 @@ #!/bin/bash -# Get start time -start_time=$(date +"%s") - cd .. export USE_CCACHE=1 @@ -41,6 +38,10 @@ case "$1" in DEVICE='i9105 i9105p' FAST=1 ;; + i9152 ) + DEVICE=$1 + FAST=1 + ;; "" ) ;; * ) @@ -128,27 +129,13 @@ if [[ !($FAST) ]]; then make clean fi - echo -n 'Device? (i9105 or i9105p): ' + echo -n 'Device? (i9105 or i9105p or i9152): ' read DEVICE # Check if given proper device DNAME - if [[ $DEVICE != i9105 && $DEVICE != i9105p ]]; then + if [[ $DEVICE != i9105 && $DEVICE != i9105p && $DEVICE != i9152 ]]; then echo Unknown device DNAME: $DEVICE exit 0 fi build_rom fi - -# Calculate elapsed time -end_time=$(date +"%s") -tdiff=$(($end_time-$start_time)) -hours=$(($tdiff / 3600 )) -mins=$((($tdiff % 3600) / 60)) -secs=$(($tdiff % 60)) - -# Print elapsed time -tput setaf 2 -echo "" -printf "Elapsed time: %02g:%02g:%02g" $hours $mins $secs -echo "" -tput sgr0 diff --git a/patch b/patch index 480890e..05f4793 100755 --- a/patch +++ b/patch @@ -4,9 +4,8 @@ cd .. COUNT=0 CURRENT_DIR="$PWD" -PD="build-tools/patches" +PD="build_tools/patches" PATCHES=( -'bootable/recovery bootable_recovery.patch' 'frameworks/av frameworks_av.patch' 'frameworks/base frameworks_base.patch' 'frameworks/native frameworks_native.patch' @@ -16,7 +15,6 @@ PATCHES=( 'packages/apps/Trebuchet packages_apps_Trebuchet.patch' 'packages/services/Telephony packages_services_Telephony.patch' 'system/core system_core.patch' -'vendor/cm vendor_cm.patch' ) while [ "x${PATCHES[COUNT]}" != "x" ] diff --git a/patches/bootable_recovery.patch b/patches/bootable_recovery.patch deleted file mode 100644 index 653f78c..0000000 --- a/patches/bootable_recovery.patch +++ /dev/null @@ -1,31 +0,0 @@ -From be936303368c68a2c6e096c0c56288fdba13779a Mon Sep 17 00:00:00 2001 -From: Pawit Pornkitprasan -Date: Tue, 27 Jan 2015 22:29:39 +0700 -Subject: [PATCH] recovery: uncrypt: fix compatibility with CWM - -CWM and other older recoveries do not support block map, so avoid -using it when possible - -Change-Id: I49a04676ca5193db31c87418a5760727648745f0 ---- - uncrypt/uncrypt.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/uncrypt/uncrypt.c b/uncrypt/uncrypt.c -index 7fb0989..6bc4f51 100644 ---- a/uncrypt/uncrypt.c -+++ b/uncrypt/uncrypt.c -@@ -423,7 +423,10 @@ int main(int argc, char** argv) - // On /data we want to convert the file to a block map so that we - // can read the package without mounting the partition. On /cache - // and /sdcard we leave the file alone. -- if (strncmp(path, "/data/", 6) != 0) { -+ // -+ // HACK: ignore above: block map is only used with encryption device -+ // for compatibility with older recoveries -+ if (!encrypted || strncmp(path, "/data/", 6) != 0) { - // path does not start with "/data/"; leave it alone. - unlink(RECOVERY_COMMAND_FILE_TMP); - } else { --- -2.3.5 diff --git a/patches/frameworks_av.patch b/patches/frameworks_av.patch index 413aeaa..eedf174 100644 --- a/patches/frameworks_av.patch +++ b/patches/frameworks_av.patch @@ -1,7 +1,7 @@ -From 289d290349a792f397346630e85653b656c5b7ac Mon Sep 17 00:00:00 2001 +From e03273b6f903bef6c7743f78261810008343c0a7 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Wed, 24 Apr 2013 11:37:19 +0700 -Subject: [PATCH 1/8] OMXCodec: Re-implement requires-flush-before-shutdown +Subject: [PATCH 1/7] OMXCodec: Re-implement requires-flush-before-shutdown quirk Support is already there, but is not in the codec quirk reading list. @@ -13,27 +13,27 @@ Change-Id: I1beac06af8118dcf0c248b631bc8e6dbbab2c1d5 1 file changed, 3 insertions(+) diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp -index 4c1249f..afe4b5c 100644 +index 3ec02d4..98769ad 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp -@@ -410,6 +410,9 @@ uint32_t OMXCodec::getComponentQuirks( +@@ -269,6 +269,9 @@ uint32_t OMXCodec::getComponentQuirks( if (info->hasQuirk("output-buffers-are-unreadable")) { quirks |= kOutputBuffersAreUnreadable; } + if (info->hasQuirk("requires-flush-before-shutdown")) { + quirks |= kRequiresFlushBeforeShutdown; + } - if (info->hasQuirk("requies-loaded-to-idle-after-allocation")) { - quirks |= kRequiresLoadedToIdleAfterAllocation; - } + + return quirks; + } -- -2.3.5 +2.6.3 -From 4008d970a6c60170c34f7d135bdb969bc52ed6ae Mon Sep 17 00:00:00 2001 +From 86b088628734b320cedfea1b04eb1d975f146c44 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Tue, 17 Dec 2013 13:15:52 +0700 -Subject: [PATCH 2/8] OMXCodec: set default input buffer size +Subject: [PATCH 2/7] 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 @@ -47,12 +47,12 @@ Change-Id: I74372f3d821e41feb38b9bc0cca4ef56aa019493 2 files changed, 24 insertions(+) diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp -index f5a6fbd..b780128 100644 +index eddd7ba..de3be6c 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp -@@ -1913,6 +1913,18 @@ status_t ACodec::configureCodec( - } else if (!strcmp("OMX.Nvidia.aac.decoder", mComponentName.c_str())) { - err = setMinBufferSize(kPortIndexInput, 8192); // XXX +@@ -2208,6 +2208,18 @@ status_t ACodec::configureCodec( + if (rateFloat > 0) { + err = setOperatingRate(rateFloat, video); } +// Capri's OMX fail to set a reasonable default size from width and height +#ifdef CAPRI_HWC @@ -70,10 +70,10 @@ index f5a6fbd..b780128 100644 mBaseOutputFormat = outputFormat; diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp -index afe4b5c..37e8ed6 100644 +index 98769ad..1c81016 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp -@@ -957,6 +957,18 @@ status_t OMXCodec::configureCodec(const sp &meta) { +@@ -677,6 +677,18 @@ status_t OMXCodec::configureCodec(const sp &meta) { if (meta->findInt32(kKeyMaxInputSize, &maxInputSize)) { setMinBufferSize(kPortIndexInput, (OMX_U32)maxInputSize); } @@ -93,13 +93,13 @@ index afe4b5c..37e8ed6 100644 initOutputFormat(meta); -- -2.3.5 +2.6.3 -From ac2e3e93fddb3fe67063dcf4d1c7fc4ee18636f1 Mon Sep 17 00:00:00 2001 +From f0f612927e8544613baf88ace8c8c67795c56760 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Wed, 19 Nov 2014 20:33:58 +0700 -Subject: [PATCH 3/8] ACodec: skip port index checking on vc4 encoder +Subject: [PATCH 3/7] ACodec: skip port index checking on vc4 encoder Change-Id: I3fe742a8ec4b7f9bc0c4e5f0825fd3b88965a95e --- @@ -107,29 +107,29 @@ Change-Id: I3fe742a8ec4b7f9bc0c4e5f0825fd3b88965a95e 1 file changed, 5 insertions(+) diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp -index b780128..1214eed 100644 +index de3be6c..110deb8 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp -@@ -3746,6 +3746,11 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp ¬ify) { - mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)), - (status_t)OK); +@@ -4081,6 +4081,11 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp ¬ify) { + return err; + } +#ifdef CAPRI_HWC + if (strncmp(mComponentName.c_str(), "OMX.BRCM.vc4.encoder.", 21) != 0) + // Skip checking on vc4 encoder. It will return the incorrect + // port index, but correct parameters. +#endif - CHECK_EQ((int)def.eDir, - (int)(portIndex == kPortIndexOutput ? OMX_DirOutput : OMX_DirInput)); - + if (def.eDir != (portIndex == kPortIndexOutput ? OMX_DirOutput : OMX_DirInput)) { + ALOGE("unexpected dir: %s(%d) on %s port", asString(def.eDir), def.eDir, niceIndex); + return BAD_VALUE; -- -2.3.5 +2.6.3 -From 9c172527c152d0279713f2b0a0c84dd4ef0ad7f0 Mon Sep 17 00:00:00 2001 +From ff6ea2e45f3b15b3c624c043aa685f20d461e252 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Sun, 23 Nov 2014 17:27:20 +0700 -Subject: [PATCH 4/8] ACodec: Don't trust provided width/height when setting +Subject: [PATCH 4/7] ACodec: Don't trust provided width/height when setting input buffer size They are bogus @@ -140,10 +140,10 @@ Change-Id: I202b291a84d2f9a8c29aa2177ba52a0465f39deb 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp -index 1214eed..7c94a75 100644 +index 110deb8..aa32adb 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp -@@ -1916,13 +1916,9 @@ status_t ACodec::configureCodec( +@@ -2211,13 +2211,9 @@ status_t ACodec::configureCodec( // Capri's OMX fail to set a reasonable default size from width and height #ifdef CAPRI_HWC else if (!strncmp(mComponentName.c_str(), "OMX.BRCM.vc4.decoder.", 21)) { @@ -161,48 +161,13 @@ index 1214eed..7c94a75 100644 #endif -- -2.3.5 - - -From e54104a4cf69f3dc0ea38d99c52325d9ed1eb309 Mon Sep 17 00:00:00 2001 -From: Pawit Pornkitprasan -Date: Fri, 28 Nov 2014 21:07:59 +0700 -Subject: [PATCH 5/8] AudioFlinger: i9082: HACK: disable stereo record - -Stereo record causes audio to speed up x2 for some reason. -Record in mono and let AudioFlinger resample to stereo -(we only have one mic anyway) - -Change-Id: I59236addc022186fa35bd3b3914f42709c2318de ---- - services/audioflinger/AudioFlinger.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp -index 25225b0..7da83ad 100644 ---- a/services/audioflinger/AudioFlinger.cpp -+++ b/services/audioflinger/AudioFlinger.cpp -@@ -2362,6 +2362,12 @@ sp AudioFlinger::openInput_l(audio_module_handle_t m - audio_config_t halconfig = *config; - audio_hw_device_t *inHwHal = inHwDev->hwDevice(); - audio_stream_in_t *inStream = NULL; -+ -+#ifdef CAPRI_HWC -+ ALOGD("Forcing channel mask to mono on capri"); -+ halconfig.channel_mask = AUDIO_CHANNEL_IN_MONO; -+#endif -+ - status_t status = inHwHal->open_input_stream(inHwHal, *input, device, &halconfig, - &inStream, flags, address.string(), source); - ALOGV("openInput_l() openInputStream returned input %p, SamplingRate %d" --- -2.3.5 +2.6.3 -From 65cd8e77080f632e56d72099fa243c5b07695a13 Mon Sep 17 00:00:00 2001 +From e9b3b104bbed50ab5cfcd443e097fe1589faee99 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Tue, 16 Dec 2014 21:12:22 +0700 -Subject: [PATCH 6/8] stagefright: i9082: don't allocate too many extra buffers +Subject: [PATCH 5/7] stagefright: i9082: don't allocate too many extra buffers Too many extra buffers (for a total of 8) causes random video freezes and freezes on rotation @@ -214,10 +179,10 @@ Change-Id: Idfe85f3cd77d6aa5422073857ceecec902e3ca68 2 files changed, 8 insertions(+) diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp -index 7c94a75..b9be274 100644 +index aa32adb..ec03da2 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp -@@ -844,7 +844,11 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( +@@ -989,7 +989,11 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( // This check was present in KitKat. if (def.nBufferCountActual < def.nBufferCountMin + *minUndequeuedBuffers) { #endif @@ -230,10 +195,10 @@ index 7c94a75..b9be274 100644 def.nBufferCountMin + *minUndequeuedBuffers + extraBuffers; def.nBufferCountActual = newBufferCount; diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp -index 37e8ed6..2fa70a8 100644 +index 1c81016..7aab4ef 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp -@@ -2377,7 +2377,11 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { +@@ -1888,7 +1888,11 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { // This check was present in KitKat. if (def.nBufferCountActual < def.nBufferCountMin + minUndequeuedBufs) { #endif @@ -246,13 +211,13 @@ index 37e8ed6..2fa70a8 100644 def.nBufferCountMin + minUndequeuedBufs + extraBuffers; def.nBufferCountActual = newBufferCount; -- -2.3.5 +2.6.3 -From 9ad09fc641d31136f32aafd63d76a477e1c419f2 Mon Sep 17 00:00:00 2001 +From 7bba182b798e59069e99af3497d84b3ce38fc6a3 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Sat, 20 Dec 2014 19:09:59 +0700 -Subject: [PATCH 7/8] stagefright: CAPRI_HWC: fix for screen recording +Subject: [PATCH 6/7] stagefright: CAPRI_HWC: fix for screen recording Change-Id: Ib8a677eb1ecabc30efe163faa9b209f4db966437 --- @@ -261,18 +226,19 @@ Change-Id: Ib8a677eb1ecabc30efe163faa9b209f4db966437 2 files changed, 9 insertions(+) diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp -index 44c7edc..b108077 100644 +index 1a7dc9d..1c468d4 100644 --- a/media/libstagefright/omx/GraphicBufferSource.cpp +++ b/media/libstagefright/omx/GraphicBufferSource.cpp -@@ -269,12 +269,14 @@ void GraphicBufferSource::codecBufferEmptied(OMX_BUFFERHEADERTYPE* header) { - } else if (type == kMetadataBufferTypeGraphicBuffer) { - GraphicBuffer *buffer; - memcpy(&buffer, data + 4, sizeof(buffer)); +@@ -369,6 +369,7 @@ void GraphicBufferSource::codecBufferEmptied(OMX_BUFFERHEADERTYPE* header, int f + } + } else if (type == kMetadataBufferTypeANWBuffer + && header->nAllocLen >= sizeof(VideoNativeMetadata)) { +#ifndef CAPRI_HWC - if (buffer != codecBuffer.mGraphicBuffer.get()) { + VideoNativeMetadata &nativeMeta = *(VideoNativeMetadata *)data; + if (nativeMeta.pBuffer != codecBuffer.mGraphicBuffer->getNativeBuffer()) { // should never happen - ALOGE("codecBufferEmptied: buffer is %p, expected %p", - buffer, codecBuffer.mGraphicBuffer.get()); +@@ -376,6 +377,7 @@ void GraphicBufferSource::codecBufferEmptied(OMX_BUFFERHEADERTYPE* header, int f + nativeMeta.pBuffer, codecBuffer.mGraphicBuffer->getNativeBuffer()); CHECK(!"codecBufferEmptied: mismatched buffer"); } +#endif @@ -280,10 +246,10 @@ index 44c7edc..b108077 100644 } diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp -index e3a1bd3..07bf1b2 100644 +index 8687ba3..125b21a 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp -@@ -822,10 +822,17 @@ status_t OMXNodeInstance::createInputSurface( +@@ -885,10 +885,17 @@ status_t OMXNodeInstance::createGraphicBufferSource( } if (def.format.video.eColorFormat != OMX_COLOR_FormatAndroidOpaque) { @@ -300,15 +266,15 @@ index e3a1bd3..07bf1b2 100644 +#endif } - GraphicBufferSource* bufferSource = new GraphicBufferSource( + uint32_t usageBits; -- -2.3.5 +2.6.3 -From 4c4eb3c3f68b3689e792f1ba8ee27850ba9b3f8c Mon Sep 17 00:00:00 2001 +From b57ad859ec8c4f6e699e8d4e94bc95a41d0bbfe8 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Sun, 21 Dec 2014 15:25:33 +0700 -Subject: [PATCH 8/8] stagefright: CAPRI_HWC: fix for miracast +Subject: [PATCH 7/7] stagefright: CAPRI_HWC: fix for miracast Our encoder does not support OMX_Video_ControlRateConstant @@ -318,10 +284,10 @@ Change-Id: I5f98f00406a6b28c1a2a1862fbcefa2fdd9055d6 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp -index b9be274..342887d 100644 +index ec03da2..95242f8 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp -@@ -2893,7 +2893,13 @@ static OMX_U32 setPFramesSpacing(int32_t iFramesInterval, int32_t frameRate) { +@@ -3222,7 +3222,13 @@ static OMX_U32 setPFramesSpacing(int32_t iFramesInterval, int32_t frameRate) { return ret; } @@ -336,7 +302,7 @@ index b9be274..342887d 100644 int32_t tmp; if (!msg->findInt32("bitrate-mode", &tmp)) { return OMX_Video_ControlRateVariable; -@@ -2909,7 +2915,7 @@ status_t ACodec::setupMPEG4EncoderParameters(const sp &msg) { +@@ -3238,7 +3244,7 @@ status_t ACodec::setupMPEG4EncoderParameters(const sp &msg) { return INVALID_OPERATION; } @@ -345,7 +311,7 @@ index b9be274..342887d 100644 float frameRate; if (!msg->findFloat("frame-rate", &frameRate)) { -@@ -2991,7 +2997,7 @@ status_t ACodec::setupH263EncoderParameters(const sp &msg) { +@@ -3320,7 +3326,7 @@ status_t ACodec::setupH263EncoderParameters(const sp &msg) { return INVALID_OPERATION; } @@ -354,7 +320,7 @@ index b9be274..342887d 100644 float frameRate; if (!msg->findFloat("frame-rate", &frameRate)) { -@@ -3119,7 +3125,7 @@ status_t ACodec::setupAVCEncoderParameters(const sp &msg) { +@@ -3448,7 +3454,7 @@ status_t ACodec::setupAVCEncoderParameters(const sp &msg) { return INVALID_OPERATION; } @@ -363,7 +329,7 @@ index b9be274..342887d 100644 float frameRate; if (!msg->findFloat("frame-rate", &frameRate)) { -@@ -3234,7 +3240,7 @@ status_t ACodec::setupHEVCEncoderParameters(const sp &msg) { +@@ -3562,7 +3568,7 @@ status_t ACodec::setupHEVCEncoderParameters(const sp &msg) { return INVALID_OPERATION; } @@ -372,7 +338,7 @@ index b9be274..342887d 100644 float frameRate; if (!msg->findFloat("frame-rate", &frameRate)) { -@@ -3301,7 +3307,7 @@ status_t ACodec::setupVPXEncoderParameters(const sp &msg) { +@@ -3631,7 +3637,7 @@ status_t ACodec::setupVPXEncoderParameters(const sp &msg) { } msg->findInt32("i-frame-interval", &iFrameInterval); @@ -382,4 +348,5 @@ index b9be274..342887d 100644 float frameRate; if (!msg->findFloat("frame-rate", &frameRate)) { -- -2.3.5 +2.6.3 + diff --git a/patches/frameworks_base.patch b/patches/frameworks_base.patch index da63011..95683e1 100644 --- a/patches/frameworks_base.patch +++ b/patches/frameworks_base.patch @@ -1,7 +1,114 @@ -From 364bda5654561df326c7e13c5edf833a6140e278 Mon Sep 17 00:00:00 2001 +From e5db5944e75a730138e650269b357e15eef9a69d Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan -Date: Sat, 15 Nov 2014 22:33:16 +0700 -Subject: [PATCH 1/2] Camera: HACK: i9082: API hacks +Date: Sat, 15 Nov 2014 14:50:29 +0700 +Subject: [PATCH 1/3] TelephonyManager: set properties in Broadcom-style as + expected by RIL + +For i9082 and i9152 + +Change-Id: I475fdd164b3316720387fefb14a3e12fbc262b39 +--- + .../java/android/telephony/TelephonyManager.java | 63 +++++++--------------- + 1 file changed, 20 insertions(+), 43 deletions(-) + +diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java +index 3dd6793..526399c 100644 +--- a/telephony/java/android/telephony/TelephonyManager.java ++++ b/telephony/java/android/telephony/TelephonyManager.java +@@ -3327,49 +3327,19 @@ public class TelephonyManager { + * @hide + */ + public static void setTelephonyProperty(int phoneId, String property, String value) { +- String propVal = ""; +- String p[] = null; +- String prop = SystemProperties.get(property); +- +- if (value == null) { +- value = ""; +- } +- +- if (prop != null) { +- p = prop.split(","); +- } +- + if (!SubscriptionManager.isValidPhoneId(phoneId)) { + Rlog.d(TAG, "setTelephonyProperty: invalid phoneId=" + phoneId + +- " property=" + property + " value: " + value + " prop=" + prop); ++ " property=" + property + " value: " + value); + return; + } + +- for (int i = 0; i < phoneId; i++) { +- String str = ""; +- if ((p != null) && (i < p.length)) { +- str = p[i]; +- } +- propVal = propVal + str + ","; +- } +- +- propVal = propVal + value; +- if (p != null) { +- for (int i = phoneId + 1; i < p.length; i++) { +- propVal = propVal + "," + p[i]; +- } +- } +- +- if (property.length() > SystemProperties.PROP_NAME_MAX +- || propVal.length() > SystemProperties.PROP_VALUE_MAX) { +- Rlog.d(TAG, "setTelephonyProperty: property to long phoneId=" + phoneId + +- " property=" + property + " value: " + value + " propVal=" + propVal); +- return; ++ if (phoneId > 0) { ++ property += "_" + phoneId; + } + + Rlog.d(TAG, "setTelephonyProperty: success phoneId=" + phoneId + +- " property=" + property + " value: " + value + " propVal=" + propVal); +- SystemProperties.set(property, propVal); ++ " property=" + property + " value: " + value); ++ SystemProperties.set(property, value); + } + + /** +@@ -3466,15 +3436,22 @@ public class TelephonyManager { + * @hide + */ + public static String getTelephonyProperty(int phoneId, String property, String defaultVal) { +- String propVal = null; +- String prop = SystemProperties.get(property); +- if ((prop != null) && (prop.length() > 0)) { +- String values[] = prop.split(","); +- if ((phoneId >= 0) && (phoneId < values.length) && (values[phoneId] != null)) { +- propVal = values[phoneId]; +- } ++ if (!SubscriptionManager.isValidPhoneId(phoneId)) { ++ Rlog.d(TAG, "getTelephonyProperty: invalid phoneId=" + phoneId + ++ " property=" + property); ++ return defaultVal; + } +- return propVal == null ? defaultVal : propVal; ++ ++ if (phoneId > 0) { ++ property += "_" + phoneId; ++ } ++ ++ String propVal = SystemProperties.get(property); ++ ++ Rlog.d(TAG, "getTelephonyProperty: return propVal='" + propVal + "' phoneId=" + phoneId ++ + " property='" + property + "' defaultVal='" + defaultVal); ++ ++ return propVal.isEmpty() ? defaultVal : propVal; + } + + /** @hide */ +-- +2.6.3 + + +From 7484ebd43377bac968a21198a51bbcd58b7a21cc Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Sat, 15 Nov 2014 14:50:29 +0700 +Subject: [PATCH 2/3] Camera: HACK: i9082: API hacks CTS 5.0 requires the presence of an auto mode, so applications may try to use auto without checking. @@ -16,10 +123,10 @@ Change-Id: I929feffa4f79c69e9d7be7d1acacb3c228280bfe 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java -index 347db05..5acf583d 100644 +index 8bdd42a..5898eac 100644 --- a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java +++ b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java -@@ -1100,7 +1100,7 @@ public class LegacyMetadataMapper { +@@ -1149,7 +1149,7 @@ public class LegacyMetadataMapper { return CONTROL_AE_ANTIBANDING_MODE_OFF; } case Camera.Parameters.ANTIBANDING_50HZ: { @@ -29,10 +136,10 @@ index 347db05..5acf583d 100644 case Camera.Parameters.ANTIBANDING_60HZ: { return CONTROL_AE_ANTIBANDING_MODE_60HZ; diff --git a/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java b/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java -index 61f7b8b..f370103 100644 +index 6a44ac5..a427b9d 100644 --- a/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java +++ b/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java -@@ -617,7 +617,7 @@ public class LegacyRequestMapper { +@@ -618,7 +618,7 @@ public class LegacyRequestMapper { return Parameters.ANTIBANDING_60HZ; } case CONTROL_AE_ANTIBANDING_MODE_AUTO: { @@ -42,7 +149,7 @@ index 61f7b8b..f370103 100644 default: { return null; diff --git a/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java b/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java -index d461bca..a34a758 100644 +index 1aee794..e7c5313 100644 --- a/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java +++ b/core/java/android/hardware/camera2/utils/CameraBinderDecorator.java @@ -124,7 +124,7 @@ public class CameraBinderDecorator { @@ -55,13 +162,13 @@ index d461bca..a34a758 100644 throw new CameraRuntimeException(CAMERA_DEPRECATED_HAL); case INVALID_OPERATION: -- -2.3.5 +2.6.3 -From 9a0b6efe16eaa2740160306bbde768758f6259d2 Mon Sep 17 00:00:00 2001 +From 26420041d94e87bd2313b11834b1f2fe6183d96f Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan -Date: Sun, 21 Dec 2014 16:23:31 +0700 -Subject: [PATCH 2/2] PowerManagerService: only turn on button light when any +Date: Sat, 14 Mar 2015 22:53:50 +0700 +Subject: [PATCH 3/3] PowerManagerService: only turn on button light when any button is pressed This more closely emulates stock Samsung behavior @@ -72,10 +179,10 @@ Change-Id: I6b15c45b713bcbc290a1026805c46109060f9990 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java -index 8105ff8..b3d2023 100644 +index 76d4a27..ee1d742 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java -@@ -235,6 +235,7 @@ public final class PowerManagerService extends SystemService +@@ -244,6 +244,7 @@ public final class PowerManagerService extends SystemService // Timestamp of the last call to user activity. private long mLastUserActivityTime; private long mLastUserActivityTimeNoChangeLights; @@ -83,7 +190,7 @@ index 8105ff8..b3d2023 100644 // Timestamp of last interactive power hint. private long mLastInteractivePowerHintTime; -@@ -1145,6 +1146,11 @@ public final class PowerManagerService extends SystemService +@@ -1165,6 +1166,11 @@ public final class PowerManagerService extends SystemService return true; } } else { @@ -95,7 +202,7 @@ index 8105ff8..b3d2023 100644 if (eventTime > mLastUserActivityTime) { mLastUserActivityTime = eventTime; mDirty |= DIRTY_USER_ACTIVITY; -@@ -1648,7 +1654,7 @@ public final class PowerManagerService extends SystemService +@@ -1677,7 +1683,7 @@ public final class PowerManagerService extends SystemService mKeyboardLight.setBrightness(mKeyboardVisible ? keyboardBrightness : 0); if (mButtonTimeout != 0 @@ -105,4 +212,5 @@ index 8105ff8..b3d2023 100644 } else { if (!mProximityPositive) { -- -1.9.1 +2.6.3 + diff --git a/patches/frameworks_native.patch b/patches/frameworks_native.patch index 963d1b7..28a825f 100644 --- a/patches/frameworks_native.patch +++ b/patches/frameworks_native.patch @@ -1,7 +1,501 @@ -From 9286ea92a5156e9464978fda5ff3cce78949a6e5 Mon Sep 17 00:00:00 2001 +From 2b4d9c4043d2f715c9458d9ceba9f580ec3e3b83 Mon Sep 17 00:00:00 2001 +From: Ricardo Cerqueira +Date: Tue, 6 Aug 2013 16:11:06 +0100 +Subject: [PATCH 1/7] libgui: Bring back support for mHeap-based screenshots + +Older graphics libraries throw a hissy fit when trying to lock +buffers for Surface-based screenshots, on at least Tegra2/3 and +Exynos4 hardware. + +This patch depends on the BOARD_USE_MHEAP_SCREENSHOT board flag +and requires the ro.bq.gpu_to_cpu_unsupported property set to 1 +in order to work. + +[pawitp: port to Lollipop] + +Change-Id: I7db955e2cdd120018e349c14290e975788e70ed3 +--- + include/gui/ISurfaceComposer.h | 15 +++ + include/gui/SurfaceComposerClient.h | 6 ++ + libs/gui/Android.mk | 4 + + libs/gui/ISurfaceComposer.cpp | 52 ++++++++++ + libs/gui/SurfaceComposerClient.cpp | 26 +++++ + services/surfaceflinger/Android.mk | 4 + + services/surfaceflinger/SurfaceFlinger.cpp | 159 ++++++++++++++++++++++++++++- + services/surfaceflinger/SurfaceFlinger.h | 16 +++ + 8 files changed, 279 insertions(+), 3 deletions(-) + +diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h +index 84ddb27..563b4d1 100644 +--- a/include/gui/ISurfaceComposer.h ++++ b/include/gui/ISurfaceComposer.h +@@ -148,6 +148,18 @@ public: + Rotation rotation = eRotateNone, + bool isCpuConsumer = false) = 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& display, sp* heap, ++ uint32_t* width, uint32_t* height, ++ Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, ++ uint32_t minLayerZ, uint32_t maxLayerZ, ++ bool useIdentityTransform, ++ Rotation rotation = eRotateNone) = 0; ++#endif ++ + /* Clears the frame statistics for animations. + * + * Requires the ACCESS_SURFACE_FLINGER permission. +@@ -177,6 +189,9 @@ public: + GET_BUILT_IN_DISPLAY, + SET_TRANSACTION_STATE, + AUTHENTICATE_SURFACE, ++#ifdef USE_MHEAP_SCREENSHOT ++ CAPTURE_SCREEN_DEPRECATED, ++#endif + GET_DISPLAY_CONFIGS, + GET_ACTIVE_CONFIG, + SET_ACTIVE_CONFIG, +diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h +index 9ec3f23..ec83b02 100644 +--- a/include/gui/SurfaceComposerClient.h ++++ b/include/gui/SurfaceComposerClient.h +@@ -40,6 +40,9 @@ namespace android { + + class DisplayInfo; + class Composer; ++#ifdef USE_MHEAP_SCREENSHOT ++class IMemoryHeap; ++#endif + class ISurfaceComposerClient; + class IGraphicBufferProducer; + class Region; +@@ -193,6 +196,9 @@ public: + bool useIdentityTransform); + + private: ++#ifdef USE_MHEAP_SCREENSHOT ++ sp mHeap; ++#endif + mutable sp mCpuConsumer; + mutable sp mProducer; + CpuConsumer::LockedBuffer mBuffer; +diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk +index 8a965dd..e439d84 100644 +--- a/libs/gui/Android.mk ++++ b/libs/gui/Android.mk +@@ -82,6 +82,10 @@ LOCAL_SHARED_LIBRARIES := \ + liblog + + ++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 0ad6339..7db2e7f 100644 +--- a/libs/gui/ISurfaceComposer.cpp ++++ b/libs/gui/ISurfaceComposer.cpp +@@ -98,6 +98,33 @@ public: + remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply); + } + ++#ifdef USE_MHEAP_SCREENSHOT ++ virtual status_t captureScreen( ++ const sp& display, sp* heap, ++ uint32_t* width, uint32_t* height, ++ Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, ++ uint32_t minLayerZ, uint32_t maxLayerZ, ++ bool useIdentityTransform, ++ ISurfaceComposer::Rotation rotation) ++ { ++ Parcel data, reply; ++ data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); ++ data.writeStrongBinder(display); ++ data.write(sourceCrop); ++ data.writeUint32(reqWidth); ++ data.writeUint32(reqHeight); ++ data.writeUint32(minLayerZ); ++ data.writeUint32(maxLayerZ); ++ data.writeInt32(static_cast(useIdentityTransform)); ++ data.writeInt32(static_cast(rotation)); ++ remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN_DEPRECATED, data, &reply); ++ *heap = interface_cast(reply.readStrongBinder()); ++ *width = reply.readUint32(); ++ *height = reply.readUint32(); ++ return reply.readInt32(); ++ } ++#endif ++ + virtual status_t captureScreen(const sp& display, + const sp& producer, + Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, +@@ -350,6 +377,31 @@ status_t BnSurfaceComposer::onTransact( + bootFinished(); + return NO_ERROR; + } ++#ifdef USE_MHEAP_SCREENSHOT ++ case CAPTURE_SCREEN_DEPRECATED: { ++ CHECK_INTERFACE(ISurfaceComposer, data, reply); ++ sp display = data.readStrongBinder(); ++ Rect sourceCrop; ++ data.read(sourceCrop); ++ uint32_t reqWidth = data.readUint32(); ++ uint32_t reqHeight = data.readUint32(); ++ uint32_t minLayerZ = data.readUint32(); ++ uint32_t maxLayerZ = data.readUint32(); ++ bool useIdentityTransform = static_cast(data.readInt32()); ++ uint32_t rotation = data.readUint32(); ++ sp heap; ++ uint32_t w, h; ++ status_t res = captureScreen(display, &heap, &w, &h, ++ sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, ++ useIdentityTransform, ++ static_cast(rotation)); ++ reply->writeStrongBinder(IInterface::asBinder(heap)); ++ reply->writeUint32(w); ++ reply->writeUint32(h); ++ reply->writeInt32(res); ++ return NO_ERROR; ++ } ++#endif + case CAPTURE_SCREEN: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + sp display = data.readStrongBinder(); +diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp +index 82bdd6b..0be73d6 100644 +--- a/libs/gui/SurfaceComposerClient.cpp ++++ b/libs/gui/SurfaceComposerClient.cpp +@@ -764,6 +764,14 @@ status_t ScreenshotClient::capture( + uint32_t minLayerZ, uint32_t maxLayerZ, bool useIdentityTransform) { + sp 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, sourceCrop, + reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, + ISurfaceComposer::eRotateNone, SS_CPU_CONSUMER); +@@ -794,6 +802,19 @@ status_t ScreenshotClient::update(const sp& display, + bool useIdentityTransform, uint32_t rotation) { + sp 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, sourceCrop, ++ reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, ++ static_cast(rotation)); ++ if (ret == NO_ERROR) { ++ mBuffer.format = PIXEL_FORMAT_RGBA_8888; ++ mBuffer.stride = mBuffer.width; ++ mBuffer.data = static_cast(mHeap->getBase()); ++ } ++ return ret; ++#else + sp cpuConsumer = getCpuConsumer(); + + if (mHaveBuffer) { +@@ -813,6 +834,7 @@ status_t ScreenshotClient::update(const sp& display, + } + } + return err; ++#endif + } + + status_t ScreenshotClient::update(const sp& display, +@@ -837,12 +859,16 @@ status_t ScreenshotClient::update(const sp& display, Rect sourceCrop, + } + + 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 c921329..b80f8fb 100644 +--- a/services/surfaceflinger/Android.mk ++++ b/services/surfaceflinger/Android.mk +@@ -64,6 +64,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/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp +index 4051b38..4e122da 100644 +--- a/services/surfaceflinger/SurfaceFlinger.cpp ++++ b/services/surfaceflinger/SurfaceFlinger.cpp +@@ -26,6 +26,9 @@ + #include + + #include ++#ifdef USE_MHEAP_SCREENSHOT ++#include ++#endif + + #include + #include +@@ -3008,12 +3011,18 @@ 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(); + const int pid = ipc->getCallingPid(); + const int uid = ipc->getCallingUid(); + if ((uid != AID_GRAPHICS) && ++#ifdef USE_MHEAP_SCREENSHOT ++ (uid != AID_SYSTEM) && ++#endif + !PermissionCache::checkPermission(sReadFramebuffer, pid, uid)) { + ALOGE("Permission Denial: " + "can't read framebuffer pid=%d, uid=%d", pid, uid); +@@ -3349,9 +3358,18 @@ status_t SurfaceFlinger::captureScreen(const sp& display, + Mutex::Autolock _l(flinger->mStateLock); + sp hw(flinger->getDisplayDevice(display)); + bool useReadPixels = this->useReadPixels && !flinger->mGpuToCpuSupported; +- result = flinger->captureScreenImplLocked(hw, producer, +- sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, +- useIdentityTransform, rotation, useReadPixels); ++#ifdef USE_MHEAP_SCREENSHOT ++ if (!useReadPixels) { ++#endif ++ result = flinger->captureScreenImplLocked(hw, producer, ++ sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, ++ useIdentityTransform, rotation, useReadPixels); ++#ifdef USE_MHEAP_SCREENSHOT ++ } else { ++ // Should never get here ++ return BAD_VALUE; ++ } ++#endif + static_cast(IInterface::asBinder(producer).get())->exit(result); + return true; + } +@@ -3633,6 +3651,139 @@ 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& hw, ++ sp* heap, uint32_t* w, uint32_t* h, ++ Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, ++ uint32_t minLayerZ, uint32_t maxLayerZ, ++ bool useIdentityTransform, Transform::orientation_flags rotation) ++{ ++ 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, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, true, ++ useIdentityTransform, rotation); ++ ++ size_t size = reqWidth * reqHeight * 4; ++ // allocate shared memory large enough to hold the ++ // screen capture ++ sp 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& display, ++ sp* heap, uint32_t* outWidth, uint32_t* outHeight, ++ Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, ++ uint32_t minLayerZ, uint32_t maxLayerZ, ++ bool useIdentityTransform, ISurfaceComposer::Rotation rotation) ++{ ++ if (CC_UNLIKELY(display == 0)) ++ return BAD_VALUE; ++ ++ // Convert to surfaceflinger's internal rotation type. ++ Transform::orientation_flags rotationFlags; ++ switch (rotation) { ++ case ISurfaceComposer::eRotateNone: ++ rotationFlags = Transform::ROT_0; ++ break; ++ case ISurfaceComposer::eRotate90: ++ rotationFlags = Transform::ROT_90; ++ break; ++ case ISurfaceComposer::eRotate180: ++ rotationFlags = Transform::ROT_180; ++ break; ++ case ISurfaceComposer::eRotate270: ++ rotationFlags = Transform::ROT_270; ++ break; ++ default: ++ rotationFlags = Transform::ROT_0; ++ ALOGE("Invalid rotation passed to captureScreen(): %d\n", rotation); ++ break; ++ } ++ ++ class MessageCaptureScreen : public MessageBase { ++ SurfaceFlinger* flinger; ++ sp display; ++ sp* heap; ++ uint32_t* outWidth; ++ uint32_t* outHeight; ++ Rect sourceCrop; ++ uint32_t reqWidth, reqHeight; ++ uint32_t minLayerZ,maxLayerZ; ++ bool useIdentityTransform; ++ Transform::orientation_flags rotation; ++ status_t result; ++ public: ++ MessageCaptureScreen(SurfaceFlinger* flinger, ++ const sp& display, sp* heap, ++ uint32_t* outWidth, uint32_t* outHeight, ++ Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, ++ uint32_t minLayerZ, uint32_t maxLayerZ, ++ bool useIdentityTransform, Transform::orientation_flags rotation) ++ : flinger(flinger), display(display), heap(heap), ++ outWidth(outWidth), outHeight(outHeight), ++ sourceCrop(sourceCrop), reqWidth(reqWidth), reqHeight(reqHeight), ++ minLayerZ(minLayerZ), maxLayerZ(maxLayerZ), ++ useIdentityTransform(useIdentityTransform), ++ rotation(rotation), ++ result(PERMISSION_DENIED) ++ { ++ } ++ status_t getResult() const { ++ return result; ++ } ++ virtual bool handler() { ++ Mutex::Autolock _l(flinger->mStateLock); ++ sp hw(flinger->getDisplayDevice(display)); ++ result = flinger->captureScreenImplCpuConsumerLocked(hw, heap, ++ outWidth, outHeight, ++ sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, ++ useIdentityTransform, rotation); ++ return true; ++ } ++ }; ++ ++ sp msg = new MessageCaptureScreen(this, display, heap, ++ outWidth, outHeight, ++ sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, ++ useIdentityTransform, rotationFlags); ++ status_t res = postMessageSync(msg); ++ if (res == NO_ERROR) { ++ res = static_cast( msg.get() )->getResult(); ++ } ++ return res; ++} ++#endif ++ + /* ------------------------------------------------------------------------ + * Extensions + */ +@@ -3717,6 +3868,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 +@@ -3724,3 +3876,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 2028d67..6f31d8e 100644 +--- a/services/surfaceflinger/SurfaceFlinger.h ++++ b/services/surfaceflinger/SurfaceFlinger.h +@@ -218,6 +218,13 @@ private: + uint32_t minLayerZ, uint32_t maxLayerZ, + bool useIdentityTransform, ISurfaceComposer::Rotation rotation, + bool isCpuConsumer); ++#ifdef USE_MHEAP_SCREENSHOT ++ virtual status_t captureScreen(const sp& display, sp* heap, ++ uint32_t* width, uint32_t* height, ++ Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, ++ uint32_t minLayerZ, uint32_t maxLayerZ, ++ bool useIdentityTransform, ISurfaceComposer::Rotation rotation); ++#endif + virtual status_t getDisplayStats(const sp& display, + DisplayStatInfo* stats); + virtual status_t getDisplayConfigs(const sp& display, +@@ -383,6 +390,15 @@ private: + bool useIdentityTransform, Transform::orientation_flags rotation, + bool useReadPixels); + ++#ifdef USE_MHEAP_SCREENSHOT ++ status_t captureScreenImplCpuConsumerLocked( ++ const sp& hw, ++ sp* heap, uint32_t* width, uint32_t* height, ++ Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, ++ uint32_t minLayerZ, uint32_t maxLayerZ, ++ bool useIdentityTransform, Transform::orientation_flags rotation); ++#endif ++ + /* ------------------------------------------------------------------------ + * EGL + */ +-- +2.6.3 + + +From 64dede002088930ac5b7a46d2f333e37b7dddae1 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Thu, 14 Nov 2013 15:19:46 +0700 -Subject: [PATCH 1/5] binder: add compat symbol +Subject: [PATCH 2/7] binder: add compat symbol Required for older Samsung libtvout @@ -11,10 +505,10 @@ Change-Id: Ib18d2513570382432d49f302ab041230650372f2 1 file changed, 4 insertions(+) diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp -index dd04dcf..9ec2380 100644 +index ef88181..a6daf23 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp -@@ -361,6 +361,10 @@ status_t IPCThreadState::clearLastError() +@@ -343,6 +343,10 @@ status_t IPCThreadState::clearLastError() return err; } @@ -22,17 +516,17 @@ index dd04dcf..9ec2380 100644 + return state->getCallingPid(); +} + - int IPCThreadState::getCallingPid() const + pid_t IPCThreadState::getCallingPid() const { return mCallingPid; -- -2.3.5 +2.6.3 -From 52672bcc7b8a858a35e3084be95417d872068285 Mon Sep 17 00:00:00 2001 +From 8f7e1525d3274276f74a5429215fd40788894d62 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Tue, 10 Dec 2013 19:38:17 +0700 -Subject: [PATCH 2/5] binder: add compat symbols +Subject: [PATCH 3/7] binder: add compat symbols Required for libtvservice_binder.so on I9082 @@ -42,11 +536,11 @@ Change-Id: I059e92f19e4c5a911d38faa9c4df549c75c90761 1 file changed, 12 insertions(+) diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp -index e7589b1..b34ceb9 100644 +index 7a4ddc4..9fc52fb 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp -@@ -873,6 +873,12 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) - return status; +@@ -964,6 +964,12 @@ status_t Parcel::writeDupImmutableBlobFileDescriptor(int fd) + return writeDupFileDescriptor(fd); } +extern "C" status_t _ZN7android6Parcel5writeERKNS0_26FlattenableHelperInterfaceE(void *parcel, void *val); @@ -58,7 +552,7 @@ index e7589b1..b34ceb9 100644 status_t Parcel::write(const FlattenableHelperInterface& val) { status_t err; -@@ -1285,6 +1291,12 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const +@@ -1404,6 +1410,12 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const return NO_ERROR; } @@ -72,23 +566,23 @@ index e7589b1..b34ceb9 100644 { // size -- -2.3.5 +2.6.3 -From 1ee90ff836265e70b8dc0357e86e18502ea46230 Mon Sep 17 00:00:00 2001 +From 33e80635fa3a105390c3bcbf2ca5a5ac13d2fbff Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Mon, 16 Dec 2013 15:45:42 +0700 -Subject: [PATCH 3/5] sf: CAPRI_HWC: fix rotation artifact +Subject: [PATCH 4/7] sf: CAPRI_HWC: fix rotation artifact --- services/surfaceflinger/SurfaceFlinger.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp -index dfe5754..c608397 100644 +index 4e122da..064e1d5 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp -@@ -3749,6 +3749,11 @@ status_t SurfaceFlinger::captureScreenImplLocked( +@@ -3487,6 +3487,11 @@ status_t SurfaceFlinger::captureScreenImplLocked( { ATRACE_CALL(); @@ -98,16 +592,16 @@ index dfe5754..c608397 100644 +#endif + // get screen geometry - const uint32_t hw_w = hw->getWidth(); - const uint32_t hw_h = hw->getHeight(); + uint32_t hw_w = hw->getWidth(); + uint32_t hw_h = hw->getHeight(); -- -2.3.5 +2.6.3 -From e6e115f462283ac2fc6a581728a5d35412d1eb21 Mon Sep 17 00:00:00 2001 +From 9b263c642c9af630daf093a049705ee8664d91b1 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Mon, 15 Dec 2014 23:12:44 +0700 -Subject: [PATCH 4/5] SurfaceComposerClient: don't block RGBA_8888 for +Subject: [PATCH 5/7] SurfaceComposerClient: don't block RGBA_8888 for screenshot on CAPRI_HWC Works here and required for ColorFade animation @@ -118,10 +612,10 @@ Change-Id: Ie7d549bb63e11380d7efcab27b7e4d9f3eb2a1fe 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp -index b6025f2..9c59ba2 100644 +index 0be73d6..038b54b 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp -@@ -838,7 +838,7 @@ status_t ScreenshotClient::capture( +@@ -764,7 +764,7 @@ status_t ScreenshotClient::capture( uint32_t minLayerZ, uint32_t maxLayerZ, bool useIdentityTransform) { sp s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; @@ -131,13 +625,13 @@ index b6025f2..9c59ba2 100644 producer->query(NATIVE_WINDOW_FORMAT,&format); if (format == PIXEL_FORMAT_RGBA_8888) { -- -2.3.5 +2.6.3 -From 395931556400205a102f9db5eec1e07088017821 Mon Sep 17 00:00:00 2001 +From 66df41899841433740ab2326f8ff77d075bb9cee Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Sat, 20 Dec 2014 19:09:27 +0700 -Subject: [PATCH 5/5] sf: CAPRI_HWC: fix for screen recording +Subject: [PATCH 6/7] sf: CAPRI_HWC: fix for screen recording Change-Id: I6c7e59400eab86bc5ec0ffebbcc475fa0fa404d2 --- @@ -145,10 +639,10 @@ Change-Id: I6c7e59400eab86bc5ec0ffebbcc475fa0fa404d2 1 file changed, 5 insertions(+) diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp -index 6f76019..ff6a570 100644 +index 87e5b4d..9634db7 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp -@@ -204,7 +204,12 @@ status_t BufferQueueProducer::waitForFreeSlotThenRelock(const char* caller, +@@ -193,7 +193,12 @@ status_t BufferQueueProducer::waitForFreeSlotThenRelock(const char* caller, const int newUndequeuedCount = maxBufferCount - (dequeuedCount + 1); const int minUndequeuedCount = @@ -162,4 +656,35 @@ index 6f76019..ff6a570 100644 BQ_LOGE("%s: min undequeued buffer count (%d) exceeded " "(dequeued=%d undequeued=%d)", -- -2.3.5 +2.6.3 + + +From 19331e7ee6dde1d58bd3af228d0c3d8f4fec3516 Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Sun, 11 Oct 2015 15:28:51 +0700 +Subject: [PATCH 7/7] binder: add compat symbol for RIL + +--- + libs/binder/Parcel.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp +index 9fc52fb..3848bef 100644 +--- a/libs/binder/Parcel.cpp ++++ b/libs/binder/Parcel.cpp +@@ -823,6 +823,12 @@ status_t Parcel::writeString16(const String16& str) + return writeString16(str.string(), str.size()); + } + ++extern "C" status_t _ZN7android6Parcel13writeString16EPKDsj(void *parcel, const char16_t* str, size_t len); ++ ++extern "C" status_t _ZN7android6Parcel13writeString16EPKtj(void *parcel, const char16_t* str, size_t len) { ++ return _ZN7android6Parcel13writeString16EPKDsj(parcel, str, len); ++} ++ + status_t Parcel::writeString16(const char16_t* str, size_t len) + { + if (str == NULL) return writeInt32(-1); +-- +2.6.3 + diff --git a/patches/frameworks_opt_telephony.patch b/patches/frameworks_opt_telephony.patch index e2e2386..8a48b13 100644 --- a/patches/frameworks_opt_telephony.patch +++ b/patches/frameworks_opt_telephony.patch @@ -1,7 +1,758 @@ -From 8ca768b45b5dc49b2df99421f39cc372e5d1361b Mon Sep 17 00:00:00 2001 +From a18dff247ce2728859155440a5cbde85f0711d2c Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Sat, 17 Oct 2015 20:45:13 +0700 +Subject: [PATCH 1/6] RIL: mark some methods as protected + +To use in RIL subclasses + +Change-Id: Ia05a951197b9c4a92c7cd7f55106648db64f51ea +--- + src/java/com/android/internal/telephony/RIL.java | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java +index 9bd46a9..1e3b83a 100644 +--- a/src/java/com/android/internal/telephony/RIL.java ++++ b/src/java/com/android/internal/telephony/RIL.java +@@ -2925,7 +2925,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + return rr; + } + +- private RadioCapability makeStaticRadioCapability() { ++ protected RadioCapability makeStaticRadioCapability() { + // default to UNKNOWN so we fail fast. + int raf = RadioAccessFamily.RAF_UNKNOWN; + +@@ -3548,7 +3548,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + return response; + } + +- private Object ++ protected Object + responseFailCause(Parcel p) { + LastCallFailCause failCause = new LastCallFailCause(); + failCause.causeCode = p.readInt(); +@@ -4241,7 +4241,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + return response; + } + +- private Object ++ protected Object + responseRadioCapability(Parcel p) { + int version = p.readInt(); + int session = p.readInt(); +@@ -4261,7 +4261,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + return rc; + } + +- private Object responseLceData(Parcel p) { ++ protected Object responseLceData(Parcel p) { + final ArrayList capacityResponse = new ArrayList(); + final int capacityDownKbps = p.readInt(); + final int confidenceLevel = p.readByte(); +@@ -4278,7 +4278,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + return capacityResponse; + } + +- private Object responseLceStatus(Parcel p) { ++ protected Object responseLceStatus(Parcel p) { + final ArrayList statusResponse = new ArrayList(); + final int lceStatus = (int)p.readByte(); + final int actualInterval = p.readInt(); +@@ -4291,7 +4291,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + return statusResponse; + } + +- private Object responseActivityData(Parcel p) { ++ protected Object responseActivityData(Parcel p) { + final int sleepModeTimeMs = p.readInt(); + final int idleModeTimeMs = p.readInt(); + int [] txModeTimeMs = new int[ModemActivityInfo.TX_POWER_LEVELS]; +@@ -4545,7 +4545,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + riljLogv("[UNSL]< " + responseToString(response) + " " + retToString(response, ret)); + } + +- private Object ++ protected Object + responseSsData(Parcel p) { + int num; + SsData ssData = new SsData(); +-- +2.6.3 + + +From 4dfa0adcd4f8ef4401e9a56d362deecbce6dd82e Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Sun, 28 Dec 2014 18:53:11 +0700 +Subject: [PATCH 2/6] UiccController: add back registerForOn + +It was removed in a77b4218dc29c2cda3eea69e6642821598849898, but this is +required for many devices. + +Change-Id: I5fabd6dd75505aa3f6433437312392805485c4dc +--- + src/java/com/android/internal/telephony/uicc/UiccController.java | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/java/com/android/internal/telephony/uicc/UiccController.java b/src/java/com/android/internal/telephony/uicc/UiccController.java +index f2aeacc..9102185 100644 +--- a/src/java/com/android/internal/telephony/uicc/UiccController.java ++++ b/src/java/com/android/internal/telephony/uicc/UiccController.java +@@ -127,6 +127,7 @@ public class UiccController extends Handler { + mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, index); + mCis[i].registerForAvailable(this, EVENT_ICC_STATUS_CHANGED, index); + mCis[i].registerForNotAvailable(this, EVENT_RADIO_UNAVAILABLE, index); ++ mCis[i].registerForOn(this, EVENT_ICC_STATUS_CHANGED, index); + mCis[i].registerForIccRefresh(this, EVENT_SIM_REFRESH, index); + } + } +-- +2.6.3 + + +From 476381154ec496f27f046760beb93836579f3cdf Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Sun, 28 Dec 2014 20:24:29 +0700 +Subject: [PATCH 3/6] UiccController: use registerForAvailable only when + persist.radio.apm_sim_not_pwdn is enabled + +Some QCOM RILs allow the SIM to be loaded in airplane mode, thus +CAF changed the callback to registerForAvailable, but that does +not work on other RILs where the SIM information will not be +loaded successfully. + +Change-Id: I9f9124417db2fe983e716a2825fc08d87511f8aa +--- + .../com/android/internal/telephony/uicc/UiccController.java | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/java/com/android/internal/telephony/uicc/UiccController.java b/src/java/com/android/internal/telephony/uicc/UiccController.java +index 9102185..737ff9e 100644 +--- a/src/java/com/android/internal/telephony/uicc/UiccController.java ++++ b/src/java/com/android/internal/telephony/uicc/UiccController.java +@@ -124,10 +124,16 @@ public class UiccController extends Handler { + mCis = ci; + for (int i = 0; i < mCis.length; i++) { + Integer index = new Integer(i); ++ if (SystemProperties.getBoolean("persist.radio.apm_sim_not_pwdn", false)) { ++ // Reading ICC status in airplane mode is only supported in QCOM ++ // RILs when this property is set to true ++ mCis[i].registerForAvailable(this, EVENT_ICC_STATUS_CHANGED, index); ++ } else { ++ mCis[i].registerForOn(this, EVENT_ICC_STATUS_CHANGED, index); ++ } ++ + mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, index); +- mCis[i].registerForAvailable(this, EVENT_ICC_STATUS_CHANGED, index); + mCis[i].registerForNotAvailable(this, EVENT_RADIO_UNAVAILABLE, index); +- mCis[i].registerForOn(this, EVENT_ICC_STATUS_CHANGED, index); + mCis[i].registerForIccRefresh(this, EVENT_SIM_REFRESH, index); + } + } +-- +2.6.3 + + +From 21568d1e84ae15b07536686892ee3c9bb564f2d9 Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Wed, 17 Dec 2014 21:19:34 +0700 +Subject: [PATCH 4/6] Forward port Samsung STK support + (frameworks/opt/telephony) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Squashed commit of the following: + +commit 7940f7ced44976f03171d09c2ba8b1d29bc9432e +Author: Flamefire +Date: Sat Nov 15 21:26:33 2014 +0100 + + Fix crash of Samsung phones + + Using an alternative SMS app like chompSMS leads to a crash as + sendResult is an array without any entries (sendResult[0] is accessed) + The default SMS app does not show this because mCurrntCmd == null + + Change-Id: Icfef6d20f9082dd1f64ed29b67031d2575896513 + +commit ed0cac138315b4dd5b36c35651ba6d23f1a47ae0 +Author: Pawit Pornkitprasan +Date: Tue Dec 11 17:22:30 2012 +0700 + + Samsung STK: Fix SMS-based STK + + SEND_SMS was falling through to SEND_USSD (which used to do nothing + until USSD support was added) causing an Exception because cmdParams + is not an instance of SendUSSDParams. + + Fix by using type-checking instead of checking if Samsung STK is + enabled (because SendSMSParams and SendUSSDParams will only be + created if Samsung STK is enabled.) + + Change-Id: I671014e295e9e529aad25a8b6fbd5a2e5788fc44 + +commit 7a9f16293abc6e216004d0c80822d39dac98db98 +Author: Pawit Pornkitprasan +Date: Fri Nov 30 21:35:50 2012 +0700 + + Samsung STK: Add USSD support + + Allow USSD-based STK applications to work + + Change-Id: I483f37a44a6c3ed43eefcf979e17b84877d03f93 + +commit b5ade3b5a527193ffc6e71f6ce55d3a96a83792a +Author: Pawit Pornkitprasan +Date: Fri Nov 30 19:30:08 2012 +0700 + + Add Samsung STK support (telephony part) + + Support for SMS-based SIM applications. + Partially rewritten the original patch by Jüri Schultz to be less intrusive. + + Change-Id: I15d2de1781a2823e24941dd792db3d372578aa9f + +Change-Id: I476959cfadab0ab14f5ed32adf51adca1e3b26b4 +--- + .../android/internal/telephony/BaseCommands.java | 10 ++ + .../internal/telephony/CommandsInterface.java | 9 ++ + src/java/com/android/internal/telephony/RIL.java | 14 +++ + .../internal/telephony/cat/CallControlResult.java | 44 +++++++ + .../android/internal/telephony/cat/CatService.java | 127 +++++++++++++++++++++ + .../internal/telephony/cat/CommandParams.java | 20 ++++ + .../telephony/cat/CommandParamsFactory.java | 43 ++++++- + .../internal/telephony/cat/ValueParser.java | 99 ++++++++++++++++ + 8 files changed, 365 insertions(+), 1 deletion(-) + create mode 100644 src/java/com/android/internal/telephony/cat/CallControlResult.java + +diff --git a/src/java/com/android/internal/telephony/BaseCommands.java b/src/java/com/android/internal/telephony/BaseCommands.java +index 7ed3206..86449dc 100644 +--- a/src/java/com/android/internal/telephony/BaseCommands.java ++++ b/src/java/com/android/internal/telephony/BaseCommands.java +@@ -86,6 +86,7 @@ public abstract class BaseCommands implements CommandsInterface { + protected Registrant mCatProCmdRegistrant; + protected Registrant mCatEventRegistrant; + protected Registrant mCatCallSetUpRegistrant; ++ protected Registrant mCatSendSmsResultRegistrant; + protected Registrant mIccSmsFullRegistrant; + protected Registrant mEmergencyCallbackModeRegistrant; + protected Registrant mRingRegistrant; +@@ -449,6 +450,15 @@ public abstract class BaseCommands implements CommandsInterface { + } + } + ++ // For Samsung STK ++ public void setOnCatSendSmsResult(Handler h, int what, Object obj) { ++ mCatSendSmsResultRegistrant = new Registrant(h, what, obj); ++ } ++ ++ public void unSetOnCatSendSmsResult(Handler h) { ++ mCatSendSmsResultRegistrant.clear(); ++ } ++ + @Override + public void setOnIccSmsFull(Handler h, int what, Object obj) { + mIccSmsFullRegistrant = new Registrant (h, what, obj); +diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java +index 68837cb..23f5fe5 100644 +--- a/src/java/com/android/internal/telephony/CommandsInterface.java ++++ b/src/java/com/android/internal/telephony/CommandsInterface.java +@@ -2043,4 +2043,13 @@ public interface CommandsInterface { + * CM-specific: Ask the RIL about the presence of back-compat flags + */ + public boolean needsOldRilFeature(String feature); ++ ++ /** ++ * @hide ++ * samsung stk service implementation - set up registrant for sending ++ * sms send result from modem(RIL) to catService ++ */ ++ void setOnCatSendSmsResult(Handler h, int what, Object obj); ++ void unSetOnCatSendSmsResult(Handler h); ++ + } +diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java +index 1e3b83a..1889aa2 100644 +--- a/src/java/com/android/internal/telephony/RIL.java ++++ b/src/java/com/android/internal/telephony/RIL.java +@@ -3083,6 +3083,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + case RIL_UNSOL_ON_SS: ret = responseSsData(p); break; + case RIL_UNSOL_STK_CC_ALPHA_NOTIFY: ret = responseString(p); break; + case RIL_UNSOL_LCEDATA_RECV: ret = responseLceData(p); break; ++ case RIL_UNSOL_STK_SEND_SMS_RESULT: ret = responseInts(p); break; // Samsung STK + + default: + throw new RuntimeException("Unrecognized unsol response: " + response); +@@ -3516,6 +3517,18 @@ public class RIL extends BaseCommands implements CommandsInterface { + mLceInfoRegistrant.notifyRegistrant(new AsyncResult(null, ret, null)); + } + break; ++ // Samsung STK ++ case RIL_UNSOL_STK_SEND_SMS_RESULT: ++ if (Resources.getSystem(). ++ getBoolean(com.android.internal.R.bool.config_samsung_stk)) { ++ if (RILJ_LOGD) unsljLogRet(response, ret); ++ ++ if (mCatSendSmsResultRegistrant != null) { ++ mCatSendSmsResultRegistrant.notifyRegistrant( ++ new AsyncResult (null, ret, null)); ++ } ++ } ++ break; + } + } + +@@ -4515,6 +4528,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + case RIL_UNSOL_ON_SS: return "UNSOL_ON_SS"; + case RIL_UNSOL_STK_CC_ALPHA_NOTIFY: return "UNSOL_STK_CC_ALPHA_NOTIFY"; + case RIL_UNSOL_LCEDATA_RECV: return "UNSOL_LCE_INFO_RECV"; ++ case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT"; + default: return ""; + } + } +diff --git a/src/java/com/android/internal/telephony/cat/CallControlResult.java b/src/java/com/android/internal/telephony/cat/CallControlResult.java +new file mode 100644 +index 0000000..2dbc0d4 +--- /dev/null ++++ b/src/java/com/android/internal/telephony/cat/CallControlResult.java +@@ -0,0 +1,44 @@ ++/* ++ * Copyright (C) 2007 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++package com.android.internal.telephony.cat; ++ ++ ++public enum CallControlResult { ++ ++ CALL_CONTROL_NO_CONTROL(0x00), ++ CALL_CONTROL_ALLOWED_NO_MOD(0x01), ++ CALL_CONTROL_NOT_ALLOWED(0x02), ++ CALL_CONTROL_ALLOWED_WITH_MOD(0x03); ++ private int mValue; ++ ++ CallControlResult(int value) { ++ mValue = value; ++ } ++ ++ public static CallControlResult fromInt(int value) { ++ for (CallControlResult e : CallControlResult.values()) { ++ if (e.mValue == value) { ++ return e; ++ } ++ } ++ return null; ++ } ++ ++ public int value() { ++ return mValue; ++ } ++} +diff --git a/src/java/com/android/internal/telephony/cat/CatService.java b/src/java/com/android/internal/telephony/cat/CatService.java +index e9a5ae2..d374962 100755 +--- a/src/java/com/android/internal/telephony/cat/CatService.java ++++ b/src/java/com/android/internal/telephony/cat/CatService.java +@@ -97,6 +97,10 @@ public class CatService extends Handler implements AppInterface { + private UiccController mUiccController; + private CardState mCardState = CardState.CARDSTATE_ABSENT; + ++ // Samsung STK ++ private int mTimeoutDest = 0; ++ private int mCallControlResultCode = 0; ++ + // Service constants. + protected static final int MSG_ID_SESSION_END = 1; + protected static final int MSG_ID_PROACTIVE_COMMAND = 2; +@@ -110,6 +114,8 @@ public class CatService extends Handler implements AppInterface { + protected static final int MSG_ID_ALPHA_NOTIFY = 9; + + static final int MSG_ID_RIL_MSG_DECODED = 10; ++ static final int MSG_ID_TIMEOUT = 11; // Samsung STK ++ static final int MSG_ID_SEND_SMS_RESULT = 12; // Samsung STK + + // Events to signal SIM presence or absent in the device. + private static final int MSG_ID_ICC_RECORDS_LOADED = 20; +@@ -128,6 +134,14 @@ public class CatService extends Handler implements AppInterface { + private HandlerThread mHandlerThread; + private int mSlotId; + ++ // Samsung STK SEND_SMS ++ static final int WAITING_SMS_RESULT = 2; ++ static final int WAITING_SMS_RESULT_TIME = 60000; ++ ++ static final int SMS_SEND_OK = 0; ++ static final int SMS_SEND_FAIL = 32790; ++ static final int SMS_SEND_RETRY = 32810; ++ + /* For multisim catservice should not be singleton */ + private CatService(CommandsInterface ci, UiccCardApplication ca, IccRecords ir, + Context context, IccFileHandler fh, UiccCard ic, int slotId) { +@@ -155,6 +169,7 @@ public class CatService extends Handler implements AppInterface { + mCmdIf.setOnCatProactiveCmd(this, MSG_ID_PROACTIVE_COMMAND, null); + mCmdIf.setOnCatEvent(this, MSG_ID_EVENT_NOTIFY, null); + mCmdIf.setOnCatCallSetUp(this, MSG_ID_CALL_SETUP, null); ++ mCmdIf.setOnCatSendSmsResult(this, MSG_ID_SEND_SMS_RESULT, null); // Samsung STK + //mCmdIf.setOnSimRefresh(this, MSG_ID_REFRESH, null); + + mCmdIf.registerForIccRefresh(this, MSG_ID_ICC_REFRESH, null); +@@ -248,6 +263,7 @@ public class CatService extends Handler implements AppInterface { + mCmdIf.unSetOnCatEvent(this); + mCmdIf.unSetOnCatCallSetUp(this); + mCmdIf.unSetOnCatCcAlphaNotify(this); ++ mCmdIf.unSetOnCatSendSmsResult(this); + + mCmdIf.unregisterForIccRefresh(this); + if (mUiccController != null) { +@@ -444,8 +460,17 @@ public class CatService extends Handler implements AppInterface { + break; + case SEND_DTMF: + case SEND_SMS: ++ // Samsung STK ++ if (cmdParams instanceof SendSMSParams) { ++ handleProactiveCommandSendSMS((SendSMSParams) cmdParams); ++ } ++ // Fall through + case SEND_SS: + case SEND_USSD: ++ // Samsung STK ++ if (cmdParams instanceof SendUSSDParams) { ++ handleProactiveCommandSendUSSD((SendUSSDParams) cmdParams); ++ } + if ((((DisplayTextParams)cmdParams).mTextMsg.text != null) + && (((DisplayTextParams)cmdParams).mTextMsg.text.equals(STK_DEFAULT))) { + message = mContext.getText(com.android.internal.R.string.sending); +@@ -878,6 +903,76 @@ public class CatService extends Handler implements AppInterface { + CatLog.d(this, "CAT Alpha message: msg.obj is null"); + } + break; ++ case MSG_ID_TIMEOUT: // Should only be called for Samsung STK ++ if (mTimeoutDest == WAITING_SMS_RESULT) { ++ CatLog.d(this, "SMS SEND TIMEOUT"); ++ if (CallControlResult.fromInt(mCallControlResultCode) == ++ CallControlResult.CALL_CONTROL_NOT_ALLOWED) ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.USIM_CALL_CONTROL_PERMANENT, true, 1, null); ++ else ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.TERMINAL_CRNTLY_UNABLE_TO_PROCESS, false, 0, null); ++ break; ++ } ++ break; ++ case MSG_ID_SEND_SMS_RESULT: // Samsung STK SEND_SMS ++ if (mContext.getResources(). ++ getBoolean(com.android.internal.R.bool.config_samsung_stk)) { ++ int[] sendResult; ++ AsyncResult ar; ++ CatLog.d(this, "handleMsg : MSG_ID_SEND_SMS_RESULT"); ++ cancelTimeOut(); ++ CatLog.d(this, "The Msg ID data:" + msg.what); ++ ar = (AsyncResult) msg.obj; ++ if (ar == null || ar.result == null || mCurrntCmd == null || mCurrntCmd.mCmdDet == null) ++ break; ++ sendResult = (int[]) ar.result; ++ if (sendResult.length == 0) ++ break; ++ switch (sendResult[0]) { ++ default: ++ CatLog.d(this, "SMS SEND GENERIC FAIL"); ++ if (CallControlResult.fromInt(mCallControlResultCode) == ++ CallControlResult.CALL_CONTROL_NOT_ALLOWED) ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.USIM_CALL_CONTROL_PERMANENT, true, 1, null); ++ else ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.TERMINAL_CRNTLY_UNABLE_TO_PROCESS, false, 0, null); ++ break; ++ case SMS_SEND_OK: // '\0' ++ CatLog.d(this, "SMS SEND OK"); ++ if (CallControlResult.fromInt(mCallControlResultCode) == ++ CallControlResult.CALL_CONTROL_NOT_ALLOWED) ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.USIM_CALL_CONTROL_PERMANENT, true, 1, null); ++ else ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ResultCode.OK, false, 0, null); ++ break; ++ case SMS_SEND_FAIL: ++ CatLog.d(this, "SMS SEND FAIL - MEMORY NOT AVAILABLE"); ++ if (CallControlResult.fromInt(mCallControlResultCode) == ++ CallControlResult.CALL_CONTROL_NOT_ALLOWED) ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.USIM_CALL_CONTROL_PERMANENT, true, 1, null); ++ else ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.TERMINAL_CRNTLY_UNABLE_TO_PROCESS, false, 0, null); ++ break; ++ case SMS_SEND_RETRY: ++ CatLog.d(this, "SMS SEND FAIL RETRY"); ++ if (CallControlResult.fromInt(mCallControlResultCode) == ++ CallControlResult.CALL_CONTROL_NOT_ALLOWED) ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.USIM_CALL_CONTROL_PERMANENT, true, 1, null); ++ else ++ sendTerminalResponse(mCurrntCmd.mCmdDet, ++ ResultCode.NETWORK_CRNTLY_UNABLE_TO_PROCESS, false, 0, null); ++ break; ++ } ++ } ++ break; + default: + throw new AssertionError("Unrecognized CAT command: " + msg.what); + } +@@ -1150,4 +1245,36 @@ public class CatService extends Handler implements AppInterface { + mCmdIf.reportStkServiceIsRunning(null); + } + } ++ ++ /** ++ * Samsung STK SEND_SMS ++ * @param cmdPar ++ */ ++ private void handleProactiveCommandSendSMS(SendSMSParams cmdPar) { ++ CatLog.d(this, "The smscaddress is: " + cmdPar.smscAddress); ++ CatLog.d(this, "The SMS tpdu is: " + cmdPar.pdu); ++ mCmdIf.sendSMS(cmdPar.smscAddress, cmdPar.pdu, null); ++ startTimeOut(WAITING_SMS_RESULT, WAITING_SMS_RESULT_TIME); ++ } ++ ++ /** ++ * Samsung STK SEND_USSD ++ * @param cmdPar ++ */ ++ private void handleProactiveCommandSendUSSD(SendUSSDParams cmdPar) { ++ CatLog.d(this, "The USSD is: " + cmdPar.ussdString); ++ mCmdIf.sendUSSD(cmdPar.ussdString, null); ++ // Sent USSD, let framework handle the rest ++ } ++ ++ private void cancelTimeOut() { ++ removeMessages(MSG_ID_TIMEOUT); ++ mTimeoutDest = 0; ++ } ++ ++ private void startTimeOut(int timeout, int delay) { ++ cancelTimeOut(); ++ mTimeoutDest = timeout; ++ sendMessageDelayed(obtainMessage(MSG_ID_TIMEOUT), delay); ++ } + } +diff --git a/src/java/com/android/internal/telephony/cat/CommandParams.java b/src/java/com/android/internal/telephony/cat/CommandParams.java +index edb3772..b87b042 100644 +--- a/src/java/com/android/internal/telephony/cat/CommandParams.java ++++ b/src/java/com/android/internal/telephony/cat/CommandParams.java +@@ -234,3 +234,23 @@ class ActivateParams extends CommandParams { + } + } + ++// Samsung STK ++class SendSMSParams extends DisplayTextParams { ++ String pdu; ++ String smscAddress; ++ ++ SendSMSParams(CommandDetails cmdDet, TextMessage textmessage, String smscaddress, String smsPdu) { ++ super(cmdDet, textmessage); ++ smscAddress = smscaddress; ++ pdu = smsPdu; ++ } ++} ++ ++class SendUSSDParams extends DisplayTextParams { ++ String ussdString; ++ ++ SendUSSDParams(CommandDetails cmdDet, TextMessage textmessage, String ussdstring) { ++ super(cmdDet, textmessage); ++ ussdString = ussdstring; ++ } ++} +diff --git a/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java b/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java +index d2ba2d6..b2d9d9b 100755 +--- a/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java ++++ b/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java +@@ -16,6 +16,7 @@ + + package com.android.internal.telephony.cat; + ++import android.content.res.Resources; + import android.graphics.Bitmap; + import android.os.Handler; + import android.os.Message; +@@ -689,7 +690,47 @@ class CommandParamsFactory extends Handler { + } + + textMsg.responseNeeded = false; +- mCmdParams = new DisplayTextParams(cmdDet, textMsg); ++ // Samsung STK ++ AppInterface.CommandType cmdType = AppInterface.CommandType.fromInt(cmdDet.typeOfCommand); ++ boolean isSamsungStk = Resources.getSystem().getBoolean(com.android.internal.R.bool.config_samsung_stk); ++ if (cmdType == AppInterface.CommandType.SEND_SMS && isSamsungStk) { ++ String smscAddress = null; ++ String pdu = null; ++ ++ ctlv = searchForTag(ComprehensionTlvTag.ADDRESS, ctlvs); ++ if (ctlv != null) { ++ smscAddress = ValueParser.retrieveSMSCaddress(ctlv); ++ CatLog.d(this, "The smsc address is " + smscAddress); ++ } ++ else { ++ CatLog.d(this, "The smsc address is null"); ++ } ++ ++ ctlv = searchForTag(ComprehensionTlvTag.SMS_TPDU, ctlvs); ++ if (ctlv != null) { ++ pdu = ValueParser.retrieveSMSTPDU(ctlv); ++ CatLog.d(this, "The SMS tpdu is " + pdu); ++ } ++ else { ++ CatLog.d(this, "The SMS tpdu is null"); ++ } ++ mCmdParams = new SendSMSParams(cmdDet, textMsg, smscAddress, pdu); ++ } ++ else if (cmdType == AppInterface.CommandType.SEND_USSD && isSamsungStk) { ++ String ussdString = null; ++ ctlv = searchForTag(ComprehensionTlvTag.USSD_STRING, ctlvs); ++ if (ctlv != null) { ++ ussdString = ValueParser.retrieveUSSDString(ctlv); ++ CatLog.d(this, "The ussd string is " + ussdString); ++ } ++ else { ++ CatLog.d(this, "The ussd string is null"); ++ } ++ mCmdParams = new SendUSSDParams(cmdDet, textMsg, ussdString); ++ } ++ else { ++ mCmdParams = new DisplayTextParams(cmdDet, textMsg); ++ } + + if (iconId != null) { + mloadIcon = true; +diff --git a/src/java/com/android/internal/telephony/cat/ValueParser.java b/src/java/com/android/internal/telephony/cat/ValueParser.java +index c6b16c7..79c2cf5 100644 +--- a/src/java/com/android/internal/telephony/cat/ValueParser.java ++++ b/src/java/com/android/internal/telephony/cat/ValueParser.java +@@ -366,4 +366,103 @@ abstract class ValueParser { + throw new ResultException(ResultCode.REQUIRED_VALUES_MISSING); + } + } ++ ++ /** ++ * Samsung STK: Read SMSC Address ++ * ++ * @param ctlv A SMSC Address COMPREHENSION-TLV object ++ * @return A Java String object decoded from the SMSC Address object ++ * @throws ResultException ++ */ ++ static String retrieveSMSCaddress(ComprehensionTlv ctlv) ++ throws ResultException { ++ byte[] rawValue = ctlv.getRawValue(); ++ int valueIndex = ctlv.getValueIndex(); ++ int length = ctlv.getLength(); ++ byte[] outputValue = new byte[length + 1]; ++ ++ for (int k = 0; k <= length; k++) { ++ try { ++ outputValue[k] = rawValue[k + (valueIndex - 1)]; ++ } ++ catch (IndexOutOfBoundsException indexoutofboundsexception) { ++ throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD); ++ } ++ } ++ if (length != 0) ++ return IccUtils.bytesToHexString(outputValue); ++ else ++ throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD); ++ } ++ ++ /** ++ * Samsung STK: Read SMS TPDU Address ++ * ++ * @param ctlv A SMS TPDU COMPREHENSION-TLV object ++ * @return A Java String object decoded from the SMS TPDU object ++ * @throws ResultException ++ */ ++ static String retrieveSMSTPDU(ComprehensionTlv ctlv) ++ throws ResultException { ++ byte[] rawValue = ctlv.getRawValue(); ++ int valueIndex = ctlv.getValueIndex(); ++ int pduLength = ctlv.getLength(); ++ byte[] outputValue; ++ int k; ++ String result; ++ if (rawValue[valueIndex + 2] % 2 == 0) ++ k = rawValue[valueIndex + 2] / 2; ++ else ++ k = (1 + rawValue[valueIndex + 2]) / 2; ++ ++ if (pduLength == k + 6) ++ outputValue = new byte[pduLength + 1]; ++ else ++ outputValue = new byte[pduLength]; ++ ++ for (int l = 0; l < pduLength; l++) { ++ try { ++ outputValue[l] = rawValue[valueIndex + l]; ++ } ++ catch (IndexOutOfBoundsException ex) { ++ throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD); ++ } ++ } ++ if (pduLength != 0) ++ result = IccUtils.bytesToHexString(outputValue); ++ else ++ throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD); ++ ++ return result; ++ } ++ ++ /** ++ * Samsung STK: Read USSD String ++ * ++ * @param ctlv A USSD String COMPREHENSION-TLV object ++ * @return A String object decoded from the USSD String object ++ * @throws ResultException ++ */ ++ static String retrieveUSSDString(ComprehensionTlv ctlv) throws ResultException { ++ byte[] rawValue = ctlv.getRawValue(); ++ int valueIndex = ctlv.getValueIndex(); ++ int length = ctlv.getLength(); ++ ++ // If length is 0 (shouldn't be), return null ++ if (length == 0) { ++ return null; ++ } ++ ++ // Should be 0x0f ++ if (rawValue[valueIndex] != 0x0f) { ++ throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD); ++ } ++ ++ try { ++ return GsmAlphabet.gsm7BitPackedToString(rawValue, ++ valueIndex + 1, ((length - 1) * 8) / 7); ++ } catch (IndexOutOfBoundsException e) { ++ throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD); ++ } ++ } + } +-- +2.6.3 + + +From 127d2598ad558b72784245c77e1744f8da11324b Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Sat, 31 May 2014 12:34:56 +0700 -Subject: [PATCH] telephony: support for RIL that does not send +Subject: [PATCH 5/6] telephony: support for RIL that does not send UNSOL_CALL_RING Samsung Broadcom RIL does not send UNSOL_CALL_RING at all, so it @@ -14,10 +765,10 @@ Change-Id: Ib7373d32777f6c42ee488972a7aa63ae8e1cd09b 1 file changed, 19 insertions(+) diff --git a/src/java/com/android/internal/telephony/PhoneBase.java b/src/java/com/android/internal/telephony/PhoneBase.java -index f6ffb49..334bece 100644 +index 07c4b5c..55492f0 100644 --- a/src/java/com/android/internal/telephony/PhoneBase.java +++ b/src/java/com/android/internal/telephony/PhoneBase.java -@@ -220,6 +220,7 @@ public abstract class PhoneBase extends Handler implements Phone { +@@ -227,6 +227,7 @@ public abstract class PhoneBase extends Handler implements Phone { boolean mDnsCheckDisabled; public DcTrackerBase mDcTracker; boolean mDoesRilSendMultipleCallRing; @@ -25,7 +776,7 @@ index f6ffb49..334bece 100644 int mCallRingContinueToken; int mCallRingDelay; public boolean mIsTheCurrentActivePhone = true; -@@ -441,6 +442,11 @@ public abstract class PhoneBase extends Handler implements Phone { +@@ -458,6 +459,11 @@ public abstract class PhoneBase extends Handler implements Phone { TelephonyProperties.PROPERTY_RIL_SENDS_MULTIPLE_CALL_RING, true); Rlog.d(LOG_TAG, "mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing); @@ -37,7 +788,7 @@ index f6ffb49..334bece 100644 mCallRingDelay = SystemProperties.getInt( TelephonyProperties.PROPERTY_CALL_RING_DELAY, 3000); Rlog.d(LOG_TAG, "mCallRingDelay=" + mCallRingDelay); -@@ -1908,6 +1914,18 @@ public abstract class PhoneBase extends Handler implements Phone { +@@ -2119,6 +2125,18 @@ public abstract class PhoneBase extends Handler implements Phone { public void notifyNewRingingConnectionP(Connection cn) { if (!mIsVoiceCapable) return; @@ -56,7 +807,7 @@ index f6ffb49..334bece 100644 AsyncResult ar = new AsyncResult(null, cn, null); mNewRingingConnectionRegistrants.notifyRegistrants(ar); } -@@ -2340,6 +2358,7 @@ public abstract class PhoneBase extends Handler implements Phone { +@@ -2692,6 +2710,7 @@ public abstract class PhoneBase extends Handler implements Phone { pw.println(" mDnsCheckDisabled=" + mDnsCheckDisabled); pw.println(" mDcTracker=" + mDcTracker); pw.println(" mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing); @@ -65,4 +816,32 @@ index f6ffb49..334bece 100644 pw.println(" mCallRingDelay=" + mCallRingDelay); pw.println(" mIsTheCurrentActivePhone=" + mIsTheCurrentActivePhone); -- -2.3.5 +2.6.3 + + +From 2043d240a1d59592863c8e4234a283d9f02a02c3 Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Sat, 15 Nov 2014 17:39:50 +0700 +Subject: [PATCH 6/6] telephony: RIL: i9082: set correct rild names + +Change-Id: Idf8e98ae2f36f30b84be04b7b062ca4b52cebd8a +--- + src/java/com/android/internal/telephony/RIL.java | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java +index 1889aa2..939461a 100644 +--- a/src/java/com/android/internal/telephony/RIL.java ++++ b/src/java/com/android/internal/telephony/RIL.java +@@ -303,7 +303,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + static final int RESPONSE_SOLICITED = 0; + static final int RESPONSE_UNSOLICITED = 1; + +- static final String[] SOCKET_NAME_RIL = {"rild", "rild2", "rild3"}; ++ static final String[] SOCKET_NAME_RIL = {"rild", "rild1", "rild2"}; + + static final int SOCKET_OPEN_RETRY_MILLIS = 4 * 1000; + +-- +2.6.3 + diff --git a/patches/hardware_broadcom_libbt.patch b/patches/hardware_broadcom_libbt.patch index 1d1a66d..9447119 100644 --- a/patches/hardware_broadcom_libbt.patch +++ b/patches/hardware_broadcom_libbt.patch @@ -1,4 +1,4 @@ -From 7db8a8ad776221457e6313635e130395931df8a0 Mon Sep 17 00:00:00 2001 +From bcfc7f0f492bbf3e623f3e8f0e46546e2b69df24 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Tue, 10 Dec 2013 20:09:12 +0700 Subject: [PATCH] libbt: switch to N_BRCM_HCI line disclipline for userial @@ -10,10 +10,10 @@ Change-Id: I12c297c6b26fc0cb6f0a36ed8f5d04d4d36a4092 1 file changed, 11 insertions(+) diff --git a/src/userial_vendor.c b/src/userial_vendor.c -index 949ec4b..be8cd0b 100644 +index 5d0ae9b..2ca3b6c 100644 --- a/src/userial_vendor.c +++ b/src/userial_vendor.c -@@ -196,6 +196,10 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) +@@ -197,6 +197,10 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) uint16_t parity; uint8_t stop_bits; @@ -24,7 +24,7 @@ index 949ec4b..be8cd0b 100644 vnd_userial.fd = -1; if (!userial_to_tcio_baud(p_cfg->baud, &baud)) -@@ -265,6 +269,13 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) +@@ -266,6 +270,13 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios); #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) @@ -39,4 +39,5 @@ index 949ec4b..be8cd0b 100644 #endif -- -2.3.5 +2.6.3 + diff --git a/patches/packages_apps_Camera2.patch b/patches/packages_apps_Camera2.patch index 288a78f..fb7c4c1 100644 --- a/patches/packages_apps_Camera2.patch +++ b/patches/packages_apps_Camera2.patch @@ -1,4 +1,4 @@ -From ead4750e7201f3437e3a9adbebdbd5f6b6594767 Mon Sep 17 00:00:00 2001 +From a65a46ab2c9d272f8323e95ff5a076a7fc6357c8 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Fri, 23 Jan 2015 20:34:16 +0700 Subject: [PATCH 1/2] Camera: i9082: disable preview after stopping camera @@ -15,10 +15,10 @@ Change-Id: I231233d28a1f7ac914408a7d02100a9424c2bf1c 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java -index f96d634..820ce24 100644 +index bf48898..85c5407 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java -@@ -1643,7 +1643,7 @@ public class CameraActivity extends QuickActivity +@@ -1743,7 +1743,7 @@ public class CameraActivity extends QuickActivity mCurrentModule.onPreviewVisibilityChanged(visibility); } @@ -28,10 +28,10 @@ index f96d634..820ce24 100644 mCameraAppUI.pausePreviewRendering(); } else { diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java -index b4b5ee7..52b8858 100644 +index c08e900..e0af88a 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java -@@ -1874,6 +1874,7 @@ public class PhotoModule +@@ -1714,6 +1714,7 @@ public class PhotoModule mActivity.getCameraProvider().releaseCamera(mCameraDevice.getCameraId()); mCameraDevice = null; setCameraState(PREVIEW_STOPPED); @@ -40,10 +40,10 @@ index b4b5ee7..52b8858 100644 } } diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java -index a034a1c..f203c12 100644 +index f16fc0a..e8e7014 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java -@@ -1026,6 +1026,7 @@ public class VideoModule extends CameraModule +@@ -1007,6 +1007,7 @@ public class VideoModule extends CameraModule } mCameraDevice.setZoomChangeListener(null); mActivity.getCameraProvider().releaseCamera(mCameraDevice.getCameraId()); @@ -52,10 +52,10 @@ index a034a1c..f203c12 100644 mPreviewing = false; mSnapshotInProgress = false; -- -2.3.5 +2.6.3 -From 79478cabada02634258b3567b282271fc4e28b92 Mon Sep 17 00:00:00 2001 +From 05618a6fa500b97b6e2848a79e63a918880ba029 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Sat, 24 Jan 2015 21:59:20 +0700 Subject: [PATCH 2/2] Camera: i9082: update preview state after starting @@ -72,10 +72,10 @@ Change-Id: I036539aa602d738372f421499cf5ac8c646523ed 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java -index 820ce24..fcb44bd 100644 +index 85c5407..cef9435 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java -@@ -1632,7 +1632,7 @@ public class CameraActivity extends QuickActivity +@@ -1732,7 +1732,7 @@ public class CameraActivity extends QuickActivity * Call this whenever the mode drawer or filmstrip change the visibility * state. */ @@ -85,10 +85,10 @@ index 820ce24..fcb44bd 100644 return; } diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java -index 52b8858..8e3f2e6 100644 +index e0af88a..9041d18 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java -@@ -1987,6 +1987,7 @@ public class PhotoModule +@@ -1827,6 +1827,7 @@ public class PhotoModule mCameraDevice.startPreviewWithCallback(new Handler(Looper.getMainLooper()), startPreviewCallback); } @@ -97,10 +97,10 @@ index 52b8858..8e3f2e6 100644 @Override diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java -index f203c12..129f39a 100644 +index e8e7014..2ee79f3 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java -@@ -981,6 +981,7 @@ public class VideoModule extends CameraModule +@@ -962,6 +962,7 @@ public class VideoModule extends CameraModule } }); mPreviewing = true; @@ -109,4 +109,5 @@ index f203c12..129f39a 100644 closeCamera(); throw new RuntimeException("startPreview failed", ex); -- -2.3.5 +2.6.3 + diff --git a/patches/packages_apps_Trebuchet.patch b/patches/packages_apps_Trebuchet.patch index 2d02c7f..84eb1b8 100644 --- a/patches/packages_apps_Trebuchet.patch +++ b/patches/packages_apps_Trebuchet.patch @@ -1,55 +1,63 @@ -From 53460b14dd8636c0fdf66586c3af9a8ef6acc6dd Mon Sep 17 00:00:00 2001 -From: Pawit Pornkitprasan -Date: Sun, 1 Feb 2015 15:26:48 +0700 +From 11d435594dd0fc98069a3e457164fcfeba46dfa6 Mon Sep 17 00:00:00 2001 +From: ghsr +Date: Tue, 29 Sep 2015 10:06:36 +0600 Subject: [PATCH 1/2] Revert "DynamicGrid: tuning the icon size for some device" This reverts commit edbea0af1226978b06d7f877ae435797d31419af. + + Conflicts: + src/com/android/launcher3/DynamicGrid.java + +Change-Id: Ic1d810880819799e7b6ef39f06c280da46460b12 --- src/com/android/launcher3/DynamicGrid.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java -index 779a5a6..1494311 100644 +index 6e889de..2355c95 100644 --- a/src/com/android/launcher3/DynamicGrid.java +++ b/src/com/android/launcher3/DynamicGrid.java -@@ -87,15 +87,15 @@ public class DynamicGrid { - (useLargeIcons ? 58 : 46), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); +@@ -82,13 +82,13 @@ public class DynamicGrid { + 296, 491.33f, 4, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5), + (useLargeIcons ? 58 : 46), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Nexus 4", - 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), 13, (hasAA ? 5 : 5), -- (useLargeIcons ? 60 : 48), fourByFourDefaultLayout, +- (useLargeIcons ? 60 : 48), fourByFourDefaultLayout)); + 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5), -+ (useLargeIcons ? 60 : 46), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 60 : 46), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Nexus 5", - 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), 13, (hasAA ? 5 : 5), -- (useLargeIcons ? 60 : 48), fourByFourDefaultLayout, +- (useLargeIcons ? 60 : 48), fourByFourDefaultLayout)); + 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5), -+ (useLargeIcons ? 60 : 46), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 60 : 46), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Large Phone", - 406, 694, 5, 5, (useLargeIcons ? 68 : 56), 14.4f, 5, (useLargeIcons ? 60 : 48), + 406, 694, 5, 5, (useLargeIcons ? 68 : 52), 14.4f, 5, (useLargeIcons ? 60 : 44), - R.xml.default_workspace_5x5, R.xml.default_workspace_5x5_no_all_apps)); + R.xml.default_workspace_5x5)); // The tablet profile is odd in that the landscape orientation // also includes the nav bar on the side -- -2.3.5 +2.6.3 -From fd7126f1359e15f42e357e4b15d16b821f497e86 Mon Sep 17 00:00:00 2001 -From: Pawit Pornkitprasan -Date: Sun, 1 Feb 2015 15:26:50 +0700 +From 5b38ae716a56acef75d750107f3d7c37b671a08f Mon Sep 17 00:00:00 2001 +From: ghsr +Date: Tue, 29 Sep 2015 10:11:02 +0600 Subject: [PATCH 2/2] Revert "Update Larger icons setting for better usability" This reverts commit 5c7529006f3ed78d934fed2861cebd3654695108. + + Conflicts: + src/com/android/launcher3/DynamicGrid.java + +Change-Id: Iba64c88d820be209d392e367ed0f1a78768f3b78 --- src/com/android/launcher3/DynamicGrid.java | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java -index 1494311..d2a5ff7 100644 +index 2355c95..dff2b6d 100644 --- a/src/com/android/launcher3/DynamicGrid.java +++ b/src/com/android/launcher3/DynamicGrid.java @@ -34,7 +34,7 @@ public class DynamicGrid { @@ -61,71 +69,65 @@ index 1494311..d2a5ff7 100644 static float DEFAULT_ICON_SIZE_PX = 0; public static float dpiFromPx(int size, DisplayMetrics metrics){ -@@ -67,47 +67,47 @@ public class DynamicGrid { +@@ -67,40 +67,40 @@ public class DynamicGrid { DEFAULT_ICON_SIZE_PX = pxFromDp(DEFAULT_ICON_SIZE_DP, dm); // Our phone profiles include the bar sizes in each orientation deviceProfiles.add(new DeviceProfile("Super Short Stubby", - 255, 300, 2, 3, (useLargeIcons ? 58 : 46), 13, (hasAA ? 3 : 5), -- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout, +- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout)); + 255, 300, 2, 3, (useLargeIcons ? 54 : 48), 13, (hasAA ? 3 : 5), -+ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Shorter Stubby", - 255, 400, 3, 3, (useLargeIcons ? 58 : 46), 13, (hasAA ? 3 : 5), -- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout, +- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout)); + 255, 400, 3, 3, (useLargeIcons ? 54 : 48), 13, (hasAA ? 3 : 5), -+ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Short Stubby", - 275, 420, 3, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5), -- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout, +- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout)); + 275, 420, 3, 4, (useLargeIcons ? 54 : 48), 13, (hasAA ? 5 : 5), -+ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Stubby", - 255, 450, 3, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5), -- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout, +- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout)); + 255, 450, 3, 4, (useLargeIcons ? 54 : 48), 13, (hasAA ? 5 : 5), -+ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Nexus S", - 296, 491.33f, 4, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5), -- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout, +- (useLargeIcons ? 58 : 46), fourByFourDefaultLayout)); + 296, 491.33f, 4, 4, (useLargeIcons ? 54 : 48), 13, (hasAA ? 5 : 5), -+ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 54 : 48), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Nexus 4", - 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5), -- (useLargeIcons ? 60 : 46), fourByFourDefaultLayout, +- (useLargeIcons ? 60 : 46), fourByFourDefaultLayout)); + 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), 13, (hasAA ? 5 : 5), -+ (useLargeIcons ? 56 : 48), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 56 : 48), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Nexus 5", - 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5), -- (useLargeIcons ? 60 : 46), fourByFourDefaultLayout, +- (useLargeIcons ? 60 : 46), fourByFourDefaultLayout)); + 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), 13, (hasAA ? 5 : 5), -+ (useLargeIcons ? 56 : 48), fourByFourDefaultLayout, - R.xml.default_workspace_4x4_no_all_apps)); ++ (useLargeIcons ? 56 : 48), fourByFourDefaultLayout)); deviceProfiles.add(new DeviceProfile("Large Phone", - 406, 694, 5, 5, (useLargeIcons ? 68 : 52), 14.4f, 5, (useLargeIcons ? 60 : 44), + 406, 694, 5, 5, (useLargeIcons ? 64 : 56), 14.4f, 5, (useLargeIcons ? 56 : 48), - R.xml.default_workspace_5x5, R.xml.default_workspace_5x5_no_all_apps)); + R.xml.default_workspace_5x5)); // The tablet profile is odd in that the landscape orientation // also includes the nav bar on the side deviceProfiles.add(new DeviceProfile("Nexus 7", - 575, 904, 5, 6, (useLargeIcons ? 76 : 60), 14.4f, 7, (useLargeIcons ? 64 : 52), + 575, 904, 5, 6, (useLargeIcons ? 72 : 60), 14.4f, 7, (useLargeIcons ? 60 : 52), - R.xml.default_workspace_5x6, R.xml.default_workspace_5x6_no_all_apps)); + R.xml.default_workspace_5x6)); // Larger tablet profiles always have system bars on the top & bottom deviceProfiles.add(new DeviceProfile("Nexus 10", - 727, 1207, 5, 6, (useLargeIcons ? 80 : 64), 14.4f, 7, (useLargeIcons ? 68 : 56), + 727, 1207, 5, 6, (useLargeIcons ? 76 : 64), 14.4f, 7, (useLargeIcons ? 64 : 56), - R.xml.default_workspace_5x6, R.xml.default_workspace_5x6_no_all_apps)); + R.xml.default_workspace_5x6)); deviceProfiles.add(new DeviceProfile("20-inch Tablet", - 1527, 2527, 7, 7, (useLargeIcons ? 104 : 80), 20, 7, (useLargeIcons ? 76 : 64), + 1527, 2527, 7, 7, (useLargeIcons ? 100 : 80), 20, 7, (useLargeIcons ? 72 : 64), - fourByFourDefaultLayout, R.xml.default_workspace_4x4_no_all_apps)); + fourByFourDefaultLayout)); mMinWidth = dpiFromPx(minWidthPx, dm); mMinHeight = dpiFromPx(minHeightPx, dm); -- -2.3.5 +2.6.3 + diff --git a/patches/packages_services_Telephony.patch b/patches/packages_services_Telephony.patch index 1257dcc..69f89a2 100644 --- a/patches/packages_services_Telephony.patch +++ b/patches/packages_services_Telephony.patch @@ -1,4 +1,4 @@ -From cbc8dba1979f3a905dc5b78d58d151ef5ff34dde Mon Sep 17 00:00:00 2001 +From eb5a77414ba56b3d576cdad2fedc9ca175c06c1a Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Fri, 20 Feb 2015 20:26:52 +0700 Subject: [PATCH] Telephony: HACK: enable WCDMA only setting @@ -7,15 +7,15 @@ Samsung stock allows WCDMA only Change-Id: If552c6439f7b6910422ec5549e54e68da798c82e --- - res/values/strings.xml | 8 +++++--- - src/com/android/phone/MobileNetworkSettings.java | 6 +++--- - 2 files changed, 8 insertions(+), 6 deletions(-) + res/values/strings.xml | 8 +++++--- + src/com/android/phone/MobileNetworkSettings.java | 15 +++++++++++++-- + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml -index 6aa2eec..f6a82d4 100644 +index 44e56b9..c8fdec4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml -@@ -609,12 +609,14 @@ +@@ -706,12 +706,14 @@ @@ -34,32 +34,50 @@ index 6aa2eec..f6a82d4 100644 diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java -index 441510d..da770b2 100644 +index dffc992..f739d88 100644 --- a/src/com/android/phone/MobileNetworkSettings.java +++ b/src/com/android/phone/MobileNetworkSettings.java -@@ -921,7 +921,7 @@ public class MobileNetworkSettings extends PreferenceActivity - case Phone.NT_MODE_WCDMA_ONLY: - mButtonEnabledNetworks.setValue( - Integer.toString(Phone.NT_MODE_WCDMA_ONLY)); -- mButtonEnabledNetworks.setSummary(R.string.network_wcdma_only); -+ mButtonEnabledNetworks.setSummary(R.string.preferred_network_mode_wcdma_only_choice); +@@ -916,6 +916,7 @@ public class MobileNetworkSettings extends PreferenceActivity + switch (buttonNetworkMode) { + case Phone.NT_MODE_WCDMA_PREF: + case Phone.NT_MODE_GSM_ONLY: ++ case Phone.NT_MODE_WCDMA_ONLY: + case Phone.NT_MODE_LTE_GSM_WCDMA: + case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA: + case Phone.NT_MODE_CDMA: +@@ -1175,12 +1176,22 @@ public class MobileNetworkSettings extends PreferenceActivity + mButtonEnabledNetworks.setSummary(R.string.network_3G); break; + case Phone.NT_MODE_WCDMA_ONLY: ++ if (!mIsGlobalCdma) { ++ mButtonEnabledNetworks.setValue( ++ Integer.toString(Phone.NT_MODE_WCDMA_ONLY)); ++ mButtonEnabledNetworks.setSummary(R.string.preferred_network_mode_wcdma_only_choice); ++ } else { ++ mButtonEnabledNetworks.setValue( ++ Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA)); ++ mButtonEnabledNetworks.setSummary(R.string.network_global); ++ } ++ break; case Phone.NT_MODE_GSM_UMTS: - mButtonEnabledNetworks.setValue( -@@ -931,12 +931,12 @@ public class MobileNetworkSettings extends PreferenceActivity case Phone.NT_MODE_WCDMA_PREF: - mButtonEnabledNetworks.setValue( - Integer.toString(Phone.NT_MODE_WCDMA_PREF)); -- mButtonEnabledNetworks.setSummary(R.string.network_wcdma_pref); -+ mButtonEnabledNetworks.setSummary(R.string.preferred_network_mode_gsm_wcdma_preferred_choice); - break; - case Phone.NT_MODE_GSM_ONLY: - mButtonEnabledNetworks.setValue( - Integer.toString(Phone.NT_MODE_GSM_ONLY)); -- mButtonEnabledNetworks.setSummary(R.string.network_gsm_only); -+ mButtonEnabledNetworks.setSummary(R.string.preferred_network_mode_gsm_only_choice); - break; - case Phone.NT_MODE_LTE_GSM_WCDMA: - mButtonEnabledNetworks.setValue( + if (!mIsGlobalCdma) { + mButtonEnabledNetworks.setValue( + Integer.toString(Phone.NT_MODE_WCDMA_PREF)); +- mButtonEnabledNetworks.setSummary(R.string.network_3G); ++ mButtonEnabledNetworks.setSummary(R.string.preferred_network_mode_gsm_wcdma_preferred_choice); + } else { + mButtonEnabledNetworks.setValue( + Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA)); +@@ -1191,7 +1202,7 @@ public class MobileNetworkSettings extends PreferenceActivity + if (!mIsGlobalCdma) { + mButtonEnabledNetworks.setValue( + Integer.toString(Phone.NT_MODE_GSM_ONLY)); +- mButtonEnabledNetworks.setSummary(R.string.network_2G); ++ mButtonEnabledNetworks.setSummary(R.string.preferred_network_mode_gsm_only_choice); + } else { + mButtonEnabledNetworks.setValue( + Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA)); -- -2.3.5 +2.6.3 + diff --git a/patches/system_core.patch b/patches/system_core.patch index b0b02ec..694331c 100644 --- a/patches/system_core.patch +++ b/patches/system_core.patch @@ -1,7 +1,234 @@ -From 9d575270bb983608a5bf97050bc9c97c6e26aa29 Mon Sep 17 00:00:00 2001 +From 62d6962682b69cccd0f9ebd0e82f5611c16f86eb Mon Sep 17 00:00:00 2001 +From: Dave Burke +Date: Wed, 24 Oct 2012 17:30:31 -0700 +Subject: [PATCH 1/5] Revert "Revert "put back the unused virtuals in + Vector<>"" + +This reverts commit 225c66a48cdc3acef21ee380dc134449749d3cb3 + +Change-Id: If31a04b81052cbc7dd7bf237c07107c33066d03d + +Conditionally Revert "put back the unused virtuals in Vector<>" + +These symbols are needed for MR2 camera.tegra and other blobs, +but they conflict with KK blobs so define it for devices that +need it by setting COMMON_GLOBAL_CFLAGS += -DNEEDS_VECTORIMPL_SYMBOLS + +Change-Id: I59e66074526f013918a29c3afc10e52b9812778c +--- + include/utils/VectorImpl.h | 26 +++++++++++++++++++++++++- + libutils/VectorImpl.cpp | 22 ++++++++++++++++++++++ + 2 files changed, 47 insertions(+), 1 deletion(-) + +diff --git a/include/utils/VectorImpl.h b/include/utils/VectorImpl.h +index 21ad71c..cab95be 100644 +--- a/include/utils/VectorImpl.h ++++ b/include/utils/VectorImpl.h +@@ -105,7 +105,19 @@ protected: + virtual void do_splat(void* dest, const void* item, size_t num) const = 0; + virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0; + virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0; +- ++ ++#if NEEDS_VECTORIMPL_SYMBOLS ++ // take care of FBC... ++ virtual void reservedVectorImpl1(); ++ virtual void reservedVectorImpl2(); ++ virtual void reservedVectorImpl3(); ++ virtual void reservedVectorImpl4(); ++ virtual void reservedVectorImpl5(); ++ virtual void reservedVectorImpl6(); ++ virtual void reservedVectorImpl7(); ++ virtual void reservedVectorImpl8(); ++#endif ++ + private: + void* _grow(size_t where, size_t amount); + void _shrink(size_t where, size_t amount); +@@ -156,6 +168,18 @@ public: + protected: + virtual int do_compare(const void* lhs, const void* rhs) const = 0; + ++#if NEEDS_VECTORIMPL_SYMBOLS ++ // take care of FBC... ++ virtual void reservedSortedVectorImpl1(); ++ virtual void reservedSortedVectorImpl2(); ++ virtual void reservedSortedVectorImpl3(); ++ virtual void reservedSortedVectorImpl4(); ++ virtual void reservedSortedVectorImpl5(); ++ virtual void reservedSortedVectorImpl6(); ++ virtual void reservedSortedVectorImpl7(); ++ virtual void reservedSortedVectorImpl8(); ++#endif ++ + private: + ssize_t _indexOrderOf(const void* item, size_t* order = 0) const; + +diff --git a/libutils/VectorImpl.cpp b/libutils/VectorImpl.cpp +index de65a6c..6d4e601 100644 +--- a/libutils/VectorImpl.cpp ++++ b/libutils/VectorImpl.cpp +@@ -552,6 +552,17 @@ void VectorImpl::_do_move_backward(void* dest, const void* from, size_t num) con + do_move_backward(dest, from, num); + } + ++#if NEEDS_VECTORIMPL_SYMBOLS ++void VectorImpl::reservedVectorImpl1() { } ++void VectorImpl::reservedVectorImpl2() { } ++void VectorImpl::reservedVectorImpl3() { } ++void VectorImpl::reservedVectorImpl4() { } ++void VectorImpl::reservedVectorImpl5() { } ++void VectorImpl::reservedVectorImpl6() { } ++void VectorImpl::reservedVectorImpl7() { } ++void VectorImpl::reservedVectorImpl8() { } ++#endif ++ + /*****************************************************************************/ + + SortedVectorImpl::SortedVectorImpl(size_t itemSize, uint32_t flags) +@@ -667,6 +678,17 @@ ssize_t SortedVectorImpl::remove(const void* item) + return i; + } + ++#if NEEDS_VECTORIMPL_SYMBOLS ++void SortedVectorImpl::reservedSortedVectorImpl1() { }; ++void SortedVectorImpl::reservedSortedVectorImpl2() { }; ++void SortedVectorImpl::reservedSortedVectorImpl3() { }; ++void SortedVectorImpl::reservedSortedVectorImpl4() { }; ++void SortedVectorImpl::reservedSortedVectorImpl5() { }; ++void SortedVectorImpl::reservedSortedVectorImpl6() { }; ++void SortedVectorImpl::reservedSortedVectorImpl7() { }; ++void SortedVectorImpl::reservedSortedVectorImpl8() { }; ++#endif ++ + /*****************************************************************************/ + + }; // namespace android +-- +2.6.3 + + +From 4b04d565696c415f51f9fb91f73ca22efc7b3c64 Mon Sep 17 00:00:00 2001 +From: Arne Coucheron +Date: Wed, 3 Dec 2014 06:14:55 +0100 +Subject: [PATCH 2/5] libutils: Properly #ifdef NEEDS_VECTORIMPL_SYMBOLS + + * Compile error might occur otherwise + +Change-Id: I982e5f72ea4e84594e415394cceed44f90045526 +--- + include/utils/VectorImpl.h | 4 ++-- + libutils/VectorImpl.cpp | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/utils/VectorImpl.h b/include/utils/VectorImpl.h +index cab95be..88c3a05 100644 +--- a/include/utils/VectorImpl.h ++++ b/include/utils/VectorImpl.h +@@ -106,7 +106,7 @@ protected: + virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0; + virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0; + +-#if NEEDS_VECTORIMPL_SYMBOLS ++#ifdef NEEDS_VECTORIMPL_SYMBOLS + // take care of FBC... + virtual void reservedVectorImpl1(); + virtual void reservedVectorImpl2(); +@@ -168,7 +168,7 @@ public: + protected: + virtual int do_compare(const void* lhs, const void* rhs) const = 0; + +-#if NEEDS_VECTORIMPL_SYMBOLS ++#ifdef NEEDS_VECTORIMPL_SYMBOLS + // take care of FBC... + virtual void reservedSortedVectorImpl1(); + virtual void reservedSortedVectorImpl2(); +diff --git a/libutils/VectorImpl.cpp b/libutils/VectorImpl.cpp +index 6d4e601..ffd552b 100644 +--- a/libutils/VectorImpl.cpp ++++ b/libutils/VectorImpl.cpp +@@ -552,7 +552,7 @@ void VectorImpl::_do_move_backward(void* dest, const void* from, size_t num) con + do_move_backward(dest, from, num); + } + +-#if NEEDS_VECTORIMPL_SYMBOLS ++#ifdef NEEDS_VECTORIMPL_SYMBOLS + void VectorImpl::reservedVectorImpl1() { } + void VectorImpl::reservedVectorImpl2() { } + void VectorImpl::reservedVectorImpl3() { } +@@ -678,7 +678,7 @@ ssize_t SortedVectorImpl::remove(const void* item) + return i; + } + +-#if NEEDS_VECTORIMPL_SYMBOLS ++#ifdef NEEDS_VECTORIMPL_SYMBOLS + void SortedVectorImpl::reservedSortedVectorImpl1() { }; + void SortedVectorImpl::reservedSortedVectorImpl2() { }; + void SortedVectorImpl::reservedSortedVectorImpl3() { }; +-- +2.6.3 + + +From 60b85a6c60feae92bba9b9a967eba4a60e4c9a4f Mon Sep 17 00:00:00 2001 +From: codeworkx +Date: Sat, 27 Jul 2013 08:18:42 +0200 +Subject: [PATCH 3/5] libutils: refbase: jellybean mr1 compat + +[mikeioannina]: Update for L +Can be enabled with global cflag REFBASE_JB_MR1_COMPAT_SYMBOLS + +Change-Id: Ideee0c3814a17b47f70fd612d27067fe19ae698d +--- + include/utils/RefBase.h | 9 +++++++++ + libutils/RefBase.cpp | 7 +++++++ + 2 files changed, 16 insertions(+) + +diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h +index eac6a78..b25bbce 100644 +--- a/include/utils/RefBase.h ++++ b/include/utils/RefBase.h +@@ -53,6 +53,15 @@ inline bool operator _op_ (const U* o) const { \ + + // --------------------------------------------------------------------------- + ++#ifdef REFBASE_JB_MR1_COMPAT_SYMBOLS ++class ReferenceConverterBase { ++public: ++ virtual size_t getReferenceTypeSize() const = 0; ++ virtual void* getReferenceBase(void const*) const = 0; ++ inline virtual ~ReferenceConverterBase() { } ++}; ++#endif ++ + class ReferenceRenamer { + protected: + // destructor is purposedly not virtual so we avoid code overhead from +diff --git a/libutils/RefBase.cpp b/libutils/RefBase.cpp +index 02907ad..b0ca12e 100644 +--- a/libutils/RefBase.cpp ++++ b/libutils/RefBase.cpp +@@ -630,6 +630,13 @@ void RefBase::onLastWeakRef(const void* /*id*/) + + // --------------------------------------------------------------------------- + ++#ifdef REFBASE_JB_MR1_COMPAT_SYMBOLS ++extern "C" void _ZN7android7RefBase14moveReferencesEPvPKvjRKNS_22ReferenceConverterBaseE(void* /*dst*/, void const* /*src*/, size_t /*n*/, ++ const ReferenceConverterBase& /*caster*/) ++{ ++} ++#endif ++ + #if DEBUG_REFS + void RefBase::renameRefs(size_t n, const ReferenceRenamer& renamer) { + for (size_t i=0 ; i Date: Fri, 12 Apr 2013 11:40:15 +0700 -Subject: [PATCH] libnetutils: add ifc_set_mtu +Subject: [PATCH 4/5] libnetutils: add ifc_set_mtu Change-Id: I3031e9ee38583648350f2c46baa7a9a714b9ea1e --- @@ -9,10 +236,10 @@ Change-Id: I3031e9ee38583648350f2c46baa7a9a714b9ea1e 1 file changed, 16 insertions(+) diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c -index d9c50ab..2394f9d 100644 +index 3bd59c7..c3ccf32 100644 --- a/libnetutils/ifc_utils.c +++ b/libnetutils/ifc_utils.c -@@ -704,3 +704,19 @@ ifc_configure(const char *ifname, +@@ -703,3 +703,19 @@ ifc_configure(const char *ifname, return 0; } @@ -33,4 +260,31 @@ index d9c50ab..2394f9d 100644 + return ret; +} -- -2.3.5 +2.6.3 + + +From 40b7bea16bae471e79787ab7111a871a8f3d5970 Mon Sep 17 00:00:00 2001 +From: Pawit Pornkitprasan +Date: Sun, 11 Oct 2015 21:11:25 +0700 +Subject: [PATCH 5/5] HACK: temporarily change SELinux to permissive + +--- + init/init.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/init/init.cpp b/init/init.cpp +index 1c45795..ecea616 100644 +--- a/init/init.cpp ++++ b/init/init.cpp +@@ -887,7 +887,7 @@ static void selinux_init_all_handles(void) + enum selinux_enforcing_status { SELINUX_DISABLED, SELINUX_PERMISSIVE, SELINUX_ENFORCING }; + + static selinux_enforcing_status selinux_status_from_cmdline() { +- selinux_enforcing_status status = SELINUX_ENFORCING; ++ selinux_enforcing_status status = SELINUX_PERMISSIVE; + + std::function fn = [&](char* name, bool in_qemu) { + char *value = strchr(name, '='); +-- +2.6.3 + diff --git a/patches/vendor_cm.patch b/patches/vendor_cm.patch deleted file mode 100644 index 5e7a854..0000000 --- a/patches/vendor_cm.patch +++ /dev/null @@ -1,24 +0,0 @@ -From a2e24c02c8de1c8d2ad51a55d94e93e99615e4ac Mon Sep 17 00:00:00 2001 -From: andixlm -Date: Sat, 24 Jan 2015 18:18:09 +0500 -Subject: [PATCH] Remove CMUpdater package - -Change-Id: Icfd0785ded840df8ce05ac231a507e40d4e62c07 ---- - config/common.mk | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/config/common.mk b/config/common.mk -index e3a5228..815b9c5 100644 ---- a/config/common.mk -+++ b/config/common.mk -@@ -146,7 +146,6 @@ PRODUCT_PACKAGES += \ - CMFileManager \ - Eleven \ - LockClock \ -- CMUpdater \ - CMAccount \ - CMHome \ - CyanogenSetupWizard --- -2.1.4 diff --git a/resync b/resync index 1f8a77c..4028c4a 100755 --- a/resync +++ b/resync @@ -20,6 +20,7 @@ repo forall -c 'git reset --hard ; git clean -fdx' # Sync sources if [[ -n $RO ]]; then + repo sync -l exit 0 else repo sync -f