commit 017c525e4f1fcd81c2ec56d596ec801a1c4be43e Author: Andy CrossGate Yan Date: Wed Oct 23 09:02:48 2019 +0000 Initial commit for Android 10, syncing up to v201 diff --git a/patches/platform_bionic/0001-Implement-per-process-target-SDK-version-override.patch b/patches/platform_bionic/0001-Implement-per-process-target-SDK-version-override.patch new file mode 100644 index 0000000..1dba426 --- /dev/null +++ b/patches/platform_bionic/0001-Implement-per-process-target-SDK-version-override.patch @@ -0,0 +1,39 @@ +From efbdeeea6ac6ac7e6a33ba9034d0d26a2da2c92e Mon Sep 17 00:00:00 2001 +From: Danny Baumann +Date: Wed, 29 Aug 2018 11:21:52 +0200 +Subject: [PATCH 1/6] Implement per-process target SDK version override. + +Change-Id: I65bbdbe96541d8aacdd4de125cdb9c1435129413 + +This is only partial cherry-pick. Value won't be set via Android.bp +--- + linker/linker.cpp | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/linker/linker.cpp b/linker/linker.cpp +index b59df7302..ccdb131ca 100644 +--- a/linker/linker.cpp ++++ b/linker/linker.cpp +@@ -4217,7 +4217,18 @@ std::vector init_default_namespaces(const char* executable + // somain and ld_preloads are added to these namespaces after LD_PRELOAD libs are linked + } + +- set_application_target_sdk_version(config->target_sdk_version()); ++ uint32_t target_sdk = config->target_sdk_version(); ++#ifdef SDK_VERSION_OVERRIDES ++ for (const auto& entry : android::base::Split(SDK_VERSION_OVERRIDES, " ")) { ++ auto splitted = android::base::Split(entry, "="); ++ if (splitted.size() == 2 && splitted[0] == executable_path) { ++ target_sdk = static_cast(std::stoul(splitted[1])); ++ break; ++ } ++ } ++ DEBUG("Target SDK for %s = %d", executable_path, target_sdk); ++#endif ++ set_application_target_sdk_version(target_sdk); + + std::vector created_namespaces; + created_namespaces.reserve(namespaces.size()); +-- +2.17.1 + diff --git a/patches/platform_bionic/0002-Actually-restore-pre-P-mutex-behavior.patch b/patches/platform_bionic/0002-Actually-restore-pre-P-mutex-behavior.patch new file mode 100644 index 0000000..24b62df --- /dev/null +++ b/patches/platform_bionic/0002-Actually-restore-pre-P-mutex-behavior.patch @@ -0,0 +1,54 @@ +From 38b21e5ba3f2ee5c8a6473ed20e6fa1946bdd2e3 Mon Sep 17 00:00:00 2001 +From: Ethan Chen +Date: Tue, 25 Sep 2018 00:11:05 -0700 +Subject: [PATCH 2/6] Actually restore pre-P mutex behavior + +Apps built against versions < P may not actually expect the EBUSY return +code, and may crash or otherwise misbehave. Check for target SDK +versions earlier than P when performing the IsMutexDestroyed check so +any invocation of HandleUsingDestroyedMutex is bypassed and pre-P mutex +behavior is restored. + +See 9e989f12d1186231d97dac6d038db7955acebdf3 for the change that +introduced this new behavior. + +Change-Id: I45f8882c9527c63eed1ef5820a5004b8958d58ea +--- + libc/bionic/pthread_mutex.cpp | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp +index f92184e50..f006bb92d 100644 +--- a/libc/bionic/pthread_mutex.cpp ++++ b/libc/bionic/pthread_mutex.cpp +@@ -783,16 +783,23 @@ static int MutexLockWithTimeout(pthread_mutex_internal_t* mutex, bool use_realti + } // namespace NonPI + + static inline __always_inline bool IsMutexDestroyed(uint16_t mutex_state) { +- return mutex_state == 0xffff; ++ if (android_get_application_target_sdk_version() >= __ANDROID_API_P__) { ++ return mutex_state == 0xffff; ++ } ++ return false; + } + + // Inlining this function in pthread_mutex_lock() adds the cost of stack frame instructions on + // ARM64. So make it noinline. + static int __attribute__((noinline)) HandleUsingDestroyedMutex(pthread_mutex_t* mutex, + const char* function_name) { +- if (android_get_application_target_sdk_version() >= __ANDROID_API_P__) { +- __fortify_fatal("%s called on a destroyed mutex (%p)", function_name, mutex); +- } ++ __fortify_fatal("%s called on a destroyed mutex (%p)", function_name, mutex); ++ return EBUSY; ++} ++ ++static int __always_inline HandleUsingDestroyedMutex(pthread_mutex_t* mutex, ++ const char* function_name) { ++ __fortify_fatal("%s called on a destroyed mutex (%p)", function_name, mutex); + return EBUSY; + } + +-- +2.17.1 + diff --git a/patches/platform_bionic/0003-bionic-Use-legacy-pthread_mutex_init-behavior-on-pre.patch b/patches/platform_bionic/0003-bionic-Use-legacy-pthread_mutex_init-behavior-on-pre.patch new file mode 100644 index 0000000..75ff5ca --- /dev/null +++ b/patches/platform_bionic/0003-bionic-Use-legacy-pthread_mutex_init-behavior-on-pre.patch @@ -0,0 +1,33 @@ +From 45eed08a80644561adc9e103e7d58af691afeb86 Mon Sep 17 00:00:00 2001 +From: nx111 +Date: Wed, 3 Oct 2018 16:58:19 +0800 +Subject: [PATCH 3/6] bionic: Use legacy pthread_mutex_init() behavior on pre-P + API levels + +* Google's changes to pthread_mutex_init is breaking RIL + on certain Samsung devices like klte and hlte +* To resolve this, add a check for their new additions + to only apply the new behavior for P and higher APIs + +Change-Id: I41335c5c436fa28a66d044e6634466556dfd7f95 +--- + libc/bionic/pthread_mutex.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp +index f006bb92d..969feb43c 100644 +--- a/libc/bionic/pthread_mutex.cpp ++++ b/libc/bionic/pthread_mutex.cpp +@@ -527,7 +527,8 @@ int pthread_mutex_init(pthread_mutex_t* mutex_interface, const pthread_mutexattr + return EINVAL; + } + +- if (((*attr & MUTEXATTR_PROTOCOL_MASK) >> MUTEXATTR_PROTOCOL_SHIFT) == PTHREAD_PRIO_INHERIT) { ++ if (((*attr & MUTEXATTR_PROTOCOL_MASK) >> MUTEXATTR_PROTOCOL_SHIFT) == PTHREAD_PRIO_INHERIT ++ && bionic_get_application_target_sdk_version() >= __ANDROID_API_P__) { + #if !defined(__LP64__) + if (state & MUTEX_SHARED_MASK) { + return EINVAL; +-- +2.17.1 + diff --git a/patches/platform_bionic/0004-Read-SDK-version-override-from-property.patch b/patches/platform_bionic/0004-Read-SDK-version-override-from-property.patch new file mode 100644 index 0000000..edfdc89 --- /dev/null +++ b/patches/platform_bionic/0004-Read-SDK-version-override-from-property.patch @@ -0,0 +1,37 @@ +From e77d8ff8326def1d6b457bfd4c8b232dc58dd7cb Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 3 Jan 2019 17:50:03 +0100 +Subject: [PATCH 4/6] Read SDK version override from property + +Change-Id: I88ca5d0bde15ee4f2b2bd1255e98f9592973dbf9 +--- + linker/linker.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/linker/linker.cpp b/linker/linker.cpp +index ccdb131ca..f45a40b9d 100644 +--- a/linker/linker.cpp ++++ b/linker/linker.cpp +@@ -4218,7 +4218,9 @@ std::vector init_default_namespaces(const char* executable + } + + uint32_t target_sdk = config->target_sdk_version(); +-#ifdef SDK_VERSION_OVERRIDES ++ ++ std::string sdkVersionOverrides = android::base::GetProperty("persist.sys.phh.sdk_override", ""); ++ static const char *SDK_VERSION_OVERRIDES = sdkVersionOverrides.c_str(); + for (const auto& entry : android::base::Split(SDK_VERSION_OVERRIDES, " ")) { + auto splitted = android::base::Split(entry, "="); + if (splitted.size() == 2 && splitted[0] == executable_path) { +@@ -4227,7 +4229,7 @@ std::vector init_default_namespaces(const char* executable + } + } + DEBUG("Target SDK for %s = %d", executable_path, target_sdk); +-#endif ++ + set_application_target_sdk_version(target_sdk); + + std::vector created_namespaces; +-- +2.17.1 + diff --git a/patches/platform_bionic/0005-Use-vndk_lite-ld.config-only-on-same-version-vendor.patch b/patches/platform_bionic/0005-Use-vndk_lite-ld.config-only-on-same-version-vendor.patch new file mode 100644 index 0000000..6f51fe6 --- /dev/null +++ b/patches/platform_bionic/0005-Use-vndk_lite-ld.config-only-on-same-version-vendor.patch @@ -0,0 +1,36 @@ +From f32750cc994642f6ba792051f20c3f930f3007d2 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 12:54:23 +0200 +Subject: [PATCH 5/6] Use vndk_lite ld.config only on same-version vendor + +When running Q over P lite, there is currently absolutely no chance the +device boots, because it will be using Q vndk. +Thus using ld.config.28.txt when running Q over P lite gives a little more +chance for the device to boot, than when using vndk_lite ld.config. +Also, once this patch is applied, the required effort to boot +Q over P lite is exclusively in vndk, which is manageable. + +Change-Id: I55257cd7c738b1d20582e198e1d5621e1c87a03e +--- + linker/linker.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/linker/linker.cpp b/linker/linker.cpp +index f45a40b9d..9082fde53 100644 +--- a/linker/linker.cpp ++++ b/linker/linker.cpp +@@ -4069,7 +4069,10 @@ static std::string get_ld_config_file_apex_path(const char* executable_path) { + } + + static std::string get_ld_config_file_vndk_path() { +- if (android::base::GetBoolProperty("ro.vndk.lite", false)) { ++ bool same_version_system_vendor = false; ++ if(std::to_string(__ANDROID_API__) == Config::get_vndk_version_string('.')) ++ same_version_system_vendor = true; ++ if (android::base::GetBoolProperty("ro.vndk.lite", false) && same_version_system_vendor) { + return kLdConfigVndkLiteFilePath; + } + +-- +2.17.1 + diff --git a/patches/platform_bionic/0006-fixup-Actually-restore-pre-P-mutex-behavior.patch b/patches/platform_bionic/0006-fixup-Actually-restore-pre-P-mutex-behavior.patch new file mode 100644 index 0000000..b240ff1 --- /dev/null +++ b/patches/platform_bionic/0006-fixup-Actually-restore-pre-P-mutex-behavior.patch @@ -0,0 +1,38 @@ +From 13acd597e0dd22c5fa462007b20fe4f2398db297 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 13:00:55 +0200 +Subject: [PATCH 6/6] fixup! Actually restore pre-P mutex behavior + +--- + libc/bionic/pthread_mutex.cpp | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp +index 969feb43c..bd9fabdb6 100644 +--- a/libc/bionic/pthread_mutex.cpp ++++ b/libc/bionic/pthread_mutex.cpp +@@ -528,7 +528,7 @@ int pthread_mutex_init(pthread_mutex_t* mutex_interface, const pthread_mutexattr + } + + if (((*attr & MUTEXATTR_PROTOCOL_MASK) >> MUTEXATTR_PROTOCOL_SHIFT) == PTHREAD_PRIO_INHERIT +- && bionic_get_application_target_sdk_version() >= __ANDROID_API_P__) { ++ && android_get_application_target_sdk_version() >= __ANDROID_API_P__) { + #if !defined(__LP64__) + if (state & MUTEX_SHARED_MASK) { + return EINVAL; +@@ -798,12 +798,6 @@ static int __attribute__((noinline)) HandleUsingDestroyedMutex(pthread_mutex_t* + return EBUSY; + } + +-static int __always_inline HandleUsingDestroyedMutex(pthread_mutex_t* mutex, +- const char* function_name) { +- __fortify_fatal("%s called on a destroyed mutex (%p)", function_name, mutex); +- return EBUSY; +-} +- + int pthread_mutex_lock(pthread_mutex_t* mutex_interface) { + #if !defined(__LP64__) + // Some apps depend on being able to pass NULL as a mutex and get EINVAL +-- +2.17.1 + diff --git a/patches/platform_bootable_recovery/0001-Don-t-reboot-if-we-couldn-t-get-bootctrl.patch b/patches/platform_bootable_recovery/0001-Don-t-reboot-if-we-couldn-t-get-bootctrl.patch new file mode 100644 index 0000000..cab3146 --- /dev/null +++ b/patches/platform_bootable_recovery/0001-Don-t-reboot-if-we-couldn-t-get-bootctrl.patch @@ -0,0 +1,26 @@ +From 58a98bd24e41cdacdbd472aaed2ab994400fe68c Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 20:31:07 +0200 +Subject: [PATCH] Don't reboot if we couldn't get bootctrl + +Change-Id: Id1793660bd1c97ab369607f58a772ca3512ec1af +--- + update_verifier/update_verifier.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp +index d04c455d..27e9f616 100644 +--- a/update_verifier/update_verifier.cpp ++++ b/update_verifier/update_verifier.cpp +@@ -310,7 +310,7 @@ int update_verifier(int argc, char** argv) { + sp module = IBootControl::getService(); + if (module == nullptr) { + LOG(ERROR) << "Error getting bootctrl module."; +- return reboot_device(); ++ return 0; + } + + uint32_t current_slot = module->getCurrentSlot(); +-- +2.17.1 + diff --git a/patches/platform_build/0001-Whitelist-radio-HALs-needed-because-they-need-to-e-i.patch b/patches/platform_build/0001-Whitelist-radio-HALs-needed-because-they-need-to-e-i.patch new file mode 100644 index 0000000..83935dd --- /dev/null +++ b/patches/platform_build/0001-Whitelist-radio-HALs-needed-because-they-need-to-e-i.patch @@ -0,0 +1,25 @@ +From 5529a224373874a11d77fd31e25428cc10fbc1a4 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Fri, 6 Sep 2019 15:10:28 +0200 +Subject: [PATCH] Whitelist radio HALs (needed because they need to e in + framework because of weird jarjar issue) + +Change-Id: If1ccbedde92955bb86f4c6db6d68502784de1d8d +--- + core/tasks/check_boot_jars/package_whitelist.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/core/tasks/check_boot_jars/package_whitelist.txt b/core/tasks/check_boot_jars/package_whitelist.txt +index 7e2e56c4c..daa23ddbd 100644 +--- a/core/tasks/check_boot_jars/package_whitelist.txt ++++ b/core/tasks/check_boot_jars/package_whitelist.txt +@@ -247,3 +247,6 @@ org\.chromium\.arc\..* + # LineageOS + lineageos\.platform + org\.lineageos\.platform\.internal ++ ++vendor\.samsung\.hardware\.radio\.V1_2 ++vendor\.mediatek\.hardware\.radio\.V2_0 +-- +2.17.1 + diff --git a/patches/platform_build/0002-Add-BOARD_SYSTEMIMAGE_AS_SYSTEM-parameter-to-build-S.patch b/patches/platform_build/0002-Add-BOARD_SYSTEMIMAGE_AS_SYSTEM-parameter-to-build-S.patch new file mode 100644 index 0000000..54b981e --- /dev/null +++ b/patches/platform_build/0002-Add-BOARD_SYSTEMIMAGE_AS_SYSTEM-parameter-to-build-S.patch @@ -0,0 +1,49 @@ +From 1c3ecb1fd46c76111d44f600532068f307ccacbc Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sat, 14 Sep 2019 21:25:07 +0200 +Subject: [PATCH 2/2] Add BOARD_SYSTEMIMAGE_AS_SYSTEM parameter to build SaS + GSI + +Change-Id: I764f0ef4e3be9a338fbe93944445cedc29d2bb81 +--- + core/Makefile | 1 + + tools/releasetools/build_image.py | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/core/Makefile b/core/Makefile +index 4611fb388..9ab207c6d 100644 +--- a/core/Makefile ++++ b/core/Makefile +@@ -1345,6 +1345,7 @@ endif # PRODUCT_USE_DYNAMIC_PARTITIONS + # $(3): additional "key=value" pairs to append to the dictionary file. + define generate-image-prop-dictionary + $(if $(filter $(2),system),\ ++ $(if $(BOARD_SYSTEMIMAGE_AS_SYSTEM),$(hide) echo "system_as_system=$(BOARD_SYSTEMIMAGE_AS_SYSTEM)" >> $(1)) + $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1)) + $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1)) + $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) +diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py +index 4136ed432..96f7ddcb0 100755 +--- a/tools/releasetools/build_image.py ++++ b/tools/releasetools/build_image.py +@@ -157,6 +157,8 @@ def SetUpInDirAndFsConfig(origin_in, prop_dict): + + if prop_dict["mount_point"] != "system": + return origin_in, fs_config ++ if "system_as_system" in prop_dict: ++ return origin_in, fs_config + + if "first_pass" in prop_dict: + prop_dict["mount_point"] = "/" +@@ -564,6 +566,8 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): + if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"): + d["extfs_rsv_pct"] = "0" + copy_prop("system_reserved_size", "partition_reserved_size") ++ ++ copy_prop("system_as_system", "system_as_system") + elif mount_point == "system_other": + # We inherit the selinux policies of /system since we contain some of its + # files. +-- +2.17.1 + diff --git a/patches/platform_external_selinux/0001-Enable-multipl_decls-by-default.-This-is-needed-beca.patch b/patches/platform_external_selinux/0001-Enable-multipl_decls-by-default.-This-is-needed-beca.patch new file mode 100644 index 0000000..2756065 --- /dev/null +++ b/patches/platform_external_selinux/0001-Enable-multipl_decls-by-default.-This-is-needed-beca.patch @@ -0,0 +1,27 @@ +From 2357a8f50b6ec8e1ed4d863c4b18aaed8af6a3db Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Fri, 2 Mar 2018 22:49:55 +0100 +Subject: [PATCH 1/6] Enable multipl_decls by default. This is needed because + 8.0 init doesn't add -m + +Change-Id: I43dc661d519f7b8576d72a828d8cbd444592bf5e +--- + secilc/secilc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/secilc/secilc.c b/secilc/secilc.c +index ad6862ba..8799e99a 100644 +--- a/secilc/secilc.c ++++ b/secilc/secilc.c +@@ -90,7 +90,7 @@ int main(int argc, char *argv[]) + int target = SEPOL_TARGET_SELINUX; + int mls = -1; + int disable_dontaudit = 0; +- int multiple_decls = 0; ++ int multiple_decls = 1; + int disable_neverallow = 0; + int preserve_tunables = 0; + int handle_unknown = -1; +-- +2.17.1 + diff --git a/patches/platform_external_selinux/0002-Increase-default-log_level-to-get-actual-selinux-err.patch b/patches/platform_external_selinux/0002-Increase-default-log_level-to-get-actual-selinux-err.patch new file mode 100644 index 0000000..448a7e9 --- /dev/null +++ b/patches/platform_external_selinux/0002-Increase-default-log_level-to-get-actual-selinux-err.patch @@ -0,0 +1,26 @@ +From 04ac55163d403dba2d986cb41805663ea5fa465a Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 9 Apr 2018 00:19:49 +0200 +Subject: [PATCH 2/6] Increase default log_level to get actual selinux error in + kmsg + +--- + secilc/secilc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/secilc/secilc.c b/secilc/secilc.c +index 8799e99a..631b4b0a 100644 +--- a/secilc/secilc.c ++++ b/secilc/secilc.c +@@ -101,7 +101,7 @@ int main(int argc, char *argv[]) + int opt_index = 0; + char *fc_buf = NULL; + size_t fc_size; +- enum cil_log_level log_level = CIL_ERR; ++ enum cil_log_level log_level = CIL_WARN; + static struct option long_opts[] = { + {"help", no_argument, 0, 'h'}, + {"verbose", no_argument, 0, 'v'}, +-- +2.17.1 + diff --git a/patches/platform_external_selinux/0003-Kirin-Workaround-some-conflicting-Kirin-tether-SELin.patch b/patches/platform_external_selinux/0003-Kirin-Workaround-some-conflicting-Kirin-tether-SELin.patch new file mode 100644 index 0000000..71801d7 --- /dev/null +++ b/patches/platform_external_selinux/0003-Kirin-Workaround-some-conflicting-Kirin-tether-SELin.patch @@ -0,0 +1,40 @@ +From 0883dddcc377f9c8c271b4ee1b5796cca6b9938c Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 3 Dec 2018 20:54:54 +0100 +Subject: [PATCH 3/6] ::Kirin:: Workaround some conflicting Kirin tether + SELinux context + +Some Kirin devices declared some android.hardware.tetheroffload HALs, +but they didn't use AOSP contexts. +This leads to libselinux aborting when loading hwservice_contexts. + +Workaround it the ugly way, by making them match. +This most likely kills tetheroffload for those devices. +--- + libselinux/src/label_backends_android.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c +index eaca5947..ab92985b 100644 +--- a/libselinux/src/label_backends_android.c ++++ b/libselinux/src/label_backends_android.c +@@ -62,6 +62,16 @@ static int nodups_specs(struct saved_data *data) + curr_spec->property_key)) { + if (strcmp(spec_arr[jj].lr.ctx_raw, + curr_spec->lr.ctx_raw)) { ++ if(strcmp(spec_arr[jj].lr.ctx_raw, "u:object_r:hal_ipacm_hwservice:s0") == 0) { ++ free(spec_arr[jj].lr.ctx_raw); ++ spec_arr[jj].lr.ctx_raw = strdup("u:object_r:hal_tetheroffload_hwservice:s0"); ++ continue; ++ } ++ if(strcmp(curr_spec->lr.ctx_raw, "u:object_r:hal_ipacm_hwservice:s0") == 0) { ++ free(curr_spec->lr.ctx_raw); ++ curr_spec->lr.ctx_raw = strdup("u:object_r:hal_tetheroffload_hwservice:s0"); ++ continue; ++ } + rc = -1; + errno = EINVAL; + selinux_log +-- +2.17.1 + diff --git a/patches/platform_external_selinux/0004-Allow-devices-virtual-block-genfscon-conflict-seen-o.patch b/patches/platform_external_selinux/0004-Allow-devices-virtual-block-genfscon-conflict-seen-o.patch new file mode 100644 index 0000000..7fd76a9 --- /dev/null +++ b/patches/platform_external_selinux/0004-Allow-devices-virtual-block-genfscon-conflict-seen-o.patch @@ -0,0 +1,43 @@ +From fac785e80fa91a71c29c95817110154e4c60464d Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Fri, 6 Sep 2019 15:07:25 +0200 +Subject: [PATCH 4/6] Allow /devices/virtual/block/ genfscon conflict (seen on + Xiaomi Mi 9) + +Change-Id: I06e4e9d5b82d61a8aeab595b47e2589249675895 +--- + libsepol/cil/src/cil_post.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c +index 0b09cecc..255c9e12 100644 +--- a/libsepol/cil/src/cil_post.c ++++ b/libsepol/cil/src/cil_post.c +@@ -477,7 +477,23 @@ int cil_post_genfscon_context_compare(const void *a, const void *b) + { + struct cil_genfscon *a_genfscon = *(struct cil_genfscon**)a; + struct cil_genfscon *b_genfscon = *(struct cil_genfscon**)b; +- return context_compare(a_genfscon->context, b_genfscon->context); ++ int rc = context_compare(a_genfscon->context, b_genfscon->context); ++ if(rc) { ++ fprintf(stderr, "hello %s\n", a_genfscon->fs_str); ++ int bypass = 0; ++ /* ++ * This conflict has been seen on Xiaomi Mi 9: ++ * - AOSP Q says (genfscon sysfs /devices/virtual/block/ (u object_r sysfs_devices_block ((s0) (s0)))) ++ * - stock rom says (genfscon sysfs /devices/virtual/block/ (u object_r sysfs_ufs_target ((s0) (s0)))) ++ */ ++ if(strcmp(a_genfscon->path_str, "/devices/virtual/block/") == 0) ++ bypass = 1; ++ if(bypass == 1) { ++ fprintf(stderr, "Received conflicting %s vs %s but ignore\n", a_genfscon->path_str, b_genfscon->path_str); ++ return 0; ++ } ++ } ++ return rc; + } + + int cil_post_netifcon_context_compare(const void *a, const void *b) +-- +2.17.1 + diff --git a/patches/platform_external_selinux/0005-Most-horrific-Remove-ramdisk-s-zygote-init-scripts.patch b/patches/platform_external_selinux/0005-Most-horrific-Remove-ramdisk-s-zygote-init-scripts.patch new file mode 100644 index 0000000..514bc55 --- /dev/null +++ b/patches/platform_external_selinux/0005-Most-horrific-Remove-ramdisk-s-zygote-init-scripts.patch @@ -0,0 +1,44 @@ +From c741063fdd7cbb01dda51737db457e4043af0d04 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 20:34:28 +0200 +Subject: [PATCH 5/6] Most horrific: Remove ramdisk's zygote init scripts + +This is needed because: +- only secilc is run soon enough in /system to +remove it +- placing an init.zygote in system won't have init replace it, it's the +first that appears that wins + +Change-Id: I8be31ceb9ef2124d04994d9fb08fc8012a2f819e +--- + secilc/secilc.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/secilc/secilc.c b/secilc/secilc.c +index 631b4b0a..3dd6e7ce 100644 +--- a/secilc/secilc.c ++++ b/secilc/secilc.c +@@ -34,6 +34,8 @@ + #include + #include + ++#include ++ + #ifdef ANDROID + #include + #else +@@ -121,6 +123,11 @@ int main(int argc, char *argv[]) + }; + int i; + ++ unlink("/init.zygote32.rc"); ++ unlink("/init.zygote64_32.rc"); ++ unlink("/init.zygote64.rc"); ++ unlink("/init.zygote32_64.rc"); ++ + while (1) { + opt_char = getopt_long(argc, argv, "o:f:U:hvt:M:PDmNc:GX:", long_opts, &opt_index); + if (opt_char == -1) { +-- +2.17.1 + diff --git a/patches/platform_external_selinux/0006-if-service-is-rcs-accept-conflict.-Seen-on-Moto-E5.patch b/patches/platform_external_selinux/0006-if-service-is-rcs-accept-conflict.-Seen-on-Moto-E5.patch new file mode 100644 index 0000000..7588803 --- /dev/null +++ b/patches/platform_external_selinux/0006-if-service-is-rcs-accept-conflict.-Seen-on-Moto-E5.patch @@ -0,0 +1,44 @@ +From 80f7a20f831e6d2028678899c39fe779024433f1 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 20:37:04 +0200 +Subject: [PATCH 6/6] if service is "rcs", accept conflict. Seen on Moto E5 + +Change-Id: I0cc2d0fad83f403f2b5d7458039b1564ce5ed9dd +--- + libselinux/src/label_backends_android.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c +index ab92985b..ca16327c 100644 +--- a/libselinux/src/label_backends_android.c ++++ b/libselinux/src/label_backends_android.c +@@ -72,14 +72,24 @@ static int nodups_specs(struct saved_data *data) + curr_spec->lr.ctx_raw = strdup("u:object_r:hal_tetheroffload_hwservice:s0"); + continue; + } +- rc = -1; +- errno = EINVAL; + selinux_log + (SELINUX_ERROR, + "Multiple different specifications for %s (%s and %s).\n", + curr_spec->property_key, + spec_arr[jj].lr.ctx_raw, + curr_spec->lr.ctx_raw); ++ int ignore = 0; ++ /* ++ * This issue has been found on Moto E5 ++ * E SELinux : Multiple different specifications for rcs (u:object_r:radio_service:s0 and u:object_r:mot_rcs_service:s0). ++ */ ++ if(!strcmp(curr_spec->property_key, "rcs")) ++ ignore = 1; ++ ++ if(!ignore) { ++ rc = -1; ++ errno = EINVAL; ++ } + } else { + selinux_log + (SELINUX_WARNING, +-- +2.17.1 + diff --git a/patches/platform_external_skia/0001-GrGLCaps-allow-ignoring-vendor-supplied-texture-swiz.patch b/patches/platform_external_skia/0001-GrGLCaps-allow-ignoring-vendor-supplied-texture-swiz.patch new file mode 100644 index 0000000..3aa5bb4 --- /dev/null +++ b/patches/platform_external_skia/0001-GrGLCaps-allow-ignoring-vendor-supplied-texture-swiz.patch @@ -0,0 +1,59 @@ +From ba695ca22d256bb8a27f699c0759162a48999cf7 Mon Sep 17 00:00:00 2001 +From: Peter Cai +Date: Tue, 22 Oct 2019 20:54:25 +0800 +Subject: [PATCH] GrGLCaps: allow ignoring vendor-supplied texture swizzle flag + +* This is broken on MTK 8.1 vendor + +Change-Id: I1ccae06f643f01e4ea6539e1d4e3c7df8d6e30ae +--- + Android.bp | 1 + + src/gpu/gl/GrGLCaps.h | 11 +++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/Android.bp b/Android.bp +index 3d2ab6d370..099cd6ba0b 100644 +--- a/Android.bp ++++ b/Android.bp +@@ -3,6 +3,7 @@ + cc_library_static { + name: "libskia", + host_supported: true, ++ shared_libs: [ "libbase" ], + cflags: [ + "-U_FORTIFY_SOURCE", + "-DATRACE_TAG=ATRACE_TAG_VIEW", +diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h +index 4a97e84cf8..aee7a5509e 100644 +--- a/src/gpu/gl/GrGLCaps.h ++++ b/src/gpu/gl/GrGLCaps.h +@@ -17,6 +17,11 @@ + #include "SkTHash.h" + #include "SkTArray.h" + ++#if defined(SK_BUILD_FOR_ANDROID) ++#include "android-base/properties.h" ++using android::base::GetBoolProperty; ++#endif ++ + class GrGLContextInfo; + class GrGLRenderTarget; + +@@ -330,8 +335,14 @@ public: + /// Are textures with GL_TEXTURE_RECTANGLE type supported. + bool rectangleTextureSupport() const { return fRectangleTextureSupport; } + ++#if !defined(SK_BUILD_FOR_ANDROID) + /// GL_ARB_texture_swizzle + bool textureSwizzleSupport() const { return fTextureSwizzleSupport; } ++#else ++ bool textureSwizzleSupport() const { ++ return !GetBoolProperty("ro.skia.ignore_swizzle", false) && fTextureSwizzleSupport; ++ } ++#endif + + bool mipMapLevelAndLodControlSupport() const { return fMipMapLevelAndLodControlSupport; } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0001-FIH-devices-Fix-Earpiece-audio-output.patch b/patches/platform_frameworks_av/0001-FIH-devices-Fix-Earpiece-audio-output.patch new file mode 100644 index 0000000..2daaaa3 --- /dev/null +++ b/patches/platform_frameworks_av/0001-FIH-devices-Fix-Earpiece-audio-output.patch @@ -0,0 +1,81 @@ +From 5286da2b7f598de0566d1ad1a5e070bdb5d698d1 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 24 Apr 2018 00:14:28 +0200 +Subject: [PATCH 01/11] FIH devices: Fix "Earpiece" audio output + +On some FIH devices (confirmed on Razer, and probably on Aquos SS2), +Earpiece is not listed in attachedDevices, and devicePort's profile +mentions it is AUDIO_CHANNEL_IN_MONO, instead of AUDIO_CHANNEL_OUT_MONO. + +Detect such cases (output device, but got only AUDIO_CHANNEL_IN_MONO), +and fix both channelMasks and attachedDevices + +Change-Id: I4a88ba6d34d0fcd346eeea2ca903772f0271040a +--- + .../managerdefinitions/src/Serializer.cpp | 27 ++++++++++++++++--- + 1 file changed, 24 insertions(+), 3 deletions(-) + +diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +index 5f820c214..0b561320b 100644 +--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp ++++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +@@ -395,14 +395,22 @@ Return AudioGainTraits::deserialize(const xmlNode *cur + } + + Return AudioProfileTraits::deserialize(const xmlNode *cur, +- PtrSerializingCtx /*serializingContext*/) ++ PtrSerializingCtx serializingContext) + { ++ bool isOutput = serializingContext != nullptr; + std::string samplingRates = getXmlAttribute(cur, Attributes::samplingRates); + std::string format = getXmlAttribute(cur, Attributes::format); + std::string channels = getXmlAttribute(cur, Attributes::channelMasks); ++ ChannelTraits::Collection channelsMask = channelMasksFromString(channels, ","); ++ ++ //Some Foxconn devices have wrong earpiece channel mask, leading to no channel mask ++ if(channelsMask.size() == 1 && channelsMask[0] == AUDIO_CHANNEL_IN_MONO && isOutput) { ++ fixedEarpieceChannels = true; ++ channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ","); ++ } + + Element profile = new AudioProfile(formatFromString(format, gDynamicFormat), +- channelMasksFromString(channels, ","), ++ channelsMask, + samplingRatesFromString(samplingRates, ",")); + + profile->setDynamicFormat(profile->getFormat() == gDynamicFormat); +@@ -517,10 +525,15 @@ Return DevicePortTraits::deserialize(const xmlNode *c + } + + AudioProfileTraits::Collection profiles; +- status_t status = deserializeCollection(cur, &profiles, NULL); ++ status_t status; ++ if(audio_is_output_devices(type)) ++ status = deserializeCollection(doc, root, profiles, (PtrSerializingCtx)1); ++ else ++ status = deserializeCollection(cur, &profiles, NULL); + if (status != NO_ERROR) { + return Status::fromStatusT(status); + } ++ + if (profiles.isEmpty()) { + profiles.add(AudioProfile::createFullDynamic()); + } +@@ -672,6 +685,14 @@ Return ModuleTraits::deserialize(const xmlNode *cur, PtrS + } + } + } ++ ++ if(fixedEarpieceChannels) { ++ sp device = ++ module->getDeclaredDevices().getDeviceFromTagName(String8("Earpiece")); ++ if(device != 0) ++ ctx->addAvailableDevice(device); ++ fixedEarpieceChannels = false; ++ } + return module; + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0002-Fix-WiFi-Display-on-Huawei-devices-EMUI-8.0.patch b/patches/platform_frameworks_av/0002-Fix-WiFi-Display-on-Huawei-devices-EMUI-8.0.patch new file mode 100644 index 0000000..fa086e3 --- /dev/null +++ b/patches/platform_frameworks_av/0002-Fix-WiFi-Display-on-Huawei-devices-EMUI-8.0.patch @@ -0,0 +1,31 @@ +From ddf773c1e301c5bc37fe156676ad6deb55fb7e8e Mon Sep 17 00:00:00 2001 +From: Alexander Pohl +Date: Fri, 15 Jun 2018 19:58:07 +0200 +Subject: [PATCH 02/11] Fix WiFi-Display on Huawei devices (EMUI 8.0) + +Huaweis media stack doesn't handle intra-refresh-mode, so skip the error instead. + +Thanks to Chris Vandomelen for pointing that out. +--- + media/libstagefright/ACodec.cpp | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp +index 3d67c911a..007b84cea 100644 +--- a/media/libstagefright/ACodec.cpp ++++ b/media/libstagefright/ACodec.cpp +@@ -4358,9 +4358,8 @@ status_t ACodec::setupAVCEncoderParameters(const sp &msg) { + if (msg->findInt32("intra-refresh-mode", &intraRefreshMode)) { + err = setCyclicIntraMacroblockRefresh(msg, intraRefreshMode); + if (err != OK) { +- ALOGE("Setting intra macroblock refresh mode (%d) failed: 0x%x", +- err, intraRefreshMode); +- return err; ++ ALOGE("setupAVCEncoderParameters(): set intra-refresh-mode failed, ignoring.."); ++ //return err; + } + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0003-Kirin-Remove-lock-to-prevent-self-lock.patch b/patches/platform_frameworks_av/0003-Kirin-Remove-lock-to-prevent-self-lock.patch new file mode 100644 index 0000000..e467d97 --- /dev/null +++ b/patches/platform_frameworks_av/0003-Kirin-Remove-lock-to-prevent-self-lock.patch @@ -0,0 +1,34 @@ +From 6e5e5dbc804ef1aa686731d588bdb959919de29e Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 19 Aug 2018 22:59:06 +0200 +Subject: [PATCH 03/11] ::Kirin:: Remove lock to prevent self-lock + +With Huawei Camera HAL, we get the following call order: +cameraserver CameraService::enumerateProviders (*) +=> HAL ICameraProvider::getVendorTags +=> HAL ICameraProviderCallback::cameraDeviceStatusChange +=> cameraserver CameraService::addState +=> cameraserver CameraService::updateCameraNumAndIds (*) + +The two functions marked with (*) take mServiceLock +Hence the safe-lock +--- + services/camera/libcameraservice/CameraService.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp +index 3e6210294..3736a9e24 100644 +--- a/services/camera/libcameraservice/CameraService.cpp ++++ b/services/camera/libcameraservice/CameraService.cpp +@@ -254,7 +254,7 @@ void CameraService::onNewProviderRegistered() { + } + + void CameraService::updateCameraNumAndIds() { +- Mutex::Autolock l(mServiceLock); ++ //Mutex::Autolock l(mServiceLock); + mNumberOfCameras = mCameraProviderManager->getCameraCount(); + mNormalDeviceIds = + mCameraProviderManager->getAPI1CompatibleCameraDeviceIds(); +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0004-We-might-not-have-a-mFlashlight-at-this-state-but-th.patch b/patches/platform_frameworks_av/0004-We-might-not-have-a-mFlashlight-at-this-state-but-th.patch new file mode 100644 index 0000000..79ec168 --- /dev/null +++ b/patches/platform_frameworks_av/0004-We-might-not-have-a-mFlashlight-at-this-state-but-th.patch @@ -0,0 +1,26 @@ +From d76a1c23cb4a61bac8e1cdc33bca4201b5c1972f Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 19 Aug 2018 23:05:26 +0200 +Subject: [PATCH 04/11] We might not have a mFlashlight at this state, but + that's ok + +--- + services/camera/libcameraservice/CameraService.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp +index 3736a9e24..12ab2f47e 100644 +--- a/services/camera/libcameraservice/CameraService.cpp ++++ b/services/camera/libcameraservice/CameraService.cpp +@@ -279,7 +279,7 @@ void CameraService::addStates(const String8 id) { + conflicting)); + } + +- if (mFlashlight->hasFlashUnit(id)) { ++ if (mFlashlight != nullptr && mFlashlight->hasFlashUnit(id)) { + Mutex::Autolock al(mTorchStatusMutex); + mTorchStatusMap.add(id, TorchModeStatus::AVAILABLE_OFF); + +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0005-CameraService-Support-calling-addStates-in-enumerate.patch b/patches/platform_frameworks_av/0005-CameraService-Support-calling-addStates-in-enumerate.patch new file mode 100644 index 0000000..9ffe11f --- /dev/null +++ b/patches/platform_frameworks_av/0005-CameraService-Support-calling-addStates-in-enumerate.patch @@ -0,0 +1,62 @@ +From a5bc47c2602ae78b0471e8f55538a4cca083decf Mon Sep 17 00:00:00 2001 +From: Artem Borisov +Date: Tue, 25 Sep 2018 12:39:22 +0300 +Subject: [PATCH 05/11] CameraService: Support calling addStates in + enumerateProviders + +Some pre-P camera HALs trigger onDeviceStatusChange callback during HAL init. +This is horribly wrong and causes a race condition between enumerateProviders +and onDeviceStatusChange. While it wasn't really harmful in O, in P call sequence +was changed and now this race condition leads to two problems: null pointer dereference +in addStates because mFlashlight is not initialized at a proper timing; mServiceLock +deadlock because updateCameraNumAndIds and enumerateProviders are called at the same time. +Moving addStates back to enumerateProviders makes the sequence more similar to O, and doesn't +let these two issues to happen. +Enable TARGET_CAMERA_NEEDS_ADD_STATES_IN_ENUMERATE when it is necessary. + +@Dil3mm4 edit: Instead of TARGET_CAMERA_NEEDS_ADD_STATES_IN_ENUMERATE let's use a system property to make it more generic and suitable for GSI use. + +Change-Id: Ife25b9753fdb679ab0c77f385e1b8527551a4711 +--- + .../camera/libcameraservice/CameraService.cpp | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp +index 12ab2f47e..d208a36a9 100644 +--- a/services/camera/libcameraservice/CameraService.cpp ++++ b/services/camera/libcameraservice/CameraService.cpp +@@ -204,6 +204,20 @@ status_t CameraService::enumerateProviders() { + + for (auto& cameraId : deviceIds) { + String8 id8 = String8(cameraId.c_str()); ++ if (property_get_bool("persist.sys.camera.huawei", false)) { ++ bool cameraFound = false; ++ { ++ Mutex::Autolock lock(mCameraStatesLock); ++ auto iter = mCameraStates.find(id8); ++ if (iter != mCameraStates.end()) { ++ cameraFound = true; ++ } ++ } ++ if (!cameraFound) { ++ addStates(id8); ++ } ++ } ++ + if (getCameraState(id8) == nullptr) { + onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT); + } +@@ -317,8 +331,10 @@ void CameraService::onDeviceStatusChanged(const String8& id, + ALOGI("%s: Unknown camera ID %s, a new camera is added", + __FUNCTION__, id.string()); + ++ if (!property_get_bool("persist.sys.camera.huawei", false)) { + // First add as absent to make sure clients are notified below + addStates(id); ++ } + + updateStatus(newStatus, id); + } else { +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0006-Revert-Set-rlimit-rtprio-for-cameraserver.patch b/patches/platform_frameworks_av/0006-Revert-Set-rlimit-rtprio-for-cameraserver.patch new file mode 100644 index 0000000..59881fa --- /dev/null +++ b/patches/platform_frameworks_av/0006-Revert-Set-rlimit-rtprio-for-cameraserver.patch @@ -0,0 +1,25 @@ +From 04e7317ef801f4124f4a074519d7a077dac14702 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 9 Dec 2018 15:56:59 +0100 +Subject: [PATCH 06/11] Revert "Set rlimit rtprio for cameraserver" + +This reverts commit 4ae244cab4fe715fc2729e906b7dda3075fbbac3. + +We need to revert this because some init/systems (Moto E5, G6) doesn't +like this instruction at all (read: this prevents boot) +--- + camera/cameraserver/cameraserver.rc | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/camera/cameraserver/cameraserver.rc b/camera/cameraserver/cameraserver.rc +index a9aae0b15..fea5a1d5c 100644 +--- a/camera/cameraserver/cameraserver.rc ++++ b/camera/cameraserver/cameraserver.rc +@@ -4,4 +4,3 @@ service cameraserver /system/bin/cameraserver + group audio camera input drmrpc + ioprio rt 4 + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks +- rlimit rtprio 10 10 +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0007-fixup-FIH-devices-Fix-Earpiece-audio-output.patch b/patches/platform_frameworks_av/0007-fixup-FIH-devices-Fix-Earpiece-audio-output.patch new file mode 100644 index 0000000..2056085 --- /dev/null +++ b/patches/platform_frameworks_av/0007-fixup-FIH-devices-Fix-Earpiece-audio-output.patch @@ -0,0 +1,33 @@ +From bb6f508a514d09fdab79583886f7953dd42bfa0c Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 4 Sep 2019 22:28:56 +0200 +Subject: [PATCH 07/11] fixup! FIH devices: Fix "Earpiece" audio output + +--- + .../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +index 0b561320b..c8cb54b5f 100644 +--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp ++++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +@@ -394,6 +394,7 @@ Return AudioGainTraits::deserialize(const xmlNode *cur + } + } + ++static bool fixedEarpieceChannels = false; + Return AudioProfileTraits::deserialize(const xmlNode *cur, + PtrSerializingCtx serializingContext) + { +@@ -527,7 +528,7 @@ Return DevicePortTraits::deserialize(const xmlNode *c + AudioProfileTraits::Collection profiles; + status_t status; + if(audio_is_output_devices(type)) +- status = deserializeCollection(doc, root, profiles, (PtrSerializingCtx)1); ++ status = deserializeCollection(cur, &profiles, (PtrSerializingCtx)1); + else + status = deserializeCollection(cur, &profiles, NULL); + if (status != NO_ERROR) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0008-Fix-use-after-free-object-on-stack.patch b/patches/platform_frameworks_av/0008-Fix-use-after-free-object-on-stack.patch new file mode 100644 index 0000000..a5fb036 --- /dev/null +++ b/patches/platform_frameworks_av/0008-Fix-use-after-free-object-on-stack.patch @@ -0,0 +1,26 @@ +From 582695245e6ce2bafaf3b11b9d3b69dcf88d0037 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 5 Aug 2019 17:27:47 +0200 +Subject: [PATCH 08/11] Fix use-after-free (object on stack) + +Change-Id: I9ae666b10873eac4e7a55032071e7b15b0de058a +--- + .../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +index c8cb54b5f..9f2bdc4b3 100644 +--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp ++++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +@@ -517,7 +517,7 @@ Return DevicePortTraits::deserialize(const xmlNode *c + if (!encodedFormatsLiteral.empty()) { + encodedFormats = formatsFromString(encodedFormatsLiteral, " "); + } +- Element deviceDesc = new DeviceDescriptor(type, encodedFormats, String8(name.c_str())); ++ Element deviceDesc = new DeviceDescriptor(type, encodedFormats, String8(strdup(name.c_str()))); + + std::string address = getXmlAttribute(cur, Attributes::address); + if (!address.empty()) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0009-Fix-BT-in-call-on-CAF-devices.patch b/patches/platform_frameworks_av/0009-Fix-BT-in-call-on-CAF-devices.patch new file mode 100644 index 0000000..9b7e6e3 --- /dev/null +++ b/patches/platform_frameworks_av/0009-Fix-BT-in-call-on-CAF-devices.patch @@ -0,0 +1,129 @@ +From c02350cbd42543fdfac9bd61b630182a0da1ecf9 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 5 Aug 2019 18:09:50 +0200 +Subject: [PATCH 09/11] Fix BT in-call on CAF devices + +See https://github.com/phhusson/treble_experimentations/issues/374 + +In Qualcomm's BSP audio_policy_configuration.xml, one route is missing, +from primary output and telephony to BT SCO. + +Add it if we detect telephony and bt sco, but no such route. + +Change-Id: Ifea0f88276ec9a0811f3cb1973c4b06f2c82077b +--- + .../managerdefinitions/src/Serializer.cpp | 91 +++++++++++++++++++ + 1 file changed, 91 insertions(+) + +diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +index 9f2bdc4b3..9c7e5c49d 100644 +--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp ++++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +@@ -607,6 +607,96 @@ Return RouteTraits::deserialize(const xmlNode *cur, PtrSer + return route; + } + ++static void fixupQualcommBtScoRoute(RouteTraits::Collection& routes, DevicePortTraits::Collection& devicePorts, HwModule* ctx) { ++ // On many Qualcomm devices, there is a BT SCO Headset Mic => primary input mix ++ // But Telephony Rx => BT SCO Headset route is missing ++ // When we detect such case, add the missing route ++ ++ // If we have: ++ // ++ // ++ // ++ // And no ++ ++ // Add: ++ // ++ bool foundBtScoHeadsetDevice = false; ++ for(const auto& device: devicePorts) { ++ if(device->getTagName() == String8("BT SCO Headset")) { ++ foundBtScoHeadsetDevice = true; ++ break; ++ } ++ } ++ if(!foundBtScoHeadsetDevice) { ++ ALOGE("No BT SCO Headset device found, don't patch policy"); ++ return; ++ } ++ ++ bool foundTelephony = false; ++ bool foundBtScoInput = false; ++ bool foundScoHeadsetRoute = false; ++ for(const auto& route: routes) { ++ ALOGE("Looking at route %d\n", route->getType()); ++ if(route->getType() != AUDIO_ROUTE_MIX) ++ continue; ++ auto sink = route->getSink(); ++ ALOGE("... With sink %s\n", sink->getTagName().c_str()); ++ if(sink->getTagName() == String8("Telephony Tx")) { ++ foundTelephony = true; ++ continue; ++ } ++ if(sink->getTagName() == String8("BT SCO Headset")) { ++ foundScoHeadsetRoute = true; ++ break; ++ } ++ for(const auto& source: route->getSources()) { ++ ALOGE("... With source %s\n", source->getTagName().c_str()); ++ if(source->getTagName() == String8("BT SCO Headset Mic")) { ++ foundBtScoInput = true; ++ break; ++ } ++ } ++ } ++ //The route we want to add is already there ++ ALOGE("Done looking for existing routes"); ++ if(foundScoHeadsetRoute) ++ return; ++ ++ ALOGE("No existing route found... %d %d", foundTelephony ? 1 : 0, foundBtScoInput ? 1 : 0); ++ //We couldn't find the routes we assume are required for the function we want to add ++ if(!foundTelephony || !foundBtScoInput) ++ return; ++ ALOGE("Adding our own."); ++ ++ // Add: ++ // ++ AudioRoute *newRoute = new AudioRoute(AUDIO_ROUTE_MIX); ++ ++ auto sink = ctx->findPortByTagName(String8("BT SCO Headset")); ++ ALOGE("Got sink %p\n", sink.get()); ++ newRoute->setSink(sink); ++ ++ AudioPortVector sources; ++ for(const auto& sourceName: { ++ "primary output", ++ "deep_buffer", ++ "compressed_offload", ++ "Telephony Rx" ++ }) { ++ auto source = ctx->findPortByTagName(String8(sourceName)); ++ ALOGE("Got source %p\n", source.get()); ++ sources.add(source); ++ source->addRoute(newRoute); ++ } ++ ++ newRoute->setSources(sources); ++ ++ sink->addRoute(newRoute); ++ ++ auto ret = routes.add(newRoute); ++ ALOGE("route add returned %zd", ret); ++} ++ + Return ModuleTraits::deserialize(const xmlNode *cur, PtrSerializingCtx ctx) + { + std::string name = getXmlAttribute(cur, Attributes::name); +@@ -646,6 +736,7 @@ Return ModuleTraits::deserialize(const xmlNode *cur, PtrS + if (status != NO_ERROR) { + return Status::fromStatusT(status); + } ++ fixupQualcommBtScoRoute(routes, devicePorts, module.get()); + module->setRoutes(routes); + + for (const xmlNode *children = cur->xmlChildrenNode; children != NULL; +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0010-Fix-null-pointer-for-unknown-audio-sources-in-Fix-BT.patch b/patches/platform_frameworks_av/0010-Fix-null-pointer-for-unknown-audio-sources-in-Fix-BT.patch new file mode 100644 index 0000000..ddc5c2e --- /dev/null +++ b/patches/platform_frameworks_av/0010-Fix-null-pointer-for-unknown-audio-sources-in-Fix-BT.patch @@ -0,0 +1,31 @@ +From a71fbad371842877a92190204450b5c6753b3509 Mon Sep 17 00:00:00 2001 +From: Vincent Vidal +Date: Thu, 12 Sep 2019 14:17:14 +0200 +Subject: [PATCH 10/11] Fix null pointer for unknown audio sources in "Fix BT + in-call on CAF devices" + +Some audio sources may not exist on some devices (e.g. Axon 7), leading to a segmentation fault. +--- + .../common/managerdefinitions/src/Serializer.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +index 9c7e5c49d..8bfdb5b0a 100644 +--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp ++++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp +@@ -685,8 +685,10 @@ static void fixupQualcommBtScoRoute(RouteTraits::Collection& routes, DevicePortT + }) { + auto source = ctx->findPortByTagName(String8(sourceName)); + ALOGE("Got source %p\n", source.get()); +- sources.add(source); +- source->addRoute(newRoute); ++ if (source.get() != nullptr) { ++ sources.add(source); ++ source->addRoute(newRoute); ++ } + } + + newRoute->setSources(sources); +-- +2.17.1 + diff --git a/patches/platform_frameworks_av/0011-Add-partial-cam-id-is-hardcoded-support-for-Asus-ZF6.patch b/patches/platform_frameworks_av/0011-Add-partial-cam-id-is-hardcoded-support-for-Asus-ZF6.patch new file mode 100644 index 0000000..bb29a76 --- /dev/null +++ b/patches/platform_frameworks_av/0011-Add-partial-cam-id-is-hardcoded-support-for-Asus-ZF6.patch @@ -0,0 +1,94 @@ +From 92aac43c368e3123ac419ad2c293de3abf0f0b3b Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 1 Oct 2019 13:35:49 +0200 +Subject: [PATCH 11/11] Add (partial, cam id is hardcoded) support for Asus ZF6 + motor camera + +Change-Id: Iea6e1370780a1d16f728748d1d948d092532d8fe +--- + .../camera/libcameraservice/CameraService.cpp | 26 +++++++++++++++++++ + .../camera/libcameraservice/CameraService.h | 3 +++ + 2 files changed, 29 insertions(+) + +diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp +index d208a36a9..37752becd 100644 +--- a/services/camera/libcameraservice/CameraService.cpp ++++ b/services/camera/libcameraservice/CameraService.cpp +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -128,6 +129,7 @@ Mutex CameraService::sProxyMutex; + sp CameraService::sCameraServiceProxy; + + CameraService::CameraService() : ++ mPhysicalFrontCamStatus(false), + mEventLog(DEFAULT_EVENT_LOG_LENGTH), + mNumberOfCameras(0), + mSoundRef(0), mInitialized(false) { +@@ -1538,6 +1540,7 @@ Status CameraService::connectHelper(const sp& cameraCb, const String8& + mServiceLock.lock(); + } else { + // Otherwise, add client to active clients list ++ physicalFrontCam(cameraId == "1"); + finishConnectLocked(client, partial); + } + } // lock is destroyed, allow further connect calls +@@ -1548,6 +1551,27 @@ Status CameraService::connectHelper(const sp& cameraCb, const String8& + return ret; + } + ++void CameraService::physicalFrontCam(bool on) { ++ if(on == mPhysicalFrontCamStatus) return; ++ mPhysicalFrontCamStatus = on; ++ ++ if(access("/dev/asusMotoDrv", F_OK) == 0) { ++ int pid = fork(); ++ if(pid == 0) { ++ const char* cmd[] = { ++ "/system/bin/asus-motor", ++ "0", ++ NULL ++ }; ++ cmd[1] = on ? "0" : "1"; ++ execve("/system/bin/asus-motor", (char**)cmd, environ); ++ _exit(1); ++ } else { ++ waitpid(pid, NULL, 0); ++ } ++ } ++} ++ + Status CameraService::setTorchMode(const String16& cameraId, bool enabled, + const sp& clientBinder) { + Mutex::Autolock lock(mServiceLock); +@@ -2405,6 +2429,8 @@ binder::Status CameraService::BasicClient::disconnect() { + } + mDisconnected = true; + ++ sCameraService->physicalFrontCam(false); ++ + sCameraService->removeByClient(this); + sCameraService->logDisconnected(mCameraIdStr, mClientPid, String8(mClientPackageName)); + sCameraService->mCameraProviderManager->removeRef(CameraProviderManager::DeviceMode::CAMERA, +diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h +index 065157dad..6d22da619 100644 +--- a/services/camera/libcameraservice/CameraService.h ++++ b/services/camera/libcameraservice/CameraService.h +@@ -182,6 +182,9 @@ public: + // Monitored UIDs availability notification + void notifyMonitoredUids(); + ++ bool mPhysicalFrontCamStatus; ++ void physicalFrontCam(bool on); ++ + ///////////////////////////////////////////////////////////////////// + // Client functionality + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0001-Fix-backlight-control-on-Galaxy-S9.patch b/patches/platform_frameworks_base/0001-Fix-backlight-control-on-Galaxy-S9.patch new file mode 100644 index 0000000..3b2473f --- /dev/null +++ b/patches/platform_frameworks_base/0001-Fix-backlight-control-on-Galaxy-S9.patch @@ -0,0 +1,56 @@ +From 9f8c77fea17968dd20e76b83b28f2fce2630a087 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sat, 24 Mar 2018 08:01:48 +0100 +Subject: [PATCH 01/36] Fix backlight control on Galaxy S9(+) + +Change-Id: I1fbbb47939c377597ef8ad6b88b2acea5f4acaa6 +--- + .../android/server/lights/LightsService.java | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index ac906bb23d3..e23e2cd3c4d 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -21,6 +21,7 @@ import android.os.Handler; + import android.os.IBinder; + import android.os.Message; + import android.os.PowerManager; ++import android.os.SystemProperties; + import android.os.Trace; + import android.provider.Settings; + import android.util.Slog; +@@ -71,6 +72,7 @@ public class LightsService extends SystemService { + ": brightness=0x" + Integer.toHexString(brightness)); + return; + } ++ + // Ideally, we'd like to set the brightness mode through the SF/HWC as well, but + // right now we just fall back to the old path through Lights brightessMode is + // anything but USER or the device shouldBeInLowPersistenceMode(). +@@ -86,11 +88,18 @@ public class LightsService extends SystemService { + } + SurfaceControl.setDisplayBrightness(mDisplayToken, + (float) brightness / mSurfaceControlMaximumBrightness); +- } else { +- int color = brightness & 0x000000ff; +- color = 0xff000000 | (color << 16) | (color << 8) | color; +- setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, brightnessMode); ++ return; + } ++ ++ String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); ++ if(fp.contains("starlte") || fp.contains("star2lte")) { ++ setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); ++ return; ++ } ++ ++ int color = brightness & 0x000000ff; ++ color = 0xff000000 | (color << 16) | (color << 8) | color; ++ setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, brightnessMode); + } + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0002-Relax-requirement-for-visible-flag-to-sdcards.patch b/patches/platform_frameworks_base/0002-Relax-requirement-for-visible-flag-to-sdcards.patch new file mode 100644 index 0000000..d9846d1 --- /dev/null +++ b/patches/platform_frameworks_base/0002-Relax-requirement-for-visible-flag-to-sdcards.patch @@ -0,0 +1,31 @@ +From ae073ba9abbd86e82d06261ad260ea27fbc04f14 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 28 Nov 2017 18:28:04 +0100 +Subject: [PATCH] Relax requirement for visible flag to sdcards + +The vast majority of sdcard readers are stable enough to be declared by +the API. (I see no counter-example) +FBE broke adoptable storage with SDCard, hence this need. + +Change-Id: Ia616671c03562d1eadaff5531a5c708a62d7ad3a +--- + .../core/java/com/android/server/StorageManagerService.java | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java +index 72f40cc0351..20ffd687e89 100644 +--- a/services/core/java/com/android/server/StorageManagerService.java ++++ b/services/core/java/com/android/server/StorageManagerService.java +@@ -1282,7 +1282,8 @@ class StorageManagerService extends IStorageManager.Stub + + // Adoptable public disks are visible to apps, since they meet + // public API requirement of being in a stable location. +- if (vol.disk.isAdoptable()) { ++ // Assume all SDs match this as well ++ if (vol.disk.isAdoptable() || vol.disk.isSd()) { + vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE; + } else if (vol.disk.isSd()) { + vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE; +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0003-Also-scan-system-overlay.patch b/patches/platform_frameworks_base/0003-Also-scan-system-overlay.patch new file mode 100644 index 0000000..3aecffb --- /dev/null +++ b/patches/platform_frameworks_base/0003-Also-scan-system-overlay.patch @@ -0,0 +1,52 @@ +From 78dcdf304f0baa325fe8d39e2e7cb64b46b9a089 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 1 May 2018 17:47:36 +0200 +Subject: [PATCH 03/36] Also scan /system/overlay + +Change-Id: Ib0223560606b80cdaaa986b159b34b4db0154589 +--- + core/jni/android_util_AssetManager.cpp | 6 +++++- + core/jni/fd_utils.cpp | 3 ++- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp +index 2b471fec9c8..4518c7e66a5 100644 +--- a/core/jni/android_util_AssetManager.cpp ++++ b/core/jni/android_util_AssetManager.cpp +@@ -163,7 +163,7 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) { + } + + // Generic idmap parameters +- const char* argv[10]; ++ const char* argv[11]; + int argc = 0; + struct stat st; + +@@ -207,6 +207,10 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) { + argv[argc++] = AssetManager::OEM_OVERLAY_DIR; + } + ++ if(stat("/system/overlay", &st) == 0) { ++ argv[argc++] = "/system/overlay"; ++ } ++ + // Finally, invoke idmap (if any overlay directory exists) + if (argc > 5) { + execv(AssetManager::IDMAP_BIN, (char* const*)argv); +diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp +index fa5f931470b..488c2f8e9e8 100644 +--- a/core/jni/fd_utils.cpp ++++ b/core/jni/fd_utils.cpp +@@ -118,7 +118,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const { + || android::base::StartsWith(path, kSystemOdmOverlayDir) + || android::base::StartsWith(path, kOdmOverlayDir) + || android::base::StartsWith(path, kSystemOemOverlayDir) +- || android::base::StartsWith(path, kOemOverlayDir)) ++ || android::base::StartsWith(path, kOemOverlayDir) ++ || android::base::StartsWith(path, "/system/overlay")) + && android::base::EndsWith(path, kApkSuffix) + && path.find("/../") == std::string::npos) { + return true; +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0004-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch b/patches/platform_frameworks_base/0004-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch new file mode 100644 index 0000000..45c9157 --- /dev/null +++ b/patches/platform_frameworks_base/0004-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch @@ -0,0 +1,25 @@ +From e1a57d1f38bb45e69c9a2178ab34fd08adafe810 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 17 May 2018 20:28:35 +0200 +Subject: [PATCH 04/36] Don't crash if there is IR HAL is not declared + +--- + services/core/java/com/android/server/ConsumerIrService.java | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/services/core/java/com/android/server/ConsumerIrService.java b/services/core/java/com/android/server/ConsumerIrService.java +index 2ed6c77baa0..c574a03c9a3 100644 +--- a/services/core/java/com/android/server/ConsumerIrService.java ++++ b/services/core/java/com/android/server/ConsumerIrService.java +@@ -50,8 +50,6 @@ public class ConsumerIrService extends IConsumerIrService.Stub { + if (!mHasNativeHal) { + throw new RuntimeException("FEATURE_CONSUMER_IR present, but no IR HAL loaded!"); + } +- } else if (mHasNativeHal) { +- throw new RuntimeException("IR HAL present, but FEATURE_CONSUMER_IR is not set!"); + } + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0005-Fix-62.patch b/patches/platform_frameworks_base/0005-Fix-62.patch new file mode 100644 index 0000000..9cd8ba3 --- /dev/null +++ b/patches/platform_frameworks_base/0005-Fix-62.patch @@ -0,0 +1,28 @@ +From c318f6086d6c12bb92de652440ee985256fd60c2 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 30 May 2018 14:05:30 +0200 +Subject: [PATCH 05/36] Fix(?) #62 + +--- + .../src/com/android/keyguard/KeyguardUpdateMonitor.java | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +index 6a4dbc8d722..39535c32860 100644 +--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java ++++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +@@ -1117,7 +1117,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { + + @Override + public void onAuthenticationError(int errMsgId, CharSequence errString) { +- handleFingerprintError(errMsgId, errString.toString()); ++ if(errString != null) ++ handleFingerprintError(errMsgId, errString.toString()); ++ else ++ handleFingerprintError(errMsgId, "unknown error"); + } + + @Override +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0006-S9-brightness-override-only-for-screen.patch b/patches/platform_frameworks_base/0006-S9-brightness-override-only-for-screen.patch new file mode 100644 index 0000000..3604cfc --- /dev/null +++ b/patches/platform_frameworks_base/0006-S9-brightness-override-only-for-screen.patch @@ -0,0 +1,36 @@ +From 6556ccbc704c6cb4a3bae5e9411082f6e1e1ff71 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 7 Jun 2018 13:36:51 +0200 +Subject: [PATCH 06/36] S9 brightness override only for screen + +Change-Id: Ie16a46336fa64850014b962429f7a20ff569222f +--- + .../com/android/server/lights/LightsService.java | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index e23e2cd3c4d..327979166c2 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -91,11 +91,13 @@ public class LightsService extends SystemService { + return; + } + +- String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); +- if(fp.contains("starlte") || fp.contains("star2lte")) { +- setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); +- return; +- } ++ if(mId == 0) { ++ String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); ++ if(fp.contains("starlte") || fp.contains("star2lte")) { ++ setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); ++ return; ++ } ++ } + + int color = brightness & 0x000000ff; + color = 0xff000000 | (color << 16) | (color << 8) | color; +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0007-WIP-Fix-OP6-brightness.patch b/patches/platform_frameworks_base/0007-WIP-Fix-OP6-brightness.patch new file mode 100644 index 0000000..bab66ca --- /dev/null +++ b/patches/platform_frameworks_base/0007-WIP-Fix-OP6-brightness.patch @@ -0,0 +1,35 @@ +From 21d4fc3b58aa737f78378c0df4987604bf4e32e0 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 7 Jun 2018 13:42:02 +0200 +Subject: [PATCH 07/36] [WIP] Fix OP6 brightness + +--- + .../com/android/server/lights/LightsService.java | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index 327979166c2..f0035c67f4a 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -97,6 +97,18 @@ public class LightsService extends SystemService { + setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); + return; + } ++ ++ boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false); ++ int scale = SystemProperties.getInt("persist.display.max_brightness", 1023); ++ if(fp.contains("OnePlus6")) { ++ qcomExtendBrightness = true; ++ scale = 1023; ++ } ++ ++ if(qcomExtendBrightness) { ++ setLightLocked(brightness * scale / 255, LIGHT_FLASH_NONE, 0, 0, brightnessMode); ++ return; ++ } + } + + int color = brightness & 0x000000ff; +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0008-Try-to-make-brightness-more-generic-using-property-s.patch b/patches/platform_frameworks_base/0008-Try-to-make-brightness-more-generic-using-property-s.patch new file mode 100644 index 0000000..0a0c6fd --- /dev/null +++ b/patches/platform_frameworks_base/0008-Try-to-make-brightness-more-generic-using-property-s.patch @@ -0,0 +1,31 @@ +From 7235d15f8ba322a1806a8736751cac88cecb9b53 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 10 Jun 2018 22:54:55 +0200 +Subject: [PATCH 08/36] Try to make brightness more generic using property set + by rw-system + +--- + .../core/java/com/android/server/lights/LightsService.java | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index f0035c67f4a..529026a1e7c 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -100,9 +100,11 @@ public class LightsService extends SystemService { + + boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false); + int scale = SystemProperties.getInt("persist.display.max_brightness", 1023); +- if(fp.contains("OnePlus6")) { ++ //This is set by vndk-detect ++ int qcomScale = SystemProperties.getInt("persist.sys.qcom-brightness", -1); ++ if(qcomScale != -1) { + qcomExtendBrightness = true; +- scale = 1023; ++ scale = qcomScale; + } + + if(qcomExtendBrightness) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0009-property-matching-RROs-allow-to-prefix-the-value-wit.patch b/patches/platform_frameworks_base/0009-property-matching-RROs-allow-to-prefix-the-value-wit.patch new file mode 100644 index 0000000..f8b9fde --- /dev/null +++ b/patches/platform_frameworks_base/0009-property-matching-RROs-allow-to-prefix-the-value-wit.patch @@ -0,0 +1,35 @@ +From 5d557f64f712c73d97669f10532b5a2867c6f1d3 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 12 Jun 2018 22:55:32 +0200 +Subject: [PATCH 09/36] property-matching RROs: allow to prefix the value with + + to do glob match instead of exact match + +--- + cmds/idmap/scan.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp +index d69dd79555a..2be6d23ac78 100644 +--- a/cmds/idmap/scan.cpp ++++ b/cmds/idmap/scan.cpp +@@ -1,5 +1,6 @@ + #include + #include ++#include + #include + #include + +@@ -92,6 +93,10 @@ namespace { + property_get(prop, propBuf, NULL); + val = strndup16to8(value.string(), value.size()); + ++ if(val[0]=='+') { ++ return fnmatch(val+1, propBuf, 0) != 0; ++ } ++ + return (strcmp(propBuf, val) == 0); + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0010-Fix-typo-on-fnmatch-return-value-check.patch b/patches/platform_frameworks_base/0010-Fix-typo-on-fnmatch-return-value-check.patch new file mode 100644 index 0000000..2fbe452 --- /dev/null +++ b/patches/platform_frameworks_base/0010-Fix-typo-on-fnmatch-return-value-check.patch @@ -0,0 +1,25 @@ +From a95da9d8c3508280233a42dcbfc6440fbc95c563 Mon Sep 17 00:00:00 2001 +From: Song Fuchang +Date: Sun, 17 Jun 2018 22:39:37 +0800 +Subject: [PATCH 10/36] Fix typo on fnmatch return value check + +--- + cmds/idmap/scan.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp +index 2be6d23ac78..0acff23d031 100644 +--- a/cmds/idmap/scan.cpp ++++ b/cmds/idmap/scan.cpp +@@ -94,7 +94,7 @@ namespace { + val = strndup16to8(value.string(), value.size()); + + if(val[0]=='+') { +- return fnmatch(val+1, propBuf, 0) != 0; ++ return fnmatch(val+1, propBuf, 0) == 0; + } + + return (strcmp(propBuf, val) == 0); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0011-Add-Qualcomm-starlte.patch b/patches/platform_frameworks_base/0011-Add-Qualcomm-starlte.patch new file mode 100644 index 0000000..8e27616 --- /dev/null +++ b/patches/platform_frameworks_base/0011-Add-Qualcomm-starlte.patch @@ -0,0 +1,27 @@ +From 695e8613f1bcee3f03269eb7f28ed9a91b41e2ad Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 25 Jun 2018 22:43:32 +0200 +Subject: [PATCH 11/36] Add Qualcomm starlte + +--- + .../core/java/com/android/server/lights/LightsService.java | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index 529026a1e7c..65f9ea87ae5 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -93,7 +93,9 @@ public class LightsService extends SystemService { + + if(mId == 0) { + String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); +- if(fp.contains("starlte") || fp.contains("star2lte")) { ++ if( ++ fp.contains("starlte") || fp.contains("star2lte") || ++ fp.contains("starqlte") || fp.contains("star2qlte")) { + setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); + return; + } +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0012-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch b/patches/platform_frameworks_base/0012-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch new file mode 100644 index 0000000..c734480 --- /dev/null +++ b/patches/platform_frameworks_base/0012-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch @@ -0,0 +1,33 @@ +From f1176c850abc148002e5986db5ccecac116b91c9 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 2 Jul 2018 23:36:39 +0200 +Subject: [PATCH 12/36] [Galaxy S9] "remaining" of HAL onEnroll is actually a + percent of progress + +Change-Id: I8a586163eca93ae3c5bd968d1e7ddbf994ddcc91 +--- + .../server/biometrics/fingerprint/FingerprintService.java | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +index 24fd1b7a6da..dc56a95217c 100644 +--- a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java ++++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +@@ -588,7 +588,13 @@ public class FingerprintService extends BiometricServiceBase { + final Fingerprint fingerprint = + new Fingerprint(getBiometricUtils().getUniqueName(getContext(), groupId), + groupId, fingerId, deviceId); +- FingerprintService.super.handleEnrollResult(fingerprint, remaining); ++ ++ int remaining2 = remaining; ++ String fp = android.os.SystemProperties.get("ro.vendor.build.fingerprint"); ++ if(fp != null && (fp.contains("starlte") || fp.contains("star2lte") || fp.contains("starqlte") || fp.contains("star2qlte"))) ++ remaining2 = 100 - remaining2; ++ ++ FingerprintService.super.handleEnrollResult(fingerprint, remaining2); + }); + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0013-Show-APN-Settings-for-CDMA-carriers.patch b/patches/platform_frameworks_base/0013-Show-APN-Settings-for-CDMA-carriers.patch new file mode 100644 index 0000000..f52d683 --- /dev/null +++ b/patches/platform_frameworks_base/0013-Show-APN-Settings-for-CDMA-carriers.patch @@ -0,0 +1,25 @@ +From ca9cc0e485753ac43ea8fba76638b00495669f39 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 6 Aug 2018 12:49:00 +0200 +Subject: [PATCH 13/36] Show APN Settings for CDMA carriers + +--- + telephony/java/android/telephony/CarrierConfigManager.java | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java +index 19f8203f750..4e0fcbb7358 100755 +--- a/telephony/java/android/telephony/CarrierConfigManager.java ++++ b/telephony/java/android/telephony/CarrierConfigManager.java +@@ -3073,7 +3073,7 @@ public class CarrierConfigManager { + sDefaults.putBoolean(KEY_MDN_IS_ADDITIONAL_VOICEMAIL_NUMBER_BOOL, false); + sDefaults.putBoolean(KEY_OPERATOR_SELECTION_EXPAND_BOOL, true); + sDefaults.putBoolean(KEY_PREFER_2G_BOOL, true); +- sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, false); ++ sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, true); + sDefaults.putBoolean(KEY_SHOW_CDMA_CHOICES_BOOL, false); + sDefaults.putBoolean(KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL, false); + sDefaults.putBoolean(KEY_SUPPORT_EMERGENCY_SMS_OVER_IMS_BOOL, false); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0014-idmap-Don-t-silently-ignore-RROs-with-same-priority.patch b/patches/platform_frameworks_base/0014-idmap-Don-t-silently-ignore-RROs-with-same-priority.patch new file mode 100644 index 0000000..1bf2337 --- /dev/null +++ b/patches/platform_frameworks_base/0014-idmap-Don-t-silently-ignore-RROs-with-same-priority.patch @@ -0,0 +1,26 @@ +From 1597769b8c2d3faabd76ba20368409293709a2d5 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 19 Aug 2018 10:51:06 +0200 +Subject: [PATCH 14/36] idmap: Don't silently ignore RROs with same priority + +Change-Id: I64a6899f1b30e0cd9e9a872b7ca83d831f038cbe +--- + cmds/idmap/scan.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp +index 0acff23d031..d1dde52732f 100644 +--- a/cmds/idmap/scan.cpp ++++ b/cmds/idmap/scan.cpp +@@ -29,6 +29,8 @@ namespace { + + bool operator<(Overlay const& rhs) const + { ++ if(rhs.priority == priority) ++ return rhs.apk_path > apk_path; + return rhs.priority > priority; + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0016-power-Disable-keyboard-button-lights-while-dozing-dr.patch b/patches/platform_frameworks_base/0016-power-Disable-keyboard-button-lights-while-dozing-dr.patch new file mode 100644 index 0000000..9211e1f --- /dev/null +++ b/patches/platform_frameworks_base/0016-power-Disable-keyboard-button-lights-while-dozing-dr.patch @@ -0,0 +1,31 @@ +From 807d3807f81b4893cd5186c60cfcf94920281a41 Mon Sep 17 00:00:00 2001 +From: Steve Kondik +Date: Sat, 3 Jan 2015 05:13:26 -0800 +Subject: [PATCH 16/36] power: Disable keyboard/button lights while + dozing/dreaming + + * With hardkeys and doze mode enabled, entering suspend results in + an epic battle over the lights. It's a bad situation. Disable + them when we're sleepy. + +Change-Id: I7f1fc35a1573717d1ea101a07c4171d6f66d1553 +--- + .../core/java/com/android/server/power/PowerManagerService.java | 2 +- + 1 file changed, 1 insertion(+), 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 5cccc77ac53..e7d5315a2b9 100644 +--- a/services/core/java/com/android/server/power/PowerManagerService.java ++++ b/services/core/java/com/android/server/power/PowerManagerService.java +@@ -2040,7 +2040,7 @@ public final class PowerManagerService extends SystemService + final long nextProfileTimeout = getNextProfileTimeoutLocked(now); + + mUserActivitySummary = 0; +- if (mLastUserActivityTime >= mLastWakeTime) { ++ if (mWakefulness == WAKEFULNESS_AWAKE && mLastUserActivityTime >= mLastWakeTime) { + nextTimeout = mLastUserActivityTime + + screenOffTimeout - screenDimDuration; + if (now < nextTimeout) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0017-Don-t-wake-IR-HAL-to-the-infinity-and-beyond.patch b/patches/platform_frameworks_base/0017-Don-t-wake-IR-HAL-to-the-infinity-and-beyond.patch new file mode 100644 index 0000000..6eeca5c --- /dev/null +++ b/patches/platform_frameworks_base/0017-Don-t-wake-IR-HAL-to-the-infinity-and-beyond.patch @@ -0,0 +1,44 @@ +From d7a6847541ff67793487d581067ca724b3144c60 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 21 Aug 2018 22:24:02 +0200 +Subject: [PATCH] Don't wake IR HAL to the infinity and beyond + +--- + .../core/java/com/android/server/ConsumerIrService.java | 7 ------- + services/core/jni/com_android_server_ConsumerIrService.cpp | 2 +- + 2 files changed, 1 insertion(+), 8 deletions(-) + +diff --git a/services/core/java/com/android/server/ConsumerIrService.java b/services/core/java/com/android/server/ConsumerIrService.java +index 2ed6c77baa0..82ec033bc30 100644 +--- a/services/core/java/com/android/server/ConsumerIrService.java ++++ b/services/core/java/com/android/server/ConsumerIrService.java +@@ -46,13 +46,6 @@ public class ConsumerIrService extends IConsumerIrService.Stub { + mWakeLock.setReferenceCounted(true); + + mHasNativeHal = halOpen(); +- if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONSUMER_IR)) { +- if (!mHasNativeHal) { +- throw new RuntimeException("FEATURE_CONSUMER_IR present, but no IR HAL loaded!"); +- } +- } else if (mHasNativeHal) { +- throw new RuntimeException("IR HAL present, but FEATURE_CONSUMER_IR is not set!"); +- } + } + + @Override +diff --git a/services/core/jni/com_android_server_ConsumerIrService.cpp b/services/core/jni/com_android_server_ConsumerIrService.cpp +index 2ca348b3ae4..148fba9a688 100644 +--- a/services/core/jni/com_android_server_ConsumerIrService.cpp ++++ b/services/core/jni/com_android_server_ConsumerIrService.cpp +@@ -36,7 +36,7 @@ static sp mHal; + + static jboolean halOpen(JNIEnv* /* env */, jobject /* obj */) { + // TODO(b/31632518) +- mHal = IConsumerIr::getService(); ++ mHal = IConsumerIr::tryGetService(); + return mHal != nullptr; + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0018-Switch-samsung-light-fingerprint-match-to-regexp-to-.patch b/patches/platform_frameworks_base/0018-Switch-samsung-light-fingerprint-match-to-regexp-to-.patch new file mode 100644 index 0000000..9ff20e6 --- /dev/null +++ b/patches/platform_frameworks_base/0018-Switch-samsung-light-fingerprint-match-to-regexp-to-.patch @@ -0,0 +1,28 @@ +From 410c6135bef8bc83e49b182f7d3408c46ca47584 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 23 Aug 2018 23:39:16 +0200 +Subject: [PATCH 18/36] Switch samsung light fingerprint match to regexp, to + include Note9 + +--- + .../core/java/com/android/server/lights/LightsService.java | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index 65f9ea87ae5..aa014bf9ff4 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -93,9 +93,7 @@ public class LightsService extends SystemService { + + if(mId == 0) { + String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); +- if( +- fp.contains("starlte") || fp.contains("star2lte") || +- fp.contains("starqlte") || fp.contains("star2qlte")) { ++ if(fp.matches(".*(crown|star)[q2]*lte.*")) { + setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); + return; + } +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0019-Add-a-property-toggle-to-enable-high-brightness-rang.patch b/patches/platform_frameworks_base/0019-Add-a-property-toggle-to-enable-high-brightness-rang.patch new file mode 100644 index 0000000..03d6436 --- /dev/null +++ b/patches/platform_frameworks_base/0019-Add-a-property-toggle-to-enable-high-brightness-rang.patch @@ -0,0 +1,30 @@ +From 378df1aac9a2b439e20dcc60d216f8c15974fdca Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 27 Aug 2018 00:47:13 +0200 +Subject: [PATCH 19/36] Add a property toggle to enable high brightness range + on samsung device + +--- + .../core/java/com/android/server/lights/LightsService.java | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index aa014bf9ff4..a18ae0d6159 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -94,7 +94,11 @@ public class LightsService extends SystemService { + if(mId == 0) { + String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); + if(fp.matches(".*(crown|star)[q2]*lte.*")) { +- setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); ++ int newBrightness = brightness * 100; ++ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) { ++ newBrightness = (int) (brightness * 40960.0 / 255.0); ++ } ++ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); + return; + } + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0020-Add-a-property-to-override-pre-o-max-aspect-ratio.patch b/patches/platform_frameworks_base/0020-Add-a-property-to-override-pre-o-max-aspect-ratio.patch new file mode 100644 index 0000000..f1f4535 --- /dev/null +++ b/patches/platform_frameworks_base/0020-Add-a-property-to-override-pre-o-max-aspect-ratio.patch @@ -0,0 +1,39 @@ +From 6c3996a1e42192a481ac029932fc1c4eade50488 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 29 Aug 2018 11:05:54 +0200 +Subject: [PATCH 20/36] Add a property to override pre-o max aspect ratio + +Change-Id: Id001a19fab7680feda841202b6e91c490d0d5ffa +--- + .../core/java/com/android/server/wm/ActivityRecord.java | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java +index 371a9435643..5b61f215f3f 100644 +--- a/services/core/java/com/android/server/wm/ActivityRecord.java ++++ b/services/core/java/com/android/server/wm/ActivityRecord.java +@@ -2837,6 +2837,12 @@ final class ActivityRecord extends ConfigurationContainer { + // TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer. + private void updateOverrideConfiguration() { + final Configuration overrideConfig = mTmpConfig; ++ if(info.applicationInfo.targetSdkVersion < O) { ++ try { ++ maxAspectRatio = Float.parseFloat(SystemProperties.get("persist.sys.max_aspect_ratio.pre_o", "")); ++ } catch (Throwable t) {} ++ Log.d("PHH", "Overrode aspect ratio because pre-o to " + maxAspectRatio); ++ } + if (shouldUseSizeCompatMode()) { + if (mCompatDisplayInsets != null) { + // The override configuration is set only once in size compatibility mode. +@@ -3070,7 +3076,7 @@ final class ActivityRecord extends ConfigurationContainer { + // TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer. + private void computeBounds(Rect outBounds, Rect containingAppBounds) { + outBounds.setEmpty(); +- final float maxAspectRatio = info.maxAspectRatio; ++ float maxAspectRatio = info.maxAspectRatio; + final ActivityStack stack = getActivityStack(); + final float minAspectRatio = info.minAspectRatio; + +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0021-Add-japanese-S9.patch b/patches/platform_frameworks_base/0021-Add-japanese-S9.patch new file mode 100644 index 0000000..399a12d --- /dev/null +++ b/patches/platform_frameworks_base/0021-Add-japanese-S9.patch @@ -0,0 +1,26 @@ +From 05ed3ef7fba2ae7fc012ca296c60af4238c91550 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 28 Aug 2018 20:39:26 +0200 +Subject: [PATCH 21/36] Add japanese S9 + +--- + .../core/java/com/android/server/lights/LightsService.java | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index a18ae0d6159..37e03880f1e 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -93,7 +93,8 @@ public class LightsService extends SystemService { + + if(mId == 0) { + String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); +- if(fp.matches(".*(crown|star)[q2]*lte.*")) { ++ if(fp.matches(".*(crown|star)[q2]*lte.*") || ++ fp.matches(".*(SC-0[23]K|SCV3[89]).*")) { + int newBrightness = brightness * 100; + if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) { + newBrightness = (int) (brightness * 40960.0 / 255.0); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0022-Re-order-services-so-that-it-works-even-without-qtag.patch b/patches/platform_frameworks_base/0022-Re-order-services-so-that-it-works-even-without-qtag.patch new file mode 100644 index 0000000..22ca70c --- /dev/null +++ b/patches/platform_frameworks_base/0022-Re-order-services-so-that-it-works-even-without-qtag.patch @@ -0,0 +1,36 @@ +From 089eae49049ea602363949e8593acfd5447530c6 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 8 Nov 2018 23:04:03 +0100 +Subject: [PATCH 22/36] Re-order services so that it works even without qtaguid + +--- + .../com/android/server/net/NetworkPolicyManagerService.java | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +index 6c34e1313f7..337b22c3587 100644 +--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java ++++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +@@ -725,6 +725,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { + Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "systemReady"); + final int oldPriority = Process.getThreadPriority(Process.myTid()); + try { ++ mUsageStats = LocalServices.getService(UsageStatsManagerInternal.class); ++ mNetworkStats = LocalServices.getService(NetworkStatsManagerInternal.class); ++ + // Boost thread's priority during system server init + Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND); + if (!isBandwidthControlEnabled()) { +@@ -732,9 +735,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { + return; + } + +- mUsageStats = LocalServices.getService(UsageStatsManagerInternal.class); +- mNetworkStats = LocalServices.getService(NetworkStatsManagerInternal.class); +- + synchronized (mUidRulesFirstLock) { + synchronized (mNetworkPoliciesSecondLock) { + updatePowerSaveWhitelistUL(); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0023-Different-value-for-astarqlte.-Probably-more-devices.patch b/patches/platform_frameworks_base/0023-Different-value-for-astarqlte.-Probably-more-devices.patch new file mode 100644 index 0000000..defcd42 --- /dev/null +++ b/patches/platform_frameworks_base/0023-Different-value-for-astarqlte.-Probably-more-devices.patch @@ -0,0 +1,33 @@ +From 1fa1945234225aa9d6201a7da2990fd17b544dc7 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 10 Mar 2019 19:35:06 +0100 +Subject: [PATCH 23/36] Different value for astarqlte. Probably more devices to + add later + +--- + .../java/com/android/server/lights/LightsService.java | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index 37e03880f1e..993483c342b 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -93,6 +93,15 @@ public class LightsService extends SystemService { + + if(mId == 0) { + String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello"); ++ if(fp.matches(".*astarqlte.*")) { ++ int newBrightness = brightness; ++ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) { ++ newBrightness = (int) (brightness * 365.0 / 255.0); ++ } ++ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); ++ return; ++ } ++ + if(fp.matches(".*(crown|star)[q2]*lte.*") || + fp.matches(".*(SC-0[23]K|SCV3[89]).*")) { + int newBrightness = brightness * 100; +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0024-Support-new-samsung-light-hal.patch b/patches/platform_frameworks_base/0024-Support-new-samsung-light-hal.patch new file mode 100644 index 0000000..a016c2f --- /dev/null +++ b/patches/platform_frameworks_base/0024-Support-new-samsung-light-hal.patch @@ -0,0 +1,70 @@ +From 8049bd5138e52042ed47b8b0700753cb77b57641 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 24 Mar 2019 23:05:14 +0100 +Subject: [PATCH] Support new samsung light hal + +Change-Id: I88ca834894320129737b4e31fa8f7e5ee918889a +--- + services/core/jni/Android.bp | 1 + + ...om_android_server_lights_LightsService.cpp | 19 +++++++++++++++++++ + 2 files changed, 20 insertions(+) + +diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp +index fdcefd42316..d8645012e24 100644 +--- a/services/core/jni/Android.bp ++++ b/services/core/jni/Android.bp +@@ -135,6 +135,7 @@ cc_defaults { + "android.system.suspend@1.0", + "suspend_control_aidl_interface-cpp", + "vendor.lineage.power@1.0", ++ "vendor.samsung.hardware.light@2.0", + ], + + static_libs: [ +diff --git a/services/core/jni/com_android_server_lights_LightsService.cpp b/services/core/jni/com_android_server_lights_LightsService.cpp +index 35d8219651d..20de7985d1d 100644 +--- a/services/core/jni/com_android_server_lights_LightsService.cpp ++++ b/services/core/jni/com_android_server_lights_LightsService.cpp +@@ -23,6 +23,8 @@ + + #include + #include ++#include ++#include + #include + #include + #include +@@ -40,6 +42,8 @@ using Type = ::android::hardware::light::V2_0::Type; + template + using Return = ::android::hardware::Return; + ++using ISecLight = ::vendor::samsung::hardware::light::V2_0::ISecLight; ++using SecType = ::vendor::samsung::hardware::light::V2_0::SecType; + static bool sLightSupported = true; + + static bool validate(jint light, jint flash, jint brightness) { +@@ -151,6 +155,21 @@ static void setLight_native( + colorAlpha = (colorAlpha * brightnessLevel) / 0xFF; + colorARGB = (colorAlpha << 24) + (colorARGB & 0x00FFFFFF); + } ++ ++ sp secHal = ISecLight::getService(); ++ ++ if(secHal != nullptr) { ++ SecType type = static_cast(light); ++ LightState state = constructState( ++ colorARGB, flashMode, onMS, offMS, brightnessMode); ++ ++ { ++ android::base::Timer t; ++ Return ret = secHal->setLightSec(type, state); ++ processReturn(ret, static_cast(light), state); ++ if (t.duration() > 50ms) ALOGD("Excessive delay setting light"); ++ } ++ } + + Type type = static_cast(light); + LightState state = constructState( +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0025-Fix-backlight-on-S10-.-Add-an-additional-property-to.patch b/patches/platform_frameworks_base/0025-Fix-backlight-on-S10-.-Add-an-additional-property-to.patch new file mode 100644 index 0000000..64c22ab --- /dev/null +++ b/patches/platform_frameworks_base/0025-Fix-backlight-on-S10-.-Add-an-additional-property-to.patch @@ -0,0 +1,28 @@ +From 454a0898504d1af98f687ebdbc8bc7b13a3d3ff5 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 24 Apr 2019 20:09:53 +0200 +Subject: [PATCH 25/36] Fix backlight on S10*. Add an additional property to + check, so testers can try it more easily + +--- + .../core/java/com/android/server/lights/LightsService.java | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index 993483c342b..a578ed894c4 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -102,7 +102,9 @@ public class LightsService extends SystemService { + return; + } + +- if(fp.matches(".*(crown|star)[q2]*lte.*") || ++ if(SystemProperties.getInt("persist.sys.phh.samsung_backlight", 0) == 1 || ++ fp.matches(".*beyond.*lte.*") || ++ fp.matches(".*(crown|star)[q2]*lte.*") || + fp.matches(".*(SC-0[23]K|SCV3[89]).*")) { + int newBrightness = brightness * 100; + if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0026-Make-samsung-light-HAL-more-overridable.patch b/patches/platform_frameworks_base/0026-Make-samsung-light-HAL-more-overridable.patch new file mode 100644 index 0000000..693a17e --- /dev/null +++ b/patches/platform_frameworks_base/0026-Make-samsung-light-HAL-more-overridable.patch @@ -0,0 +1,48 @@ +From 571bf63da97814631982b28b41f96781a13848a8 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 2 Jul 2019 21:15:07 +0200 +Subject: [PATCH 26/36] Make samsung light HAL more overridable + +--- + .../android/server/lights/LightsService.java | 24 ++++++++++++------- + 1 file changed, 15 insertions(+), 9 deletions(-) + +diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java +index a578ed894c4..ac102c94770 100644 +--- a/services/core/java/com/android/server/lights/LightsService.java ++++ b/services/core/java/com/android/server/lights/LightsService.java +@@ -102,16 +102,22 @@ public class LightsService extends SystemService { + return; + } + +- if(SystemProperties.getInt("persist.sys.phh.samsung_backlight", 0) == 1 || +- fp.matches(".*beyond.*lte.*") || +- fp.matches(".*(crown|star)[q2]*lte.*") || +- fp.matches(".*(SC-0[23]K|SCV3[89]).*")) { +- int newBrightness = brightness * 100; +- if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) { +- newBrightness = (int) (brightness * 40960.0 / 255.0); ++ int useSamsungBacklight = SystemProperties.getInt("persist.sys.phh.samsung_backlight", -1); ++ if(useSamsungBacklight != 0) { ++ if(useSamsungBacklight > 0 || ++ fp.matches(".*beyond.*lte.*") || ++ fp.matches(".*(crown|star)[q2]*lte.*") || ++ fp.matches(".*(SC-0[23]K|SCV3[89]).*")) { ++ int ratio = 100; ++ if(useSamsungBacklight > 1) ++ ratio = useSamsungBacklight; ++ int newBrightness = brightness * ratio; ++ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) { ++ newBrightness = (int) (brightness * 40960.0 / 255.0); ++ } ++ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); ++ return; + } +- setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode); +- return; + } + + boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0027-Make-Samsung-fingerprint-broken-HAL-overridable.patch b/patches/platform_frameworks_base/0027-Make-Samsung-fingerprint-broken-HAL-overridable.patch new file mode 100644 index 0000000..05fb154 --- /dev/null +++ b/patches/platform_frameworks_base/0027-Make-Samsung-fingerprint-broken-HAL-overridable.patch @@ -0,0 +1,29 @@ +From d02ed45de2a9ad381a735ae0649f61dbca1f1d41 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 2 Jul 2019 21:19:29 +0200 +Subject: [PATCH 27/36] Make Samsung fingerprint broken HAL overridable + +Change-Id: I8be38daa7c80fdb61e9209f12215e6daea171d03 +--- + .../server/biometrics/fingerprint/FingerprintService.java | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +index dc56a95217c..19593e7e047 100644 +--- a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java ++++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +@@ -590,8 +590,10 @@ public class FingerprintService extends BiometricServiceBase { + groupId, fingerId, deviceId); + + int remaining2 = remaining; ++ int overrideSamsung = android.os.SystemProperties.getInt("persist.sys.phh.samsung_fingerprint", -1); ++ + String fp = android.os.SystemProperties.get("ro.vendor.build.fingerprint"); +- if(fp != null && (fp.contains("starlte") || fp.contains("star2lte") || fp.contains("starqlte") || fp.contains("star2qlte"))) ++ if(overrideSamsung == 1 || (overrideSamsung != 0 && fp != null && fp.startsWith("samsung/"))) + remaining2 = 100 - remaining2; + + FingerprintService.super.handleEnrollResult(fingerprint, remaining2); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0029-Add-property-to-use-linear-brightness-slider.patch b/patches/platform_frameworks_base/0029-Add-property-to-use-linear-brightness-slider.patch new file mode 100644 index 0000000..2ef720c --- /dev/null +++ b/patches/platform_frameworks_base/0029-Add-property-to-use-linear-brightness-slider.patch @@ -0,0 +1,37 @@ +From 677389d4f112ca9368d55e1eb661727e5974eeb1 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 11 Aug 2019 10:30:37 +0200 +Subject: [PATCH 29/36] Add property to use linear brightness slider + +--- + .../com/android/settingslib/display/BrightnessUtils.java | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java +index 55723f9d8ed..da8ce4a67e9 100644 +--- a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java ++++ b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java +@@ -50,7 +50,12 @@ public class BrightnessUtils { + * @param max The maximum acceptable value for the setting. + * @return The corresponding setting value. + */ ++ private static final boolean useLinearBrightness = android.os.SystemProperties.getBoolean("persist.sys.phh.linear_brightness", false); + public static final int convertGammaToLinear(int val, int min, int max) { ++ if(useLinearBrightness) { ++ if(val < 4) return 1; ++ return val/4; ++ } + final float normalizedVal = MathUtils.norm(0, GAMMA_SPACE_MAX, val); + final float ret; + if (normalizedVal <= R) { +@@ -87,6 +92,7 @@ public class BrightnessUtils { + * @return The corresponding slider value + */ + public static final int convertLinearToGamma(int val, int min, int max) { ++ if(useLinearBrightness) return val*4; + // For some reason, HLG normalizes to the range [0, 12] rather than [0, 1] + final float normalizedVal = MathUtils.norm(min, max, val) * 12; + final float ret; +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0030-Add-support-for-samsung-touch-proximity-sensor-as-fa.patch b/patches/platform_frameworks_base/0030-Add-support-for-samsung-touch-proximity-sensor-as-fa.patch new file mode 100644 index 0000000..833cb5a --- /dev/null +++ b/patches/platform_frameworks_base/0030-Add-support-for-samsung-touch-proximity-sensor-as-fa.patch @@ -0,0 +1,45 @@ +From f93124e38386cc549fa02126c776098923f73ed7 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 12 Aug 2019 23:08:26 +0200 +Subject: [PATCH 30/36] Add support for samsung touch proximity sensor as + fallback to real proximity sensor + +--- + .../server/display/DisplayPowerController.java | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java +index fb381c33cbc..a262c86b7c7 100644 +--- a/services/core/java/com/android/server/display/DisplayPowerController.java ++++ b/services/core/java/com/android/server/display/DisplayPowerController.java +@@ -529,6 +529,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call + + if (!DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT) { + mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); ++ if(mProximitySensor == null) { ++ List sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL); ++ for(Sensor sensor: sensors) { ++ if("com.samsung.sensor.touch_proximity".equals(sensor.getStringType())) ++ mProximitySensor = sensor; ++ } ++ } + if (mProximitySensor != null) { + mProximityThreshold = Math.min(mProximitySensor.getMaximumRange(), + TYPICAL_PROXIMITY_THRESHOLD); +@@ -1944,6 +1951,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call + public void onSensorChanged(SensorEvent event) { + if (mProximitySensorEnabled) { + final long time = SystemClock.uptimeMillis(); ++ if("com.samsung.sensor.touch_proximity".equals(mProximitySensor.getStringType())) { ++ int v = (int)event.values[0]; ++ boolean positive = (v <= 4); ++ android.util.Log.d("PHH", "Samsung sensor changed " + positive + ":" + v); ++ handleProximitySensorEvent(time, positive); ++ return; ++ } + final float distance = event.values[0]; + boolean positive = distance >= 0.0f && distance < mProximityThreshold; + handleProximitySensorEvent(time, positive); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0031-Use-Samsung-power-HAL.patch b/patches/platform_frameworks_base/0031-Use-Samsung-power-HAL.patch new file mode 100644 index 0000000..d9d1d2d --- /dev/null +++ b/patches/platform_frameworks_base/0031-Use-Samsung-power-HAL.patch @@ -0,0 +1,30 @@ +From f852fefd22c754345767a7c3d3024f4f93791a3d Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 14 Aug 2019 08:50:47 +0200 +Subject: [PATCH 31/36] Use Samsung power HAL + +Samsung likes to have two android.hardware.power@1.0 implementation +side-by-side, one that works, one that doesn't. +Pick the one that works. +--- + .../core/jni/com_android_server_power_PowerManagerService.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp +index 73bb579bd27..a211eef3d24 100644 +--- a/services/core/jni/com_android_server_power_PowerManagerService.cpp ++++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp +@@ -92,7 +92,9 @@ static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodNa + // The caller must be holding gPowerHalMutex. + static void connectPowerHalLocked() { + if (gPowerHalExists && gPowerHalV1_0_ == nullptr) { +- gPowerHalV1_0_ = IPowerV1_0::getService(); ++ gPowerHalV1_0_ = IPowerV1_0::getService("miscpower"); ++ if(gPowerHalV1_0_ == nullptr) ++ gPowerHalV1_0_ = IPowerV1_0::getService(); + if (gPowerHalV1_0_ != nullptr) { + ALOGI("Loaded power HAL 1.0 service"); + // Try cast to powerHAL V1_1 +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0032-Also-add-com.samsung.sensor.physical_proximity-if-av.patch b/patches/platform_frameworks_base/0032-Also-add-com.samsung.sensor.physical_proximity-if-av.patch new file mode 100644 index 0000000..56bb92b --- /dev/null +++ b/patches/platform_frameworks_base/0032-Also-add-com.samsung.sensor.physical_proximity-if-av.patch @@ -0,0 +1,31 @@ +From 32ce2b67710daf2e8b81f99a3660210f96d04f3a Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 14 Aug 2019 23:36:45 +0200 +Subject: [PATCH 32/36] Also add com.samsung.sensor.physical_proximity (if + available, it is more a true proximity sensor than touch proximity sensor) + +--- + .../com/android/server/display/DisplayPowerController.java | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java +index a262c86b7c7..7c38f62b256 100644 +--- a/services/core/java/com/android/server/display/DisplayPowerController.java ++++ b/services/core/java/com/android/server/display/DisplayPowerController.java +@@ -529,6 +529,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call + + if (!DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT) { + mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); ++ if(mProximitySensor == null) { ++ List sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL); ++ for(Sensor sensor: sensors) { ++ if("com.samsung.sensor.physical_proximity".equals(sensor.getStringType())) ++ mProximitySensor = sensor; ++ } ++ } + if(mProximitySensor == null) { + List sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL); + for(Sensor sensor: sensors) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0033-wip.patch b/patches/platform_frameworks_base/0033-wip.patch new file mode 100644 index 0000000..aab2d25 --- /dev/null +++ b/patches/platform_frameworks_base/0033-wip.patch @@ -0,0 +1,413 @@ +From b15c825ccb48260a85695db41aff138787d1817f Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 24 Mar 2019 22:48:39 +0100 +Subject: [PATCH] wip + +Change-Id: I50fa9a7a670cef5b93fc4a3a027f1587b1214831 +--- + Android.bp | 2 + + services/core/Android.bp | 1 + + .../biometrics/fingerprint/FacolaView.java | 210 ++++++++++++++++++ + .../fingerprint/FingerprintService.java | 26 ++- + .../testharness/TestHarnessModeService.java | 7 +- + .../com/android/server/wm/ActivityRecord.java | 6 - + ...om_android_server_lights_LightsService.cpp | 15 +- + 7 files changed, 255 insertions(+), 12 deletions(-) + create mode 100644 services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java + +diff --git a/Android.bp b/Android.bp +index 16abdbf79de..d01dc639c8f 100644 +--- a/Android.bp ++++ b/Android.bp +@@ -777,6 +777,8 @@ java_defaults { + "android.hardware.vibrator-V1.2-java", + "android.hardware.vibrator-V1.3-java", + "android.hardware.wifi-V1.0-java-constants", ++ "vendor.mediatek.hardware.radio-V2.0-java", ++ "vendor.samsung.hardware.radio-V1.2-java", + "devicepolicyprotosnano", + ], + +diff --git a/services/core/Android.bp b/services/core/Android.bp +index ee26710cf7b..2e7118da1c0 100644 +--- a/services/core/Android.bp ++++ b/services/core/Android.bp +@@ -55,6 +55,7 @@ java_library_static { + "dnsresolver_aidl_interface-V2-java", + "netd_aidl_interface-V2-java", + "netd_event_listener_interface-java", ++ "vendor.xiaomi.hardware.fingerprintextension-V1.0-java", + ], + } + +diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java +new file mode 100644 +index 00000000000..8829bcb7e48 +--- /dev/null ++++ b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java +@@ -0,0 +1,210 @@ ++/** ++ * Copyright (C) 2019 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++package com.android.server.biometrics.fingerprint; ++ ++import android.graphics.Canvas; ++import android.graphics.Color; ++import android.graphics.Paint; ++import android.content.Context; ++import android.view.View.OnTouchListener; ++import android.view.View; ++import android.widget.ImageView; ++import android.view.MotionEvent; ++import android.util.Slog; ++ ++import android.view.WindowManager; ++import android.graphics.PixelFormat; ++import android.view.Gravity; ++ ++import java.io.PrintWriter; ++ ++import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint; ++ ++import android.os.Handler; ++import android.os.HandlerThread; ++import android.os.ServiceManager; ++ ++public class FacolaView extends ImageView implements OnTouchListener { ++ private final int mX, mY, mW, mH; ++ private final Paint mPaintFingerprint = new Paint(); ++ private final Paint mPaintShow = new Paint(); ++ private IXiaomiFingerprint mXiaomiFingerprint = null; ++ private boolean mInsideCircle = false; ++ private final WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); ++ ++ private final static float UNTOUCHED_DIM = .1f; ++ private final static float TOUCHED_DIM = .9f; ++ ++ private final HandlerThread mHandlerThread; ++ private final Handler mHandler; ++ ++ private final WindowManager mWM; ++ FacolaView(Context context) { ++ super(context); ++ ++ mHandlerThread = new HandlerThread("FacolaThread"); ++ mHandlerThread.start(); ++ mHandler = new Handler(mHandlerThread.getLooper()); ++ ++ String[] location = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.location.X_Y", "").split(","); ++ String[] size = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.size.width_height", "").split(","); ++ Slog.d("PHH-Enroll", "FacolaView hello"); ++ if(size.length == 2 && location.length == 2) { ++ Slog.d("PHH-Enroll", "Got real values"); ++ mX = Integer.parseInt(location[0]); ++ mY = Integer.parseInt(location[1]); ++ mW = Integer.parseInt(size[0]); ++ mH = Integer.parseInt(size[1]); ++ } else { ++ mX = -1; ++ mY = -1; ++ mW = -1; ++ mH = -1; ++ } ++ ++ mPaintFingerprint.setAntiAlias(true); ++ mPaintFingerprint.setColor(Color.GREEN); ++ ++ mPaintShow.setAntiAlias(true); ++ mPaintShow.setColor(Color.argb(0x18, 0x00, 0xff, 0x00)); ++ setOnTouchListener(this); ++ mWM = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); ++ Slog.d("PHH-Enroll", "Created facola..."); ++ try { ++ if(mW != -1) ++ mXiaomiFingerprint = IXiaomiFingerprint.getService(); ++ } catch(Exception e) { ++ Slog.d("PHH-Enroll", "Failed getting xiaomi fingerprint service", e); ++ } ++ } ++ ++ @Override ++ protected void onDraw(Canvas canvas) { ++ super.onDraw(canvas); ++ ++ Slog.d("PHH-Enroll", "Drawing at " + mX + ", " + mY + ", " + mW + ", " + mH); ++ //TODO w!=h? ++ if(mInsideCircle) { ++ try { ++ int nitValue = 3; ++ if(mXiaomiFingerprint != null) ++ mXiaomiFingerprint.extCmd(0xa, nitValue); ++ } catch(Exception e) { ++ Slog.d("PHH-Enroll", "Failed calling xiaomi fp extcmd"); ++ } ++ ++ canvas.drawCircle(mW/2, mH/2, (float) (mW/2.0f), this.mPaintFingerprint); ++ } else { ++ try { ++ if(mXiaomiFingerprint != null) ++ mXiaomiFingerprint.extCmd(0xa, 0); ++ } catch(Exception e) { ++ Slog.d("PHH-Enroll", "Failed calling xiaomi fp extcmd"); ++ } ++ canvas.drawCircle(mW/2, mH/2, (float) (mW/2.0f), this.mPaintShow); ++ } ++ } ++ ++ @Override ++ public boolean onTouch(View v, MotionEvent event) { ++ float x = event.getAxisValue(MotionEvent.AXIS_X); ++ float y = event.getAxisValue(MotionEvent.AXIS_Y); ++ ++ boolean newInside = (x > 0 && x < mW) && (y > 0 && y < mW); ++ if(event.getAction() == MotionEvent.ACTION_UP) ++ newInside = false; ++ ++ Slog.d("PHH-Enroll", "Got action " + event.getAction() + ", x = " + x + ", y = " + y + ", inside = " + mInsideCircle + "/" + newInside); ++ if(newInside == mInsideCircle) return mInsideCircle; ++ mInsideCircle = newInside; ++ ++ invalidate(); ++ ++ if(!mInsideCircle) { ++ mParams.screenBrightness = .0f; ++ mParams.dimAmount = UNTOUCHED_DIM; ++ mWM.updateViewLayout(this, mParams); ++ return false; ++ } ++ ++ mParams.dimAmount = TOUCHED_DIM; ++ mParams.screenBrightness = 1.0f; ++ mWM.updateViewLayout(this, mParams); ++ ++ return true; ++ } ++ ++ public void show() { ++ Slog.d("PHH-Enroll", "Show", new Exception()); ++ if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return; ++ ++ try { ++ PrintWriter writer = new PrintWriter("/sys/devices/virtual/touch/tp_dev/fod_status", "UTF-8"); ++ writer.println("1"); ++ writer.close(); ++ } catch(Exception e) { ++ Slog.d("PHH-Enroll", "Failed setting fod status for touchscreen"); ++ } ++ ++ mParams.x = mX; ++ mParams.y = mY; ++ ++ mParams.height = mW; ++ mParams.width = mH; ++ mParams.format = PixelFormat.TRANSLUCENT; ++ ++ mParams.type = WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; ++ mParams.setTitle("Fingerprint on display"); ++ mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | ++ WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | ++ WindowManager.LayoutParams.FLAG_DIM_BEHIND | ++ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; ++ mParams.dimAmount = UNTOUCHED_DIM; ++ ++ mParams.packageName = "android"; ++ ++ mParams.gravity = Gravity.TOP | Gravity.LEFT; ++ mHandler.post( () -> { ++ mWM.addView(this, mParams); ++ }); ++ ++ } ++ ++ public void hide() { ++ Slog.d("PHH-Enroll", "Hide", new Exception()); ++ if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return; ++ ++ try { ++ if(mXiaomiFingerprint != null) ++ mXiaomiFingerprint.extCmd(0xa, 0); ++ } catch(Exception e) { ++ Slog.d("PHH-Enroll", "Failed calling xiaomi fp extcmd"); ++ } ++ try { ++ PrintWriter writer = new PrintWriter("/sys/devices/virtual/touch/tp_dev/fod_status", "UTF-8"); ++ writer.println("0"); ++ writer.close(); ++ } catch(Exception e) { ++ Slog.d("PHH-Enroll", "Failed setting fod status for touchscreen"); ++ } ++ ++ Slog.d("PHH-Enroll", "Removed facola"); ++ mHandler.post( () -> { ++ mWM.removeView(this); ++ }); ++ } ++} +diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +index 19593e7e047..c7de87126e8 100644 +--- a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java ++++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +@@ -120,8 +120,10 @@ public class FingerprintService extends BiometricServiceBase { + } + } + } ++ private FacolaView mFacola; + + private final class FingerprintAuthClient extends AuthenticationClientImpl { ++ + @Override + protected boolean isFingerprint() { + return true; +@@ -170,6 +172,26 @@ public class FingerprintService extends BiometricServiceBase { + + return super.handleFailedAttempt(); + } ++ ++ @Override ++ public boolean onAcquired(int acquiredInfo, int vendorCode) { ++ boolean result = super.onAcquired(acquiredInfo, vendorCode); ++ android.util.Log.d("PHH-Enroll", "acquired ret " + result); ++ if(result) mFacola.hide(); ++ return result; ++ } ++ ++ @Override ++ public int start() { ++ mFacola.show(); ++ return super.start(); ++ } ++ ++ @Override ++ public int stop(boolean initiatedByClient) { ++ mFacola.hide(); ++ return super.stop(initiatedByClient); ++ } + } + + /** +@@ -180,7 +202,6 @@ public class FingerprintService extends BiometricServiceBase { + /** + * The following methods contain common code which is shared in biometrics/common. + */ +- + @Override // Binder call + public long preEnroll(IBinder token) { + checkPermission(MANAGE_FINGERPRINT); +@@ -725,6 +746,7 @@ public class FingerprintService extends BiometricServiceBase { + mAlarmManager = context.getSystemService(AlarmManager.class); + context.registerReceiver(mLockoutReceiver, new IntentFilter(getLockoutResetIntent()), + getLockoutBroadcastPermission(), null /* handler */); ++ mFacola = new FacolaView(context); + } + + @Override +@@ -952,6 +974,7 @@ public class FingerprintService extends BiometricServiceBase { + Slog.w(TAG, "startPreEnroll: no fingerprint HAL!"); + return 0; + } ++ mFacola.show(); + try { + return daemon.preEnroll(); + } catch (RemoteException e) { +@@ -966,6 +989,7 @@ public class FingerprintService extends BiometricServiceBase { + Slog.w(TAG, "startPostEnroll: no fingerprint HAL!"); + return 0; + } ++ mFacola.hide(); + try { + return daemon.postEnroll(); + } catch (RemoteException e) { +diff --git a/services/core/java/com/android/server/testharness/TestHarnessModeService.java b/services/core/java/com/android/server/testharness/TestHarnessModeService.java +index fcf87ee2a4b..0aa948417c1 100644 +--- a/services/core/java/com/android/server/testharness/TestHarnessModeService.java ++++ b/services/core/java/com/android/server/testharness/TestHarnessModeService.java +@@ -150,7 +150,12 @@ public class TestHarnessModeService extends SystemService { + + "PersistentDataBlockManagerInternal was bound!"); + return null; + } +- byte[] testHarnessModeData = blockManager.getTestHarnessModeData(); ++ byte[] testHarnessModeData = null; ++ try { ++ testHarnessModeData = blockManager.getTestHarnessModeData(); ++ } catch(Exception e) { ++ Slog.e(TAG, "Failed to read block for test harness", e); ++ } + if (testHarnessModeData == null || testHarnessModeData.length == 0) { + // There's no data to apply, so leave it as-is. + return null; +diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java +index 479babc4c7d..1f972dd4918 100644 +--- a/services/core/java/com/android/server/wm/ActivityRecord.java ++++ b/services/core/java/com/android/server/wm/ActivityRecord.java +@@ -2833,12 +2833,6 @@ final class ActivityRecord extends ConfigurationContainer { + // TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer. + private void updateOverrideConfiguration() { + final Configuration overrideConfig = mTmpConfig; +- if(info.applicationInfo.targetSdkVersion < O) { +- try { +- maxAspectRatio = Float.parseFloat(SystemProperties.get("persist.sys.max_aspect_ratio.pre_o", "")); +- } catch (Throwable t) {} +- Log.d("PHH", "Overrode aspect ratio because pre-o to " + maxAspectRatio); +- } + if (shouldUseSizeCompatMode()) { + if (mCompatDisplayInsets != null) { + // The override configuration is set only once in size compatibility mode. +diff --git a/services/core/jni/com_android_server_lights_LightsService.cpp b/services/core/jni/com_android_server_lights_LightsService.cpp +index 20de7985d1d..2b50d04233e 100644 +--- a/services/core/jni/com_android_server_lights_LightsService.cpp ++++ b/services/core/jni/com_android_server_lights_LightsService.cpp +@@ -46,6 +46,9 @@ using ISecLight = ::vendor::samsung::hardware::light::V2_0::ISecLight; + using SecType = ::vendor::samsung::hardware::light::V2_0::SecType; + static bool sLightSupported = true; + ++static sp sSecHal; ++static bool sSecTried = false; ++ + static bool validate(jint light, jint flash, jint brightness) { + bool valid = true; + +@@ -155,20 +158,24 @@ static void setLight_native( + colorAlpha = (colorAlpha * brightnessLevel) / 0xFF; + colorARGB = (colorAlpha << 24) + (colorARGB & 0x00FFFFFF); + } +- +- sp secHal = ISecLight::getService(); + +- if(secHal != nullptr) { ++ if(!sSecTried) { ++ sSecHal = ISecLight::getService(); ++ sSecTried = true; ++ } ++ ++ if(sSecHal != nullptr) { + SecType type = static_cast(light); + LightState state = constructState( + colorARGB, flashMode, onMS, offMS, brightnessMode); + + { + android::base::Timer t; +- Return ret = secHal->setLightSec(type, state); ++ Return ret = sSecHal->setLightSec(type, state); + processReturn(ret, static_cast(light), state); + if (t.duration() > 50ms) ALOGD("Excessive delay setting light"); + } ++ return; + } + + Type type = static_cast(light); +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0034-User-statsd-incidentd-arent-known-to-init-8.0.-disab.patch b/patches/platform_frameworks_base/0034-User-statsd-incidentd-arent-known-to-init-8.0.-disab.patch new file mode 100644 index 0000000..df3fd6e --- /dev/null +++ b/patches/platform_frameworks_base/0034-User-statsd-incidentd-arent-known-to-init-8.0.-disab.patch @@ -0,0 +1,65 @@ +From 8167bee50010c872b82a2183e0ac17779b6b565e Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 12 Aug 2019 23:10:21 +0200 +Subject: [PATCH 34/36] User statsd/incidentd arent known to init 8.0. disable + those services + +Change-Id: I074654e194f764ffbc6961ff0ae304e36a9b5d1e +--- + cmds/incidentd/incidentd.rc | 10 +++++----- + cmds/statsd/statsd.rc | 18 +++++++++--------- + 2 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/cmds/incidentd/incidentd.rc b/cmds/incidentd/incidentd.rc +index 9c16a1c52e8..cc20c936fda 100644 +--- a/cmds/incidentd/incidentd.rc ++++ b/cmds/incidentd/incidentd.rc +@@ -12,11 +12,11 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-service incidentd /system/bin/incidentd +- class main +- user incidentd +- group incidentd log readproc +- capabilities KILL SYS_PTRACE ++#service incidentd /system/bin/incidentd ++# class main ++# user incidentd ++# group incidentd log readproc ++# capabilities KILL SYS_PTRACE + + on post-fs-data + # Create directory for incidentd +diff --git a/cmds/statsd/statsd.rc b/cmds/statsd/statsd.rc +index a98ecd586b4..564cf98d0a9 100644 +--- a/cmds/statsd/statsd.rc ++++ b/cmds/statsd/statsd.rc +@@ -12,15 +12,15 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-service statsd /system/bin/statsd +- class main +- socket statsdw dgram+passcred 0222 statsd statsd +- user statsd +- group statsd log +- writepid /dev/cpuset/system-background/tasks +- +-on property:ro.statsd.enable=false +- stop statsd ++#service statsd /system/bin/statsd ++# class main ++# socket statsdw dgram+passcred 0222 statsd statsd ++# user statsd ++# group statsd log ++# writepid /dev/cpuset/system-background/tasks ++# ++#on property:ro.statsd.enable=false ++# stop statsd + + on post-fs-data + # Create directory for statsd +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0035-Check-for-samsung-light-service-everytime.patch b/patches/platform_frameworks_base/0035-Check-for-samsung-light-service-everytime.patch new file mode 100644 index 0000000..0a9a4e8 --- /dev/null +++ b/patches/platform_frameworks_base/0035-Check-for-samsung-light-service-everytime.patch @@ -0,0 +1,31 @@ +From e73eb752f04a301bb4195a40ef3d73be5bb705d6 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 20:38:08 +0200 +Subject: [PATCH 35/36] Check for samsung light service everytime + +This is needed because it is possible sec light service isn't ready at +that time. +TODO: check that the services exists at all, so that this is done only +on Samsung devices + +Change-Id: I30f049f3b06f83c455301b589b3558ff384ec300 +--- + services/core/jni/com_android_server_lights_LightsService.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/services/core/jni/com_android_server_lights_LightsService.cpp b/services/core/jni/com_android_server_lights_LightsService.cpp +index bea321da890..75793a7c0f2 100644 +--- a/services/core/jni/com_android_server_lights_LightsService.cpp ++++ b/services/core/jni/com_android_server_lights_LightsService.cpp +@@ -150,7 +150,7 @@ static void setLight_native( + + if(!sSecTried) { + sSecHal = ISecLight::getService(); +- sSecTried = true; ++ //sSecTried = true; + } + + if(sSecHal != nullptr) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0036-Forawrdport-Samsung-fod-support-for-ultrasound-fp.patch b/patches/platform_frameworks_base/0036-Forawrdport-Samsung-fod-support-for-ultrasound-fp.patch new file mode 100644 index 0000000..a5927b3 --- /dev/null +++ b/patches/platform_frameworks_base/0036-Forawrdport-Samsung-fod-support-for-ultrasound-fp.patch @@ -0,0 +1,121 @@ +From f2c2a6a4707dde7f62d29aa5b204d96f9693e0e0 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 20:39:50 +0200 +Subject: [PATCH 36/36] Forawrdport Samsung "fod" support for ultrasound fp + +Change-Id: I9f787a01dab922cd94f9e552a6f3f53a00ca8448 +--- + .../biometrics/fingerprint/FacolaView.java | 61 ++++++++++++++++++- + 1 file changed, 58 insertions(+), 3 deletions(-) + +diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java +index 8829bcb7e48..f61582990cf 100644 +--- a/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java ++++ b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java +@@ -30,6 +30,9 @@ import android.view.WindowManager; + import android.graphics.PixelFormat; + import android.view.Gravity; + ++import java.io.BufferedReader; ++import java.io.File; ++import java.io.FileReader; + import java.io.PrintWriter; + + import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint; +@@ -53,9 +56,12 @@ public class FacolaView extends ImageView implements OnTouchListener { + private final Handler mHandler; + + private final WindowManager mWM; ++ private final boolean samsungFod = samsungHasCmd("fod_enable"); + FacolaView(Context context) { + super(context); + ++ android.util.Log.d("PHH", "Samsung FOD " + samsungFod); ++ + mHandlerThread = new HandlerThread("FacolaThread"); + mHandlerThread.start(); + mHandler = new Handler(mHandlerThread.getLooper()); +@@ -64,7 +70,7 @@ public class FacolaView extends ImageView implements OnTouchListener { + String[] size = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.size.width_height", "").split(","); + Slog.d("PHH-Enroll", "FacolaView hello"); + if(size.length == 2 && location.length == 2) { +- Slog.d("PHH-Enroll", "Got real values"); ++ Slog.d("PHH-Enroll", "Got real values"); + mX = Integer.parseInt(location[0]); + mY = Integer.parseInt(location[1]); + mW = Integer.parseInt(size[0]); +@@ -149,7 +155,10 @@ public class FacolaView extends ImageView implements OnTouchListener { + } + + public void show() { +- Slog.d("PHH-Enroll", "Show", new Exception()); ++ Slog.d("PHH-Enroll", "Show", new Exception()); ++ if(samsungFod) { ++ samsungCmd("fod_enable,1,1"); ++ } + if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return; + + try { +@@ -185,7 +194,10 @@ public class FacolaView extends ImageView implements OnTouchListener { + } + + public void hide() { +- Slog.d("PHH-Enroll", "Hide", new Exception()); ++ Slog.d("PHH-Enroll", "Hide", new Exception()); ++ if(samsungFod) { ++ samsungCmd("fod_enable,0"); ++ } + if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return; + + try { +@@ -207,4 +219,47 @@ public class FacolaView extends ImageView implements OnTouchListener { + mWM.removeView(this); + }); + } ++ ++ private static boolean samsungHasCmd(String cmd) { ++ try { ++ File f = new File("/sys/devices/virtual/sec/tsp/cmd_list"); ++ if(!f.exists()) return false; ++ ++ BufferedReader b = new BufferedReader(new FileReader(f)); ++ String line = null; ++ while( (line = b.readLine()) != null) { ++ if(line.equals(cmd)) return true; ++ } ++ return false; ++ } catch(Exception e) { ++ return false; ++ } ++ } ++ ++ private static String readFile(String path) { ++ try { ++ File f = new File(path); ++ ++ BufferedReader b = new BufferedReader(new FileReader(f)); ++ return b.readLine(); ++ } catch(Exception e) { ++ return null; ++ } ++ } ++ ++ private static void samsungCmd(String cmd) { ++ try { ++ PrintWriter writer = new PrintWriter("/sys/devices/virtual/sec/tsp/cmd", "UTF-8"); ++ writer.println(cmd); ++ writer.close(); ++ ++ String status = readFile("/sys/devices/virtual/sec/tsp/cmd_status"); ++ String ret = readFile("/sys/devices/virtual/sec/tsp/cmd_result"); ++ ++ android.util.Log.d("PHH", "Sending command " + cmd + " returned " + ret + ":" + status); ++ } catch(Exception e) { ++ android.util.Log.d("PHH", "Failed sending command " + cmd, e); ++ } ++ } ++ + } +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0037-Scan-system-overlay-and-fix-support-for-properties-i.patch b/patches/platform_frameworks_base/0037-Scan-system-overlay-and-fix-support-for-properties-i.patch new file mode 100644 index 0000000..77a3792 --- /dev/null +++ b/patches/platform_frameworks_base/0037-Scan-system-overlay-and-fix-support-for-properties-i.patch @@ -0,0 +1,166 @@ +From f1e202e71f6ab47a1870aa91e65d8c777770b88d Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 14 Oct 2019 23:50:46 +0200 +Subject: [PATCH 37/38] Scan /system/overlay and fix support for properties in + idmap2 + +Change-Id: Ic04b5b1cc7b5d8cee67b1e2fdaa8aa793546b6d6 +--- + cmds/idmap2/idmap2/Scan.cpp | 6 ++++- + cmds/idmap2/include/idmap2/ResourceUtils.h | 3 +++ + cmds/idmap2/libidmap2/ResourceUtils.cpp | 26 +++++++++++++++++++ + .../android/content/pm/PackageParser.java | 9 ++++++- + core/jni/android_util_AssetManager.cpp | 3 +++ + .../server/pm/PackageManagerService.java | 6 +++++ + 6 files changed, 51 insertions(+), 2 deletions(-) + +diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp +index cfac5f31e2e..adac1ef88cf 100644 +--- a/cmds/idmap2/idmap2/Scan.cpp ++++ b/cmds/idmap2/idmap2/Scan.cpp +@@ -159,13 +159,17 @@ Result Scan(const std::vector& args) { + Result overlay_info = + ExtractOverlayManifestInfo(path, /* assert_overlay */ false); + if (!overlay_info) { +- return overlay_info.GetError(); ++ continue; + } + + if (!overlay_info->is_static) { + continue; + } + ++ if (!overlay_info->property_match) { ++ continue; ++ } ++ + if (overlay_info->target_package.empty() || + overlay_info->target_package != target_package_name) { + continue; +diff --git a/cmds/idmap2/include/idmap2/ResourceUtils.h b/cmds/idmap2/include/idmap2/ResourceUtils.h +index 8797a788dd1..0f98f4d1a2d 100644 +--- a/cmds/idmap2/include/idmap2/ResourceUtils.h ++++ b/cmds/idmap2/include/idmap2/ResourceUtils.h +@@ -30,6 +30,9 @@ namespace android::idmap2::utils { + struct OverlayManifestInfo { + std::string target_package; // NOLINT(misc-non-private-member-variables-in-classes) + std::string target_name; // NOLINT(misc-non-private-member-variables-in-classes) ++ std::string property_name; // NOLINT(misc-non-private-member-variables-in-classes) ++ std::string property_value; // NOLINT(misc-non-private-member-variables-in-classes) ++ bool property_match; // NOLINT(misc-non-private-member-variables-in-classes) + bool is_static; // NOLINT(misc-non-private-member-variables-in-classes) + int priority = -1; // NOLINT(misc-non-private-member-variables-in-classes) + }; +diff --git a/cmds/idmap2/libidmap2/ResourceUtils.cpp b/cmds/idmap2/libidmap2/ResourceUtils.cpp +index 71ba3f0f1ac..7fda402b80f 100644 +--- a/cmds/idmap2/libidmap2/ResourceUtils.cpp ++++ b/cmds/idmap2/libidmap2/ResourceUtils.cpp +@@ -18,7 +18,9 @@ + + #include + #include ++#include + ++#include "android-base/properties.h" + #include "androidfw/StringPiece.h" + #include "androidfw/Util.h" + #include "idmap2/Result.h" +@@ -93,6 +95,30 @@ Result ExtractOverlayManifestInfo(const std::string& path, + info.target_name = iter->second; + } + ++ iter = tag->find("requiredSystemPropertyName"); ++ if (iter != tag->end()) { ++ info.property_name = iter->second; ++ } ++ ++ iter = tag->find("requiredSystemPropertyValue"); ++ if (iter != tag->end()) { ++ info.property_value = iter->second; ++ } ++ ++ info.property_match = false; ++ if(!info.property_name.empty() && !info.property_value.empty()) { ++ std::string prop = android::base::GetProperty(info.property_name, ""); ++ if(info.property_value == prop) { ++ info.property_match = true; ++ } ++ if(info.property_value[0] == '+') { ++ info.property_match = ++ fnmatch(info.property_value.c_str()+1, prop.c_str(), 0) == 0; ++ } ++ } else { ++ info.property_match = true; ++ } ++ + iter = tag->find("isStatic"); + if (iter != tag->end()) { + info.is_static = std::stoul(iter->second) != 0U; +diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java +index b3776787cc2..2147cc61728 100644 +--- a/core/java/android/content/pm/PackageParser.java ++++ b/core/java/android/content/pm/PackageParser.java +@@ -1353,6 +1353,7 @@ public class PackageParser { + } catch (PackageParserException e) { + throw e; + } catch (Exception e) { ++ android.util.Log.d("PHH", "failed reading manifest because of", e); + throw new PackageParserException(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION, + "Failed to read manifest from " + apkPath, e); + } finally { +@@ -1392,6 +1393,7 @@ public class PackageParser { + } catch (PackageParserException e) { + throw e; + } catch (Exception e) { ++ android.util.Log.d("PHH", "failed reading manifest because of", e); + throw new PackageParserException(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION, + "Failed to read manifest from " + apkPath, e); + } finally { +@@ -2556,7 +2558,12 @@ public class PackageParser { + + // check property value - make sure it is both set and equal to expected value + final String currValue = SystemProperties.get(propName); +- return (currValue != null && currValue.equals(propValue)); ++ if(propValue.charAt(0) == '+') { ++ String valRegexp = propValue.replace("*", ".*").substring(1); ++ return currValue != null && currValue.matches(valRegexp); ++ } else { ++ return (currValue != null && currValue.equals(propValue)); ++ } + } + + /** +diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp +index 4518c7e66a5..9e1b6db9ad9 100644 +--- a/core/jni/android_util_AssetManager.cpp ++++ b/core/jni/android_util_AssetManager.cpp +@@ -233,6 +233,9 @@ static jobjectArray NativeCreateIdmapsForStaticOverlaysTargetingAndroid(JNIEnv* + // --input-directory can be given multiple times, but idmap2 expects the directory to exist + std::vector input_dirs; + struct stat st; ++ if (stat("/system/overlay", &st) == 0) { ++ input_dirs.push_back("/system/overlay"); ++ } + if (stat(AssetManager::VENDOR_OVERLAY_DIR, &st) == 0) { + input_dirs.push_back(AssetManager::VENDOR_OVERLAY_DIR); + } +diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java +index 7469e099421..203eb793610 100644 +--- a/services/core/java/com/android/server/pm/PackageManagerService.java ++++ b/services/core/java/com/android/server/pm/PackageManagerService.java +@@ -2608,6 +2608,12 @@ public class PackageManagerService extends IPackageManager.Stub + // any apps.) + // For security and version matching reason, only consider overlay packages if they + // reside in the right directory. ++ scanDirTracedLI(new File("/system/overlay"), ++ mDefParseFlags ++ | PackageParser.PARSE_IS_SYSTEM_DIR, ++ scanFlags ++ | SCAN_AS_SYSTEM, ++ 0); + scanDirTracedLI(new File(VENDOR_OVERLAY_DIR), + mDefParseFlags + | PackageParser.PARSE_IS_SYSTEM_DIR, +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0038-Improve-FacolaView-life-cycle-though-it-is-still-mis.patch b/patches/platform_frameworks_base/0038-Improve-FacolaView-life-cycle-though-it-is-still-mis.patch new file mode 100644 index 0000000..7709698 --- /dev/null +++ b/patches/platform_frameworks_base/0038-Improve-FacolaView-life-cycle-though-it-is-still-mis.patch @@ -0,0 +1,97 @@ +From 9bba3cbb885f9917c120bfc7f072002f9e8cd4ed Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 22 Oct 2019 00:33:23 +0200 +Subject: [PATCH 38/38] Improve FacolaView life cycle, though it is still + missing few cases. It might require to change BiometricServiceBase for actual + fix + +Change-Id: Ida96f8aca360c23cd5535f0ee92fd77dada2ebec +--- + .../server/biometrics/fingerprint/FacolaView.java | 9 ++++++++- + .../biometrics/fingerprint/FingerprintService.java | 14 ++++++++++++++ + 2 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java +index f61582990cf..4ff373a108d 100644 +--- a/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java ++++ b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java +@@ -57,6 +57,8 @@ public class FacolaView extends ImageView implements OnTouchListener { + + private final WindowManager mWM; + private final boolean samsungFod = samsungHasCmd("fod_enable"); ++ ++ private boolean mHidden = true; + FacolaView(Context context) { + super(context); + +@@ -106,7 +108,7 @@ public class FacolaView extends ImageView implements OnTouchListener { + //TODO w!=h? + if(mInsideCircle) { + try { +- int nitValue = 3; ++ int nitValue = 2; + if(mXiaomiFingerprint != null) + mXiaomiFingerprint.extCmd(0xa, nitValue); + } catch(Exception e) { +@@ -156,6 +158,8 @@ public class FacolaView extends ImageView implements OnTouchListener { + + public void show() { + Slog.d("PHH-Enroll", "Show", new Exception()); ++ if(!mHidden) return; ++ mHidden = false; + if(samsungFod) { + samsungCmd("fod_enable,1,1"); + } +@@ -194,7 +198,10 @@ public class FacolaView extends ImageView implements OnTouchListener { + } + + public void hide() { ++ mInsideCircle = false; + Slog.d("PHH-Enroll", "Hide", new Exception()); ++ if(mHidden) return; ++ mHidden = true; + if(samsungFod) { + samsungCmd("fod_enable,0"); + } +diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +index c7de87126e8..972b4703860 100644 +--- a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java ++++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +@@ -181,6 +181,16 @@ public class FingerprintService extends BiometricServiceBase { + return result; + } + ++ @Override ++ public boolean onAuthenticated(BiometricAuthenticator.Identifier identifier, ++ boolean authenticated, ArrayList token) { ++ boolean result = super.onAuthenticated(identifier, authenticated, token); ++ android.util.Log.d("PHH-Enroll", "auth-ed ret " + result); ++ if(result) mFacola.hide(); ++ return result; ++ } ++ ++ + @Override + public int start() { + mFacola.show(); +@@ -219,6 +229,7 @@ public class FingerprintService extends BiometricServiceBase { + final IFingerprintServiceReceiver receiver, final int flags, + final String opPackageName) { + checkPermission(MANAGE_FINGERPRINT); ++ mFacola.show(); + + final boolean restricted = isRestricted(); + final int groupId = userId; // default group for fingerprint enrollment +@@ -641,6 +652,9 @@ public class FingerprintService extends BiometricServiceBase { + public void onError(final long deviceId, final int error, final int vendorCode) { + mHandler.post(() -> { + FingerprintService.super.handleError(deviceId, error, vendorCode); ++ if ( error == BiometricConstants.BIOMETRIC_ERROR_CANCELED) { ++ mFacola.hide(); ++ } + // TODO: this chunk of code should be common to all biometric services + if (error == BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE) { + // If we get HW_UNAVAILABLE, try to connect again later... +-- +2.17.1 + diff --git a/patches/platform_frameworks_base/0039-Link-hwui-with-libbase-because-of-updated-skia-depen.patch b/patches/platform_frameworks_base/0039-Link-hwui-with-libbase-because-of-updated-skia-depen.patch new file mode 100644 index 0000000..2d86dfa --- /dev/null +++ b/patches/platform_frameworks_base/0039-Link-hwui-with-libbase-because-of-updated-skia-depen.patch @@ -0,0 +1,26 @@ +From 12005c0b0a7f7e9c33bd8cf79ffaee609c43dafb Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 22 Oct 2019 15:31:54 +0200 +Subject: [PATCH 39/39] Link hwui with libbase, because of updated skia + dependency + +Change-Id: I201df2cd8f66674948b56fb6d5be5e8c3cb48bd1 +--- + libs/hwui/Android.bp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp +index ebba4cb79df..b9808751130 100644 +--- a/libs/hwui/Android.bp ++++ b/libs/hwui/Android.bp +@@ -70,6 +70,7 @@ cc_defaults { + "libandroidfw", + "libcrypto", + "libsync", ++ "libbase", + ], + static_libs: [ + "libEGL_blobCache", +-- +2.17.1 + diff --git a/patches/platform_frameworks_native/0001-AOSP-8.0-8.1-didn-t-use-presentOrValidate-so-it-s-br.patch b/patches/platform_frameworks_native/0001-AOSP-8.0-8.1-didn-t-use-presentOrValidate-so-it-s-br.patch new file mode 100644 index 0000000..05fd342 --- /dev/null +++ b/patches/platform_frameworks_native/0001-AOSP-8.0-8.1-didn-t-use-presentOrValidate-so-it-s-br.patch @@ -0,0 +1,27 @@ +From 0ce8e40182af9c1955a862f8bba608b90e6a0524 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 21:01:35 +0200 +Subject: [PATCH 1/5] AOSP 8.0/8.1 didn't use presentOrValidate, so it's + broken. Don't use it + +Change-Id: If86793dba3738680280f9dc0f7e7c802c0836690 +--- + services/surfaceflinger/DisplayHardware/HWComposer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp +index 1099041b4..2021c26b0 100644 +--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp ++++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp +@@ -424,7 +424,7 @@ status_t HWComposer::prepare(DisplayId displayId, const compositionengine::Outpu + // The check below is incorrect. We actually rely on HWC here to fall + // back to validate when there is any client layer. + displayData.validateWasSkipped = false; +- if (!displayData.hasClientComposition) { ++ if ((false)) { + sp outPresentFence; + uint32_t state = UINT32_MAX; + error = hwcDisplay->presentOrValidate(&numTypes, &numRequests, &outPresentFence , &state); +-- +2.17.1 + diff --git a/patches/platform_frameworks_native/0002-Ignore-usage-bits-verification.patch b/patches/platform_frameworks_native/0002-Ignore-usage-bits-verification.patch new file mode 100644 index 0000000..af737e7 --- /dev/null +++ b/patches/platform_frameworks_native/0002-Ignore-usage-bits-verification.patch @@ -0,0 +1,28 @@ +From d51e5d5a041f8404b5d62cfca5f5765588ded4fb Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 19 Aug 2018 23:07:24 +0200 +Subject: [PATCH 2/5] Ignore usage bits verification + +This didn't ignore as of 8.1, so we're ""safe"" + +Change-Id: I40c1d588c1fa104d844322b469f76e52bee1495a +--- + libs/ui/Gralloc2.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp +index 5dc453005..90dc90f39 100644 +--- a/libs/ui/Gralloc2.cpp ++++ b/libs/ui/Gralloc2.cpp +@@ -108,7 +108,7 @@ status_t Gralloc2Mapper::validateBufferDescriptorInfo( + if (descriptorInfo->usage & ~validUsageBits) { + ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64, + descriptorInfo->usage & ~validUsageBits); +- return BAD_VALUE; ++ //return BAD_VALUE; + } + return NO_ERROR; + } +-- +2.17.1 + diff --git a/patches/platform_frameworks_native/0003-Enable-fallback-to-old-ro.sf.hwrotation-property.patch b/patches/platform_frameworks_native/0003-Enable-fallback-to-old-ro.sf.hwrotation-property.patch new file mode 100644 index 0000000..f024283 --- /dev/null +++ b/patches/platform_frameworks_native/0003-Enable-fallback-to-old-ro.sf.hwrotation-property.patch @@ -0,0 +1,43 @@ +From 8db7e963f05ebc59298cf8e9b74f98d670ec5742 Mon Sep 17 00:00:00 2001 +From: phh +Date: Wed, 22 Aug 2018 08:57:52 +0000 +Subject: [PATCH 3/5] Enable fallback to old ro.sf.hwrotation property + +Change-Id: I46b75a15b85fc5bda31357a4beeb7dab77bd6fe1 +--- + services/surfaceflinger/SurfaceFlinger.cpp | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp +index 6166789fc..14ca4729c 100644 +--- a/services/surfaceflinger/SurfaceFlinger.cpp ++++ b/services/surfaceflinger/SurfaceFlinger.cpp +@@ -329,7 +329,25 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI + SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientationDefault; + break; + } ++ + ALOGV("Primary Display Orientation is set to %2d.", SurfaceFlinger::primaryDisplayOrientation); ++ if(tmpPrimaryDisplayOrientation == SurfaceFlingerProperties::primary_display_orientation_values::ORIENTATION_0) { ++ int sfRotation = property_get_int32("ro.sf.hwrotation", -1); ++ switch(sfRotation) { ++ case 0: ++ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientationDefault; ++ break; ++ case 90: ++ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation90; ++ break; ++ case 180: ++ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation180; ++ break; ++ case 270: ++ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation270; ++ break; ++ } ++ } + + mInternalDisplayPrimaries = sysprop::getDisplayNativePrimaries(); + +-- +2.17.1 + diff --git a/patches/platform_frameworks_native/0004-Some-Samsung-devices-requires-lying-colorspace.patch b/patches/platform_frameworks_native/0004-Some-Samsung-devices-requires-lying-colorspace.patch new file mode 100644 index 0000000..2c7afcd --- /dev/null +++ b/patches/platform_frameworks_native/0004-Some-Samsung-devices-requires-lying-colorspace.patch @@ -0,0 +1,32 @@ +From c554242731125a5e6a3f7d31d4f4af9049d8c7f4 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 12 Aug 2019 23:48:37 +0200 +Subject: [PATCH 4/5] Some Samsung devices requires lying colorspace + +Change-Id: I4153b8e7abc10c519565e4e4386c6388621477b2 +--- + opengl/libs/EGL/egl_platform_entries.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp +index e996be685..57ca592a7 100644 +--- a/opengl/libs/EGL/egl_platform_entries.cpp ++++ b/opengl/libs/EGL/egl_platform_entries.cpp +@@ -458,8 +458,14 @@ EGLBoolean eglGetConfigAttribImpl(EGLDisplay dpy, EGLConfig config, + // ---------------------------------------------------------------------------- + + // Translates EGL color spaces to Android data spaces. ++static int samsungColorspace = -1; + static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace) { ++ if(samsungColorspace == -1) { ++ samsungColorspace = property_get_bool("persist.sys.phh.samsung_colorspace", false); ++ } + if (colorspace == EGL_GL_COLORSPACE_LINEAR_KHR) { ++ if(samsungColorspace) ++ return HAL_DATASPACE_UNKNOWN; + return HAL_DATASPACE_UNKNOWN; + } else if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) { + return HAL_DATASPACE_V0_SRGB; +-- +2.17.1 + diff --git a/patches/platform_frameworks_native/0005-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch b/patches/platform_frameworks_native/0005-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch new file mode 100644 index 0000000..144dd9d --- /dev/null +++ b/patches/platform_frameworks_native/0005-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch @@ -0,0 +1,37 @@ +From fd7365352954e1ab647fca2eefeaa2707d47f7fa Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 14 Aug 2019 23:37:10 +0200 +Subject: [PATCH 5/5] On Samsung, we need to send a hack-message to HAL to get + all Sensors + +Change-Id: Id6a1fa48340de61c418493668e9abd22c2599376 +--- + services/sensorservice/SensorDevice.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp +index 717f31769..45d6c679b 100644 +--- a/services/sensorservice/SensorDevice.cpp ++++ b/services/sensorservice/SensorDevice.cpp +@@ -30,7 +30,9 @@ + #include + #include + ++#include + using namespace android::hardware::sensors; ++ + using namespace android::hardware::sensors::V1_0; + using namespace android::hardware::sensors::V1_0::implementation; + using android::hardware::sensors::V2_0::ISensorsCallback; +@@ -115,6 +117,8 @@ SensorDevice::SensorDevice() + void SensorDevice::initializeSensorList() { + float minPowerMa = 0.001; // 1 microAmp + ++ if(::android::base::GetBoolProperty("persist.sys.phh.samsung_sensors", false)) ++ setMode(5555); + checkReturn(mSensors->getSensorsList( + [&](const auto &list) { + const size_t count = list.size(); +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_net_wifi/0001-Revert-SupplicantManager-Remove-ensure_config_file_e.patch b/patches/platform_frameworks_opt_net_wifi/0001-Revert-SupplicantManager-Remove-ensure_config_file_e.patch new file mode 100644 index 0000000..e1dd13e --- /dev/null +++ b/patches/platform_frameworks_opt_net_wifi/0001-Revert-SupplicantManager-Remove-ensure_config_file_e.patch @@ -0,0 +1,130 @@ +From d5a9fce16e57c2dfbc090190b0ed99f833f9842b Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 16:59:12 +0200 +Subject: [PATCH 1/4] Revert "SupplicantManager: Remove + |ensure_config_file_exists|" + +This reverts commit f61dc8cd7dadda5741d6e4a1bb6b576ba89cc24b. +--- + libwifi_system/supplicant_manager.cpp | 97 +++++++++++++++++++++++++++ + 1 file changed, 97 insertions(+) + +diff --git a/libwifi_system/supplicant_manager.cpp b/libwifi_system/supplicant_manager.cpp +index 60720d40f..f22eea92e 100644 +--- a/libwifi_system/supplicant_manager.cpp ++++ b/libwifi_system/supplicant_manager.cpp +@@ -33,7 +33,89 @@ namespace wifi_system { + namespace { + + const char kSupplicantInitProperty[] = "init.svc.wpa_supplicant"; ++const char kSupplicantConfigTemplatePath[] = ++ "/etc/wifi/wpa_supplicant.conf"; ++const char kSupplicantConfigFile[] = "/data/misc/wifi/wpa_supplicant.conf"; ++const char kP2pConfigFile[] = "/data/misc/wifi/p2p_supplicant.conf"; + const char kSupplicantServiceName[] = "wpa_supplicant"; ++constexpr mode_t kConfigFileMode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; ++ ++int ensure_config_file_exists(const char* config_file) { ++ char buf[2048]; ++ int srcfd, destfd; ++ int nread; ++ int ret; ++ std::string templatePath; ++ ++ ret = access(config_file, R_OK | W_OK); ++ if ((ret == 0) || (errno == EACCES)) { ++ if ((ret != 0) && (chmod(config_file, kConfigFileMode) != 0)) { ++ LOG(ERROR) << "Cannot set RW to \"" << config_file << "\": " ++ << strerror(errno); ++ return false; ++ } ++ return true; ++ } else if (errno != ENOENT) { ++ LOG(ERROR) << "Cannot access \"" << config_file << "\": " ++ << strerror(errno); ++ return false; ++ } ++ ++ std::string configPathSystem = ++ std::string("/system") + std::string(kSupplicantConfigTemplatePath); ++ std::string configPathVendor = ++ std::string("/vendor") + std::string(kSupplicantConfigTemplatePath); ++ srcfd = TEMP_FAILURE_RETRY(open(configPathSystem.c_str(), O_RDONLY)); ++ templatePath = configPathSystem; ++ if (srcfd < 0) { ++ int errnoSystem = errno; ++ srcfd = TEMP_FAILURE_RETRY(open(configPathVendor.c_str(), O_RDONLY)); ++ templatePath = configPathVendor; ++ if (srcfd < 0) { ++ int errnoVendor = errno; ++ LOG(ERROR) << "Cannot open \"" << configPathSystem << "\": " ++ << strerror(errnoSystem); ++ LOG(ERROR) << "Cannot open \"" << configPathVendor << "\": " ++ << strerror(errnoVendor); ++ return false; ++ } ++ } ++ ++ destfd = TEMP_FAILURE_RETRY(open(config_file, ++ O_CREAT | O_RDWR, ++ kConfigFileMode)); ++ if (destfd < 0) { ++ close(srcfd); ++ LOG(ERROR) << "Cannot create \"" << config_file << "\": " ++ << strerror(errno); ++ return false; ++ } ++ ++ while ((nread = TEMP_FAILURE_RETRY(read(srcfd, buf, sizeof(buf)))) != 0) { ++ if (nread < 0) { ++ LOG(ERROR) << "Error reading \"" << templatePath ++ << "\": " << strerror(errno); ++ close(srcfd); ++ close(destfd); ++ unlink(config_file); ++ return false; ++ } ++ TEMP_FAILURE_RETRY(write(destfd, buf, nread)); ++ } ++ ++ close(destfd); ++ close(srcfd); ++ ++ /* chmod is needed because open() didn't set permisions properly */ ++ if (chmod(config_file, kConfigFileMode) < 0) { ++ LOG(ERROR) << "Error changing permissions of " << config_file ++ << " to 0660: " << strerror(errno); ++ unlink(config_file); ++ return false; ++ } ++ ++ return true; ++} + + } // namespace + +@@ -49,6 +131,21 @@ bool SupplicantManager::StartSupplicant() { + return true; + } + ++ /* Before starting the daemon, make sure its config file exists */ ++ if (ensure_config_file_exists(kSupplicantConfigFile) < 0) { ++ LOG(ERROR) << "Wi-Fi will not be enabled"; ++ return false; ++ } ++ ++ /* ++ * Some devices have another configuration file for the p2p interface. ++ * However, not all devices have this, and we'll let it slide if it ++ * is missing. For devices that do expect this file to exist, ++ * supplicant will refuse to start and emit a good error message. ++ * No need to check for it here. ++ */ ++ (void)ensure_config_file_exists(kP2pConfigFile); ++ + /* + * Get a reference to the status property, so we can distinguish + * the case where it goes stopped => running => stopped (i.e., +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_net_wifi/0002-Support-hostap-on-O-O-MR1-vendors.patch b/patches/platform_frameworks_opt_net_wifi/0002-Support-hostap-on-O-O-MR1-vendors.patch new file mode 100644 index 0000000..6eeb4da --- /dev/null +++ b/patches/platform_frameworks_opt_net_wifi/0002-Support-hostap-on-O-O-MR1-vendors.patch @@ -0,0 +1,94 @@ +From 5e4a56c542339de718992bdfeeb0a72ec5cd4d98 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 18 Sep 2018 17:05:07 +0200 +Subject: [PATCH 2/4] Support hostap on O/O-MR1 vendors + +Two issues are fixed here: +- some vendor HALs lied (because of Android behaviour) about ap interface name. +O/O-MR1 behaviour meant hostap/sta had same interface. So "wlan0" sound +quite a good guess +- doing multiple configureChip in one IWifi session wasn't allowed. +Now, it is a requirement to be supported, so most(all?) HALs don't +support it. force stop/start for every reconfiguration +--- + .../android/server/wifi/HalDeviceManager.java | 22 +++++++++++++++++-- + .../com/android/server/wifi/WifiNative.java | 15 ++++++++++++- + 2 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java +index bb53a6e88..612bd48b8 100644 +--- a/service/java/com/android/server/wifi/HalDeviceManager.java ++++ b/service/java/com/android/server/wifi/HalDeviceManager.java +@@ -63,8 +63,8 @@ import java.util.Set; + */ + public class HalDeviceManager { + private static final String TAG = "HalDevMgr"; +- private static final boolean VDBG = false; +- private boolean mDbg = false; ++ private static final boolean VDBG = true; ++ private boolean mDbg = true; + + private static final int START_HAL_RETRY_INTERVAL_MS = 20; + // Number of attempts a start() is re-tried. A value of 0 means no retries after a single +@@ -226,6 +226,16 @@ public class HalDeviceManager { + */ + public IWifiStaIface createStaIface(boolean lowPrioritySta, + @Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler) { ++ //As of O and O-MR1, configureChip MUST BE after a startWifi ++ //Pie changed this to allow dynamic configureChip ++ //No O/O-MR1 HAL support that, so restart wifi HAL when we do that ++ if(android.os.SystemProperties.getInt("persist.sys.vndk", 28) < 28) { ++ Log.e(TAG, "createStaIface: Stopping wifi"); ++ stopWifi(); ++ Log.e(TAG, "createStaIface: Starting wifi"); ++ startWifi(); ++ Log.e(TAG, "createStaIface: Creating iface"); ++ } + return (IWifiStaIface) createIface(IfaceType.STA, lowPrioritySta, destroyedListener, + handler); + } +@@ -235,6 +245,14 @@ public class HalDeviceManager { + */ + public IWifiApIface createApIface(@Nullable InterfaceDestroyedListener destroyedListener, + @Nullable Handler handler) { ++ //cf createStaIface ++ if(android.os.SystemProperties.getInt("persist.sys.vndk", 28) < 28) { ++ Log.e(TAG, "createApIface: Stopping wifi"); ++ stopWifi(); ++ Log.e(TAG, "createApIface: Starting wifi"); ++ startWifi(); ++ Log.e(TAG, "createApIface: Creating iface"); ++ } + return (IWifiApIface) createIface(IfaceType.AP, false, destroyedListener, handler); + } + +diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java +index 3e5dc3c79..63907e67c 100644 +--- a/service/java/com/android/server/wifi/WifiNative.java ++++ b/service/java/com/android/server/wifi/WifiNative.java +@@ -769,8 +769,21 @@ public class WifiNative { + private String createApIface(@NonNull Iface iface) { + synchronized (mLock) { + if (mWifiVendorHal.isVendorHalSupported()) { +- return mWifiVendorHal.createApIface( ++ String ret = mWifiVendorHal.createApIface( + new InterfaceDestoyedListenerInternal(iface.id)); ++ //In O and O-MR1, there was only ONE wifi interface for everything (sta and ap) ++ //Most vendors used "wlan0" for those interfaces, but there is no guarantee ++ //This override exists here, because most OEMs return "ap0" when doing createApIface, ++ //even when the iface is actually called "wlan0" ++ // ++ //To be perfectly clean, we should check what value createStaIface (would have) returned ++ //and use the same one. ++ //That's overly complicated, so let's assume this is wlan0 for the moment ++ if(android.os.SystemProperties.getInt("persist.sys.vndk", 28) < 28) { ++ ret = "wlan0"; ++ } ++ ++ return ret; + } else { + Log.i(TAG, "Vendor Hal not supported, ignoring createApIface."); + return handleIfaceCreationWhenVendorHalNotSupported(iface); +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_net_wifi/0003-Restore-O-O-MR1-behaviour-of-initing-ifaces-before-s.patch b/patches/platform_frameworks_opt_net_wifi/0003-Restore-O-O-MR1-behaviour-of-initing-ifaces-before-s.patch new file mode 100644 index 0000000..31118fd --- /dev/null +++ b/patches/platform_frameworks_opt_net_wifi/0003-Restore-O-O-MR1-behaviour-of-initing-ifaces-before-s.patch @@ -0,0 +1,94 @@ +From e9e35f0091a58a51c21aaa46e52764578c85a5b4 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 16 Sep 2019 17:42:37 +0200 +Subject: [PATCH 3/4] Restore O/O-MR1 behaviour of initing ifaces before supp. + Still not perfect, because wifi can be turned on only once + +Change-Id: I7a94b3c4a3fca140a50962e6787af3a7aa2c7d61 +--- + .../server/wifi/SupplicantStaIfaceHal.java | 4 ++-- + .../java/com/android/server/wifi/WifiNative.java | 16 ++++++++++++++-- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +index bed66d926..fda64e977 100644 +--- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java ++++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +@@ -717,7 +717,7 @@ public class SupplicantStaIfaceHal { + * the device. + * @return true if supported, false otherwise. + */ +- private boolean isV1_1() { ++ /* package */ boolean isV1_1() { + return checkHalVersionByInterfaceName( + android.hardware.wifi.supplicant.V1_1.ISupplicant.kInterfaceName); + } +@@ -727,7 +727,7 @@ public class SupplicantStaIfaceHal { + * the device. + * @return true if supported, false otherwise. + */ +- private boolean isV1_2() { ++ /* package */ boolean isV1_2() { + return checkHalVersionByInterfaceName( + android.hardware.wifi.supplicant.V1_2.ISupplicant.kInterfaceName); + } +diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java +index 63907e67c..917494a10 100644 +--- a/service/java/com/android/server/wifi/WifiNative.java ++++ b/service/java/com/android/server/wifi/WifiNative.java +@@ -370,9 +370,11 @@ public class WifiNative { + } + + /** Helper method invoked to start supplicant if there were no STA ifaces */ ++ private boolean supplicantOn = false; + private boolean startSupplicant() { + synchronized (mLock) { +- if (!mIfaceMgr.hasAnyStaIfaceForConnectivity()) { ++ boolean prePieWifi = !mSupplicantStaIfaceHal.isV1_2(); ++ if (!mIfaceMgr.hasAnyStaIfaceForConnectivity() || (prePieWifi && !supplicantOn)) { + if (!startAndWaitForSupplicantConnection()) { + Log.e(TAG, "Failed to connect to supplicant"); + return false; +@@ -382,6 +384,8 @@ public class WifiNative { + Log.e(TAG, "Failed to register supplicant death handler"); + return false; + } ++ ++ supplicantOn = true; + } + return true; + } +@@ -395,6 +399,7 @@ public class WifiNative { + Log.e(TAG, "Failed to deregister supplicant death handler"); + } + mSupplicantStaIfaceHal.terminate(); ++ supplicantOn = false; + } + } + } +@@ -941,7 +946,9 @@ public class WifiNative { + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToHal(); + return null; + } +- if (!startSupplicant()) { ++ boolean prePieWifi = !mSupplicantStaIfaceHal.isV1_2(); ++ ++ if (!prePieWifi && !startSupplicant()) { + Log.e(TAG, "Failed to start supplicant"); + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant(); + return null; +@@ -965,6 +972,11 @@ public class WifiNative { + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToWificond(); + return null; + } ++ if (prePieWifi && !startSupplicant()) { ++ Log.e(TAG, "Failed to start supplicant"); ++ mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant(); ++ return null; ++ } + if (!mSupplicantStaIfaceHal.setupIface(iface.name)) { + Log.e(TAG, "Failed to setup iface in supplicant on " + iface); + teardownInterface(iface.name); +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_net_wifi/0004-Boot-wifi-supplicant-both-with-lazy-hal-style-and-in.patch b/patches/platform_frameworks_opt_net_wifi/0004-Boot-wifi-supplicant-both-with-lazy-hal-style-and-in.patch new file mode 100644 index 0000000..54049af --- /dev/null +++ b/patches/platform_frameworks_opt_net_wifi/0004-Boot-wifi-supplicant-both-with-lazy-hal-style-and-in.patch @@ -0,0 +1,33 @@ +From 77792728f07c8a1f9dbd9c2e2532138b2e06d8e3 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 16 Sep 2019 22:47:37 +0200 +Subject: [PATCH 4/4] Boot wifi supplicant both with lazy-hal style and init + style + +Change-Id: I7e23348d4d16d3787f2c80bce3f8d0178dd5c4c7 +--- + .../java/com/android/server/wifi/SupplicantStaIfaceHal.java | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +index fda64e977..2b98557e9 100644 +--- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java ++++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +@@ -616,12 +616,12 @@ public class SupplicantStaIfaceHal { + */ + public boolean startDaemon() { + synchronized (mLock) { ++ Log.i(TAG, "Starting supplicant using init"); ++ mPropertyService.set(INIT_START_PROPERTY, INIT_SERVICE_NAME); + if (isV1_1()) { + Log.i(TAG, "Starting supplicant using HIDL"); + return startDaemon_V1_1(); + } else { +- Log.i(TAG, "Starting supplicant using init"); +- mPropertyService.set(INIT_START_PROPERTY, INIT_SERVICE_NAME); + return true; + } + } +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_telephony/0001-Add-route-to-gateway-on-null-netmask.patch b/patches/platform_frameworks_opt_telephony/0001-Add-route-to-gateway-on-null-netmask.patch new file mode 100644 index 0000000..28866db --- /dev/null +++ b/patches/platform_frameworks_opt_telephony/0001-Add-route-to-gateway-on-null-netmask.patch @@ -0,0 +1,50 @@ +From 60d9333099db6587acd48b896d37e9e949fa95dc Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 16 Aug 2018 22:12:46 +0200 +Subject: [PATCH 1/6] Add route to gateway on null netmask + +Galaxy S9 returns empty prefix + +Change-Id: I8133da8e8f5203666684100009ba658528a02e94 +--- + .../dataconnection/DataConnection.java | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/src/java/com/android/internal/telephony/dataconnection/DataConnection.java b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java +index 20ccee8c9..f39d01809 100644 +--- a/src/java/com/android/internal/telephony/dataconnection/DataConnection.java ++++ b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java +@@ -24,6 +24,7 @@ import android.annotation.Nullable; + import android.app.PendingIntent; + import android.net.ConnectivityManager; + import android.net.KeepalivePacketData; ++import android.net.IpPrefix; + import android.net.LinkAddress; + import android.net.LinkProperties; + import android.net.NetworkCapabilities; +@@ -1393,6 +1394,22 @@ public class DataConnection extends StateMachine { + } + + for (InetAddress gateway : response.getGatewayAddresses()) { ++ if(response.getAddresses().size()>0) { ++ //TODO: ++ // - IPv6 ++ // - Multiple addresses ++ // - Check for non-trivial prefix length ++ LinkAddress la = response.getAddresses().get(0); ++ if(la.getNetworkPrefixLength() == 32 && ++ gateway instanceof java.net.Inet4Address) { ++ if(!gateway.isAnyLocalAddress()) { ++ linkProperties.addRoute(new RouteInfo( ++ new IpPrefix(gateway, 32), ++ InetAddress.getByName("0.0.0.0"), ++ response.getInterfaceName())); ++ } ++ } ++ } + // Allow 0.0.0.0 or :: as a gateway; + // this indicates a point-to-point interface. + linkProperties.addRoute(new RouteInfo(gateway)); +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_telephony/0002-Telephony-Don-not-call-onUssdRelease-for-Huawei-RIL.patch b/patches/platform_frameworks_opt_telephony/0002-Telephony-Don-not-call-onUssdRelease-for-Huawei-RIL.patch new file mode 100644 index 0000000..6a29087 --- /dev/null +++ b/patches/platform_frameworks_opt_telephony/0002-Telephony-Don-not-call-onUssdRelease-for-Huawei-RIL.patch @@ -0,0 +1,34 @@ +From e66ddf44169f3dda57d01a9dd5aded920bdc80a9 Mon Sep 17 00:00:00 2001 +From: Artem Borisov +Date: Sat, 10 Nov 2018 17:19:17 +0000 +Subject: [PATCH 2/6] Telephony: Don not call onUssdRelease for Huawei RIL + +Huawei RIL doesn't seem to work properly with USSD_MODE_NW_RELEASE, +always releasing USSD when it should be finished instead. +Let's explicitly call onUssdFinished in this case. + +Change-Id: I69faed1c51d4582834879975d6ab13daf7f48ad4 +--- + src/java/com/android/internal/telephony/GsmCdmaPhone.java | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java +index 6e539f0ae..14a322747 100644 +--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java ++++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java +@@ -2313,7 +2313,11 @@ public class GsmCdmaPhone extends Phone { + // Complete pending USSD + + if (isUssdRelease) { +- found.onUssdRelease(); ++ if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) { ++ found.onUssdFinished(ussdMessage, isUssdRequest); ++ } else { ++ found.onUssdRelease(); ++ } + } else if (isUssdError) { + found.onUssdFinishedError(); + } else { +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_telephony/0003-Make-MAX_CONNECTIONS_GSM-settable-from-property.patch b/patches/platform_frameworks_opt_telephony/0003-Make-MAX_CONNECTIONS_GSM-settable-from-property.patch new file mode 100644 index 0000000..faade13 --- /dev/null +++ b/patches/platform_frameworks_opt_telephony/0003-Make-MAX_CONNECTIONS_GSM-settable-from-property.patch @@ -0,0 +1,28 @@ +From e67dac2c25d6a64230a866566fbc2636b2f73bc6 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Fri, 28 Dec 2018 13:06:32 +0100 +Subject: [PATCH 3/6] Make MAX_CONNECTIONS_GSM settable from property + +cf https://github.com/phhusson/treble_experimentations/issues/110 + +Change-Id: I5df755535aa5ded704d4c33122d63ac2481bd5f6 +--- + src/java/com/android/internal/telephony/GsmCdmaCallTracker.java | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java b/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java +index 0a7acee57..aca129308 100755 +--- a/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java ++++ b/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java +@@ -64,7 +64,7 @@ public class GsmCdmaCallTracker extends CallTracker { + + //***** Constants + +- public static final int MAX_CONNECTIONS_GSM = 19; //7 allowed in GSM + 12 from IMS for SRVCC ++ public static final int MAX_CONNECTIONS_GSM = android.os.SystemProperties.getInt("persist.sys.phh.radio.max_connections_gsm", 19); //7 allowed in GSM + 12 from IMS for SRVCC + private static final int MAX_CONNECTIONS_PER_CALL_GSM = 5; //only 5 connections allowed per call + + private static final int MAX_CONNECTIONS_CDMA = 8; +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_telephony/0004-Choose-a-more-generic-prop.patch b/patches/platform_frameworks_opt_telephony/0004-Choose-a-more-generic-prop.patch new file mode 100644 index 0000000..237843f --- /dev/null +++ b/patches/platform_frameworks_opt_telephony/0004-Choose-a-more-generic-prop.patch @@ -0,0 +1,28 @@ +From 21952419962b9a642a5312e8258039bbbb5f893b Mon Sep 17 00:00:00 2001 +From: Dil3mm4 +Date: Sat, 17 Nov 2018 18:18:42 +0000 +Subject: [PATCH 4/6] Choose a more generic prop. + +Since USSD it's a problem over MTK too and not only on Kirin, let's be more generic. + +Change-Id: Icf1700f55be40915f9c64059019287f300d81405 +--- + src/java/com/android/internal/telephony/GsmCdmaPhone.java | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java +index 14a322747..8359a3858 100644 +--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java ++++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java +@@ -2313,7 +2313,7 @@ public class GsmCdmaPhone extends Phone { + // Complete pending USSD + + if (isUssdRelease) { +- if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) { ++ if (SystemProperties.getBoolean("persist.sys.radio.ussd.fix", false)) { + found.onUssdFinished(ussdMessage, isUssdRequest); + } else { + found.onUssdRelease(); +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_telephony/0005-Reverse-engineer-MTK-IRadio-interfaces-to-approve-in.patch b/patches/platform_frameworks_opt_telephony/0005-Reverse-engineer-MTK-IRadio-interfaces-to-approve-in.patch new file mode 100644 index 0000000..1db59d5 --- /dev/null +++ b/patches/platform_frameworks_opt_telephony/0005-Reverse-engineer-MTK-IRadio-interfaces-to-approve-in.patch @@ -0,0 +1,1604 @@ +From acb8e3866e2c08c13fa3a111be911eee65c1cdbf Mon Sep 17 00:00:00 2001 +From: Bevis Tseng +Date: Thu, 18 Apr 2019 16:30:45 +0800 +Subject: [PATCH] Reverse-engineer MTK IRadio interfaces to approve incoming + call for MTK devices from Telephony F/W. + +This is an alternative solution of 's/AT+EAIC=2/AT+EAIC=3/g' in device/phh/treble/rw-system.sh +which is not workable on some MTK devices such as Nokia 1. +Make sure that the solution in `rw-system.sh` is reversed if this alternative is applied. + +Here is the reason of each API to be reverse-engineered in this patch: +1. IRadio::setResponseFunctionsMtk(): + - To register callbacks of MTK-extended radio indications and responses. +2. IRadioIndication::incomingCallIndication(): + - To receive the indication of the incoming call to be approved. +3. IRadio::setCallIndication() | + IRadioResponse::setCallIndicationResponse(): + - To approve each the incoming call reported from incomingCallIndication(). +4. IRadioResponse::setupDataCallResponseEx() | + IRadioResponse::getDataCallListResponseEx() | + IRadioIndication::dataCallListChangedEx(): + - These callbacks are MTK's replacements of the following AOSP callbacks: + setupDataCallResponse(), getDataCallListResponse(), dataCallListChanged() if + MTK-specific implementation is registered via IRadio::setResponseFunctionsMtk(). + - To make sure that data connections are workable after fixing the incoming call issues, + we have to implement these methods additionally to forward the responses to the replaced ones defined by AOSP. + +Change-Id: I35d29f0f2ebc4abf8678bd59c2d97a257fac1b29 +--- + Android.bp | 1 + + .../telephony/MtkRadioIndication.java | 481 +++++++++ + .../internal/telephony/MtkRadioResponse.java | 984 ++++++++++++++++++ + .../com/android/internal/telephony/RIL.java | 38 + + .../internal/telephony/RadioResponse.java | 2 +- + 5 files changed, 1505 insertions(+), 1 deletion(-) + create mode 100644 src/java/com/android/internal/telephony/MtkRadioIndication.java + create mode 100644 src/java/com/android/internal/telephony/MtkRadioResponse.java + +diff --git a/Android.bp b/Android.bp +index d1a89377b..ae678cb54 100644 +--- a/Android.bp ++++ b/Android.bp +@@ -55,6 +55,7 @@ java_library { + "android.hardware.radio-V1.2-java", + "android.hardware.radio-V1.3-java", + "android.hardware.radio-V1.4-java", ++ "vendor.mediatek.hardware.radio-V2.0-java", + "voip-common", + "ims-common", + "services", +diff --git a/src/java/com/android/internal/telephony/MtkRadioIndication.java b/src/java/com/android/internal/telephony/MtkRadioIndication.java +new file mode 100644 +index 000000000..8d6963be7 +--- /dev/null ++++ b/src/java/com/android/internal/telephony/MtkRadioIndication.java +@@ -0,0 +1,481 @@ ++package com.android.internal.telephony; ++ ++import android.hardware.radio.V1_0.SetupDataCallResult; ++ ++import java.util.ArrayList; ++ ++import vendor.mediatek.hardware.radio.V2_0.IRadioIndication; ++import vendor.mediatek.hardware.radio.V2_0.IncomingCallNotification; ++import vendor.mediatek.hardware.radio.V2_0.MtkSetupDataCallResult; ++ ++public class MtkRadioIndication extends IRadioIndication.Stub { ++ RIL mRil; ++ RadioIndication mIndication; ++ ++ MtkRadioIndication(RIL ril, RadioIndication indication) { ++ mRil = ril; ++ mIndication = indication; ++ } ++ ++ //++ Radio V1_0 ++ public void radioStateChanged(int type, int radioState) { ++ mIndication.radioStateChanged(type, radioState); ++ } ++ ++ public void callStateChanged(int type) { ++ mIndication.callStateChanged(type); ++ } ++ ++ public void networkStateChanged(int type) { ++ mIndication.networkStateChanged(type); ++ } ++ ++ public void newSms(int type, ArrayList pdu) { ++ mIndication.newSms(type, pdu); ++ } ++ ++ public void newSmsStatusReport(int type, ArrayList pdu) { ++ mIndication.newSmsStatusReport(type, pdu); ++ } ++ ++ public void newSmsOnSim(int type, int recordNumber) { ++ mIndication.newSmsOnSim(type, recordNumber); ++ } ++ ++ public void onUssd(int type, int modeType, String msg) { ++ mIndication.onUssd(type, modeType, msg); ++ } ++ ++ public void nitzTimeReceived(int type, String nitzTime, long receivedTime) { ++ mIndication.nitzTimeReceived(type, nitzTime, receivedTime); ++ } ++ ++ public void currentSignalStrength(int type, android.hardware.radio.V1_0.SignalStrength signalStrength) { ++ mIndication.currentSignalStrength(type, signalStrength); ++ } ++ ++ public void dataCallListChanged(int type, ArrayList dcList) { ++ mIndication.dataCallListChanged(type, dcList); ++ } ++ ++ public void suppSvcNotify(int type, android.hardware.radio.V1_0.SuppSvcNotification suppSvc) { ++ mIndication.suppSvcNotify(type, suppSvc); ++ } ++ ++ public void stkSessionEnd(int type) { ++ mIndication.stkSessionEnd(type); ++ } ++ ++ public void stkProactiveCommand(int type, String cmd) { ++ mIndication.stkProactiveCommand(type, cmd); ++ } ++ ++ public void stkEventNotify(int type, String cmd) { ++ mIndication.stkEventNotify(type, cmd); ++ } ++ ++ public void stkCallSetup(int type, long timeout) { ++ mIndication.stkCallSetup(type, timeout); ++ } ++ ++ public void simSmsStorageFull(int type) { ++ mIndication.simSmsStorageFull(type); ++ } ++ ++ public void simRefresh(int type, android.hardware.radio.V1_0.SimRefreshResult refreshResult) { ++ mIndication.simRefresh(type, refreshResult); ++ } ++ ++ public void callRing(int type, boolean isGsm, android.hardware.radio.V1_0.CdmaSignalInfoRecord record) { ++ mIndication.callRing(type, isGsm, record); ++ } ++ ++ public void simStatusChanged(int type) { ++ mIndication.simStatusChanged(type); ++ } ++ ++ public void cdmaNewSms(int type, android.hardware.radio.V1_0.CdmaSmsMessage msg) { ++ mIndication.cdmaNewSms(type, msg); ++ } ++ ++ public void newBroadcastSms(int type, ArrayList data) { ++ mIndication.newBroadcastSms(type, data); ++ } ++ ++ public void cdmaRuimSmsStorageFull(int type) { ++ mIndication.cdmaRuimSmsStorageFull(type); ++ } ++ ++ public void restrictedStateChanged(int type, int state) { ++ mIndication.restrictedStateChanged(type, state); ++ } ++ ++ public void enterEmergencyCallbackMode(int type) { ++ mIndication.enterEmergencyCallbackMode(type); ++ } ++ ++ public void cdmaCallWaiting(int type, android.hardware.radio.V1_0.CdmaCallWaiting callWaitingRecord) { ++ mIndication.cdmaCallWaiting(type, callWaitingRecord); ++ } ++ ++ public void cdmaOtaProvisionStatus(int type, int status) { ++ mIndication.cdmaOtaProvisionStatus(type, status); ++ } ++ ++ public void cdmaInfoRec(int type, android.hardware.radio.V1_0.CdmaInformationRecords records) { ++ mIndication.cdmaInfoRec(type, records); ++ } ++ ++ public void indicateRingbackTone(int type, boolean start) { ++ mIndication.indicateRingbackTone(type, start); ++ } ++ ++ public void resendIncallMute(int type) { ++ mIndication.resendIncallMute(type); ++ } ++ ++ public void cdmaSubscriptionSourceChanged(int type, int cdmaSource) { ++ mIndication.cdmaSubscriptionSourceChanged(type, cdmaSource); ++ } ++ ++ public void cdmaPrlChanged(int type, int version) { ++ mIndication.cdmaPrlChanged(type, version); ++ } ++ ++ public void exitEmergencyCallbackMode(int type) { ++ mIndication.exitEmergencyCallbackMode(type); ++ } ++ ++ public void rilConnected(int type) { ++ mIndication.rilConnected(type); ++ } ++ ++ public void voiceRadioTechChanged(int type, int rat) { ++ mIndication.voiceRadioTechChanged(type, rat); ++ } ++ ++ public void cellInfoList(int type, ArrayList records) { ++ mIndication.cellInfoList(type, records); ++ } ++ ++ public void imsNetworkStateChanged(int type) { ++ mIndication.imsNetworkStateChanged(type); ++ } ++ ++ public void subscriptionStatusChanged(int type, boolean activate) { ++ mIndication.subscriptionStatusChanged(type, activate); ++ } ++ ++ public void srvccStateNotify(int type, int state) { ++ mIndication.srvccStateNotify(type, state); ++ } ++ ++ public void hardwareConfigChanged(int type, ArrayList configs) { ++ mIndication.hardwareConfigChanged(type, configs); ++ } ++ ++ public void radioCapabilityIndication(int type, android.hardware.radio.V1_0.RadioCapability rc) { ++ mIndication.radioCapabilityIndication(type, rc); ++ } ++ ++ public void onSupplementaryServiceIndication(int type, android.hardware.radio.V1_0.StkCcUnsolSsResult ss) { ++ mIndication.onSupplementaryServiceIndication(type, ss); ++ } ++ ++ public void stkCallControlAlphaNotify(int type, String alpha) { ++ mIndication.stkCallControlAlphaNotify(type, alpha); ++ } ++ ++ public void lceData(int type, android.hardware.radio.V1_0.LceDataInfo lce) { ++ mIndication.lceData(type, lce); ++ } ++ ++ public void pcoData(int type, android.hardware.radio.V1_0.PcoDataInfo pco) { ++ mIndication.pcoData(type, pco); ++ } ++ ++ public void modemReset(int type, String reason) { ++ mIndication.modemReset(type, reason); ++ } ++ //-- Radio V1_0 ++ ++ //++ Radio V1_1 ++ public void carrierInfoForImsiEncryption(int type) { ++ mIndication.carrierInfoForImsiEncryption(type); ++ } ++ ++ public void networkScanResult(int type, android.hardware.radio.V1_1.NetworkScanResult result) { ++ mIndication.networkScanResult(type, result); ++ } ++ ++ public void keepaliveStatus(int type, android.hardware.radio.V1_1.KeepaliveStatus status) { ++ mIndication.keepaliveStatus(type, status); ++ } ++ ++ //-- Radio V1_1 ++ ++ //++ MTK Radio V2_0 ++ public void incomingCallIndication(int indicationType, IncomingCallNotification notification) { ++ mRil.processIndication(indicationType); ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< incomingCallIndication"); ++ mRil.setCallIndication( ++ Integer.parseInt(notification.callId), Integer.parseInt(notification.seqNo)); ++ } ++ ++ public void cipherIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< cipherIndication not implemented"); ++ } ++ ++ public void crssIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< crssIndication not implemented"); ++ } ++ ++ public void vtStatusInfoIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< vtStatusInfoIndication not implemented"); ++ } ++ ++ public void speechCodecInfoIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< speechCodecInfoIndication not implemented"); ++ } ++ ++ public void cdmaCallAccepted() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< cdmaCallAccepted not implemented"); ++ } ++ ++ public void onVirtualSimOn() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onVirtualSimOn not implemented"); ++ } ++ ++ public void onVirtualSimOff() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onVirtualSimOff not implemented"); ++ } ++ ++ public void onImeiLock() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onImeiLock not implemented"); ++ } ++ ++ public void onImsiRefreshDone() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onImsiRefreshDone not implemented"); ++ } ++ ++ public void newEtwsInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< newEtwsInd not implemented"); ++ } ++ ++ public void meSmsStorageFullInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< meSmsStorageFullInd not implemented"); ++ } ++ ++ public void smsReadyInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< smsReadyInd not implemented"); ++ } ++ ++ public void dataCallListChangedEx(int indicationType, ++ ArrayList mtkDcList) { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< dataCallListChangedEx"); ++ ArrayList dcList = new java.util.ArrayList(); ++ mtkDcList.forEach(entry -> dcList.add(entry.dcr)); ++ mIndication.dataCallListChanged(indicationType, dcList); ++ } ++ ++ public void responseCsNetworkStateChangeInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< responseCsNetworkStateChangeInd not implemented"); ++ } ++ ++ public void eMBMSAtInfoIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< eMBMSAtInfoIndication not implemented"); ++ } ++ ++ public void eMBMSSessionStatusIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< eMBMSSessionStatusIndication not implemented"); ++ } ++ ++ public void responsePsNetworkStateChangeInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< responsePsNetworkStateChangeInd not implemented"); ++ } ++ ++ public void responseInvalidSimInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< responseInvalidSimInd not implemented"); ++ } ++ ++ public void responseNetworkEventInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< responseNetworkEventInd not implemented"); ++ } ++ ++ public void responseModulationInfoInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< responseModulationInfoInd not implemented"); ++ } ++ ++ public void dataAllowedNotification() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< dataAllowedNotification not implemented"); ++ } ++ ++ public void onPseudoCellInfoInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onPseudoCellInfoInd not implemented"); ++ } ++ ++ public void plmnChangedIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< plmnChangedIndication not implemented"); ++ } ++ ++ public void registrationSuspendedIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< registrationSuspendedIndication not implemented"); ++ } ++ ++ public void gmssRatChangedIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< gmssRatChangedIndication not implemented"); ++ } ++ ++ public void worldModeChangedIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< worldModeChangedIndication not implemented"); ++ } ++ ++ public void resetAttachApnInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< resetAttachApnInd not implemented"); ++ } ++ ++ public void mdChangedApnInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< mdChangedApnInd not implemented"); ++ } ++ ++ public void esnMeidChangeInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< esnMeidChangeInd not implemented"); ++ } ++ ++ public void responseFemtocellInfo() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< responseFemtocellInfo not implemented"); ++ } ++ ++ public void phbReadyNotification() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< phbReadyNotification not implemented"); ++ } ++ ++ public void bipProactiveCommand() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< bipProactiveCommand not implemented"); ++ } ++ ++ public void triggerOtaSP() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< triggerOtaSP not implemented"); ++ } ++ ++ public void onStkMenuReset() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onStkMenuReset not implemented"); ++ } ++ ++ public void onMdDataRetryCountReset() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onMdDataRetryCountReset not implemented"); ++ } ++ ++ public void onRemoveRestrictEutran() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onRemoveRestrictEutran not implemented"); ++ } ++ ++ public void onPcoStatus() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onPcoStatus not implemented"); ++ } ++ ++ public void onLteAccessStratumStateChanged() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onLteAccessStratumStateChanged not implemented"); ++ } ++ ++ public void onSimPlugIn() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onSimPlugIn not implemented"); ++ } ++ ++ public void onSimPlugOut() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onSimPlugOut not implemented"); ++ } ++ ++ public void onSimMissing() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onSimMissing not implemented"); ++ } ++ ++ public void onSimRecovery() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onSimRecovery not implemented"); ++ } ++ ++ public void onSimTrayPlugIn() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onSimTrayPlugIn not implemented"); ++ } ++ ++ public void onSimCommonSlotNoChanged() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onSimCommonSlotNoChanged not implemented"); ++ } ++ ++ public void onSimMeLockEvent() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onSimMeLockEvent not implemented"); ++ } ++ ++ public void networkInfoInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< networkInfoInd not implemented"); ++ } ++ ++ public void cfuStatusNotify() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< cfuStatusNotify not implemented"); ++ } ++ ++ public void pcoDataAfterAttached() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< pcoDataAfterAttached not implemented"); ++ } ++ ++ public void confSRVCC() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< confSRVCC not implemented"); ++ } ++ ++ public void onVsimEventIndication() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onVsimEventIndication not implemented"); ++ } ++ ++ public void volteLteConnectionStatus() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< volteLteConnectionStatus not implemented"); ++ } ++ ++ public void dedicatedBearerActivationInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< dedicatedBearerActivationInd not implemented"); ++ } ++ ++ public void dedicatedBearerModificationInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< dedicatedBearerModificationInd not implemented"); ++ } ++ ++ public void dedicatedBearerDeactivationInd() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< dedicatedBearerDeactivationInd not implemented"); ++ } ++ ++ public void onWifiMonitoringThreshouldChanged() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onWifiMonitoringThreshouldChanged not implemented"); ++ } ++ ++ public void onWifiPdnActivate() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onWifiPdnActivate not implemented"); ++ } ++ ++ public void onWfcPdnError() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onWfcPdnError not implemented"); ++ } ++ ++ public void onPdnHandover() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onPdnHandover not implemented"); ++ } ++ ++ public void onWifiRoveout() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onWifiRoveout not implemented"); ++ } ++ ++ public void onLocationRequest() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onLocationRequest not implemented"); ++ } ++ ++ public void onWfcPdnStateChanged() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onWfcPdnStateChanged not implemented"); ++ } ++ ++ public void onNattKeepAliveChanged() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< onNattKeepAliveChanged not implemented"); ++ } ++ ++ public void oemHookRaw() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[UNSL][MTK]< oemHookRaw not implemented"); ++ } ++ //-- MTK Radio V2_0 ++} +diff --git a/src/java/com/android/internal/telephony/MtkRadioResponse.java b/src/java/com/android/internal/telephony/MtkRadioResponse.java +new file mode 100644 +index 000000000..2548e967e +--- /dev/null ++++ b/src/java/com/android/internal/telephony/MtkRadioResponse.java +@@ -0,0 +1,984 @@ ++package com.android.internal.telephony; ++ ++import android.hardware.radio.V1_0.ActivityStatsInfo; ++import android.hardware.radio.V1_0.CallForwardInfo; ++import android.hardware.radio.V1_0.Call; ++import android.hardware.radio.V1_0.CardStatus; ++import android.hardware.radio.V1_0.CarrierRestrictions; ++import android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo; ++import android.hardware.radio.V1_0.CellInfo; ++import android.hardware.radio.V1_0.DataRegStateResult; ++import android.hardware.radio.V1_0.HardwareConfig; ++import android.hardware.radio.V1_0.IccIoResult; ++import android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo; ++import android.hardware.radio.V1_0.LastCallFailCauseInfo; ++import android.hardware.radio.V1_0.LceDataInfo; ++import android.hardware.radio.V1_0.LceStatusInfo; ++import android.hardware.radio.V1_0.NeighboringCell; ++import android.hardware.radio.V1_0.OperatorInfo; ++import android.hardware.radio.V1_0.RadioCapability; ++import android.hardware.radio.V1_0.RadioResponseInfo; ++import android.hardware.radio.V1_0.SendSmsResult; ++import android.hardware.radio.V1_0.SetupDataCallResult; ++import android.hardware.radio.V1_0.SignalStrength; ++import android.hardware.radio.V1_0.VoiceRegStateResult; ++import android.hardware.radio.V1_1.KeepaliveStatus; ++ ++import java.util.ArrayList; ++ ++import vendor.mediatek.hardware.radio.V2_0.IRadioResponse; ++import vendor.mediatek.hardware.radio.V2_0.MtkSetupDataCallResult; ++ ++public class MtkRadioResponse extends IRadioResponse.Stub { ++ RIL mRil; ++ RadioResponse mResponse; ++ ++ MtkRadioResponse(RIL ril, RadioResponse response) { ++ mRil = ril; ++ mResponse = response; ++ } ++ ++ //++ Radio V1_0 ++ public void getIccCardStatusResponse(RadioResponseInfo info, CardStatus cardStatus) { ++ mResponse.getIccCardStatusResponse(info, cardStatus); ++ } ++ public void supplyIccPinForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPinForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyIccPukForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPukForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyIccPin2ForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPin2ForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyIccPuk2ForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPuk2ForAppResponse(info, remainingRetries); ++ } ++ ++ public void changeIccPinForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.changeIccPinForAppResponse(info, remainingRetries); ++ } ++ ++ public void changeIccPin2ForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.changeIccPin2ForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyNetworkDepersonalizationResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyNetworkDepersonalizationResponse(info, remainingRetries); ++ } ++ ++ public void getCurrentCallsResponse(RadioResponseInfo info, ArrayList calls) { ++ mResponse.getCurrentCallsResponse(info, calls); ++ } ++ ++ public void dialResponse(RadioResponseInfo info) { ++ mResponse.dialResponse(info); ++ } ++ ++ public void getIMSIForAppResponse(RadioResponseInfo info, String imsi) { ++ mResponse.getIMSIForAppResponse(info, imsi); ++ } ++ ++ public void hangupConnectionResponse(RadioResponseInfo info) { ++ mResponse.hangupConnectionResponse(info); ++ } ++ ++ public void hangupWaitingOrBackgroundResponse(RadioResponseInfo info) { ++ mResponse.hangupWaitingOrBackgroundResponse(info); ++ } ++ ++ public void hangupForegroundResumeBackgroundResponse(RadioResponseInfo info) { ++ mResponse.hangupForegroundResumeBackgroundResponse(info); ++ } ++ ++ public void switchWaitingOrHoldingAndActiveResponse(RadioResponseInfo info) { ++ mResponse.switchWaitingOrHoldingAndActiveResponse(info); ++ } ++ ++ public void conferenceResponse(RadioResponseInfo info) { ++ mResponse.conferenceResponse(info); ++ } ++ ++ public void rejectCallResponse(RadioResponseInfo info) { ++ mResponse.rejectCallResponse(info); ++ } ++ ++ public void getLastCallFailCauseResponse(RadioResponseInfo info, LastCallFailCauseInfo failCauseinfo) { ++ mResponse.getLastCallFailCauseResponse(info, failCauseinfo); ++ } ++ ++ public void getSignalStrengthResponse(RadioResponseInfo info, SignalStrength sigStrength) { ++ mResponse.getSignalStrengthResponse(info, sigStrength); ++ } ++ ++ public void getVoiceRegistrationStateResponse(RadioResponseInfo info, VoiceRegStateResult voiceRegResponse) { ++ mResponse.getVoiceRegistrationStateResponse(info, voiceRegResponse); ++ } ++ ++ public void getDataRegistrationStateResponse(RadioResponseInfo info, DataRegStateResult dataRegResponse) { ++ mResponse.getDataRegistrationStateResponse(info, dataRegResponse); ++ } ++ ++ public void getOperatorResponse(RadioResponseInfo info, String longName, String shortName, String numeric) { ++ mResponse.getOperatorResponse(info, longName, shortName, numeric); ++ } ++ ++ public void setRadioPowerResponse(RadioResponseInfo info) { ++ mResponse.setRadioPowerResponse(info); ++ } ++ ++ public void sendDtmfResponse(RadioResponseInfo info) { ++ mResponse.sendDtmfResponse(info); ++ } ++ ++ public void sendSmsResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendSmsResponse(info, sms); ++ } ++ ++ public void sendSMSExpectMoreResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendSMSExpectMoreResponse(info, sms); ++ } ++ ++ public void setupDataCallResponse(RadioResponseInfo info, SetupDataCallResult dcResponse) { ++ mResponse.setupDataCallResponse(info, dcResponse); ++ } ++ ++ public void iccIOForAppResponse(RadioResponseInfo info, IccIoResult iccIo) { ++ mResponse.iccIOForAppResponse(info, iccIo); ++ } ++ ++ public void sendUssdResponse(RadioResponseInfo info) { ++ mResponse.sendUssdResponse(info); ++ } ++ ++ public void cancelPendingUssdResponse(RadioResponseInfo info) { ++ mResponse.cancelPendingUssdResponse(info); ++ } ++ ++ public void getClirResponse(RadioResponseInfo info, int n, int m) { ++ mResponse.getClirResponse(info, n, m); ++ } ++ ++ public void setClirResponse(RadioResponseInfo info) { ++ mResponse.setClirResponse(info); ++ } ++ ++ public void getCallForwardStatusResponse(RadioResponseInfo info, ArrayList callForwardInfos) { ++ mResponse.getCallForwardStatusResponse(info, callForwardInfos); ++ } ++ ++ public void setCallForwardResponse(RadioResponseInfo info) { ++ mResponse.setCallForwardResponse(info); ++ } ++ ++ public void getCallWaitingResponse(RadioResponseInfo info, boolean enable, int serviceClass) { ++ mResponse.getCallWaitingResponse(info, enable, serviceClass); ++ } ++ ++ public void setCallWaitingResponse(RadioResponseInfo info) { ++ mResponse.setCallWaitingResponse(info); ++ } ++ ++ public void acknowledgeLastIncomingGsmSmsResponse(RadioResponseInfo info) { ++ mResponse.acknowledgeLastIncomingGsmSmsResponse(info); ++ } ++ ++ public void acceptCallResponse(RadioResponseInfo info) { ++ mResponse.acceptCallResponse(info); ++ } ++ ++ public void deactivateDataCallResponse(RadioResponseInfo info) { ++ mResponse.deactivateDataCallResponse(info); ++ } ++ ++ public void getFacilityLockForAppResponse(RadioResponseInfo info, int response) { ++ mResponse.getFacilityLockForAppResponse(info, response); ++ } ++ ++ public void setFacilityLockForAppResponse(RadioResponseInfo info, int retry) { ++ mResponse.setFacilityLockForAppResponse(info, retry); ++ } ++ ++ public void setBarringPasswordResponse(RadioResponseInfo info) { ++ mResponse.setBarringPasswordResponse(info); ++ } ++ ++ public void getNetworkSelectionModeResponse(RadioResponseInfo info, boolean manual) { ++ mResponse.getNetworkSelectionModeResponse(info, manual); ++ } ++ ++ public void setNetworkSelectionModeAutomaticResponse(RadioResponseInfo info) { ++ mResponse.setNetworkSelectionModeAutomaticResponse(info); ++ } ++ ++ public void setNetworkSelectionModeManualResponse(RadioResponseInfo info) { ++ mResponse.setNetworkSelectionModeManualResponse(info); ++ } ++ ++ public void getAvailableNetworksResponse(RadioResponseInfo info, ArrayList networkInfos) { ++ mResponse.getAvailableNetworksResponse(info, networkInfos); ++ } ++ ++ public void startDtmfResponse(RadioResponseInfo info) { ++ mResponse.startDtmfResponse(info); ++ } ++ ++ public void stopDtmfResponse(RadioResponseInfo info) { ++ mResponse.stopDtmfResponse(info); ++ } ++ ++ public void getBasebandVersionResponse(RadioResponseInfo info, String version) { ++ mResponse.getBasebandVersionResponse(info, version); ++ } ++ ++ public void separateConnectionResponse(RadioResponseInfo info) { ++ mResponse.separateConnectionResponse(info); ++ } ++ ++ public void setMuteResponse(RadioResponseInfo info) { ++ mResponse.setMuteResponse(info); ++ } ++ ++ public void getMuteResponse(RadioResponseInfo info, boolean enable) { ++ mResponse.getMuteResponse(info, enable); ++ } ++ ++ public void getClipResponse(RadioResponseInfo info, int status) { ++ mResponse.getClipResponse(info, status); ++ } ++ ++ public void getDataCallListResponse(RadioResponseInfo info, ArrayList dcResponse) { ++ mResponse.getDataCallListResponse(info, dcResponse); ++ } ++ ++ public void setSuppServiceNotificationsResponse(RadioResponseInfo info) { ++ mResponse.setSuppServiceNotificationsResponse(info); ++ } ++ ++ public void writeSmsToSimResponse(RadioResponseInfo info, int index) { ++ mResponse.writeSmsToSimResponse(info, index); ++ } ++ ++ public void deleteSmsOnSimResponse(RadioResponseInfo info) { ++ mResponse.deleteSmsOnSimResponse(info); ++ } ++ ++ public void setBandModeResponse(RadioResponseInfo info) { ++ mResponse.setBandModeResponse(info); ++ } ++ ++ public void getAvailableBandModesResponse(RadioResponseInfo info, ArrayList bandModes) { ++ mResponse.getAvailableBandModesResponse(info, bandModes); ++ } ++ ++ public void sendEnvelopeResponse(RadioResponseInfo info, String commandResponse) { ++ mResponse.sendEnvelopeResponse(info, commandResponse); ++ } ++ ++ public void sendTerminalResponseToSimResponse(RadioResponseInfo info) { ++ mResponse.sendTerminalResponseToSimResponse(info); ++ } ++ ++ public void handleStkCallSetupRequestFromSimResponse(RadioResponseInfo info) { ++ mResponse.handleStkCallSetupRequestFromSimResponse(info); ++ } ++ ++ public void explicitCallTransferResponse(RadioResponseInfo info) { ++ mResponse.explicitCallTransferResponse(info); ++ } ++ ++ public void setPreferredNetworkTypeResponse(RadioResponseInfo info) { ++ mResponse.setPreferredNetworkTypeResponse(info); ++ } ++ ++ public void getPreferredNetworkTypeResponse(RadioResponseInfo info, int nwType) { ++ mResponse.getPreferredNetworkTypeResponse(info, nwType); ++ } ++ ++ public void getNeighboringCidsResponse(RadioResponseInfo info, ArrayList cells) { ++ mResponse.getNeighboringCidsResponse(info, cells); ++ } ++ ++ public void setLocationUpdatesResponse(RadioResponseInfo info) { ++ mResponse.setLocationUpdatesResponse(info); ++ } ++ ++ public void setCdmaSubscriptionSourceResponse(RadioResponseInfo info) { ++ mResponse.setCdmaSubscriptionSourceResponse(info); ++ } ++ ++ public void setCdmaRoamingPreferenceResponse(RadioResponseInfo info) { ++ mResponse.setCdmaRoamingPreferenceResponse(info); ++ } ++ ++ public void getCdmaRoamingPreferenceResponse(RadioResponseInfo info, int type) { ++ mResponse.getCdmaRoamingPreferenceResponse(info, type); ++ } ++ ++ public void setTTYModeResponse(RadioResponseInfo info) { ++ mResponse.setTTYModeResponse(info); ++ } ++ ++ public void getTTYModeResponse(RadioResponseInfo info, int mode) { ++ mResponse.getTTYModeResponse(info, mode); ++ } ++ ++ public void setPreferredVoicePrivacyResponse(RadioResponseInfo info) { ++ mResponse.setPreferredVoicePrivacyResponse(info); ++ } ++ ++ public void getPreferredVoicePrivacyResponse(RadioResponseInfo info, boolean enable) { ++ mResponse.getPreferredVoicePrivacyResponse(info, enable); ++ } ++ ++ public void sendCDMAFeatureCodeResponse(RadioResponseInfo info) { ++ mResponse.sendCDMAFeatureCodeResponse(info); ++ } ++ ++ public void sendBurstDtmfResponse(RadioResponseInfo info) { ++ mResponse.sendBurstDtmfResponse(info); ++ } ++ ++ public void sendCdmaSmsResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendCdmaSmsResponse(info, sms); ++ } ++ ++ public void acknowledgeLastIncomingCdmaSmsResponse(RadioResponseInfo info) { ++ mResponse.acknowledgeLastIncomingCdmaSmsResponse(info); ++ } ++ ++ public void getGsmBroadcastConfigResponse(RadioResponseInfo info, ArrayList configs) { ++ mResponse.getGsmBroadcastConfigResponse(info, configs); ++ } ++ ++ public void setGsmBroadcastConfigResponse(RadioResponseInfo info) { ++ mResponse.setGsmBroadcastConfigResponse(info); ++ } ++ ++ public void setGsmBroadcastActivationResponse(RadioResponseInfo info) { ++ mResponse.setGsmBroadcastActivationResponse(info); ++ } ++ ++ public void getCdmaBroadcastConfigResponse(RadioResponseInfo info, ArrayList configs) { ++ mResponse.getCdmaBroadcastConfigResponse(info, configs); ++ } ++ ++ public void setCdmaBroadcastConfigResponse(RadioResponseInfo info) { ++ mResponse.setCdmaBroadcastConfigResponse(info); ++ } ++ ++ public void setCdmaBroadcastActivationResponse(RadioResponseInfo info) { ++ mResponse.setCdmaBroadcastActivationResponse(info); ++ } ++ ++ public void getCDMASubscriptionResponse(RadioResponseInfo info, String mdn, String hSid, String hNid, String min, String prl) { ++ mResponse.getCDMASubscriptionResponse(info, mdn, hSid, hNid, min, prl); ++ } ++ ++ public void writeSmsToRuimResponse(RadioResponseInfo info, int index) { ++ mResponse.writeSmsToRuimResponse(info, index); ++ } ++ ++ public void deleteSmsOnRuimResponse(RadioResponseInfo info) { ++ mResponse.deleteSmsOnRuimResponse(info); ++ } ++ ++ public void getDeviceIdentityResponse(RadioResponseInfo info, String imei, String imeisv, String esn, String meid) { ++ mResponse.getDeviceIdentityResponse(info, imei, imeisv, esn, meid); ++ } ++ ++ public void exitEmergencyCallbackModeResponse(RadioResponseInfo info) { ++ mResponse.exitEmergencyCallbackModeResponse(info); ++ } ++ ++ public void getSmscAddressResponse(RadioResponseInfo info, String smsc) { ++ mResponse.getSmscAddressResponse(info, smsc); ++ } ++ ++ public void setSmscAddressResponse(RadioResponseInfo info) { ++ mResponse.setSmscAddressResponse(info); ++ } ++ ++ public void reportSmsMemoryStatusResponse(RadioResponseInfo info) { ++ mResponse.reportSmsMemoryStatusResponse(info); ++ } ++ ++ public void reportStkServiceIsRunningResponse(RadioResponseInfo info) { ++ mResponse.reportStkServiceIsRunningResponse(info); ++ } ++ ++ public void getCdmaSubscriptionSourceResponse(RadioResponseInfo info, int source) { ++ mResponse.getCdmaSubscriptionSourceResponse(info, source); ++ } ++ ++ public void requestIsimAuthenticationResponse(RadioResponseInfo info, String response) { ++ mResponse.requestIsimAuthenticationResponse(info, response); ++ } ++ ++ public void acknowledgeIncomingGsmSmsWithPduResponse(RadioResponseInfo info) { ++ mResponse.acknowledgeIncomingGsmSmsWithPduResponse(info); ++ } ++ ++ public void sendEnvelopeWithStatusResponse(RadioResponseInfo info, IccIoResult iccIo) { ++ mResponse.sendEnvelopeWithStatusResponse(info, iccIo); ++ } ++ ++ public void getVoiceRadioTechnologyResponse(RadioResponseInfo info, int rat) { ++ mResponse.getVoiceRadioTechnologyResponse(info, rat); ++ } ++ ++ public void getCellInfoListResponse(RadioResponseInfo info, ArrayList cellInfo) { ++ mResponse.getCellInfoListResponse(info, cellInfo); ++ } ++ ++ public void setCellInfoListRateResponse(RadioResponseInfo info) { ++ mResponse.setCellInfoListRateResponse(info); ++ } ++ ++ public void setInitialAttachApnResponse(RadioResponseInfo info) { ++ mResponse.setInitialAttachApnResponse(info); ++ } ++ ++ public void getImsRegistrationStateResponse(RadioResponseInfo info, boolean isRegistered, int ratFamily) { ++ mResponse.getImsRegistrationStateResponse(info, isRegistered, ratFamily); ++ } ++ ++ public void sendImsSmsResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendImsSmsResponse(info, sms); ++ } ++ ++ public void iccTransmitApduBasicChannelResponse(RadioResponseInfo info, IccIoResult result) { ++ mResponse.iccTransmitApduBasicChannelResponse(info, result); ++ } ++ ++ public void iccOpenLogicalChannelResponse(RadioResponseInfo info, int channelId, ArrayList selectResponse) { ++ mResponse.iccOpenLogicalChannelResponse(info, channelId, selectResponse); ++ } ++ ++ public void iccCloseLogicalChannelResponse(RadioResponseInfo info) { ++ mResponse.iccCloseLogicalChannelResponse(info); ++ } ++ ++ public void iccTransmitApduLogicalChannelResponse(RadioResponseInfo info, IccIoResult result) { ++ mResponse.iccTransmitApduLogicalChannelResponse(info, result); ++ } ++ ++ public void nvReadItemResponse(RadioResponseInfo info, String result) { ++ mResponse.nvReadItemResponse(info, result); ++ } ++ ++ public void nvWriteItemResponse(RadioResponseInfo info) { ++ mResponse.nvWriteItemResponse(info); ++ } ++ ++ public void nvWriteCdmaPrlResponse(RadioResponseInfo info) { ++ mResponse.nvWriteCdmaPrlResponse(info); ++ } ++ ++ public void nvResetConfigResponse(RadioResponseInfo info) { ++ mResponse.nvResetConfigResponse(info); ++ } ++ ++ public void setUiccSubscriptionResponse(RadioResponseInfo info) { ++ mResponse.setUiccSubscriptionResponse(info); ++ } ++ ++ public void setDataAllowedResponse(RadioResponseInfo info) { ++ mResponse.setDataAllowedResponse(info); ++ } ++ ++ public void getHardwareConfigResponse(RadioResponseInfo info, ArrayList config) { ++ mResponse.getHardwareConfigResponse(info, config); ++ } ++ ++ public void requestIccSimAuthenticationResponse(RadioResponseInfo info, IccIoResult result) { ++ mResponse.requestIccSimAuthenticationResponse(info, result); ++ } ++ ++ public void setDataProfileResponse(RadioResponseInfo info) { ++ mResponse.setDataProfileResponse(info); ++ } ++ ++ public void requestShutdownResponse(RadioResponseInfo info) { ++ mResponse.requestShutdownResponse(info); ++ } ++ ++ public void getRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc) { ++ mResponse.getRadioCapabilityResponse(info, rc); ++ } ++ ++ public void setRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc) { ++ mResponse.setRadioCapabilityResponse(info, rc); ++ } ++ ++ public void startLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo) { ++ mResponse.startLceServiceResponse(info, statusInfo); ++ } ++ ++ public void stopLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo) { ++ mResponse.stopLceServiceResponse(info, statusInfo); ++ } ++ ++ public void pullLceDataResponse(RadioResponseInfo info, LceDataInfo lceInfo) { ++ mResponse.pullLceDataResponse(info, lceInfo); ++ } ++ ++ public void getModemActivityInfoResponse(RadioResponseInfo info, ActivityStatsInfo activityInfo) { ++ mResponse.getModemActivityInfoResponse(info, activityInfo); ++ } ++ ++ public void setAllowedCarriersResponse(RadioResponseInfo info, int numAllowed) { ++ mResponse.setAllowedCarriersResponse(info, numAllowed); ++ } ++ ++ public void getAllowedCarriersResponse(RadioResponseInfo info, boolean allAllowed, CarrierRestrictions carriers) { ++ mResponse.getAllowedCarriersResponse(info, allAllowed, carriers); ++ } ++ ++ public void sendDeviceStateResponse(RadioResponseInfo info) { ++ mResponse.sendDeviceStateResponse(info); ++ } ++ ++ public void setIndicationFilterResponse(RadioResponseInfo info) { ++ mResponse.setIndicationFilterResponse(info); ++ } ++ ++ public void setSimCardPowerResponse(RadioResponseInfo info) { ++ mResponse.setSimCardPowerResponse(info); ++ } ++ ++ public void acknowledgeRequest(int serial) { ++ mResponse.acknowledgeRequest(serial); ++ } ++ //-- Radio V1_0 ++ ++ //++ Radio V1_1 ++ public void setCarrierInfoForImsiEncryptionResponse(RadioResponseInfo info) { ++ mResponse.setCarrierInfoForImsiEncryptionResponse(info); ++ } ++ ++ public void setSimCardPowerResponse_1_1(RadioResponseInfo info) { ++ mResponse.setSimCardPowerResponse_1_1(info); ++ } ++ ++ public void startNetworkScanResponse(RadioResponseInfo info) { ++ mResponse.startNetworkScanResponse(info); ++ } ++ ++ public void stopNetworkScanResponse(RadioResponseInfo info) { ++ mResponse.stopNetworkScanResponse(info); ++ } ++ ++ public void startKeepaliveResponse(RadioResponseInfo info, KeepaliveStatus status) { ++ mResponse.startKeepaliveResponse(info, status); ++ } ++ ++ public void stopKeepaliveResponse(RadioResponseInfo info) { ++ mResponse.stopKeepaliveResponse(info); ++ } ++ //-- Radio V1_1 ++ ++ //++ MTK Radio V2_0 ++ public void setTrmResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setTrmResponse not implemented"); ++ } ++ ++ public void getATRResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getATRResponse not implemented"); ++ } ++ ++ public void setSimPowerResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setSimPowerResponse not implemented"); ++ } ++ ++ public void setModemPowerResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setModemPowerResponse not implemented"); ++ } ++ ++ public void hangupAllResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< hangupAllResponse not implemented"); ++ } ++ ++ public void setCallIndicationResponse(RadioResponseInfo info) { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setCallIndicationResponse"); ++ mResponse.responseVoid(info); ++ } ++ ++ public void emergencyDialResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< emergencyDialResponse not implemented"); ++ } ++ ++ public void setEccServiceCategoryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setEccServiceCategoryResponse not implemented"); ++ } ++ ++ public void setEccListResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setEccListResponse not implemented"); ++ } ++ ++ public void vtDialResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< vtDialResponse not implemented"); ++ } ++ ++ public void voiceAcceptResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< voiceAcceptResponse not implemented"); ++ } ++ ++ public void replaceVtCallResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< replaceVtCallResponse not implemented"); ++ } ++ ++ public void setNetworkSelectionModeManualWithActResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setNetworkSelectionModeManualWithActResponse not implemented"); ++ } ++ ++ public void getAvailableNetworksWithActResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getAvailableNetworksWithActResponse not implemented"); ++ } ++ ++ public void cancelAvailableNetworksResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< cancelAvailableNetworksResponse not implemented"); ++ } ++ ++ public void currentStatusResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< currentStatusResponse not implemented"); ++ } ++ ++ public void eccPreferredRatResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< eccPreferredRatResponse not implemented"); ++ } ++ ++ public void getSmsParametersResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getSmsParametersResponse not implemented"); ++ } ++ ++ public void setSmsParametersResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setSmsParametersResponse not implemented"); ++ } ++ ++ public void getSmsMemStatusResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getSmsMemStatusResponse not implemented"); ++ } ++ ++ public void setEtwsResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setEtwsResponse not implemented"); ++ } ++ ++ public void removeCbMsgResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< removeCbMsgResponse not implemented"); ++ } ++ ++ public void setGsmBroadcastLangsResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setGsmBroadcastLangsResponse not implemented"); ++ } ++ ++ public void getGsmBroadcastLangsResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getGsmBroadcastLangsResponse not implemented"); ++ } ++ ++ public void getGsmBroadcastActivationRsp() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getGsmBroadcastActivationRsp not implemented"); ++ } ++ ++ public void sendEmbmsAtCommandResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< sendEmbmsAtCommandResponse not implemented"); ++ } ++ ++ public void setupDataCallResponseEx(RadioResponseInfo responseInfo, ++ MtkSetupDataCallResult setupDataCallResult) { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setupDataCallResponse"); ++ mResponse.setupDataCallResponse(responseInfo, setupDataCallResult.dcr); ++ } ++ ++ public void getDataCallListResponseEx(RadioResponseInfo info, ++ ArrayList mtkDcList) { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getDataCallListResponseEx"); ++ ArrayList dcList = new ArrayList(); ++ mtkDcList.forEach(entry -> dcList.add(entry.dcr)); ++ mResponse.getDataCallListResponse(info, dcList); ++ } ++ ++ public void setApcModeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setApcModeResponse not implemented"); ++ } ++ ++ public void getApcInfoResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getApcInfoResponse not implemented"); ++ } ++ ++ public void triggerModeSwitchByEccResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< triggerModeSwitchByEccResponse not implemented"); ++ } ++ ++ public void getSmsRuimMemoryStatusResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getSmsRuimMemoryStatusResponse not implemented"); ++ } ++ ++ public void setFdModeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setFdModeResponse not implemented"); ++ } ++ ++ public void setResumeRegistrationResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setResumeRegistrationResponse not implemented"); ++ } ++ ++ public void storeModemTypeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< storeModemTypeResponse not implemented"); ++ } ++ ++ public void reloadModemTypeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< reloadModemTypeResponse not implemented"); ++ } ++ ++ public void handleStkCallSetupRequestFromSimWithResCodeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< handleStkCallSetupRequestFromSimWithResCodeResponse not implemented"); ++ } ++ ++ public void getFemtocellListResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getFemtocellListResponse not implemented"); ++ } ++ ++ public void abortFemtocellListResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< abortFemtocellListResponse not implemented"); ++ } ++ ++ public void selectFemtocellResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< selectFemtocellResponse not implemented"); ++ } ++ ++ public void queryFemtoCellSystemSelectionModeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< queryFemtoCellSystemSelectionModeResponse not implemented"); ++ } ++ ++ public void setFemtoCellSystemSelectionModeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setFemtoCellSystemSelectionModeResponse not implemented"); ++ } ++ ++ public void setClipResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setClipResponse not implemented"); ++ } ++ ++ public void getColpResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getColpResponse not implemented"); ++ } ++ ++ public void getColrResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getColrResponse not implemented"); ++ } ++ ++ public void sendCnapResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< sendCnapResponse not implemented"); ++ } ++ ++ public void setColpResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setColpResponse not implemented"); ++ } ++ ++ public void setColrResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setColrResponse not implemented"); ++ } ++ ++ public void queryCallForwardInTimeSlotStatusResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< queryCallForwardInTimeSlotStatusResponse not implemented"); ++ } ++ ++ public void setCallForwardInTimeSlotResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setCallForwardInTimeSlotResponse not implemented"); ++ } ++ ++ public void runGbaAuthenticationResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< runGbaAuthenticationResponse not implemented"); ++ } ++ ++ public void queryPhbStorageInfoResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< queryPhbStorageInfoResponse not implemented"); ++ } ++ ++ public void writePhbEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< writePhbEntryResponse not implemented"); ++ } ++ ++ public void readPhbEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readPhbEntryResponse not implemented"); ++ } ++ ++ public void queryUPBCapabilityResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< queryUPBCapabilityResponse not implemented"); ++ } ++ ++ public void editUPBEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< editUPBEntryResponse not implemented"); ++ } ++ ++ public void deleteUPBEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< deleteUPBEntryResponse not implemented"); ++ } ++ ++ public void readUPBGasListResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readUPBGasListResponse not implemented"); ++ } ++ ++ public void readUPBGrpEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readUPBGrpEntryResponse not implemented"); ++ } ++ ++ public void writeUPBGrpEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< writeUPBGrpEntryResponse not implemented"); ++ } ++ ++ public void getPhoneBookStringsLengthResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getPhoneBookStringsLengthResponse not implemented"); ++ } ++ ++ public void getPhoneBookMemStorageResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getPhoneBookMemStorageResponse not implemented"); ++ } ++ ++ public void setPhoneBookMemStorageResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setPhoneBookMemStorageResponse not implemented"); ++ } ++ ++ public void readPhoneBookEntryExtResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readPhoneBookEntryExtResponse not implemented"); ++ } ++ ++ public void writePhoneBookEntryExtResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< writePhoneBookEntryExtResponse not implemented"); ++ } ++ ++ public void queryUPBAvailableResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< queryUPBAvailableResponse not implemented"); ++ } ++ ++ public void readUPBEmailEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readUPBEmailEntryResponse not implemented"); ++ } ++ ++ public void readUPBSneEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readUPBSneEntryResponse not implemented"); ++ } ++ ++ public void readUPBAnrEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readUPBAnrEntryResponse not implemented"); ++ } ++ ++ public void readUPBAasListResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< readUPBAasListResponse not implemented"); ++ } ++ ++ public void queryNetworkLockResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< queryNetworkLockResponse not implemented"); ++ } ++ ++ public void setNetworkLockResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setNetworkLockResponse not implemented"); ++ } ++ ++ public void resetRadioResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< resetRadioResponse not implemented"); ++ } ++ ++ public void syncDataSettingsToMdResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< syncDataSettingsToMdResponse not implemented"); ++ } ++ ++ public void resetMdDataRetryCountResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< resetMdDataRetryCountResponse not implemented"); ++ } ++ ++ public void setRemoveRestrictEutranModeResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setRemoveRestrictEutranModeResponse not implemented"); ++ } ++ ++ public void setLteAccessStratumReportResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setLteAccessStratumReportResponse not implemented"); ++ } ++ ++ public void setLteUplinkDataTransferResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setLteUplinkDataTransferResponse not implemented"); ++ } ++ ++ public void setRxTestConfigResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setRxTestConfigResponse not implemented"); ++ } ++ ++ public void getRxTestResultResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getRxTestResultResponse not implemented"); ++ } ++ ++ public void getPOLCapabilityResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getPOLCapabilityResponse not implemented"); ++ } ++ ++ public void getCurrentPOLListResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getCurrentPOLListResponse not implemented"); ++ } ++ ++ public void setPOLEntryResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setPOLEntryResponse not implemented"); ++ } ++ ++ public void setRoamingEnableResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setRoamingEnableResponse not implemented"); ++ } ++ ++ public void getRoamingEnableResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< getRoamingEnableResponse not implemented"); ++ } ++ ++ public void vsimNotificationResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< vsimNotificationResponse not implemented"); ++ } ++ ++ public void vsimOperationResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< vsimOperationResponse not implemented"); ++ } ++ ++ public void setWifiEnabledResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setWifiEnabledResponse not implemented"); ++ } ++ ++ public void setWifiAssociatedResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setWifiAssociatedResponse not implemented"); ++ } ++ ++ public void setWifiSignalLevelResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setWifiSignalLevelResponse not implemented"); ++ } ++ ++ public void setWifiIpAddressResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setWifiIpAddressResponse not implemented"); ++ } ++ ++ public void setLocationInfoResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setLocationInfoResponse not implemented"); ++ } ++ ++ public void setEmergencyAddressIdResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setEmergencyAddressIdResponse not implemented"); ++ } ++ ++ public void setNattKeepAliveStatusResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setNattKeepAliveStatusResponse not implemented"); ++ } ++ ++ public void setE911StateResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setE911StateResponse not implemented"); ++ } ++ ++ public void setServiceStateToModemResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< setServiceStateToModemResponse not implemented"); ++ } ++ ++ public void sendRequestRawResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< sendRequestRawResponse not implemented"); ++ } ++ ++ public void sendRequestStringsResponse() { ++ if (RIL.RILJ_LOGD) mRil.riljLog("[MTK]< sendRequestStringsResponse not implemented"); ++ } ++ //-- MTK Radio V2_0 ++} +diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java +index 4e74cceee..c0c6db742 100644 +--- a/src/java/com/android/internal/telephony/RIL.java ++++ b/src/java/com/android/internal/telephony/RIL.java +@@ -237,6 +237,9 @@ public class RIL extends BaseCommands implements CommandsInterface { + final AtomicLong mRadioProxyCookie = new AtomicLong(0); + final RadioProxyDeathRecipient mRadioProxyDeathRecipient; + final RilHandler mRilHandler; ++ vendor.mediatek.hardware.radio.V2_0.IRadioResponse mMtkRadioResponse; ++ vendor.mediatek.hardware.radio.V2_0.IRadioIndication mMtkRadioIndication; ++ volatile vendor.mediatek.hardware.radio.V2_0.IRadio mMtkRadioProxy = null; + + //***** Events + static final int EVENT_WAKE_LOCK_TIMEOUT = 2; +@@ -494,6 +497,22 @@ public class RIL extends BaseCommands implements CommandsInterface { + } + } + ++ if (mRadioProxy != null) { ++ try { ++ mMtkRadioProxy = ++ vendor.mediatek.hardware.radio.V2_0.IRadio.getService( ++ HIDL_SERVICE_NAME[mPhoneId == null ? 0 : mPhoneId]); ++ if (mMtkRadioProxy != null) { ++ if (mMtkRadioResponse == null && mMtkRadioIndication == null) { ++ mMtkRadioResponse = new MtkRadioResponse(this, mRadioResponse); ++ mMtkRadioIndication = new MtkRadioIndication(this, mRadioIndication); ++ } ++ mMtkRadioProxy.setResponseFunctionsMtk(mMtkRadioResponse, mMtkRadioIndication); ++ } ++ } catch (RemoteException | RuntimeException e) { ++ riljLog("MTK RadioProxy is not available"); ++ } ++ } + return mRadioProxy; + } + +@@ -6060,4 +6079,23 @@ public class RIL extends BaseCommands implements CommandsInterface { + public boolean needsOldRilFeature(String feature) { + return mOldRilFeatures.contains(feature); + } ++ ++ void setCallIndication(int callId, int seqNo) { ++ // Ensure that mMtkRadioProxy is updated. ++ IRadio radioProxy = getRadioProxy(null); ++ if (mMtkRadioProxy != null) { ++ RILRequest rr = obtainRequest(-1, null, mRILDefaultWorkSource); ++ ++ if (RILJ_LOGD) { ++ riljLog(rr.serialString() + "> " + "setCallIndication"); ++ } ++ ++ try { ++ mMtkRadioProxy.setCallIndication( ++ rr.mSerial, 0 /* 0: allowed, 1: disallowed */, callId, seqNo); ++ } catch (RemoteException | RuntimeException e) { ++ handleRadioProxyExceptionForRR(rr, "setCallIndication", e); ++ } ++ } ++ } + } +diff --git a/src/java/com/android/internal/telephony/RadioResponse.java b/src/java/com/android/internal/telephony/RadioResponse.java +index a36b7a6fc..a52702f36 100644 +--- a/src/java/com/android/internal/telephony/RadioResponse.java ++++ b/src/java/com/android/internal/telephony/RadioResponse.java +@@ -1809,7 +1809,7 @@ public class RadioResponse extends IRadioResponse.Stub { + } + + +- private void responseVoid(RadioResponseInfo responseInfo) { ++ void responseVoid(RadioResponseInfo responseInfo) { + RILRequest rr = mRil.processResponse(responseInfo); + + if (rr != null) { +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_telephony/0006-Plugin-Samsung-RadioIndication-RadioResponse-to-get-.patch b/patches/platform_frameworks_opt_telephony/0006-Plugin-Samsung-RadioIndication-RadioResponse-to-get-.patch new file mode 100644 index 0000000..46ba330 --- /dev/null +++ b/patches/platform_frameworks_opt_telephony/0006-Plugin-Samsung-RadioIndication-RadioResponse-to-get-.patch @@ -0,0 +1,1087 @@ +From d11dbfd4177f8e6e13965faf20de758d88265057 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 12 Aug 2019 23:49:56 +0200 +Subject: [PATCH 6/6] Plugin Samsung RadioIndication/RadioResponse to get + signal strength + +Change-Id: Ic3d5801627bf3dd72d2e7b6bb3741b9d368d1f07 +--- + Android.bp | 1 + + .../com/android/internal/telephony/RIL.java | 25 +- + .../telephony/SamsungRadioIndication.java | 303 ++++++++ + .../telephony/SamsungRadioResponse.java | 684 ++++++++++++++++++ + 4 files changed, 1011 insertions(+), 2 deletions(-) + create mode 100644 src/java/com/android/internal/telephony/SamsungRadioIndication.java + create mode 100644 src/java/com/android/internal/telephony/SamsungRadioResponse.java + +diff --git a/Android.bp b/Android.bp +index ae678cb54..bb9925beb 100644 +--- a/Android.bp ++++ b/Android.bp +@@ -56,6 +56,7 @@ java_library { + "android.hardware.radio-V1.3-java", + "android.hardware.radio-V1.4-java", + "vendor.mediatek.hardware.radio-V2.0-java", ++ "vendor.samsung.hardware.radio-V1.2-java", + "voip-common", + "ims-common", + "services", +diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java +index 47cb9f240..586dd063a 100644 +--- a/src/java/com/android/internal/telephony/RIL.java ++++ b/src/java/com/android/internal/telephony/RIL.java +@@ -239,6 +239,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + vendor.mediatek.hardware.radio.V2_0.IRadioResponse mMtkRadioResponse; + vendor.mediatek.hardware.radio.V2_0.IRadioIndication mMtkRadioIndication; + volatile vendor.mediatek.hardware.radio.V2_0.IRadio mMtkRadioProxy = null; ++ volatile vendor.samsung.hardware.radio.V1_2.IRadio mSamsungRadioProxy = null; + + //***** Events + static final int EVENT_WAKE_LOCK_TIMEOUT = 2; +@@ -423,6 +424,26 @@ public class RIL extends BaseCommands implements CommandsInterface { + return mRadioProxy; + } + ++ String halName = HIDL_SERVICE_NAME[mPhoneId == null ? 0 : mPhoneId]; ++ ++ try { ++ mSamsungRadioProxy = vendor.samsung.hardware.radio.V1_2.IRadio.getService(halName); ++ mRadioProxy = mSamsungRadioProxy; ++ Rlog.e("PHH", "Got samsung radio proxy " + mSamsungRadioProxy); ++ if(mSamsungRadioProxy != null) { ++ Rlog.e("PHH", "Setting response"); ++ mRadioProxy.linkToDeath(mRadioProxyDeathRecipient, ++ mRadioProxyCookie.incrementAndGet()); ++ mSamsungRadioProxy.setResponseFunctions( ++ new SamsungRadioResponse(this, mRadioResponse), ++ new SamsungRadioIndication(this, mRadioIndication) ++ ); ++ } ++ return mRadioProxy; ++ } catch(Exception e) { ++ Rlog.e("PHH", "Failed getting samsung hardware radio", e); ++ } ++ + try { + if (mDisabledRadioServices.contains(mPhoneId)) { + riljLoge("getRadioProxy: mRadioProxy for " + HIDL_SERVICE_NAME[mPhoneId] +@@ -499,8 +520,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + if (mRadioProxy != null) { + try { + mMtkRadioProxy = +- vendor.mediatek.hardware.radio.V2_0.IRadio.getService( +- HIDL_SERVICE_NAME[mPhoneId == null ? 0 : mPhoneId]); ++ vendor.mediatek.hardware.radio.V2_0.IRadio.getService(halName); + if (mMtkRadioProxy != null) { + if (mMtkRadioResponse == null && mMtkRadioIndication == null) { + mMtkRadioResponse = new MtkRadioResponse(this, mRadioResponse); +@@ -511,6 +531,7 @@ public class RIL extends BaseCommands implements CommandsInterface { + } catch (RemoteException | RuntimeException e) { + riljLog("MTK RadioProxy is not available"); + } ++ + } + return mRadioProxy; + } +diff --git a/src/java/com/android/internal/telephony/SamsungRadioIndication.java b/src/java/com/android/internal/telephony/SamsungRadioIndication.java +new file mode 100644 +index 000000000..9eadec147 +--- /dev/null ++++ b/src/java/com/android/internal/telephony/SamsungRadioIndication.java +@@ -0,0 +1,303 @@ ++package com.android.internal.telephony; ++ ++import android.hardware.radio.V1_0.SetupDataCallResult; ++ ++import java.util.ArrayList; ++ ++import vendor.samsung.hardware.radio.V1_2.IRadioIndication; ++ ++import vendor.samsung.hardware.radio.V1_2.ApnProfile; ++import vendor.samsung.hardware.radio.V1_2.SecSignalStrength; ++import vendor.samsung.hardware.radio.V1_2.OemSSReleaseComplete; ++import vendor.samsung.hardware.radio.V1_2.DcParam; ++import vendor.samsung.hardware.radio.V1_2.NrSignalStrength; ++import android.hardware.radio.V1_2.PhysicalChannelConfig; ++ ++public class SamsungRadioIndication extends IRadioIndication.Stub { ++ RIL mRil; ++ RadioIndication mIndication; ++ ++ SamsungRadioIndication(RIL ril, RadioIndication indication) { ++ mRil = ril; ++ mIndication = indication; ++ } ++ ++ //++ Radio V1_0 ++ public void radioStateChanged(int type, int radioState) { ++ mIndication.radioStateChanged(type, radioState); ++ } ++ ++ public void callStateChanged(int type) { ++ mIndication.callStateChanged(type); ++ } ++ ++ public void networkStateChanged(int type) { ++ mIndication.networkStateChanged(type); ++ } ++ ++ public void newSms(int type, ArrayList pdu) { ++ mIndication.newSms(type, pdu); ++ } ++ ++ public void newSmsStatusReport(int type, ArrayList pdu) { ++ mIndication.newSmsStatusReport(type, pdu); ++ } ++ ++ public void newSmsOnSim(int type, int recordNumber) { ++ mIndication.newSmsOnSim(type, recordNumber); ++ } ++ ++ public void onUssd(int type, int modeType, String msg) { ++ mIndication.onUssd(type, modeType, msg); ++ } ++ ++ public void nitzTimeReceived(int type, String nitzTime, long receivedTime) { ++ mIndication.nitzTimeReceived(type, nitzTime, receivedTime); ++ } ++ ++ public void currentSignalStrength(int type, android.hardware.radio.V1_0.SignalStrength signalStrength) { ++ mIndication.currentSignalStrength(type, signalStrength); ++ } ++ ++ public void dataCallListChanged(int type, ArrayList dcList) { ++ mIndication.dataCallListChanged(type, dcList); ++ } ++ ++ public void suppSvcNotify(int type, android.hardware.radio.V1_0.SuppSvcNotification suppSvc) { ++ mIndication.suppSvcNotify(type, suppSvc); ++ } ++ ++ public void stkSessionEnd(int type) { ++ mIndication.stkSessionEnd(type); ++ } ++ ++ public void stkProactiveCommand(int type, String cmd) { ++ mIndication.stkProactiveCommand(type, cmd); ++ } ++ ++ public void stkEventNotify(int type, String cmd) { ++ mIndication.stkEventNotify(type, cmd); ++ } ++ ++ public void stkCallSetup(int type, long timeout) { ++ mIndication.stkCallSetup(type, timeout); ++ } ++ ++ public void simSmsStorageFull(int type) { ++ mIndication.simSmsStorageFull(type); ++ } ++ ++ public void simRefresh(int type, android.hardware.radio.V1_0.SimRefreshResult refreshResult) { ++ mIndication.simRefresh(type, refreshResult); ++ } ++ ++ public void callRing(int type, boolean isGsm, android.hardware.radio.V1_0.CdmaSignalInfoRecord record) { ++ mIndication.callRing(type, isGsm, record); ++ } ++ ++ public void simStatusChanged(int type) { ++ mIndication.simStatusChanged(type); ++ } ++ ++ public void cdmaNewSms(int type, android.hardware.radio.V1_0.CdmaSmsMessage msg) { ++ mIndication.cdmaNewSms(type, msg); ++ } ++ ++ public void newBroadcastSms(int type, ArrayList data) { ++ mIndication.newBroadcastSms(type, data); ++ } ++ ++ public void cdmaRuimSmsStorageFull(int type) { ++ mIndication.cdmaRuimSmsStorageFull(type); ++ } ++ ++ public void restrictedStateChanged(int type, int state) { ++ mIndication.restrictedStateChanged(type, state); ++ } ++ ++ public void enterEmergencyCallbackMode(int type) { ++ mIndication.enterEmergencyCallbackMode(type); ++ } ++ ++ public void cdmaCallWaiting(int type, android.hardware.radio.V1_0.CdmaCallWaiting callWaitingRecord) { ++ mIndication.cdmaCallWaiting(type, callWaitingRecord); ++ } ++ ++ public void cdmaOtaProvisionStatus(int type, int status) { ++ mIndication.cdmaOtaProvisionStatus(type, status); ++ } ++ ++ public void cdmaInfoRec(int type, android.hardware.radio.V1_0.CdmaInformationRecords records) { ++ mIndication.cdmaInfoRec(type, records); ++ } ++ ++ public void indicateRingbackTone(int type, boolean start) { ++ mIndication.indicateRingbackTone(type, start); ++ } ++ ++ public void resendIncallMute(int type) { ++ mIndication.resendIncallMute(type); ++ } ++ ++ public void cdmaSubscriptionSourceChanged(int type, int cdmaSource) { ++ mIndication.cdmaSubscriptionSourceChanged(type, cdmaSource); ++ } ++ ++ public void cdmaPrlChanged(int type, int version) { ++ mIndication.cdmaPrlChanged(type, version); ++ } ++ ++ public void exitEmergencyCallbackMode(int type) { ++ mIndication.exitEmergencyCallbackMode(type); ++ } ++ ++ public void rilConnected(int type) { ++ mIndication.rilConnected(type); ++ } ++ ++ public void voiceRadioTechChanged(int type, int rat) { ++ mIndication.voiceRadioTechChanged(type, rat); ++ } ++ ++ public void cellInfoList(int type, ArrayList records) { ++ mIndication.cellInfoList(type, records); ++ } ++ ++ public void imsNetworkStateChanged(int type) { ++ mIndication.imsNetworkStateChanged(type); ++ } ++ ++ public void subscriptionStatusChanged(int type, boolean activate) { ++ mIndication.subscriptionStatusChanged(type, activate); ++ } ++ ++ public void srvccStateNotify(int type, int state) { ++ mIndication.srvccStateNotify(type, state); ++ } ++ ++ public void hardwareConfigChanged(int type, ArrayList configs) { ++ mIndication.hardwareConfigChanged(type, configs); ++ } ++ ++ public void radioCapabilityIndication(int type, android.hardware.radio.V1_0.RadioCapability rc) { ++ mIndication.radioCapabilityIndication(type, rc); ++ } ++ ++ public void onSupplementaryServiceIndication(int type, android.hardware.radio.V1_0.StkCcUnsolSsResult ss) { ++ mIndication.onSupplementaryServiceIndication(type, ss); ++ } ++ ++ public void stkCallControlAlphaNotify(int type, String alpha) { ++ mIndication.stkCallControlAlphaNotify(type, alpha); ++ } ++ ++ public void lceData(int type, android.hardware.radio.V1_0.LceDataInfo lce) { ++ mIndication.lceData(type, lce); ++ } ++ ++ public void pcoData(int type, android.hardware.radio.V1_0.PcoDataInfo pco) { ++ mIndication.pcoData(type, pco); ++ } ++ ++ public void modemReset(int type, String reason) { ++ mIndication.modemReset(type, reason); ++ } ++ //-- Radio V1_0 ++ ++ //++ Radio V1_1 ++ public void carrierInfoForImsiEncryption(int type) { ++ mIndication.carrierInfoForImsiEncryption(type); ++ } ++ ++ public void networkScanResult(int type, android.hardware.radio.V1_1.NetworkScanResult result) { ++ mIndication.networkScanResult(type, result); ++ } ++ ++ public void keepaliveStatus(int type, android.hardware.radio.V1_1.KeepaliveStatus status) { ++ mIndication.keepaliveStatus(type, status); ++ } ++ ++ //-- Radio V1_1 ++ ++ //++ Radio V1_2 ++ public void networkScanResult_1_2(int type, android.hardware.radio.V1_2.NetworkScanResult result) { ++ mIndication.networkScanResult_1_2(type, result); ++ } ++ ++ public void cellInfoList_1_2(int type, ArrayList records) { ++ mIndication.cellInfoList_1_2(type, records); ++ } ++ ++ public void currentLinkCapacityEstimate(int type, android.hardware.radio.V1_2.LinkCapacityEstimate lce) { ++ mIndication.currentLinkCapacityEstimate(type, lce); ++ } ++ ++ public void currentPhysicalChannelConfigs(int type, ArrayList configs) { ++ mIndication.currentPhysicalChannelConfigs(type, configs); ++ } ++ ++ public void currentSignalStrength_1_2(int type, android.hardware.radio.V1_2.SignalStrength signalStrength) { ++ mIndication.currentSignalStrength_1_2(type, signalStrength); ++ } ++ //-- Radio V1_2 ++ ++ public void secCurrentSignalStrength(int type, SecSignalStrength signalStrength) { ++ mIndication.currentSignalStrength_1_2(type, signalStrength.base); ++ } ++ public void secImsNetworkStateChanged(int type, ArrayList regState) { ++ } ++ public void oemAcbInfoChanged(int type, ArrayList acbInfo) { ++ } ++ public void oemCsFallback(int type, int state) { ++ } ++ public void oemImsPreferenceChangeInd(int type, ArrayList imsPref) { ++ } ++ public void oemVoiceRadioBearerHoStatusInd(int type, int state) { ++ } ++ public void oemHysteresisDcnInd(int type) { ++ } ++ public void oemTimerStatusChangedInd(int type, ArrayList eventNoti) { ++ } ++ public void oemModemCapInd(int type, ArrayList data) { ++ } ++ public void oemAmInd(int type, String intent) { ++ } ++ public void oemTrunRadioOnInd(int type) { ++ } ++ public void oemSimPbReadyInd(int type) { ++ } ++ public void oemPbInitCompleteInd(int type) { ++ } ++ public void oemDeviceReadyNoti(int type) { ++ } ++ public void oemStkSmsSendResultInd(int type, int result) { ++ } ++ public void oemStkCallControlResultInd(int type, String cmd) { ++ } ++ public void oemSimSwapStateChangedInd(int type, int state) { ++ } ++ public void oemSimCountMismatchedInd(int type, int state) { ++ } ++ public void oemSimIccidNoti(int type, String iccid) { ++ } ++ public void oemSimOnOffNoti(int type, int mode) { ++ } ++ public void oemReleaseCompleteMessageInd(int typer, OemSSReleaseComplete result) { ++ } ++ public void oemSapNoti(int type, ArrayList data) { ++ } ++ public void oemNrBearerAllocationChangeInd(int type, int status) { ++ } ++ public void oem5gStatusChangeInd(int type, int status) { ++ } ++ public void oemNrDcParamChangeInd(int type, DcParam dcParam) { ++ } ++ public void oemNrSignalStrengthInd(int type, NrSignalStrength nrSignalStrength) { ++ } ++ public ApnProfile oemLoadApnProfile(String select) { ++ return null; ++ } ++ public int oemGetSettingValue(String key, String table) { ++ return 0; ++ } ++} +diff --git a/src/java/com/android/internal/telephony/SamsungRadioResponse.java b/src/java/com/android/internal/telephony/SamsungRadioResponse.java +new file mode 100644 +index 000000000..63e680afb +--- /dev/null ++++ b/src/java/com/android/internal/telephony/SamsungRadioResponse.java +@@ -0,0 +1,684 @@ ++package com.android.internal.telephony; ++ ++import android.hardware.radio.V1_0.ActivityStatsInfo; ++import android.hardware.radio.V1_0.CallForwardInfo; ++import android.hardware.radio.V1_0.Call; ++import android.hardware.radio.V1_0.CardStatus; ++import android.hardware.radio.V1_0.CarrierRestrictions; ++import android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo; ++import android.hardware.radio.V1_0.CellInfo; ++import android.hardware.radio.V1_0.DataRegStateResult; ++import android.hardware.radio.V1_0.HardwareConfig; ++import android.hardware.radio.V1_0.IccIoResult; ++import android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo; ++import android.hardware.radio.V1_0.LastCallFailCauseInfo; ++import android.hardware.radio.V1_0.LceDataInfo; ++import android.hardware.radio.V1_0.LceStatusInfo; ++import android.hardware.radio.V1_0.NeighboringCell; ++import android.hardware.radio.V1_0.OperatorInfo; ++import android.hardware.radio.V1_0.RadioCapability; ++import android.hardware.radio.V1_0.RadioResponseInfo; ++import android.hardware.radio.V1_0.SendSmsResult; ++import android.hardware.radio.V1_0.SetupDataCallResult; ++import android.hardware.radio.V1_0.SignalStrength; ++import android.hardware.radio.V1_0.VoiceRegStateResult; ++import android.hardware.radio.V1_1.KeepaliveStatus; ++ ++import java.util.ArrayList; ++ ++import vendor.samsung.hardware.radio.V1_2.IRadioResponse; ++ ++import vendor.samsung.hardware.radio.V1_2.SecCall; ++import vendor.samsung.hardware.radio.V1_2.SecCardStatus; ++import vendor.samsung.hardware.radio.V1_2.SecSignalStrength; ++import vendor.samsung.hardware.radio.V1_2.SecVoiceRegStateResult; ++import vendor.samsung.hardware.radio.V1_2.SecDataRegStateResult; ++import vendor.samsung.hardware.radio.V1_2.SecOperatorInfo; ++import vendor.samsung.hardware.radio.V1_2.OemPreferredNetworkInfo; ++import vendor.samsung.hardware.radio.V1_2.OemSimPBResponse; ++import vendor.samsung.hardware.radio.V1_2.OemCbConfigArgs; ++import vendor.samsung.hardware.radio.V1_2.SecSendSmsResult; ++import vendor.samsung.hardware.radio.V1_2.DcParam; ++import vendor.samsung.hardware.radio.V1_2.NrSignalStrength; ++import vendor.samsung.hardware.radio.V1_2.OemCsgInfo; ++ ++public class SamsungRadioResponse extends IRadioResponse.Stub { ++ RIL mRil; ++ RadioResponse mResponse; ++ ++ SamsungRadioResponse(RIL ril, RadioResponse response) { ++ mRil = ril; ++ mResponse = response; ++ } ++ ++ //++ Radio V1_0 ++ public void getIccCardStatusResponse(RadioResponseInfo info, CardStatus cardStatus) { ++ mResponse.getIccCardStatusResponse(info, cardStatus); ++ } ++ public void supplyIccPinForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPinForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyIccPukForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPukForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyIccPin2ForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPin2ForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyIccPuk2ForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyIccPuk2ForAppResponse(info, remainingRetries); ++ } ++ ++ public void changeIccPinForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.changeIccPinForAppResponse(info, remainingRetries); ++ } ++ ++ public void changeIccPin2ForAppResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.changeIccPin2ForAppResponse(info, remainingRetries); ++ } ++ ++ public void supplyNetworkDepersonalizationResponse(RadioResponseInfo info, int remainingRetries) { ++ mResponse.supplyNetworkDepersonalizationResponse(info, remainingRetries); ++ } ++ ++ public void getCurrentCallsResponse(RadioResponseInfo info, ArrayList calls) { ++ mResponse.getCurrentCallsResponse(info, calls); ++ } ++ ++ public void dialResponse(RadioResponseInfo info) { ++ mResponse.dialResponse(info); ++ } ++ ++ public void getIMSIForAppResponse(RadioResponseInfo info, String imsi) { ++ mResponse.getIMSIForAppResponse(info, imsi); ++ } ++ ++ public void hangupConnectionResponse(RadioResponseInfo info) { ++ mResponse.hangupConnectionResponse(info); ++ } ++ ++ public void hangupWaitingOrBackgroundResponse(RadioResponseInfo info) { ++ mResponse.hangupWaitingOrBackgroundResponse(info); ++ } ++ ++ public void hangupForegroundResumeBackgroundResponse(RadioResponseInfo info) { ++ mResponse.hangupForegroundResumeBackgroundResponse(info); ++ } ++ ++ public void switchWaitingOrHoldingAndActiveResponse(RadioResponseInfo info) { ++ mResponse.switchWaitingOrHoldingAndActiveResponse(info); ++ } ++ ++ public void conferenceResponse(RadioResponseInfo info) { ++ mResponse.conferenceResponse(info); ++ } ++ ++ public void rejectCallResponse(RadioResponseInfo info) { ++ mResponse.rejectCallResponse(info); ++ } ++ ++ public void getLastCallFailCauseResponse(RadioResponseInfo info, LastCallFailCauseInfo failCauseinfo) { ++ mResponse.getLastCallFailCauseResponse(info, failCauseinfo); ++ } ++ ++ public void getSignalStrengthResponse(RadioResponseInfo info, SignalStrength sigStrength) { ++ mResponse.getSignalStrengthResponse(info, sigStrength); ++ } ++ ++ public void getVoiceRegistrationStateResponse(RadioResponseInfo info, VoiceRegStateResult voiceRegResponse) { ++ mResponse.getVoiceRegistrationStateResponse(info, voiceRegResponse); ++ } ++ ++ public void getDataRegistrationStateResponse(RadioResponseInfo info, DataRegStateResult dataRegResponse) { ++ mResponse.getDataRegistrationStateResponse(info, dataRegResponse); ++ } ++ ++ public void getOperatorResponse(RadioResponseInfo info, String longName, String shortName, String numeric) { ++ mResponse.getOperatorResponse(info, longName, shortName, numeric); ++ } ++ ++ public void setRadioPowerResponse(RadioResponseInfo info) { ++ mResponse.setRadioPowerResponse(info); ++ } ++ ++ public void sendDtmfResponse(RadioResponseInfo info) { ++ mResponse.sendDtmfResponse(info); ++ } ++ ++ public void sendSmsResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendSmsResponse(info, sms); ++ } ++ ++ public void sendSMSExpectMoreResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendSMSExpectMoreResponse(info, sms); ++ } ++ ++ public void setupDataCallResponse(RadioResponseInfo info, SetupDataCallResult dcResponse) { ++ mResponse.setupDataCallResponse(info, dcResponse); ++ } ++ ++ public void iccIOForAppResponse(RadioResponseInfo info, IccIoResult iccIo) { ++ mResponse.iccIOForAppResponse(info, iccIo); ++ } ++ ++ public void sendUssdResponse(RadioResponseInfo info) { ++ mResponse.sendUssdResponse(info); ++ } ++ ++ public void cancelPendingUssdResponse(RadioResponseInfo info) { ++ mResponse.cancelPendingUssdResponse(info); ++ } ++ ++ public void getClirResponse(RadioResponseInfo info, int n, int m) { ++ mResponse.getClirResponse(info, n, m); ++ } ++ ++ public void setClirResponse(RadioResponseInfo info) { ++ mResponse.setClirResponse(info); ++ } ++ ++ public void getCallForwardStatusResponse(RadioResponseInfo info, ArrayList callForwardInfos) { ++ mResponse.getCallForwardStatusResponse(info, callForwardInfos); ++ } ++ ++ public void setCallForwardResponse(RadioResponseInfo info) { ++ mResponse.setCallForwardResponse(info); ++ } ++ ++ public void getCallWaitingResponse(RadioResponseInfo info, boolean enable, int serviceClass) { ++ mResponse.getCallWaitingResponse(info, enable, serviceClass); ++ } ++ ++ public void setCallWaitingResponse(RadioResponseInfo info) { ++ mResponse.setCallWaitingResponse(info); ++ } ++ ++ public void acknowledgeLastIncomingGsmSmsResponse(RadioResponseInfo info) { ++ mResponse.acknowledgeLastIncomingGsmSmsResponse(info); ++ } ++ ++ public void acceptCallResponse(RadioResponseInfo info) { ++ mResponse.acceptCallResponse(info); ++ } ++ ++ public void deactivateDataCallResponse(RadioResponseInfo info) { ++ mResponse.deactivateDataCallResponse(info); ++ } ++ ++ public void getFacilityLockForAppResponse(RadioResponseInfo info, int response) { ++ mResponse.getFacilityLockForAppResponse(info, response); ++ } ++ ++ public void setFacilityLockForAppResponse(RadioResponseInfo info, int retry) { ++ mResponse.setFacilityLockForAppResponse(info, retry); ++ } ++ ++ public void setBarringPasswordResponse(RadioResponseInfo info) { ++ mResponse.setBarringPasswordResponse(info); ++ } ++ ++ public void getNetworkSelectionModeResponse(RadioResponseInfo info, boolean manual) { ++ mResponse.getNetworkSelectionModeResponse(info, manual); ++ } ++ ++ public void setNetworkSelectionModeAutomaticResponse(RadioResponseInfo info) { ++ mResponse.setNetworkSelectionModeAutomaticResponse(info); ++ } ++ ++ public void setNetworkSelectionModeManualResponse(RadioResponseInfo info) { ++ mResponse.setNetworkSelectionModeManualResponse(info); ++ } ++ ++ public void getAvailableNetworksResponse(RadioResponseInfo info, ArrayList networkInfos) { ++ mResponse.getAvailableNetworksResponse(info, networkInfos); ++ } ++ ++ public void startDtmfResponse(RadioResponseInfo info) { ++ mResponse.startDtmfResponse(info); ++ } ++ ++ public void stopDtmfResponse(RadioResponseInfo info) { ++ mResponse.stopDtmfResponse(info); ++ } ++ ++ public void getBasebandVersionResponse(RadioResponseInfo info, String version) { ++ mResponse.getBasebandVersionResponse(info, version); ++ } ++ ++ public void separateConnectionResponse(RadioResponseInfo info) { ++ mResponse.separateConnectionResponse(info); ++ } ++ ++ public void setMuteResponse(RadioResponseInfo info) { ++ mResponse.setMuteResponse(info); ++ } ++ ++ public void getMuteResponse(RadioResponseInfo info, boolean enable) { ++ mResponse.getMuteResponse(info, enable); ++ } ++ ++ public void getClipResponse(RadioResponseInfo info, int status) { ++ mResponse.getClipResponse(info, status); ++ } ++ ++ public void getDataCallListResponse(RadioResponseInfo info, ArrayList dcResponse) { ++ mResponse.getDataCallListResponse(info, dcResponse); ++ } ++ ++ public void setSuppServiceNotificationsResponse(RadioResponseInfo info) { ++ mResponse.setSuppServiceNotificationsResponse(info); ++ } ++ ++ public void writeSmsToSimResponse(RadioResponseInfo info, int index) { ++ mResponse.writeSmsToSimResponse(info, index); ++ } ++ ++ public void deleteSmsOnSimResponse(RadioResponseInfo info) { ++ mResponse.deleteSmsOnSimResponse(info); ++ } ++ ++ public void setBandModeResponse(RadioResponseInfo info) { ++ mResponse.setBandModeResponse(info); ++ } ++ ++ public void getAvailableBandModesResponse(RadioResponseInfo info, ArrayList bandModes) { ++ mResponse.getAvailableBandModesResponse(info, bandModes); ++ } ++ ++ public void sendEnvelopeResponse(RadioResponseInfo info, String commandResponse) { ++ mResponse.sendEnvelopeResponse(info, commandResponse); ++ } ++ ++ public void sendTerminalResponseToSimResponse(RadioResponseInfo info) { ++ mResponse.sendTerminalResponseToSimResponse(info); ++ } ++ ++ public void handleStkCallSetupRequestFromSimResponse(RadioResponseInfo info) { ++ mResponse.handleStkCallSetupRequestFromSimResponse(info); ++ } ++ ++ public void explicitCallTransferResponse(RadioResponseInfo info) { ++ mResponse.explicitCallTransferResponse(info); ++ } ++ ++ public void setPreferredNetworkTypeResponse(RadioResponseInfo info) { ++ mResponse.setPreferredNetworkTypeResponse(info); ++ } ++ ++ public void getPreferredNetworkTypeResponse(RadioResponseInfo info, int nwType) { ++ mResponse.getPreferredNetworkTypeResponse(info, nwType); ++ } ++ ++ public void getNeighboringCidsResponse(RadioResponseInfo info, ArrayList cells) { ++ mResponse.getNeighboringCidsResponse(info, cells); ++ } ++ ++ public void setLocationUpdatesResponse(RadioResponseInfo info) { ++ mResponse.setLocationUpdatesResponse(info); ++ } ++ ++ public void setCdmaSubscriptionSourceResponse(RadioResponseInfo info) { ++ mResponse.setCdmaSubscriptionSourceResponse(info); ++ } ++ ++ public void setCdmaRoamingPreferenceResponse(RadioResponseInfo info) { ++ mResponse.setCdmaRoamingPreferenceResponse(info); ++ } ++ ++ public void getCdmaRoamingPreferenceResponse(RadioResponseInfo info, int type) { ++ mResponse.getCdmaRoamingPreferenceResponse(info, type); ++ } ++ ++ public void setTTYModeResponse(RadioResponseInfo info) { ++ mResponse.setTTYModeResponse(info); ++ } ++ ++ public void getTTYModeResponse(RadioResponseInfo info, int mode) { ++ mResponse.getTTYModeResponse(info, mode); ++ } ++ ++ public void setPreferredVoicePrivacyResponse(RadioResponseInfo info) { ++ mResponse.setPreferredVoicePrivacyResponse(info); ++ } ++ ++ public void getPreferredVoicePrivacyResponse(RadioResponseInfo info, boolean enable) { ++ mResponse.getPreferredVoicePrivacyResponse(info, enable); ++ } ++ ++ public void sendCDMAFeatureCodeResponse(RadioResponseInfo info) { ++ mResponse.sendCDMAFeatureCodeResponse(info); ++ } ++ ++ public void sendBurstDtmfResponse(RadioResponseInfo info) { ++ mResponse.sendBurstDtmfResponse(info); ++ } ++ ++ public void sendCdmaSmsResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendCdmaSmsResponse(info, sms); ++ } ++ ++ public void acknowledgeLastIncomingCdmaSmsResponse(RadioResponseInfo info) { ++ mResponse.acknowledgeLastIncomingCdmaSmsResponse(info); ++ } ++ ++ public void getGsmBroadcastConfigResponse(RadioResponseInfo info, ArrayList configs) { ++ mResponse.getGsmBroadcastConfigResponse(info, configs); ++ } ++ ++ public void setGsmBroadcastConfigResponse(RadioResponseInfo info) { ++ mResponse.setGsmBroadcastConfigResponse(info); ++ } ++ ++ public void setGsmBroadcastActivationResponse(RadioResponseInfo info) { ++ mResponse.setGsmBroadcastActivationResponse(info); ++ } ++ ++ public void getCdmaBroadcastConfigResponse(RadioResponseInfo info, ArrayList configs) { ++ mResponse.getCdmaBroadcastConfigResponse(info, configs); ++ } ++ ++ public void setCdmaBroadcastConfigResponse(RadioResponseInfo info) { ++ mResponse.setCdmaBroadcastConfigResponse(info); ++ } ++ ++ public void setCdmaBroadcastActivationResponse(RadioResponseInfo info) { ++ mResponse.setCdmaBroadcastActivationResponse(info); ++ } ++ ++ public void getCDMASubscriptionResponse(RadioResponseInfo info, String mdn, String hSid, String hNid, String min, String prl) { ++ mResponse.getCDMASubscriptionResponse(info, mdn, hSid, hNid, min, prl); ++ } ++ ++ public void writeSmsToRuimResponse(RadioResponseInfo info, int index) { ++ mResponse.writeSmsToRuimResponse(info, index); ++ } ++ ++ public void deleteSmsOnRuimResponse(RadioResponseInfo info) { ++ mResponse.deleteSmsOnRuimResponse(info); ++ } ++ ++ public void getDeviceIdentityResponse(RadioResponseInfo info, String imei, String imeisv, String esn, String meid) { ++ mResponse.getDeviceIdentityResponse(info, imei, imeisv, esn, meid); ++ } ++ ++ public void exitEmergencyCallbackModeResponse(RadioResponseInfo info) { ++ mResponse.exitEmergencyCallbackModeResponse(info); ++ } ++ ++ public void getSmscAddressResponse(RadioResponseInfo info, String smsc) { ++ mResponse.getSmscAddressResponse(info, smsc); ++ } ++ ++ public void setSmscAddressResponse(RadioResponseInfo info) { ++ mResponse.setSmscAddressResponse(info); ++ } ++ ++ public void reportSmsMemoryStatusResponse(RadioResponseInfo info) { ++ mResponse.reportSmsMemoryStatusResponse(info); ++ } ++ ++ public void reportStkServiceIsRunningResponse(RadioResponseInfo info) { ++ mResponse.reportStkServiceIsRunningResponse(info); ++ } ++ ++ public void getCdmaSubscriptionSourceResponse(RadioResponseInfo info, int source) { ++ mResponse.getCdmaSubscriptionSourceResponse(info, source); ++ } ++ ++ public void requestIsimAuthenticationResponse(RadioResponseInfo info, String response) { ++ mResponse.requestIsimAuthenticationResponse(info, response); ++ } ++ ++ public void acknowledgeIncomingGsmSmsWithPduResponse(RadioResponseInfo info) { ++ mResponse.acknowledgeIncomingGsmSmsWithPduResponse(info); ++ } ++ ++ public void sendEnvelopeWithStatusResponse(RadioResponseInfo info, IccIoResult iccIo) { ++ mResponse.sendEnvelopeWithStatusResponse(info, iccIo); ++ } ++ ++ public void getVoiceRadioTechnologyResponse(RadioResponseInfo info, int rat) { ++ mResponse.getVoiceRadioTechnologyResponse(info, rat); ++ } ++ ++ public void getCellInfoListResponse(RadioResponseInfo info, ArrayList cellInfo) { ++ mResponse.getCellInfoListResponse(info, cellInfo); ++ } ++ ++ public void setCellInfoListRateResponse(RadioResponseInfo info) { ++ mResponse.setCellInfoListRateResponse(info); ++ } ++ ++ public void setInitialAttachApnResponse(RadioResponseInfo info) { ++ mResponse.setInitialAttachApnResponse(info); ++ } ++ ++ public void getImsRegistrationStateResponse(RadioResponseInfo info, boolean isRegistered, int ratFamily) { ++ mResponse.getImsRegistrationStateResponse(info, isRegistered, ratFamily); ++ } ++ ++ public void sendImsSmsResponse(RadioResponseInfo info, SendSmsResult sms) { ++ mResponse.sendImsSmsResponse(info, sms); ++ } ++ ++ public void iccTransmitApduBasicChannelResponse(RadioResponseInfo info, IccIoResult result) { ++ mResponse.iccTransmitApduBasicChannelResponse(info, result); ++ } ++ ++ public void iccOpenLogicalChannelResponse(RadioResponseInfo info, int channelId, ArrayList selectResponse) { ++ mResponse.iccOpenLogicalChannelResponse(info, channelId, selectResponse); ++ } ++ ++ public void iccCloseLogicalChannelResponse(RadioResponseInfo info) { ++ mResponse.iccCloseLogicalChannelResponse(info); ++ } ++ ++ public void iccTransmitApduLogicalChannelResponse(RadioResponseInfo info, IccIoResult result) { ++ mResponse.iccTransmitApduLogicalChannelResponse(info, result); ++ } ++ ++ public void nvReadItemResponse(RadioResponseInfo info, String result) { ++ mResponse.nvReadItemResponse(info, result); ++ } ++ ++ public void nvWriteItemResponse(RadioResponseInfo info) { ++ mResponse.nvWriteItemResponse(info); ++ } ++ ++ public void nvWriteCdmaPrlResponse(RadioResponseInfo info) { ++ mResponse.nvWriteCdmaPrlResponse(info); ++ } ++ ++ public void nvResetConfigResponse(RadioResponseInfo info) { ++ mResponse.nvResetConfigResponse(info); ++ } ++ ++ public void setUiccSubscriptionResponse(RadioResponseInfo info) { ++ mResponse.setUiccSubscriptionResponse(info); ++ } ++ ++ public void setDataAllowedResponse(RadioResponseInfo info) { ++ mResponse.setDataAllowedResponse(info); ++ } ++ ++ public void getHardwareConfigResponse(RadioResponseInfo info, ArrayList config) { ++ mResponse.getHardwareConfigResponse(info, config); ++ } ++ ++ public void requestIccSimAuthenticationResponse(RadioResponseInfo info, IccIoResult result) { ++ mResponse.requestIccSimAuthenticationResponse(info, result); ++ } ++ ++ public void setDataProfileResponse(RadioResponseInfo info) { ++ mResponse.setDataProfileResponse(info); ++ } ++ ++ public void requestShutdownResponse(RadioResponseInfo info) { ++ mResponse.requestShutdownResponse(info); ++ } ++ ++ public void getRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc) { ++ mResponse.getRadioCapabilityResponse(info, rc); ++ } ++ ++ public void setRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc) { ++ mResponse.setRadioCapabilityResponse(info, rc); ++ } ++ ++ public void startLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo) { ++ mResponse.startLceServiceResponse(info, statusInfo); ++ } ++ ++ public void stopLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo) { ++ mResponse.stopLceServiceResponse(info, statusInfo); ++ } ++ ++ public void pullLceDataResponse(RadioResponseInfo info, LceDataInfo lceInfo) { ++ mResponse.pullLceDataResponse(info, lceInfo); ++ } ++ ++ public void getModemActivityInfoResponse(RadioResponseInfo info, ActivityStatsInfo activityInfo) { ++ mResponse.getModemActivityInfoResponse(info, activityInfo); ++ } ++ ++ public void setAllowedCarriersResponse(RadioResponseInfo info, int numAllowed) { ++ mResponse.setAllowedCarriersResponse(info, numAllowed); ++ } ++ ++ public void getAllowedCarriersResponse(RadioResponseInfo info, boolean allAllowed, CarrierRestrictions carriers) { ++ mResponse.getAllowedCarriersResponse(info, allAllowed, carriers); ++ } ++ ++ public void sendDeviceStateResponse(RadioResponseInfo info) { ++ mResponse.sendDeviceStateResponse(info); ++ } ++ ++ public void setIndicationFilterResponse(RadioResponseInfo info) { ++ mResponse.setIndicationFilterResponse(info); ++ } ++ ++ public void setSimCardPowerResponse(RadioResponseInfo info) { ++ mResponse.setSimCardPowerResponse(info); ++ } ++ ++ public void acknowledgeRequest(int serial) { ++ mResponse.acknowledgeRequest(serial); ++ } ++ //-- Radio V1_0 ++ ++ //++ Radio V1_1 ++ public void setCarrierInfoForImsiEncryptionResponse(RadioResponseInfo info) { ++ mResponse.setCarrierInfoForImsiEncryptionResponse(info); ++ } ++ ++ public void setSimCardPowerResponse_1_1(RadioResponseInfo info) { ++ mResponse.setSimCardPowerResponse_1_1(info); ++ } ++ ++ public void startNetworkScanResponse(RadioResponseInfo info) { ++ mResponse.startNetworkScanResponse(info); ++ } ++ ++ public void stopNetworkScanResponse(RadioResponseInfo info) { ++ mResponse.stopNetworkScanResponse(info); ++ } ++ ++ public void startKeepaliveResponse(RadioResponseInfo info, KeepaliveStatus status) { ++ mResponse.startKeepaliveResponse(info, status); ++ } ++ ++ public void stopKeepaliveResponse(RadioResponseInfo info) { ++ mResponse.stopKeepaliveResponse(info); ++ } ++ //-- Radio V1_1 ++ ++ //++Radio V1_2 ++ public void getCellInfoListResponse_1_2(RadioResponseInfo info, ArrayList cellInfo) { ++ mResponse.getCellInfoListResponse_1_2(info, cellInfo); ++ } ++ public void getIccCardStatusResponse_1_2(RadioResponseInfo info, android.hardware.radio.V1_2.CardStatus cardStatus) { ++ mResponse.getIccCardStatusResponse_1_2(info, cardStatus); ++ } ++ public void setSignalStrengthReportingCriteriaResponse(RadioResponseInfo info) { ++ mResponse.setSignalStrengthReportingCriteriaResponse(info); ++ } ++ public void setLinkCapacityReportingCriteriaResponse(RadioResponseInfo info) { ++ mResponse.setLinkCapacityReportingCriteriaResponse(info); ++ } ++ public void getCurrentCallsResponse_1_2(RadioResponseInfo info, ArrayList calls) { ++ mResponse.getCurrentCallsResponse_1_2(info, calls); ++ } ++ public void getSignalStrengthResponse_1_2(RadioResponseInfo info, android.hardware.radio.V1_2.SignalStrength signalStrength) { ++ mResponse.getSignalStrengthResponse_1_2(info, signalStrength); ++ } ++ public void getVoiceRegistrationStateResponse_1_2(RadioResponseInfo info, android.hardware.radio.V1_2.VoiceRegStateResult voiceRegResponse) { ++ mResponse.getVoiceRegistrationStateResponse_1_2(info, voiceRegResponse); ++ } ++ public void getDataRegistrationStateResponse_1_2(RadioResponseInfo info, android.hardware.radio.V1_2.DataRegStateResult dataRegResponse) { ++ mResponse.getDataRegistrationStateResponse_1_2(info, dataRegResponse); ++ } ++ //-- Radio V1_2 ++ public void secGetIccCardStatusReponse(RadioResponseInfo info, SecCardStatus cardStatus) {} ++ public void secSupplyNetworkDepersonalizationResponse(RadioResponseInfo info, int remainingRetries) {} ++ public void secAcceptCallResponse(RadioResponseInfo info) {} ++ public void secDialResponse(RadioResponseInfo info) {} ++ public void secGetCurrentCallsResponse(RadioResponseInfo info, ArrayList calls) {} ++ public void secGetSignalStrengthResponse(RadioResponseInfo info, SecSignalStrength sigStrength) {} ++ public void secGetVoiceRegistrationStateResponse(RadioResponseInfo info, SecVoiceRegStateResult voiceRegResponse) {} ++ public void secGetDataRegistrationStateResponse(RadioResponseInfo info, SecDataRegStateResult dataRegResponse) {} ++ public void secExplicitCallTransferResponse(RadioResponseInfo info) {} ++ public void secGetOperatorRespnse(RadioResponseInfo info, String longName, String shortName, String plmn, String epdgname) {} ++ public void oemSetBarringPasswordResponse(RadioResponseInfo info) {} ++ public void secgetImsRegistrationStateReponse(RadioResponseInfo info, ArrayList regState) {} ++ public void secGetAvailableNetworkResponse(RadioResponseInfo info, ArrayList networkInfo) {} ++ public void oemDialEmergencyCallResponse(RadioResponseInfo info) {} ++ public void oemCallDeflectionResponse(RadioResponseInfo info) {} ++ public void oemModifyCallInitiateResponse(RadioResponseInfo info, LastCallFailCauseInfo failCauseInfo) {} ++ public void oemSetImsCallListResponse(RadioResponseInfo info) {} ++ public void oemGetPreferredNetworkListResponse(RadioResponseInfo info, ArrayList infos) {} ++ public void oemSetPreferredNetworkListResponse(RadioResponseInfo info) {} ++ public void oemSendEncodedUSSDResponse(RadioResponseInfo info) {} ++ public void oemHoldCallResponse(RadioResponseInfo info) {} ++ public void oemGetDisable2gResponse(RadioResponseInfo info, int isDisable) {} ++ public void oemSetDisable2gResponse(RadioResponseInfo info) {} ++ public void oenGetAcbInfoResponse(RadioResponseInfo info, ArrayList acbInfo) {} ++ public void oemSetTransferCallResponse(RadioResponseInfo info) {} ++ public void oemGetICBarringResponse(RadioResponseInfo info, String numberDateList) {} ++ public void oemSetICBarringResponse(RadioResponseInfo info) {} ++ public void oemQueryCnapResponse(RadioResponseInfo info, int queryCNAP) {} ++ public void oemRefreshNitzTimeResponse(RadioResponseInfo info) {} ++ public void oemEnableUnsolResponseResponse(RadioResponseInfo info) {} ++ public void oemCancelTransferCallResponse(RadioResponseInfo info) {} ++ public void oemAcknowledgeRilConnectedResponse(RadioResponseInfo info) {} ++ public void oemGetPhoneBookStorageInfoResponse(RadioResponseInfo info, ArrayList phoneBookInfo) {} ++ public void oemUsimPbCapaResponse(RadioResponseInfo info, ArrayList usimPbCapa) {} ++ public void oemSetSimPowerResponse(RadioResponseInfo info, int power) {} ++ public void oemSetSimOnOffResponse(RadioResponseInfo info) {} ++ public void oemSetSimInitEventResponse(RadioResponseInfo info) {} ++ public void oemGetSimLockInfoResponse(RadioResponseInfo info, ArrayList simLockInfO) {} ++ public void oemSupplyIccPersoResponse(RadioResponseInfo info) {} ++ public void oemChangeIccPersoResponse(RadioResponseInfo info) {} ++ public void oemGetPhoneBookEntryResponse(RadioResponseInfo info, OemSimPBResponse SimPBResponseInfo) {} ++ public void oemAccessPhoneBookEntryResponse(RadioResponseInfo info, int SimPbAccessResp) {} ++ public void oemGetCellBroadcastConfigResponse(RadioResponseInfo info, OemCbConfigArgs configs) {} ++ public void oemEmergencySearchResponse(RadioResponseInfo info, int respEmergencySearch) {} ++ public void oemEmergencyControlResponse(RadioResponseInfo info) {} ++ public void oemGetAtrResponse(RadioResponseInfo info, String atr) {} ++ public void oemSendCdmaSmsExpectMoreResponse(RadioResponseInfo info, SecSendSmsResult sms) {} ++ public void secSendSmsResponse(RadioResponseInfo info, SecSendSmsResult sms) {} ++ public void secSendSMSExpectMoreResponse(RadioResponseInfo info, SecSendSmsResult sms) {} ++ public void secSendCdmaSmsResponse(RadioResponseInfo info, SecSendSmsResult sms) {} ++ public void secSendImsSmsResponse(RadioResponseInfo info, SecSendSmsResult sms) {} ++ public void secSetDataAllowedResponse(RadioResponseInfo info) {} ++ public void secGetCdmaRoamingPreferenceResponse(RadioResponseInfo info, int n, int m) {} ++ public void secEnable5gResponse(RadioResponseInfo info) {} ++ public void secDisable5gResponse(RadioResponseInfo info) {} ++ public void secQuery5gStatusResponse(RadioResponseInfo info) {} ++ public void secQueryNrDcParamResponse(RadioResponseInfo info, DcParam endcDcnr) {} ++ public void secQueryNrBearerAllocationResponse(RadioResponseInfo info, int bearerStatus) {} ++ public void secQueryNrSignalStrengthResponse(RadioResponseInfo info, NrSignalStrength nrSignalStrength) {} ++ public void oemQueryCsgListResponse(RadioResponseInfo info, ArrayList csgInfos) {} ++ public void oemSelectCsgManualResponse(RadioResponseInfo info) {} ++} +-- +2.17.1 + diff --git a/patches/platform_frameworks_opt_telephony/0007-telephony-forward-port-support-for-forceCognitive.patch b/patches/platform_frameworks_opt_telephony/0007-telephony-forward-port-support-for-forceCognitive.patch new file mode 100644 index 0000000..e040b9f --- /dev/null +++ b/patches/platform_frameworks_opt_telephony/0007-telephony-forward-port-support-for-forceCognitive.patch @@ -0,0 +1,45 @@ +From 5c9753b0fe01bf6b5b025a3c2ad9405e92341fc4 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 13 Oct 2019 17:21:31 +0800 +Subject: [PATCH 7/7] telephony: forward-port support for forceCognitive + +* This is needed on some MTK devices. Android 10 refactored some code, + so now the "non-persistent/cognitive" filter is relocated to RIL and + also in DcTracker.setupData(). +--- + src/java/com/android/internal/telephony/RIL.java | 3 ++- + .../android/internal/telephony/dataconnection/DcTracker.java | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java +index 586dd063a..cc8997ccc 100644 +--- a/src/java/com/android/internal/telephony/RIL.java ++++ b/src/java/com/android/internal/telephony/RIL.java +@@ -3963,7 +3963,8 @@ public class RIL extends BaseCommands implements CommandsInterface { + for (DataProfile dp : dps) { + // For v1.0 to v1.2, we only send data profiles that has the persistent + // (a.k.a modem cognitive) bit set to true. +- if (dp.isPersistent()) { ++ boolean forceCognitive = SystemProperties.getBoolean("persist.sys.phh.radio.force_cognitive", false); ++ if (dp.isPersistent() || forceCognitive) { + dpis.add(convertToHalDataProfile10(dp)); + } + } +diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java +index 7a4bfd8d3..f5c54cc40 100644 +--- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java ++++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java +@@ -1890,8 +1890,9 @@ public class DcTracker extends Handler { + } + + // profile id is only meaningful when the profile is persistent on the modem. ++ boolean forceCognitive = SystemProperties.getBoolean("persist.sys.phh.radio.force_cognitive", false); + int profileId = DATA_PROFILE_INVALID; +- if (apnSetting.isPersistent()) { ++ if (apnSetting.isPersistent() || forceCognitive) { + profileId = apnSetting.getProfileId(); + if (profileId == DATA_PROFILE_DEFAULT) { + profileId = getApnProfileID(apnContext.getApnType()); +-- +2.17.1 + diff --git a/patches/platform_packages_apps_Settings/0001-Act-as-usb-device-when-there-is-no-hal-but-we-believ.patch b/patches/platform_packages_apps_Settings/0001-Act-as-usb-device-when-there-is-no-hal-but-we-believ.patch new file mode 100644 index 0000000..d19b27d --- /dev/null +++ b/patches/platform_packages_apps_Settings/0001-Act-as-usb-device-when-there-is-no-hal-but-we-believ.patch @@ -0,0 +1,33 @@ +From b009ff6561e52e151adfc4aaa5b0b4a56a66cac3 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 21:48:19 +0200 +Subject: [PATCH] Act as usb device when there is no hal, but we believe we are + a device + +Change-Id: I036090738525fd8cc63534d52d02ab1852950a7d +--- + .../usb/UsbConnectionBroadcastReceiver.java | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java +index 695a714528..1f2b751991 100644 +--- a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java ++++ b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java +@@ -76,6 +76,14 @@ public class UsbConnectionBroadcastReceiver extends BroadcastReceiver implements + mFunctions = functions; + mDataRole = mUsbBackend.getDataRole(); + mPowerRole = mUsbBackend.getPowerRole(); ++ //If we have no USB HAL, mDataRole is invalid ++ //But we can't be connected AND have none data_role, so it's safe. ++ //It would be better to fix UsbManager when no HAL is available, but that's more work ++ if(mDataRole == UsbPortStatus.DATA_ROLE_NONE && ++ intent.getExtras().getBoolean(UsbManager.USB_CONNECTED) && ++ !intent.getExtras().getBoolean(UsbManager.USB_HOST_CONNECTED)) ++ mDataRole = UsbPortStatus.DATA_ROLE_DEVICE; ++ + } + } else if (UsbManager.ACTION_USB_PORT_CHANGED.equals(intent.getAction())) { + UsbPortStatus portStatus = intent.getExtras() +-- +2.17.1 + diff --git a/patches/platform_packages_services_Telephony/0001-Telephony-Support-muting-by-RIL-command.patch b/patches/platform_packages_services_Telephony/0001-Telephony-Support-muting-by-RIL-command.patch new file mode 100644 index 0000000..f665930 --- /dev/null +++ b/patches/platform_packages_services_Telephony/0001-Telephony-Support-muting-by-RIL-command.patch @@ -0,0 +1,41 @@ +From 014a893a2872fb067c83a866d39ef1c4da70aaff Mon Sep 17 00:00:00 2001 +From: Artem Borisov +Date: Wed, 19 Sep 2018 17:02:06 +0300 +Subject: [PATCH 1/3] Telephony: Support muting by RIL command + +While almost everyone already moved to AudioManager years ago, +some OEMs (cough Huawei) still use RIL for muting and don't +promote the necessary calls in their audio HAL. +Let's handle these odd cases too when it's necessary. + +Change-Id: Id916dec2574d6e57b6f809fbaf2b0959c0cc7256 +--- + src/com/android/services/telephony/TelephonyConnection.java | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java +index 7bb6b7d55..18e078fe3 100644 +--- a/src/com/android/services/telephony/TelephonyConnection.java ++++ b/src/com/android/services/telephony/TelephonyConnection.java +@@ -25,6 +25,7 @@ import android.os.Handler; + import android.os.Looper; + import android.os.Message; + import android.os.PersistableBundle; ++import android.os.SystemProperties; + import android.telecom.CallAudioState; + import android.telecom.ConferenceParticipant; + import android.telecom.Connection; +@@ -736,6 +737,10 @@ abstract class TelephonyConnection extends Connection implements Holdable { + // TODO: update TTY mode. + if (getPhone() != null) { + getPhone().setEchoSuppressionEnabled(); ++ ++ if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) { ++ getPhone().setMute(audioState.isMuted()); ++ } + } + } + +-- +2.17.1 + diff --git a/patches/platform_packages_services_Telephony/0002-Fixes-crash-when-selecting-network.patch b/patches/platform_packages_services_Telephony/0002-Fixes-crash-when-selecting-network.patch new file mode 100644 index 0000000..a4e16f3 --- /dev/null +++ b/patches/platform_packages_services_Telephony/0002-Fixes-crash-when-selecting-network.patch @@ -0,0 +1,50 @@ +From 7c9e1ac4204748173e182c353f2c5b5c45ac1cdb Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 6 May 2019 20:25:34 +0200 +Subject: [PATCH 2/3] Fixes crash when selecting network + +Cf https://github.com/phhusson/treble_experimentations/issues/486 +--- + src/com/android/phone/NetworkQueryService.java | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/com/android/phone/NetworkQueryService.java b/src/com/android/phone/NetworkQueryService.java +index e67582fa3..c622713e8 100644 +--- a/src/com/android/phone/NetworkQueryService.java ++++ b/src/com/android/phone/NetworkQueryService.java +@@ -43,6 +43,8 @@ import com.android.settingslib.utils.ThreadUtils; + + import java.util.ArrayList; + import java.util.List; ++import java.util.regex.Matcher; ++import java.util.regex.Pattern; + + /** + * Service code used to assist in querying the network for service +@@ -377,14 +379,20 @@ public class NetworkQueryService extends Service { + */ + private List getCellInfoList(List operatorInfoList) { + List cellInfoList = new ArrayList<>(); ++ Pattern p = Pattern.compile("^([0-9]{5,6}).*"); + for (OperatorInfo oi: operatorInfoList) { + String operatorNumeric = oi.getOperatorNumeric(); + String mcc = null; + String mnc = null; + log("operatorNumeric: " + operatorNumeric); +- if (operatorNumeric != null && operatorNumeric.matches("^[0-9]{5,6}$")) { +- mcc = operatorNumeric.substring(0, 3); +- mnc = operatorNumeric.substring(3); ++ if (operatorNumeric != null) { ++ Matcher m = p.matcher(operatorNumeric); ++ if (m.matches()) { ++ mcc = m.group(1).substring(0, 3); ++ mnc = m.group(1).substring(3); ++ } else { ++ Log.e(LOG_TAG, "Failed to parse operatorNumeric!"); ++ } + } + CellIdentityGsm cig = new CellIdentityGsm( + Integer.MAX_VALUE /* lac */, +-- +2.17.1 + diff --git a/patches/platform_packages_services_Telephony/0003-Fail-gracefully-in-mobile-settings.patch b/patches/platform_packages_services_Telephony/0003-Fail-gracefully-in-mobile-settings.patch new file mode 100644 index 0000000..7816e29 --- /dev/null +++ b/patches/platform_packages_services_Telephony/0003-Fail-gracefully-in-mobile-settings.patch @@ -0,0 +1,31 @@ +From 0c7e103fd7c8d50322057a1f0fe852de9df0a029 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 20 May 2019 23:45:56 +0200 +Subject: [PATCH 3/3] Fail gracefully in mobile settings + +--- + src/com/android/phone/DataUsagePreference.java | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/com/android/phone/DataUsagePreference.java b/src/com/android/phone/DataUsagePreference.java +index b6b26e2b8..ebd446dfa 100644 +--- a/src/com/android/phone/DataUsagePreference.java ++++ b/src/com/android/phone/DataUsagePreference.java +@@ -54,8 +54,12 @@ public class DataUsagePreference extends Preference { + DataUsageController controller = new DataUsageController(activity); + + DataUsageController.DataUsageInfo usageInfo = controller.getDataUsageInfo(mTemplate); +- setSummary(activity.getString(R.string.data_usage_template, +- Formatter.formatFileSize(activity, usageInfo.usageLevel), usageInfo.period)); ++ if(usageInfo != null) { ++ setSummary(activity.getString(R.string.data_usage_template, ++ Formatter.formatFileSize(activity, usageInfo.usageLevel), usageInfo.period)); ++ } else { ++ setSummary(activity.getString(R.string.data_usage_title)); ++ } + setIntent(getIntent()); + } + +-- +2.17.1 + diff --git a/patches/platform_system_bpf/0001-Disable-rlimit-on-bpfloader-because-it-will-crash-8..patch b/patches/platform_system_bpf/0001-Disable-rlimit-on-bpfloader-because-it-will-crash-8..patch new file mode 100644 index 0000000..d8ae8af --- /dev/null +++ b/patches/platform_system_bpf/0001-Disable-rlimit-on-bpfloader-because-it-will-crash-8..patch @@ -0,0 +1,24 @@ +From 8d85aaa52cf7deabcda97053cfc59288dd969d63 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 20:41:03 +0200 +Subject: [PATCH] Disable rlimit on bpfloader, because it will crash 8.0 init + +Change-Id: Ic6d7c8fa702ed5d2df7d4fff4f1c0a848a91e86b +--- + bpfloader/bpfloader.rc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bpfloader/bpfloader.rc b/bpfloader/bpfloader.rc +index 31747fb..d95cdbd 100644 +--- a/bpfloader/bpfloader.rc ++++ b/bpfloader/bpfloader.rc +@@ -5,5 +5,5 @@ service bpfloader /system/bin/bpfloader + # Actually only 8MB is needed, but since bpfloader runs as root, it shares + # the global rlimit. Once bpfloader is running as its own user in the + # future, it will have dedicated rlimit to itself and this can be 8MB. +- rlimit memlock 67108864 67108864 ++ #rlimit memlock 67108864 67108864 + oneshot +-- +2.17.1 + diff --git a/patches/platform_system_bt/0001-Make-BTM_BYPASS_EXTRA_ACL_SETUP-dynamic.patch b/patches/platform_system_bt/0001-Make-BTM_BYPASS_EXTRA_ACL_SETUP-dynamic.patch new file mode 100644 index 0000000..4467f59 --- /dev/null +++ b/patches/platform_system_bt/0001-Make-BTM_BYPASS_EXTRA_ACL_SETUP-dynamic.patch @@ -0,0 +1,105 @@ +From fef557417bece64d452454b3263ce2a8d3661ff9 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 20 Feb 2018 23:04:50 +0100 +Subject: [PATCH 1/2] Make BTM_BYPASS_EXTRA_ACL_SETUP dynamic + +Change-Id: Icb0868566b29b053ed7e83c9fd32e225af3f2e46 +--- + hci/include/bt_hci_bdroid.h | 3 +++ + internal_include/bt_target.h | 3 +++ + stack/btm/btm_acl.cc | 20 ++++++++++---------- + stack/btm/btm_sec.cc | 18 +++++++++--------- + 4 files changed, 25 insertions(+), 19 deletions(-) + +diff --git a/hci/include/bt_hci_bdroid.h b/hci/include/bt_hci_bdroid.h +index cf2c1136f..e2844db82 100644 +--- a/hci/include/bt_hci_bdroid.h ++++ b/hci/include/bt_hci_bdroid.h +@@ -32,6 +32,9 @@ + #ifdef HAS_BDROID_BUILDCFG + #include "bdroid_buildcfg.h" + #endif ++#ifndef BTM_BYPASS_EXTRA_ACL_SETUP ++#define BTM_BYPASS_EXTRA_ACL_SETUP TRUE ++#endif + + /****************************************************************************** + * Constants & Macros +diff --git a/internal_include/bt_target.h b/internal_include/bt_target.h +index 67a67c56d..3021ca37b 100644 +--- a/internal_include/bt_target.h ++++ b/internal_include/bt_target.h +@@ -32,6 +32,9 @@ + #ifdef HAS_BDROID_BUILDCFG + #include "bdroid_buildcfg.h" + #endif ++#ifndef BTM_BYPASS_EXTRA_ACL_SETUP ++#define BTM_BYPASS_EXTRA_ACL_SETUP TRUE ++#endif + + #include "bt_types.h" /* This must be defined AFTER buildcfg.h */ + +diff --git a/stack/btm/btm_acl.cc b/stack/btm/btm_acl.cc +index dcb2fb4d9..5a6c3631e 100644 +--- a/stack/btm/btm_acl.cc ++++ b/stack/btm/btm_acl.cc +@@ -1186,17 +1186,17 @@ void btm_read_remote_ext_features_failed(uint8_t status, uint16_t handle) { + void btm_establish_continue(tACL_CONN* p_acl_cb) { + tBTM_BL_EVENT_DATA evt_data; + BTM_TRACE_DEBUG("btm_establish_continue"); +-#if (BTM_BYPASS_EXTRA_ACL_SETUP == FALSE) +- if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) { +- /* For now there are a some devices that do not like sending */ +- /* commands events and data at the same time. */ +- /* Set the packet types to the default allowed by the device */ +- btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported); +- +- if (btm_cb.btm_def_link_policy) +- BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy); ++ if (!BTM_BYPASS_EXTRA_ACL_SETUP) { ++ if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) { ++ /* For now there are a some devices that do not like sending */ ++ /* commands events and data at the same time. */ ++ /* Set the packet types to the default allowed by the device */ ++ btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported); ++ ++ if (btm_cb.btm_def_link_policy) ++ BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy); ++ } + } +-#endif + if (p_acl_cb->link_up_issued) { + BTM_TRACE_ERROR("%s: Already link is up ", __func__); + return; +diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc +index 4df0974dd..eb28b0a97 100644 +--- a/stack/btm/btm_sec.cc ++++ b/stack/btm/btm_sec.cc +@@ -4366,15 +4366,15 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status, + if (p_acl_cb) { + /* whatever is in btm_establish_continue() without reporting the BTM_BL_CONN_EVT + * event */ +-#if (BTM_BYPASS_EXTRA_ACL_SETUP == FALSE) +- /* For now there are a some devices that do not like sending */ +- /* commands events and data at the same time. */ +- /* Set the packet types to the default allowed by the device */ +- btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported); +- +- if (btm_cb.btm_def_link_policy) +- BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy); +-#endif ++ if(!BTM_BYPASS_EXTRA_ACL_SETUP) { ++ /* For now there are a some devices that do not like sending */ ++ /* commands events and data at the same time. */ ++ /* Set the packet types to the default allowed by the device */ ++ btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported); ++ ++ if (btm_cb.btm_def_link_policy) ++ BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy); ++ } + } + btm_acl_created(bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name, handle, + HCI_ROLE_SLAVE, BT_TRANSPORT_BR_EDR); +-- +2.17.1 + diff --git a/patches/platform_system_bt/0002-Add-props-to-control-supported-features-and-states-1.patch b/patches/platform_system_bt/0002-Add-props-to-control-supported-features-and-states-1.patch new file mode 100644 index 0000000..191dadc --- /dev/null +++ b/patches/platform_system_bt/0002-Add-props-to-control-supported-features-and-states-1.patch @@ -0,0 +1,153 @@ +From 9bc6c5d104edf78b5f795e17560ee4f8bb39a122 Mon Sep 17 00:00:00 2001 +From: penn5 +Date: Mon, 4 Mar 2019 22:21:07 +0000 +Subject: [PATCH 2/2] Add props to control supported features and states (#1) + +* Add bitmask for supported fields +Use persist.sys.bt.unsupport.states, defaults to 0, left-aligned. +Huawei suggest to use 000000000000000000000011111 + +* Add bitmask to LOCAL_SUPPORTED_FEATURES +For Huawei, suggest to use 00000001 + +Documentation: +- persist.sys.bt.unsupport.features matches the values: +HCI_3_SLOT_PACKETS..HCI_LMP_EXTENDED_SUPPORTED (max 8bits * 8 bytes = +64 bits) +- persist.sys.bt.unsupport.states matches the values: +BTM_BLE_STATE_INVALID..BTM_BLE_STATE_SCAN_ADV (max = 0x3ff, 11 bits) +- persist.sys.bt.unsupport.stdfeatures ( max: 16 bits) +HCI_LE_ENCRYPTION..HCI_LE_PERIODIC_ADVERTISING +--- + hci/src/hci_packet_parser.cc | 77 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 77 insertions(+) + +diff --git a/hci/src/hci_packet_parser.cc b/hci/src/hci_packet_parser.cc +index b1efd444d..88dc4c6cd 100644 +--- a/hci/src/hci_packet_parser.cc ++++ b/hci/src/hci_packet_parser.cc +@@ -27,6 +27,8 @@ + #include "hcimsgs.h" + #include "osi/include/log.h" + ++#include ++ + static const command_opcode_t NO_OPCODE_CHECKING = 0; + + static const allocator_t* buffer_allocator; +@@ -108,6 +110,31 @@ static void parse_read_local_supported_commands_response( + buffer_allocator->free(response); + } + ++static void setup_bitmask(uint8_t *v, const char* property) { ++ char str[PROPERTY_VALUE_MAX]; ++ int len = property_get(property, str, ""); ++ memset(v, 255, 8); ++ for(int i = 0; ifree(response); + } + +@@ -148,6 +185,19 @@ static void parse_ble_read_buffer_size_response(BT_HDR* response, + buffer_allocator->free(response); + } + ++ ++static void filter_supported_states(uint8_t *v, int size) { ++ static int setup = 0; ++ static uint8_t unsupport_bitmask[8]; ++ if(!setup) { ++ setup = 1; ++ setup_bitmask(unsupport_bitmask, "persist.sys.bt.unsupport.states"); ++ } ++ ++ for(int i=0; ifree(response); + } + ++static void filter_supported_stdfeatures(uint8_t *v) { ++ static int setup = 0; ++ static uint8_t unsupport_bitmask[8]; ++ if(!setup) { ++ setup = 1; ++ setup_bitmask(unsupport_bitmask, "persist.sys.bt.unsupport.stdfeatures"); ++ } ++ ++ for(unsigned i=0; ias_array, stream, + (int)sizeof(bt_device_features_t)); + ++ for (int i = 0; i < ((int)sizeof(bt_device_features_t)); i++) ++ LOG_DEBUG(LOG_TAG, "supported state 0x%x is 0x%x", i, supported_features->as_array[i]); ++ filter_supported_stdfeatures(supported_features->as_array); ++ for (int i = 0; i < ((int)sizeof(bt_device_features_t)); i++) ++ LOG_DEBUG(LOG_TAG, "supported.2 state 0x%x is 0x%x", i, supported_features->as_array[i]); ++ + buffer_allocator->free(response); + } + +-- +2.17.1 + diff --git a/patches/platform_system_core/0001-Revert-logd-add-passcred-for-logdw-socket.patch b/patches/platform_system_core/0001-Revert-logd-add-passcred-for-logdw-socket.patch new file mode 100644 index 0000000..cd98dc9 --- /dev/null +++ b/patches/platform_system_core/0001-Revert-logd-add-passcred-for-logdw-socket.patch @@ -0,0 +1,53 @@ +From 452c6e9529d5c66857853de368d1770b743d7678 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sun, 10 Dec 2017 00:26:21 +0100 +Subject: [PATCH 01/12] Revert "logd: add "+passcred" for logdw socket" + +This reverts commit 54d8ff1121440d0ef4565ce0ab3751f82fdb393c. + +Android 8.0 init doesn't understand this new syntax +--- + logd/LogListener.cpp | 10 +++++----- + logd/logd.rc | 2 +- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp +index 2f227788c..240127e2d 100644 +--- a/logd/LogListener.cpp ++++ b/logd/LogListener.cpp +@@ -149,14 +149,14 @@ int LogListener::getLogSocket() { + static const char socketName[] = "logdw"; + int sock = android_get_control_socket(socketName); + +- if (sock < 0) { // logd started up in init.sh ++ if (sock < 0) { + sock = socket_local_server( + socketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_DGRAM); ++ } + +- int on = 1; +- if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on))) { +- return -1; +- } ++ int on = 1; ++ if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) { ++ return -1; + } + return sock; + } +diff --git a/logd/logd.rc b/logd/logd.rc +index 438419ad6..5514e9456 100644 +--- a/logd/logd.rc ++++ b/logd/logd.rc +@@ -1,7 +1,7 @@ + service logd /system/bin/logd + socket logd stream 0666 logd logd + socket logdr seqpacket 0666 logd logd +- socket logdw dgram+passcred 0222 logd logd ++ socket logdw dgram 0222 logd logd + file /proc/kmsg r + file /dev/kmsg w + user logd +-- +2.17.1 + diff --git a/patches/platform_system_core/0002-Some-kernel-crashes-when-using-too-recent-sdcardfs-o.patch b/patches/platform_system_core/0002-Some-kernel-crashes-when-using-too-recent-sdcardfs-o.patch new file mode 100644 index 0000000..03ea14b --- /dev/null +++ b/patches/platform_system_core/0002-Some-kernel-crashes-when-using-too-recent-sdcardfs-o.patch @@ -0,0 +1,28 @@ +From 84efb8f43e2be2b7ab3c5a04956199b7f8683556 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 19:33:03 +0200 +Subject: [PATCH 02/12] Some kernel crashes when using too recent sdcardfs + options. Force everyone to old options + +Change-Id: Ia5cf1aa8dc07a0f4a78b4d8f760ca0944dabaa89 +--- + sdcard/sdcard.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp +index 2b358197a..4420ebbd2 100644 +--- a/sdcard/sdcard.cpp ++++ b/sdcard/sdcard.cpp +@@ -110,7 +110,8 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de + if (unshared_obb) new_opts_list.push_back("unshared_obb,"); + // Try several attempts, each time with one less option, to gracefully + // handle older kernels that aren't updated yet. +- for (int i = 0; i <= new_opts_list.size(); ++i) { ++ int first_option_to_try = property_get_bool("persist.sys.phh.modern_sdcard", false) ? 0 : 2; ++ for (int i = first_option_to_try; i <= new_opts_list.size(); ++i) { + std::string new_opts; + for (int j = 0; j < new_opts_list.size() - i; ++j) { + new_opts += new_opts_list[j]; +-- +2.17.1 + diff --git a/patches/platform_system_core/0003-First-drop_privs-which-may-fail-and-only-run-thread-.patch b/patches/platform_system_core/0003-First-drop_privs-which-may-fail-and-only-run-thread-.patch new file mode 100644 index 0000000..7bfea44 --- /dev/null +++ b/patches/platform_system_core/0003-First-drop_privs-which-may-fail-and-only-run-thread-.patch @@ -0,0 +1,44 @@ +From 51f63fdc8fa7144cb2bee8e5a8f8fef6db7a0447 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 19:33:23 +0200 +Subject: [PATCH 03/12] First drop_privs (which may fail) and only run thread + that might be scheduled before us + +Change-Id: I118fb2d4beedbeecf5d3a8d255929d3be480b923 +--- + logd/main.cpp | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/logd/main.cpp b/logd/main.cpp +index fd3cdf877..4057347b8 100644 +--- a/logd/main.cpp ++++ b/logd/main.cpp +@@ -440,6 +440,12 @@ int main(int argc, char* argv[]) { + if (fdPmesg < 0) android::prdebug("Failed to open %s\n", proc_kmsg); + } + ++ bool auditd = ++ __android_logger_property_get_bool("ro.logd.auditd", BOOL_DEFAULT_TRUE); ++ if (drop_privs(klogd, auditd) != 0) { ++ return EXIT_FAILURE; ++ } ++ + // Reinit Thread + sem_init(&reinit, 0, 0); + sem_init(&uidName, 0, 0); +@@ -461,12 +467,6 @@ int main(int argc, char* argv[]) { + pthread_attr_destroy(&attr); + } + +- bool auditd = +- __android_logger_property_get_bool("ro.logd.auditd", BOOL_DEFAULT_TRUE); +- if (drop_privs(klogd, auditd) != 0) { +- return EXIT_FAILURE; +- } +- + // Serves the purpose of managing the last logs times read on a + // socket connection, and as a reader lock on a range of log + // entries. +-- +2.17.1 + diff --git a/patches/platform_system_core/0004-Ignore-proc-kmsg-if-reading-from-it-faults.patch b/patches/platform_system_core/0004-Ignore-proc-kmsg-if-reading-from-it-faults.patch new file mode 100644 index 0000000..e87776e --- /dev/null +++ b/patches/platform_system_core/0004-Ignore-proc-kmsg-if-reading-from-it-faults.patch @@ -0,0 +1,33 @@ +From 9d1ea37580d14cc71170595ec0c73fc04a99243a Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 2 Jan 2019 17:17:20 +0100 +Subject: [PATCH 04/12] Ignore /proc/kmsg if reading from it faults + +On some devices, (The only known one is Y6 2018), reading from +/proc/kmsg fails, with a status EFAULT +This isn't just from logd, a simple cat /proc/kmsg does that as well. + +Simply stop reading logs from kernel in that case + +Change-Id: I4b902b7ec36107c722e2f5cc5dbb7964734bb71d +--- + logd/LogKlog.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp +index edd326aec..8ff719f6e 100644 +--- a/logd/LogKlog.cpp ++++ b/logd/LogKlog.cpp +@@ -238,6 +238,9 @@ bool LogKlog::onDataAvailable(SocketClient* cli) { + break; + } + if (retval < 0) { ++ if(errno == EFAULT) { ++ stopListener(); ++ } + return false; + } + len += retval; +-- +2.17.1 + diff --git a/patches/platform_system_core/0005-Panic-into-recovery-rather-than-bootloader.patch b/patches/platform_system_core/0005-Panic-into-recovery-rather-than-bootloader.patch new file mode 100644 index 0000000..9c12425 --- /dev/null +++ b/patches/platform_system_core/0005-Panic-into-recovery-rather-than-bootloader.patch @@ -0,0 +1,29 @@ +From 6892df4432eb01985e64368643708d68a6c8ac50 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 4 Sep 2019 21:11:48 +0200 +Subject: [PATCH 05/12] Panic into recovery rather than bootloader + +Getting last_kmsg/pstore from bootloader isn't possible for other people +than the OEM, but we have TWRP to access last_kmsg/pstore + +Change-Id: If04bb6572dc66677d7b44f7d302b2d69ce526200 +--- + init/reboot_utils.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/init/reboot_utils.cpp b/init/reboot_utils.cpp +index d1a712f2e..e79b634e8 100644 +--- a/init/reboot_utils.cpp ++++ b/init/reboot_utils.cpp +@@ -32,7 +32,7 @@ + namespace android { + namespace init { + +-static std::string init_fatal_reboot_target = "bootloader"; ++static std::string init_fatal_reboot_target = "recovery"; + + void SetFatalRebootTarget() { + std::string cmdline; +-- +2.17.1 + diff --git a/patches/platform_system_core/0006-HACK-XXX-Never-check-adb-key.patch b/patches/platform_system_core/0006-HACK-XXX-Never-check-adb-key.patch new file mode 100644 index 0000000..fc03cb1 --- /dev/null +++ b/patches/platform_system_core/0006-HACK-XXX-Never-check-adb-key.patch @@ -0,0 +1,34 @@ +From 51a0a2ece994b4a5feddf1f080c51ff57028b2c9 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Fri, 6 Sep 2019 15:09:45 +0200 +Subject: [PATCH 06/12] HACK XXX Never check adb key + +Change-Id: Ic933023724c80f4a30725bb23de03fba9c5fbd12 +--- + adb/daemon/main.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp +index e5a49171b..90fefc901 100644 +--- a/adb/daemon/main.cpp ++++ b/adb/daemon/main.cpp +@@ -205,6 +205,7 @@ int adbd_main(int server_port) { + // descriptor will always be open. + adbd_cloexec_auth_socket(); + ++#if 0 + #if defined(ALLOW_ADBD_NO_AUTH) + // If ro.adb.secure is unset, default to no authentication required. + auth_required = android::base::GetBoolProperty("ro.adb.secure", false); +@@ -213,6 +214,8 @@ int adbd_main(int server_port) { + auth_required = android::base::GetBoolProperty("ro.adb.secure", false); + } + #endif ++#endif ++ auth_required = false; + + adbd_auth_init(); + +-- +2.17.1 + diff --git a/patches/platform_system_core/0007-first-stage-If-Vboot2-fails-fall-back-to-Vboot1.patch b/patches/platform_system_core/0007-first-stage-If-Vboot2-fails-fall-back-to-Vboot1.patch new file mode 100644 index 0000000..60d8121 --- /dev/null +++ b/patches/platform_system_core/0007-first-stage-If-Vboot2-fails-fall-back-to-Vboot1.patch @@ -0,0 +1,41 @@ +From 683ff1f93a10edbccd533056f836eb1307686783 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 13:05:37 +0200 +Subject: [PATCH 07/12] [first stage] If Vboot2 fails, fall-back to Vboot1 + +Some devices, for instance Honor View 10, running Pie vendor declares +vbmeta in their device-tree, but doesn't have a vbmeta partition. + +Test: without this fix the device reboots into bootloader +Test: with this fix, the device boots. + +Please note that other fixes are also required to get this device to +actually boot. + +Change-Id: I97a7042fb03f817c41b801d558e438d2c1f6c375 +--- + init/first_stage_mount.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp +index 3e76556ff..41498202f 100644 +--- a/init/first_stage_mount.cpp ++++ b/init/first_stage_mount.cpp +@@ -852,7 +852,13 @@ bool DoFirstStageMount() { + LOG(ERROR) << "Failed to create FirstStageMount"; + return false; + } +- return handle->DoFirstStageMount(); ++ if(!handle->DoFirstStageMount()) { ++ handle = nullptr; ++ auto fstab = ReadFirstStageFstab(); ++ std::unique_ptr v = std::make_unique(std::move(fstab)); ++ return v->DoFirstStageMount(); ++ } ++ return true; + } + + void SetInitAvbVersionInRecovery() { +-- +2.17.1 + diff --git a/patches/platform_system_core/0008-wip.patch b/patches/platform_system_core/0008-wip.patch new file mode 100644 index 0000000..6824f5d --- /dev/null +++ b/patches/platform_system_core/0008-wip.patch @@ -0,0 +1,106 @@ +From 26a7dd02cd2a9092b7d5fb40be277029ddd9dd7d Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Thu, 12 Sep 2019 13:09:46 +0200 +Subject: [PATCH 08/12] wip + +Change-Id: I925f21802d3dd031c6d7d8c4777f36e62e52699b +--- + init/uevent_listener.cpp | 5 +++-- + libcutils/uevent.cpp | 28 +++++++++++----------------- + lmkd/lmkd.rc | 2 -- + rootdir/init.zygote32.rc | 2 +- + 4 files changed, 15 insertions(+), 22 deletions(-) + +diff --git a/init/uevent_listener.cpp b/init/uevent_listener.cpp +index 62cd2be3a..26f7ed6a9 100644 +--- a/init/uevent_listener.cpp ++++ b/init/uevent_listener.cpp +@@ -88,10 +88,11 @@ static void ParseEvent(const char* msg, Uevent* uevent) { + + UeventListener::UeventListener(size_t uevent_socket_rcvbuf_size) { + device_fd_.reset(uevent_open_socket(uevent_socket_rcvbuf_size, true)); +- if (device_fd_ == -1) { +- LOG(FATAL) << "Could not open uevent socket"; ++ if (device_fd_ <= -1) { ++ LOG(FATAL) << "Could not open uevent socket" << device_fd_; + } + ++ LOG(ERROR) << "Successfully opened uevent socket"; + fcntl(device_fd_, F_SETFL, O_NONBLOCK); + } + +diff --git a/libcutils/uevent.cpp b/libcutils/uevent.cpp +index 721de7c47..dc51b12b9 100644 +--- a/libcutils/uevent.cpp ++++ b/libcutils/uevent.cpp +@@ -105,31 +105,25 @@ int uevent_open_socket(int buf_sz, bool passcred) { + addr.nl_groups = 0xffffffff; + + s = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT); +- if (s < 0) return -1; ++ if (s < 0) return -errno; + +- if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &buf_sz, sizeof(buf_sz)) < 0 || +- getsockopt(s, SOL_SOCKET, SO_RCVBUF, &buf_sz_readback, &optlen) < 0) { +- close(s); +- return -1; +- } +- /* Only if SO_RCVBUF was not effective, try SO_RCVBUFFORCE. Generally, we +- * want to avoid SO_RCVBUFFORCE, because it generates SELinux denials in +- * case we don't have CAP_NET_ADMIN. This is the case, for example, for +- * healthd. */ +- if (buf_sz_readback < 2 * buf_sz) { +- if (setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, &buf_sz, sizeof(buf_sz)) < 0) { +- close(s); +- return -1; +- } +- } ++fcntl(s, F_SETFD, FD_CLOEXEC); + + setsockopt(s, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + + if (bind(s, (struct sockaddr*)&addr, sizeof(addr)) < 0) { + close(s); +- return -1; ++ return -errno - 1000; + } + ++ setsockopt(s, SOL_SOCKET, SO_RCVBUF, &buf_sz, sizeof(buf_sz)); ++ getsockopt(s, SOL_SOCKET, SO_RCVBUF, &buf_sz_readback, &optlen); ++ /* Only if SO_RCVBUF was not effective, try SO_RCVBUFFORCE. Generally, we ++ * want to avoid SO_RCVBUFFORCE, because it generates SELinux denials in ++ * case we don't have CAP_NET_ADMIN. This is the case, for example, for ++ * healthd. */ ++ setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, &buf_sz, sizeof(buf_sz)); ++ + return s; + } + +diff --git a/lmkd/lmkd.rc b/lmkd/lmkd.rc +index 76b60558a..5a357ee84 100644 +--- a/lmkd/lmkd.rc ++++ b/lmkd/lmkd.rc +@@ -1,7 +1,5 @@ + service lmkd /system/bin/lmkd + class core +- user lmkd +- group lmkd system readproc + capabilities DAC_OVERRIDE KILL IPC_LOCK SYS_NICE SYS_RESOURCE + critical + socket lmkd seqpacket 0660 system system +diff --git a/rootdir/init.zygote32.rc b/rootdir/init.zygote32.rc +index bf3fb4217..0a67281ab 100644 +--- a/rootdir/init.zygote32.rc ++++ b/rootdir/init.zygote32.rc +@@ -2,7 +2,7 @@ service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-sys + class main + priority -20 + user root +- group root readproc reserved_disk ++ group root readproc + socket zygote stream 660 root system + socket usap_pool_primary stream 660 root system + onrestart write /sys/android_power/request_state wake +-- +2.17.1 + diff --git a/patches/platform_system_core/0009-Remove-reserved_disk-group-not-very-useful-and-break.patch b/patches/platform_system_core/0009-Remove-reserved_disk-group-not-very-useful-and-break.patch new file mode 100644 index 0000000..1a340ec --- /dev/null +++ b/patches/platform_system_core/0009-Remove-reserved_disk-group-not-very-useful-and-break.patch @@ -0,0 +1,73 @@ +From 252ef3edfbd768b4005df28c026a0969221819c2 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sat, 14 Sep 2019 21:29:29 +0200 +Subject: [PATCH 09/12] Remove reserved_disk group (not very useful, and breaks + SaS boot) + +Change-Id: Ib503fe64a095c00757d410ee65fde6fa8f6ea784 +--- + rootdir/init.zygote32_64.rc | 4 ++-- + rootdir/init.zygote64.rc | 2 +- + rootdir/init.zygote64_32.rc | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/rootdir/init.zygote32_64.rc b/rootdir/init.zygote32_64.rc +index 1bab588c4..14dbe563e 100644 +--- a/rootdir/init.zygote32_64.rc ++++ b/rootdir/init.zygote32_64.rc +@@ -2,7 +2,7 @@ service zygote /system/bin/app_process32 -Xzygote /system/bin --zygote --start-s + class main + priority -20 + user root +- group root readproc reserved_disk ++ group root readproc + socket zygote stream 660 root system + socket usap_pool_primary stream 660 root system + onrestart write /sys/android_power/request_state wake +@@ -18,7 +18,7 @@ service zygote_secondary /system/bin/app_process64 -Xzygote /system/bin --zygote + class main + priority -20 + user root +- group root readproc reserved_disk ++ group root readproc + socket zygote_secondary stream 660 root system + socket usap_pool_secondary stream 660 root system + onrestart restart zygote +diff --git a/rootdir/init.zygote64.rc b/rootdir/init.zygote64.rc +index 6fa210a7b..80fb37659 100644 +--- a/rootdir/init.zygote64.rc ++++ b/rootdir/init.zygote64.rc +@@ -2,7 +2,7 @@ service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-s + class main + priority -20 + user root +- group root readproc reserved_disk ++ group root readproc + socket zygote stream 660 root system + socket usap_pool_primary stream 660 root system + onrestart write /sys/android_power/request_state wake +diff --git a/rootdir/init.zygote64_32.rc b/rootdir/init.zygote64_32.rc +index 48461ecd3..6fd203bc5 100644 +--- a/rootdir/init.zygote64_32.rc ++++ b/rootdir/init.zygote64_32.rc +@@ -2,7 +2,7 @@ service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-s + class main + priority -20 + user root +- group root readproc reserved_disk ++ group root readproc + socket zygote stream 660 root system + socket usap_pool_primary stream 660 root system + onrestart write /sys/android_power/request_state wake +@@ -18,7 +18,7 @@ service zygote_secondary /system/bin/app_process32 -Xzygote /system/bin --zygote + class main + priority -20 + user root +- group root readproc reserved_disk ++ group root readproc + socket zygote_secondary stream 660 root system + socket usap_pool_secondary stream 660 root system + onrestart restart zygote +-- +2.17.1 + diff --git a/patches/platform_system_core/0010-Take-ro.vndk.version-into-account-to-know-what-to-te.patch b/patches/platform_system_core/0010-Take-ro.vndk.version-into-account-to-know-what-to-te.patch new file mode 100644 index 0000000..cd8f319 --- /dev/null +++ b/patches/platform_system_core/0010-Take-ro.vndk.version-into-account-to-know-what-to-te.patch @@ -0,0 +1,44 @@ +From b39f578a5772607b269bfe169a16f1adb8f7f037 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sat, 14 Sep 2019 21:53:35 +0200 +Subject: [PATCH 10/12] Take ro.vndk.version into account to know what to test + +Change-Id: Ia7c710941c39b7051b904032a13e5f443049cc05 +--- + sdcard/sdcard.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp +index 4420ebbd2..a6f290960 100644 +--- a/sdcard/sdcard.cpp ++++ b/sdcard/sdcard.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -103,6 +104,7 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de + mode_t mask, bool derive_gid, bool default_normal, bool unshared_obb, + bool use_esdfs) { + // Add new options at the end of the vector. ++ int vndk = android::base::GetIntProperty("ro.vndk.version", 29); + std::vector new_opts_list; + if (multi_user) new_opts_list.push_back("multiuser,"); + if (derive_gid) new_opts_list.push_back("derive_gid,"); +@@ -110,7 +112,9 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de + if (unshared_obb) new_opts_list.push_back("unshared_obb,"); + // Try several attempts, each time with one less option, to gracefully + // handle older kernels that aren't updated yet. +- int first_option_to_try = property_get_bool("persist.sys.phh.modern_sdcard", false) ? 0 : 2; ++ int first_option_to_try = 0; ++ if(vndk == 26) first_option_to_try = 3; ++ if(vndk == 27) first_option_to_try = 2; + for (int i = first_option_to_try; i <= new_opts_list.size(); ++i) { + std::string new_opts; + for (int j = 0; j < new_opts_list.size() - i; ++j) { +-- +2.17.1 + diff --git a/patches/platform_system_core/0011-Use-a-vndk-lite-friendly-ld-config.patch b/patches/platform_system_core/0011-Use-a-vndk-lite-friendly-ld-config.patch new file mode 100644 index 0000000..7ec65d2 --- /dev/null +++ b/patches/platform_system_core/0011-Use-a-vndk-lite-friendly-ld-config.patch @@ -0,0 +1,32 @@ +From e109f7d80980e4a24a57c0ffcacfece96b8b9b9e Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sat, 14 Sep 2019 22:49:31 +0200 +Subject: [PATCH 11/12] Use a vndk-lite friendly ld config + +Change-Id: I5b1e49fc534e6625ebdb6e183466e73b5c49e175 +--- + rootdir/etc/ld.config.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/rootdir/etc/ld.config.txt b/rootdir/etc/ld.config.txt +index 84b308d0e..f59a01520 100644 +--- a/rootdir/etc/ld.config.txt ++++ b/rootdir/etc/ld.config.txt +@@ -423,11 +423,11 @@ namespace.default.asan.permitted.paths += /odm + namespace.default.asan.permitted.paths += /data/asan/vendor + namespace.default.asan.permitted.paths += /vendor + +-namespace.default.links = system,vndk%VNDK_IN_SYSTEM_NS% ++namespace.default.links = system,vndk%VNDK_IN_SYSTEM_NS%,runtime + namespace.default.link.system.shared_libs = %LLNDK_LIBRARIES% + namespace.default.link.vndk_in_system.shared_libs = %VNDK_USING_CORE_VARIANT_LIBRARIES% +-namespace.default.link.vndk.shared_libs = %VNDK_SAMEPROCESS_LIBRARIES% +-namespace.default.link.vndk.shared_libs += %VNDK_CORE_LIBRARIES% ++namespace.default.link.vndk.allow_all_shared_libs = true ++namespace.default.link.runtime.shared_libs = libnativeloader.so + + ############################################################################### + # "runtime" APEX namespace +-- +2.17.1 + diff --git a/patches/platform_system_core/0012-fixup-Take-ro.vndk.version-into-account-to-know-what.patch b/patches/platform_system_core/0012-fixup-Take-ro.vndk.version-into-account-to-know-what.patch new file mode 100644 index 0000000..c5e300d --- /dev/null +++ b/patches/platform_system_core/0012-fixup-Take-ro.vndk.version-into-account-to-know-what.patch @@ -0,0 +1,37 @@ +From 1edfe5d82e20527ebb852cb506f878f19049f07e Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 1 Oct 2019 13:34:35 +0200 +Subject: [PATCH 12/12] fixup! Take ro.vndk.version into account to know what + to test + +--- + sdcard/sdcard.cpp | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp +index a6f290960..7b2bb588a 100644 +--- a/sdcard/sdcard.cpp ++++ b/sdcard/sdcard.cpp +@@ -107,15 +107,12 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de + int vndk = android::base::GetIntProperty("ro.vndk.version", 29); + std::vector new_opts_list; + if (multi_user) new_opts_list.push_back("multiuser,"); +- if (derive_gid) new_opts_list.push_back("derive_gid,"); +- if (default_normal) new_opts_list.push_back("default_normal,"); +- if (unshared_obb) new_opts_list.push_back("unshared_obb,"); ++ if (derive_gid && vndk >= 27) new_opts_list.push_back("derive_gid,"); ++ if (default_normal && vndk >= 28) new_opts_list.push_back("default_normal,"); ++ if (unshared_obb && vndk >= 29) new_opts_list.push_back("unshared_obb,"); + // Try several attempts, each time with one less option, to gracefully + // handle older kernels that aren't updated yet. +- int first_option_to_try = 0; +- if(vndk == 26) first_option_to_try = 3; +- if(vndk == 27) first_option_to_try = 2; +- for (int i = first_option_to_try; i <= new_opts_list.size(); ++i) { ++ for (int i = 0; i <= new_opts_list.size(); ++i) { + std::string new_opts; + for (int j = 0; j < new_opts_list.size() - i; ++j) { + new_opts += new_opts_list[j]; +-- +2.17.1 + diff --git a/patches/platform_system_core/0013-Give-lmkd-ptrace-capability-to-bypass-hidepid-AOSP-u.patch b/patches/platform_system_core/0013-Give-lmkd-ptrace-capability-to-bypass-hidepid-AOSP-u.patch new file mode 100644 index 0000000..719a876 --- /dev/null +++ b/patches/platform_system_core/0013-Give-lmkd-ptrace-capability-to-bypass-hidepid-AOSP-u.patch @@ -0,0 +1,26 @@ +From 4152eaf5e3da9f0e4d67187b351478d92c7ae627 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 16 Oct 2019 15:52:12 +0200 +Subject: [PATCH 13/13] Give lmkd ptrace capability, to bypass hidepid (AOSP + uses `readproc` group, but I cant because of A-only) + +Change-Id: Ic58e7c125d86fde45764d39f250675cf84777266 +--- + lmkd/lmkd.rc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lmkd/lmkd.rc b/lmkd/lmkd.rc +index 5a357ee84..d5ddab091 100644 +--- a/lmkd/lmkd.rc ++++ b/lmkd/lmkd.rc +@@ -1,6 +1,6 @@ + service lmkd /system/bin/lmkd + class core +- capabilities DAC_OVERRIDE KILL IPC_LOCK SYS_NICE SYS_RESOURCE ++ capabilities DAC_OVERRIDE KILL IPC_LOCK SYS_NICE SYS_RESOURCE SYS_PTRACE + critical + socket lmkd seqpacket 0660 system system + writepid /dev/cpuset/system-background/tasks +-- +2.17.1 + diff --git a/patches/platform_system_netd/0001-device-Huawei-Kirin-960-accept-broken-rpfilter-match.patch b/patches/platform_system_netd/0001-device-Huawei-Kirin-960-accept-broken-rpfilter-match.patch new file mode 100644 index 0000000..850bf38 --- /dev/null +++ b/patches/platform_system_netd/0001-device-Huawei-Kirin-960-accept-broken-rpfilter-match.patch @@ -0,0 +1,30 @@ +From dad654943fe290ab081c3e5b07cc913130f1d3ad Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 2 Jul 2018 22:01:43 +0200 +Subject: [PATCH 1/2] [device] ::Huawei Kirin 960:: accept broken rpfilter + match + +How bad a security flaw is this? +People lived with rpfilter on IPv4 for a very long time... + +Change-Id: I9aa63d18e54a8254133adf97bf757c03d6b66757 +--- + server/TetherController.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/server/TetherController.cpp b/server/TetherController.cpp +index 0c5b6bfe..d9439be6 100644 +--- a/server/TetherController.cpp ++++ b/server/TetherController.cpp +@@ -696,7 +696,7 @@ int TetherController::setForwardRules(bool add, const char *intIface, const char + "*raw\n" + "%s %s -i %s -m rpfilter --invert ! -s fe80::/64 -j DROP\n" + "COMMIT\n", op, LOCAL_RAW_PREROUTING, intIface); +- if (iptablesRestoreFunction(V6, rpfilterCmd, nullptr) == -1 && add) { ++ if (iptablesRestoreFunction(V6, rpfilterCmd, nullptr) == -1 && add && false) { + return -EREMOTEIO; + } + +-- +2.17.1 + diff --git a/patches/platform_system_netd/0002-Don-t-fail-on-FTP-conntracking-failing.patch b/patches/platform_system_netd/0002-Don-t-fail-on-FTP-conntracking-failing.patch new file mode 100644 index 0000000..69a7ffc --- /dev/null +++ b/patches/platform_system_netd/0002-Don-t-fail-on-FTP-conntracking-failing.patch @@ -0,0 +1,45 @@ +From c6d11821f650bbb8fc73056cf0aa57a254b5837d Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 29 Jul 2019 18:09:12 +0200 +Subject: [PATCH 2/2] Don't fail on FTP conntracking failing + +The issue has been seen on some Samsung devices. +See https://github.com/phhusson/treble_experimentations/issues/425 + +Thanks @zamrih for pin-pointing the issue and validating fix + +Change-Id: I3d9c865eb5a4b421f9983210c2ceae62b4906234 +--- + server/TetherController.cpp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/server/TetherController.cpp b/server/TetherController.cpp +index d9439be6..2fa4a0c9 100644 +--- a/server/TetherController.cpp ++++ b/server/TetherController.cpp +@@ -700,13 +700,19 @@ int TetherController::setForwardRules(bool add, const char *intIface, const char + return -EREMOTEIO; + } + +- std::vector v4 = { ++ std::vector v4Ftp = { + "*raw", +- StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp", op, +- LOCAL_RAW_PREROUTING, intIface), ++ StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp", ++ op, LOCAL_RAW_PREROUTING, intIface), + StringPrintf("%s %s -p tcp --dport 1723 -i %s -j CT --helper pptp", op, + LOCAL_RAW_PREROUTING, intIface), + "COMMIT", ++ }; ++ if(iptablesRestoreFunction(V4, Join(v4Ftp, '\n'), nullptr) == -1) { ++ ALOGE("Failed adding iptables CT target on FTP."); ++ } ++ ++ std::vector v4 = { + "*filter", + StringPrintf("%s %s -i %s -o %s -m state --state ESTABLISHED,RELATED -g %s", op, + LOCAL_FORWARD, extIface, intIface, LOCAL_TETHER_COUNTERS_CHAIN), +-- +2.17.1 + diff --git a/patches/platform_system_sepolicy/0001-Don-t-set-esdfs-or-exfat-genfscon.-Assume-OEM-does.patch b/patches/platform_system_sepolicy/0001-Don-t-set-esdfs-or-exfat-genfscon.-Assume-OEM-does.patch new file mode 100644 index 0000000..d3f7fe3 --- /dev/null +++ b/patches/platform_system_sepolicy/0001-Don-t-set-esdfs-or-exfat-genfscon.-Assume-OEM-does.patch @@ -0,0 +1,71 @@ +From 2963058b10e3f92d351dec6fa6a09dad4d3213b3 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 20:56:54 +0200 +Subject: [PATCH 1/2] Don't set esdfs or exfat genfscon. Assume OEM does + +--- + prebuilts/api/28.0/private/genfs_contexts | 4 ++-- + prebuilts/api/29.0/private/genfs_contexts | 4 ++-- + private/genfs_contexts | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/prebuilts/api/28.0/private/genfs_contexts b/prebuilts/api/28.0/private/genfs_contexts +index 7e2ea509..56cd92da 100644 +--- a/prebuilts/api/28.0/private/genfs_contexts ++++ b/prebuilts/api/28.0/private/genfs_contexts +@@ -231,12 +231,12 @@ genfscon debugfs /tracing/events/fence/ + + genfscon inotifyfs / u:object_r:inotify:s0 + genfscon vfat / u:object_r:vfat:s0 +-genfscon exfat / u:object_r:exfat:s0 ++#genfscon exfat / u:object_r:exfat:s0 + genfscon debugfs / u:object_r:debugfs:s0 + genfscon fuse / u:object_r:fuse:s0 + genfscon configfs / u:object_r:configfs:s0 + genfscon sdcardfs / u:object_r:sdcardfs:s0 +-genfscon esdfs / u:object_r:sdcardfs:s0 ++#genfscon esdfs / u:object_r:sdcardfs:s0 + genfscon pstore / u:object_r:pstorefs:s0 + genfscon functionfs / u:object_r:functionfs:s0 + genfscon usbfs / u:object_r:usbfs:s0 +diff --git a/prebuilts/api/29.0/private/genfs_contexts b/prebuilts/api/29.0/private/genfs_contexts +index 202d1b31..df21c503 100644 +--- a/prebuilts/api/29.0/private/genfs_contexts ++++ b/prebuilts/api/29.0/private/genfs_contexts +@@ -285,12 +285,12 @@ genfscon debugfs /kcov u:object_r:debugfs_kcov:s0 + + genfscon inotifyfs / u:object_r:inotify:s0 + genfscon vfat / u:object_r:vfat:s0 +-genfscon exfat / u:object_r:exfat:s0 ++#genfscon exfat / u:object_r:exfat:s0 + genfscon debugfs / u:object_r:debugfs:s0 + genfscon fuse / u:object_r:fuse:s0 + genfscon configfs / u:object_r:configfs:s0 + genfscon sdcardfs / u:object_r:sdcardfs:s0 +-genfscon esdfs / u:object_r:sdcardfs:s0 ++#genfscon esdfs / u:object_r:sdcardfs:s0 + genfscon pstore / u:object_r:pstorefs:s0 + genfscon functionfs / u:object_r:functionfs:s0 + genfscon usbfs / u:object_r:usbfs:s0 +diff --git a/private/genfs_contexts b/private/genfs_contexts +index 202d1b31..df21c503 100644 +--- a/private/genfs_contexts ++++ b/private/genfs_contexts +@@ -285,12 +285,12 @@ genfscon debugfs /kcov u:object_r:debugfs_kcov:s0 + + genfscon inotifyfs / u:object_r:inotify:s0 + genfscon vfat / u:object_r:vfat:s0 +-genfscon exfat / u:object_r:exfat:s0 ++#genfscon exfat / u:object_r:exfat:s0 + genfscon debugfs / u:object_r:debugfs:s0 + genfscon fuse / u:object_r:fuse:s0 + genfscon configfs / u:object_r:configfs:s0 + genfscon sdcardfs / u:object_r:sdcardfs:s0 +-genfscon esdfs / u:object_r:sdcardfs:s0 ++#genfscon esdfs / u:object_r:sdcardfs:s0 + genfscon pstore / u:object_r:pstorefs:s0 + genfscon functionfs / u:object_r:functionfs:s0 + genfscon usbfs / u:object_r:usbfs:s0 +-- +2.17.1 + diff --git a/patches/platform_system_sepolicy/0002-Mark-mediacodec_2-6-7-8-as-hal_omx_server.patch b/patches/platform_system_sepolicy/0002-Mark-mediacodec_2-6-7-8-as-hal_omx_server.patch new file mode 100644 index 0000000..d637a57 --- /dev/null +++ b/patches/platform_system_sepolicy/0002-Mark-mediacodec_2-6-7-8-as-hal_omx_server.patch @@ -0,0 +1,90 @@ +From 50cc46681b211922da50a0d97624499f551642a1 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Wed, 18 Sep 2019 11:50:14 +0200 +Subject: [PATCH 2/2] Mark mediacodec_2{6,7,8} as hal_omx_server + +Change-Id: I03e763b8092a9089739db68ed17368ff574879bb +--- + prebuilts/api/29.0/private/compat/26.0/26.0.cil | 1 + + prebuilts/api/29.0/private/compat/27.0/27.0.cil | 1 + + prebuilts/api/29.0/private/compat/28.0/28.0.cil | 1 + + private/compat/26.0/26.0.cil | 1 + + private/compat/27.0/27.0.cil | 1 + + private/compat/28.0/28.0.cil | 1 + + 6 files changed, 6 insertions(+) + +diff --git a/prebuilts/api/29.0/private/compat/26.0/26.0.cil b/prebuilts/api/29.0/private/compat/26.0/26.0.cil +index 3b3dae1c..60f42b9c 100644 +--- a/prebuilts/api/29.0/private/compat/26.0/26.0.cil ++++ b/prebuilts/api/29.0/private/compat/26.0/26.0.cil +@@ -336,6 +336,7 @@ + (typeattributeset mdnsd_socket_26_0 (mdnsd_socket)) + (typeattributeset mdns_socket_26_0 (mdns_socket)) + (typeattributeset mediacasserver_service_26_0 (mediacasserver_service)) ++(typeattributeset hal_omx_server (mediacodec_26_0)) + (typeattributeset mediacodec_26_0 (mediacodec)) + (typeattributeset mediacodec_exec_26_0 (mediacodec_exec)) + (typeattributeset mediacodec_service_26_0 (mediacodec_service)) +diff --git a/prebuilts/api/29.0/private/compat/27.0/27.0.cil b/prebuilts/api/29.0/private/compat/27.0/27.0.cil +index 365d791a..8c8f82fc 100644 +--- a/prebuilts/api/29.0/private/compat/27.0/27.0.cil ++++ b/prebuilts/api/29.0/private/compat/27.0/27.0.cil +@@ -1047,6 +1047,7 @@ + (typeattributeset mdnsd_27_0 (mdnsd)) + (typeattributeset mdnsd_socket_27_0 (mdnsd_socket)) + (typeattributeset mdns_socket_27_0 (mdns_socket)) ++(typeattributeset hal_omx_server (mediacodec_27_0)) + (typeattributeset mediacodec_27_0 (mediacodec)) + (typeattributeset mediacodec_exec_27_0 (mediacodec_exec)) + (typeattributeset mediacodec_service_27_0 (mediacodec_service)) +diff --git a/prebuilts/api/29.0/private/compat/28.0/28.0.cil b/prebuilts/api/29.0/private/compat/28.0/28.0.cil +index 305cb3ac..338cbd02 100644 +--- a/prebuilts/api/29.0/private/compat/28.0/28.0.cil ++++ b/prebuilts/api/29.0/private/compat/28.0/28.0.cil +@@ -1242,6 +1242,7 @@ + (typeattributeset mdnsd_28_0 (mdnsd)) + (typeattributeset mdnsd_socket_28_0 (mdnsd_socket)) + (typeattributeset mdns_socket_28_0 (mdns_socket)) ++(typeattributeset hal_omx_server (mediacodec_28_0)) + (typeattributeset mediacodec_28_0 (mediacodec)) + (typeattributeset mediacodec_exec_28_0 (mediacodec_exec)) + (typeattributeset mediacodec_service_28_0 (mediacodec_service)) +diff --git a/private/compat/26.0/26.0.cil b/private/compat/26.0/26.0.cil +index 3b3dae1c..60f42b9c 100644 +--- a/private/compat/26.0/26.0.cil ++++ b/private/compat/26.0/26.0.cil +@@ -336,6 +336,7 @@ + (typeattributeset mdnsd_socket_26_0 (mdnsd_socket)) + (typeattributeset mdns_socket_26_0 (mdns_socket)) + (typeattributeset mediacasserver_service_26_0 (mediacasserver_service)) ++(typeattributeset hal_omx_server (mediacodec_26_0)) + (typeattributeset mediacodec_26_0 (mediacodec)) + (typeattributeset mediacodec_exec_26_0 (mediacodec_exec)) + (typeattributeset mediacodec_service_26_0 (mediacodec_service)) +diff --git a/private/compat/27.0/27.0.cil b/private/compat/27.0/27.0.cil +index 365d791a..8c8f82fc 100644 +--- a/private/compat/27.0/27.0.cil ++++ b/private/compat/27.0/27.0.cil +@@ -1047,6 +1047,7 @@ + (typeattributeset mdnsd_27_0 (mdnsd)) + (typeattributeset mdnsd_socket_27_0 (mdnsd_socket)) + (typeattributeset mdns_socket_27_0 (mdns_socket)) ++(typeattributeset hal_omx_server (mediacodec_27_0)) + (typeattributeset mediacodec_27_0 (mediacodec)) + (typeattributeset mediacodec_exec_27_0 (mediacodec_exec)) + (typeattributeset mediacodec_service_27_0 (mediacodec_service)) +diff --git a/private/compat/28.0/28.0.cil b/private/compat/28.0/28.0.cil +index 305cb3ac..338cbd02 100644 +--- a/private/compat/28.0/28.0.cil ++++ b/private/compat/28.0/28.0.cil +@@ -1242,6 +1242,7 @@ + (typeattributeset mdnsd_28_0 (mdnsd)) + (typeattributeset mdnsd_socket_28_0 (mdnsd_socket)) + (typeattributeset mdns_socket_28_0 (mdns_socket)) ++(typeattributeset hal_omx_server (mediacodec_28_0)) + (typeattributeset mediacodec_28_0 (mediacodec)) + (typeattributeset mediacodec_exec_28_0 (mediacodec_exec)) + (typeattributeset mediacodec_service_28_0 (mediacodec_service)) +-- +2.17.1 + diff --git a/patches/platform_system_vold/0001-Allow-deletion-of-symlink.patch b/patches/platform_system_vold/0001-Allow-deletion-of-symlink.patch new file mode 100644 index 0000000..46bfb59 --- /dev/null +++ b/patches/platform_system_vold/0001-Allow-deletion-of-symlink.patch @@ -0,0 +1,25 @@ +From c3b771c76088e9308759d9d59a79c67fe52514b6 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Sat, 17 Feb 2018 19:39:38 +0100 +Subject: [PATCH 1/6] Allow deletion of symlink + +Change-Id: I9731895f88729072297f753088583aabbe6990f4 +--- + FsCrypt.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/FsCrypt.cpp b/FsCrypt.cpp +index 2a8e110..8b061cb 100644 +--- a/FsCrypt.cpp ++++ b/FsCrypt.cpp +@@ -224,6 +224,7 @@ static bool prepare_dir(const std::string& dir, mode_t mode, uid_t uid, gid_t gi + static bool destroy_dir(const std::string& dir) { + LOG(DEBUG) << "Destroying: " << dir; + if (rmdir(dir.c_str()) != 0 && errno != ENOENT) { ++ if(unlink(dir.c_str()) == 0) return true; + PLOG(ERROR) << "Failed to destroy " << dir; + return false; + } +-- +2.17.1 + diff --git a/patches/platform_system_vold/0002-Don-t-set-reserved_disk-group-it-panics-old-inits.patch b/patches/platform_system_vold/0002-Don-t-set-reserved_disk-group-it-panics-old-inits.patch new file mode 100644 index 0000000..5ddc47c --- /dev/null +++ b/patches/platform_system_vold/0002-Don-t-set-reserved_disk-group-it-panics-old-inits.patch @@ -0,0 +1,22 @@ +From 95622cc1d194d74b5d7c38747c2b0ce14470d030 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 20:53:12 +0200 +Subject: [PATCH 2/6] Don't set reserved_disk group, it panics old inits + +Change-Id: Ic4893136c188059d40d3e97099f7990dfa7432a8 +--- + vold.rc | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/vold.rc b/vold.rc +index 93d8786..c27aeda 100644 +--- a/vold.rc ++++ b/vold.rc +@@ -5,4 +5,3 @@ service vold /system/bin/vold \ + ioprio be 2 + writepid /dev/cpuset/foreground/tasks + shutdown critical +- group root reserved_disk +-- +2.17.1 + diff --git a/patches/platform_system_vold/0003-Create-vendor_de.-This-is-done-by-init.rc-on-system-.patch b/patches/platform_system_vold/0003-Create-vendor_de.-This-is-done-by-init.rc-on-system-.patch new file mode 100644 index 0000000..c3013bd --- /dev/null +++ b/patches/platform_system_vold/0003-Create-vendor_de.-This-is-done-by-init.rc-on-system-.patch @@ -0,0 +1,26 @@ +From 54e73dca9f6ec77bbd2f88d3daaef3c9c87979a1 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Tue, 14 Aug 2018 20:54:08 +0200 +Subject: [PATCH 3/6] Create vendor_de. This is done by /init.rc on + system-as-root device + +--- + FsCrypt.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/FsCrypt.cpp b/FsCrypt.cpp +index 8b061cb..bb90ee0 100644 +--- a/FsCrypt.cpp ++++ b/FsCrypt.cpp +@@ -669,6 +669,8 @@ bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_ + auto vendor_de_path = android::vold::BuildDataVendorDePath(user_id); + auto user_de_path = android::vold::BuildDataUserDePath(volume_uuid, user_id); + ++ prepare_dir(android::vold::BuildDataPath("") + "/vendor_de", 0771, 0, 0); ++ + if (volume_uuid.empty()) { + if (!prepare_dir(system_legacy_path, 0700, AID_SYSTEM, AID_SYSTEM)) return false; + #if MANAGE_MISC_DIRS +-- +2.17.1 + diff --git a/patches/platform_system_vold/0004-Support-Samsung-s-implementation-of-exfat-called-sdf.patch b/patches/platform_system_vold/0004-Support-Samsung-s-implementation-of-exfat-called-sdf.patch new file mode 100644 index 0000000..82f685d --- /dev/null +++ b/patches/platform_system_vold/0004-Support-Samsung-s-implementation-of-exfat-called-sdf.patch @@ -0,0 +1,44 @@ +From 742595997f8f2380e0229e231848211c8126b92f Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 20 Aug 2018 22:37:54 +0200 +Subject: [PATCH 4/6] Support Samsung's implementation of exfat, called sdfat + +--- + fs/Exfat.cpp | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp +index c624eb9..b9844a5 100644 +--- a/fs/Exfat.cpp ++++ b/fs/Exfat.cpp +@@ -35,7 +35,7 @@ static const char* kFsckPath = "/system/bin/fsck.exfat"; + + bool IsSupported() { + return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 && +- IsFilesystemSupported("exfat"); ++ (IsFilesystemSupported("exfat") || IsFilesystemSupported("sdfat")); + } + + status_t Check(const std::string& source) { +@@ -60,13 +60,16 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUi + auto mountData = android::base::StringPrintf("uid=%d,gid=%d,fmask=%o,dmask=%o", ownerUid, + ownerGid, permMask, permMask); + +- if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) { ++ const char *fs = "exfat"; ++ if(IsFilesystemSupported("sdfat")) ++ fs = "sdfat"; ++ if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) { + return 0; + } + + PLOG(ERROR) << "Mount failed; attempting read-only"; + mountFlags |= MS_RDONLY; +- if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) { ++ if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) { + return 0; + } + +-- +2.17.1 + diff --git a/patches/platform_system_vold/0005-Also-create-vendor_ce-same-reason-as-vendor_de.patch b/patches/platform_system_vold/0005-Also-create-vendor_ce-same-reason-as-vendor_de.patch new file mode 100644 index 0000000..89453b1 --- /dev/null +++ b/patches/platform_system_vold/0005-Also-create-vendor_ce-same-reason-as-vendor_de.patch @@ -0,0 +1,25 @@ +From 1cdb0168b3bc3981f71aba62f51064be57ccf8f5 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 20 Aug 2018 22:38:08 +0200 +Subject: [PATCH 5/6] Also create vendor_ce (same reason as vendor_de) + +--- + FsCrypt.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/FsCrypt.cpp b/FsCrypt.cpp +index bb90ee0..ec7ec7d 100644 +--- a/FsCrypt.cpp ++++ b/FsCrypt.cpp +@@ -709,6 +709,8 @@ bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_ + auto media_ce_path = android::vold::BuildDataMediaCePath(volume_uuid, user_id); + auto user_ce_path = android::vold::BuildDataUserCePath(volume_uuid, user_id); + ++ prepare_dir(android::vold::BuildDataPath("") + "/vendor_ce", 0771, 0, 0); ++ + if (volume_uuid.empty()) { + if (!prepare_dir(system_ce_path, 0770, AID_SYSTEM, AID_SYSTEM)) return false; + if (!prepare_dir(misc_ce_path, 01771, AID_SYSTEM, AID_MISC)) return false; +-- +2.17.1 + diff --git a/patches/platform_system_vold/0006-Check-needsCheckpoint-only-if-checkpoint-is-supporte.patch b/patches/platform_system_vold/0006-Check-needsCheckpoint-only-if-checkpoint-is-supporte.patch new file mode 100644 index 0000000..be902fb --- /dev/null +++ b/patches/platform_system_vold/0006-Check-needsCheckpoint-only-if-checkpoint-is-supporte.patch @@ -0,0 +1,32 @@ +From b48715b53228daedd29507239ceb1704453f4163 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 16 Sep 2019 13:49:05 +0200 +Subject: [PATCH] Check needsCheckpoint only if checkpoint is supported + +This is needed because some devices (Xiaomi MiPad 4, uncertified) +declares a bootctrl HAL in manifest, but doesn't have it. +vold will then hang in needsCheckpoint waiting for bootctrl + +Change-Id: I2dafcbca7e994d7a3ac36ef3698590db2ab482fa +--- + cryptfs.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/cryptfs.cpp b/cryptfs.cpp +index ed9a53e..d2971ff 100644 +--- a/cryptfs.cpp ++++ b/cryptfs.cpp +@@ -1888,7 +1888,9 @@ static int cryptfs_restart_internal(int restart_main) { + SLOGE("Failed to setexeccon"); + return -1; + } +- bool needs_cp = android::vold::cp_needsCheckpoint(); ++ bool supportsCheckpoint = false; ++ android::vold::cp_supportsCheckpoint(supportsCheckpoint); ++ bool needs_cp = supportsCheckpoint && android::vold::cp_needsCheckpoint(); + #ifdef CONFIG_HW_DISK_ENCRYPTION + while ((mount_rc = fs_mgr_do_mount(&fstab_default, DATA_MNT_POINT, blkdev.data(), 0, + needs_cp)) != 0) { +-- +2.17.1 + diff --git a/patches/platform_system_vold/0006-Check-needsCheckpoint-only-if-checkpoint-is-supporte.patch.bak b/patches/platform_system_vold/0006-Check-needsCheckpoint-only-if-checkpoint-is-supporte.patch.bak new file mode 100644 index 0000000..b6fad66 --- /dev/null +++ b/patches/platform_system_vold/0006-Check-needsCheckpoint-only-if-checkpoint-is-supporte.patch.bak @@ -0,0 +1,32 @@ +From d184ff43ee1dd74f64fd9a0db99c29a225c22147 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +Date: Mon, 16 Sep 2019 13:49:05 +0200 +Subject: [PATCH 6/6] Check needsCheckpoint only if checkpoint is supported + +This is needed because some devices (Xiaomi MiPad 4, uncertified) +declares a bootctrl HAL in manifest, but doesn't have it. +vold will then hang in needsCheckpoint waiting for bootctrl + +Change-Id: I2dafcbca7e994d7a3ac36ef3698590db2ab482fa +--- + cryptfs.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/cryptfs.cpp b/cryptfs.cpp +index 07617e9..dbdc5af 100644 +--- a/cryptfs.cpp ++++ b/cryptfs.cpp +@@ -1643,7 +1643,9 @@ static int cryptfs_restart_internal(int restart_main) { + SLOGE("Failed to setexeccon"); + return -1; + } +- bool needs_cp = android::vold::cp_needsCheckpoint(); ++ bool supportsCheckpoint = false; ++ android::vold::cp_supportsCheckpoint(supportsCheckpoint); ++ bool needs_cp = supportsCheckpoint && android::vold::cp_needsCheckpoint(); + while ((mount_rc = fs_mgr_do_mount(&fstab_default, DATA_MNT_POINT, crypto_blkdev, 0, + needs_cp)) != 0) { + if (mount_rc == FS_MGR_DOMNT_BUSY) { +-- +2.17.1 +