Skip to content

Instantly share code, notes, and snippets.

@pawitp
Last active February 22, 2016 01:47
Show Gist options
  • Save pawitp/88a1d4514a0734c866c7 to your computer and use it in GitHub Desktop.
Save pawitp/88a1d4514a0734c866c7 to your computer and use it in GitHub Desktop.

Revisions

  1. pawitp revised this gist Feb 22, 2016. 1 changed file with 16 additions and 16 deletions.
    32 changes: 16 additions & 16 deletions build.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From f0317ad5345871b7a543b95026d3a33ff7ddbc9a Mon Sep 17 00:00:00 2001
    From 0365cf5760585f88bc093a86b176775683765475 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 28 Nov 2014 21:16:21 +0700
    Subject: [PATCH 1/4] ota: custom support for i9082 xda release
    @@ -12,10 +12,10 @@ Change-Id: Ib036f4291a0d8b6a636aa6bc43beaddce0f34152
    4 files changed, 39 insertions(+), 7 deletions(-)

    diff --git a/envsetup.sh b/envsetup.sh
    index 51f3253..3ec08d5 100644
    index d37d3c7..0dcdec0 100644
    --- a/envsetup.sh
    +++ b/envsetup.sh
    @@ -76,7 +76,7 @@ function check_product()
    @@ -78,7 +78,7 @@ function check_product()

    if (echo -n $1 | grep -q -e "^cm_") ; then
    CM_BUILD=$(echo -n $1 | sed -e 's/^cm_//g')
    @@ -118,10 +118,10 @@ index 011fe53..4e19a17 100755
    "/tmp/boot.img", "boot.img", OPTIONS.source_tmp, "BOOT",
    OPTIONS.source_info_dict)
    --
    1.9.1
    2.5.4 (Apple Git-61)


    From 33c0bfaf0efb29951ce739120b5a1792bf0e00bf Mon Sep 17 00:00:00 2001
    From 6ef4a9fda647f4f5706977bd940a7012a043058b Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 16 Dec 2014 19:19:52 +0700
    Subject: [PATCH 2/4] build: minigzip dependency for kernel
    @@ -134,23 +134,23 @@ Change-Id: I8c07a76eec568bce641b158d01ef8cd88b9997d4
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk
    index e10adeb..f5bf33f 100644
    index 4283dbb..91714da 100644
    --- a/core/tasks/kernel.mk
    +++ b/core/tasks/kernel.mk
    @@ -229,7 +229,7 @@ $(KERNEL_CONFIG): $(KERNEL_OUT)
    @@ -252,7 +252,7 @@ $(KERNEL_CONFIG): $(KERNEL_OUT_STAMP) $(KERNEL_DEFCONFIG_SRC) $(KERNEL_ADDITIONA
    $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
    $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi

    -TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL)
    +TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) $(MINIGZIP)
    -TARGET_KERNEL_BINARIES: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP)
    +TARGET_KERNEL_BINARIES: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP) $(MINIGZIP)
    @echo -e ${CL_GRN}"Building Kernel"${CL_RST}
    $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
    -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs
    -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules
    $(hide) if grep -q 'CONFIG_OF=y' $(KERNEL_CONFIG) ; \
    --
    1.9.1
    2.5.4 (Apple Git-61)


    From 0581df2b70aea09c18d3af5a8bfd5c3f86a80951 Mon Sep 17 00:00:00 2001
    From 1a1d6a73c200ceefc13de74351ae30a7c0116ba0 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Jun 2015 09:52:59 +0700
    Subject: [PATCH 3/4] ota: make delta compatible with
    @@ -175,10 +175,10 @@ index 4e19a17..6bf9af5 100755
    "system/lib/librs_jni.so",\
    "system/lib/libjni_latinime.so",\
    --
    1.9.1
    2.5.4 (Apple Git-61)


    From fbf67065a0cee880b77a9fa6167bafd75503f765 Mon Sep 17 00:00:00 2001
    From 1bd0bc68f339c96570115bb64cbbdf43d65b5933 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 15 Nov 2015 00:42:50 -0500
    Subject: [PATCH 4/4] ota: make delta compatible with capps
    @@ -219,5 +219,5 @@ index 6bf9af5..ec3eb9d 100755
    OPTIONS.wipe_user_data = False
    OPTIONS.omit_prereq = False
    --
    1.9.1
    2.5.4 (Apple Git-61)

  2. pawitp revised this gist Nov 15, 2015. 1 changed file with 223 additions and 0 deletions.
    223 changes: 223 additions & 0 deletions build.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,223 @@
    From f0317ad5345871b7a543b95026d3a33ff7ddbc9a Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 28 Nov 2014 21:16:21 +0700
    Subject: [PATCH 1/4] ota: custom support for i9082 xda release

    Change-Id: Ib036f4291a0d8b6a636aa6bc43beaddce0f34152
    ---
    envsetup.sh | 2 +-
    tools/buildinfo.sh | 2 ++
    tools/releasetools/edify_generator.py | 13 +++++++++++++
    tools/releasetools/ota_from_target_files | 29 +++++++++++++++++++++++------
    4 files changed, 39 insertions(+), 7 deletions(-)

    diff --git a/envsetup.sh b/envsetup.sh
    index 51f3253..3ec08d5 100644
    --- a/envsetup.sh
    +++ b/envsetup.sh
    @@ -76,7 +76,7 @@ function check_product()

    if (echo -n $1 | grep -q -e "^cm_") ; then
    CM_BUILD=$(echo -n $1 | sed -e 's/^cm_//g')
    - export BUILD_NUMBER=$((date +%s%N ; echo $CM_BUILD; hostname) | openssl sha1 | sed -e 's/.*=//g; s/ //g' | cut -c1-10)
    + export BUILD_NUMBER=`whoami`.i9082.cm-12-1.`date -u +%Y%m%d`
    else
    CM_BUILD=
    fi
    diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
    index a549607..1eb94cc 100755
    --- a/tools/buildinfo.sh
    +++ b/tools/buildinfo.sh
    @@ -61,4 +61,6 @@ echo "ro.build.characteristics=$TARGET_AAPT_CHARACTERISTICS"

    echo "ro.cm.device=$CM_DEVICE"

    +echo "cm.updater.uri=https://pawitp-update.appspot.com/api"
    +
    echo "# end build properties"
    diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
    index 80cf7ce..9d31059 100644
    --- a/tools/releasetools/edify_generator.py
    +++ b/tools/releasetools/edify_generator.py
    @@ -93,6 +93,19 @@ class EdifyGenerator(object):
    ) % (" or ".join(fp),)
    self.script.append(cmd)

    + def AssertSomeDisplayId(self, *fp):
    + """Assert that the current system display id is one of *fp."""
    + if not fp:
    + raise ValueError("must specify some display ids")
    + cmd = (
    + ' ||\n '.join([('file_getprop("/system/build.prop", '
    + '"ro.build.display.id") == "%s"')
    + % i for i in fp]) +
    + ' ||\n abort("Package expects display id of %s; this '
    + 'device has " + getprop("ro.build.display.id") + ".");'
    + ) % (" or ".join(fp),)
    + self.script.append(cmd)
    +
    def AssertSomeThumbprint(self, *fp):
    """Assert that the current recovery build thumbprint is one of *fp."""
    if not fp:
    diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
    index 011fe53..4e19a17 100755
    --- a/tools/releasetools/ota_from_target_files
    +++ b/tools/releasetools/ota_from_target_files
    @@ -130,6 +130,17 @@ OPTIONS.incremental_source = None
    OPTIONS.verify = False
    OPTIONS.require_verbatim = set()
    OPTIONS.prohibit_verbatim = set(("system/build.prop",))
    +# May have been deleted by gapps
    +# Also, otasigcheck is deleted by install script, so don't bother
    +OPTIONS.skip_error = set(("system/app/Provision/Provision.apk",\
    +"system/app/Provision/arm/Provision.odex",\
    +"system/app/QuickSearchBox/QuickSearchBox.apk",\
    +"system/app/QuickSearchBox/arm/QuickSearchBox.odex",\
    +"system/lib/libwebrtc_audio_preprocessing.so",\
    +"system/lib/librs_jni.so",\
    +"system/lib/libjni_latinime.so",\
    +"system/xbin/su",\
    +"system/bin/otasigcheck.sh"))
    OPTIONS.patch_threshold = 0.95
    OPTIONS.wipe_user_data = False
    OPTIONS.omit_prereq = False
    @@ -1088,6 +1099,8 @@ class FileDifference:
    def EmitVerification(self, script):
    so_far = 0
    for tf, sf, size, patch_sha in self.patch_list:
    + if tf.name in OPTIONS.skip_error:
    + continue
    if tf.name != sf.name:
    script.SkipNextActionIfTargetExists("/"+tf.name, tf.sha1)
    script.PatchCheck("/"+sf.name, tf.sha1, sf.sha1)
    @@ -1205,16 +1218,20 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
    target_fp = CalculateFingerprint(oem_props, oem_dict, OPTIONS.target_info_dict)
    source_fp = CalculateFingerprint(oem_props, oem_dict, OPTIONS.source_info_dict)

    - if oem_props is None:
    - script.AssertSomeFingerprint(source_fp, target_fp)
    - else:
    - script.AssertSomeThumbprint(
    - GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict),
    - GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
    + # if oem_props is None:
    + # script.AssertSomeFingerprint(source_fp, target_fp)
    + # else:
    + # script.AssertSomeThumbprint(
    + # GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict),
    + # GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))

    metadata["pre-build"] = source_fp
    metadata["post-build"] = target_fp

    + source_di = GetBuildProp("ro.build.display.id", OPTIONS.source_info_dict)
    + target_di = GetBuildProp("ro.build.display.id", OPTIONS.target_info_dict)
    + script.AssertSomeDisplayId(source_di, target_di)
    +
    source_boot = common.GetBootableImage(
    "/tmp/boot.img", "boot.img", OPTIONS.source_tmp, "BOOT",
    OPTIONS.source_info_dict)
    --
    1.9.1


    From 33c0bfaf0efb29951ce739120b5a1792bf0e00bf Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 16 Dec 2014 19:19:52 +0700
    Subject: [PATCH 2/4] build: minigzip dependency for kernel

    i9082 uses minigzip

    Change-Id: I8c07a76eec568bce641b158d01ef8cd88b9997d4
    ---
    core/tasks/kernel.mk | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk
    index e10adeb..f5bf33f 100644
    --- a/core/tasks/kernel.mk
    +++ b/core/tasks/kernel.mk
    @@ -229,7 +229,7 @@ $(KERNEL_CONFIG): $(KERNEL_OUT)
    $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
    $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi

    -TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL)
    +TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) $(MINIGZIP)
    $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
    -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs
    -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules
    --
    1.9.1


    From 0581df2b70aea09c18d3af5a8bfd5c3f86a80951 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Jun 2015 09:52:59 +0700
    Subject: [PATCH 3/4] ota: make delta compatible with
    HDPI_miniGAPPS-5.1.1-20150605-signed

    Change-Id: Icffcd5bfe338e4babc672ec534b79cf4797f47af
    ---
    tools/releasetools/ota_from_target_files | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
    index 4e19a17..6bf9af5 100755
    --- a/tools/releasetools/ota_from_target_files
    +++ b/tools/releasetools/ota_from_target_files
    @@ -136,6 +136,8 @@ OPTIONS.skip_error = set(("system/app/Provision/Provision.apk",\
    "system/app/Provision/arm/Provision.odex",\
    "system/app/QuickSearchBox/QuickSearchBox.apk",\
    "system/app/QuickSearchBox/arm/QuickSearchBox.odex",\
    +"system/priv-app/BackupRestoreConfirmation/BackupRestoreConfirmation.apk",\
    +"system/priv-app/BackupRestoreConfirmation/arm/BackupRestoreConfirmation.odex",\
    "system/lib/libwebrtc_audio_preprocessing.so",\
    "system/lib/librs_jni.so",\
    "system/lib/libjni_latinime.so",\
    --
    1.9.1


    From fbf67065a0cee880b77a9fa6167bafd75503f765 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 15 Nov 2015 00:42:50 -0500
    Subject: [PATCH 4/4] ota: make delta compatible with capps

    Change-Id: Ic2ce75a539d93a4469fd8fbac8bfa20965d8c9f1
    ---
    tools/releasetools/ota_from_target_files | 12 ++++++++++--
    1 file changed, 10 insertions(+), 2 deletions(-)

    diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
    index 6bf9af5..ec3eb9d 100755
    --- a/tools/releasetools/ota_from_target_files
    +++ b/tools/releasetools/ota_from_target_files
    @@ -130,7 +130,7 @@ OPTIONS.incremental_source = None
    OPTIONS.verify = False
    OPTIONS.require_verbatim = set()
    OPTIONS.prohibit_verbatim = set(("system/build.prop",))
    -# May have been deleted by gapps
    +# May have been deleted by gapps and capps
    # Also, otasigcheck is deleted by install script, so don't bother
    OPTIONS.skip_error = set(("system/app/Provision/Provision.apk",\
    "system/app/Provision/arm/Provision.odex",\
    @@ -142,7 +142,15 @@ OPTIONS.skip_error = set(("system/app/Provision/Provision.apk",\
    "system/lib/librs_jni.so",\
    "system/lib/libjni_latinime.so",\
    "system/xbin/su",\
    -"system/bin/otasigcheck.sh"))
    +"system/bin/otasigcheck.sh",\
    +"system/priv-app/AudioFX/AudioFX.apk",\
    +"system/priv-app/AudioFX/arm/AudioFX.odex",\
    +"system/priv-app/Dialer/Dialer.apk",\
    +"system/priv-app/Dialer/arm/Dialer.odex",\
    +"system/app/InCallUI/InCallUI.apk",\
    +"system/app/InCallUI/arm/InCallUI.odex",\
    +"system/priv-app/ThemeChooser/ThemeChooser.apk",\
    +"system/priv-app/ThemeChooser/arm/ThemeChooser.odex"))
    OPTIONS.patch_threshold = 0.95
    OPTIONS.wipe_user_data = False
    OPTIONS.omit_prereq = False
    --
    1.9.1

  3. pawitp revised this gist Oct 3, 2015. 1 changed file with 39 additions and 44 deletions.
    83 changes: 39 additions & 44 deletions packages_apps_Trebuchet.patch
    Original file line number Diff line number Diff line change
    @@ -1,55 +1,57 @@
    From 53460b14dd8636c0fdf66586c3af9a8ef6acc6dd Mon Sep 17 00:00:00 2001
    From 4ba407655964868e2746dc74be087de4373ce0c9 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:48 +0700
    Date: Sat, 3 Oct 2015 13:40:57 +0700
    Subject: [PATCH 1/2] Revert "DynamicGrid: tuning the icon size for some
    device"

    This reverts commit edbea0af1226978b06d7f877ae435797d31419af.

    Change-Id: Ib97c3cf75e8ed354fce9471cb32ce33fe688ff2b
    ---
    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
    1.9.1


    From fd7126f1359e15f42e357e4b15d16b821f497e86 Mon Sep 17 00:00:00 2001
    From b62f7265304b3d7db53b2a985c11840a1172936b Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:50 +0700
    Date: Sat, 3 Oct 2015 13:43:40 +0700
    Subject: [PATCH 2/2] Revert "Update Larger icons setting for better usability"

    This reverts commit 5c7529006f3ed78d934fed2861cebd3654695108.

    Change-Id: I4ecf4ef9adc347fc16c98419262bf34bc11f7090
    ---
    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,72 +63,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
    1.9.1

  4. pawitp revised this gist Jul 11, 2015. 2 changed files with 23 additions and 32 deletions.
    2 changes: 1 addition & 1 deletion frameworks_native.patch
    Original file line number Diff line number Diff line change
    @@ -126,7 +126,7 @@ index b6025f2..9c59ba2 100644
    sp<ISurfaceComposer> s(ComposerService::getComposerService());
    if (s == NULL) return NO_INIT;
    -#ifdef USE_MHEAP_SCREENSHOT
    +#if defined(SE_MHEAP_SCREENSHOT) && !defined(CAPRI_HWC)
    +#if defined(USE_MHEAP_SCREENSHOT) && !defined(CAPRI_HWC)
    int format = 0;
    producer->query(NATIVE_WINDOW_FORMAT,&format);
    if (format == PIXEL_FORMAT_RGBA_8888) {
    53 changes: 22 additions & 31 deletions packages_services_Telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 5a4572488163f88d7990595fd3ba4862cc002192 Mon Sep 17 00:00:00 2001
    From d5cb82c98ea31b727e211e3aebe27d57961dcf45 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 23 Dec 2014 22:27:09 +0700
    Subject: [PATCH 1/2] Telephony: HACK: fix 'up' for MSimCallFeature sub option
    @@ -9,10 +9,10 @@ Change-Id: I1fcd9309d2849fbdd0ac1c903cbda4a8b1f213f5
    1 file changed, 7 insertions(+), 4 deletions(-)

    diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
    index 37bc515..8bb4da3 100644
    index 87cc1d6..873c621 100644
    --- a/src/com/android/phone/CallFeaturesSetting.java
    +++ b/src/com/android/phone/CallFeaturesSetting.java
    @@ -2301,10 +2301,13 @@ public class CallFeaturesSetting extends PreferenceActivity
    @@ -2349,10 +2349,13 @@ public class CallFeaturesSetting extends PreferenceActivity
    * This is useful for implementing "HomeAsUp" capability for second-level Settings.
    */
    public static void goUpToTopLevelSetting(Activity activity) {
    @@ -31,10 +31,10 @@ index 37bc515..8bb4da3 100644
    }
    }
    --
    2.3.5
    1.9.1


    From cbc8dba1979f3a905dc5b78d58d151ef5ff34dde Mon Sep 17 00:00:00 2001
    From d80082dc96fd257f1ca9bfd40884769b76270bab Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 20 Feb 2015 20:26:52 +0700
    Subject: [PATCH 2/2] Telephony: HACK: enable WCDMA only setting
    @@ -70,33 +70,24 @@ index 6aa2eec..f6a82d4 100644

    <string-array name="enabled_networks_except_gsm_lte_choices" translatable="false">
    diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
    index 441510d..da770b2 100755
    index 6dbd608..253ea80 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);
    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(
    @@ -512,11 +512,11 @@ public class MobileNetworkSettings extends PreferenceActivity

    mEnabledNetworksSummaries = new SparseIntArray();
    mEnabledNetworksSummaries.append(Phone.NT_MODE_WCDMA_PREF,
    - R.string.network_wcdma_pref);
    + R.string.preferred_network_mode_gsm_wcdma_preferred_choice);
    mEnabledNetworksSummaries.append(Phone.NT_MODE_GSM_ONLY,
    - R.string.network_gsm_only);
    + R.string.preferred_network_mode_gsm_only_choice);
    mEnabledNetworksSummaries.append(Phone.NT_MODE_WCDMA_ONLY,
    - R.string.network_wcdma_only);
    + R.string.preferred_network_mode_wcdma_only_choice);
    mEnabledNetworksSummaries.append(Phone.NT_MODE_GSM_UMTS,
    R.string.network_gsm_umts);
    mEnabledNetworksSummaries.append(Phone.NT_MODE_CDMA,
    --
    2.3.5
    1.9.1

  5. pawitp revised this gist Jun 13, 2015. 1 changed file with 20 additions and 20 deletions.
    40 changes: 20 additions & 20 deletions frameworks_base.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From af2291f5e3f3d6a7d6b47e4b7a321b80f45d5af7 Mon Sep 17 00:00:00 2001
    From 52b7533338de361512d0ab7535f1b3dc1a6f3774 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 14:50:29 +0700
    Subject: [PATCH 1/3] TelephonyManager: set properties in Broadcom-style as
    @@ -12,10 +12,10 @@ Change-Id: I475fdd164b3316720387fefb14a3e12fbc262b39
    1 file changed, 19 insertions(+), 44 deletions(-)

    diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
    index 274f8cf..e7f0a3d 100644
    index 4ee5c01..63062d2 100644
    --- a/telephony/java/android/telephony/TelephonyManager.java
    +++ b/telephony/java/android/telephony/TelephonyManager.java
    @@ -3020,49 +3020,19 @@ public class TelephonyManager {
    @@ -3017,49 +3017,19 @@ public class TelephonyManager {
    * @hide
    */
    public static void setTelephonyProperty(int phoneId, String property, String value) {
    @@ -70,7 +70,7 @@ index 274f8cf..e7f0a3d 100644
    }

    /**
    @@ -3159,17 +3129,22 @@ public class TelephonyManager {
    @@ -3156,17 +3126,22 @@ public class TelephonyManager {
    * @hide
    */
    public static String getTelephonyProperty(int phoneId, String property, String defaultVal) {
    @@ -103,10 +103,10 @@ index 274f8cf..e7f0a3d 100644

    /**
    --
    2.3.5
    1.9.1


    From 364bda5654561df326c7e13c5edf833a6140e278 Mon Sep 17 00:00:00 2001
    From 81f8e414533dfc83bc44ac704fd0c97cbaccf4da Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 22:33:16 +0700
    Subject: [PATCH 2/3] Camera: HACK: i9082: API hacks
    @@ -124,7 +124,7 @@ 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 347db05..5acf583 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 {
    @@ -163,10 +163,10 @@ index d461bca..a34a758 100644
    throw new CameraRuntimeException(CAMERA_DEPRECATED_HAL);
    case INVALID_OPERATION:
    --
    2.3.5
    1.9.1


    From cc384f5009f85e3b11ecb7ace018bacf5f301319 Mon Sep 17 00:00:00 2001
    From 9a0b6efe16eaa2740160306bbde768758f6259d2 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 16:23:31 +0700
    Subject: [PATCH 3/3] PowerManagerService: only turn on button light when any
    @@ -180,7 +180,7 @@ 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 cd5baa8..5002726 100644
    index 8105ff8..b3d2023 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
    @@ -203,15 +203,15 @@ index cd5baa8..5002726 100644
    if (eventTime > mLastUserActivityTime) {
    mLastUserActivityTime = eventTime;
    mDirty |= DIRTY_USER_ACTIVITY;
    @@ -1644,7 +1650,7 @@ public final class PowerManagerService extends SystemService
    }

    mKeyboardLight.setBrightness(mKeyboardVisible ? keyboardBrightness : 0);
    - if (mButtonTimeout != 0 && now > mLastUserActivityTime + mButtonTimeout) {
    + if (mButtonTimeout != 0 && now > mLastButtonActivityTime + mButtonTimeout) {
    mButtonsLight.setBrightness(0);
    } else {
    mButtonsLight.setBrightness(buttonBrightness);
    @@ -1648,7 +1654,7 @@ public final class PowerManagerService extends SystemService
    mKeyboardLight.setBrightness(mKeyboardVisible ?
    keyboardBrightness : 0);
    if (mButtonTimeout != 0
    - && now > mLastUserActivityTime + mButtonTimeout) {
    + && now > mLastButtonActivityTime + mButtonTimeout) {
    mButtonsLight.setBrightness(0);
    } else {
    if (!mProximityPositive) {
    --
    2.3.5
    1.9.1

  6. pawitp revised this gist May 7, 2015. 1 changed file with 0 additions and 416 deletions.
    416 changes: 0 additions & 416 deletions packages_apps_Stk.patch
    Original file line number Diff line number Diff line change
    @@ -1,416 +0,0 @@
    From 21fa071f8dc60a91a86cf4f49f81d1bc0e0a133f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 24 Apr 2015 13:32:38 +0700
    Subject: [PATCH] STK: use single icon as per latest AOSP 5.1

    This partially reverts commit b9676c91039df24dfe7bea589bfd277efa1b5b9a.
    and bring some code back in from AOSP 5.1.

    Change-Id: I25a76bb95e49ca8effa34332adc1f87b90effb2f
    ---
    AndroidManifest.xml | 29 +++++-------
    res/values/cm_strings.xml | 5 ---
    src/com/android/stk/StkAppInstaller.java | 64 +++++++++++++++++----------
    src/com/android/stk/StkAppService.java | 38 +++++++++++++---
    src/com/android/stk/StkLauncherActivity2.java | 56 -----------------------
    src/com/android/stk/StkLauncherActivity3.java | 56 -----------------------
    6 files changed, 82 insertions(+), 166 deletions(-)
    delete mode 100644 src/com/android/stk/StkLauncherActivity2.java
    delete mode 100644 src/com/android/stk/StkLauncherActivity3.java

    diff --git a/AndroidManifest.xml b/AndroidManifest.xml
    index 9361fe0..f0d615b 100644
    --- a/AndroidManifest.xml
    +++ b/AndroidManifest.xml
    @@ -39,33 +39,24 @@
    android:supportsRtl="true"
    android:process="com.android.phone">

    - <activity android:name="StkLauncherActivity"
    + <activity android:name="StkMain"
    + android:theme="@android:style/Theme.NoDisplay"
    android:label="@string/app_name"
    - android:taskAffinity="android.task.StkLauncherActivity"
    - android:enabled="false">
    + android:enabled="false"
    + android:taskAffinity="android.task.stk.StkLauncherActivity">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>

    - <activity android:name="StkLauncherActivity2"
    - android:label="@string/app_name2"
    - android:taskAffinity="android.task.StkLauncherActivity2"
    - android:enabled="false" >
    - <intent-filter>
    - <action android:name="android.intent.action.MAIN" />
    - <category android:name="android.intent.category.LAUNCHER" />
    - </intent-filter>
    - </activity>
    -
    - <activity android:name="StkLauncherActivity3"
    - android:label="@string/app_name3"
    - android:taskAffinity="android.task.StkLauncherActivity3"
    - android:enabled="false" >
    + <activity android:name="StkLauncherActivity"
    + android:label="@string/app_name"
    + android:taskAffinity="android.task.stk.StkLauncherActivity">
    <intent-filter>
    - <action android:name="android.intent.action.MAIN" />
    - <category android:name="android.intent.category.LAUNCHER" />
    + <action android:name="android.intent.action.VIEW" />
    + <action android:name="android.intent.action.PICK" />
    + <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    </activity>

    diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
    index 5498c9e..562175b 100644
    --- a/res/values/cm_strings.xml
    +++ b/res/values/cm_strings.xml
    @@ -16,11 +16,6 @@
    limitations under the License.
    -->
    <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    - <!-- Application label used on home screen with an icon2 -->
    - <string name="app_name2">SIM Toolkit 2</string>
    - <!-- Application label used on home screen with an icon3 -->
    - <string name="app_name3">SIM Toolkit 3</string>
    -
    <!-- Default message when no alpha tag in Play Tone -->
    <string name="default_tone_dialog_msg">Playing Tone</string>

    diff --git a/src/com/android/stk/StkAppInstaller.java b/src/com/android/stk/StkAppInstaller.java
    index 9a4fbb7..7cc77a0 100644
    --- a/src/com/android/stk/StkAppInstaller.java
    +++ b/src/com/android/stk/StkAppInstaller.java
    @@ -1,6 +1,4 @@
    /*
    - * Copyright (c) 2011, 2013-2014 The Linux Foundation. All rights reserved.
    - * Not a Contribution.
    * Copyright (C) 2007 The Android Open Source Project
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    @@ -18,53 +16,71 @@

    package com.android.stk;

    -import com.android.internal.telephony.cat.CatLog;
    -
    import android.content.ComponentName;
    import android.content.Context;
    import android.content.pm.PackageManager;

    +import com.android.internal.telephony.cat.CatLog;
    +
    /**
    * Application installer for SIM Toolkit.
    *
    */
    abstract class StkAppInstaller {
    - private StkAppInstaller() {}
    + private static final String LOG_TAG = "StkAppInstaller";

    - static void install(Context context, int slotId) {
    - setAppState(context, true, slotId);
    + private StkAppInstaller() {
    + CatLog.d(LOG_TAG, "init");
    }

    - static void unInstall(Context context, int slotId) {
    - setAppState(context, false, slotId);
    + public static void install(Context context) {
    + setAppState(context, true);
    }

    - private static void setAppState(Context context, boolean install, int slotId) {
    + public static void unInstall(Context context) {
    + setAppState(context, false);
    + }
    +
    + private static void setAppState(Context context, boolean install) {
    + CatLog.d(LOG_TAG, "[setAppState]+");
    if (context == null) {
    + CatLog.d(LOG_TAG, "[setAppState]- no context, just return.");
    return;
    }
    PackageManager pm = context.getPackageManager();
    if (pm == null) {
    + CatLog.d(LOG_TAG, "[setAppState]- no package manager, just return.");
    return;
    }
    - ComponentName cName;
    - String[] launcherActivity = {
    - "com.android.stk.StkLauncherActivity",
    - "com.android.stk.StkLauncherActivity2",
    - "com.android.stk.StkLauncherActivity3"
    - };
    - // check that STK app package is known to the PackageManager
    - cName = new ComponentName("com.android.stk",
    - launcherActivity[slotId]);

    + ComponentName cName = new ComponentName(context, StkMain.class);
    int state = install ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
    : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;

    - try {
    - pm.setComponentEnabledSetting(cName, state,
    - PackageManager.DONT_KILL_APP);
    - } catch (Exception e) {
    - CatLog.d("StkAppInstaller", "Could not change STK app state");
    + if (pm.getComponentEnabledSetting(cName) == state) {
    + CatLog.d(LOG_TAG, "Need not change app state!!");
    + } else {
    + CatLog.d(LOG_TAG, "Change app state[" + install + "]");
    + try {
    + pm.setComponentEnabledSetting(cName, state, PackageManager.DONT_KILL_APP);
    + } catch (Exception e) {
    + CatLog.d(LOG_TAG, "Could not change STK app state");
    + }
    + }
    +
    + // Upgrade path: always enable StkLauncherActivity in case it was disabled by a
    + // previous version
    + ComponentName cNameOld = new ComponentName(context, StkLauncherActivity.class);
    + int stateOld = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
    + if (pm.getComponentEnabledSetting(cNameOld) != stateOld) {
    + CatLog.d(LOG_TAG, "Enabling StkLauncherActivity");
    + try {
    + pm.setComponentEnabledSetting(cNameOld, stateOld, PackageManager.DONT_KILL_APP);
    + } catch (Exception e) {
    + CatLog.d(LOG_TAG, "Could not enable StkLauncherActivity");
    + }
    }
    +
    + CatLog.d(LOG_TAG, "[setAppState]-");
    }
    }
    diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
    index aee0d80..d65a49f 100755
    --- a/src/com/android/stk/StkAppService.java
    +++ b/src/com/android/stk/StkAppService.java
    @@ -96,6 +96,7 @@ public class StkAppService extends Service {
    private Context mContext = null;
    private NotificationManager mNotificationManager = null;
    private HandlerThread[] mHandlerThread;
    + private boolean[] mStkPresent;
    private int mSimCount = TelephonyManager.getDefault().getSimCount();
    static StkAppService sInstance = null;

    @@ -182,6 +183,7 @@ public class StkAppService extends Service {
    mStkService = new AppInterface[mSimCount];
    mHandlerThread = new HandlerThread[mSimCount];
    mServiceHandler = new ServiceHandler[mSimCount];
    + mStkPresent = new boolean[mSimCount];

    mContext = getBaseContext();
    InitHandlerThread();
    @@ -275,7 +277,7 @@ public class StkAppService extends Service {
    for (int i = 0; i < mSimCount; i++) {
    if (mStkService[i] == null) {
    CatLog.d(this, " Unistalling Stk App for slot: " + i);
    - StkAppInstaller.unInstall(mContext, i);
    + unInstallStkApp(i);
    }
    }
    }
    @@ -312,6 +314,30 @@ public class StkAppService extends Service {
    }
    }

    + private void installStkApp(int slotId) {
    + mStkPresent[slotId] = true;
    + updateStkApp();
    + }
    +
    + private void unInstallStkApp(int slotId) {
    + mStkPresent[slotId] = false;
    + updateStkApp();
    + }
    +
    + private void updateStkApp() {
    + boolean install = false;
    + for (int i = 0; i < mSimCount; i++) {
    + if (mStkPresent[i]) {
    + install = true;
    + }
    + }
    + if (install) {
    + StkAppInstaller.install(mContext);
    + } else {
    + StkAppInstaller.unInstall(mContext);
    + }
    + }
    +
    @Override
    public void onDestroy() {
    waitForLooper();
    @@ -496,7 +522,7 @@ public class StkAppService extends Service {
    case OP_BOOT_COMPLETED:
    CatLog.d(this, "OP_BOOT_COMPLETED");
    if (mMainCmd == null) {
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    }
    break;
    case OP_DELAYED_MSG:
    @@ -535,7 +561,7 @@ public class StkAppService extends Service {
    if (cardStatus == false) {
    CatLog.d(this, "CARD is ABSENT");
    // Uninstall STKAPP, Clear Idle text, Menu related variables.
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    mNotificationManager.cancel(STK_NOTIFICATION_ID);
    mStkService[mCurrentSlotId] = null;
    cleanUp();
    @@ -552,7 +578,7 @@ public class StkAppService extends Service {

    if (state.refreshResult == IccRefreshResponse.REFRESH_RESULT_RESET) {
    // Uninstall STkmenu
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    mCurrentMenu = null;
    mMainCmd = null;
    }
    @@ -745,10 +771,10 @@ public class StkAppService extends Service {
    CatLog.d(this, "Uninstall App");
    mCurrentMenu = null;
    mMainCmd = null;
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    } else {
    CatLog.d(this, "Install App");
    - StkAppInstaller.install(mContext, mCurrentSlotId);
    + installStkApp(mCurrentSlotId);
    }
    mMainMenu = mCurrentMenu;
    if (mMenuIsVisibile) {
    diff --git a/src/com/android/stk/StkLauncherActivity2.java b/src/com/android/stk/StkLauncherActivity2.java
    deleted file mode 100644
    index ed1f132..0000000
    --- a/src/com/android/stk/StkLauncherActivity2.java
    +++ /dev/null
    @@ -1,56 +0,0 @@
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    -
    -package com.android.stk;
    -
    -import android.app.Activity;
    -import android.content.Intent;
    -import android.os.Bundle;
    -
    -/**
    - * Launcher class. Serve as the app's MAIN activity, send an intent to the
    - * StkAppService and finish.
    - *
    - */
    -public class StkLauncherActivity2 extends Activity {
    - private static int mSlotId = 1;
    -
    - @Override
    - protected void onCreate(Bundle savedInstanceState) {
    - super.onCreate(savedInstanceState);
    -
    - Intent intent = new Intent(this, StkAppService.class);
    - intent.putExtra(StkAppService.OPCODE, StkAppService.OP_LAUNCH_APP);
    - intent.putExtra(StkAppService.SLOT_ID, mSlotId);
    - startService(intent);
    -
    - finish();
    - }
    -}
    diff --git a/src/com/android/stk/StkLauncherActivity3.java b/src/com/android/stk/StkLauncherActivity3.java
    deleted file mode 100644
    index bb11d29..0000000
    --- a/src/com/android/stk/StkLauncherActivity3.java
    +++ /dev/null
    @@ -1,56 +0,0 @@
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    -
    -package com.android.stk;
    -
    -import android.app.Activity;
    -import android.content.Intent;
    -import android.os.Bundle;
    -
    -/**
    - * Launcher class. Serve as the app's MAIN activity, send an intent to the
    - * StkAppService and finish.
    - *
    - */
    -public class StkLauncherActivity3 extends Activity {
    - private static int mSlotId = 2;
    -
    - @Override
    - protected void onCreate(Bundle savedInstanceState) {
    - super.onCreate(savedInstanceState);
    -
    - Intent intent = new Intent(this, StkAppService.class);
    - intent.putExtra(StkAppService.OPCODE, StkAppService.OP_LAUNCH_APP);
    - intent.putExtra(StkAppService.SLOT_ID, mSlotId);
    - startService(intent);
    -
    - finish();
    - }
    -}
    --
    2.3.5

  7. pawitp revised this gist Apr 25, 2015. 6 changed files with 43 additions and 85 deletions.
    6 changes: 3 additions & 3 deletions frameworks_base.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From a03613a28d7fe9c757988611b242173fb96c736b Mon Sep 17 00:00:00 2001
    From af2291f5e3f3d6a7d6b47e4b7a321b80f45d5af7 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 14:50:29 +0700
    Subject: [PATCH 1/3] TelephonyManager: set properties in Broadcom-style as
    @@ -106,7 +106,7 @@ index 274f8cf..e7f0a3d 100644
    2.3.5


    From 1831c5cc604e222e0c656cb9f66d8b541ab1eca4 Mon Sep 17 00:00:00 2001
    From 364bda5654561df326c7e13c5edf833a6140e278 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 22:33:16 +0700
    Subject: [PATCH 2/3] Camera: HACK: i9082: API hacks
    @@ -166,7 +166,7 @@ index d461bca..a34a758 100644
    2.3.5


    From ae1487df27f5e3b56c044254c964c44cd3191a26 Mon Sep 17 00:00:00 2001
    From cc384f5009f85e3b11ecb7ace018bacf5f301319 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 16:23:31 +0700
    Subject: [PATCH 3/3] PowerManagerService: only turn on button light when any
    57 changes: 4 additions & 53 deletions frameworks_opt_telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,56 +1,7 @@
    From 993c9eae4a27d14d4dff95ed7eabf0b9f1476cde Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 24 Apr 2015 17:31:48 +0700
    Subject: [PATCH 1/3] SubscriptionController: do not send invalid data sub to
    DctController

    Causes random crash when default (-1) subId is set

    E/AndroidRuntime( 2665): FATAL EXCEPTION: DctControllerThread
    E/AndroidRuntime( 2665): Process: com.android.phone, PID: 2665
    E/AndroidRuntime( 2665): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-1
    E/AndroidRuntime( 2665): at com.android.internal.telephony.dataconnection.DctController.handleMessage(DctController.java:368)
    E/AndroidRuntime( 2665): at android.os.Handler.dispatchMessage(Handler.java:102)
    E/AndroidRuntime( 2665): at android.os.Looper.loop(Looper.java:135)
    E/AndroidRuntime( 2665): at android.os.HandlerThread.run(HandlerThread.java:61)

    Change-Id: I2321aa10098cd62fab374d0dd42f2b0e69c65c3d
    ---
    .../android/internal/telephony/SubscriptionController.java | 12 +++++++-----
    1 file changed, 7 insertions(+), 5 deletions(-)

    diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
    index 905d671..b3dc72d 100755
    --- a/src/java/com/android/internal/telephony/SubscriptionController.java
    +++ b/src/java/com/android/internal/telephony/SubscriptionController.java
    @@ -1435,12 +1435,14 @@ public class SubscriptionController extends ISub.Stub {
    throw new RuntimeException("setDefaultDataSubId called with DEFAULT_SUB_ID");
    }
    if (DBG) logdl("[setDefaultDataSubId] subId=" + subId);
    - if (mDctController == null) {
    - mDctController = DctController.getInstance();
    - mDctController.registerForDefaultDataSwitchInfo(mDataConnectionHandler,
    - EVENT_SET_DEFAULT_DATA_DONE, null);
    + if (subId >= 0) {
    + if (mDctController == null) {
    + mDctController = DctController.getInstance();
    + mDctController.registerForDefaultDataSwitchInfo(mDataConnectionHandler,
    + EVENT_SET_DEFAULT_DATA_DONE, null);
    + }
    + mDctController.setDefaultDataSubId(subId);
    }
    - mDctController.setDefaultDataSubId(subId);

    Settings.Global.putInt(mContext.getContentResolver(),
    Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, subId);
    --
    2.3.5


    From fbab96592144024316076719805e8c29a91416f0 Mon Sep 17 00:00:00 2001
    From 8ca768b45b5dc49b2df99421f39cc372e5d1361b Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 31 May 2014 12:34:56 +0700
    Subject: [PATCH 2/3] telephony: support for RIL that does not send
    Subject: [PATCH 1/2] telephony: support for RIL that does not send
    UNSOL_CALL_RING

    Samsung Broadcom RIL does not send UNSOL_CALL_RING at all, so it
    @@ -117,10 +68,10 @@ index f6ffb49..334bece 100644
    2.3.5


    From d42dc2daeb318e5d2aed543208629593c9a75752 Mon Sep 17 00:00:00 2001
    From e3bf01ab3d3f55fddf3eb52b28f80042ae3c7b12 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 17:39:50 +0700
    Subject: [PATCH 3/3] telephony: RIL: i9082: set correct rild names
    Subject: [PATCH 2/2] telephony: RIL: i9082: set correct rild names

    Change-Id: Idf8e98ae2f36f30b84be04b7b062ca4b52cebd8a
    ---
    2 changes: 1 addition & 1 deletion packages_apps_Settings.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 31018413197f9a1e3dd6af85aafcf626ecfdff61 Mon Sep 17 00:00:00 2001
    From 2c3e7123dadfad9e363a376c5e61aac199cb605f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 16 Nov 2014 08:55:55 +0700
    Subject: [PATCH] Settings: i9082: disable manual provisioning
    55 changes: 31 additions & 24 deletions packages_apps_Stk.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 2803f0d8c076a0a7dbb04a4b24c8d3d629ece662 Mon Sep 17 00:00:00 2001
    From 21fa071f8dc60a91a86cf4f49f81d1bc0e0a133f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 24 Apr 2015 13:32:38 +0700
    Subject: [PATCH] STK: use single icon as per latest AOSP 5.1
    @@ -8,13 +8,13 @@ and bring some code back in from AOSP 5.1.

    Change-Id: I25a76bb95e49ca8effa34332adc1f87b90effb2f
    ---
    AndroidManifest.xml | 29 +++++---------
    AndroidManifest.xml | 29 +++++-------
    res/values/cm_strings.xml | 5 ---
    src/com/android/stk/StkAppInstaller.java | 57 ++++++++++++++++-----------
    src/com/android/stk/StkAppService.java | 38 +++++++++++++++---
    src/com/android/stk/StkLauncherActivity2.java | 56 --------------------------
    src/com/android/stk/StkLauncherActivity3.java | 56 --------------------------
    6 files changed, 76 insertions(+), 165 deletions(-)
    src/com/android/stk/StkAppInstaller.java | 64 +++++++++++++++++----------
    src/com/android/stk/StkAppService.java | 38 +++++++++++++---
    src/com/android/stk/StkLauncherActivity2.java | 56 -----------------------
    src/com/android/stk/StkLauncherActivity3.java | 56 -----------------------
    6 files changed, 82 insertions(+), 166 deletions(-)
    delete mode 100644 src/com/android/stk/StkLauncherActivity2.java
    delete mode 100644 src/com/android/stk/StkLauncherActivity3.java

    @@ -83,7 +83,7 @@ index 5498c9e..562175b 100644
    <string name="default_tone_dialog_msg">Playing Tone</string>

    diff --git a/src/com/android/stk/StkAppInstaller.java b/src/com/android/stk/StkAppInstaller.java
    index 9a4fbb7..2d06e59 100644
    index 9a4fbb7..7cc77a0 100644
    --- a/src/com/android/stk/StkAppInstaller.java
    +++ b/src/com/android/stk/StkAppInstaller.java
    @@ -1,6 +1,4 @@
    @@ -93,26 +93,24 @@ index 9a4fbb7..2d06e59 100644
    * Copyright (C) 2007 The Android Open Source Project
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    @@ -19,52 +17,65 @@
    package com.android.stk;
    @@ -18,53 +16,71 @@

    import com.android.internal.telephony.cat.CatLog;
    +import com.android.internal.telephony.PhoneConstants;
    +import com.android.internal.telephony.TelephonyProperties;
    package com.android.stk;

    -import com.android.internal.telephony.cat.CatLog;
    -
    import android.content.ComponentName;
    import android.content.Context;
    import android.content.pm.PackageManager;
    +import android.telephony.TelephonyManager;
    +import android.os.SystemProperties;

    +import com.android.internal.telephony.cat.CatLog;
    +
    /**
    * Application installer for SIM Toolkit.
    *
    */
    abstract class StkAppInstaller {
    - private StkAppInstaller() {}
    + private static final String STK_MAIN_ACTIVITY = "com.android.stk.StkMain";
    + private static final String LOG_TAG = "StkAppInstaller";

    - static void install(Context context, int slotId) {
    @@ -152,8 +150,8 @@ index 9a4fbb7..2d06e59 100644
    - // check that STK app package is known to the PackageManager
    - cName = new ComponentName("com.android.stk",
    - launcherActivity[slotId]);
    -
    + ComponentName cName = new ComponentName("com.android.stk", STK_MAIN_ACTIVITY);
    + ComponentName cName = new ComponentName(context, StkMain.class);
    int state = install ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
    : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;

    @@ -162,21 +160,30 @@ index 9a4fbb7..2d06e59 100644
    - PackageManager.DONT_KILL_APP);
    - } catch (Exception e) {
    - CatLog.d("StkAppInstaller", "Could not change STK app state");
    + if (((PackageManager.COMPONENT_ENABLED_STATE_ENABLED == state) &&
    + (PackageManager.COMPONENT_ENABLED_STATE_ENABLED ==
    + pm.getComponentEnabledSetting(cName))) ||
    + ((PackageManager.COMPONENT_ENABLED_STATE_DISABLED == state) &&
    + (PackageManager.COMPONENT_ENABLED_STATE_DISABLED ==
    + pm.getComponentEnabledSetting(cName)))) {
    + if (pm.getComponentEnabledSetting(cName) == state) {
    + CatLog.d(LOG_TAG, "Need not change app state!!");
    + } else {
    + CatLog.d(LOG_TAG, "Change app state[" + install + "]");
    + try {
    + pm.setComponentEnabledSetting(cName, state, PackageManager.DONT_KILL_APP);
    + } catch (Exception e) {
    + CatLog.d(LOG_TAG, "Could not change STK app state");
    + }
    + }
    +
    + // Upgrade path: always enable StkLauncherActivity in case it was disabled by a
    + // previous version
    + ComponentName cNameOld = new ComponentName(context, StkLauncherActivity.class);
    + int stateOld = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
    + if (pm.getComponentEnabledSetting(cNameOld) != stateOld) {
    + CatLog.d(LOG_TAG, "Enabling StkLauncherActivity");
    + try {
    + pm.setComponentEnabledSetting(cNameOld, stateOld, PackageManager.DONT_KILL_APP);
    + } catch (Exception e) {
    + CatLog.d(LOG_TAG, "Could not enable StkLauncherActivity");
    + }
    }
    +
    + CatLog.d(LOG_TAG, "[setAppState]-");
    }
    }
    4 changes: 2 additions & 2 deletions packages_apps_Trebuchet.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 0a3a6469218dc23eb195ead7cd8b959ee120ea6d Mon Sep 17 00:00:00 2001
    From 53460b14dd8636c0fdf66586c3af9a8ef6acc6dd Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:48 +0700
    Subject: [PATCH 1/2] Revert "DynamicGrid: tuning the icon size for some
    @@ -38,7 +38,7 @@ index 779a5a6..1494311 100644
    2.3.5


    From d9d9b96b93eea2c642a1fed90d227d400ff6b538 Mon Sep 17 00:00:00 2001
    From fd7126f1359e15f42e357e4b15d16b821f497e86 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:50 +0700
    Subject: [PATCH 2/2] Revert "Update Larger icons setting for better usability"
    4 changes: 2 additions & 2 deletions packages_services_Telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From dba03bf3b6927b32b135aa7b0def93ea5c519adc Mon Sep 17 00:00:00 2001
    From 5a4572488163f88d7990595fd3ba4862cc002192 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 23 Dec 2014 22:27:09 +0700
    Subject: [PATCH 1/2] Telephony: HACK: fix 'up' for MSimCallFeature sub option
    @@ -34,7 +34,7 @@ index 37bc515..8bb4da3 100644
    2.3.5


    From cc40eb1405004c61491763d0e31ff3121cdbb6e4 Mon Sep 17 00:00:00 2001
    From cbc8dba1979f3a905dc5b78d58d151ef5ff34dde Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 20 Feb 2015 20:26:52 +0700
    Subject: [PATCH 2/2] Telephony: HACK: enable WCDMA only setting
  8. pawitp revised this gist Apr 24, 2015. 11 changed files with 490 additions and 61 deletions.
    2 changes: 1 addition & 1 deletion bootable_recovery.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From a769d27609fee670b573759fc01d41072a1614f5 Mon Sep 17 00:00:00 2001
    From be936303368c68a2c6e096c0c56288fdba13779a Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 27 Jan 2015 22:29:39 +0700
    Subject: [PATCH] recovery: uncrypt: fix compatibility with CWM
    18 changes: 9 additions & 9 deletions frameworks_av.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 7b3a73083184ed879415a07242d17cba209710fe Mon Sep 17 00:00:00 2001
    From 289d290349a792f397346630e85653b656c5b7ac Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 24 Apr 2013 11:37:19 +0700
    Subject: [PATCH 1/9] OMXCodec: Re-implement requires-flush-before-shutdown
    @@ -30,7 +30,7 @@ index 4c1249f..afe4b5c 100644
    2.3.5


    From 3e934c62601909bf87bf29672957fb5388cb6088 Mon Sep 17 00:00:00 2001
    From 4008d970a6c60170c34f7d135bdb969bc52ed6ae Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 17 Dec 2013 13:15:52 +0700
    Subject: [PATCH 2/9] OMXCodec: set default input buffer size
    @@ -96,7 +96,7 @@ index afe4b5c..37e8ed6 100644
    2.3.5


    From 6dc42b502b4c8cf76377ef15a39315cbb6347677 Mon Sep 17 00:00:00 2001
    From ac2e3e93fddb3fe67063dcf4d1c7fc4ee18636f1 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 19 Nov 2014 20:33:58 +0700
    Subject: [PATCH 3/9] ACodec: skip port index checking on vc4 encoder
    @@ -126,7 +126,7 @@ index b780128..1214eed 100644
    2.3.5


    From 24c117a94b58e9645dbf4770e3172e39016c2abe Mon Sep 17 00:00:00 2001
    From 9c172527c152d0279713f2b0a0c84dd4ef0ad7f0 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 23 Nov 2014 17:27:20 +0700
    Subject: [PATCH 4/9] ACodec: Don't trust provided width/height when setting
    @@ -164,7 +164,7 @@ index 1214eed..7c94a75 100644
    2.3.5


    From 164327830397e40799e20df275ec4529c44fa22a Mon Sep 17 00:00:00 2001
    From e54104a4cf69f3dc0ea38d99c52325d9ed1eb309 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 28 Nov 2014 21:07:59 +0700
    Subject: [PATCH 5/9] AudioFlinger: i9082: HACK: disable stereo record
    @@ -199,7 +199,7 @@ index 25225b0..7da83ad 100644
    2.3.5


    From 5298eb955cc03dfdf8f732978022d5032dc5bdfd Mon Sep 17 00:00:00 2001
    From 089cf6cfe45179b6ed35cce5ba3b3bdf57f5cabd Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 10 Dec 2014 17:38:10 +0700
    Subject: [PATCH 6/9] AudioFlinger: i9082: HACK: force audio to 48 KHz
    @@ -232,7 +232,7 @@ index 7da83ad..484acfb 100644
    2.3.5


    From 9d11c8b9562c5c5f89e8a79b9c7418fc3b73b277 Mon Sep 17 00:00:00 2001
    From 65cd8e77080f632e56d72099fa243c5b07695a13 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 16 Dec 2014 21:12:22 +0700
    Subject: [PATCH 7/9] stagefright: i9082: don't allocate too many extra buffers
    @@ -282,7 +282,7 @@ index 37e8ed6..2fa70a8 100644
    2.3.5


    From ccb871f133ed25c71d4b19ae8e8e8dcab26f083d Mon Sep 17 00:00:00 2001
    From 9ad09fc641d31136f32aafd63d76a477e1c419f2 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Dec 2014 19:09:59 +0700
    Subject: [PATCH 8/9] stagefright: CAPRI_HWC: fix for screen recording
    @@ -338,7 +338,7 @@ index e3a1bd3..07bf1b2 100644
    2.3.5


    From cf3cb70d94bd61903f31938a96cfbf26351136e2 Mon Sep 17 00:00:00 2001
    From 4c4eb3c3f68b3689e792f1ba8ee27850ba9b3f8c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 15:25:33 +0700
    Subject: [PATCH 9/9] stagefright: CAPRI_HWC: fix for miracast
    6 changes: 3 additions & 3 deletions frameworks_base.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 9d0dd4a58ceb4caef6867a71018b8ca4fb6bc6d6 Mon Sep 17 00:00:00 2001
    From a03613a28d7fe9c757988611b242173fb96c736b Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 14:50:29 +0700
    Subject: [PATCH 1/3] TelephonyManager: set properties in Broadcom-style as
    @@ -106,7 +106,7 @@ index 274f8cf..e7f0a3d 100644
    2.3.5


    From 7ac0aa9d7814e5f16fa3632365b05acebd1643e3 Mon Sep 17 00:00:00 2001
    From 1831c5cc604e222e0c656cb9f66d8b541ab1eca4 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 22:33:16 +0700
    Subject: [PATCH 2/3] Camera: HACK: i9082: API hacks
    @@ -166,7 +166,7 @@ index d461bca..a34a758 100644
    2.3.5


    From 39724cc850504fe358d7c5f39e75f2ff16065834 Mon Sep 17 00:00:00 2001
    From ae1487df27f5e3b56c044254c964c44cd3191a26 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 16:23:31 +0700
    Subject: [PATCH 3/3] PowerManagerService: only turn on button light when any
    10 changes: 5 additions & 5 deletions frameworks_native.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From e3512d9e82090d7f7f75e259e9240340fca5fc2f Mon Sep 17 00:00:00 2001
    From 9286ea92a5156e9464978fda5ff3cce78949a6e5 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Thu, 14 Nov 2013 15:19:46 +0700
    Subject: [PATCH 1/5] binder: add compat symbol
    @@ -29,7 +29,7 @@ index dd04dcf..9ec2380 100644
    2.3.5


    From fde13fe4e805d93fd5a2cd9289401bdb01238926 Mon Sep 17 00:00:00 2001
    From 52672bcc7b8a858a35e3084be95417d872068285 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:38:17 +0700
    Subject: [PATCH 2/5] binder: add compat symbols
    @@ -75,7 +75,7 @@ index e7589b1..b34ceb9 100644
    2.3.5


    From 15c7c445483efd839da8bcf434928f2c7f4cfc5a Mon Sep 17 00:00:00 2001
    From 1ee90ff836265e70b8dc0357e86e18502ea46230 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Mon, 16 Dec 2013 15:45:42 +0700
    Subject: [PATCH 3/5] sf: CAPRI_HWC: fix rotation artifact
    @@ -104,7 +104,7 @@ index dfe5754..c608397 100644
    2.3.5


    From bc71eb0842a6b968a643e357d0a5f3d69cf427c0 Mon Sep 17 00:00:00 2001
    From e6e115f462283ac2fc6a581728a5d35412d1eb21 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Mon, 15 Dec 2014 23:12:44 +0700
    Subject: [PATCH 4/5] SurfaceComposerClient: don't block RGBA_8888 for
    @@ -134,7 +134,7 @@ index b6025f2..9c59ba2 100644
    2.3.5


    From 2e8a2ea56c5f156110a578059df473b3a8a7224d Mon Sep 17 00:00:00 2001
    From 395931556400205a102f9db5eec1e07088017821 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Dec 2014 19:09:27 +0700
    Subject: [PATCH 5/5] sf: CAPRI_HWC: fix for screen recording
    63 changes: 56 additions & 7 deletions frameworks_opt_telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,56 @@
    From a87312a40fb1c9457010e7c8375aba191b1c29e5 Mon Sep 17 00:00:00 2001
    From 993c9eae4a27d14d4dff95ed7eabf0b9f1476cde Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 24 Apr 2015 17:31:48 +0700
    Subject: [PATCH 1/3] SubscriptionController: do not send invalid data sub to
    DctController

    Causes random crash when default (-1) subId is set

    E/AndroidRuntime( 2665): FATAL EXCEPTION: DctControllerThread
    E/AndroidRuntime( 2665): Process: com.android.phone, PID: 2665
    E/AndroidRuntime( 2665): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-1
    E/AndroidRuntime( 2665): at com.android.internal.telephony.dataconnection.DctController.handleMessage(DctController.java:368)
    E/AndroidRuntime( 2665): at android.os.Handler.dispatchMessage(Handler.java:102)
    E/AndroidRuntime( 2665): at android.os.Looper.loop(Looper.java:135)
    E/AndroidRuntime( 2665): at android.os.HandlerThread.run(HandlerThread.java:61)

    Change-Id: I2321aa10098cd62fab374d0dd42f2b0e69c65c3d
    ---
    .../android/internal/telephony/SubscriptionController.java | 12 +++++++-----
    1 file changed, 7 insertions(+), 5 deletions(-)

    diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
    index 905d671..b3dc72d 100755
    --- a/src/java/com/android/internal/telephony/SubscriptionController.java
    +++ b/src/java/com/android/internal/telephony/SubscriptionController.java
    @@ -1435,12 +1435,14 @@ public class SubscriptionController extends ISub.Stub {
    throw new RuntimeException("setDefaultDataSubId called with DEFAULT_SUB_ID");
    }
    if (DBG) logdl("[setDefaultDataSubId] subId=" + subId);
    - if (mDctController == null) {
    - mDctController = DctController.getInstance();
    - mDctController.registerForDefaultDataSwitchInfo(mDataConnectionHandler,
    - EVENT_SET_DEFAULT_DATA_DONE, null);
    + if (subId >= 0) {
    + if (mDctController == null) {
    + mDctController = DctController.getInstance();
    + mDctController.registerForDefaultDataSwitchInfo(mDataConnectionHandler,
    + EVENT_SET_DEFAULT_DATA_DONE, null);
    + }
    + mDctController.setDefaultDataSubId(subId);
    }
    - mDctController.setDefaultDataSubId(subId);

    Settings.Global.putInt(mContext.getContentResolver(),
    Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, subId);
    --
    2.3.5


    From fbab96592144024316076719805e8c29a91416f0 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 31 May 2014 12:34:56 +0700
    Subject: [PATCH 1/2] telephony: support for RIL that does not send
    Subject: [PATCH 2/3] 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,7 +63,7 @@ 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 bfccd9f..a309abe 100644
    index f6ffb49..334bece 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 {
    @@ -37,7 +86,7 @@ index bfccd9f..a309abe 100644
    mCallRingDelay = SystemProperties.getInt(
    TelephonyProperties.PROPERTY_CALL_RING_DELAY, 3000);
    Rlog.d(LOG_TAG, "mCallRingDelay=" + mCallRingDelay);
    @@ -1902,6 +1908,18 @@ public abstract class PhoneBase extends Handler implements Phone {
    @@ -1908,6 +1914,18 @@ public abstract class PhoneBase extends Handler implements Phone {
    public void notifyNewRingingConnectionP(Connection cn) {
    if (!mIsVoiceCapable)
    return;
    @@ -56,7 +105,7 @@ index bfccd9f..a309abe 100644
    AsyncResult ar = new AsyncResult(null, cn, null);
    mNewRingingConnectionRegistrants.notifyRegistrants(ar);
    }
    @@ -2334,6 +2352,7 @@ public abstract class PhoneBase extends Handler implements Phone {
    @@ -2340,6 +2358,7 @@ public abstract class PhoneBase extends Handler implements Phone {
    pw.println(" mDnsCheckDisabled=" + mDnsCheckDisabled);
    pw.println(" mDcTracker=" + mDcTracker);
    pw.println(" mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing);
    @@ -68,10 +117,10 @@ index bfccd9f..a309abe 100644
    2.3.5


    From 0a30238f89d13e390ecdff86d298c32e3b179cc5 Mon Sep 17 00:00:00 2001
    From d42dc2daeb318e5d2aed543208629593c9a75752 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 17:39:50 +0700
    Subject: [PATCH 2/2] telephony: RIL: i9082: set correct rild names
    Subject: [PATCH 3/3] telephony: RIL: i9082: set correct rild names

    Change-Id: Idf8e98ae2f36f30b84be04b7b062ca4b52cebd8a
    ---
    4 changes: 2 additions & 2 deletions packages_apps_Settings.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From b721f48f2cff051dcb47e0e571c7e8c6967337da Mon Sep 17 00:00:00 2001
    From 31018413197f9a1e3dd6af85aafcf626ecfdff61 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 16 Nov 2014 08:55:55 +0700
    Subject: [PATCH] Settings: i9082: disable manual provisioning
    @@ -11,7 +11,7 @@ Change-Id: I1096b349ccf60b05aa261289b6bc7127beffaca5
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/src/com/android/settings/sim/MultiSimEnablerPreference.java b/src/com/android/settings/sim/MultiSimEnablerPreference.java
    index 6bd4c43..da14f7b 100644
    index ed1424f..93344ee 100644
    --- a/src/com/android/settings/sim/MultiSimEnablerPreference.java
    +++ b/src/com/android/settings/sim/MultiSimEnablerPreference.java
    @@ -219,7 +219,9 @@ public class MultiSimEnablerPreference extends SwitchPreference implements
    29 changes: 0 additions & 29 deletions packages_apps_SetupWizard.patch
    Original file line number Diff line number Diff line change
    @@ -1,29 +0,0 @@
    From 6d2dcdae2b4ad69529f0b1f822e9194c3a363a04 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 18 Apr 2015 11:40:43 +0700
    Subject: [PATCH] SetupWizard: don't access SubscriptionController directly

    SubscriptionController exists in the telephony process and cannot
    be accessed by SetupWizard.

    getInstance() will always return null.
    ---
    src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    index 451b79e..0ed4c8b 100644
    --- a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    +++ b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    @@ -78,7 +78,7 @@ public class ChooseDataSimPage extends SetupPage {
    }


    - public static class ChooseDataSimFragment extends SetupPageFragment {
    + public class ChooseDataSimFragment extends SetupPageFragment {

    private ViewGroup mPageView;
    private ProgressBar mProgressBar;
    --
    2.3.5

    409 changes: 409 additions & 0 deletions packages_apps_Stk.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,409 @@
    From 2803f0d8c076a0a7dbb04a4b24c8d3d629ece662 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 24 Apr 2015 13:32:38 +0700
    Subject: [PATCH] STK: use single icon as per latest AOSP 5.1

    This partially reverts commit b9676c91039df24dfe7bea589bfd277efa1b5b9a.
    and bring some code back in from AOSP 5.1.

    Change-Id: I25a76bb95e49ca8effa34332adc1f87b90effb2f
    ---
    AndroidManifest.xml | 29 +++++---------
    res/values/cm_strings.xml | 5 ---
    src/com/android/stk/StkAppInstaller.java | 57 ++++++++++++++++-----------
    src/com/android/stk/StkAppService.java | 38 +++++++++++++++---
    src/com/android/stk/StkLauncherActivity2.java | 56 --------------------------
    src/com/android/stk/StkLauncherActivity3.java | 56 --------------------------
    6 files changed, 76 insertions(+), 165 deletions(-)
    delete mode 100644 src/com/android/stk/StkLauncherActivity2.java
    delete mode 100644 src/com/android/stk/StkLauncherActivity3.java

    diff --git a/AndroidManifest.xml b/AndroidManifest.xml
    index 9361fe0..f0d615b 100644
    --- a/AndroidManifest.xml
    +++ b/AndroidManifest.xml
    @@ -39,33 +39,24 @@
    android:supportsRtl="true"
    android:process="com.android.phone">

    - <activity android:name="StkLauncherActivity"
    + <activity android:name="StkMain"
    + android:theme="@android:style/Theme.NoDisplay"
    android:label="@string/app_name"
    - android:taskAffinity="android.task.StkLauncherActivity"
    - android:enabled="false">
    + android:enabled="false"
    + android:taskAffinity="android.task.stk.StkLauncherActivity">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>

    - <activity android:name="StkLauncherActivity2"
    - android:label="@string/app_name2"
    - android:taskAffinity="android.task.StkLauncherActivity2"
    - android:enabled="false" >
    - <intent-filter>
    - <action android:name="android.intent.action.MAIN" />
    - <category android:name="android.intent.category.LAUNCHER" />
    - </intent-filter>
    - </activity>
    -
    - <activity android:name="StkLauncherActivity3"
    - android:label="@string/app_name3"
    - android:taskAffinity="android.task.StkLauncherActivity3"
    - android:enabled="false" >
    + <activity android:name="StkLauncherActivity"
    + android:label="@string/app_name"
    + android:taskAffinity="android.task.stk.StkLauncherActivity">
    <intent-filter>
    - <action android:name="android.intent.action.MAIN" />
    - <category android:name="android.intent.category.LAUNCHER" />
    + <action android:name="android.intent.action.VIEW" />
    + <action android:name="android.intent.action.PICK" />
    + <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    </activity>

    diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
    index 5498c9e..562175b 100644
    --- a/res/values/cm_strings.xml
    +++ b/res/values/cm_strings.xml
    @@ -16,11 +16,6 @@
    limitations under the License.
    -->
    <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    - <!-- Application label used on home screen with an icon2 -->
    - <string name="app_name2">SIM Toolkit 2</string>
    - <!-- Application label used on home screen with an icon3 -->
    - <string name="app_name3">SIM Toolkit 3</string>
    -
    <!-- Default message when no alpha tag in Play Tone -->
    <string name="default_tone_dialog_msg">Playing Tone</string>

    diff --git a/src/com/android/stk/StkAppInstaller.java b/src/com/android/stk/StkAppInstaller.java
    index 9a4fbb7..2d06e59 100644
    --- a/src/com/android/stk/StkAppInstaller.java
    +++ b/src/com/android/stk/StkAppInstaller.java
    @@ -1,6 +1,4 @@
    /*
    - * Copyright (c) 2011, 2013-2014 The Linux Foundation. All rights reserved.
    - * Not a Contribution.
    * Copyright (C) 2007 The Android Open Source Project
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    @@ -19,52 +17,65 @@
    package com.android.stk;

    import com.android.internal.telephony.cat.CatLog;
    +import com.android.internal.telephony.PhoneConstants;
    +import com.android.internal.telephony.TelephonyProperties;

    import android.content.ComponentName;
    import android.content.Context;
    import android.content.pm.PackageManager;
    +import android.telephony.TelephonyManager;
    +import android.os.SystemProperties;

    /**
    * Application installer for SIM Toolkit.
    *
    */
    abstract class StkAppInstaller {
    - private StkAppInstaller() {}
    + private static final String STK_MAIN_ACTIVITY = "com.android.stk.StkMain";
    + private static final String LOG_TAG = "StkAppInstaller";

    - static void install(Context context, int slotId) {
    - setAppState(context, true, slotId);
    + private StkAppInstaller() {
    + CatLog.d(LOG_TAG, "init");
    }

    - static void unInstall(Context context, int slotId) {
    - setAppState(context, false, slotId);
    + public static void install(Context context) {
    + setAppState(context, true);
    }

    - private static void setAppState(Context context, boolean install, int slotId) {
    + public static void unInstall(Context context) {
    + setAppState(context, false);
    + }
    +
    + private static void setAppState(Context context, boolean install) {
    + CatLog.d(LOG_TAG, "[setAppState]+");
    if (context == null) {
    + CatLog.d(LOG_TAG, "[setAppState]- no context, just return.");
    return;
    }
    PackageManager pm = context.getPackageManager();
    if (pm == null) {
    + CatLog.d(LOG_TAG, "[setAppState]- no package manager, just return.");
    return;
    }
    - ComponentName cName;
    - String[] launcherActivity = {
    - "com.android.stk.StkLauncherActivity",
    - "com.android.stk.StkLauncherActivity2",
    - "com.android.stk.StkLauncherActivity3"
    - };
    - // check that STK app package is known to the PackageManager
    - cName = new ComponentName("com.android.stk",
    - launcherActivity[slotId]);
    -
    + ComponentName cName = new ComponentName("com.android.stk", STK_MAIN_ACTIVITY);
    int state = install ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
    : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;

    - try {
    - pm.setComponentEnabledSetting(cName, state,
    - PackageManager.DONT_KILL_APP);
    - } catch (Exception e) {
    - CatLog.d("StkAppInstaller", "Could not change STK app state");
    + if (((PackageManager.COMPONENT_ENABLED_STATE_ENABLED == state) &&
    + (PackageManager.COMPONENT_ENABLED_STATE_ENABLED ==
    + pm.getComponentEnabledSetting(cName))) ||
    + ((PackageManager.COMPONENT_ENABLED_STATE_DISABLED == state) &&
    + (PackageManager.COMPONENT_ENABLED_STATE_DISABLED ==
    + pm.getComponentEnabledSetting(cName)))) {
    + CatLog.d(LOG_TAG, "Need not change app state!!");
    + } else {
    + CatLog.d(LOG_TAG, "Change app state[" + install + "]");
    + try {
    + pm.setComponentEnabledSetting(cName, state, PackageManager.DONT_KILL_APP);
    + } catch (Exception e) {
    + CatLog.d(LOG_TAG, "Could not change STK app state");
    + }
    }
    + CatLog.d(LOG_TAG, "[setAppState]-");
    }
    }
    diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
    index aee0d80..d65a49f 100755
    --- a/src/com/android/stk/StkAppService.java
    +++ b/src/com/android/stk/StkAppService.java
    @@ -96,6 +96,7 @@ public class StkAppService extends Service {
    private Context mContext = null;
    private NotificationManager mNotificationManager = null;
    private HandlerThread[] mHandlerThread;
    + private boolean[] mStkPresent;
    private int mSimCount = TelephonyManager.getDefault().getSimCount();
    static StkAppService sInstance = null;

    @@ -182,6 +183,7 @@ public class StkAppService extends Service {
    mStkService = new AppInterface[mSimCount];
    mHandlerThread = new HandlerThread[mSimCount];
    mServiceHandler = new ServiceHandler[mSimCount];
    + mStkPresent = new boolean[mSimCount];

    mContext = getBaseContext();
    InitHandlerThread();
    @@ -275,7 +277,7 @@ public class StkAppService extends Service {
    for (int i = 0; i < mSimCount; i++) {
    if (mStkService[i] == null) {
    CatLog.d(this, " Unistalling Stk App for slot: " + i);
    - StkAppInstaller.unInstall(mContext, i);
    + unInstallStkApp(i);
    }
    }
    }
    @@ -312,6 +314,30 @@ public class StkAppService extends Service {
    }
    }

    + private void installStkApp(int slotId) {
    + mStkPresent[slotId] = true;
    + updateStkApp();
    + }
    +
    + private void unInstallStkApp(int slotId) {
    + mStkPresent[slotId] = false;
    + updateStkApp();
    + }
    +
    + private void updateStkApp() {
    + boolean install = false;
    + for (int i = 0; i < mSimCount; i++) {
    + if (mStkPresent[i]) {
    + install = true;
    + }
    + }
    + if (install) {
    + StkAppInstaller.install(mContext);
    + } else {
    + StkAppInstaller.unInstall(mContext);
    + }
    + }
    +
    @Override
    public void onDestroy() {
    waitForLooper();
    @@ -496,7 +522,7 @@ public class StkAppService extends Service {
    case OP_BOOT_COMPLETED:
    CatLog.d(this, "OP_BOOT_COMPLETED");
    if (mMainCmd == null) {
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    }
    break;
    case OP_DELAYED_MSG:
    @@ -535,7 +561,7 @@ public class StkAppService extends Service {
    if (cardStatus == false) {
    CatLog.d(this, "CARD is ABSENT");
    // Uninstall STKAPP, Clear Idle text, Menu related variables.
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    mNotificationManager.cancel(STK_NOTIFICATION_ID);
    mStkService[mCurrentSlotId] = null;
    cleanUp();
    @@ -552,7 +578,7 @@ public class StkAppService extends Service {

    if (state.refreshResult == IccRefreshResponse.REFRESH_RESULT_RESET) {
    // Uninstall STkmenu
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    mCurrentMenu = null;
    mMainCmd = null;
    }
    @@ -745,10 +771,10 @@ public class StkAppService extends Service {
    CatLog.d(this, "Uninstall App");
    mCurrentMenu = null;
    mMainCmd = null;
    - StkAppInstaller.unInstall(mContext, mCurrentSlotId);
    + unInstallStkApp(mCurrentSlotId);
    } else {
    CatLog.d(this, "Install App");
    - StkAppInstaller.install(mContext, mCurrentSlotId);
    + installStkApp(mCurrentSlotId);
    }
    mMainMenu = mCurrentMenu;
    if (mMenuIsVisibile) {
    diff --git a/src/com/android/stk/StkLauncherActivity2.java b/src/com/android/stk/StkLauncherActivity2.java
    deleted file mode 100644
    index ed1f132..0000000
    --- a/src/com/android/stk/StkLauncherActivity2.java
    +++ /dev/null
    @@ -1,56 +0,0 @@
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    -
    -package com.android.stk;
    -
    -import android.app.Activity;
    -import android.content.Intent;
    -import android.os.Bundle;
    -
    -/**
    - * Launcher class. Serve as the app's MAIN activity, send an intent to the
    - * StkAppService and finish.
    - *
    - */
    -public class StkLauncherActivity2 extends Activity {
    - private static int mSlotId = 1;
    -
    - @Override
    - protected void onCreate(Bundle savedInstanceState) {
    - super.onCreate(savedInstanceState);
    -
    - Intent intent = new Intent(this, StkAppService.class);
    - intent.putExtra(StkAppService.OPCODE, StkAppService.OP_LAUNCH_APP);
    - intent.putExtra(StkAppService.SLOT_ID, mSlotId);
    - startService(intent);
    -
    - finish();
    - }
    -}
    diff --git a/src/com/android/stk/StkLauncherActivity3.java b/src/com/android/stk/StkLauncherActivity3.java
    deleted file mode 100644
    index bb11d29..0000000
    --- a/src/com/android/stk/StkLauncherActivity3.java
    +++ /dev/null
    @@ -1,56 +0,0 @@
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    -
    -package com.android.stk;
    -
    -import android.app.Activity;
    -import android.content.Intent;
    -import android.os.Bundle;
    -
    -/**
    - * Launcher class. Serve as the app's MAIN activity, send an intent to the
    - * StkAppService and finish.
    - *
    - */
    -public class StkLauncherActivity3 extends Activity {
    - private static int mSlotId = 2;
    -
    - @Override
    - protected void onCreate(Bundle savedInstanceState) {
    - super.onCreate(savedInstanceState);
    -
    - Intent intent = new Intent(this, StkAppService.class);
    - intent.putExtra(StkAppService.OPCODE, StkAppService.OP_LAUNCH_APP);
    - intent.putExtra(StkAppService.SLOT_ID, mSlotId);
    - startService(intent);
    -
    - finish();
    - }
    -}
    --
    2.3.5

    4 changes: 2 additions & 2 deletions packages_apps_Trebuchet.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From e6b01a913bb3193fd41643b9c74c5648b8334f7c Mon Sep 17 00:00:00 2001
    From 0a3a6469218dc23eb195ead7cd8b959ee120ea6d Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:48 +0700
    Subject: [PATCH 1/2] Revert "DynamicGrid: tuning the icon size for some
    @@ -38,7 +38,7 @@ index 779a5a6..1494311 100644
    2.3.5


    From a570fff3c674b4874554109225cb0b99e5afe03b Mon Sep 17 00:00:00 2001
    From d9d9b96b93eea2c642a1fed90d227d400ff6b538 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:50 +0700
    Subject: [PATCH 2/2] Revert "Update Larger icons setting for better usability"
    4 changes: 2 additions & 2 deletions packages_services_Telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 120fe8f84aeab3773893bd921accaf1b629529bb Mon Sep 17 00:00:00 2001
    From dba03bf3b6927b32b135aa7b0def93ea5c519adc Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 23 Dec 2014 22:27:09 +0700
    Subject: [PATCH 1/2] Telephony: HACK: fix 'up' for MSimCallFeature sub option
    @@ -34,7 +34,7 @@ index 37bc515..8bb4da3 100644
    2.3.5


    From 8d380575d353cebf6e2c7c8a9405103023d870bb Mon Sep 17 00:00:00 2001
    From cc40eb1405004c61491763d0e31ff3121cdbb6e4 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 20 Feb 2015 20:26:52 +0700
    Subject: [PATCH 2/2] Telephony: HACK: enable WCDMA only setting
    2 changes: 1 addition & 1 deletion system_core.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From c9e352147ea509ad0b50e3d999ea18cf594e5f9f Mon Sep 17 00:00:00 2001
    From 9d575270bb983608a5bf97050bc9c97c6e26aa29 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 12 Apr 2013 11:40:15 +0700
    Subject: [PATCH] libnetutils: add ifc_set_mtu
  9. pawitp revised this gist Apr 21, 2015. 6 changed files with 58 additions and 216 deletions.
    28 changes: 14 additions & 14 deletions frameworks_av.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From b0d103c165e2c85b79694cfeff818232ddaa26fd Mon Sep 17 00:00:00 2001
    From 7b3a73083184ed879415a07242d17cba209710fe Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 24 Apr 2013 11:37:19 +0700
    Subject: [PATCH 1/9] OMXCodec: Re-implement requires-flush-before-shutdown
    @@ -30,7 +30,7 @@ index 4c1249f..afe4b5c 100644
    2.3.5


    From 0c25c1742bedcb0b5424f1c4427ac79b039b295f Mon Sep 17 00:00:00 2001
    From 3e934c62601909bf87bf29672957fb5388cb6088 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 17 Dec 2013 13:15:52 +0700
    Subject: [PATCH 2/9] OMXCodec: set default input buffer size
    @@ -47,7 +47,7 @@ Change-Id: I74372f3d821e41feb38b9bc0cca4ef56aa019493
    2 files changed, 24 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 504e534..83af10b 100644
    index f5a6fbd..b780128 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -1913,6 +1913,18 @@ status_t ACodec::configureCodec(
    @@ -96,7 +96,7 @@ index afe4b5c..37e8ed6 100644
    2.3.5


    From ee48442534d7e6244340ef9df72ed88086f790a7 Mon Sep 17 00:00:00 2001
    From 6dc42b502b4c8cf76377ef15a39315cbb6347677 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 19 Nov 2014 20:33:58 +0700
    Subject: [PATCH 3/9] ACodec: skip port index checking on vc4 encoder
    @@ -107,7 +107,7 @@ Change-Id: I3fe742a8ec4b7f9bc0c4e5f0825fd3b88965a95e
    1 file changed, 5 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 83af10b..2fae7d0 100644
    index b780128..1214eed 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -3746,6 +3746,11 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
    @@ -126,7 +126,7 @@ index 83af10b..2fae7d0 100644
    2.3.5


    From 4357692a11d1166996bc052f3c9b5902dd8e0ab3 Mon Sep 17 00:00:00 2001
    From 24c117a94b58e9645dbf4770e3172e39016c2abe Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 23 Nov 2014 17:27:20 +0700
    Subject: [PATCH 4/9] ACodec: Don't trust provided width/height when setting
    @@ -140,7 +140,7 @@ Change-Id: I202b291a84d2f9a8c29aa2177ba52a0465f39deb
    1 file changed, 3 insertions(+), 7 deletions(-)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 2fae7d0..cd9a3e6 100644
    index 1214eed..7c94a75 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -1916,13 +1916,9 @@ status_t ACodec::configureCodec(
    @@ -164,7 +164,7 @@ index 2fae7d0..cd9a3e6 100644
    2.3.5


    From de376fd446da5c9199d847fca1e11e704a25786c Mon Sep 17 00:00:00 2001
    From 164327830397e40799e20df275ec4529c44fa22a Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 28 Nov 2014 21:07:59 +0700
    Subject: [PATCH 5/9] AudioFlinger: i9082: HACK: disable stereo record
    @@ -199,7 +199,7 @@ index 25225b0..7da83ad 100644
    2.3.5


    From f39c2c1ff338d6584ddf5539fde645fd74a7bc14 Mon Sep 17 00:00:00 2001
    From 5298eb955cc03dfdf8f732978022d5032dc5bdfd Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 10 Dec 2014 17:38:10 +0700
    Subject: [PATCH 6/9] AudioFlinger: i9082: HACK: force audio to 48 KHz
    @@ -232,7 +232,7 @@ index 7da83ad..484acfb 100644
    2.3.5


    From 1ebdb9fed71ae4c77099197cd729458041495de4 Mon Sep 17 00:00:00 2001
    From 9d11c8b9562c5c5f89e8a79b9c7418fc3b73b277 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 16 Dec 2014 21:12:22 +0700
    Subject: [PATCH 7/9] stagefright: i9082: don't allocate too many extra buffers
    @@ -247,7 +247,7 @@ Change-Id: Idfe85f3cd77d6aa5422073857ceecec902e3ca68
    2 files changed, 8 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index cd9a3e6..b06a3ee 100644
    index 7c94a75..b9be274 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -844,7 +844,11 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
    @@ -282,7 +282,7 @@ index 37e8ed6..2fa70a8 100644
    2.3.5


    From de58aa827aa84573f6818ffd17a99f49cc2cd366 Mon Sep 17 00:00:00 2001
    From ccb871f133ed25c71d4b19ae8e8e8dcab26f083d Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Dec 2014 19:09:59 +0700
    Subject: [PATCH 8/9] stagefright: CAPRI_HWC: fix for screen recording
    @@ -338,7 +338,7 @@ index e3a1bd3..07bf1b2 100644
    2.3.5


    From fdf7044a05b3b4c3647d6d05ee32951ef18e99a5 Mon Sep 17 00:00:00 2001
    From cf3cb70d94bd61903f31938a96cfbf26351136e2 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 15:25:33 +0700
    Subject: [PATCH 9/9] stagefright: CAPRI_HWC: fix for miracast
    @@ -351,7 +351,7 @@ Change-Id: I5f98f00406a6b28c1a2a1862fbcefa2fdd9055d6
    1 file changed, 12 insertions(+), 6 deletions(-)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index b06a3ee..cac8865 100644
    index b9be274..342887d 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) {
    6 changes: 3 additions & 3 deletions frameworks_base.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 049ee589b66009245a6fff96a283d46f12a45802 Mon Sep 17 00:00:00 2001
    From 9d0dd4a58ceb4caef6867a71018b8ca4fb6bc6d6 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 14:50:29 +0700
    Subject: [PATCH 1/3] TelephonyManager: set properties in Broadcom-style as
    @@ -106,7 +106,7 @@ index 274f8cf..e7f0a3d 100644
    2.3.5


    From 60512efaecf9ab16a31304a3d237d89bdc3c191e Mon Sep 17 00:00:00 2001
    From 7ac0aa9d7814e5f16fa3632365b05acebd1643e3 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 22:33:16 +0700
    Subject: [PATCH 2/3] Camera: HACK: i9082: API hacks
    @@ -166,7 +166,7 @@ index d461bca..a34a758 100644
    2.3.5


    From 4788b00e11ad9e6742ee5b2de1707d67e6df465f Mon Sep 17 00:00:00 2001
    From 39724cc850504fe358d7c5f39e75f2ff16065834 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 16:23:31 +0700
    Subject: [PATCH 3/3] PowerManagerService: only turn on button light when any
    10 changes: 5 additions & 5 deletions frameworks_native.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 06a95c91816d81f89c7b939678f5a43e10b94b0e Mon Sep 17 00:00:00 2001
    From e3512d9e82090d7f7f75e259e9240340fca5fc2f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Thu, 14 Nov 2013 15:19:46 +0700
    Subject: [PATCH 1/5] binder: add compat symbol
    @@ -29,7 +29,7 @@ index dd04dcf..9ec2380 100644
    2.3.5


    From 618836db92ebb800d870c190ce90795496c6be5e Mon Sep 17 00:00:00 2001
    From fde13fe4e805d93fd5a2cd9289401bdb01238926 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:38:17 +0700
    Subject: [PATCH 2/5] binder: add compat symbols
    @@ -75,7 +75,7 @@ index e7589b1..b34ceb9 100644
    2.3.5


    From 0325983656a05e1817ed12df3446cb851619375c Mon Sep 17 00:00:00 2001
    From 15c7c445483efd839da8bcf434928f2c7f4cfc5a Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Mon, 16 Dec 2013 15:45:42 +0700
    Subject: [PATCH 3/5] sf: CAPRI_HWC: fix rotation artifact
    @@ -104,7 +104,7 @@ index dfe5754..c608397 100644
    2.3.5


    From 476c6ee94d64c2469efcdb45a2c022e710dac35b Mon Sep 17 00:00:00 2001
    From bc71eb0842a6b968a643e357d0a5f3d69cf427c0 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Mon, 15 Dec 2014 23:12:44 +0700
    Subject: [PATCH 4/5] SurfaceComposerClient: don't block RGBA_8888 for
    @@ -134,7 +134,7 @@ index b6025f2..9c59ba2 100644
    2.3.5


    From ff83dc2393d1fedc903b78aef1d6a56c990b086a Mon Sep 17 00:00:00 2001
    From 2e8a2ea56c5f156110a578059df473b3a8a7224d Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Dec 2014 19:09:27 +0700
    Subject: [PATCH 5/5] sf: CAPRI_HWC: fix for screen recording
    2 changes: 1 addition & 1 deletion packages_apps_Settings.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 8899e72455b852ce8b79e3659d699441ecc6d93a Mon Sep 17 00:00:00 2001
    From b721f48f2cff051dcb47e0e571c7e8c6967337da Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 16 Nov 2014 08:55:55 +0700
    Subject: [PATCH] Settings: i9082: disable manual provisioning
    153 changes: 6 additions & 147 deletions packages_apps_SetupWizard.patch
    Original file line number Diff line number Diff line change
    @@ -1,46 +1,21 @@
    From 40a60f3f1dc70a19613d285f4e46e5a3f94b1ec7 Mon Sep 17 00:00:00 2001
    From 6d2dcdae2b4ad69529f0b1f822e9194c3a363a04 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 18 Apr 2015 11:40:43 +0700
    Subject: [PATCH 1/2] SetupWizard: don't access SubscriptionController directly
    Subject: [PATCH] SetupWizard: don't access SubscriptionController directly

    SubscriptionController exists in the telephony process and cannot
    be accessed by SetupWizard.

    getInstance() will always return null.
    ---
    Android.mk | 3 ---
    .../setupwizard/setup/ChooseDataSimPage.java | 10 +++-------
    .../cyanogenmod/setupwizard/util/SetupWizardUtils.java | 17 ++++++-----------
    3 files changed, 9 insertions(+), 21 deletions(-)
    src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/Android.mk b/Android.mk
    index aa8859d..3f1db8c 100644
    --- a/Android.mk
    +++ b/Android.mk
    @@ -17,9 +17,6 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
    play \
    libphonenumber

    -LOCAL_JAVA_LIBRARIES := \
    - telephony-common
    -
    # Include res dir from chips
    google_play_dir := ../../../external/google/google_play_services/libproject/google-play-services_lib/res
    res_dir := $(google_play_dir) res
    diff --git a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    index c5aedc4..7c9542d 100644
    index 451b79e..0ed4c8b 100644
    --- a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    +++ b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    @@ -38,8 +38,6 @@ import android.widget.ImageView;
    import android.widget.ProgressBar;
    import android.widget.TextView;

    -import com.android.internal.telephony.SubscriptionController;
    -
    import com.cyanogenmod.setupwizard.R;
    import com.cyanogenmod.setupwizard.SetupWizardApp;
    import com.cyanogenmod.setupwizard.cmstats.SetupStats;
    @@ -83,7 +81,7 @@ public class ChooseDataSimPage extends SetupPage {
    @@ -78,7 +78,7 @@ public class ChooseDataSimPage extends SetupPage {
    }


    @@ -49,122 +24,6 @@ index c5aedc4..7c9542d 100644

    private ViewGroup mPageView;
    private ProgressBar mProgressBar;
    @@ -115,8 +113,7 @@ public class ChooseDataSimPage extends SetupPage {
    public void onClick(View view) {
    SubscriptionInfo subInfoRecord = (SubscriptionInfo)view.getTag();
    if (subInfoRecord != null) {
    - SubscriptionController.getInstance()
    - .setDefaultDataSubId(subInfoRecord.getSubscriptionId());
    + mSubscriptionManager.setDefaultDataSubId(subInfoRecord.getSubscriptionId());
    setDataSubChecked(subInfoRecord);
    }
    }
    @@ -126,8 +123,7 @@ public class ChooseDataSimPage extends SetupPage {
    protected void initializePage() {
    mPageView = (ViewGroup)mRootView.findViewById(R.id.page_view);
    mProgressBar = (ProgressBar) mRootView.findViewById(R.id.progress);
    - List<SubscriptionInfo> subInfoRecords = SubscriptionController
    - .getInstance().getActiveSubscriptionInfoList();
    + List<SubscriptionInfo> subInfoRecords = mSubscriptionManager.getActiveSubscriptionInfoList();
    int simCount = subInfoRecords.size();
    mSubInfoRecords = new SparseArray<SubscriptionInfo>(simCount);
    for (int i = 0; i < simCount; i++) {
    diff --git a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
    index 1aeda14..d201080 100644
    --- a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
    +++ b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
    @@ -32,8 +32,6 @@ import android.telephony.SubscriptionManager;
    import android.telephony.TelephonyManager;
    import android.util.Log;

    -import com.android.internal.telephony.SubscriptionController;
    -
    import com.cyanogenmod.setupwizard.SetupWizardApp;

    import com.google.android.gms.common.ConnectionResult;
    @@ -115,15 +113,12 @@ public class SetupWizardUtils {
    public static boolean isSimMissing(Context context) {
    TelephonyManager tm =
    (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    - SubscriptionController subscriptionController = SubscriptionController.getInstance();
    - if (subscriptionController != null) {
    - int simCount = subscriptionController.getActiveSubInfoCount();
    - for (int i = 0; i < simCount; i++) {
    - int simState = tm.getSimState(i);
    - if (simState != TelephonyManager.SIM_STATE_ABSENT &&
    - simState != TelephonyManager.SIM_STATE_UNKNOWN) {
    - return false;
    - }
    + int simCount = SubscriptionManager.from(context).getDefaultDataPhoneId();
    + for (int i = 0; i < simCount; i++) {
    + int simState = tm.getSimState(i);
    + if (simState != TelephonyManager.SIM_STATE_ABSENT &&
    + simState != TelephonyManager.SIM_STATE_UNKNOWN) {
    + return false;
    }
    }
    return true;
    --
    2.3.5


    From 109046e87fa41554821f1c8e4450b5bfebfb7b6c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 18 Apr 2015 11:48:46 +0700
    Subject: [PATCH 2/2] SetupWizard: handle skipping id in SubInfoRecords

    This extends I3b4132afccc96a5d08986a3cb902bd384931f21f to actually
    work.
    ---
    .../setupwizard/setup/ChooseDataSimPage.java | 17 +++++++++--------
    1 file changed, 9 insertions(+), 8 deletions(-)

    diff --git a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    index 7c9542d..4db8f6c 100644
    --- a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    +++ b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    @@ -137,16 +137,17 @@ public class ChooseDataSimPage extends SetupPage {
    mSignalStrengths = new SparseArray<SignalStrength>(simCount);
    mPhoneStateListeners = new SparseArray<PhoneStateListener>(simCount);
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    - for (int i = 0; i < simCount; i++) {
    + for (int i = 0; i < mSubInfoRecords.size(); i++) {
    View simRow = inflater.inflate(R.layout.data_sim_row, null);
    mPageView.addView(simRow);
    - SubscriptionInfo subInfoRecord = mSubInfoRecords.get(i);
    + SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
    simRow.setTag(subInfoRecord);
    simRow.setOnClickListener(mSetDataSimClickListener);
    - mNameViews.put(i, (TextView) simRow.findViewById(R.id.sim_title));
    - mSignalViews.put(i, (ImageView) simRow.findViewById(R.id.signal));
    - mCheckBoxes.put(i, (CheckBox) simRow.findViewById(R.id.enable_check));
    - mPhoneStateListeners.put(i, createPhoneStateListener(subInfoRecord));
    + int slot = subInfoRecord.getSimSlotIndex();
    + mNameViews.put(slot, (TextView) simRow.findViewById(R.id.sim_title));
    + mSignalViews.put(slot, (ImageView) simRow.findViewById(R.id.signal));
    + mCheckBoxes.put(slot, (CheckBox) simRow.findViewById(R.id.enable_check));
    + mPhoneStateListeners.put(slot, createPhoneStateListener(subInfoRecord));
    mPageView.addView(inflater.inflate(R.layout.divider, null));
    }
    updateSignalStrengths();
    @@ -224,7 +225,7 @@ public class ChooseDataSimPage extends SetupPage {
    private void updateSignalStrengths() {
    if (mIsAttached) {
    for (int i = 0; i < mSubInfoRecords.size(); i++) {
    - updateSignalStrength(mSubInfoRecords.get(i));
    + updateSignalStrength(mSubInfoRecords.valueAt(i));
    }
    }
    }
    @@ -248,7 +249,7 @@ public class ChooseDataSimPage extends SetupPage {
    private void updateCurrentDataSub() {
    if (mIsAttached) {
    for (int i = 0; i < mSubInfoRecords.size(); i++) {
    - SubscriptionInfo subInfoRecord = mSubInfoRecords.get(i);
    + SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
    mCheckBoxes.get(i).setChecked(SubscriptionManager.getDefaultDataSubId()
    == subInfoRecord.getSimSlotIndex());

    --
    2.3.5

    75 changes: 29 additions & 46 deletions packages_services_Telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 30678349fdde9e576a275adf1cb7754a609deac7 Mon Sep 17 00:00:00 2001
    From 120fe8f84aeab3773893bd921accaf1b629529bb Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 23 Dec 2014 22:27:09 +0700
    Subject: [PATCH 1/2] Telephony: HACK: fix 'up' for MSimCallFeature sub option
    @@ -9,10 +9,10 @@ Change-Id: I1fcd9309d2849fbdd0ac1c903cbda4a8b1f213f5
    1 file changed, 7 insertions(+), 4 deletions(-)

    diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
    index cbbfac9..5297abc 100644
    index 37bc515..8bb4da3 100644
    --- a/src/com/android/phone/CallFeaturesSetting.java
    +++ b/src/com/android/phone/CallFeaturesSetting.java
    @@ -2294,10 +2294,13 @@ public class CallFeaturesSetting extends PreferenceActivity
    @@ -2301,10 +2301,13 @@ public class CallFeaturesSetting extends PreferenceActivity
    * This is useful for implementing "HomeAsUp" capability for second-level Settings.
    */
    public static void goUpToTopLevelSetting(Activity activity) {
    @@ -34,7 +34,7 @@ index cbbfac9..5297abc 100644
    2.3.5


    From 8333e7a4605604f59d01eacebc1e68e36a2398ec Mon Sep 17 00:00:00 2001
    From 8d380575d353cebf6e2c7c8a9405103023d870bb Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 20 Feb 2015 20:26:52 +0700
    Subject: [PATCH 2/2] Telephony: HACK: enable WCDMA only setting
    @@ -43,9 +43,9 @@ Samsung stock allows WCDMA only

    Change-Id: If552c6439f7b6910422ec5549e54e68da798c82e
    ---
    res/values/strings.xml | 8 +++++---
    src/com/android/phone/MobileNetworkSettings.java | 15 +++++++++++++--
    2 files changed, 18 insertions(+), 5 deletions(-)
    res/values/strings.xml | 8 +++++---
    src/com/android/phone/MobileNetworkSettings.java | 6 +++---
    2 files changed, 8 insertions(+), 6 deletions(-)

    diff --git a/res/values/strings.xml b/res/values/strings.xml
    index 6aa2eec..f6a82d4 100644
    @@ -70,50 +70,33 @@ index 6aa2eec..f6a82d4 100644

    <string-array name="enabled_networks_except_gsm_lte_choices" translatable="false">
    diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
    index 4103111..3bda06e 100644
    index 441510d..da770b2 100755
    --- a/src/com/android/phone/MobileNetworkSettings.java
    +++ b/src/com/android/phone/MobileNetworkSettings.java
    @@ -523,6 +523,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:
    @@ -901,12 +902,22 @@ public class MobileNetworkSettings extends PreferenceActivity
    private void UpdateEnabledNetworksValueAndSummary(int NetworkMode) {
    switch (NetworkMode) {
    @@ -921,7 +921,7 @@ public class MobileNetworkSettings extends PreferenceActivity
    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;
    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);
    break;
    case Phone.NT_MODE_GSM_UMTS:
    mButtonEnabledNetworks.setValue(
    @@ -931,12 +931,12 @@ public class MobileNetworkSettings extends PreferenceActivity
    case Phone.NT_MODE_WCDMA_PREF:
    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));
    @@ -917,7 +928,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));
    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(
    --
    2.3.5

  10. pawitp revised this gist Apr 18, 2015. 13 changed files with 236 additions and 434 deletions.
    4 changes: 2 additions & 2 deletions bootable_recovery.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From f59eb3542b98ddd1bbac1f4bbc363bd54848b323 Mon Sep 17 00:00:00 2001
    From a769d27609fee670b573759fc01d41072a1614f5 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 27 Jan 2015 22:29:39 +0700
    Subject: [PATCH] recovery: uncrypt: fix compatibility with CWM
    @@ -28,5 +28,5 @@ index 7fb0989..6bc4f51 100644
    unlink(RECOVERY_COMMAND_FILE_TMP);
    } else {
    --
    1.9.1
    2.3.5

    58 changes: 29 additions & 29 deletions frameworks_av.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 2fec04b30574a10b9c46cfcda2550de078324ba3 Mon Sep 17 00:00:00 2001
    From b0d103c165e2c85b79694cfeff818232ddaa26fd Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 24 Apr 2013 11:37:19 +0700
    Subject: [PATCH 1/9] OMXCodec: Re-implement requires-flush-before-shutdown
    @@ -13,7 +13,7 @@ Change-Id: I1beac06af8118dcf0c248b631bc8e6dbbab2c1d5
    1 file changed, 3 insertions(+)

    diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
    index f3452f2..387b1d0 100644
    index 4c1249f..afe4b5c 100644
    --- a/media/libstagefright/OMXCodec.cpp
    +++ b/media/libstagefright/OMXCodec.cpp
    @@ -410,6 +410,9 @@ uint32_t OMXCodec::getComponentQuirks(
    @@ -27,10 +27,10 @@ index f3452f2..387b1d0 100644
    quirks |= kRequiresLoadedToIdleAfterAllocation;
    }
    --
    1.9.1
    2.3.5


    From e6da28d5fc09ff0fe44a8929ccf7b386ac19e839 Mon Sep 17 00:00:00 2001
    From 0c25c1742bedcb0b5424f1c4427ac79b039b295f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 17 Dec 2013 13:15:52 +0700
    Subject: [PATCH 2/9] OMXCodec: set default input buffer size
    @@ -47,7 +47,7 @@ Change-Id: I74372f3d821e41feb38b9bc0cca4ef56aa019493
    2 files changed, 24 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 7ee35d6..f720871 100644
    index 504e534..83af10b 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -1913,6 +1913,18 @@ status_t ACodec::configureCodec(
    @@ -70,7 +70,7 @@ index 7ee35d6..f720871 100644
    mBaseOutputFormat = outputFormat;

    diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
    index 387b1d0..2c49c00 100644
    index afe4b5c..37e8ed6 100644
    --- a/media/libstagefright/OMXCodec.cpp
    +++ b/media/libstagefright/OMXCodec.cpp
    @@ -957,6 +957,18 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
    @@ -93,10 +93,10 @@ index 387b1d0..2c49c00 100644
    initOutputFormat(meta);

    --
    1.9.1
    2.3.5


    From dbfdf5de8fb3dad5d2d0b98a44e94c23bb988a02 Mon Sep 17 00:00:00 2001
    From ee48442534d7e6244340ef9df72ed88086f790a7 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 19 Nov 2014 20:33:58 +0700
    Subject: [PATCH 3/9] ACodec: skip port index checking on vc4 encoder
    @@ -107,10 +107,10 @@ Change-Id: I3fe742a8ec4b7f9bc0c4e5f0825fd3b88965a95e
    1 file changed, 5 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index f720871..973f5b2 100644
    index 83af10b..2fae7d0 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -3744,6 +3744,11 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
    @@ -3746,6 +3746,11 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
    mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)),
    (status_t)OK);

    @@ -123,10 +123,10 @@ index f720871..973f5b2 100644
    (int)(portIndex == kPortIndexOutput ? OMX_DirOutput : OMX_DirInput));

    --
    1.9.1
    2.3.5


    From f8854bde9005770530aff16c6a8d7fe4cff37380 Mon Sep 17 00:00:00 2001
    From 4357692a11d1166996bc052f3c9b5902dd8e0ab3 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 23 Nov 2014 17:27:20 +0700
    Subject: [PATCH 4/9] ACodec: Don't trust provided width/height when setting
    @@ -140,7 +140,7 @@ Change-Id: I202b291a84d2f9a8c29aa2177ba52a0465f39deb
    1 file changed, 3 insertions(+), 7 deletions(-)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 973f5b2..d309985 100644
    index 2fae7d0..cd9a3e6 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -1916,13 +1916,9 @@ status_t ACodec::configureCodec(
    @@ -161,10 +161,10 @@ index 973f5b2..d309985 100644
    #endif

    --
    1.9.1
    2.3.5


    From b6e8740680b0dc1e609006bf0dc0514f110fa766 Mon Sep 17 00:00:00 2001
    From de376fd446da5c9199d847fca1e11e704a25786c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 28 Nov 2014 21:07:59 +0700
    Subject: [PATCH 5/9] AudioFlinger: i9082: HACK: disable stereo record
    @@ -196,10 +196,10 @@ index 25225b0..7da83ad 100644
    &inStream, flags, address.string(), source);
    ALOGV("openInput_l() openInputStream returned input %p, SamplingRate %d"
    --
    1.9.1
    2.3.5


    From f2a5b7551adf6d5fd365445b717cdf2b9a4bec15 Mon Sep 17 00:00:00 2001
    From f39c2c1ff338d6584ddf5539fde645fd74a7bc14 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 10 Dec 2014 17:38:10 +0700
    Subject: [PATCH 6/9] AudioFlinger: i9082: HACK: force audio to 48 KHz
    @@ -229,10 +229,10 @@ index 7da83ad..484acfb 100644

    status_t status = inHwHal->open_input_stream(inHwHal, *input, device, &halconfig,
    --
    1.9.1
    2.3.5


    From 296f79f7913bd3d6d3ff1239e6349b97abe992c6 Mon Sep 17 00:00:00 2001
    From 1ebdb9fed71ae4c77099197cd729458041495de4 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 16 Dec 2014 21:12:22 +0700
    Subject: [PATCH 7/9] stagefright: i9082: don't allocate too many extra buffers
    @@ -247,10 +247,10 @@ Change-Id: Idfe85f3cd77d6aa5422073857ceecec902e3ca68
    2 files changed, 8 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index d309985..8b740d6 100644
    index cd9a3e6..b06a3ee 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -836,7 +836,11 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
    @@ -844,7 +844,11 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
    // This check was present in KitKat.
    if (def.nBufferCountActual < def.nBufferCountMin + *minUndequeuedBuffers) {
    #endif
    @@ -263,10 +263,10 @@ index d309985..8b740d6 100644
    def.nBufferCountMin + *minUndequeuedBuffers + extraBuffers;
    def.nBufferCountActual = newBufferCount;
    diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
    index 2c49c00..4d96c2c 100644
    index 37e8ed6..2fa70a8 100644
    --- a/media/libstagefright/OMXCodec.cpp
    +++ b/media/libstagefright/OMXCodec.cpp
    @@ -2373,7 +2373,11 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
    @@ -2377,7 +2377,11 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
    // This check was present in KitKat.
    if (def.nBufferCountActual < def.nBufferCountMin + minUndequeuedBufs) {
    #endif
    @@ -279,10 +279,10 @@ index 2c49c00..4d96c2c 100644
    def.nBufferCountMin + minUndequeuedBufs + extraBuffers;
    def.nBufferCountActual = newBufferCount;
    --
    1.9.1
    2.3.5


    From c2dae735b6dbbbc1fbb15b37de04c0c3677de921 Mon Sep 17 00:00:00 2001
    From de58aa827aa84573f6818ffd17a99f49cc2cd366 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Dec 2014 19:09:59 +0700
    Subject: [PATCH 8/9] stagefright: CAPRI_HWC: fix for screen recording
    @@ -335,10 +335,10 @@ index e3a1bd3..07bf1b2 100644

    GraphicBufferSource* bufferSource = new GraphicBufferSource(
    --
    1.9.1
    2.3.5


    From 0e703a45613a62de8fc9b401fa4fb3ac4c1eecb6 Mon Sep 17 00:00:00 2001
    From fdf7044a05b3b4c3647d6d05ee32951ef18e99a5 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 15:25:33 +0700
    Subject: [PATCH 9/9] stagefright: CAPRI_HWC: fix for miracast
    @@ -351,7 +351,7 @@ Change-Id: I5f98f00406a6b28c1a2a1862fbcefa2fdd9055d6
    1 file changed, 12 insertions(+), 6 deletions(-)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 8b740d6..c570d9c 100644
    index b06a3ee..cac8865 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) {
    @@ -415,5 +415,5 @@ index 8b740d6..c570d9c 100644
    float frameRate;
    if (!msg->findFloat("frame-rate", &frameRate)) {
    --
    1.9.1
    2.3.5

    14 changes: 7 additions & 7 deletions frameworks_base.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From f5c50ac90ebde285d72ee2fb8ce80eb5290a3b4d Mon Sep 17 00:00:00 2001
    From 049ee589b66009245a6fff96a283d46f12a45802 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 14:50:29 +0700
    Subject: [PATCH 1/3] TelephonyManager: set properties in Broadcom-style as
    @@ -12,7 +12,7 @@ Change-Id: I475fdd164b3316720387fefb14a3e12fbc262b39
    1 file changed, 19 insertions(+), 44 deletions(-)

    diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
    index dfea650..1f7f015 100644
    index 274f8cf..e7f0a3d 100644
    --- a/telephony/java/android/telephony/TelephonyManager.java
    +++ b/telephony/java/android/telephony/TelephonyManager.java
    @@ -3020,49 +3020,19 @@ public class TelephonyManager {
    @@ -103,10 +103,10 @@ index dfea650..1f7f015 100644

    /**
    --
    1.9.1
    2.3.5


    From cecfcff89d52c6a27d6a9ec609fdf0ee391890cc Mon Sep 17 00:00:00 2001
    From 60512efaecf9ab16a31304a3d237d89bdc3c191e Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 22:33:16 +0700
    Subject: [PATCH 2/3] Camera: HACK: i9082: API hacks
    @@ -163,10 +163,10 @@ index d461bca..a34a758 100644
    throw new CameraRuntimeException(CAMERA_DEPRECATED_HAL);
    case INVALID_OPERATION:
    --
    1.9.1
    2.3.5


    From 516f9356aed2712605a3b0f26837be941e9837c5 Mon Sep 17 00:00:00 2001
    From 4788b00e11ad9e6742ee5b2de1707d67e6df465f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 16:23:31 +0700
    Subject: [PATCH 3/3] PowerManagerService: only turn on button light when any
    @@ -213,5 +213,5 @@ index cd5baa8..5002726 100644
    } else {
    mButtonsLight.setBrightness(buttonBrightness);
    --
    1.9.1
    2.3.5

    10 changes: 5 additions & 5 deletions frameworks_native.patch
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ index dd04dcf..9ec2380 100644
    {
    return mCallingPid;
    --
    1.9.1
    2.3.5


    From 618836db92ebb800d870c190ce90795496c6be5e Mon Sep 17 00:00:00 2001
    @@ -72,7 +72,7 @@ index e7589b1..b34ceb9 100644
    {
    // size
    --
    1.9.1
    2.3.5


    From 0325983656a05e1817ed12df3446cb851619375c Mon Sep 17 00:00:00 2001
    @@ -101,7 +101,7 @@ index dfe5754..c608397 100644
    const uint32_t hw_w = hw->getWidth();
    const uint32_t hw_h = hw->getHeight();
    --
    1.9.1
    2.3.5


    From 476c6ee94d64c2469efcdb45a2c022e710dac35b Mon Sep 17 00:00:00 2001
    @@ -131,7 +131,7 @@ index b6025f2..9c59ba2 100644
    producer->query(NATIVE_WINDOW_FORMAT,&format);
    if (format == PIXEL_FORMAT_RGBA_8888) {
    --
    1.9.1
    2.3.5


    From ff83dc2393d1fedc903b78aef1d6a56c990b086a Mon Sep 17 00:00:00 2001
    @@ -162,5 +162,5 @@ index 6f76019..ff6a570 100644
    BQ_LOGE("%s: min undequeued buffer count (%d) exceeded "
    "(dequeued=%d undequeued=%d)",
    --
    1.9.1
    2.3.5

    8 changes: 4 additions & 4 deletions frameworks_opt_telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 8773072f4d193e99eb2d13f15a152c3bfb4116dc Mon Sep 17 00:00:00 2001
    From a87312a40fb1c9457010e7c8375aba191b1c29e5 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 31 May 2014 12:34:56 +0700
    Subject: [PATCH 1/2] telephony: support for RIL that does not send
    @@ -65,10 +65,10 @@ index bfccd9f..a309abe 100644
    pw.println(" mCallRingDelay=" + mCallRingDelay);
    pw.println(" mIsTheCurrentActivePhone=" + mIsTheCurrentActivePhone);
    --
    1.9.1
    2.3.5


    From 2dfc805d86ff7ac311a535e8ca3c7620a64aaab8 Mon Sep 17 00:00:00 2001
    From 0a30238f89d13e390ecdff86d298c32e3b179cc5 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 17:39:50 +0700
    Subject: [PATCH 2/2] telephony: RIL: i9082: set correct rild names
    @@ -92,5 +92,5 @@ index a012244..b1bda54 100644
    static final int SOCKET_OPEN_RETRY_MILLIS = 4 * 1000;

    --
    1.9.1
    2.3.5

    2 changes: 1 addition & 1 deletion hardware_broadcom_libbt.patch
    Original file line number Diff line number Diff line change
    @@ -39,5 +39,5 @@ index 949ec4b..be8cd0b 100644
    #endif

    --
    1.9.1
    2.3.5

    8 changes: 4 additions & 4 deletions packages_apps_Camera2.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 7b7c319b7171c16556c7a98033b1f53f3bc1de3f Mon Sep 17 00:00:00 2001
    From ead4750e7201f3437e3a9adbebdbd5f6b6594767 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 23 Jan 2015 20:34:16 +0700
    Subject: [PATCH 1/2] Camera: i9082: disable preview after stopping camera
    @@ -52,10 +52,10 @@ index a034a1c..f203c12 100644
    mPreviewing = false;
    mSnapshotInProgress = false;
    --
    1.9.1
    2.3.5


    From b40d76b7e8183bbfa88f68891638c686c680dee9 Mon Sep 17 00:00:00 2001
    From 79478cabada02634258b3567b282271fc4e28b92 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 24 Jan 2015 21:59:20 +0700
    Subject: [PATCH 2/2] Camera: i9082: update preview state after starting
    @@ -109,5 +109,5 @@ index f203c12..129f39a 100644
    closeCamera();
    throw new RuntimeException("startPreview failed", ex);
    --
    1.9.1
    2.3.5

    8 changes: 4 additions & 4 deletions packages_apps_Settings.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From d5267dee49cc9663b94ff270b1a889262b5d3df0 Mon Sep 17 00:00:00 2001
    From 8899e72455b852ce8b79e3659d699441ecc6d93a Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 16 Nov 2014 08:55:55 +0700
    Subject: [PATCH] Settings: i9082: disable manual provisioning
    @@ -11,10 +11,10 @@ Change-Id: I1096b349ccf60b05aa261289b6bc7127beffaca5
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/src/com/android/settings/sim/MultiSimEnablerPreference.java b/src/com/android/settings/sim/MultiSimEnablerPreference.java
    index 523251d..77628e2 100644
    index 6bd4c43..da14f7b 100644
    --- a/src/com/android/settings/sim/MultiSimEnablerPreference.java
    +++ b/src/com/android/settings/sim/MultiSimEnablerPreference.java
    @@ -215,7 +215,9 @@ public class MultiSimEnablerPreference extends SwitchPreference implements
    @@ -219,7 +219,9 @@ public class MultiSimEnablerPreference extends SwitchPreference implements
    super.onBindView(view);

    mSwitch = (Switch) view.findViewById(com.android.internal.R.id.switchWidget);
    @@ -26,5 +26,5 @@ index 523251d..77628e2 100644
    update();
    }
    --
    1.9.1
    2.3.5

    170 changes: 170 additions & 0 deletions packages_apps_SetupWizard.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,170 @@
    From 40a60f3f1dc70a19613d285f4e46e5a3f94b1ec7 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 18 Apr 2015 11:40:43 +0700
    Subject: [PATCH 1/2] SetupWizard: don't access SubscriptionController directly

    SubscriptionController exists in the telephony process and cannot
    be accessed by SetupWizard.

    getInstance() will always return null.
    ---
    Android.mk | 3 ---
    .../setupwizard/setup/ChooseDataSimPage.java | 10 +++-------
    .../cyanogenmod/setupwizard/util/SetupWizardUtils.java | 17 ++++++-----------
    3 files changed, 9 insertions(+), 21 deletions(-)

    diff --git a/Android.mk b/Android.mk
    index aa8859d..3f1db8c 100644
    --- a/Android.mk
    +++ b/Android.mk
    @@ -17,9 +17,6 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
    play \
    libphonenumber

    -LOCAL_JAVA_LIBRARIES := \
    - telephony-common
    -
    # Include res dir from chips
    google_play_dir := ../../../external/google/google_play_services/libproject/google-play-services_lib/res
    res_dir := $(google_play_dir) res
    diff --git a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    index c5aedc4..7c9542d 100644
    --- a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    +++ b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    @@ -38,8 +38,6 @@ import android.widget.ImageView;
    import android.widget.ProgressBar;
    import android.widget.TextView;

    -import com.android.internal.telephony.SubscriptionController;
    -
    import com.cyanogenmod.setupwizard.R;
    import com.cyanogenmod.setupwizard.SetupWizardApp;
    import com.cyanogenmod.setupwizard.cmstats.SetupStats;
    @@ -83,7 +81,7 @@ public class ChooseDataSimPage extends SetupPage {
    }


    - public static class ChooseDataSimFragment extends SetupPageFragment {
    + public class ChooseDataSimFragment extends SetupPageFragment {

    private ViewGroup mPageView;
    private ProgressBar mProgressBar;
    @@ -115,8 +113,7 @@ public class ChooseDataSimPage extends SetupPage {
    public void onClick(View view) {
    SubscriptionInfo subInfoRecord = (SubscriptionInfo)view.getTag();
    if (subInfoRecord != null) {
    - SubscriptionController.getInstance()
    - .setDefaultDataSubId(subInfoRecord.getSubscriptionId());
    + mSubscriptionManager.setDefaultDataSubId(subInfoRecord.getSubscriptionId());
    setDataSubChecked(subInfoRecord);
    }
    }
    @@ -126,8 +123,7 @@ public class ChooseDataSimPage extends SetupPage {
    protected void initializePage() {
    mPageView = (ViewGroup)mRootView.findViewById(R.id.page_view);
    mProgressBar = (ProgressBar) mRootView.findViewById(R.id.progress);
    - List<SubscriptionInfo> subInfoRecords = SubscriptionController
    - .getInstance().getActiveSubscriptionInfoList();
    + List<SubscriptionInfo> subInfoRecords = mSubscriptionManager.getActiveSubscriptionInfoList();
    int simCount = subInfoRecords.size();
    mSubInfoRecords = new SparseArray<SubscriptionInfo>(simCount);
    for (int i = 0; i < simCount; i++) {
    diff --git a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
    index 1aeda14..d201080 100644
    --- a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
    +++ b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
    @@ -32,8 +32,6 @@ import android.telephony.SubscriptionManager;
    import android.telephony.TelephonyManager;
    import android.util.Log;

    -import com.android.internal.telephony.SubscriptionController;
    -
    import com.cyanogenmod.setupwizard.SetupWizardApp;

    import com.google.android.gms.common.ConnectionResult;
    @@ -115,15 +113,12 @@ public class SetupWizardUtils {
    public static boolean isSimMissing(Context context) {
    TelephonyManager tm =
    (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    - SubscriptionController subscriptionController = SubscriptionController.getInstance();
    - if (subscriptionController != null) {
    - int simCount = subscriptionController.getActiveSubInfoCount();
    - for (int i = 0; i < simCount; i++) {
    - int simState = tm.getSimState(i);
    - if (simState != TelephonyManager.SIM_STATE_ABSENT &&
    - simState != TelephonyManager.SIM_STATE_UNKNOWN) {
    - return false;
    - }
    + int simCount = SubscriptionManager.from(context).getDefaultDataPhoneId();
    + for (int i = 0; i < simCount; i++) {
    + int simState = tm.getSimState(i);
    + if (simState != TelephonyManager.SIM_STATE_ABSENT &&
    + simState != TelephonyManager.SIM_STATE_UNKNOWN) {
    + return false;
    }
    }
    return true;
    --
    2.3.5


    From 109046e87fa41554821f1c8e4450b5bfebfb7b6c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 18 Apr 2015 11:48:46 +0700
    Subject: [PATCH 2/2] SetupWizard: handle skipping id in SubInfoRecords

    This extends I3b4132afccc96a5d08986a3cb902bd384931f21f to actually
    work.
    ---
    .../setupwizard/setup/ChooseDataSimPage.java | 17 +++++++++--------
    1 file changed, 9 insertions(+), 8 deletions(-)

    diff --git a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    index 7c9542d..4db8f6c 100644
    --- a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    +++ b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
    @@ -137,16 +137,17 @@ public class ChooseDataSimPage extends SetupPage {
    mSignalStrengths = new SparseArray<SignalStrength>(simCount);
    mPhoneStateListeners = new SparseArray<PhoneStateListener>(simCount);
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    - for (int i = 0; i < simCount; i++) {
    + for (int i = 0; i < mSubInfoRecords.size(); i++) {
    View simRow = inflater.inflate(R.layout.data_sim_row, null);
    mPageView.addView(simRow);
    - SubscriptionInfo subInfoRecord = mSubInfoRecords.get(i);
    + SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
    simRow.setTag(subInfoRecord);
    simRow.setOnClickListener(mSetDataSimClickListener);
    - mNameViews.put(i, (TextView) simRow.findViewById(R.id.sim_title));
    - mSignalViews.put(i, (ImageView) simRow.findViewById(R.id.signal));
    - mCheckBoxes.put(i, (CheckBox) simRow.findViewById(R.id.enable_check));
    - mPhoneStateListeners.put(i, createPhoneStateListener(subInfoRecord));
    + int slot = subInfoRecord.getSimSlotIndex();
    + mNameViews.put(slot, (TextView) simRow.findViewById(R.id.sim_title));
    + mSignalViews.put(slot, (ImageView) simRow.findViewById(R.id.signal));
    + mCheckBoxes.put(slot, (CheckBox) simRow.findViewById(R.id.enable_check));
    + mPhoneStateListeners.put(slot, createPhoneStateListener(subInfoRecord));
    mPageView.addView(inflater.inflate(R.layout.divider, null));
    }
    updateSignalStrengths();
    @@ -224,7 +225,7 @@ public class ChooseDataSimPage extends SetupPage {
    private void updateSignalStrengths() {
    if (mIsAttached) {
    for (int i = 0; i < mSubInfoRecords.size(); i++) {
    - updateSignalStrength(mSubInfoRecords.get(i));
    + updateSignalStrength(mSubInfoRecords.valueAt(i));
    }
    }
    }
    @@ -248,7 +249,7 @@ public class ChooseDataSimPage extends SetupPage {
    private void updateCurrentDataSub() {
    if (mIsAttached) {
    for (int i = 0; i < mSubInfoRecords.size(); i++) {
    - SubscriptionInfo subInfoRecord = mSubInfoRecords.get(i);
    + SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
    mCheckBoxes.get(i).setChecked(SubscriptionManager.getDefaultDataSubId()
    == subInfoRecord.getSimSlotIndex());

    --
    2.3.5

    8 changes: 4 additions & 4 deletions packages_apps_Trebuchet.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From a9f99c67e236fe35ef6359527e4348f1261eab27 Mon Sep 17 00:00:00 2001
    From e6b01a913bb3193fd41643b9c74c5648b8334f7c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:48 +0700
    Subject: [PATCH 1/2] Revert "DynamicGrid: tuning the icon size for some
    @@ -35,10 +35,10 @@ index 779a5a6..1494311 100644
    // The tablet profile is odd in that the landscape orientation
    // also includes the nav bar on the side
    --
    1.9.1
    2.3.5


    From 7d0e7a3639c58c967fe14c2f915610288fa5c9f8 Mon Sep 17 00:00:00 2001
    From a570fff3c674b4874554109225cb0b99e5afe03b Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:50 +0700
    Subject: [PATCH 2/2] Revert "Update Larger icons setting for better usability"
    @@ -128,5 +128,5 @@ index 1494311..d2a5ff7 100644
    mMinWidth = dpiFromPx(minWidthPx, dm);
    mMinHeight = dpiFromPx(minHeightPx, dm);
    --
    1.9.1
    2.3.5

    368 changes: 0 additions & 368 deletions packages_services_Telecomm.patch
    Original file line number Diff line number Diff line change
    @@ -1,368 +0,0 @@
    From e611ca7dcabe0be837c401a304e97cc310d6f099 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 15 Mar 2015 08:33:32 +0700
    Subject: [PATCH 1/2] CallsManager: fix starting call from Contacts app with
    MSim

    The extras bundle may be Bundle.EMPTY, which immutable. Create our
    own copy to modify.

    Change-Id: If875eddc6afe9c5ca4b0d59a51902529cf115487
    ---
    src/com/android/server/telecom/CallsManager.java | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
    index 0934df7..1f84d61 100644
    --- a/src/com/android/server/telecom/CallsManager.java
    +++ b/src/com/android/server/telecom/CallsManager.java
    @@ -627,6 +627,8 @@ public final class CallsManager extends Call.ListenerBase {
    if (needsAccountSelection) {
    // This is the state where the user is expected to select an account
    call.setState(CallState.PRE_DIAL_WAIT);
    + // Create our own instance to modify (since extras may be Bundle.EMPTY)
    + extras = new Bundle(extras);
    extras.putParcelableList(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS, accounts);
    } else {
    call.setState(CallState.CONNECTING);
    --
    1.9.1


    From a4709db3091ec7dfdefe3dbe99635c607e84545e Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 5 Apr 2015 10:15:00 +0700
    Subject: [PATCH 2/2] Revert "Subscription selection when dialing USSD"

    This is already handled by AOSP in Dialer.

    This reverts commit 63605bb077cf87d0678197b42527f6c0a4eb6436.

    Conflicts:
    res/values/colors.xml
    res/values/strings.xml
    src/com/android/server/telecom/AccountSelection.java
    src/com/android/server/telecom/CallsManager.java

    Change-Id: Ib5d49a6b7685c3781fad122f2d1e612993ff9e6a
    ---
    AndroidManifest.xml | 3 -
    res/layout/account_list_item.xml | 54 --------
    res/values/cm_strings.xml | 1 -
    res/values/colors.xml | 1 -
    .../android/server/telecom/AccountSelection.java | 147 ---------------------
    src/com/android/server/telecom/CallsManager.java | 33 +----
    6 files changed, 1 insertion(+), 238 deletions(-)
    delete mode 100644 res/layout/account_list_item.xml
    delete mode 100644 src/com/android/server/telecom/AccountSelection.java

    diff --git a/AndroidManifest.xml b/AndroidManifest.xml
    index f382f30..511316b 100644
    --- a/AndroidManifest.xml
    +++ b/AndroidManifest.xml
    @@ -228,9 +228,6 @@
    <action android:name="android.bluetooth.IBluetoothHeadsetPhone" />
    </intent-filter>
    </service>
    - <activity android:name="AccountSelection"
    - android:theme="@style/Theme.Telecomm.Transparent"
    - android:excludeFromRecents="true"/>

    <service android:name=".TelecomService"
    android:singleUser="true"
    diff --git a/res/layout/account_list_item.xml b/res/layout/account_list_item.xml
    deleted file mode 100644
    index 86d3cb7..0000000
    --- a/res/layout/account_list_item.xml
    +++ /dev/null
    @@ -1,54 +0,0 @@
    -<?xml version="1.0" encoding="utf-8"?>
    -<!--
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    --->
    -
    -<LinearLayout
    - xmlns:android="http://schemas.android.com/apk/res/android"
    - android:orientation="horizontal"
    - android:layout_width="match_parent"
    - android:layout_height="wrap_content"
    - android:padding="4dp" >
    -
    - <ImageView android:id="@+id/icon"
    - android:layout_width="48dp"
    - android:layout_height="48dp"
    - android:tint="@color/dialtacts_secondary_text_color"
    - android:scaleType="center" />
    -
    - <TextView android:id="@+id/text"
    - android:textAppearance="?android:attr/textAppearanceMedium"
    - android:gravity="start|center_vertical"
    - android:layout_marginLeft="8dp"
    - android:layout_width="0dp"
    - android:layout_weight="1"
    - android:layout_height="match_parent" />
    -</LinearLayout>
    diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
    index 785e4ef..523175d 100644
    --- a/res/values/cm_strings.xml
    +++ b/res/values/cm_strings.xml
    @@ -34,5 +34,4 @@

    <!-- Message indicating video calls not allowed if user enabled TTY Mode -->
    <string name="video_call_not_allowed_if_tty_enabled">Please disable TTY mode to make video calls.</string>
    - <string name="select_account_dialog_title">Select account</string>
    </resources>
    diff --git a/res/values/colors.xml b/res/values/colors.xml
    index f9eb279..64db085 100644
    --- a/res/values/colors.xml
    +++ b/res/values/colors.xml
    @@ -16,7 +16,6 @@

    <resources>
    <color name="theme_color">#0288d1</color>
    - <color name="dialtacts_secondary_text_color">#737373</color>

    <color name="dialer_settings_actionbar_text_color">#ffffff</color>
    <color name="dialer_settings_actionbar_background_color">@color/theme_color</color>
    diff --git a/src/com/android/server/telecom/AccountSelection.java b/src/com/android/server/telecom/AccountSelection.java
    deleted file mode 100644
    index 537f4e4..0000000
    --- a/src/com/android/server/telecom/AccountSelection.java
    +++ /dev/null
    @@ -1,147 +0,0 @@
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    -package com.android.server.telecom;
    -
    -import android.app.Activity;
    -import android.app.AlertDialog;
    -import android.content.Context;
    -import android.content.DialogInterface;
    -import android.content.DialogInterface.OnClickListener;
    -import android.content.DialogInterface.OnCancelListener;
    -import android.content.Intent;
    -import android.net.Uri;
    -import android.telecom.PhoneAccount;
    -import android.telecom.PhoneAccountHandle;
    -import android.view.KeyEvent;
    -import android.view.View;
    -import android.view.ViewGroup;
    -import android.view.Window;
    -import android.view.WindowManager;
    -import android.view.accessibility.AccessibilityEvent;
    -import android.widget.ArrayAdapter;
    -import android.widget.ListAdapter;
    -import android.widget.ImageView;
    -import android.widget.TextView;
    -
    -
    -import java.util.List;
    -import android.os.Bundle;
    -import android.telecom.TelecomManager;
    -import android.view.LayoutInflater;
    -
    -public class AccountSelection extends Activity {
    -
    - TelecomManager mTelecomManager;
    - List<PhoneAccountHandle> mAccountHandles;
    - Uri mHandle;
    - boolean mIsSelected = false;
    -
    - @Override
    - protected void onCreate(Bundle icicle) {
    - Log.d(this, "onCreate()... this = " + this);
    -
    - super.onCreate(icicle);
    - Intent intent = getIntent();
    - Bundle extras = intent.getExtras();
    - mHandle = Uri.parse(extras.getString("Handle"));
    - mAccountHandles = extras.getParcelableArrayList(android.telecom.
    - Call.AVAILABLE_PHONE_ACCOUNTS);
    - if (mAccountHandles == null ) {
    - finish();
    - return;
    - }
    - mTelecomManager = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
    - final DialogInterface.OnClickListener selectionListener =
    - new DialogInterface.OnClickListener() {
    - @Override
    - public void onClick(DialogInterface dialog, int which) {
    - mIsSelected = true;
    - CallsManager.getInstance().phoneAccountSelectedForMMI(mHandle,
    - mAccountHandles.get(which));
    - finish();
    - }
    - };
    - AlertDialog.Builder builder = new AlertDialog.Builder(AccountSelection.this);
    -
    - ListAdapter AccountListAdapter = new AccountListAdapter(
    - builder.getContext(),
    - R.layout.account_list_item,
    - mAccountHandles);
    -
    - builder.setTitle(R.string.select_account_dialog_title)
    - .setAdapter(AccountListAdapter, selectionListener)
    - .setOnCancelListener(new DialogInterface.OnCancelListener() {
    - @Override
    - public void onCancel(DialogInterface dialog) {
    - mIsSelected = false;
    - finish();
    - }
    - }).create().show();
    - }
    -
    - private class AccountListAdapter extends ArrayAdapter<PhoneAccountHandle> {
    - private Context mContext;
    - private int mResId;
    -
    - public AccountListAdapter(
    - Context context, int resource, List<PhoneAccountHandle> accountHandles) {
    - super(context, resource, accountHandles);
    - mContext = context;
    - mResId = resource;
    - }
    -
    - @Override
    - public View getView(int position, View convertView, ViewGroup parent) {
    - LayoutInflater inflater = (LayoutInflater)
    - mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    -
    - View rowView = inflater.inflate(mResId, null);
    - TextView textView = (TextView) rowView.findViewById(R.id.text);
    - ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
    -
    - PhoneAccountHandle accountHandle = getItem(position);
    - PhoneAccount account = mTelecomManager.getPhoneAccount(accountHandle);
    - textView.setText(account.getLabel());
    - imageView.setImageDrawable(account.createIconDrawable(mContext));
    - return rowView;
    - }
    -
    - }
    -
    -
    - @Override
    - protected void onDestroy() {
    - Log.d(this, "onDestroy()... this = " + mIsSelected);
    - if(!mIsSelected) {
    - CallsManager.getInstance().phoneAccountSelectedForMMI(mHandle, null);
    - }
    - super.onDestroy();
    - }
    -}
    diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
    index 1f84d61..7de9087 100644
    --- a/src/com/android/server/telecom/CallsManager.java
    +++ b/src/com/android/server/telecom/CallsManager.java
    @@ -637,16 +637,7 @@ public final class CallsManager extends Call.ListenerBase {
    call.setExtras(extras);

    // Do not add the call if it is a potential MMI code.
    - if (phoneAccountHandle == null && isPotentialMMICode(handle) &&
    - accounts.size() > 1) {
    - mCalls.add(call);
    - call.addListener(this);
    - extras.putString("Handle", handle.toString());
    - Intent intent = new Intent(mContext, AccountSelection.class);
    - intent.putExtras(extras);
    - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    - mContext.startActivity(intent);
    - } else if ((isPotentialMMICode(handle) || isPotentialInCallMMICode) && !needsAccountSelection) {
    + if ((isPotentialMMICode(handle) || isPotentialInCallMMICode) && !needsAccountSelection) {
    call.addListener(this);
    } else if (!mCalls.contains(call)) {
    // We check if mCalls already contains the call because we could potentially be reusing
    @@ -1018,16 +1009,6 @@ public final class CallsManager extends Call.ListenerBase {
    }
    }

    - void phoneAccountSelectedForMMI(Uri handle, PhoneAccountHandle account) {
    - Call call = getFirstCallWithHandle(handle, CallState.PRE_DIAL_WAIT);
    - Log.d(this,"call: "+ call);
    - if (account != null) {
    - phoneAccountSelected(call, account, false);
    - } else {
    - call.disconnect();
    - }
    - }
    -
    /** Called when the audio state changes. */
    void onAudioStateChanged(AudioState oldAudioState, AudioState newAudioState) {
    Log.v(this, "onAudioStateChanged, audioState: %s -> %s", oldAudioState, newAudioState);
    @@ -1267,18 +1248,6 @@ public final class CallsManager extends Call.ListenerBase {
    return getFirstCallWithState(null, states);
    }

    - Call getFirstCallWithHandle(Uri handle, int... states) {
    - for (int currentState : states) {
    - for (Call call : mCalls) {
    - if ((currentState == call.getState()) &&
    - call.getHandle().toString().equals(handle.toString())) {
    - return call;
    - }
    - }
    - }
    - return null;
    - }
    -
    /**
    * Returns the first call that it finds with the given states. The states are treated as having
    * priority order so that any call with the first state will be returned before any call with
    --
    1.9.1

    8 changes: 4 additions & 4 deletions packages_services_Telephony.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From a49543b9dc4ce3bd49b505ef523c5594f67fe339 Mon Sep 17 00:00:00 2001
    From 30678349fdde9e576a275adf1cb7754a609deac7 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 23 Dec 2014 22:27:09 +0700
    Subject: [PATCH 1/2] Telephony: HACK: fix 'up' for MSimCallFeature sub option
    @@ -31,10 +31,10 @@ index cbbfac9..5297abc 100644
    }
    }
    --
    1.9.1
    2.3.5


    From 7cd091321568a4b24b82ed4d55bb459f8e91ae03 Mon Sep 17 00:00:00 2001
    From 8333e7a4605604f59d01eacebc1e68e36a2398ec Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 20 Feb 2015 20:26:52 +0700
    Subject: [PATCH 2/2] Telephony: HACK: enable WCDMA only setting
    @@ -115,5 +115,5 @@ index 4103111..3bda06e 100644
    mButtonEnabledNetworks.setValue(
    Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
    --
    1.9.1
    2.3.5

    4 changes: 2 additions & 2 deletions system_core.patch
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From 2856ce55dcc0e750b0c17c6749391ec2a237e01a Mon Sep 17 00:00:00 2001
    From c9e352147ea509ad0b50e3d999ea18cf594e5f9f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 12 Apr 2013 11:40:15 +0700
    Subject: [PATCH] libnetutils: add ifc_set_mtu
    @@ -33,5 +33,5 @@ index d9c50ab..2394f9d 100644
    + return ret;
    +}
    --
    1.9.1
    2.3.5

  11. pawitp revised this gist Apr 5, 2015. 13 changed files with 1772 additions and 1 deletion.
    32 changes: 32 additions & 0 deletions bootable_recovery.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    From f59eb3542b98ddd1bbac1f4bbc363bd54848b323 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    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 {
    --
    1.9.1

    419 changes: 419 additions & 0 deletions frameworks_av.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,419 @@
    From 2fec04b30574a10b9c46cfcda2550de078324ba3 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 24 Apr 2013 11:37:19 +0700
    Subject: [PATCH 1/9] OMXCodec: Re-implement requires-flush-before-shutdown
    quirk

    Support is already there, but is not in the codec quirk reading list.
    Re-implement it as required by Broadcom's OMX

    Change-Id: I1beac06af8118dcf0c248b631bc8e6dbbab2c1d5
    ---
    media/libstagefright/OMXCodec.cpp | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
    index f3452f2..387b1d0 100644
    --- a/media/libstagefright/OMXCodec.cpp
    +++ b/media/libstagefright/OMXCodec.cpp
    @@ -410,6 +410,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;
    }
    --
    1.9.1


    From e6da28d5fc09ff0fe44a8929ccf7b386ac19e839 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 17 Dec 2013 13:15:52 +0700
    Subject: [PATCH 2/9] 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

    (This patch has been adapted for Lollipop)

    Change-Id: I74372f3d821e41feb38b9bc0cca4ef56aa019493
    ---
    media/libstagefright/ACodec.cpp | 12 ++++++++++++
    media/libstagefright/OMXCodec.cpp | 12 ++++++++++++
    2 files changed, 24 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 7ee35d6..f720871 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
    }
    +// 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)) {
    + int32_t width;
    + int32_t height;
    + if (msg->findInt32("width", &width) && msg->findInt32("height", &height)) {
    + setMinBufferSize(kPortIndexInput, (width * height * 3) / 2);
    + } else {
    + ALOGE("Failed to set min buffer size");
    + }
    + }
    +#endif

    mBaseOutputFormat = outputFormat;

    diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
    index 387b1d0..2c49c00 100644
    --- a/media/libstagefright/OMXCodec.cpp
    +++ b/media/libstagefright/OMXCodec.cpp
    @@ -957,6 +957,18 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
    if (meta->findInt32(kKeyMaxInputSize, &maxInputSize)) {
    setMinBufferSize(kPortIndexInput, (OMX_U32)maxInputSize);
    }
    +// Capri's OMX fail to set a reasonable default size from width and height
    +#ifdef CAPRI_HWC
    + else if (!strncmp(mComponentName, "OMX.BRCM.vc4.decoder.", 21)) {
    + int32_t width;
    + int32_t height;
    + if (meta->findInt32(kKeyWidth, &width) && meta->findInt32(kKeyHeight, &height)) {
    + setMinBufferSize(kPortIndexInput, (width * height * 3) / 2);
    + } else {
    + ALOGE("Failed to set min buffer size");
    + }
    + }
    +#endif

    initOutputFormat(meta);

    --
    1.9.1


    From dbfdf5de8fb3dad5d2d0b98a44e94c23bb988a02 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 19 Nov 2014 20:33:58 +0700
    Subject: [PATCH 3/9] ACodec: skip port index checking on vc4 encoder

    Change-Id: I3fe742a8ec4b7f9bc0c4e5f0825fd3b88965a95e
    ---
    media/libstagefright/ACodec.cpp | 5 +++++
    1 file changed, 5 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index f720871..973f5b2 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -3744,6 +3744,11 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
    mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)),
    (status_t)OK);

    +#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));

    --
    1.9.1


    From f8854bde9005770530aff16c6a8d7fe4cff37380 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 23 Nov 2014 17:27:20 +0700
    Subject: [PATCH 4/9] ACodec: Don't trust provided width/height when setting
    input buffer size

    They are bogus

    Change-Id: I202b291a84d2f9a8c29aa2177ba52a0465f39deb
    ---
    media/libstagefright/ACodec.cpp | 10 +++-------
    1 file changed, 3 insertions(+), 7 deletions(-)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 973f5b2..d309985 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -1916,13 +1916,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)) {
    - int32_t width;
    - int32_t height;
    - if (msg->findInt32("width", &width) && msg->findInt32("height", &height)) {
    - setMinBufferSize(kPortIndexInput, (width * height * 3) / 2);
    - } else {
    - ALOGE("Failed to set min buffer size");
    - }
    + // We cannot trust the width/height from the message
    + // so just use 1920x1080
    + setMinBufferSize(kPortIndexInput, (1920 * 1080 * 3) / 2);
    }
    #endif

    --
    1.9.1


    From b6e8740680b0dc1e609006bf0dc0514f110fa766 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 28 Nov 2014 21:07:59 +0700
    Subject: [PATCH 5/9] 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::RecordThread> 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"
    --
    1.9.1


    From f2a5b7551adf6d5fd365445b717cdf2b9a4bec15 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Wed, 10 Dec 2014 17:38:10 +0700
    Subject: [PATCH 6/9] AudioFlinger: i9082: HACK: force audio to 48 KHz

    Let surfaceflinger do all the resampling instead of the audio HAL

    Don't know if it fixes anything, but worth a try

    Change-Id: I0113831464f2f64c26a9c93bba8fe6b8229b09b4
    ---
    services/audioflinger/AudioFlinger.cpp | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
    index 7da83ad..484acfb 100644
    --- a/services/audioflinger/AudioFlinger.cpp
    +++ b/services/audioflinger/AudioFlinger.cpp
    @@ -2364,8 +2364,9 @@ sp<AudioFlinger::RecordThread> AudioFlinger::openInput_l(audio_module_handle_t m
    audio_stream_in_t *inStream = NULL;

    #ifdef CAPRI_HWC
    - ALOGD("Forcing channel mask to mono on capri");
    + ALOGD("Forcing input to mono 48K on capri");
    halconfig.channel_mask = AUDIO_CHANNEL_IN_MONO;
    + halconfig.sample_rate = 48000;
    #endif

    status_t status = inHwHal->open_input_stream(inHwHal, *input, device, &halconfig,
    --
    1.9.1


    From 296f79f7913bd3d6d3ff1239e6349b97abe992c6 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 16 Dec 2014 21:12:22 +0700
    Subject: [PATCH 7/9] 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

    Change-Id: Idfe85f3cd77d6aa5422073857ceecec902e3ca68
    ---
    media/libstagefright/ACodec.cpp | 4 ++++
    media/libstagefright/OMXCodec.cpp | 4 ++++
    2 files changed, 8 insertions(+)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index d309985..8b740d6 100644
    --- a/media/libstagefright/ACodec.cpp
    +++ b/media/libstagefright/ACodec.cpp
    @@ -836,7 +836,11 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
    // This check was present in KitKat.
    if (def.nBufferCountActual < def.nBufferCountMin + *minUndequeuedBuffers) {
    #endif
    +#ifdef CAPRI_HWC
    + for (OMX_U32 extraBuffers = 1; /* condition inside loop */; extraBuffers--) {
    +#else
    for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
    +#endif
    OMX_U32 newBufferCount =
    def.nBufferCountMin + *minUndequeuedBuffers + extraBuffers;
    def.nBufferCountActual = newBufferCount;
    diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
    index 2c49c00..4d96c2c 100644
    --- a/media/libstagefright/OMXCodec.cpp
    +++ b/media/libstagefright/OMXCodec.cpp
    @@ -2373,7 +2373,11 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
    // This check was present in KitKat.
    if (def.nBufferCountActual < def.nBufferCountMin + minUndequeuedBufs) {
    #endif
    +#ifdef CAPRI_HWC
    + for (OMX_U32 extraBuffers = 1; /* condition inside loop */; extraBuffers--) {
    +#else
    for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
    +#endif
    OMX_U32 newBufferCount =
    def.nBufferCountMin + minUndequeuedBufs + extraBuffers;
    def.nBufferCountActual = newBufferCount;
    --
    1.9.1


    From c2dae735b6dbbbc1fbb15b37de04c0c3677de921 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Dec 2014 19:09:59 +0700
    Subject: [PATCH 8/9] stagefright: CAPRI_HWC: fix for screen recording

    Change-Id: Ib8a677eb1ecabc30efe163faa9b209f4db966437
    ---
    media/libstagefright/omx/GraphicBufferSource.cpp | 2 ++
    media/libstagefright/omx/OMXNodeInstance.cpp | 7 +++++++
    2 files changed, 9 insertions(+)

    diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp
    index 44c7edc..b108077 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));
    +#ifndef CAPRI_HWC
    if (buffer != codecBuffer.mGraphicBuffer.get()) {
    // should never happen
    ALOGE("codecBufferEmptied: buffer is %p, expected %p",
    buffer, codecBuffer.mGraphicBuffer.get());
    CHECK(!"codecBufferEmptied: mismatched buffer");
    }
    +#endif
    }
    }

    diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
    index e3a1bd3..07bf1b2 100644
    --- a/media/libstagefright/omx/OMXNodeInstance.cpp
    +++ b/media/libstagefright/omx/OMXNodeInstance.cpp
    @@ -822,10 +822,17 @@ status_t OMXNodeInstance::createInputSurface(
    }

    if (def.format.video.eColorFormat != OMX_COLOR_FormatAndroidOpaque) {
    +#ifdef CAPRI_HWC
    + // VC Encoder change OMX_COLOR_FormatAndroidOpaque to 0x7F000005
    + if (def.format.video.eColorFormat != 0x7F000005) {
    +#endif
    CLOGW("createInputSurface requires COLOR_FormatSurface "
    "(AndroidOpaque) color format instead of %s(%#x)",
    asString(def.format.video.eColorFormat), def.format.video.eColorFormat);
    return INVALID_OPERATION;
    +#ifdef CAPRI_HWC
    + }
    +#endif
    }

    GraphicBufferSource* bufferSource = new GraphicBufferSource(
    --
    1.9.1


    From 0e703a45613a62de8fc9b401fa4fb3ac4c1eecb6 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 15:25:33 +0700
    Subject: [PATCH 9/9] stagefright: CAPRI_HWC: fix for miracast

    Our encoder does not support OMX_Video_ControlRateConstant

    Change-Id: I5f98f00406a6b28c1a2a1862fbcefa2fdd9055d6
    ---
    media/libstagefright/ACodec.cpp | 18 ++++++++++++------
    1 file changed, 12 insertions(+), 6 deletions(-)

    diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
    index 8b740d6..c570d9c 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) {
    return ret;
    }

    -static OMX_VIDEO_CONTROLRATETYPE getBitrateMode(const sp<AMessage> &msg) {
    +static OMX_VIDEO_CONTROLRATETYPE getBitrateMode(const sp<AMessage> &msg, const AString &name) {
    +#ifdef CAPRI_HWC
    + // vc4 encoder only supports VBR
    + if (strncmp(name.c_str(), "OMX.BRCM.vc4.encoder.", 21) == 0) {
    + return OMX_Video_ControlRateVariable;
    + }
    +#endif
    int32_t tmp;
    if (!msg->findInt32("bitrate-mode", &tmp)) {
    return OMX_Video_ControlRateVariable;
    @@ -2909,7 +2915,7 @@ status_t ACodec::setupMPEG4EncoderParameters(const sp<AMessage> &msg) {
    return INVALID_OPERATION;
    }

    - OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg);
    + OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg, mComponentName);

    float frameRate;
    if (!msg->findFloat("frame-rate", &frameRate)) {
    @@ -2991,7 +2997,7 @@ status_t ACodec::setupH263EncoderParameters(const sp<AMessage> &msg) {
    return INVALID_OPERATION;
    }

    - OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg);
    + OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg, mComponentName);

    float frameRate;
    if (!msg->findFloat("frame-rate", &frameRate)) {
    @@ -3119,7 +3125,7 @@ status_t ACodec::setupAVCEncoderParameters(const sp<AMessage> &msg) {
    return INVALID_OPERATION;
    }

    - OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg);
    + OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg, mComponentName);

    float frameRate;
    if (!msg->findFloat("frame-rate", &frameRate)) {
    @@ -3234,7 +3240,7 @@ status_t ACodec::setupHEVCEncoderParameters(const sp<AMessage> &msg) {
    return INVALID_OPERATION;
    }

    - OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg);
    + OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg, mComponentName);

    float frameRate;
    if (!msg->findFloat("frame-rate", &frameRate)) {
    @@ -3301,7 +3307,7 @@ status_t ACodec::setupVPXEncoderParameters(const sp<AMessage> &msg) {
    }
    msg->findInt32("i-frame-interval", &iFrameInterval);

    - OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg);
    + OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg, mComponentName);

    float frameRate;
    if (!msg->findFloat("frame-rate", &frameRate)) {
    --
    1.9.1

    217 changes: 217 additions & 0 deletions frameworks_base.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,217 @@
    From f5c50ac90ebde285d72ee2fb8ce80eb5290a3b4d Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    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

    Change-Id: I475fdd164b3316720387fefb14a3e12fbc262b39
    ---
    .../java/android/telephony/TelephonyManager.java | 63 +++++++---------------
    1 file changed, 19 insertions(+), 44 deletions(-)

    diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
    index dfea650..1f7f015 100644
    --- a/telephony/java/android/telephony/TelephonyManager.java
    +++ b/telephony/java/android/telephony/TelephonyManager.java
    @@ -3020,49 +3020,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);
    }

    /**
    @@ -3159,17 +3129,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;
    + }
    +
    + if (phoneId > 0) {
    + property += "_" + phoneId;
    }
    +
    + String propVal = SystemProperties.get(property);
    +
    Rlog.d(TAG, "getTelephonyProperty: return propVal='" + propVal + "' phoneId=" + phoneId
    - + " property='" + property + "' defaultVal='" + defaultVal + "' prop=" + prop);
    - return propVal == null ? defaultVal : propVal;
    + + " property='" + property + "' defaultVal='" + defaultVal);
    +
    + return propVal.isEmpty() ? defaultVal : propVal;
    }

    /**
    --
    1.9.1


    From cecfcff89d52c6a27d6a9ec609fdf0ee391890cc Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 22:33:16 +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.

    Also change ENODEV to MAX_CAMERAS_IN_USE to please the CTS

    Change-Id: I929feffa4f79c69e9d7be7d1acacb3c228280bfe
    ---
    core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java | 2 +-
    core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java | 2 +-
    core/java/android/hardware/camera2/utils/CameraBinderDecorator.java | 2 +-
    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
    --- 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 {
    return CONTROL_AE_ANTIBANDING_MODE_OFF;
    }
    case Camera.Parameters.ANTIBANDING_50HZ: {
    - return CONTROL_AE_ANTIBANDING_MODE_50HZ;
    + return /* CONTROL_AE_ANTIBANDING_MODE_50HZ */ CONTROL_AE_ANTIBANDING_MODE_AUTO;
    }
    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
    --- 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 {
    return Parameters.ANTIBANDING_60HZ;
    }
    case CONTROL_AE_ANTIBANDING_MODE_AUTO: {
    - return Parameters.ANTIBANDING_AUTO;
    + return Parameters.ANTIBANDING_50HZ /* Parameters.ANTIBANDING_AUTO */;
    }
    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
    --- 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 {
    case EUSERS:
    throw new CameraRuntimeException(MAX_CAMERAS_IN_USE);
    case ENODEV:
    - throw new CameraRuntimeException(CAMERA_DISCONNECTED);
    + throw new CameraRuntimeException(/*CAMERA_DISCONNECTED*/ MAX_CAMERAS_IN_USE);
    case EOPNOTSUPP:
    throw new CameraRuntimeException(CAMERA_DEPRECATED_HAL);
    case INVALID_OPERATION:
    --
    1.9.1


    From 516f9356aed2712605a3b0f26837be941e9837c5 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 21 Dec 2014 16:23:31 +0700
    Subject: [PATCH 3/3] PowerManagerService: only turn on button light when any
    button is pressed

    This more closely emulates stock Samsung behavior

    Change-Id: I6b15c45b713bcbc290a1026805c46109060f9990
    ---
    .../core/java/com/android/server/power/PowerManagerService.java | 8 +++++++-
    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 cd5baa8..5002726 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
    // Timestamp of the last call to user activity.
    private long mLastUserActivityTime;
    private long mLastUserActivityTimeNoChangeLights;
    + private long mLastButtonActivityTime;

    // Timestamp of last interactive power hint.
    private long mLastInteractivePowerHintTime;
    @@ -1145,6 +1146,11 @@ public final class PowerManagerService extends SystemService
    return true;
    }
    } else {
    + if (eventTime > mLastButtonActivityTime && (event & PowerManager.USER_ACTIVITY_EVENT_BUTTON) != 0) {
    + mLastButtonActivityTime = eventTime;
    + mDirty |= DIRTY_USER_ACTIVITY;
    + }
    +
    if (eventTime > mLastUserActivityTime) {
    mLastUserActivityTime = eventTime;
    mDirty |= DIRTY_USER_ACTIVITY;
    @@ -1644,7 +1650,7 @@ public final class PowerManagerService extends SystemService
    }

    mKeyboardLight.setBrightness(mKeyboardVisible ? keyboardBrightness : 0);
    - if (mButtonTimeout != 0 && now > mLastUserActivityTime + mButtonTimeout) {
    + if (mButtonTimeout != 0 && now > mLastButtonActivityTime + mButtonTimeout) {
    mButtonsLight.setBrightness(0);
    } else {
    mButtonsLight.setBrightness(buttonBrightness);
    --
    1.9.1

    166 changes: 166 additions & 0 deletions frameworks_native.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,166 @@
    From 06a95c91816d81f89c7b939678f5a43e10b94b0e Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Thu, 14 Nov 2013 15:19:46 +0700
    Subject: [PATCH 1/5] binder: add compat symbol

    Required for older Samsung libtvout

    Change-Id: Ib18d2513570382432d49f302ab041230650372f2
    ---
    libs/binder/IPCThreadState.cpp | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
    index dd04dcf..9ec2380 100644
    --- a/libs/binder/IPCThreadState.cpp
    +++ b/libs/binder/IPCThreadState.cpp
    @@ -361,6 +361,10 @@ status_t IPCThreadState::clearLastError()
    return err;
    }

    +extern "C" int _ZN7android14IPCThreadState13getCallingPidEv(IPCThreadState *state) {
    + return state->getCallingPid();
    +}
    +
    int IPCThreadState::getCallingPid() const
    {
    return mCallingPid;
    --
    1.9.1


    From 618836db92ebb800d870c190ce90795496c6be5e Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:38:17 +0700
    Subject: [PATCH 2/5] binder: add compat symbols

    Required for libtvservice_binder.so on I9082

    Change-Id: I059e92f19e4c5a911d38faa9c4df549c75c90761
    ---
    libs/binder/Parcel.cpp | 12 ++++++++++++
    1 file changed, 12 insertions(+)

    diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
    index e7589b1..b34ceb9 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;
    }

    +extern "C" status_t _ZN7android6Parcel5writeERKNS0_26FlattenableHelperInterfaceE(void *parcel, void *val);
    +
    +extern "C" status_t _ZN7android6Parcel5writeERKNS_11FlattenableE(void *parcel, void *val) {
    + return _ZN7android6Parcel5writeERKNS0_26FlattenableHelperInterfaceE(parcel, val);
    +}
    +
    status_t Parcel::write(const FlattenableHelperInterface& val)
    {
    status_t err;
    @@ -1285,6 +1291,12 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
    return NO_ERROR;
    }

    +extern "C" status_t _ZNK7android6Parcel4readERNS0_26FlattenableHelperInterfaceE(void *parcel, void *val);
    +
    +extern "C" status_t _ZNK7android6Parcel4readERNS_11FlattenableE(void *parcel, void *val) {
    + return _ZNK7android6Parcel4readERNS0_26FlattenableHelperInterfaceE(parcel, val);
    +}
    +
    status_t Parcel::read(FlattenableHelperInterface& val) const
    {
    // size
    --
    1.9.1


    From 0325983656a05e1817ed12df3446cb851619375c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Mon, 16 Dec 2013 15:45:42 +0700
    Subject: [PATCH 3/5] 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
    --- a/services/surfaceflinger/SurfaceFlinger.cpp
    +++ b/services/surfaceflinger/SurfaceFlinger.cpp
    @@ -3749,6 +3749,11 @@ status_t SurfaceFlinger::captureScreenImplLocked(
    {
    ATRACE_CALL();

    +// Rotation artifact problems when useReadPixels is false
    +#ifdef CAPRI_HWC
    + useReadPixels = true;
    +#endif
    +
    // get screen geometry
    const uint32_t hw_w = hw->getWidth();
    const uint32_t hw_h = hw->getHeight();
    --
    1.9.1


    From 476c6ee94d64c2469efcdb45a2c022e710dac35b Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Mon, 15 Dec 2014 23:12:44 +0700
    Subject: [PATCH 4/5] SurfaceComposerClient: don't block RGBA_8888 for
    screenshot on CAPRI_HWC

    Works here and required for ColorFade animation

    Change-Id: Ie7d549bb63e11380d7efcab27b7e4d9f3eb2a1fe
    ---
    libs/gui/SurfaceComposerClient.cpp | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
    index b6025f2..9c59ba2 100644
    --- a/libs/gui/SurfaceComposerClient.cpp
    +++ b/libs/gui/SurfaceComposerClient.cpp
    @@ -838,7 +838,7 @@ status_t ScreenshotClient::capture(
    uint32_t minLayerZ, uint32_t maxLayerZ, bool useIdentityTransform) {
    sp<ISurfaceComposer> s(ComposerService::getComposerService());
    if (s == NULL) return NO_INIT;
    -#ifdef USE_MHEAP_SCREENSHOT
    +#if defined(SE_MHEAP_SCREENSHOT) && !defined(CAPRI_HWC)
    int format = 0;
    producer->query(NATIVE_WINDOW_FORMAT,&format);
    if (format == PIXEL_FORMAT_RGBA_8888) {
    --
    1.9.1


    From ff83dc2393d1fedc903b78aef1d6a56c990b086a Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 20 Dec 2014 19:09:27 +0700
    Subject: [PATCH 5/5] sf: CAPRI_HWC: fix for screen recording

    Change-Id: I6c7e59400eab86bc5ec0ffebbcc475fa0fa404d2
    ---
    libs/gui/BufferQueueProducer.cpp | 5 +++++
    1 file changed, 5 insertions(+)

    diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
    index 6f76019..ff6a570 100644
    --- a/libs/gui/BufferQueueProducer.cpp
    +++ b/libs/gui/BufferQueueProducer.cpp
    @@ -204,7 +204,12 @@ status_t BufferQueueProducer::waitForFreeSlotThenRelock(const char* caller,
    const int newUndequeuedCount =
    maxBufferCount - (dequeuedCount + 1);
    const int minUndequeuedCount =
    +#ifdef CAPRI_HWC
    + // HACK: for some reason, we need to reduce min undequeue for screen recording
    + mCore->getMinUndequeuedBufferCountLocked(false);
    +#else
    mCore->getMinUndequeuedBufferCountLocked(async);
    +#endif
    if (newUndequeuedCount < minUndequeuedCount) {
    BQ_LOGE("%s: min undequeued buffer count (%d) exceeded "
    "(dequeued=%d undequeued=%d)",
    --
    1.9.1

    96 changes: 96 additions & 0 deletions frameworks_opt_telephony.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,96 @@
    From 8773072f4d193e99eb2d13f15a152c3bfb4116dc Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 31 May 2014 12:34:56 +0700
    Subject: [PATCH 1/2] telephony: support for RIL that does not send
    UNSOL_CALL_RING

    Samsung Broadcom RIL does not send UNSOL_CALL_RING at all, so it
    needs to be faked or non loop (e.g. Digital Phone) ringtones
    won't work.

    Change-Id: Ib7373d32777f6c42ee488972a7aa63ae8e1cd09b
    ---
    .../com/android/internal/telephony/PhoneBase.java | 19 +++++++++++++++++++
    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 bfccd9f..a309abe 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 {
    boolean mDnsCheckDisabled;
    public DcTrackerBase mDcTracker;
    boolean mDoesRilSendMultipleCallRing;
    + boolean mDoesRilSendCallRing;
    int mCallRingContinueToken;
    int mCallRingDelay;
    public boolean mIsTheCurrentActivePhone = true;
    @@ -441,6 +442,11 @@ public abstract class PhoneBase extends Handler implements Phone {
    TelephonyProperties.PROPERTY_RIL_SENDS_MULTIPLE_CALL_RING, true);
    Rlog.d(LOG_TAG, "mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing);

    + // Some RIL do not even send a single RIL_UNSOL_CALL_RING
    + mDoesRilSendCallRing = SystemProperties.getBoolean(
    + "ro.telephony.call_ring", true);
    + Rlog.d(LOG_TAG, "mDoesRilSendCallRing=" + mDoesRilSendCallRing);
    +
    mCallRingDelay = SystemProperties.getInt(
    TelephonyProperties.PROPERTY_CALL_RING_DELAY, 3000);
    Rlog.d(LOG_TAG, "mCallRingDelay=" + mCallRingDelay);
    @@ -1902,6 +1908,18 @@ public abstract class PhoneBase extends Handler implements Phone {
    public void notifyNewRingingConnectionP(Connection cn) {
    if (!mIsVoiceCapable)
    return;
    +
    + // Fake RIL_UNSOL_CALL_RING if the RIL doesn't send it.
    + // Note that we need the delay to prevent the request from
    + // being sent after CallTracker detects "RINGING" state, but
    + // before the correct contact-specific ringtone is queried.
    + // Otherwise, the incorrect ringtone will be used
    + if (!mDoesRilSendCallRing) {
    + int token = ++mCallRingContinueToken;
    + sendMessageDelayed(
    + obtainMessage(EVENT_CALL_RING_CONTINUE, token, 0), mCallRingDelay);
    + }
    +
    AsyncResult ar = new AsyncResult(null, cn, null);
    mNewRingingConnectionRegistrants.notifyRegistrants(ar);
    }
    @@ -2334,6 +2352,7 @@ public abstract class PhoneBase extends Handler implements Phone {
    pw.println(" mDnsCheckDisabled=" + mDnsCheckDisabled);
    pw.println(" mDcTracker=" + mDcTracker);
    pw.println(" mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing);
    + pw.println(" mDoesRilSendCallRing=" + mDoesRilSendCallRing);
    pw.println(" mCallRingContinueToken=" + mCallRingContinueToken);
    pw.println(" mCallRingDelay=" + mCallRingDelay);
    pw.println(" mIsTheCurrentActivePhone=" + mIsTheCurrentActivePhone);
    --
    1.9.1


    From 2dfc805d86ff7ac311a535e8ca3c7620a64aaab8 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 15 Nov 2014 17:39:50 +0700
    Subject: [PATCH 2/2] 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 a012244..b1bda54 100644
    --- a/src/java/com/android/internal/telephony/RIL.java
    +++ b/src/java/com/android/internal/telephony/RIL.java
    @@ -301,7 +301,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;

    --
    1.9.1

    1 change: 0 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    Dummy
    43 changes: 43 additions & 0 deletions hardware_broadcom_libbt.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    From 7db8a8ad776221457e6313635e130395931df8a0 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 20:09:12 +0700
    Subject: [PATCH] libbt: switch to N_BRCM_HCI line disclipline for userial
    ioctl

    Change-Id: I12c297c6b26fc0cb6f0a36ed8f5d04d4d36a4092
    ---
    src/userial_vendor.c | 11 +++++++++++
    1 file changed, 11 insertions(+)

    diff --git a/src/userial_vendor.c b/src/userial_vendor.c
    index 949ec4b..be8cd0b 100644
    --- a/src/userial_vendor.c
    +++ b/src/userial_vendor.c
    @@ -196,6 +196,10 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg)
    uint16_t parity;
    uint8_t stop_bits;

    +#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
    + int ldisc;
    +#endif
    +
    vnd_userial.fd = -1;

    if (!userial_to_tcio_baud(p_cfg->baud, &baud))
    @@ -265,6 +269,13 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg)
    tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios);

    #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
    + // TODO: check for breakage on tuna (Galaxy Nexus). It defines this,
    + // but does not contain the kernel code to support it.
    +
    + // Switch to N_BRCM_HCI line disclipline for ioctl to work
    + ldisc = 25; // N_BRCM_HCI
    + ioctl(vnd_userial.fd, TIOCSETD, &ldisc);
    +
    userial_ioctl_init_bt_wake(vnd_userial.fd);
    #endif

    --
    1.9.1

    113 changes: 113 additions & 0 deletions packages_apps_Camera2.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,113 @@
    From 7b7c319b7171c16556c7a98033b1f53f3bc1de3f Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 23 Jan 2015 20:34:16 +0700
    Subject: [PATCH 1/2] Camera: i9082: disable preview after stopping camera

    This fixes a native crash from Broadcom's driver. However, there is
    an unwanted side effect of the preview going black while the
    'close application' animation is running.

    Change-Id: I231233d28a1f7ac914408a7d02100a9424c2bf1c
    ---
    src/com/android/camera/CameraActivity.java | 2 +-
    src/com/android/camera/PhotoModule.java | 1 +
    src/com/android/camera/VideoModule.java | 1 +
    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
    --- a/src/com/android/camera/CameraActivity.java
    +++ b/src/com/android/camera/CameraActivity.java
    @@ -1643,7 +1643,7 @@ public class CameraActivity extends QuickActivity
    mCurrentModule.onPreviewVisibilityChanged(visibility);
    }

    - private void updatePreviewRendering(int visibility) {
    + /* private */ void updatePreviewRendering(int visibility) {
    if (visibility == ModuleController.VISIBILITY_HIDDEN) {
    mCameraAppUI.pausePreviewRendering();
    } else {
    diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
    index b4b5ee7..52b8858 100644
    --- a/src/com/android/camera/PhotoModule.java
    +++ b/src/com/android/camera/PhotoModule.java
    @@ -1874,6 +1874,7 @@ public class PhotoModule
    mActivity.getCameraProvider().releaseCamera(mCameraDevice.getCameraId());
    mCameraDevice = null;
    setCameraState(PREVIEW_STOPPED);
    + mActivity.updatePreviewRendering(ModuleController.VISIBILITY_HIDDEN);
    mFocusManager.onCameraReleased();
    }
    }
    diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
    index a034a1c..f203c12 100644
    --- a/src/com/android/camera/VideoModule.java
    +++ b/src/com/android/camera/VideoModule.java
    @@ -1026,6 +1026,7 @@ public class VideoModule extends CameraModule
    }
    mCameraDevice.setZoomChangeListener(null);
    mActivity.getCameraProvider().releaseCamera(mCameraDevice.getCameraId());
    + mActivity.updatePreviewRendering(ModuleController.VISIBILITY_HIDDEN);
    mCameraDevice = null;
    mPreviewing = false;
    mSnapshotInProgress = false;
    --
    1.9.1


    From b40d76b7e8183bbfa88f68891638c686c680dee9 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sat, 24 Jan 2015 21:59:20 +0700
    Subject: [PATCH 2/2] Camera: i9082: update preview state after starting
    preview

    Fixes a regression in I231233d28a1f7ac914408a7d02100a9424c2bf1c
    where preview freezes after switching between front and back cams

    Change-Id: I036539aa602d738372f421499cf5ac8c646523ed
    ---
    src/com/android/camera/CameraActivity.java | 2 +-
    src/com/android/camera/PhotoModule.java | 1 +
    src/com/android/camera/VideoModule.java | 1 +
    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
    --- a/src/com/android/camera/CameraActivity.java
    +++ b/src/com/android/camera/CameraActivity.java
    @@ -1632,7 +1632,7 @@ public class CameraActivity extends QuickActivity
    * Call this whenever the mode drawer or filmstrip change the visibility
    * state.
    */
    - private void updatePreviewVisibility() {
    + /* package */ void updatePreviewVisibility() {
    if (mCurrentModule == null) {
    return;
    }
    diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
    index 52b8858..8e3f2e6 100644
    --- a/src/com/android/camera/PhotoModule.java
    +++ b/src/com/android/camera/PhotoModule.java
    @@ -1987,6 +1987,7 @@ public class PhotoModule
    mCameraDevice.startPreviewWithCallback(new Handler(Looper.getMainLooper()),
    startPreviewCallback);
    }
    + mActivity.updatePreviewVisibility();
    }

    @Override
    diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
    index f203c12..129f39a 100644
    --- a/src/com/android/camera/VideoModule.java
    +++ b/src/com/android/camera/VideoModule.java
    @@ -981,6 +981,7 @@ public class VideoModule extends CameraModule
    }
    });
    mPreviewing = true;
    + mActivity.updatePreviewVisibility();
    } catch (Throwable ex) {
    closeCamera();
    throw new RuntimeException("startPreview failed", ex);
    --
    1.9.1

    30 changes: 30 additions & 0 deletions packages_apps_Settings.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    From d5267dee49cc9663b94ff270b1a889262b5d3df0 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 16 Nov 2014 08:55:55 +0700
    Subject: [PATCH] Settings: i9082: disable manual provisioning

    Does not work here

    Change-Id: I1096b349ccf60b05aa261289b6bc7127beffaca5
    ---
    src/com/android/settings/sim/MultiSimEnablerPreference.java | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/src/com/android/settings/sim/MultiSimEnablerPreference.java b/src/com/android/settings/sim/MultiSimEnablerPreference.java
    index 523251d..77628e2 100644
    --- a/src/com/android/settings/sim/MultiSimEnablerPreference.java
    +++ b/src/com/android/settings/sim/MultiSimEnablerPreference.java
    @@ -215,7 +215,9 @@ public class MultiSimEnablerPreference extends SwitchPreference implements
    super.onBindView(view);

    mSwitch = (Switch) view.findViewById(com.android.internal.R.id.switchWidget);
    - mSwitch.setClickable(true);
    + // Disable manual provisioning
    + mSwitch.setClickable(false);
    + mSwitch.setVisibility(View.INVISIBLE);

    update();
    }
    --
    1.9.1

    132 changes: 132 additions & 0 deletions packages_apps_Trebuchet.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,132 @@
    From a9f99c67e236fe35ef6359527e4348f1261eab27 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:48 +0700
    Subject: [PATCH 1/2] Revert "DynamicGrid: tuning the icon size for some
    device"

    This reverts commit edbea0af1226978b06d7f877ae435797d31419af.
    ---
    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
    --- 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));
    deviceProfiles.add(new DeviceProfile("Nexus 4",
    - 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), 13, (hasAA ? 5 : 5),
    - (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));
    deviceProfiles.add(new DeviceProfile("Nexus 5",
    - 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), 13, (hasAA ? 5 : 5),
    - (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));
    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));
    // The tablet profile is odd in that the landscape orientation
    // also includes the nav bar on the side
    --
    1.9.1


    From 7d0e7a3639c58c967fe14c2f915610288fa5c9f8 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 1 Feb 2015 15:26:50 +0700
    Subject: [PATCH 2/2] Revert "Update Larger icons setting for better usability"

    This reverts commit 5c7529006f3ed78d934fed2861cebd3654695108.
    ---
    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
    --- a/src/com/android/launcher3/DynamicGrid.java
    +++ b/src/com/android/launcher3/DynamicGrid.java
    @@ -34,7 +34,7 @@ public class DynamicGrid {
    private float mMinHeight;

    // This is a static that we use for the default icon size on a 4/5-inch phone
    - static float DEFAULT_ICON_SIZE_DP = 66;
    + static float DEFAULT_ICON_SIZE_DP = 60;
    static float DEFAULT_ICON_SIZE_PX = 0;

    public static float dpiFromPx(int size, DisplayMetrics metrics){
    @@ -67,47 +67,47 @@ 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,
    + 255, 300, 2, 3, (useLargeIcons ? 54 : 48), 13, (hasAA ? 3 : 5),
    + (useLargeIcons ? 54 : 48), fourByFourDefaultLayout,
    R.xml.default_workspace_4x4_no_all_apps));
    deviceProfiles.add(new DeviceProfile("Shorter Stubby",
    - 255, 400, 3, 3, (useLargeIcons ? 58 : 46), 13, (hasAA ? 3 : 5),
    - (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));
    deviceProfiles.add(new DeviceProfile("Short Stubby",
    - 275, 420, 3, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5),
    - (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));
    deviceProfiles.add(new DeviceProfile("Stubby",
    - 255, 450, 3, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5),
    - (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));
    deviceProfiles.add(new DeviceProfile("Nexus S",
    - 296, 491.33f, 4, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5),
    - (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));
    deviceProfiles.add(new DeviceProfile("Nexus 4",
    - 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5),
    - (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));
    deviceProfiles.add(new DeviceProfile("Nexus 5",
    - 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5),
    - (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));
    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));
    // 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));
    // 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));
    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));
    mMinWidth = dpiFromPx(minWidthPx, dm);
    mMinHeight = dpiFromPx(minHeightPx, dm);
    --
    1.9.1

    368 changes: 368 additions & 0 deletions packages_services_Telecomm.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,368 @@
    From e611ca7dcabe0be837c401a304e97cc310d6f099 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 15 Mar 2015 08:33:32 +0700
    Subject: [PATCH 1/2] CallsManager: fix starting call from Contacts app with
    MSim

    The extras bundle may be Bundle.EMPTY, which immutable. Create our
    own copy to modify.

    Change-Id: If875eddc6afe9c5ca4b0d59a51902529cf115487
    ---
    src/com/android/server/telecom/CallsManager.java | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
    index 0934df7..1f84d61 100644
    --- a/src/com/android/server/telecom/CallsManager.java
    +++ b/src/com/android/server/telecom/CallsManager.java
    @@ -627,6 +627,8 @@ public final class CallsManager extends Call.ListenerBase {
    if (needsAccountSelection) {
    // This is the state where the user is expected to select an account
    call.setState(CallState.PRE_DIAL_WAIT);
    + // Create our own instance to modify (since extras may be Bundle.EMPTY)
    + extras = new Bundle(extras);
    extras.putParcelableList(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS, accounts);
    } else {
    call.setState(CallState.CONNECTING);
    --
    1.9.1


    From a4709db3091ec7dfdefe3dbe99635c607e84545e Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Sun, 5 Apr 2015 10:15:00 +0700
    Subject: [PATCH 2/2] Revert "Subscription selection when dialing USSD"

    This is already handled by AOSP in Dialer.

    This reverts commit 63605bb077cf87d0678197b42527f6c0a4eb6436.

    Conflicts:
    res/values/colors.xml
    res/values/strings.xml
    src/com/android/server/telecom/AccountSelection.java
    src/com/android/server/telecom/CallsManager.java

    Change-Id: Ib5d49a6b7685c3781fad122f2d1e612993ff9e6a
    ---
    AndroidManifest.xml | 3 -
    res/layout/account_list_item.xml | 54 --------
    res/values/cm_strings.xml | 1 -
    res/values/colors.xml | 1 -
    .../android/server/telecom/AccountSelection.java | 147 ---------------------
    src/com/android/server/telecom/CallsManager.java | 33 +----
    6 files changed, 1 insertion(+), 238 deletions(-)
    delete mode 100644 res/layout/account_list_item.xml
    delete mode 100644 src/com/android/server/telecom/AccountSelection.java

    diff --git a/AndroidManifest.xml b/AndroidManifest.xml
    index f382f30..511316b 100644
    --- a/AndroidManifest.xml
    +++ b/AndroidManifest.xml
    @@ -228,9 +228,6 @@
    <action android:name="android.bluetooth.IBluetoothHeadsetPhone" />
    </intent-filter>
    </service>
    - <activity android:name="AccountSelection"
    - android:theme="@style/Theme.Telecomm.Transparent"
    - android:excludeFromRecents="true"/>

    <service android:name=".TelecomService"
    android:singleUser="true"
    diff --git a/res/layout/account_list_item.xml b/res/layout/account_list_item.xml
    deleted file mode 100644
    index 86d3cb7..0000000
    --- a/res/layout/account_list_item.xml
    +++ /dev/null
    @@ -1,54 +0,0 @@
    -<?xml version="1.0" encoding="utf-8"?>
    -<!--
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    --->
    -
    -<LinearLayout
    - xmlns:android="http://schemas.android.com/apk/res/android"
    - android:orientation="horizontal"
    - android:layout_width="match_parent"
    - android:layout_height="wrap_content"
    - android:padding="4dp" >
    -
    - <ImageView android:id="@+id/icon"
    - android:layout_width="48dp"
    - android:layout_height="48dp"
    - android:tint="@color/dialtacts_secondary_text_color"
    - android:scaleType="center" />
    -
    - <TextView android:id="@+id/text"
    - android:textAppearance="?android:attr/textAppearanceMedium"
    - android:gravity="start|center_vertical"
    - android:layout_marginLeft="8dp"
    - android:layout_width="0dp"
    - android:layout_weight="1"
    - android:layout_height="match_parent" />
    -</LinearLayout>
    diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
    index 785e4ef..523175d 100644
    --- a/res/values/cm_strings.xml
    +++ b/res/values/cm_strings.xml
    @@ -34,5 +34,4 @@

    <!-- Message indicating video calls not allowed if user enabled TTY Mode -->
    <string name="video_call_not_allowed_if_tty_enabled">Please disable TTY mode to make video calls.</string>
    - <string name="select_account_dialog_title">Select account</string>
    </resources>
    diff --git a/res/values/colors.xml b/res/values/colors.xml
    index f9eb279..64db085 100644
    --- a/res/values/colors.xml
    +++ b/res/values/colors.xml
    @@ -16,7 +16,6 @@

    <resources>
    <color name="theme_color">#0288d1</color>
    - <color name="dialtacts_secondary_text_color">#737373</color>

    <color name="dialer_settings_actionbar_text_color">#ffffff</color>
    <color name="dialer_settings_actionbar_background_color">@color/theme_color</color>
    diff --git a/src/com/android/server/telecom/AccountSelection.java b/src/com/android/server/telecom/AccountSelection.java
    deleted file mode 100644
    index 537f4e4..0000000
    --- a/src/com/android/server/telecom/AccountSelection.java
    +++ /dev/null
    @@ -1,147 +0,0 @@
    -/*
    - * Copyright (c) 2014, The Linux Foundation. All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions are
    - * met:
    - * * Redistributions of source code must retain the above copyright
    - * notice, this list of conditions and the following disclaimer.
    - * * Redistributions in binary form must reproduce the above
    - * copyright notice, this list of conditions and the following
    - * disclaimer in the documentation and/or other materials provided
    - * with the distribution.
    - * * Neither the name of The Linux Foundation nor the names of its
    - * contributors may be used to endorse or promote products derived
    - * from this software without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
    - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
    - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - */
    -package com.android.server.telecom;
    -
    -import android.app.Activity;
    -import android.app.AlertDialog;
    -import android.content.Context;
    -import android.content.DialogInterface;
    -import android.content.DialogInterface.OnClickListener;
    -import android.content.DialogInterface.OnCancelListener;
    -import android.content.Intent;
    -import android.net.Uri;
    -import android.telecom.PhoneAccount;
    -import android.telecom.PhoneAccountHandle;
    -import android.view.KeyEvent;
    -import android.view.View;
    -import android.view.ViewGroup;
    -import android.view.Window;
    -import android.view.WindowManager;
    -import android.view.accessibility.AccessibilityEvent;
    -import android.widget.ArrayAdapter;
    -import android.widget.ListAdapter;
    -import android.widget.ImageView;
    -import android.widget.TextView;
    -
    -
    -import java.util.List;
    -import android.os.Bundle;
    -import android.telecom.TelecomManager;
    -import android.view.LayoutInflater;
    -
    -public class AccountSelection extends Activity {
    -
    - TelecomManager mTelecomManager;
    - List<PhoneAccountHandle> mAccountHandles;
    - Uri mHandle;
    - boolean mIsSelected = false;
    -
    - @Override
    - protected void onCreate(Bundle icicle) {
    - Log.d(this, "onCreate()... this = " + this);
    -
    - super.onCreate(icicle);
    - Intent intent = getIntent();
    - Bundle extras = intent.getExtras();
    - mHandle = Uri.parse(extras.getString("Handle"));
    - mAccountHandles = extras.getParcelableArrayList(android.telecom.
    - Call.AVAILABLE_PHONE_ACCOUNTS);
    - if (mAccountHandles == null ) {
    - finish();
    - return;
    - }
    - mTelecomManager = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
    - final DialogInterface.OnClickListener selectionListener =
    - new DialogInterface.OnClickListener() {
    - @Override
    - public void onClick(DialogInterface dialog, int which) {
    - mIsSelected = true;
    - CallsManager.getInstance().phoneAccountSelectedForMMI(mHandle,
    - mAccountHandles.get(which));
    - finish();
    - }
    - };
    - AlertDialog.Builder builder = new AlertDialog.Builder(AccountSelection.this);
    -
    - ListAdapter AccountListAdapter = new AccountListAdapter(
    - builder.getContext(),
    - R.layout.account_list_item,
    - mAccountHandles);
    -
    - builder.setTitle(R.string.select_account_dialog_title)
    - .setAdapter(AccountListAdapter, selectionListener)
    - .setOnCancelListener(new DialogInterface.OnCancelListener() {
    - @Override
    - public void onCancel(DialogInterface dialog) {
    - mIsSelected = false;
    - finish();
    - }
    - }).create().show();
    - }
    -
    - private class AccountListAdapter extends ArrayAdapter<PhoneAccountHandle> {
    - private Context mContext;
    - private int mResId;
    -
    - public AccountListAdapter(
    - Context context, int resource, List<PhoneAccountHandle> accountHandles) {
    - super(context, resource, accountHandles);
    - mContext = context;
    - mResId = resource;
    - }
    -
    - @Override
    - public View getView(int position, View convertView, ViewGroup parent) {
    - LayoutInflater inflater = (LayoutInflater)
    - mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    -
    - View rowView = inflater.inflate(mResId, null);
    - TextView textView = (TextView) rowView.findViewById(R.id.text);
    - ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
    -
    - PhoneAccountHandle accountHandle = getItem(position);
    - PhoneAccount account = mTelecomManager.getPhoneAccount(accountHandle);
    - textView.setText(account.getLabel());
    - imageView.setImageDrawable(account.createIconDrawable(mContext));
    - return rowView;
    - }
    -
    - }
    -
    -
    - @Override
    - protected void onDestroy() {
    - Log.d(this, "onDestroy()... this = " + mIsSelected);
    - if(!mIsSelected) {
    - CallsManager.getInstance().phoneAccountSelectedForMMI(mHandle, null);
    - }
    - super.onDestroy();
    - }
    -}
    diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
    index 1f84d61..7de9087 100644
    --- a/src/com/android/server/telecom/CallsManager.java
    +++ b/src/com/android/server/telecom/CallsManager.java
    @@ -637,16 +637,7 @@ public final class CallsManager extends Call.ListenerBase {
    call.setExtras(extras);

    // Do not add the call if it is a potential MMI code.
    - if (phoneAccountHandle == null && isPotentialMMICode(handle) &&
    - accounts.size() > 1) {
    - mCalls.add(call);
    - call.addListener(this);
    - extras.putString("Handle", handle.toString());
    - Intent intent = new Intent(mContext, AccountSelection.class);
    - intent.putExtras(extras);
    - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    - mContext.startActivity(intent);
    - } else if ((isPotentialMMICode(handle) || isPotentialInCallMMICode) && !needsAccountSelection) {
    + if ((isPotentialMMICode(handle) || isPotentialInCallMMICode) && !needsAccountSelection) {
    call.addListener(this);
    } else if (!mCalls.contains(call)) {
    // We check if mCalls already contains the call because we could potentially be reusing
    @@ -1018,16 +1009,6 @@ public final class CallsManager extends Call.ListenerBase {
    }
    }

    - void phoneAccountSelectedForMMI(Uri handle, PhoneAccountHandle account) {
    - Call call = getFirstCallWithHandle(handle, CallState.PRE_DIAL_WAIT);
    - Log.d(this,"call: "+ call);
    - if (account != null) {
    - phoneAccountSelected(call, account, false);
    - } else {
    - call.disconnect();
    - }
    - }
    -
    /** Called when the audio state changes. */
    void onAudioStateChanged(AudioState oldAudioState, AudioState newAudioState) {
    Log.v(this, "onAudioStateChanged, audioState: %s -> %s", oldAudioState, newAudioState);
    @@ -1267,18 +1248,6 @@ public final class CallsManager extends Call.ListenerBase {
    return getFirstCallWithState(null, states);
    }

    - Call getFirstCallWithHandle(Uri handle, int... states) {
    - for (int currentState : states) {
    - for (Call call : mCalls) {
    - if ((currentState == call.getState()) &&
    - call.getHandle().toString().equals(handle.toString())) {
    - return call;
    - }
    - }
    - }
    - return null;
    - }
    -
    /**
    * Returns the first call that it finds with the given states. The states are treated as having
    * priority order so that any call with the first state will be returned before any call with
    --
    1.9.1

    119 changes: 119 additions & 0 deletions packages_services_Telephony.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,119 @@
    From a49543b9dc4ce3bd49b505ef523c5594f67fe339 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 23 Dec 2014 22:27:09 +0700
    Subject: [PATCH 1/2] Telephony: HACK: fix 'up' for MSimCallFeature sub option

    Change-Id: I1fcd9309d2849fbdd0ac1c903cbda4a8b1f213f5
    ---
    src/com/android/phone/CallFeaturesSetting.java | 11 +++++++----
    1 file changed, 7 insertions(+), 4 deletions(-)

    diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
    index cbbfac9..5297abc 100644
    --- a/src/com/android/phone/CallFeaturesSetting.java
    +++ b/src/com/android/phone/CallFeaturesSetting.java
    @@ -2294,10 +2294,13 @@ public class CallFeaturesSetting extends PreferenceActivity
    * This is useful for implementing "HomeAsUp" capability for second-level Settings.
    */
    public static void goUpToTopLevelSetting(Activity activity) {
    - Intent intent = new Intent(activity, CallFeaturesSetting.class);
    - intent.setAction(Intent.ACTION_MAIN);
    - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    - activity.startActivity(intent);
    + // HACK: See MSimMobileNetworkSubSettings#onOptionsItemSelected
    + if (!PhoneUtils.isMultiSimEnabled()) {
    + Intent intent = new Intent(activity, CallFeaturesSetting.class);
    + intent.setAction(Intent.ACTION_MAIN);
    + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    + activity.startActivity(intent);
    + }
    activity.finish();
    }
    }
    --
    1.9.1


    From 7cd091321568a4b24b82ed4d55bb459f8e91ae03 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 20 Feb 2015 20:26:52 +0700
    Subject: [PATCH 2/2] Telephony: HACK: enable WCDMA only setting

    Samsung stock allows WCDMA only

    Change-Id: If552c6439f7b6910422ec5549e54e68da798c82e
    ---
    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
    --- a/res/values/strings.xml
    +++ b/res/values/strings.xml
    @@ -609,12 +609,14 @@
    </string-array>

    <string-array name="enabled_networks_except_lte_choices" translatable="false">
    - <item>@string/network_3G</item>
    - <item>@string/network_2G</item>
    + <item>@string/preferred_network_mode_wcdma_only_choice</item>
    + <item>@string/preferred_network_mode_gsm_only_choice</item>
    + <item>@string/preferred_network_mode_gsm_wcdma_preferred_choice</item>
    </string-array>
    <string-array name="enabled_networks_except_lte_values" translatable="false">
    - <item>"0"</item>
    + <item>"2"</item>
    <item>"1"</item>
    + <item>"0"</item>
    </string-array>

    <string-array name="enabled_networks_except_gsm_lte_choices" translatable="false">
    diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
    index 4103111..3bda06e 100644
    --- a/src/com/android/phone/MobileNetworkSettings.java
    +++ b/src/com/android/phone/MobileNetworkSettings.java
    @@ -523,6 +523,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:
    @@ -901,12 +902,22 @@ public class MobileNetworkSettings extends PreferenceActivity
    private void UpdateEnabledNetworksValueAndSummary(int NetworkMode) {
    switch (NetworkMode) {
    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:
    case Phone.NT_MODE_WCDMA_PREF:
    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));
    @@ -917,7 +928,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));
    --
    1.9.1

    37 changes: 37 additions & 0 deletions system_core.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    From 2856ce55dcc0e750b0c17c6749391ec2a237e01a Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Fri, 12 Apr 2013 11:40:15 +0700
    Subject: [PATCH] libnetutils: add ifc_set_mtu

    Change-Id: I3031e9ee38583648350f2c46baa7a9a714b9ea1e
    ---
    libnetutils/ifc_utils.c | 16 ++++++++++++++++
    1 file changed, 16 insertions(+)

    diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
    index d9c50ab..2394f9d 100644
    --- a/libnetutils/ifc_utils.c
    +++ b/libnetutils/ifc_utils.c
    @@ -704,3 +704,19 @@ ifc_configure(const char *ifname,

    return 0;
    }
    +
    +// Required for Broadcom RILD
    +int ifc_set_mtu(const char *name, int mtuSz)
    +{
    + struct ifreq ifr;
    + int ret;
    + ifc_init_ifr(name, &ifr);
    + ifr.ifr_mtu = mtuSz;
    +
    + ret = ioctl(ifc_ctl_sock, SIOCSIFMTU, &ifr);
    + if (ret < 0) {
    + printerr("ifc_set_mtu: SIOCSIFMTU failed: %d\n", ret);
    + }
    +
    + return ret;
    +}
    --
    1.9.1

  12. pawitp created this gist Apr 5, 2015.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Dummy