Initial unified commit for Android 14, with TrebleDroid GSI target, syncing up to 20240208
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
From cb9d1aaacaa105c20551952ead0ad7a49408efce Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 27 Oct 2021 14:39:29 -0400
|
||||
Subject: [PATCH 1/2] Disable vndklite handling
|
||||
|
||||
Change-Id: Ic4474cf80fc4b45a9a2760dd51e2ca29c4d961e2
|
||||
---
|
||||
linker/linker.cpp | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/linker/linker.cpp b/linker/linker.cpp
|
||||
index 17b574fc1..c863f8ea6 100644
|
||||
--- a/linker/linker.cpp
|
||||
+++ b/linker/linker.cpp
|
||||
@@ -95,7 +95,6 @@ static uint64_t g_module_unload_counter = 0;
|
||||
static const char* const kLdConfigArchFilePath = "/system/etc/ld.config." ABI_STRING ".txt";
|
||||
|
||||
static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt";
|
||||
-static const char* const kLdConfigVndkLiteFilePath = "/system/etc/ld.config.vndk_lite.txt";
|
||||
|
||||
static const char* const kLdGeneratedConfigFilePath = "/linkerconfig/ld.config.txt";
|
||||
|
||||
@@ -3423,10 +3422,6 @@ 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)) {
|
||||
- return kLdConfigVndkLiteFilePath;
|
||||
- }
|
||||
-
|
||||
std::string ld_config_file_vndk = kLdConfigFilePath;
|
||||
size_t insert_pos = ld_config_file_vndk.find_last_of('.');
|
||||
if (insert_pos == std::string::npos) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
From ab1289090a65808ee3fbbeb40b0a77e91c1a6aab Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 19 Feb 2022 08:20:25 -0500
|
||||
Subject: [PATCH 2/2] Add new mechanism to fake vendor props on a per-process
|
||||
basis
|
||||
|
||||
This reads debug.phh.props.<process name>. If its value is "vendor",
|
||||
then ro.product.device/ro.product.manufacturer is read from vendor
|
||||
---
|
||||
libc/system_properties/system_properties.cpp | 87 +++++++++++++++++++-
|
||||
1 file changed, 85 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp
|
||||
index 1cb15c3df..057199318 100644
|
||||
--- a/libc/system_properties/system_properties.cpp
|
||||
+++ b/libc/system_properties/system_properties.cpp
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
@@ -50,6 +52,85 @@
|
||||
#define SERIAL_DIRTY(serial) ((serial)&1)
|
||||
#define SERIAL_VALUE_LEN(serial) ((serial) >> 24)
|
||||
|
||||
+static char comm[128];
|
||||
+static bool self_ok = false;
|
||||
+static char comm_override[PROP_VALUE_MAX];
|
||||
+
|
||||
+static void read_self() {
|
||||
+ //NB: Not atomic, but should be good enough, there is no possible corruption from concurrency
|
||||
+ if(self_ok) return;
|
||||
+ self_ok = true;
|
||||
+
|
||||
+ char cmdline[128];
|
||||
+ int fd = open("/proc/self/cmdline", O_RDONLY);
|
||||
+ if(fd<0) return;
|
||||
+ read(fd, cmdline, sizeof(cmdline)-1);
|
||||
+ for(unsigned i=0; i<sizeof(cmdline); i++)
|
||||
+ if(cmdline[i] == '\n')
|
||||
+ cmdline[i] = 0;
|
||||
+ close(fd);
|
||||
+
|
||||
+ // Truncate to last /, we don't want `/` in the prop
|
||||
+ const char *c = strrchr(cmdline, '/');
|
||||
+ if (c != nullptr) {
|
||||
+ c = c+1;
|
||||
+ } else {
|
||||
+ c = cmdline;
|
||||
+ }
|
||||
+ // Take only the last 16 bytes (prop names max is 32)
|
||||
+ if(strlen(c) < 15) {
|
||||
+ strcpy(comm, c);
|
||||
+ } else {
|
||||
+ strcpy(comm, c + strlen(c) - 15);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ //That's calling ourselves but that's fine because we already have self_ok = true
|
||||
+ char propName[PROP_NAME_MAX];
|
||||
+ memset(propName, 0, PROP_NAME_MAX);
|
||||
+ strncpy(propName, "debug.phh.props.", PROP_NAME_MAX - 1);
|
||||
+ strncat(propName, comm, PROP_NAME_MAX - strlen(propName) - 1);
|
||||
+
|
||||
+ //async_safe_format_log(ANDROID_LOG_WARN, "libc", "Reading debug prop %s", propName);
|
||||
+ __system_property_get(propName, comm_override);
|
||||
+}
|
||||
+
|
||||
+static const char* redirectToProp(const char *name) {
|
||||
+ read_self();
|
||||
+ /*if(strstr(name, "ro.keymaster") != nullptr || strstr(name, "security_patch") != nullptr || strstr(name, "release") != nullptr) {
|
||||
+ async_safe_format_log(ANDROID_LOG_WARN, "libc", "Process/comm %s/%s is reading %s", comm, comm_override, name);
|
||||
+ }*/
|
||||
+ if(strcmp(comm_override, "vendor") == 0) {
|
||||
+ if(strcmp(name, "ro.product.device") == 0) {
|
||||
+ return "ro.product.vendor.device";
|
||||
+ }
|
||||
+ if(strcmp(name, "ro.product.manufacturer") == 0) {
|
||||
+ return "ro.product.vendor.manufacturer";
|
||||
+ }
|
||||
+ }
|
||||
+ if(strcmp(comm_override, "keymaster") == 0) {
|
||||
+ if(strcmp(name, "ro.product.model") == 0) {
|
||||
+ return "ro.keymaster.mod";
|
||||
+ }
|
||||
+ if(strcmp(name, "ro.product.brand") == 0) {
|
||||
+ return "ro.keymaster.brn";
|
||||
+ }
|
||||
+ if(strcmp(name, "ro.build.version.release") == 0) {
|
||||
+ return "ro.keymaster.xxx.release";
|
||||
+ }
|
||||
+ if(strcmp(name, "ro.build.version.security_patch") == 0) {
|
||||
+ return "ro.keymaster.xxx.security_patch";
|
||||
+ }
|
||||
+ if(strcmp(name, "ro.boot.vbmeta.device_state") == 0) {
|
||||
+ return "ro.keymaster.xxx.vbmeta_state";
|
||||
+ }
|
||||
+ if(strcmp(name, "ro.boot.verifiedbootstate") == 0) {
|
||||
+ return "ro.keymaster.xxx.verifiedbootstate";
|
||||
+ }
|
||||
+ }
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
static bool is_dir(const char* pathname) {
|
||||
struct stat info;
|
||||
if (stat(pathname, &info) == -1) {
|
||||
@@ -123,17 +204,19 @@ uint32_t SystemProperties::AreaSerial() {
|
||||
}
|
||||
|
||||
const prop_info* SystemProperties::Find(const char* name) {
|
||||
+ const char* newName = redirectToProp(name);
|
||||
+
|
||||
if (!initialized_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- prop_area* pa = contexts_->GetPropAreaForName(name);
|
||||
+ prop_area* pa = contexts_->GetPropAreaForName(newName);
|
||||
if (!pa) {
|
||||
async_safe_format_log(ANDROID_LOG_WARN, "libc", "Access denied finding property \"%s\"", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- return pa->find(name);
|
||||
+ return pa->find(newName);
|
||||
}
|
||||
|
||||
static bool is_read_only(const char* name) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 6b118b279359ded66d661bd5504cfa8a9759b4e2 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
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 a0160e2f..24d6ccab 100644
|
||||
--- a/update_verifier/update_verifier.cpp
|
||||
+++ b/update_verifier/update_verifier.cpp
|
||||
@@ -324,7 +324,7 @@ int update_verifier(int argc, char** argv) {
|
||||
const auto module = android::hal::BootControlClient::WaitForService();
|
||||
if (module == nullptr) {
|
||||
LOG(ERROR) << "Error getting bootctrl module.";
|
||||
- return reboot_device();
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
uint32_t current_slot = module->GetCurrentSlot();
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 4ec43947116f793a592988b91389132b22bf1fb2 Mon Sep 17 00:00:00 2001
|
||||
From: sooti <sooti85@gmail.com>
|
||||
Date: Tue, 12 Oct 2021 14:32:52 +0300
|
||||
Subject: [PATCH 1/4] build: remove emulator crap from GSI
|
||||
|
||||
Change-Id: Id45f3ff1d31e3d4492f956e68a1eb4b2fb82ce63
|
||||
---
|
||||
target/product/emulator_vendor.mk | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk
|
||||
index f71b275b0e..62984253f3 100644
|
||||
--- a/target/product/emulator_vendor.mk
|
||||
+++ b/target/product/emulator_vendor.mk
|
||||
@@ -28,7 +28,7 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
DEVICE_PACKAGE_OVERLAYS := device/generic/goldfish/overlay
|
||||
|
||||
-PRODUCT_CHARACTERISTICS := emulator
|
||||
+# PRODUCT_CHARACTERISTICS := emulator
|
||||
|
||||
PRODUCT_FULL_TREBLE_OVERRIDE := true
|
||||
|
||||
@@ -48,5 +48,5 @@ PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
||||
ro.com.google.locationfeatures=1
|
||||
|
||||
# disable setupwizard
|
||||
-PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
||||
- ro.setupwizard.mode?=DISABLED
|
||||
+# PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
||||
+# ro.setupwizard.mode?=DISABLED
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 6b27f2fd5851e7b9ac30922640b480282252a8c7 Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Ponces <ponces26@gmail.com>
|
||||
Date: Mon, 18 Oct 2021 17:20:18 +0100
|
||||
Subject: [PATCH 2/4] build: Bypass vendor calls
|
||||
|
||||
Change-Id: I69830d6264356dadd7b037553a899a4eb3d211f1
|
||||
---
|
||||
target/product/aosp_arm64.mk | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
|
||||
index 6c907db0ed..0adced1672 100644
|
||||
--- a/target/product/aosp_arm64.mk
|
||||
+++ b/target/product/aosp_arm64.mk
|
||||
@@ -54,9 +54,9 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
|
||||
#
|
||||
# All components inherited here go to vendor or vendor_boot image
|
||||
#
|
||||
-$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
|
||||
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
|
||||
-$(call inherit-product, $(SRC_TARGET_DIR)/product/non_ab_device.mk)
|
||||
+#$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
|
||||
+#$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
|
||||
+#$(call inherit-product, $(SRC_TARGET_DIR)/product/non_ab_device.mk)
|
||||
|
||||
#
|
||||
# Special settings for GSI releasing
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From 7a3067d35183c2b6ceac06dcaecd81c55bd58494 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 6 Oct 2023 19:11:22 -0400
|
||||
Subject: [PATCH 3/4] Include vndk v28 sepolicy support
|
||||
|
||||
---
|
||||
core/config.mk | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/core/config.mk b/core/config.mk
|
||||
index 8f7af0512a..f693461f61 100644
|
||||
--- a/core/config.mk
|
||||
+++ b/core/config.mk
|
||||
@@ -916,6 +916,7 @@ endif
|
||||
|
||||
# A list of SEPolicy versions, besides PLATFORM_SEPOLICY_VERSION, that the framework supports.
|
||||
PLATFORM_SEPOLICY_COMPAT_VERSIONS := \
|
||||
+ 28.0 \
|
||||
29.0 \
|
||||
30.0 \
|
||||
31.0 \
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 8c802e0a41a2a54d6ed53f3b7e60de307469f628 Mon Sep 17 00:00:00 2001
|
||||
From: Adithya R <gh0strider.2k18.reborn@gmail.com>
|
||||
Date: Thu, 18 Aug 2022 21:29:34 +0530
|
||||
Subject: [PATCH 4/4] core: sysprop: Write build display id to product prop
|
||||
|
||||
Some vendors override build id in odm or vendor, such as oplus.
|
||||
|
||||
Change-Id: I1c2de43ba7c3544710897ad9127d320dd02293fe
|
||||
---
|
||||
core/sysprop.mk | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/core/sysprop.mk b/core/sysprop.mk
|
||||
index d2551aa44d..f913d11743 100644
|
||||
--- a/core/sysprop.mk
|
||||
+++ b/core/sysprop.mk
|
||||
@@ -77,6 +77,9 @@ define generate-common-build-props
|
||||
echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
|
||||
)\
|
||||
)\
|
||||
+ $(if $(filter product,$(1)),\
|
||||
+ echo "ro.build.display.id=$(BUILD_DISPLAY_ID)" >> $(2);\
|
||||
+ )\
|
||||
echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\
|
||||
echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\
|
||||
echo "ro.$(1).build.fingerprint=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From aa0cbcaebbaf0886abfd6bd97232798c7cb5be9b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 9 Apr 2018 00:19:49 +0200
|
||||
Subject: [PATCH 01/10] 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 80d3583d..a51630b2 100644
|
||||
--- a/secilc/secilc.c
|
||||
+++ b/secilc/secilc.c
|
||||
@@ -107,7 +107,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.25.1
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From a88a863bdd7cee7e8d8a681d7f32d9ff6d0bc746 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 9 Sep 2020 22:36:42 +0200
|
||||
Subject: [PATCH 02/10] Revert "libsepol: Make an unknown permission an error
|
||||
in CIL"
|
||||
|
||||
This reverts commit dc4e54126bf25dea4d51820922ccd1959be68fbc.
|
||||
|
||||
This is required because some targets calls undefined permissions:
|
||||
- Realme X2 Pro calls sigcont
|
||||
- Honor 7X calls perf_event
|
||||
---
|
||||
libsepol/cil/src/cil_resolve_ast.c | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c
|
||||
index d2bfdc81..91fa1075 100644
|
||||
--- a/libsepol/cil/src/cil_resolve_ast.c
|
||||
+++ b/libsepol/cil/src/cil_resolve_ast.c
|
||||
@@ -136,14 +136,18 @@ static int __cil_resolve_perms(symtab_t *class_symtab, symtab_t *common_symtab,
|
||||
}
|
||||
}
|
||||
if (rc != SEPOL_OK) {
|
||||
+ struct cil_list *empty_list;
|
||||
if (class_flavor == CIL_MAP_CLASS) {
|
||||
cil_log(CIL_ERR, "Failed to resolve permission %s for map class\n", (char*)curr->data);
|
||||
- } else {
|
||||
- cil_log(CIL_ERR, "Failed to resolve permission %s\n", (char*)curr->data);
|
||||
+ goto exit;
|
||||
}
|
||||
- goto exit;
|
||||
+ cil_log(CIL_WARN, "Failed to resolve permission %s\n", (char*)curr->data);
|
||||
+ /* Use an empty list to represent unknown perm */
|
||||
+ cil_list_init(&empty_list, perm_strs->flavor);
|
||||
+ cil_list_append(*perm_datums, CIL_LIST, empty_list);
|
||||
+ } else {
|
||||
+ cil_list_append(*perm_datums, CIL_DATUM, perm_datum);
|
||||
}
|
||||
- cil_list_append(*perm_datums, CIL_DATUM, perm_datum);
|
||||
} else {
|
||||
cil_list_append(*perm_datums, curr->flavor, curr->data);
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
From 01034f4009d29c401d5f007f76044482c0ed8bd0 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 31 Mar 2021 23:32:37 +0200
|
||||
Subject: [PATCH 03/10] Workaround device/phh/treble conflict with SELinux
|
||||
policy
|
||||
|
||||
device/phh/treble defines the following three types (hostapd,
|
||||
sysfs_usb_supply, rpmb_device)
|
||||
However, Qualcomm Samsung Android 11 devices export those symbols as
|
||||
typealias.
|
||||
Type and typealias are fundamentally not mergeable.
|
||||
Luckily, Samsung doesn't do anything with those typealias, so we can
|
||||
simply ignore them.
|
||||
---
|
||||
libsepol/cil/src/cil_binary.c | 8 ++++++--
|
||||
libsepol/cil/src/cil_build_ast.c | 11 +++++++++--
|
||||
libsepol/cil/src/cil_resolve_ast.c | 15 +++++++++++++--
|
||||
3 files changed, 28 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libsepol/cil/src/cil_binary.c b/libsepol/cil/src/cil_binary.c
|
||||
index 40615db2..74a52956 100644
|
||||
--- a/libsepol/cil/src/cil_binary.c
|
||||
+++ b/libsepol/cil/src/cil_binary.c
|
||||
@@ -511,13 +511,17 @@ int cil_typealias_to_policydb(policydb_t *pdb, struct cil_alias *cil_alias)
|
||||
type_datum_init(sepol_alias);
|
||||
|
||||
rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_alias->actual), &sepol_type);
|
||||
- if (rc != SEPOL_OK) goto exit;
|
||||
+ if (rc != SEPOL_OK) {
|
||||
+ cil_log(CIL_ERR, "Failed at %s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
+ goto exit;
|
||||
+ }
|
||||
|
||||
sepol_alias->flavor = TYPE_TYPE;
|
||||
|
||||
key = cil_strdup(cil_alias->datum.fqn);
|
||||
rc = symtab_insert(pdb, SYM_TYPES, key, sepol_alias, SCOPE_DECL, 0, NULL);
|
||||
if (rc != SEPOL_OK) {
|
||||
+ cil_log(CIL_ERR, "Failed at %s:%s:%d:%d\n", __FILE__, __FUNCTION__, __LINE__, rc);
|
||||
goto exit;
|
||||
}
|
||||
sepol_alias->s.value = sepol_type->s.value;
|
||||
@@ -3995,7 +3999,7 @@ static int __cil_node_to_policydb(struct cil_tree_node *node, void *extra_args)
|
||||
|
||||
exit:
|
||||
if (rc != SEPOL_OK) {
|
||||
- cil_tree_log(node, CIL_ERR, "Binary policy creation failed");
|
||||
+ cil_tree_log(node, CIL_ERR, "Binary policy creation failed, for pass = %d, flavor = %d", pass, node->flavor);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
|
||||
index 4177c9f6..118de1f5 100644
|
||||
--- a/libsepol/cil/src/cil_build_ast.c
|
||||
+++ b/libsepol/cil/src/cil_build_ast.c
|
||||
@@ -116,7 +116,7 @@ int cil_add_decl_to_symtab(struct cil_db *db, symtab_t *symtab, hashtab_key_t ke
|
||||
|
||||
rc = cil_symtab_insert(symtab, key, datum, node);
|
||||
if (rc == SEPOL_EEXIST) {
|
||||
- struct cil_symtab_datum *prev;
|
||||
+ struct cil_symtab_datum *prev = NULL;
|
||||
rc = cil_symtab_get_datum(symtab, key, &prev);
|
||||
if (rc != SEPOL_OK) {
|
||||
cil_log(CIL_ERR, "Re-declaration of %s %s, but previous declaration could not be found\n",cil_node_to_string(node), key);
|
||||
@@ -129,7 +129,14 @@ int cil_add_decl_to_symtab(struct cil_db *db, symtab_t *symtab, hashtab_key_t ke
|
||||
cil_node_to_string(node), key);
|
||||
cil_tree_log(node, CIL_ERR, "Previous declaration of %s",
|
||||
cil_node_to_string(n));
|
||||
- return SEPOL_ERR;
|
||||
+ if(
|
||||
+ strcmp(key, "sysfs_usb_supply") == 0 ||
|
||||
+ strcmp(key, "hostapd") == 0 ||
|
||||
+ strcmp(key, "rpmb_device") == 0) {
|
||||
+ cil_log(CIL_ERR, "Ignoring...");
|
||||
+ } else {
|
||||
+ return SEPOL_ERR;
|
||||
+ }
|
||||
}
|
||||
/* multiple_decls is enabled and works for this datum type, add node */
|
||||
cil_list_append(prev->nodes, CIL_NODE, node);
|
||||
diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c
|
||||
index 91fa1075..d20fb7ee 100644
|
||||
--- a/libsepol/cil/src/cil_resolve_ast.c
|
||||
+++ b/libsepol/cil/src/cil_resolve_ast.c
|
||||
@@ -522,7 +522,13 @@ static int cil_resolve_aliasactual(struct cil_tree_node *current, void *extra_ar
|
||||
}
|
||||
if (FLAVOR(alias_datum) != alias_flavor) {
|
||||
cil_log(CIL_ERR, "%s is not an alias\n",alias_datum->name);
|
||||
- rc = SEPOL_ERR;
|
||||
+ if(
|
||||
+ strcmp(alias_datum->name, "hostapd") == 0 ||
|
||||
+ strcmp(alias_datum->name, "sysfs_usb_supply") == 0 ||
|
||||
+ strcmp(alias_datum->name, "rpmb_device") == 0)
|
||||
+ rc = 0;
|
||||
+ else
|
||||
+ rc = SEPOL_ERR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -563,7 +569,12 @@ static int cil_resolve_alias_to_actual(struct cil_tree_node *current, enum cil_f
|
||||
int limit = 2;
|
||||
|
||||
if (alias->actual == NULL) {
|
||||
- cil_tree_log(current, CIL_ERR, "Alias declared but not used");
|
||||
+ cil_tree_log(current, CIL_ERR, "Alias %s declared but not used", a1->datum.name);
|
||||
+ if(
|
||||
+ strcmp(a1->datum.name, "hostapd") == 0 ||
|
||||
+ strcmp(a1->datum.name, "sysfs_usb_supply") == 0 ||
|
||||
+ strcmp(a1->datum.name, "rpmb_device") == 0)
|
||||
+ return SEPOL_OK;
|
||||
return SEPOL_ERR;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 81fa34b00d80113ed4015b99dab093826c1acb89 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 6 Sep 2019 15:07:25 +0200
|
||||
Subject: [PATCH 04/10] 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 a7c66ead..99410da0 100644
|
||||
--- a/libsepol/cil/src/cil_post.c
|
||||
+++ b/libsepol/cil/src/cil_post.c
|
||||
@@ -491,7 +491,23 @@ static 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;
|
||||
}
|
||||
|
||||
static int cil_post_netifcon_context_compare(const void *a, const void *b)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 0bc7791b9f1423f70c17b68dd7fb9d672b2bb924 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Thu, 12 Sep 2019 20:37:04 +0200
|
||||
Subject: [PATCH 05/10] 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 77f7a1eb..55a30944 100644
|
||||
--- a/libselinux/src/label_backends_android.c
|
||||
+++ b/libselinux/src/label_backends_android.c
|
||||
@@ -62,14 +62,24 @@ 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)) {
|
||||
- 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.25.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From c4100e160008273781973b2098267e7d343b8956 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 24 May 2020 17:22:22 +0200
|
||||
Subject: [PATCH 06/10] Allow mismatches of exfat genfscon
|
||||
|
||||
---
|
||||
libsepol/cil/src/cil_post.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c
|
||||
index 99410da0..7f614c03 100644
|
||||
--- a/libsepol/cil/src/cil_post.c
|
||||
+++ b/libsepol/cil/src/cil_post.c
|
||||
@@ -502,6 +502,10 @@ static int cil_post_genfscon_context_compare(const void *a, const void *b)
|
||||
*/
|
||||
if(strcmp(a_genfscon->path_str, "/devices/virtual/block/") == 0)
|
||||
bypass = 1;
|
||||
+ if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0) {
|
||||
+ if(strcmp(a_genfscon->path_str, "/") == 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;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From 4c0afb19a2170e2cd9c4e2a1fdb48cdb16d4100e Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 25 Oct 2019 13:29:20 +0200
|
||||
Subject: [PATCH 07/10] Fix boot on Moto devices using unknown class
|
||||
|
||||
vendor sepolicy never contains new class or classorder, and are not
|
||||
allowed to.
|
||||
Though this is not tested, and it turns out Moto did it anyway.
|
||||
This raises an issue, because class need to be ordered, and thus the cil
|
||||
contains the ordering. This ordering needs to be merged.
|
||||
Android 10 added new classes, so the ordering can no longer be merged,
|
||||
and secilc fails on those devices, preventing boot.
|
||||
|
||||
Considering vendor are not supposed to declare new class (and thus
|
||||
declare classorder), this fix ignores class-es/classorder in vendor
|
||||
SELinux policy.
|
||||
|
||||
Since the vendor selinux policy has allows rules based on this context,
|
||||
those allows will fail since the class doesn't exist.
|
||||
Workaround this by ignoring rules with the problematic class
|
||||
( keystore_moto_key )
|
||||
|
||||
Lucky us, this new class `keystore_moto_key` is used by Moto for
|
||||
framework to framework (more accurately priv app to keymaster), since
|
||||
our own framework doesn't use this class, simply ignoring it fixes the
|
||||
issue.
|
||||
|
||||
Change-Id: I66339857634ebfdba359f12a99dfd0bff709d80b
|
||||
---
|
||||
libsepol/cil/src/cil_build_ast.c | 24 ++++++++++++++++++++++++
|
||||
1 file changed, 24 insertions(+)
|
||||
|
||||
diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
|
||||
index 118de1f5..77e130d1 100644
|
||||
--- a/libsepol/cil/src/cil_build_ast.c
|
||||
+++ b/libsepol/cil/src/cil_build_ast.c
|
||||
@@ -462,6 +462,14 @@ int cil_gen_class(struct cil_db *db, struct cil_tree_node *parse_current, struct
|
||||
struct cil_tree_node *perms = NULL;
|
||||
int rc = SEPOL_ERR;
|
||||
|
||||
+ {
|
||||
+ const char* path = cil_tree_get_cil_path(parse_current);
|
||||
+ if(strstr(path, "vendor/")) {
|
||||
+ cil_clear_node(ast_node);
|
||||
+ return SEPOL_OK;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
|
||||
if (rc != SEPOL_OK) {
|
||||
goto exit;
|
||||
@@ -530,6 +538,14 @@ int cil_gen_classorder(struct cil_db *db, struct cil_tree_node *parse_current, s
|
||||
struct cil_list_item *head = NULL;
|
||||
int rc = SEPOL_ERR;
|
||||
|
||||
+ {
|
||||
+ const char* path = cil_tree_get_cil_path(parse_current);
|
||||
+ if(strstr(path, "vendor/")) {
|
||||
+ cil_clear_node(ast_node);
|
||||
+ return SEPOL_OK;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (db == NULL || parse_current == NULL || ast_node == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
@@ -2115,6 +2131,14 @@ int cil_gen_avrule(struct cil_tree_node *parse_current, struct cil_tree_node *as
|
||||
rule->src_str = parse_current->next->data;
|
||||
rule->tgt_str = parse_current->next->next->data;
|
||||
|
||||
+ {
|
||||
+ const char *classname = parse_current->next->next->next->cl_head->data;
|
||||
+ if(strcmp(classname, "keystore_moto_key") == 0) {
|
||||
+ cil_clear_node(ast_node);
|
||||
+ return SEPOL_OK;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
rc = cil_fill_classperms_list(parse_current->next->next->next, &rule->perms.classperms);
|
||||
if (rc != SEPOL_OK) {
|
||||
goto exit;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 18cdd4e9ff37377b80f837c92026f1ce3514d074 Mon Sep 17 00:00:00 2001
|
||||
From: ponces <ponces26@gmail.com>
|
||||
Date: Mon, 7 Nov 2022 16:14:20 +0000
|
||||
Subject: [PATCH 08/10] Improve SELinux policy workaround on device/phh/treble
|
||||
conflict to exit with SEPOL_OK instead of SEPOL_EEXIST
|
||||
|
||||
This fixes boot on many Samsung devices as exiting with SEPOL_EEXIST will prevent them to boot
|
||||
---
|
||||
libsepol/cil/src/cil_build_ast.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
|
||||
index 77e130d1..daf8b8b3 100644
|
||||
--- a/libsepol/cil/src/cil_build_ast.c
|
||||
+++ b/libsepol/cil/src/cil_build_ast.c
|
||||
@@ -141,7 +141,6 @@ int cil_add_decl_to_symtab(struct cil_db *db, symtab_t *symtab, hashtab_key_t ke
|
||||
/* multiple_decls is enabled and works for this datum type, add node */
|
||||
cil_list_append(prev->nodes, CIL_NODE, node);
|
||||
node->data = prev;
|
||||
- return SEPOL_EEXIST;
|
||||
}
|
||||
|
||||
return SEPOL_OK;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From e62c978dbf5f214f392355a0d111adc772f10b60 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Thu, 20 Jul 2023 14:21:21 -0400
|
||||
Subject: [PATCH 09/10] Allow /sys/vm/watermark_scale_factor conflict -- seen
|
||||
on Freebox Player Pop
|
||||
|
||||
---
|
||||
libsepol/cil/src/cil_post.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c
|
||||
index 7f614c03..1703b3b6 100644
|
||||
--- a/libsepol/cil/src/cil_post.c
|
||||
+++ b/libsepol/cil/src/cil_post.c
|
||||
@@ -502,6 +502,15 @@ static int cil_post_genfscon_context_compare(const void *a, const void *b)
|
||||
*/
|
||||
if(strcmp(a_genfscon->path_str, "/devices/virtual/block/") == 0)
|
||||
bypass = 1;
|
||||
+ /*
|
||||
+ * This conflict has been seen on Freebox Player Pop
|
||||
+ * - AOSP T says (genfscon proc "/sys/vm/watermark_scale_factor" (u object_r proc_watermark_scale_factor ((s0) (s0))))
|
||||
+ * - stock rom says proc_vm_writable
|
||||
+ *
|
||||
+ * Stock ROM uses it only in recovery so it's safe to ignore
|
||||
+ */
|
||||
+ if(strcmp(a_genfscon->path_str, "/sys/vm/watermark_scale_factor") == 0)
|
||||
+ bypass = 1;
|
||||
if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0) {
|
||||
if(strcmp(a_genfscon->path_str, "/") == 0)
|
||||
bypass = 1;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From d69b637d22bd02e44ece4e68e53b9151dfda8247 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 6 Oct 2023 08:49:59 -0400
|
||||
Subject: [PATCH 10/10] Allow conflict on fuseblk
|
||||
|
||||
---
|
||||
libsepol/cil/src/cil_post.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c
|
||||
index 1703b3b6..5428005d 100644
|
||||
--- a/libsepol/cil/src/cil_post.c
|
||||
+++ b/libsepol/cil/src/cil_post.c
|
||||
@@ -511,7 +511,7 @@ static int cil_post_genfscon_context_compare(const void *a, const void *b)
|
||||
*/
|
||||
if(strcmp(a_genfscon->path_str, "/sys/vm/watermark_scale_factor") == 0)
|
||||
bypass = 1;
|
||||
- if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0) {
|
||||
+ if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0 || strcmp(a_genfscon->fs_str, "fuseblk") == 0) {
|
||||
if(strcmp(a_genfscon->path_str, "/") == 0)
|
||||
bypass = 1;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
From a23cc54356f2fe9123e370bed82cad45d67eca9e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Thu, 18 Aug 2022 15:44:46 -0400
|
||||
Subject: [PATCH 01/24] APM: Restore S, R and Q behavior respectively for
|
||||
telephony audio
|
||||
|
||||
This conditionally reverts part of b2e5cb (T), 51c9cc (S) and afd4ce (R)
|
||||
when the VNDK version is equal to or before S, R and Q respectively.
|
||||
|
||||
On R, commit afd4ce made it so that both HW and SW bridging go through
|
||||
`createAudioPatch()`, which is broken on some devices such as on MTK Q
|
||||
vendor, because their HAL do not support HW patching via the newer
|
||||
`createAudioPatch()` method. Instead, the patching on Q was done through
|
||||
`setOutputDevices()`.
|
||||
|
||||
On S, commit 51c9cc refactored the related code again such that HW
|
||||
bridging for the Rx direction is essentially removed, replaced with SW
|
||||
bridging through `startAudioSource()`. This is, again, broken on MTK R
|
||||
vendor devices.
|
||||
|
||||
On T, commit b2e5cb applied the same SW bridging to the Tx direction.
|
||||
|
||||
All of these commits rely on assumptions that are not tested through
|
||||
VTS and just presumed to be true. Although we can blame MTK for not
|
||||
supporting all the possible cases in their HAL, it will not fix
|
||||
anything, and really frameworks code should not depend on such untested
|
||||
assumptions.
|
||||
|
||||
To work around said issues, we restore old behavior from S, R and Q
|
||||
relying on the value of `ro.vndk.version`.
|
||||
|
||||
Change-Id: I56d36d2aef4319935cb88a3e4771b23c6d5b2145
|
||||
---
|
||||
.../managerdefault/AudioPolicyManager.cpp | 206 ++++++++++++------
|
||||
.../managerdefault/AudioPolicyManager.h | 3 +
|
||||
2 files changed, 147 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
index b3c68b58d3..470317cb3d 100644
|
||||
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
@@ -689,6 +689,17 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
|
||||
disconnectTelephonyAudioSource(mCallRxSourceClient);
|
||||
disconnectTelephonyAudioSource(mCallTxSourceClient);
|
||||
|
||||
+ // release existing RX patch if any
|
||||
+ if (mCallRxPatch != 0) {
|
||||
+ releaseAudioPatchInternal(mCallRxPatch->getHandle());
|
||||
+ mCallRxPatch.clear();
|
||||
+ }
|
||||
+ // release TX patch if any
|
||||
+ if (mCallTxPatch != 0) {
|
||||
+ releaseAudioPatchInternal(mCallTxPatch->getHandle());
|
||||
+ mCallTxPatch.clear();
|
||||
+ }
|
||||
+
|
||||
auto telephonyRxModule =
|
||||
mHwModules.getModuleForDeviceType(AUDIO_DEVICE_IN_TELEPHONY_RX, AUDIO_FORMAT_DEFAULT);
|
||||
auto telephonyTxModule =
|
||||
@@ -711,9 +722,20 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
|
||||
ALOGE("%s() no telephony Tx and/or RX device", __func__);
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
- // createAudioPatchInternal now supports both HW / SW bridging
|
||||
- createRxPatch = true;
|
||||
- createTxPatch = true;
|
||||
+ if (property_get_int32("ro.vndk.version", 31) >= 30) {
|
||||
+ // createAudioPatchInternal now supports both HW / SW bridging
|
||||
+ createRxPatch = true;
|
||||
+ createTxPatch = true;
|
||||
+ } else {
|
||||
+ // pre-R behavior: some devices before VNDK 30 do not support createAudioPatch correctly
|
||||
+ // for HW bridging even though they declare support for it
|
||||
+ // do not create a patch (aka Sw Bridging) if Primary HW module has declared supporting a
|
||||
+ // route between telephony RX to Sink device and Source device to telephony TX
|
||||
+ ALOGI("%s() Using pre-R behavior for createRxPatch and createTxPatch", __func__);
|
||||
+ const auto &primaryModule = telephonyRxModule;
|
||||
+ createRxPatch = !primaryModule->supportsPatch(rxSourceDevice, rxDevices.itemAt(0));
|
||||
+ createTxPatch = !primaryModule->supportsPatch(txSourceDevice, txSinkDevice);
|
||||
+ }
|
||||
} else {
|
||||
// If the RX device is on the primary HW module, then use legacy routing method for
|
||||
// voice calls via setOutputDevice() on primary output.
|
||||
@@ -730,7 +752,14 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
|
||||
if (!createRxPatch) {
|
||||
muteWaitMs = setOutputDevices(mPrimaryOutput, rxDevices, true, delayMs);
|
||||
} else { // create RX path audio patch
|
||||
- connectTelephonyRxAudioSource();
|
||||
+ if (property_get_int32("ro.vndk.version", 31) >= 31) {
|
||||
+ connectTelephonyRxAudioSource();
|
||||
+ } else {
|
||||
+ // pre-S behavior: some devices do not support SW bridging correctly when HW bridge is
|
||||
+ // available through createAudioPatch(); startAudioSource() forces SW bridging.
|
||||
+ ALOGI("%s() Using pre-S behavior to create HW Rx patch", __func__);
|
||||
+ mCallRxPatch = createTelephonyPatch(true /*isRx*/, rxDevices.itemAt(0), delayMs);
|
||||
+ }
|
||||
// If the TX device is on the primary HW module but RX device is
|
||||
// on other HW module, SinkMetaData of telephony input should handle it
|
||||
// assuming the device uses audio HAL V5.0 and above
|
||||
@@ -745,7 +774,12 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
|
||||
closeActiveClients(activeDesc);
|
||||
}
|
||||
}
|
||||
- connectTelephonyTxAudioSource(txSourceDevice, txSinkDevice, delayMs);
|
||||
+ if (property_get_int32("ro.vndk.version", 33) >= 33) {
|
||||
+ connectTelephonyTxAudioSource(txSourceDevice, txSinkDevice, delayMs);
|
||||
+ } else {
|
||||
+ // pre-T behavior: hw bridging for tx too; skip the SwOutput
|
||||
+ mCallTxPatch = createTelephonyPatch(false /*isRx*/, txSourceDevice, delayMs);
|
||||
+ }
|
||||
}
|
||||
if (waitMs != nullptr) {
|
||||
*waitMs = muteWaitMs;
|
||||
@@ -753,6 +787,36 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
+sp<AudioPatch> AudioPolicyManager::createTelephonyPatch(
|
||||
+ bool isRx, const sp<DeviceDescriptor> &device, uint32_t delayMs) {
|
||||
+ PatchBuilder patchBuilder;
|
||||
+
|
||||
+ if (device == nullptr) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ // @TODO: still ignoring the address, or not dealing platform with multiple telephony devices
|
||||
+ if (isRx) {
|
||||
+ patchBuilder.addSink(device).
|
||||
+ addSource(mAvailableInputDevices.getDevice(
|
||||
+ AUDIO_DEVICE_IN_TELEPHONY_RX, String8(), AUDIO_FORMAT_DEFAULT));
|
||||
+ } else {
|
||||
+ patchBuilder.addSource(device).
|
||||
+ addSink(mAvailableOutputDevices.getDevice(
|
||||
+ AUDIO_DEVICE_OUT_TELEPHONY_TX, String8(), AUDIO_FORMAT_DEFAULT));
|
||||
+ }
|
||||
+
|
||||
+ audio_patch_handle_t patchHandle = AUDIO_PATCH_HANDLE_NONE;
|
||||
+ status_t status =
|
||||
+ createAudioPatchInternal(patchBuilder.patch(), &patchHandle, mUidCached, delayMs, nullptr);
|
||||
+ ssize_t index = mAudioPatches.indexOfKey(patchHandle);
|
||||
+ if (status != NO_ERROR || index < 0) {
|
||||
+ ALOGW("%s() error %d creating %s audio patch", __func__, status, isRx ? "RX" : "TX");
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ return mAudioPatches.valueAt(index);
|
||||
+}
|
||||
+
|
||||
bool AudioPolicyManager::isDeviceOfModule(
|
||||
const sp<DeviceDescriptor>& devDesc, const char *moduleId) const {
|
||||
sp<HwModule> module = mHwModules.getModuleFromName(moduleId);
|
||||
@@ -5034,83 +5098,101 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *
|
||||
// in config XML to reach the sink so that is can be declared as available.
|
||||
audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
|
||||
sp<SwAudioOutputDescriptor> outputDesc;
|
||||
- if (!sourceDesc->isInternal()) {
|
||||
- // take care of dynamic routing for SwOutput selection,
|
||||
- audio_attributes_t attributes = sourceDesc->attributes();
|
||||
- audio_stream_type_t stream = sourceDesc->stream();
|
||||
- audio_attributes_t resultAttr;
|
||||
- audio_config_t config = AUDIO_CONFIG_INITIALIZER;
|
||||
- config.sample_rate = sourceDesc->config().sample_rate;
|
||||
- audio_channel_mask_t sourceMask = sourceDesc->config().channel_mask;
|
||||
- config.channel_mask =
|
||||
- (audio_channel_mask_get_representation(sourceMask)
|
||||
- == AUDIO_CHANNEL_REPRESENTATION_INDEX) ? sourceMask
|
||||
- : audio_channel_mask_in_to_out(sourceMask);
|
||||
- config.format = sourceDesc->config().format;
|
||||
- audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
|
||||
- audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
|
||||
- bool isRequestedDeviceForExclusiveUse = false;
|
||||
- output_type_t outputType;
|
||||
- bool isSpatialized;
|
||||
- bool isBitPerfect;
|
||||
- getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
|
||||
- &stream, sourceDesc->uid(), &config, &flags,
|
||||
- &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
|
||||
- nullptr, &outputType, &isSpatialized, &isBitPerfect);
|
||||
- if (output == AUDIO_IO_HANDLE_NONE) {
|
||||
- ALOGV("%s no output for device %s",
|
||||
- __FUNCTION__, sinkDevice->toString().c_str());
|
||||
- return INVALID_OPERATION;
|
||||
- }
|
||||
- outputDesc = mOutputs.valueFor(output);
|
||||
- if (outputDesc->isDuplicated()) {
|
||||
- ALOGE("%s output is duplicated", __func__);
|
||||
- return INVALID_OPERATION;
|
||||
- }
|
||||
- bool closeOutput = outputDesc->mDirectOpenCount != 0;
|
||||
- sourceDesc->setSwOutput(outputDesc, closeOutput);
|
||||
- } else {
|
||||
- // Same for "raw patches" aka created from createAudioPatch API
|
||||
- SortedVector<audio_io_handle_t> outputs =
|
||||
- getOutputsForDevices(DeviceVector(sinkDevice), mOutputs);
|
||||
- // if the sink device is reachable via an opened output stream, request to
|
||||
- // go via this output stream by adding a second source to the patch
|
||||
- // description
|
||||
- output = selectOutput(outputs);
|
||||
- if (output == AUDIO_IO_HANDLE_NONE) {
|
||||
- ALOGE("%s no output available for internal patch sink", __func__);
|
||||
- return INVALID_OPERATION;
|
||||
- }
|
||||
- outputDesc = mOutputs.valueFor(output);
|
||||
- if (outputDesc->isDuplicated()) {
|
||||
- ALOGV("%s output for device %s is duplicated",
|
||||
- __func__, sinkDevice->toString().c_str());
|
||||
- return INVALID_OPERATION;
|
||||
+ if (sourceDesc != nullptr) {
|
||||
+ if (!sourceDesc->isInternal()) {
|
||||
+ // take care of dynamic routing for SwOutput selection,
|
||||
+ audio_attributes_t attributes = sourceDesc->attributes();
|
||||
+ audio_stream_type_t stream = sourceDesc->stream();
|
||||
+ audio_attributes_t resultAttr;
|
||||
+ audio_config_t config = AUDIO_CONFIG_INITIALIZER;
|
||||
+ config.sample_rate = sourceDesc->config().sample_rate;
|
||||
+ audio_channel_mask_t sourceMask = sourceDesc->config().channel_mask;
|
||||
+ config.channel_mask =
|
||||
+ (audio_channel_mask_get_representation(sourceMask)
|
||||
+ == AUDIO_CHANNEL_REPRESENTATION_INDEX) ? sourceMask
|
||||
+ : audio_channel_mask_in_to_out(sourceMask);
|
||||
+ config.format = sourceDesc->config().format;
|
||||
+ audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
|
||||
+ audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
|
||||
+ bool isRequestedDeviceForExclusiveUse = false;
|
||||
+ output_type_t outputType;
|
||||
+ bool isSpatialized;
|
||||
+ bool isBitPerfect;
|
||||
+ getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
|
||||
+ &stream, sourceDesc->uid(), &config, &flags,
|
||||
+ &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
|
||||
+ nullptr, &outputType, &isSpatialized, &isBitPerfect);
|
||||
+ if (output == AUDIO_IO_HANDLE_NONE) {
|
||||
+ ALOGV("%s no output for device %s",
|
||||
+ __FUNCTION__, sinkDevice->toString().c_str());
|
||||
+ return INVALID_OPERATION;
|
||||
+ }
|
||||
+ outputDesc = mOutputs.valueFor(output);
|
||||
+ if (outputDesc->isDuplicated()) {
|
||||
+ ALOGE("%s output is duplicated", __func__);
|
||||
+ return INVALID_OPERATION;
|
||||
+ }
|
||||
+ bool closeOutput = outputDesc->mDirectOpenCount != 0;
|
||||
+ sourceDesc->setSwOutput(outputDesc, closeOutput);
|
||||
+ } else {
|
||||
+ // Same for "raw patches" aka created from createAudioPatch API
|
||||
+ SortedVector<audio_io_handle_t> outputs =
|
||||
+ getOutputsForDevices(DeviceVector(sinkDevice), mOutputs);
|
||||
+ // if the sink device is reachable via an opened output stream, request to
|
||||
+ // go via this output stream by adding a second source to the patch
|
||||
+ // description
|
||||
+ output = selectOutput(outputs);
|
||||
+ if (output == AUDIO_IO_HANDLE_NONE) {
|
||||
+ ALOGE("%s no output available for internal patch sink", __func__);
|
||||
+ return INVALID_OPERATION;
|
||||
+ }
|
||||
+ outputDesc = mOutputs.valueFor(output);
|
||||
+ if (outputDesc->isDuplicated()) {
|
||||
+ ALOGV("%s output for device %s is duplicated",
|
||||
+ __func__, sinkDevice->toString().c_str());
|
||||
+ return INVALID_OPERATION;
|
||||
+ }
|
||||
}
|
||||
- sourceDesc->setSwOutput(outputDesc, /* closeOutput= */ false);
|
||||
}
|
||||
// create a software bridge in PatchPanel if:
|
||||
// - source and sink devices are on different HW modules OR
|
||||
// - audio HAL version is < 3.0
|
||||
// - audio HAL version is >= 3.0 but no route has been declared between devices
|
||||
- // - called from startAudioSource (aka sourceDesc is not internal) and source device
|
||||
+ // - called from startAudioSource (aka sourceDesc is neither null nor internal) and source device
|
||||
// does not have a gain controller
|
||||
if (!srcDevice->hasSameHwModuleAs(sinkDevice) ||
|
||||
(srcDevice->getModuleVersionMajor() < 3) ||
|
||||
!srcDevice->getModule()->supportsPatch(srcDevice, sinkDevice) ||
|
||||
- (!sourceDesc->isInternal() &&
|
||||
+ ((sourceDesc != nullptr && !sourceDesc->isInternal()) &&
|
||||
srcDevice->getAudioPort()->getGains().size() == 0)) {
|
||||
// support only one sink device for now to simplify output selection logic
|
||||
if (patch->num_sinks > 1) {
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
- sourceDesc->setUseSwBridge();
|
||||
+ if (sourceDesc == nullptr) {
|
||||
+ SortedVector<audio_io_handle_t> outputs =
|
||||
+ getOutputsForDevices(DeviceVector(sinkDevice), mOutputs);
|
||||
+ // if the sink device is reachable via an opened output stream, request to
|
||||
+ // go via this output stream by adding a second source to the patch
|
||||
+ // description
|
||||
+ output = selectOutput(outputs);
|
||||
+ if (output != AUDIO_IO_HANDLE_NONE) {
|
||||
+ outputDesc = mOutputs.valueFor(output);
|
||||
+ if (outputDesc->isDuplicated()) {
|
||||
+ ALOGV("%s output for device %s is duplicated",
|
||||
+ __FUNCTION__, sinkDevice->toString().c_str());
|
||||
+ return INVALID_OPERATION;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ sourceDesc->setUseSwBridge();
|
||||
+ }
|
||||
if (outputDesc != nullptr) {
|
||||
audio_port_config srcMixPortConfig = {};
|
||||
outputDesc->toAudioPortConfig(&srcMixPortConfig, nullptr);
|
||||
// for volume control, we may need a valid stream
|
||||
srcMixPortConfig.ext.mix.usecase.stream =
|
||||
- (!sourceDesc->isInternal() || isCallTxAudioSource(sourceDesc)) ?
|
||||
+ (sourceDesc != nullptr && (!sourceDesc->isInternal() || isCallTxAudioSource(sourceDesc))) ?
|
||||
mEngine->getStreamTypeForAttributes(sourceDesc->attributes()) :
|
||||
AUDIO_STREAM_PATCH;
|
||||
patchBuilder.addSource(srcMixPortConfig);
|
||||
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
index 863c785b08..41930138c4 100644
|
||||
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
@@ -957,6 +957,9 @@ protected:
|
||||
|
||||
SoundTriggerSessionCollection mSoundTriggerSessions;
|
||||
|
||||
+ sp<AudioPatch> mCallTxPatch;
|
||||
+ sp<AudioPatch> mCallRxPatch;
|
||||
+
|
||||
HwAudioOutputCollection mHwOutputs;
|
||||
SourceClientCollection mAudioSources;
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
From f1a2ee42e286ea44030eea193d8abd2daf865cb5 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 5 Aug 2019 18:09:50 +0200
|
||||
Subject: [PATCH 02/24] 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 | 93 +++++++++++++++++++
|
||||
1 file changed, 93 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 3d5c1d2e42..5ca409cfe7 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -663,6 +663,98 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
|
||||
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:
|
||||
+ // <route type="mix" sink="Telephony Tx" sources="voice_tx"/>
|
||||
+ // <route type="mix" sink="primary input" sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic"/>
|
||||
+ // <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink" />
|
||||
+ // And no <route type="mix" sink="BT SCO Headset" />
|
||||
+
|
||||
+ // Add:
|
||||
+ // <route type="mix" sink="BT SCO Headset" sources="primary output,deep_buffer,compressed_offload,Telephony Rx"/>
|
||||
+ bool foundBtScoHeadsetDevice = false;
|
||||
+ for(const auto& device: devicePorts) {
|
||||
+ if(device->getTagName() == "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() == "Telephony Tx") {
|
||||
+ foundTelephony = true;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if(sink->getTagName() == "BT SCO Headset") {
|
||||
+ foundScoHeadsetRoute = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ for(const auto& source: route->getSources()) {
|
||||
+ ALOGE("... With source %s\n", source->getTagName().c_str());
|
||||
+ if(source->getTagName() == "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:
|
||||
+ // <route type="mix" sink="BT SCO Headset" sources="primary output,deep_buffer,compressed_offload,Telephony Rx"/>
|
||||
+ AudioRoute *newRoute = new AudioRoute(AUDIO_ROUTE_MIX);
|
||||
+
|
||||
+ auto sink = ctx->findPortByTagName("BT SCO Headset");
|
||||
+ ALOGE("Got sink %p\n", sink.get());
|
||||
+ newRoute->setSink(sink);
|
||||
+
|
||||
+ Vector<sp<PolicyAudioPort>> sources;
|
||||
+ for(const auto& sourceName: {
|
||||
+ "primary output",
|
||||
+ "deep_buffer",
|
||||
+ "compressed_offload",
|
||||
+ "Telephony Rx"
|
||||
+ }) {
|
||||
+ auto source = ctx->findPortByTagName(sourceName);
|
||||
+ ALOGE("Got source %p\n", source.get());
|
||||
+ if (source.get() != nullptr) {
|
||||
+ sources.add(source);
|
||||
+ source->addRoute(newRoute);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ newRoute->setSources(sources);
|
||||
+
|
||||
+ sink->addRoute(newRoute);
|
||||
+
|
||||
+ auto ret = routes.add(newRoute);
|
||||
+ ALOGE("route add returned %zd", ret);
|
||||
+}
|
||||
+
|
||||
template<>
|
||||
std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<ModuleTraits>(
|
||||
const xmlNode *cur, ModuleTraits::PtrSerializingCtx ctx)
|
||||
@@ -710,6 +802,7 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
|
||||
if (status != NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
+ fixupQualcommBtScoRoute(routes, devicePorts, module.get());
|
||||
module->setRoutes(routes);
|
||||
|
||||
for (const xmlNode *children = cur->xmlChildrenNode; children != NULL;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
From 624156c029c11d97005c2f3212d3d67fb511ebfe Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 1 Oct 2019 13:35:49 +0200
|
||||
Subject: [PATCH 03/24] 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 ebe424ec25..ac1ba38db9 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.cpp
|
||||
+++ b/services/camera/libcameraservice/CameraService.cpp
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <inttypes.h>
|
||||
#include <pthread.h>
|
||||
#include <poll.h>
|
||||
@@ -154,6 +155,7 @@ static std::set<String8> sServiceErrorEventSet;
|
||||
|
||||
CameraService::CameraService(
|
||||
std::shared_ptr<CameraServiceProxyWrapper> cameraServiceProxyWrapper) :
|
||||
+ mPhysicalFrontCamStatus(false),
|
||||
mCameraServiceProxyWrapper(cameraServiceProxyWrapper == nullptr ?
|
||||
std::make_shared<CameraServiceProxyWrapper>() : cameraServiceProxyWrapper),
|
||||
mEventLog(DEFAULT_EVENT_LOG_LENGTH),
|
||||
@@ -2344,6 +2346,7 @@ Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String8&
|
||||
mServiceLock.lock();
|
||||
} else {
|
||||
// Otherwise, add client to active clients list
|
||||
+ physicalFrontCam(cameraId == "1");
|
||||
finishConnectLocked(client, partial, oomScoreOffset, systemNativeClient);
|
||||
}
|
||||
|
||||
@@ -2468,6 +2471,27 @@ status_t CameraService::addOfflineClient(String8 cameraId, sp<BasicClient> offli
|
||||
return OK;
|
||||
}
|
||||
|
||||
+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::turnOnTorchWithStrengthLevel(const String16& unresolvedCameraId,
|
||||
int32_t torchStrength,
|
||||
const sp<IBinder>& clientBinder) {
|
||||
@@ -3733,6 +3757,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 208138f4ab..4ac9362621 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.h
|
||||
+++ b/services/camera/libcameraservice/CameraService.h
|
||||
@@ -252,6 +252,9 @@ public:
|
||||
// Register an offline client for a given active camera id
|
||||
status_t addOfflineClient(String8 cameraId, sp<BasicClient> offlineClient);
|
||||
|
||||
+ bool mPhysicalFrontCamStatus;
|
||||
+ void physicalFrontCam(bool on);
|
||||
+
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Client functionality
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From 205893589b67163df4b625e417a30b5e20a0197c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 24 Aug 2022 15:42:39 -0400
|
||||
Subject: [PATCH 04/24] APM: Optionally force-load audio policy for system-side
|
||||
bt audio HAL
|
||||
|
||||
Required to support our system-side bt audio implementation, i.e.
|
||||
`sysbta`.
|
||||
|
||||
Co-authored-by: Pierre-Hugues Husson <phh@phh.me>
|
||||
Change-Id: I279fff541a531f922f3fa55b8f14d00237db59ff
|
||||
---
|
||||
.../managerdefinitions/src/Serializer.cpp | 25 +++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 5ca409cfe7..14b19e76ad 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xinclude.h>
|
||||
#include <media/convert.h>
|
||||
+#include <cutils/properties.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
#include <utils/Errors.h>
|
||||
@@ -978,6 +979,30 @@ status_t PolicySerializer::deserialize(const char *configFile, AudioPolicyConfig
|
||||
if (status != NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
+
|
||||
+ // Remove modules called bluetooth, bluetooth_qti or a2dp, and inject our own
|
||||
+ if (property_get_bool("persist.bluetooth.system_audio_hal.enabled", false)) {
|
||||
+ for (auto it = modules.begin(); it != modules.end(); it++) {
|
||||
+ const char *name = (*it)->getName();
|
||||
+ if (strcmp(name, "a2dp") == 0 ||
|
||||
+ strcmp(name, "a2dpsink") == 0 ||
|
||||
+ strcmp(name, "bluetooth") == 0 ||
|
||||
+ strcmp(name, "bluetooth_qti") == 0) {
|
||||
+
|
||||
+ ALOGE("Removed module %s\n", name);
|
||||
+ it = modules.erase(it);
|
||||
+ }
|
||||
+ if (it == modules.end()) break;
|
||||
+ }
|
||||
+ const char* a2dpFileName = "/system/etc/sysbta_audio_policy_configuration.xml";
|
||||
+ if (version == "7.0")
|
||||
+ a2dpFileName = "/system/etc/sysbta_audio_policy_configuration_7_0.xml";
|
||||
+ auto doc = make_xmlUnique(xmlParseFile(a2dpFileName));
|
||||
+ xmlNodePtr root = xmlDocGetRootElement(doc.get());
|
||||
+ auto maybeA2dpModule = deserialize<ModuleTraits>(root, config);
|
||||
+ modules.add(std::get<1>(maybeA2dpModule));
|
||||
+ }
|
||||
+
|
||||
config->setHwModules(modules);
|
||||
|
||||
// Global Configuration
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
From 973d0264e4b10d1c30db4361b947378452c1d259 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Thu, 25 Aug 2022 13:30:29 -0400
|
||||
Subject: [PATCH 05/24] APM: Remove A2DP audio ports from the primary HAL
|
||||
|
||||
These ports defined in the primary HAL are intended for A2DP offloading,
|
||||
however they do not work in general on GSIs, and will interfere with
|
||||
sysbta, the system-side generic bluetooth audio implementation.
|
||||
|
||||
Remove them as we parse the policy XML.
|
||||
|
||||
Co-authored-by: Pierre-Hugues Husson <phh@phh.me>
|
||||
Change-Id: I3305594a17285da113167b419543543f0ef71122
|
||||
---
|
||||
.../managerdefinitions/src/Serializer.cpp | 26 ++++++++++++++++---
|
||||
1 file changed, 22 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 14b19e76ad..b30ad7e8af 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <libxml/xinclude.h>
|
||||
#include <media/convert.h>
|
||||
#include <cutils/properties.h>
|
||||
+#include <system/audio.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
#include <utils/Errors.h>
|
||||
@@ -334,11 +335,8 @@ status_t PolicySerializer::deserializeCollection(const xmlNode *cur,
|
||||
Trait::collectionTag);
|
||||
return status;
|
||||
}
|
||||
- } else if (mIgnoreVendorExtensions && std::get<status_t>(maybeElement) == NO_INIT) {
|
||||
- // Skip a vendor extension element.
|
||||
- } else {
|
||||
- return BAD_VALUE;
|
||||
}
|
||||
+ // Ignore elements that failed to parse, e.g. routes with invalid sinks
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, reinterpret_cast<const xmlChar*>(Trait::tag))) {
|
||||
@@ -771,6 +769,7 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
|
||||
ALOGE("%s: No %s found", __func__, Attributes::name);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
+
|
||||
uint32_t versionMajor = 0, versionMinor = 0;
|
||||
std::string versionLiteral = getXmlAttribute(cur, Attributes::version);
|
||||
if (!versionLiteral.empty()) {
|
||||
@@ -796,6 +795,25 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
|
||||
if (status != NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
+ bool shouldEraseA2DP = name == "primary" && property_get_bool("persist.bluetooth.system_audio_hal.enabled", false);
|
||||
+ if (shouldEraseA2DP) {
|
||||
+ // Having A2DP ports in the primary audio HAL module will interfere with sysbta
|
||||
+ // so remove them here. Note that we do not need to explicitly remove the
|
||||
+ // corresponding routes below, because routes with invalid sinks will be ignored
|
||||
+ auto iter = devicePorts.begin();
|
||||
+ while (iter != devicePorts.end()) {
|
||||
+ auto port = *iter;
|
||||
+ auto type = port->type();
|
||||
+ if (type == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP
|
||||
+ || type == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES
|
||||
+ || type == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER) {
|
||||
+ ALOGE("Erasing A2DP device port %s", port->getTagName().c_str());
|
||||
+ iter = devicePorts.erase(iter);
|
||||
+ } else {
|
||||
+ iter++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
module->setDeclaredDevices(devicePorts);
|
||||
|
||||
RouteTraits::Collection routes;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
From 4166271097c272370d8079303e8a88a209fca163 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Thu, 23 Jan 2020 11:13:43 +0800
|
||||
Subject: [PATCH 06/24] audiopolicy: try again with trimmed audio port name if
|
||||
not found
|
||||
|
||||
* In Spreadtrum BSP, some audio routes may contain ports with extra
|
||||
spaces at the beginning and the end, causing audiopolicy to refuse to
|
||||
load and leading to broken audio.
|
||||
|
||||
* Fix this by retrying with trimmed port name when not found. Do not
|
||||
use trimmed name all the time because a white space is a valid
|
||||
character in port name, and we cannot be sure nobody is using it for
|
||||
legitimite purposes.
|
||||
|
||||
Change-Id: I993708b28e8404bc8c483d71a850ac69382231bd
|
||||
---
|
||||
.../common/managerdefinitions/src/Serializer.cpp | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index b30ad7e8af..53fabcc71e 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -593,6 +593,17 @@ std::variant<status_t, DevicePortTraits::Element> PolicySerializer::deserialize<
|
||||
return deviceDesc;
|
||||
}
|
||||
|
||||
+char* trim(char * s) {
|
||||
+ int l = strlen(s);
|
||||
+
|
||||
+ if (l > 0) {
|
||||
+ while (isspace(s[l - 1])) --l;
|
||||
+ while (*s && isspace(*s)) ++s, --l;
|
||||
+ }
|
||||
+
|
||||
+ return strndup(s, l);
|
||||
+}
|
||||
+
|
||||
template<>
|
||||
std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<RouteTraits>(
|
||||
const xmlNode *cur, RouteTraits::PtrSerializingCtx ctx)
|
||||
@@ -640,6 +651,9 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
|
||||
while (devTag != NULL) {
|
||||
if (strlen(devTag) != 0) {
|
||||
sp<PolicyAudioPort> source = ctx->findPortByTagName(devTag);
|
||||
+ if (source == NULL) {
|
||||
+ source = ctx->findPortByTagName(trim(devTag));
|
||||
+ }
|
||||
if (source == NULL && !mIgnoreVendorExtensions) {
|
||||
ALOGE("%s: no source found with name=%s", __func__, devTag);
|
||||
return BAD_VALUE;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From bcedbc8066a041ae996960642cee0c41390a0603 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 1 Jun 2022 16:56:46 -0400
|
||||
Subject: [PATCH 07/24] camera: Implement property to override default camera
|
||||
|
||||
Complement to the frameworks/base patch.
|
||||
|
||||
Change-Id: I002bfa974bafc2cc01365eeea31c7a5dcb5a2028
|
||||
---
|
||||
.../common/CameraProviderManager.cpp | 22 +++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
index fac6e4e189..0ec647a941 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <functional>
|
||||
#include <camera_metadata_hidden.h>
|
||||
#include <android-base/parseint.h>
|
||||
+#include <android-base/properties.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <hwbinder/IPCThreadState.h>
|
||||
@@ -215,6 +216,15 @@ std::vector<std::string> CameraProviderManager::getCameraDeviceIds(std::unordere
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ int32_t altPrimaryCamera = property_get_int32("persist.sys.alt_primary_camera", 0);
|
||||
+
|
||||
+ if (altPrimaryCamera != 0 && deviceIds.size() > (size_t) altPrimaryCamera) {
|
||||
+ const std::string origPrimary = deviceIds[0];
|
||||
+ deviceIds[0] = deviceIds[altPrimaryCamera];
|
||||
+ deviceIds[altPrimaryCamera] = origPrimary;
|
||||
+ }
|
||||
+
|
||||
return deviceIds;
|
||||
}
|
||||
|
||||
@@ -281,6 +291,18 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
|
||||
std::sort(systemDeviceIds.begin(), systemDeviceIds.end(), sortFunc);
|
||||
deviceIds.insert(deviceIds.end(), publicDeviceIds.begin(), publicDeviceIds.end());
|
||||
deviceIds.insert(deviceIds.end(), systemDeviceIds.begin(), systemDeviceIds.end());
|
||||
+
|
||||
+ // Default camera ID hack should match with android.hardware.camera2.CameraManager.sortCameraIds
|
||||
+ // Note that the alt primary camera may not be available here due to filterLogicalCameraIdsLocked()
|
||||
+ // in which case we will just ignore it.
|
||||
+ int altPrimaryCameraId = base::GetIntProperty("persist.sys.alt_primary_camera", -1);
|
||||
+
|
||||
+ if (altPrimaryCameraId > 0 && altPrimaryCameraId < (int) deviceIds.size()) {
|
||||
+ std::string origPrimary = deviceIds[0];
|
||||
+ deviceIds[0] = deviceIds[altPrimaryCameraId];
|
||||
+ deviceIds[altPrimaryCameraId] = origPrimary;
|
||||
+ }
|
||||
+
|
||||
return deviceIds;
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 39d57b92989f1c50c144fe2084a82b8b2b84d5e4 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 13 Apr 2020 21:01:16 +0200
|
||||
Subject: [PATCH 08/24] There are three SCO devices. Fallback from one to the
|
||||
others if needed
|
||||
|
||||
Change-Id: I414dcb6b154855c00cb8520b23dc1069827864b2
|
||||
---
|
||||
.../managerdefinitions/src/HwModule.cpp | 21 +++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
|
||||
index 5f14ee4623..166ab7acbb 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
|
||||
@@ -318,6 +318,27 @@ sp<HwModule> HwModuleCollection::getModuleForDeviceType(audio_devices_t type,
|
||||
}
|
||||
}
|
||||
}
|
||||
+ //We didn't find one? Ok but all SCOs are equivalent surely?
|
||||
+ if(type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO ||
|
||||
+ type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET ||
|
||||
+ type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) {
|
||||
+ ALOGE("Fallback SCO");
|
||||
+ if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO) {
|
||||
+ auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO, encodedFormat);
|
||||
+ ALOGE("Fallback SCO simple? %s", (ret != nullptr) ? "yes" : "no");
|
||||
+ if(ret != nullptr) return ret;
|
||||
+ }
|
||||
+ if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) {
|
||||
+ auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET, encodedFormat);
|
||||
+ ALOGE("Fallback SCO headset? %s", (ret != nullptr) ? "yes" : "no");
|
||||
+ if(ret != nullptr) return ret;
|
||||
+ }
|
||||
+ if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) {
|
||||
+ auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT, encodedFormat);
|
||||
+ ALOGE("Fallback SCO carkit? %s", (ret != nullptr) ? "yes" : "no");
|
||||
+ if(ret != nullptr) return ret;
|
||||
+ }
|
||||
+ }
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From 6ce29da63cd824516e7472706e78e0f9704e9453 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Thu, 14 May 2020 19:54:55 +0200
|
||||
Subject: [PATCH 09/24] Add persist.sys.phh.samsung.camera_ids property to
|
||||
access hidden Samsung cameras
|
||||
|
||||
Change-Id: I2c7bf535272acc28ed2277e96c78ddd28a0b4593
|
||||
---
|
||||
services/camera/libcameraservice/Android.bp | 1 +
|
||||
.../common/hidl/HidlProviderInfo.cpp | 14 ++++++++++++--
|
||||
2 files changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
|
||||
index a45365ad53..25fd8451a9 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -175,6 +175,7 @@ cc_library_shared {
|
||||
"android.hardware.camera.device@3.6",
|
||||
"android.hardware.camera.device@3.7",
|
||||
"android.hardware.camera.device-V2-ndk",
|
||||
+ "vendor.samsung.hardware.camera.provider@3.0",
|
||||
"media_permission-aidl-cpp",
|
||||
],
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
index 8ff5c3fb01..d498ecbee5 100644
|
||||
--- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
+++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <utils/Trace.h>
|
||||
|
||||
#include <android/hardware/camera/device/3.7/ICameraDevice.h>
|
||||
+#include <vendor/samsung/hardware/camera/provider/3.0/ISehCameraProvider.h>
|
||||
|
||||
namespace {
|
||||
const bool kEnableLazyHal(property_get_bool("ro.camera.enableLazyHal", false));
|
||||
@@ -134,6 +135,7 @@ status_t HidlProviderInfo::initializeHidlProvider(
|
||||
mMinorVersion = 6;
|
||||
}
|
||||
}
|
||||
+
|
||||
// We need to check again since cast2_6.isOk() succeeds even if the provider
|
||||
// version isn't actually 2.6.
|
||||
if (interface2_6 == nullptr){
|
||||
@@ -170,6 +172,9 @@ status_t HidlProviderInfo::initializeHidlProvider(
|
||||
return mapToStatusT(status);
|
||||
}
|
||||
|
||||
+ auto samsungCast = vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider::castFrom(interface);
|
||||
+ auto samsungProvider = samsungCast.isOk() ? static_cast<sp<vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider>>(samsungCast) : nullptr;
|
||||
+
|
||||
hardware::Return<bool> linked = interface->linkToDeath(this, /*cookie*/ mId);
|
||||
if (!linked.isOk()) {
|
||||
ALOGE("%s: Transaction error in linking to camera provider '%s' death: %s",
|
||||
@@ -200,7 +205,7 @@ status_t HidlProviderInfo::initializeHidlProvider(
|
||||
|
||||
// Get initial list of camera devices, if any
|
||||
std::vector<std::string> devices;
|
||||
- hardware::Return<void> ret = interface->getCameraIdList([&status, this, &devices](
|
||||
+ auto cb = [&status, this, &devices](
|
||||
Status idStatus,
|
||||
const hardware::hidl_vec<hardware::hidl_string>& cameraDeviceNames) {
|
||||
status = idStatus;
|
||||
@@ -217,7 +222,12 @@ status_t HidlProviderInfo::initializeHidlProvider(
|
||||
mProviderPublicCameraIds.push_back(id);
|
||||
}
|
||||
}
|
||||
- } });
|
||||
+ } };
|
||||
+ hardware::Return<void> ret;
|
||||
+ if(samsungProvider != nullptr && property_get_bool("persist.sys.phh.samsung.camera_ids", false))
|
||||
+ ret = samsungProvider->sehGetCameraIdList(cb);
|
||||
+ else
|
||||
+ ret = interface->getCameraIdList(cb);
|
||||
if (!ret.isOk()) {
|
||||
ALOGE("%s: Transaction error in getting camera ID list from provider '%s': %s",
|
||||
__FUNCTION__, mProviderName.c_str(), linked.description().c_str());
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From 603a86094ca5d2daf1c28ce6ee72110f13526c7f Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 19 May 2020 14:01:14 +0200
|
||||
Subject: [PATCH 10/24] Add a property to force camera timestamp source
|
||||
|
||||
Some devices wrongly report their timesource
|
||||
Camera's timesource can either be CLOCK_MONOTONIC, or CLOCK_BOOTTIME
|
||||
The former doesn't increment in sleep, while the later does.
|
||||
There is a camera HAL property for that, though some devices don't
|
||||
report it properly.
|
||||
|
||||
This issue happens on Xiaomi Redmi 7A, it needs to force the value to 1
|
||||
|
||||
Add a property persist.sys.phh.camera.force_timestampsource to force
|
||||
timestamp source.
|
||||
---
|
||||
.../libcameraservice/device3/Camera3Device.cpp | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
|
||||
index 54176f9a96..81a1faca83 100644
|
||||
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
|
||||
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
|
||||
@@ -211,8 +211,16 @@ status_t Camera3Device::initializeCommonLocked() {
|
||||
mTimestampOffset = getMonoToBoottimeOffset();
|
||||
camera_metadata_entry timestampSource =
|
||||
mDeviceInfo.find(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE);
|
||||
- if (timestampSource.count > 0 && timestampSource.data.u8[0] ==
|
||||
- ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME) {
|
||||
+ int timestampSourceValue = 0;
|
||||
+ if ((timestampSource.count > 0 && timestampSource.data.u8[0] ==
|
||||
+ ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME)) {
|
||||
+ timestampSourceValue = 1;
|
||||
+ }
|
||||
+ int forceTimestampSource = property_get_int32("persist.sys.phh.camera.force_timestampsource", -1);
|
||||
+ //Don't override if it's -1, default value
|
||||
+ if(forceTimestampSource == 0) timestampSourceValue = 0;
|
||||
+ if(forceTimestampSource == 1) timestampSourceValue = 1;
|
||||
+ if (timestampSourceValue == 1) {
|
||||
mDeviceTimeBaseIsRealtime = true;
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
From ffca95eba859a2b763b6d2b7221bc96aeeef764b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 24 Apr 2018 00:14:28 +0200
|
||||
Subject: [PATCH 11/24] 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 53fabcc71e..83eafc2f79 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -416,23 +416,32 @@ std::variant<status_t, AudioGainTraits::Element> PolicySerializer::deserialize<A
|
||||
}
|
||||
}
|
||||
|
||||
+static bool fixedEarpieceChannels = false;
|
||||
template<>
|
||||
std::variant<status_t, AudioProfileTraits::Element>
|
||||
PolicySerializer::deserialize<AudioProfileTraits>(
|
||||
- const xmlNode *cur, AudioProfileTraits::PtrSerializingCtx /*serializingContext*/)
|
||||
+ const xmlNode *cur, AudioProfileTraits::PtrSerializingCtx serializingContext)
|
||||
{
|
||||
using Attributes = AudioProfileTraits::Attributes;
|
||||
+ 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, mChannelMasksSeparator.c_str());
|
||||
+
|
||||
+ //Some Foxconn devices have wrong earpiece channel mask, leading to no channel mask
|
||||
+ if(channelsMask.size() == 1 && *channelsMask.begin() == AUDIO_CHANNEL_IN_MONO && isOutput) {
|
||||
+ fixedEarpieceChannels = true;
|
||||
+ channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ",");
|
||||
+ }
|
||||
|
||||
if (mIgnoreVendorExtensions && maybeVendorExtension(format)) {
|
||||
ALOGI("%s: vendor extension format \"%s\" skipped", __func__, format.c_str());
|
||||
return NO_INIT;
|
||||
}
|
||||
AudioProfileTraits::Element profile = new AudioProfile(formatFromString(format, gDynamicFormat),
|
||||
- channelMasksFromString(channels, mChannelMasksSeparator.c_str()),
|
||||
+ channelsMask,
|
||||
samplingRatesFromString(samplingRates, mSamplingRatesSeparator.c_str()));
|
||||
|
||||
profile->setDynamicFormat(profile->getFormat() == gDynamicFormat);
|
||||
@@ -571,7 +580,11 @@ std::variant<status_t, DevicePortTraits::Element> PolicySerializer::deserialize<
|
||||
new DeviceDescriptor(type, name, address, encodedFormats);
|
||||
|
||||
AudioProfileTraits::Collection profiles;
|
||||
- status_t status = deserializeCollection<AudioProfileTraits>(cur, &profiles, NULL);
|
||||
+ status_t status;
|
||||
+ if(audio_is_output_devices(type))
|
||||
+ status = deserializeCollection<AudioProfileTraits>(cur, &profiles, (AudioProfileTraits::PtrSerializingCtx)1);
|
||||
+ else
|
||||
+ status = deserializeCollection<AudioProfileTraits>(cur, &profiles, NULL);
|
||||
if (status != NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
@@ -882,6 +895,14 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if(fixedEarpieceChannels) {
|
||||
+ sp<DeviceDescriptor> device =
|
||||
+ module->getDeclaredDevices().getDeviceFromTagName("Earpiece");
|
||||
+ if(device != 0)
|
||||
+ ctx->addDevice(device);
|
||||
+ fixedEarpieceChannels = false;
|
||||
+ }
|
||||
return module;
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0066e121e5d68b9dcd5b288c1cb94ef41a8cb66c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 12 Sep 2020 12:32:50 +0200
|
||||
Subject: [PATCH 12/24] No longer make re-assigning legacy audio groups fatal.
|
||||
Mi9 declares AUDIO_STREAM_PATCH and AUDIO_STREAM_REROUTING which is defined
|
||||
by framework too
|
||||
|
||||
Change-Id: I794fe22d63a8af705be4f5f09b9879ecaab3eae5
|
||||
---
|
||||
services/audiopolicy/engine/common/src/EngineBase.cpp | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/engine/common/src/EngineBase.cpp b/services/audiopolicy/engine/common/src/EngineBase.cpp
|
||||
index 218aff80e6..c7ea035191 100644
|
||||
--- a/services/audiopolicy/engine/common/src/EngineBase.cpp
|
||||
+++ b/services/audiopolicy/engine/common/src/EngineBase.cpp
|
||||
@@ -245,9 +245,9 @@ engineConfig::ParsingResult EngineBase::processParsingResult(
|
||||
}
|
||||
if (group.stream != AUDIO_STREAM_DEFAULT) {
|
||||
// A legacy stream can be assigned once to a volume group
|
||||
- LOG_ALWAYS_FATAL_IF(checkStreamForGroups(group.stream, mVolumeGroups),
|
||||
- "stream %s already assigned to a volume group, "
|
||||
- "review the configuration", toString(group.stream).c_str());
|
||||
+ if(checkStreamForGroups(group.stream, mVolumeGroups)) {
|
||||
+ ALOGE("stream %s already assigned to a volume group, review the configuration", toString(group.stream).c_str());
|
||||
+ }
|
||||
volumeGroup->addSupportedStream(group.stream);
|
||||
}
|
||||
addSupportedAttributesToGroup(group, volumeGroup, strategy);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
From e06b7885df0180f6e270ed31e095bda0622e217e Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 21 Dec 2020 20:19:11 +0100
|
||||
Subject: [PATCH 13/24] Make camera IDs filter-out optional
|
||||
|
||||
Nowadays most people have Camera 2 apps, and would like to have all
|
||||
cameras, rather than limit which cameras are available.
|
||||
Add a property for that.
|
||||
---
|
||||
.../common/CameraProviderManager.cpp | 14 +++++++++-----
|
||||
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
index 0ec647a941..bba0fedaea 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -265,7 +265,9 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
|
||||
// API1 app doesn't handle logical and physical camera devices well. So
|
||||
// for each camera facing, only take the first id advertised by HAL in
|
||||
// all [logical, physical1, physical2, ...] id combos, and filter out the rest.
|
||||
- filterLogicalCameraIdsLocked(providerDeviceIds);
|
||||
+ if(!property_get_bool("persist.sys.phh.include_all_cameras", false)) {
|
||||
+ filterLogicalCameraIdsLocked(providerDeviceIds);
|
||||
+ }
|
||||
collectDeviceIdsLocked(providerDeviceIds, publicDeviceIds, systemDeviceIds);
|
||||
}
|
||||
auto sortFunc =
|
||||
@@ -997,10 +999,12 @@ SystemCameraKind CameraProviderManager::ProviderInfo::DeviceInfo3::getSystemCame
|
||||
|
||||
// Go through the capabilities and check if it has
|
||||
// ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA
|
||||
- for (size_t i = 0; i < entryCap.count; ++i) {
|
||||
- uint8_t capability = entryCap.data.u8[i];
|
||||
- if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA) {
|
||||
- return SystemCameraKind::SYSTEM_ONLY_CAMERA;
|
||||
+ if(!property_get_bool("persist.sys.phh.include_all_cameras", false)) {
|
||||
+ for (size_t i = 0; i < entryCap.count; ++i) {
|
||||
+ uint8_t capability = entryCap.data.u8[i];
|
||||
+ if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA) {
|
||||
+ return SystemCameraKind::SYSTEM_ONLY_CAMERA;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
return SystemCameraKind::PUBLIC;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
From 6ef49b5b9ad8c15081a18b4b7ad06112ff784993 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 13 Mar 2021 14:20:03 -0500
|
||||
Subject: [PATCH 14/24] Support Samsung R multi-cams
|
||||
|
||||
Change-Id: If46f385e8dd16185cbf37ab083e6a1242e1d1555
|
||||
---
|
||||
services/camera/libcameraservice/Android.bp | 1 +
|
||||
.../libcameraservice/common/hidl/HidlProviderInfo.cpp | 8 +++++++-
|
||||
2 files changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
|
||||
index 25fd8451a9..3136bbd30f 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -176,6 +176,7 @@ cc_library_shared {
|
||||
"android.hardware.camera.device@3.7",
|
||||
"android.hardware.camera.device-V2-ndk",
|
||||
"vendor.samsung.hardware.camera.provider@3.0",
|
||||
+ "vendor.samsung.hardware.camera.provider@4.0",
|
||||
"media_permission-aidl-cpp",
|
||||
],
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
index d498ecbee5..587d3eeda7 100644
|
||||
--- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
+++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <android/hardware/camera/device/3.7/ICameraDevice.h>
|
||||
#include <vendor/samsung/hardware/camera/provider/3.0/ISehCameraProvider.h>
|
||||
+#include <vendor/samsung/hardware/camera/provider/4.0/ISehCameraProvider.h>
|
||||
|
||||
namespace {
|
||||
const bool kEnableLazyHal(property_get_bool("ro.camera.enableLazyHal", false));
|
||||
@@ -173,7 +174,9 @@ status_t HidlProviderInfo::initializeHidlProvider(
|
||||
}
|
||||
|
||||
auto samsungCast = vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider::castFrom(interface);
|
||||
+ auto samsung40Cast = vendor::samsung::hardware::camera::provider::V4_0::ISehCameraProvider::castFrom(interface);
|
||||
auto samsungProvider = samsungCast.isOk() ? static_cast<sp<vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider>>(samsungCast) : nullptr;
|
||||
+ auto samsung40Provider = samsung40Cast.isOk() ? static_cast<sp<vendor::samsung::hardware::camera::provider::V4_0::ISehCameraProvider>>(samsung40Cast) : nullptr;
|
||||
|
||||
hardware::Return<bool> linked = interface->linkToDeath(this, /*cookie*/ mId);
|
||||
if (!linked.isOk()) {
|
||||
@@ -211,6 +214,7 @@ status_t HidlProviderInfo::initializeHidlProvider(
|
||||
status = idStatus;
|
||||
if (status == Status::OK) {
|
||||
for (auto& name : cameraDeviceNames) {
|
||||
+ ALOGE("Listing camera ID %s", name.c_str());
|
||||
uint16_t major, minor;
|
||||
std::string type, id;
|
||||
status_t res = parseDeviceName(name, &major, &minor, &type, &id);
|
||||
@@ -224,7 +228,9 @@ status_t HidlProviderInfo::initializeHidlProvider(
|
||||
}
|
||||
} };
|
||||
hardware::Return<void> ret;
|
||||
- if(samsungProvider != nullptr && property_get_bool("persist.sys.phh.samsung.camera_ids", false))
|
||||
+ if(samsung40Provider != nullptr && property_get_bool("persist.sys.phh.samsung.camera_ids", false))
|
||||
+ ret = samsung40Provider->sehGetCameraIdList(cb);
|
||||
+ else if(samsungProvider != nullptr && property_get_bool("persist.sys.phh.samsung.camera_ids", false))
|
||||
ret = samsungProvider->sehGetCameraIdList(cb);
|
||||
else
|
||||
ret = interface->getCameraIdList(cb);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 82c8c088952068c4d157839aac4011e943e0aa6a Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 23 Mar 2021 00:16:42 +0100
|
||||
Subject: [PATCH 15/24] Don't crash on unknown audio devices
|
||||
|
||||
Change-Id: I2df8d88f742da6a84aa8888cdf19de25444de919
|
||||
---
|
||||
.../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 83eafc2f79..91fc5f57da 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -867,7 +867,7 @@ std::variant<status_t, ModuleTraits::Element> PolicySerializer::deserialize<Modu
|
||||
sp<DeviceDescriptor> device = module->getDeclaredDevices().
|
||||
getDeviceFromTagName(std::string(reinterpret_cast<const char*>(
|
||||
attachedDevice.get())));
|
||||
- if (device == nullptr && mIgnoreVendorExtensions) {
|
||||
+ if (device == nullptr) {
|
||||
ALOGW("Skipped attached device \"%s\" because it likely uses a vendor"
|
||||
"extension type",
|
||||
reinterpret_cast<const char*>(attachedDevice.get()));
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 127db05e06dd0963bc883c86ffd44425a3011900 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 28 Mar 2021 18:54:47 +0200
|
||||
Subject: [PATCH 16/24] Not all sources in a route are valid. Dont ignore the
|
||||
whole route because of one broken source
|
||||
|
||||
Change-Id: If8a51740e71bef3a4738262ad7b43a337b0ec36d
|
||||
---
|
||||
.../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 91fc5f57da..d2fcc13b00 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -667,7 +667,7 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
|
||||
if (source == NULL) {
|
||||
source = ctx->findPortByTagName(trim(devTag));
|
||||
}
|
||||
- if (source == NULL && !mIgnoreVendorExtensions) {
|
||||
+ if (source == NULL && false) {
|
||||
ALOGE("%s: no source found with name=%s", __func__, devTag);
|
||||
return BAD_VALUE;
|
||||
} else if (source == NULL) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 5126e56dfe7f129e73991697008b826e5e55fe24 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 28 Mar 2021 14:48:49 +0200
|
||||
Subject: [PATCH 17/24] Use a fake volume policy when none has been found
|
||||
|
||||
This is useful, because on Samsung devices, the "real"
|
||||
(=non-gsi-cheating) audio policy doesn't have any volume policy.
|
||||
|
||||
This requires actually adding the fake audio policy xml file (done in
|
||||
device/phh/treble)
|
||||
|
||||
Change-Id: I461a3f22893ab2b1d96d67f22397369b2cae41e5
|
||||
---
|
||||
services/audiopolicy/engine/config/src/EngineConfig.cpp | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/audiopolicy/engine/config/src/EngineConfig.cpp b/services/audiopolicy/engine/config/src/EngineConfig.cpp
|
||||
index ca78ce7213..59211577c4 100644
|
||||
--- a/services/audiopolicy/engine/config/src/EngineConfig.cpp
|
||||
+++ b/services/audiopolicy/engine/config/src/EngineConfig.cpp
|
||||
@@ -800,7 +800,12 @@ android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGr
|
||||
android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups) {
|
||||
if (std::string audioPolicyXmlConfigFile = audio_get_audio_policy_config_file();
|
||||
!audioPolicyXmlConfigFile.empty()) {
|
||||
- return parseLegacyVolumeFile(audioPolicyXmlConfigFile.c_str(), volumeGroups);
|
||||
+ int ret = parseLegacyVolumeFile(audioPolicyXmlConfigFile.c_str(), volumeGroups);
|
||||
+ if (ret == NO_ERROR && volumeGroups.size() == 0) {
|
||||
+ ret = parseLegacyVolumeFile("/system/etc/fake_audio_policy_volume.xml", volumeGroups);
|
||||
+ ALOGE("Parsing volume for /system/etc/fake_audio_policy_volume.xml gave %zu", volumeGroups.size());
|
||||
+ }
|
||||
+ return ret;
|
||||
} else {
|
||||
ALOGE("No readable audio policy config file found");
|
||||
return BAD_VALUE;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
From a0f9fc2e8b386ee9e3c1064bfb076306e901f187 Mon Sep 17 00:00:00 2001
|
||||
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
||||
Date: Mon, 11 Oct 2021 16:10:42 -0400
|
||||
Subject: [PATCH 18/24] Revert "Remove support for audio HAL V2 from the
|
||||
framework"
|
||||
|
||||
This reverts commit cbf517f837f7bf8a59f3ff8aa1e0e3e19612e251.
|
||||
|
||||
Also enable new extensions required to actually build
|
||||
|
||||
Change-Id: Icfd638a91b22ffa6d2cd6d19a624e699a85a850a
|
||||
---
|
||||
media/libaudiohal/Android.bp | 1 +
|
||||
media/libaudiohal/FactoryHal.cpp | 3 ++-
|
||||
media/libaudiohal/impl/Android.bp | 26 +++++++++++++++++++
|
||||
media/libaudiohal/impl/DeviceHalHidl.cpp | 10 +++++++
|
||||
.../impl/DevicesFactoryHalHidl.cpp | 4 +++
|
||||
5 files changed, 43 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/media/libaudiohal/Android.bp b/media/libaudiohal/Android.bp
|
||||
index 3c05b0b472..1426930603 100644
|
||||
--- a/media/libaudiohal/Android.bp
|
||||
+++ b/media/libaudiohal/Android.bp
|
||||
@@ -23,6 +23,7 @@ cc_library_shared {
|
||||
],
|
||||
|
||||
required: [
|
||||
+ "libaudiohal@2.0",
|
||||
"libaudiohal@4.0",
|
||||
"libaudiohal@5.0",
|
||||
"libaudiohal@6.0",
|
||||
diff --git a/media/libaudiohal/FactoryHal.cpp b/media/libaudiohal/FactoryHal.cpp
|
||||
index f88915d7f4..24e5adbae3 100644
|
||||
--- a/media/libaudiohal/FactoryHal.cpp
|
||||
+++ b/media/libaudiohal/FactoryHal.cpp
|
||||
@@ -50,7 +50,7 @@ using InterfaceName = std::pair<std::string, std::string>;
|
||||
* This list need to keep sync with AudioHalVersionInfo.VERSIONS in
|
||||
* media/java/android/media/AudioHalVersionInfo.java.
|
||||
*/
|
||||
-static const std::array<AudioHalVersionInfo, 5> sAudioHALVersions = {
|
||||
+static const std::array<AudioHalVersionInfo, 6> sAudioHALVersions = {
|
||||
// TODO: remove this comment to get AIDL
|
||||
// AudioHalVersionInfo(AudioHalVersionInfo::Type::AIDL, 1, 0),
|
||||
AudioHalVersionInfo(AudioHalVersionInfo::Type::HIDL, 7, 1),
|
||||
@@ -58,6 +58,7 @@ static const std::array<AudioHalVersionInfo, 5> sAudioHALVersions = {
|
||||
AudioHalVersionInfo(AudioHalVersionInfo::Type::HIDL, 6, 0),
|
||||
AudioHalVersionInfo(AudioHalVersionInfo::Type::HIDL, 5, 0),
|
||||
AudioHalVersionInfo(AudioHalVersionInfo::Type::HIDL, 4, 0),
|
||||
+ AudioHalVersionInfo(AudioHalVersionInfo::Type::HIDL, 2, 0),
|
||||
};
|
||||
|
||||
static const std::map<AudioHalVersionInfo::Type, InterfaceName> sDevicesHALInterfaces = {
|
||||
diff --git a/media/libaudiohal/impl/Android.bp b/media/libaudiohal/impl/Android.bp
|
||||
index 16893655f0..1271756bd1 100644
|
||||
--- a/media/libaudiohal/impl/Android.bp
|
||||
+++ b/media/libaudiohal/impl/Android.bp
|
||||
@@ -82,6 +82,32 @@ cc_defaults {
|
||||
],
|
||||
}
|
||||
|
||||
+cc_library_shared {
|
||||
+ name: "libaudiohal@2.0",
|
||||
+ defaults: [
|
||||
+ "libaudiohal_default",
|
||||
+ "libaudiohal_hidl_default"
|
||||
+ ],
|
||||
+ srcs: [
|
||||
+ ":audio_core_hal_client_sources",
|
||||
+ ":audio_effect_hidl_hal_client_sources",
|
||||
+ "EffectsFactoryHalEntry.cpp",
|
||||
+ ],
|
||||
+ shared_libs: [
|
||||
+ "android.hardware.audio.common@2.0",
|
||||
+ "android.hardware.audio.common@2.0-util",
|
||||
+ "android.hardware.audio.effect@2.0",
|
||||
+ "android.hardware.audio.effect@2.0-util",
|
||||
+ "android.hardware.audio@2.0",
|
||||
+ "android.hardware.audio@2.0-util",
|
||||
+ ],
|
||||
+ cflags: [
|
||||
+ "-DMAJOR_VERSION=2",
|
||||
+ "-DMINOR_VERSION=0",
|
||||
+ "-include common/all-versions/VersionMacro.h",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
cc_library_shared {
|
||||
name: "libaudiohal@4.0",
|
||||
defaults: [
|
||||
diff --git a/media/libaudiohal/impl/DeviceHalHidl.cpp b/media/libaudiohal/impl/DeviceHalHidl.cpp
|
||||
index 0d71fd338c..c228bf7a6f 100644
|
||||
--- a/media/libaudiohal/impl/DeviceHalHidl.cpp
|
||||
+++ b/media/libaudiohal/impl/DeviceHalHidl.cpp
|
||||
@@ -577,6 +577,7 @@ status_t DeviceHalHidl::setConnectedState(const struct audio_port_v7 *port, bool
|
||||
// call is successful. Also remove the cache here to avoid a large cache after a long run.
|
||||
return NO_ERROR;
|
||||
}
|
||||
+#if MAJOR_VERSION > 2
|
||||
#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
|
||||
if (supportsSetConnectedState7_1) {
|
||||
AudioPort hidlPort;
|
||||
@@ -599,11 +600,17 @@ status_t DeviceHalHidl::setConnectedState(const struct audio_port_v7 *port, bool
|
||||
return result;
|
||||
}
|
||||
return processReturn("setConnectedState", mDevice->setConnectedState(hidlAddress, connected));
|
||||
+#else
|
||||
+ (void) port;
|
||||
+ (void) connected;
|
||||
+ return NO_ERROR;
|
||||
+#endif
|
||||
}
|
||||
|
||||
error::Result<audio_hw_sync_t> DeviceHalHidl::getHwAvSync() {
|
||||
TIME_CHECK();
|
||||
if (mDevice == 0) return NO_INIT;
|
||||
+#if MAJOR_VERSION > 2
|
||||
audio_hw_sync_t value;
|
||||
Result result;
|
||||
Return<void> ret = mDevice->getHwAvSync([&value, &result](Result r, audio_hw_sync_t v) {
|
||||
@@ -612,6 +619,9 @@ error::Result<audio_hw_sync_t> DeviceHalHidl::getHwAvSync() {
|
||||
});
|
||||
RETURN_IF_ERROR(processReturn("getHwAvSync", ret, result));
|
||||
return value;
|
||||
+#else
|
||||
+ return 0xdeadbeef;
|
||||
+#endif
|
||||
}
|
||||
|
||||
status_t DeviceHalHidl::dump(int fd, const Vector<String16>& args) {
|
||||
diff --git a/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp b/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
|
||||
index eef60b506c..e303e54b41 100644
|
||||
--- a/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
|
||||
+++ b/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
|
||||
@@ -119,6 +119,7 @@ status_t DevicesFactoryHalHidl::openDevice(const char *name, sp<DeviceHalInterfa
|
||||
Result retval = Result::NOT_INITIALIZED;
|
||||
for (const auto& factory : factories) {
|
||||
Return<void> ret;
|
||||
+#if MAJOR_VERSION > 2
|
||||
if (strcmp(name, AUDIO_HARDWARE_MODULE_ID_PRIMARY) == 0) {
|
||||
// In V7.1 it's not possible to cast IDevice back to IPrimaryDevice,
|
||||
// thus openPrimaryDevice must be used.
|
||||
@@ -135,6 +136,9 @@ status_t DevicesFactoryHalHidl::openDevice(const char *name, sp<DeviceHalInterfa
|
||||
}
|
||||
});
|
||||
} else {
|
||||
+#else
|
||||
+ if (true) {
|
||||
+#endif
|
||||
#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
|
||||
ret = factory->openDevice_7_1(
|
||||
#else
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From 217bd49b1255e5a98e3c9dc0db3f0be15e395b8c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 16 Apr 2022 14:30:14 -0400
|
||||
Subject: [PATCH 19/24] Add a prop to change Samsung flash strength
|
||||
|
||||
---
|
||||
services/camera/libcameraservice/Android.bp | 2 ++
|
||||
.../common/hidl/HidlProviderInfo.cpp | 20 ++++++++++++++++++-
|
||||
2 files changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
|
||||
index 3136bbd30f..7ef870c1eb 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -177,6 +177,8 @@ cc_library_shared {
|
||||
"android.hardware.camera.device-V2-ndk",
|
||||
"vendor.samsung.hardware.camera.provider@3.0",
|
||||
"vendor.samsung.hardware.camera.provider@4.0",
|
||||
+ "vendor.samsung.hardware.camera.device@5.0",
|
||||
+ "vendor.samsung.hardware.camera.device@4.0",
|
||||
"media_permission-aidl-cpp",
|
||||
],
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
index 587d3eeda7..a345d6a2bf 100644
|
||||
--- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
+++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <android/hardware/camera/device/3.7/ICameraDevice.h>
|
||||
#include <vendor/samsung/hardware/camera/provider/3.0/ISehCameraProvider.h>
|
||||
#include <vendor/samsung/hardware/camera/provider/4.0/ISehCameraProvider.h>
|
||||
+#include <vendor/samsung/hardware/camera/device/5.0/ISehCameraDevice.h>
|
||||
+#include <vendor/samsung/hardware/camera/device/4.0/ISehCameraDevice.h>
|
||||
|
||||
namespace {
|
||||
const bool kEnableLazyHal(property_get_bool("ro.camera.enableLazyHal", false));
|
||||
@@ -783,7 +785,23 @@ HidlProviderInfo::HidlDeviceInfo3::HidlDeviceInfo3(
|
||||
status_t HidlProviderInfo::HidlDeviceInfo3::setTorchMode(bool enabled) {
|
||||
using hardware::camera::common::V1_0::TorchMode;
|
||||
const sp<hardware::camera::device::V3_2::ICameraDevice> interface = startDeviceInterface();
|
||||
- Status s = interface->setTorchMode(enabled ? TorchMode::ON : TorchMode::OFF);
|
||||
+ int32_t flashStrength = property_get_int32("persist.sys.phh.flash_strength", 1);
|
||||
+
|
||||
+ auto sehCast = vendor::samsung::hardware::camera::device::V5_0::ISehCameraDevice::castFrom(interface);
|
||||
+ android::sp<vendor::samsung::hardware::camera::device::V5_0::ISehCameraDevice> seh = sehCast;
|
||||
+
|
||||
+ auto sehCast2 = vendor::samsung::hardware::camera::device::V4_0::ISehCameraDevice::castFrom(interface);
|
||||
+ android::sp<vendor::samsung::hardware::camera::device::V4_0::ISehCameraDevice> seh2 = sehCast2;
|
||||
+
|
||||
+ Status s;
|
||||
+ if(seh != nullptr) {
|
||||
+ s = seh->sehSetTorchModeStrength(enabled ? TorchMode::ON : TorchMode::OFF, flashStrength);
|
||||
+ } else if(seh2 != nullptr) {
|
||||
+ s = seh2->sehSetTorchModeStrength(enabled ? TorchMode::ON : TorchMode::OFF, flashStrength);
|
||||
+ } else {
|
||||
+ s = interface->setTorchMode(enabled ? TorchMode::ON : TorchMode::OFF);
|
||||
+ }
|
||||
+
|
||||
return mapToStatusT(s);
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 35e06c722ccee32176fe646dd8e59940df9a83ba Mon Sep 17 00:00:00 2001
|
||||
From: ponces <ponces26@gmail.com>
|
||||
Date: Mon, 24 Oct 2022 09:38:34 +0100
|
||||
Subject: [PATCH 20/24] voip: Fix high pitched voice on Qualcomm devices
|
||||
|
||||
---
|
||||
.../common/managerdefinitions/src/Serializer.cpp | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index d2fcc13b00..fc6cc72c1c 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -252,6 +252,7 @@ private:
|
||||
std::string mChannelMasksSeparator = ",";
|
||||
std::string mSamplingRatesSeparator = ",";
|
||||
std::string mFlagsSeparator = "|";
|
||||
+ std::string mMixPortName = "";
|
||||
|
||||
// Children: ModulesTraits, VolumeTraits, SurroundSoundTraits (optional)
|
||||
};
|
||||
@@ -436,6 +437,13 @@ PolicySerializer::deserialize<AudioProfileTraits>(
|
||||
channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ",");
|
||||
}
|
||||
|
||||
+ // This breaks in-game voice chat and audio in some messaging apps causing it to play with a higher pitch and speed
|
||||
+ bool disableStereoVoip = property_get_bool("persist.sys.phh.disable_stereo_voip", false);
|
||||
+ if (disableStereoVoip && mMixPortName == "voip_rx") {
|
||||
+ ALOGI("%s: disabling stereo support on voip_rx", __func__);
|
||||
+ channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ",");
|
||||
+ }
|
||||
+
|
||||
if (mIgnoreVendorExtensions && maybeVendorExtension(format)) {
|
||||
ALOGI("%s: vendor extension format \"%s\" skipped", __func__, format.c_str());
|
||||
return NO_INIT;
|
||||
@@ -458,6 +466,7 @@ std::variant<status_t, MixPortTraits::Element> PolicySerializer::deserialize<Mix
|
||||
using Attributes = MixPortTraits::Attributes;
|
||||
|
||||
std::string name = getXmlAttribute(child, Attributes::name);
|
||||
+ mMixPortName = name;
|
||||
if (name.empty()) {
|
||||
ALOGE("%s: No %s found", __func__, Attributes::name);
|
||||
return BAD_VALUE;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From 151098b94d9a2b3d0ae30f825a52d479172bbde1 Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Ponces <ponces26@gmail.com>
|
||||
Date: Sun, 30 Apr 2023 23:29:04 +0100
|
||||
Subject: [PATCH 21/24] audiopolicy: Fix broken mic while video recording on
|
||||
some Exynos devices This should fix
|
||||
https://github.com/phhusson/treble_experimentations/issues/2021 and
|
||||
https://github.com/phhusson/treble_experimentations/issues/2384. Credits to
|
||||
@haridhayal11.
|
||||
|
||||
---
|
||||
.../managerdefinitions/src/Serializer.cpp | 29 ++++++++++++-------
|
||||
1 file changed, 18 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index fc6cc72c1c..8b3a1f0e4f 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -660,6 +660,9 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
|
||||
}
|
||||
route->setSink(sink);
|
||||
|
||||
+ // This fixes broken mic while video record on some Exynos devices
|
||||
+ bool disableBackMic = property_get_bool("persist.sys.phh.disable_back_mic", false);
|
||||
+
|
||||
std::string sourcesAttr = getXmlAttribute(cur, Attributes::sources);
|
||||
if (sourcesAttr.empty()) {
|
||||
ALOGE("%s: No %s found", __func__, Attributes::sources);
|
||||
@@ -672,18 +675,22 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
|
||||
char *devTag = strtok(sourcesLiteral.get(), ",");
|
||||
while (devTag != NULL) {
|
||||
if (strlen(devTag) != 0) {
|
||||
- sp<PolicyAudioPort> source = ctx->findPortByTagName(devTag);
|
||||
- if (source == NULL) {
|
||||
- source = ctx->findPortByTagName(trim(devTag));
|
||||
- }
|
||||
- if (source == NULL && false) {
|
||||
- ALOGE("%s: no source found with name=%s", __func__, devTag);
|
||||
- return BAD_VALUE;
|
||||
- } else if (source == NULL) {
|
||||
- ALOGW("Skipping route source \"%s\" as it likely has vendor extension type",
|
||||
- devTag);
|
||||
+ if (disableBackMic && strcmp(devTag, "Built-In Back Mic") == 0) {
|
||||
+ ALOGW("Skipping route source \"%s\" as it breaks video recording mic", devTag);
|
||||
} else {
|
||||
- sources.add(source);
|
||||
+ sp<PolicyAudioPort> source = ctx->findPortByTagName(devTag);
|
||||
+ if (source == NULL) {
|
||||
+ source = ctx->findPortByTagName(trim(devTag));
|
||||
+ }
|
||||
+ if (source == NULL && false) {
|
||||
+ ALOGE("%s: no source found with name=%s", __func__, devTag);
|
||||
+ return BAD_VALUE;
|
||||
+ } else if (source == NULL) {
|
||||
+ ALOGW("Skipping route source \"%s\" as it likely has vendor extension type",
|
||||
+ devTag);
|
||||
+ } else {
|
||||
+ sources.add(source);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
devTag = strtok(NULL, ",");
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 7e954a9afe0ab43a7f3b2eb0ad9b58b338e5e0ce Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 30 Oct 2023 10:30:58 -0400
|
||||
Subject: [PATCH 22/24] Add a prop to disable AUDIO_OUTPUT_FLAG_FAST from audio
|
||||
policies, when CPU can't really handle that kind of load
|
||||
|
||||
---
|
||||
.../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 8b3a1f0e4f..913cbc0e90 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -504,6 +504,10 @@ std::variant<status_t, MixPortTraits::Element> PolicySerializer::deserialize<Mix
|
||||
// use DEEP_BUFFER+FAST flag combo to indicate the spatializer output profile
|
||||
uint32_t intFlags =
|
||||
OutputFlagConverter::maskFromString(flags, mFlagsSeparator.c_str());
|
||||
+ bool ignore_fast = property_get_bool("persist.sys.phh.disable_fast_audio", false);
|
||||
+ if (ignore_fast)
|
||||
+ intFlags &= ~AUDIO_OUTPUT_FLAG_FAST;
|
||||
+
|
||||
if (intFlags == (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) {
|
||||
intFlags = AUDIO_OUTPUT_FLAG_SPATIALIZER;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From e19f041d8f670730392fa3c8d792133687216057 Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Ponces <ponces26@gmail.com>
|
||||
Date: Sun, 5 Nov 2023 15:18:03 +0000
|
||||
Subject: [PATCH 23/24] Add a prop to fix echo on incoming or outgoing calls
|
||||
|
||||
May even fix audio calls altogether.
|
||||
|
||||
Change-Id: I3a05608ad7b3f0876160d5f6a12b7c529b8f0961
|
||||
---
|
||||
.../common/managerdefinitions/src/Serializer.cpp | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 913cbc0e90..6bf5d14c3c 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -667,6 +667,9 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
|
||||
// This fixes broken mic while video record on some Exynos devices
|
||||
bool disableBackMic = property_get_bool("persist.sys.phh.disable_back_mic", false);
|
||||
|
||||
+ // This may fix echo or non-working audio on calls
|
||||
+ bool disableVoiceCallIn = property_get_bool("persist.sys.phh.disable_voice_call_in", false);
|
||||
+
|
||||
std::string sourcesAttr = getXmlAttribute(cur, Attributes::sources);
|
||||
if (sourcesAttr.empty()) {
|
||||
ALOGE("%s: No %s found", __func__, Attributes::sources);
|
||||
@@ -681,6 +684,9 @@ std::variant<status_t, RouteTraits::Element> PolicySerializer::deserialize<Route
|
||||
if (strlen(devTag) != 0) {
|
||||
if (disableBackMic && strcmp(devTag, "Built-In Back Mic") == 0) {
|
||||
ALOGW("Skipping route source \"%s\" as it breaks video recording mic", devTag);
|
||||
+ } else if (disableVoiceCallIn && strcmp(devTag, "Voice Call In") == 0 &&
|
||||
+ (sinkAttr == "voice tx" || sinkAttr == "voice_tx")) {
|
||||
+ ALOGW("Skipping route source \"%s\" as it breaks audio on calls", devTag);
|
||||
} else {
|
||||
sp<PolicyAudioPort> source = ctx->findPortByTagName(devTag);
|
||||
if (source == NULL) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From d780d481954070610f88fa7aa35ed1581374ea98 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 7 Feb 2024 05:06:32 -0500
|
||||
Subject: [PATCH 24/24] Include Samsung AIDL camera ids
|
||||
|
||||
---
|
||||
services/camera/libcameraservice/Android.bp | 1 +
|
||||
.../common/aidl/AidlProviderInfo.cpp | 21 +++++++++++++++++++
|
||||
2 files changed, 22 insertions(+)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
|
||||
index 7ef870c1eb..43a1ebd8ee 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -179,6 +179,7 @@ cc_library_shared {
|
||||
"vendor.samsung.hardware.camera.provider@4.0",
|
||||
"vendor.samsung.hardware.camera.device@5.0",
|
||||
"vendor.samsung.hardware.camera.device@4.0",
|
||||
+ "vendor.samsung.hardware.camera.provider-V1-ndk",
|
||||
"media_permission-aidl-cpp",
|
||||
],
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp b/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
|
||||
index b18cbd41a4..9ea1bee67d 100644
|
||||
--- a/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
|
||||
+++ b/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <utils/SessionConfigurationUtils.h>
|
||||
#include <utils/Trace.h>
|
||||
|
||||
+#include <aidl/vendor/samsung/hardware/camera/provider/ISehCameraProvider.h>
|
||||
+
|
||||
namespace {
|
||||
const bool kEnableLazyHal(property_get_bool("ro.camera.enableLazyHal", false));
|
||||
} // anonymous namespace
|
||||
@@ -155,6 +157,25 @@ status_t AidlProviderInfo::initializeAidlProvider(
|
||||
return mapToStatusT(status);
|
||||
}
|
||||
|
||||
+ if(true) {
|
||||
+ AIBinder *ext;
|
||||
+ auto spaibinder = interface->asBinder();
|
||||
+
|
||||
+ status_t ret = AIBinder_getExtension(spaibinder.get(), &ext);
|
||||
+ ALOGE("Grabbing CameraProvider extension got %d", ret);
|
||||
+ if (ret == android::OK) {
|
||||
+ using aidl::vendor::samsung::hardware::camera::provider::ISehCameraProvider;
|
||||
+ std::shared_ptr<ISehCameraProvider> provider = ISehCameraProvider::fromBinder(ndk::SpAIBinder(ext));
|
||||
+ ALOGE("Trying to get ISehCameraProvider...");
|
||||
+ if (provider != nullptr) {
|
||||
+ ALOGE("Got it!");
|
||||
+ if(property_get_bool("persist.sys.phh.samsung.camera_ids", false)) {
|
||||
+ provider->getCameraIdListAll(&retDevices);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
for (auto& name : retDevices) {
|
||||
uint16_t major, minor;
|
||||
std::string type, id;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 16bd746b4407edc79b799a89cb16850b89c90b6b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 5 Oct 2021 17:59:16 -0400
|
||||
Subject: [PATCH 01/50] Fallback to stupid autobrightness if brightness values
|
||||
are broken
|
||||
|
||||
This is needed because of:
|
||||
`ava.lang.IllegalArgumentException: The control points must all have strictly increasing X values.`
|
||||
on some Samsung devices
|
||||
|
||||
Change-Id: Ieb679b34239013a5e31b34cb010b12febd9ef6d9
|
||||
---
|
||||
.../com/android/server/display/DisplayDeviceConfig.java | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
index 2464eb0141b8..b0ebab8e4002 100644
|
||||
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
@@ -777,9 +777,14 @@ public class DisplayDeviceConfig {
|
||||
* @return A configuration instance.
|
||||
*/
|
||||
public static DisplayDeviceConfig create(Context context, boolean useConfigXml) {
|
||||
- final DisplayDeviceConfig config;
|
||||
+ DisplayDeviceConfig config;
|
||||
if (useConfigXml) {
|
||||
- config = getConfigFromGlobalXml(context);
|
||||
+ try {
|
||||
+ config = getConfigFromGlobalXml(context);
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.e("PHH", "Failed parsing automatic brightness values, fallbacking", e);
|
||||
+ config = getConfigFromPmValues(context);
|
||||
+ }
|
||||
} else {
|
||||
config = getConfigFromPmValues(context);
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From e63c11343cbaf133b302ce98b44ebea59e5a0217 Mon Sep 17 00:00:00 2001
|
||||
From: Raphael Mounier <mounierr07@gmail.com>
|
||||
Date: Sat, 6 Aug 2022 18:08:36 +0200
|
||||
Subject: [PATCH 02/50] Fix env empty string - ANDROID_STORAGE
|
||||
|
||||
Huawei hi6250 define in init.hi6250.rc ANDROID_STORAGE to "", so check empty string and replace with default path. Apply change for all env directory
|
||||
---
|
||||
core/java/android/os/Environment.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java
|
||||
index 536ef31f334a..bebab95189d7 100644
|
||||
--- a/core/java/android/os/Environment.java
|
||||
+++ b/core/java/android/os/Environment.java
|
||||
@@ -1523,7 +1523,7 @@ public class Environment {
|
||||
|
||||
static File getDirectory(String variableName, String defaultPath) {
|
||||
String path = System.getenv(variableName);
|
||||
- return path == null ? new File(defaultPath) : new File(path);
|
||||
+ return ((path == null || path.isEmpty()) ? new File(defaultPath) : new File(path));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From bb3c0d66940957431ea2337577806f91a721bb4b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 28 Nov 2017 18:28:04 +0100
|
||||
Subject: [PATCH 03/50] 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 f114ad86f028..05f1f0fc61a5 100644
|
||||
--- a/services/core/java/com/android/server/StorageManagerService.java
|
||||
+++ b/services/core/java/com/android/server/StorageManagerService.java
|
||||
@@ -1533,7 +1533,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_FOR_WRITE;
|
||||
} else if (vol.disk.isSd()) {
|
||||
vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE_FOR_WRITE;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From f41d2389d0d471ff04ab555d6858e20c0e9bd717 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Thu, 17 May 2018 20:28:35 +0200
|
||||
Subject: [PATCH 04/50] Don't crash if there is IR HAL is not declared
|
||||
|
||||
Change-Id: I3afded27441bbee8244d5fda544b3e6d1238dc1b
|
||||
---
|
||||
.../core/java/com/android/server/ConsumerIrService.java | 8 --------
|
||||
.../core/jni/com_android_server_ConsumerIrService.cpp | 2 +-
|
||||
2 files changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/ConsumerIrService.java b/services/core/java/com/android/server/ConsumerIrService.java
|
||||
index ee6d808aa549..be8e2bb95ece 100644
|
||||
--- a/services/core/java/com/android/server/ConsumerIrService.java
|
||||
+++ b/services/core/java/com/android/server/ConsumerIrService.java
|
||||
@@ -53,14 +53,6 @@ public class ConsumerIrService extends IConsumerIrService.Stub {
|
||||
mWakeLock.setReferenceCounted(true);
|
||||
|
||||
mHasNativeHal = getHalService();
|
||||
-
|
||||
- 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 63daa3503bd5..d068ec06fc14 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<IConsumerIr> mHal;
|
||||
|
||||
static jboolean getHidlHalService(JNIEnv * /* env */, jobject /* obj */) {
|
||||
// TODO(b/31632518)
|
||||
- mHal = IConsumerIr::getService();
|
||||
+ mHal = IConsumerIr::tryGetService();
|
||||
return mHal != nullptr;
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 7d505ba36fb5f011383b2dfcae1cab3b00091b13 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 1 Jun 2022 16:56:20 -0400
|
||||
Subject: [PATCH 05/50] Implement a persistent property to override the default
|
||||
primary camera (0)
|
||||
|
||||
Change-Id: I49b45d00bf71d7932591b3516d49a680e1b6568b
|
||||
---
|
||||
core/java/android/hardware/Camera.java | 5 +++++
|
||||
core/java/android/hardware/camera2/CameraManager.java | 9 +++++++++
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
|
||||
index 388b31041f86..da4bc798cee3 100644
|
||||
--- a/core/java/android/hardware/Camera.java
|
||||
+++ b/core/java/android/hardware/Camera.java
|
||||
@@ -455,6 +455,11 @@ public class Camera {
|
||||
* @see #open(int)
|
||||
*/
|
||||
public static Camera open() {
|
||||
+ int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1);
|
||||
+ if (altPrimaryCamera > 0) {
|
||||
+ return new Camera(altPrimaryCamera);
|
||||
+ }
|
||||
+
|
||||
int numberOfCameras = getNumberOfCameras();
|
||||
CameraInfo cameraInfo = new CameraInfo();
|
||||
for (int i = 0; i < numberOfCameras; i++) {
|
||||
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
|
||||
index 69660d9344c9..d8841489e051 100644
|
||||
--- a/core/java/android/hardware/camera2/CameraManager.java
|
||||
+++ b/core/java/android/hardware/camera2/CameraManager.java
|
||||
@@ -2081,6 +2081,15 @@ public final class CameraManager {
|
||||
}
|
||||
}});
|
||||
|
||||
+ // HAXX: Allow overriding default primary camera (assumed to be camera 0) via property
|
||||
+ // Should match with libcameraservice/common/CameraProviderManager.cpp
|
||||
+ int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1);
|
||||
+ if (altPrimaryCamera > 0 && altPrimaryCamera < cameraIds.length) {
|
||||
+ String origPrimary = cameraIds[0];
|
||||
+ cameraIds[0] = cameraIds[altPrimaryCamera];
|
||||
+ cameraIds[altPrimaryCamera] = origPrimary;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
public static boolean cameraStatusesContains(CameraStatus[] cameraStatuses, String id) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From d357d016eae346a4473bfd280bda4c5fb5680b91 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 6 Aug 2018 12:49:00 +0200
|
||||
Subject: [PATCH 06/50] 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 3d46c33534af..3f29b459b7cf 100644
|
||||
--- a/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
@@ -9904,7 +9904,7 @@ public class CarrierConfigManager {
|
||||
sDefaults.putBoolean(KEY_OPERATOR_SELECTION_EXPAND_BOOL, true);
|
||||
sDefaults.putBoolean(KEY_PREFER_2G_BOOL, false);
|
||||
sDefaults.putBoolean(KEY_4G_ONLY_BOOL, false);
|
||||
- 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.34.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 2fc52f8f733f8f29bc9fa4e9b82d66812bb9f917 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Thu, 8 Nov 2018 23:04:03 +0100
|
||||
Subject: [PATCH 07/50] Re-order services so that it works even without qtaguid
|
||||
|
||||
Change-Id: I0c0f527b3ae151d45c68f7ac6c205da3f34e74df
|
||||
---
|
||||
.../android/server/net/NetworkPolicyManagerService.java | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
|
||||
index ac69a785e62d..1f550c7da82c 100644
|
||||
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
|
||||
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
|
||||
@@ -971,6 +971,10 @@ 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);
|
||||
+ mAppStandby = LocalServices.getService(AppStandbyInternal.class);
|
||||
+ mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
|
||||
+
|
||||
// Boost thread's priority during system server init
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
|
||||
if (!isBandwidthControlEnabled()) {
|
||||
@@ -978,10 +982,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
return;
|
||||
}
|
||||
|
||||
- mUsageStats = LocalServices.getService(UsageStatsManagerInternal.class);
|
||||
- mAppStandby = LocalServices.getService(AppStandbyInternal.class);
|
||||
- mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
|
||||
-
|
||||
synchronized (mUidRulesFirstLock) {
|
||||
synchronized (mNetworkPoliciesSecondLock) {
|
||||
updatePowerSaveWhitelistUL();
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 4170fb54bb1ed5755f434372c27980a475aba97a Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 24 Mar 2019 23:05:14 +0100
|
||||
Subject: [PATCH 08/50] Support samsung Pie and Q light hal
|
||||
|
||||
Change-Id: I01f94acd7d0672733e48854d80368f9ac6f861c6
|
||||
---
|
||||
services/core/jni/Android.bp | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
|
||||
index 77db96001e0c..36c13ca121e3 100644
|
||||
--- a/services/core/jni/Android.bp
|
||||
+++ b/services/core/jni/Android.bp
|
||||
@@ -202,6 +202,8 @@ cc_defaults {
|
||||
"android.system.suspend-V1-ndk",
|
||||
"server_configurable_flags",
|
||||
"service.incremental",
|
||||
+ "vendor.samsung.hardware.light@2.0",
|
||||
+ "vendor.samsung.hardware.light@3.0",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
From 743b7f87fc925d6e8710ed087e429c20c9c2f1b5 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 12 Aug 2019 23:08:26 +0200
|
||||
Subject: [PATCH 09/50] Add support for samsung touch, physical and hover
|
||||
proximity sensor as fallback to real proximity sensor
|
||||
|
||||
Change-Id: I7a0f8b4665c802140d19197d850b77b2a7ac1865
|
||||
---
|
||||
.../display/DisplayPowerController.java | 35 +++++++++++++++++++
|
||||
1 file changed, 35 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
index e09d7289e37b..c6035e68de71 100644
|
||||
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
@@ -2366,6 +2366,27 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
}
|
||||
mProximitySensor = SensorUtils.findSensor(mSensorManager,
|
||||
mDisplayDeviceConfig.getProximitySensor(), Sensor.TYPE_PROXIMITY);
|
||||
+ if(mProximitySensor == null) {
|
||||
+ java.util.List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
|
||||
+ for(Sensor sensor: sensors) {
|
||||
+ if("com.samsung.sensor.physical_proximity".equals(sensor.getStringType()))
|
||||
+ mProximitySensor = sensor;
|
||||
+ }
|
||||
+ }
|
||||
+ if(mProximitySensor == null) {
|
||||
+ java.util.List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
|
||||
+ for(Sensor sensor: sensors) {
|
||||
+ if("com.samsung.sensor.hover_proximity".equals(sensor.getStringType()))
|
||||
+ mProximitySensor = sensor;
|
||||
+ }
|
||||
+ }
|
||||
+ if(mProximitySensor == null) {
|
||||
+ java.util.List<Sensor> 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);
|
||||
@@ -3408,6 +3429,20 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
if (mProximitySensorEnabled) {
|
||||
final long time = mClock.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;
|
||||
+ }
|
||||
+ if("com.samsung.sensor.hover_proximity".equals(mProximitySensor.getStringType())) {
|
||||
+ float v = event.values[0];
|
||||
+ boolean positive = (v >= 0.5f && v <= 4.5);
|
||||
+ android.util.Log.d("PHH", "Samsung hover 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.34.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 268e1bd12c10eba4700444c0687fd509dbce8ee3 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 5 Apr 2020 16:32:46 +0200
|
||||
Subject: [PATCH 10/50] Always allow overriding the number of work profiles
|
||||
|
||||
Change-Id: I6eb09aa71663c6fbe7563e3038bffcabdba0ff6a
|
||||
---
|
||||
.../java/com/android/server/pm/UserManagerService.java | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
|
||||
index a959fc10db49..440d42681c1a 100644
|
||||
--- a/services/core/java/com/android/server/pm/UserManagerService.java
|
||||
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
|
||||
@@ -7357,12 +7357,8 @@ public class UserManagerService extends IUserManager.Stub {
|
||||
*/
|
||||
private static int getMaxUsersOfTypePerParent(UserTypeDetails userTypeDetails) {
|
||||
final int defaultMax = userTypeDetails.getMaxAllowedPerParent();
|
||||
- if (!Build.IS_DEBUGGABLE) {
|
||||
- return defaultMax;
|
||||
- } else {
|
||||
- if (userTypeDetails.isManagedProfile()) {
|
||||
- return SystemProperties.getInt("persist.sys.max_profiles", defaultMax);
|
||||
- }
|
||||
+ if (userTypeDetails.isManagedProfile()) {
|
||||
+ return SystemProperties.getInt("persist.sys.max_profiles", defaultMax);
|
||||
}
|
||||
return defaultMax;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 1c2e2c57747d27dfc8facb75bb73e575647acb81 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 6 Jun 2020 18:21:56 +0200
|
||||
Subject: [PATCH 11/50] HOME deserves to wake-up devices just as well as back
|
||||
and menu
|
||||
|
||||
Change-Id: Ia562bafd8c620d00c17e8eb338e4701c6c4a3c3a
|
||||
---
|
||||
core/java/android/view/KeyEvent.java | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
|
||||
index 5de31a229aa3..a242afd2a689 100644
|
||||
--- a/core/java/android/view/KeyEvent.java
|
||||
+++ b/core/java/android/view/KeyEvent.java
|
||||
@@ -2068,6 +2068,7 @@ public class KeyEvent extends InputEvent implements Parcelable {
|
||||
case KeyEvent.KEYCODE_CAMERA:
|
||||
case KeyEvent.KEYCODE_FOCUS:
|
||||
case KeyEvent.KEYCODE_MENU:
|
||||
+ case KeyEvent.KEYCODE_HOME:
|
||||
case KeyEvent.KEYCODE_PAIRING:
|
||||
case KeyEvent.KEYCODE_STEM_1:
|
||||
case KeyEvent.KEYCODE_STEM_2:
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 2312dfbcde812959495f8766eb80b9450829772d Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 29 Sep 2020 22:39:47 +0200
|
||||
Subject: [PATCH 12/50] Some devices have proximity sensor reporting NaN as max
|
||||
range for some reason. Make them behave standard way by setting 5 cm
|
||||
|
||||
Change-Id: I3c39e3e914a05903c140235702e0480d2d58a612
|
||||
---
|
||||
.../com/android/server/display/DisplayPowerController.java | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
index c6035e68de71..fb84d64350b7 100644
|
||||
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
@@ -2390,6 +2390,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
if (mProximitySensor != null) {
|
||||
mProximityThreshold = Math.min(mProximitySensor.getMaximumRange(),
|
||||
TYPICAL_PROXIMITY_THRESHOLD);
|
||||
+ if(Float.isNaN(mProximityThreshold)) {
|
||||
+ mProximityThreshold = 5.0f;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 70cd27439768d7b7137225345f403aa43adfb9c8 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 29 Sep 2020 22:40:10 +0200
|
||||
Subject: [PATCH 13/50] Fix brightness range not being complete on Samsung
|
||||
devices
|
||||
|
||||
On some devices, minimum brightness is 0, which totally messes with
|
||||
Brightness computations (minimum float brightness becomes -1.0 instead
|
||||
of 0.0...).
|
||||
Cheat and have them report 1 as minimum instead, which fixes the slope
|
||||
|
||||
Change-Id: I4d97cbc32490949e83272b81ec6320a5483310b1
|
||||
---
|
||||
.../java/com/android/server/power/PowerManagerService.java | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
|
||||
index edcf2715b0a5..e88ec095fbe7 100644
|
||||
--- a/services/core/java/com/android/server/power/PowerManagerService.java
|
||||
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
|
||||
@@ -1246,9 +1246,11 @@ public final class PowerManagerService extends SystemService
|
||||
|
||||
if (min == INVALID_BRIGHTNESS_IN_CONFIG || max == INVALID_BRIGHTNESS_IN_CONFIG
|
||||
|| def == INVALID_BRIGHTNESS_IN_CONFIG) {
|
||||
+ int correctedMin = mContext.getResources().getInteger(com.android.internal.R.integer
|
||||
+ .config_screenBrightnessSettingMinimum);
|
||||
+ if(correctedMin == 0) correctedMin = 1;
|
||||
mScreenBrightnessMinimum = BrightnessSynchronizer.brightnessIntToFloat(
|
||||
- mContext.getResources().getInteger(com.android.internal.R.integer
|
||||
- .config_screenBrightnessSettingMinimum));
|
||||
+ correctedMin);
|
||||
mScreenBrightnessMaximum = BrightnessSynchronizer.brightnessIntToFloat(
|
||||
mContext.getResources().getInteger(com.android.internal.R.integer
|
||||
.config_screenBrightnessSettingMaximum));
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 6f924b3312017fc5eb84d50eaf544d2e79d90fbf Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 25 Oct 2020 23:57:26 +0100
|
||||
Subject: [PATCH 14/50] Re-implement fnmatch-like behaviour for RRO java-side
|
||||
|
||||
T: Also apply to FrameworkParsingPackageUtils (@PeterCxy)
|
||||
|
||||
Change-Id: Id38292a9a1453aa87b8401c1fdb390fa4e63c7d1
|
||||
---
|
||||
.../pm/parsing/FrameworkParsingPackageUtils.java | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
||||
index b75ba82ad091..b344f7232190 100644
|
||||
--- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
||||
+++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
||||
@@ -223,8 +223,17 @@ public class FrameworkParsingPackageUtils {
|
||||
continue;
|
||||
}
|
||||
// 3. Check if prop is equal to expected value.
|
||||
- if (!currValue.equals(propValues[i])) {
|
||||
- return false;
|
||||
+ final String value = propValues[i];
|
||||
+ if(value.startsWith("+")) {
|
||||
+ final java.util.regex.Pattern regex = java.util.regex.Pattern.compile(value.substring(1, value.length()).replace("*", ".*"));
|
||||
+ java.util.regex.Matcher matcher = regex.matcher(currValue);
|
||||
+ if (!matcher.find()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if(!value.equals(currValue)) {
|
||||
+ return false;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
return true;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From bc7ba9db9a4cb0f11a715f113b88897f4031890a Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 11 Dec 2020 14:41:09 +0100
|
||||
Subject: [PATCH 15/50] Remove useless notification about "console" service
|
||||
being running
|
||||
|
||||
---
|
||||
.../core/java/com/android/server/am/ActivityManagerService.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
index 4dad2d560526..5d1f27ac923d 100644
|
||||
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
@@ -5156,7 +5156,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
|
||||
private void showConsoleNotificationIfActive() {
|
||||
- if (!SystemProperties.get("init.svc.console").equals("running")) {
|
||||
+ if (!SystemProperties.get("init.svc.console").equals("running") || true) {
|
||||
return;
|
||||
}
|
||||
String title = mContext
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
From 0131331d9813abfb7e0a1d3a8a82036c34294b9e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 21:24:12 +0800
|
||||
Subject: [PATCH 16/50] Revert "Remove unused SystemProperties.set"
|
||||
|
||||
This reverts commit debb4616ef67f9ed5054eca51ec58592358ff55f.
|
||||
|
||||
* Needed for SPRD IMS
|
||||
---
|
||||
.../android/telephony/TelephonyManager.java | 69 +++++++++++++++++++
|
||||
1 file changed, 69 insertions(+)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
|
||||
index 340e4ab132ca..551b73a1706f 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -8095,6 +8095,75 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Sets a per-phone telephony property with the value specified.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static void setTelephonyProperty(int phoneId, String property, String value) {
|
||||
+ String propVal = "";
|
||||
+ String p[] = null;
|
||||
+ String prop = SystemProperties.get(property);
|
||||
+
|
||||
+ if (value == null) {
|
||||
+ value = "";
|
||||
+ }
|
||||
+ value.replace(',', ' ');
|
||||
+ if (prop != null) {
|
||||
+ p = prop.split(",");
|
||||
+ }
|
||||
+
|
||||
+ if (!SubscriptionManager.isValidPhoneId(phoneId)) {
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: invalid phoneId=" + phoneId +
|
||||
+ " property=" + property + " value: " + value + " prop=" + prop);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < phoneId; i++) {
|
||||
+ String str = "";
|
||||
+ if ((p != null) && (i < p.length)) {
|
||||
+ str = p[i];
|
||||
+ }
|
||||
+ propVal = propVal + str + ",";
|
||||
+ }
|
||||
+
|
||||
+ propVal = propVal + value;
|
||||
+ if (p != null) {
|
||||
+ for (int i = phoneId + 1; i < p.length; i++) {
|
||||
+ propVal = propVal + "," + p[i];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int propValLen = propVal.length();
|
||||
+ try {
|
||||
+ propValLen = propVal.getBytes("utf-8").length;
|
||||
+ } catch (java.io.UnsupportedEncodingException e) {
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: utf-8 not supported");
|
||||
+ }
|
||||
+ if (propValLen > SystemProperties.PROP_VALUE_MAX) {
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: property too long phoneId=" + phoneId +
|
||||
+ " property=" + property + " value: " + value + " propVal=" + propVal);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ SystemProperties.set(property, propVal);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets a global telephony property with the value specified.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static void setTelephonyProperty(String property, String value) {
|
||||
+ if (value == null) {
|
||||
+ value = "";
|
||||
+ }
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: success" + " property=" +
|
||||
+ property + " value: " + value);
|
||||
+ SystemProperties.set(property, value);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Inserts or updates a list property. Expands the list if its length is not enough.
|
||||
*/
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From 6879e245b3b923f650eb0ebfa124181f53082efe Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 13:46:15 +0800
|
||||
Subject: [PATCH 17/50] TelephonyManager: bring back getNetworkClass()
|
||||
|
||||
This partially reverts commit c058cac051ab083dc7fb7ea6aa85699110b2e9bf.
|
||||
|
||||
* Needed by Spreadtrum IMS
|
||||
---
|
||||
.../android/telephony/TelephonyManager.java | 58 +++++++++++++++++++
|
||||
1 file changed, 58 insertions(+)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
|
||||
index 551b73a1706f..62bd70374c96 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -3204,6 +3204,64 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Network Class Definitions.
|
||||
+ * Do not change this order, it is used for sorting during emergency calling in
|
||||
+ * {@link TelephonyConnectionService#getFirstPhoneForEmergencyCall()}. Any newer technologies
|
||||
+ * should be added after the current definitions.
|
||||
+ */
|
||||
+ /** Unknown network class. {@hide} */
|
||||
+ public static final int NETWORK_CLASS_UNKNOWN = 0;
|
||||
+ /** Class of broadly defined "2G" networks. {@hide} */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int NETWORK_CLASS_2_G = 1;
|
||||
+ /** Class of broadly defined "3G" networks. {@hide} */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int NETWORK_CLASS_3_G = 2;
|
||||
+ /** Class of broadly defined "4G" networks. {@hide} */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int NETWORK_CLASS_4_G = 3;
|
||||
+ /** Class of broadly defined "5G" networks. {@hide} */
|
||||
+ public static final int NETWORK_CLASS_5_G = 4;
|
||||
+
|
||||
+ /**
|
||||
+ * Return general class of network type, such as "3G" or "4G". In cases
|
||||
+ * where classification is contentious, this method is conservative.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static int getNetworkClass(int networkType) {
|
||||
+ switch (networkType) {
|
||||
+ case NETWORK_TYPE_GPRS:
|
||||
+ case NETWORK_TYPE_GSM:
|
||||
+ case NETWORK_TYPE_EDGE:
|
||||
+ case NETWORK_TYPE_CDMA:
|
||||
+ case NETWORK_TYPE_1xRTT:
|
||||
+ case NETWORK_TYPE_IDEN:
|
||||
+ return NETWORK_CLASS_2_G;
|
||||
+ case NETWORK_TYPE_UMTS:
|
||||
+ case NETWORK_TYPE_EVDO_0:
|
||||
+ case NETWORK_TYPE_EVDO_A:
|
||||
+ case NETWORK_TYPE_HSDPA:
|
||||
+ case NETWORK_TYPE_HSUPA:
|
||||
+ case NETWORK_TYPE_HSPA:
|
||||
+ case NETWORK_TYPE_EVDO_B:
|
||||
+ case NETWORK_TYPE_EHRPD:
|
||||
+ case NETWORK_TYPE_HSPAP:
|
||||
+ case NETWORK_TYPE_TD_SCDMA:
|
||||
+ return NETWORK_CLASS_3_G;
|
||||
+ case NETWORK_TYPE_LTE:
|
||||
+ case NETWORK_TYPE_IWLAN:
|
||||
+ case NETWORK_TYPE_LTE_CA:
|
||||
+ return NETWORK_CLASS_4_G;
|
||||
+ case NETWORK_TYPE_NR:
|
||||
+ return NETWORK_CLASS_5_G;
|
||||
+ default:
|
||||
+ return NETWORK_CLASS_UNKNOWN;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Returns a string representation of the radio technology (network type)
|
||||
* currently in use on the device.
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 1963ddb089e0fb68669da3fe5e2b7dd6e31f7ebf Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 21:26:45 +0800
|
||||
Subject: [PATCH 18/50] TelephonyManager: add API annotations for
|
||||
setTelephonyProperty
|
||||
|
||||
* This method was added back by reverting commit
|
||||
debb4616ef67f9ed5054eca51ec58592358ff55f, but they do not conform to
|
||||
the new R API requirements.
|
||||
|
||||
* R requires such annotations.
|
||||
---
|
||||
telephony/java/android/telephony/TelephonyManager.java | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
|
||||
index 62bd70374c96..7aac41db9c36 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -8159,7 +8159,7 @@ public class TelephonyManager {
|
||||
* @hide
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
- public static void setTelephonyProperty(int phoneId, String property, String value) {
|
||||
+ public static void setTelephonyProperty(int phoneId, @NonNull String property, @Nullable String value) {
|
||||
String propVal = "";
|
||||
String p[] = null;
|
||||
String prop = SystemProperties.get(property);
|
||||
@@ -8213,7 +8213,8 @@ public class TelephonyManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
- public static void setTelephonyProperty(String property, String value) {
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static void setTelephonyProperty(@NonNull String property, @Nullable String value) {
|
||||
if (value == null) {
|
||||
value = "";
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 8dca252df27d744e02dd842a37fa061dff75eda0 Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Ponces <ponces26@gmail.com>
|
||||
Date: Tue, 2 Feb 2021 10:20:51 +0000
|
||||
Subject: [PATCH 19/50] Fix Wakelock issue
|
||||
|
||||
Prevent SystemUI crash due to "WakeLock under-locked Doze" (issue #12) by only releasing a wakelock that was not already released
|
||||
---
|
||||
.../src/com/android/systemui/util/wakelock/WakeLock.java | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java b/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java
|
||||
index 6128feee8116..b60905b39e32 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java
|
||||
@@ -143,7 +143,9 @@ public interface WakeLock {
|
||||
if (logger != null) {
|
||||
logger.logRelease(inner, why, count);
|
||||
}
|
||||
- inner.release();
|
||||
+ if (inner.isHeld()) {
|
||||
+ inner.release();
|
||||
+ }
|
||||
}
|
||||
|
||||
/** @see PowerManager.WakeLock#wrap(Runnable) */
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 509bd0245a7bc49d22c89bcff4d06bfc21eae906 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 20 Mar 2021 14:31:01 +0100
|
||||
Subject: [PATCH 20/50] Automatically detect pick up sensor, so that an overlay
|
||||
is required for the sole purpose of enabling pulse doze on pick up sensor
|
||||
|
||||
---
|
||||
.../display/AmbientDisplayConfiguration.java | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/hardware/display/AmbientDisplayConfiguration.java b/core/java/android/hardware/display/AmbientDisplayConfiguration.java
|
||||
index 47541ca16cda..28168b9208f5 100644
|
||||
--- a/core/java/android/hardware/display/AmbientDisplayConfiguration.java
|
||||
+++ b/core/java/android/hardware/display/AmbientDisplayConfiguration.java
|
||||
@@ -25,6 +25,9 @@ import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.SparseArray;
|
||||
|
||||
+import android.hardware.SensorManager;
|
||||
+import android.hardware.Sensor;
|
||||
+
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
|
||||
@@ -105,8 +108,20 @@ public class AmbientDisplayConfiguration {
|
||||
|
||||
/** @hide */
|
||||
public boolean dozePickupSensorAvailable() {
|
||||
- return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup);
|
||||
- }
|
||||
+ SensorManager sm = mContext.getSystemService(SensorManager.class);
|
||||
+ boolean found = false;
|
||||
+ if(sm == null) {
|
||||
+ android.util.Log.d("PHH", "Failed getting sensor manager, can't detect pickup sensor");
|
||||
+ } else {
|
||||
+ java.util.List<Sensor> sensors = sm.getSensorList(Sensor.TYPE_ALL);
|
||||
+ for(Sensor s : sensors) {
|
||||
+ if(Sensor.STRING_TYPE_PICK_UP_GESTURE.equals(s.getStringType())) {
|
||||
+ found = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup) || found; }
|
||||
|
||||
/** @hide */
|
||||
public boolean tapGestureEnabled(int user) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 707fa8d5e9f3fa538dd44e7c2e6ed5c4acbadf56 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 23 Mar 2021 19:43:26 +0100
|
||||
Subject: [PATCH 21/50] Catch broken mainBuiltInDisplayCutoutRectApproximation
|
||||
|
||||
Some devices (Redmi Note 9T) have:
|
||||
mainBuiltInDisplayCutoutRectApproximation = @android:mainBuiltInDisplayCutout
|
||||
Since mainBuiltInDisplayCutout is private, its ID is dynamic and can't
|
||||
be relied upon.
|
||||
This means that we'll get garbage in mainBuiltInDisplayCutoutRectApproximation
|
||||
The SVG Path parser will fail, triggering an exception.
|
||||
|
||||
Fix it by catching it, and parsing mainBuiltInDisplayCutout instead
|
||||
|
||||
Change-Id: I03b6e78bac2cc38f3a623c8add801405ad6ba7ba
|
||||
---
|
||||
core/java/android/view/DisplayCutout.java | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java
|
||||
index 712d1d67c942..5d929873f18d 100644
|
||||
--- a/core/java/android/view/DisplayCutout.java
|
||||
+++ b/core/java/android/view/DisplayCutout.java
|
||||
@@ -1056,11 +1056,19 @@ public final class DisplayCutout {
|
||||
public static DisplayCutout fromResourcesRectApproximation(Resources res,
|
||||
String displayUniqueId, int physicalDisplayWidth, int physicalDisplayHeight,
|
||||
int displayWidth, int displayHeight) {
|
||||
- return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId),
|
||||
- getDisplayCutoutApproximationRect(res, displayUniqueId), physicalDisplayWidth,
|
||||
- physicalDisplayHeight, displayWidth, displayHeight,
|
||||
- DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT,
|
||||
- getWaterfallInsets(res, displayUniqueId)).second;
|
||||
+ try {
|
||||
+ return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId),
|
||||
+ getDisplayCutoutApproximationRect(res, displayUniqueId), physicalDisplayWidth,
|
||||
+ physicalDisplayHeight, displayWidth, displayHeight,
|
||||
+ DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT,
|
||||
+ getWaterfallInsets(res, displayUniqueId)).second;
|
||||
+ } catch(Throwable t) {
|
||||
+ return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId),
|
||||
+ null, physicalDisplayWidth,
|
||||
+ physicalDisplayHeight, displayWidth, displayHeight,
|
||||
+ DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT,
|
||||
+ getWaterfallInsets(res, displayUniqueId)).second;
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
From 7548d2465b542b0b24609900b57e0eab433e6eb6 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 24 Mar 2018 08:01:48 +0100
|
||||
Subject: [PATCH 22/50] backlight: Fix backlight control on Galaxy S9(+)
|
||||
|
||||
Change-Id: I1fbbb47939c377597ef8ad6b88b2acea5f4acaa6
|
||||
|
||||
:backlight: S9 brightness override only for screen
|
||||
|
||||
Change-Id: Ie16a46336fa64850014b962429f7a20ff569222f
|
||||
|
||||
:backlight: [WIP] Fix OP6 brightness
|
||||
|
||||
Change-Id: If08959ece6cac1f27e1f1a0bd966ee8e1813241d
|
||||
|
||||
:backlight: Try to make brightness more generic using property set by rw-system
|
||||
|
||||
Change-Id: I0f20ca4b1f0fa1fcfd19833aa291fbdf16d6eedd
|
||||
|
||||
:backlight: Add Qualcomm starlte
|
||||
|
||||
Change-Id: I12a445344deb8b2e59a2f6ce6b24c1ffe5675092
|
||||
|
||||
:backlight: Switch samsung light fingerprint match to regexp, to include Note9
|
||||
|
||||
Change-Id: I2995f7bab615aec125927a5a027ad8f9ae43405f
|
||||
|
||||
Add a property toggle to enable high brightness range on samsung device
|
||||
|
||||
Change-Id: I649a3985ef87f46a5515a63935fdae9cdcbd8ec5
|
||||
|
||||
:backlight: Add japanese S9
|
||||
|
||||
Change-Id: I5e245469f5f51fed14c6080e5be72506e10389e0
|
||||
|
||||
:backlight: Fix backlight on S10*. Add an additional property to check, so testers can try it more easily
|
||||
|
||||
Change-Id: Ia224e641cad8561201b4dee3d896362bee80c903
|
||||
|
||||
:backlight: Make samsung light HAL more overridable
|
||||
|
||||
Change-Id: Ie04f394f8a614da8070f330bcadbcbe12895bed0
|
||||
|
||||
Use new backlight control API only for backlight, not for other lights
|
||||
|
||||
Change-Id: I35c35fabff8b275f35671dcb8578b96dcad526f1
|
||||
|
||||
:backlight: fixup
|
||||
|
||||
Change-Id: I4e85178327d2bb63d5d0a37786058843662a89ba
|
||||
---
|
||||
.../android/server/lights/LightsService.java | 46 +++++++++++++++++++
|
||||
1 file changed, 46 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
|
||||
index fea6b29d9260..caf9eba7d9a8 100644
|
||||
--- a/services/core/java/com/android/server/lights/LightsService.java
|
||||
+++ b/services/core/java/com/android/server/lights/LightsService.java
|
||||
@@ -32,6 +32,7 @@ import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
+import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.provider.Settings;
|
||||
import android.util.Slog;
|
||||
@@ -295,6 +296,51 @@ public class LightsService extends SystemService {
|
||||
return;
|
||||
}
|
||||
int brightnessInt = BrightnessSynchronizer.brightnessFloatToInt(brightness);
|
||||
+
|
||||
+ if(mHwLight.id == 0) {
|
||||
+ String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
|
||||
+ if(fp.matches(".*astarqlte.*")) {
|
||||
+ int newBrightness = brightnessInt;
|
||||
+ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
|
||||
+ newBrightness = (int) (brightnessInt * 365.0 / 255.0);
|
||||
+ }
|
||||
+ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ 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 = brightnessInt * ratio;
|
||||
+ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
|
||||
+ newBrightness = (int) (brightnessInt * 40960.0 / 255.0);
|
||||
+ }
|
||||
+ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false);
|
||||
+ int scale = SystemProperties.getInt("persist.display.max_brightness", 1023);
|
||||
+ //This is set by vndk-detect
|
||||
+ int qcomScale = SystemProperties.getInt("persist.sys.qcom-brightness", -1);
|
||||
+ if(qcomScale != -1) {
|
||||
+ qcomExtendBrightness = true;
|
||||
+ scale = qcomScale;
|
||||
+ }
|
||||
+
|
||||
+ if(qcomExtendBrightness) {
|
||||
+ setLightLocked(brightnessInt * scale / 255, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
int color = brightnessInt & 0x000000ff;
|
||||
color = 0xff000000 | (color << 16) | (color << 8) | color;
|
||||
setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 02c62cf8b31225686f8b9567cba799f9e8f175a4 Mon Sep 17 00:00:00 2001
|
||||
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
||||
Date: Sat, 4 Sep 2021 08:26:30 +0000
|
||||
Subject: [PATCH 23/50] Revert "Switch long-press power behavior in AOSP."
|
||||
|
||||
This reverts commit 803c77a0a24624111944832098c6f65158051dc4.
|
||||
---
|
||||
core/res/res/values/config.xml | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
|
||||
index 40bae0723f41..04a69f8c1e6d 100644
|
||||
--- a/core/res/res/values/config.xml
|
||||
+++ b/core/res/res/values/config.xml
|
||||
@@ -1098,7 +1098,7 @@
|
||||
5 - Go to assistant (Settings.Secure.ASSISTANT)
|
||||
6 - Toggle torch on / off (if screen is off)
|
||||
-->
|
||||
- <integer name="config_longPressOnPowerBehavior">5</integer>
|
||||
+ <integer name="config_longPressOnPowerBehavior">1</integer>
|
||||
|
||||
<!-- The time in milliseconds after which a press on power button is considered "long". -->
|
||||
<integer name="config_longPressOnPowerDurationMs">500</integer>
|
||||
@@ -1130,7 +1130,7 @@
|
||||
1 - Mute toggle
|
||||
2 - Global actions menu
|
||||
-->
|
||||
- <integer name="config_keyChordPowerVolumeUp">2</integer>
|
||||
+ <integer name="config_keyChordPowerVolumeUp">1</integer>
|
||||
|
||||
<!-- Control the behavior when the user long presses the back button. Non-zero values are only
|
||||
valid for watches as part of CDD/CTS.
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 58bdf9405c40873bbc54d90269dd1a98bd895b22 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 2 Apr 2022 18:04:01 -0400
|
||||
Subject: [PATCH 24/50] Allow disabling of fingerprint cleanups, needed on some
|
||||
Realme devices that cant enumerate
|
||||
|
||||
---
|
||||
.../biometrics/sensors/fingerprint/hidl/Fingerprint21.java | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java
|
||||
index d0b71fcf2dbb..d5978a531dc5 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java
|
||||
@@ -746,6 +746,8 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
||||
|
||||
private void scheduleInternalCleanup(int userId,
|
||||
@Nullable ClientMonitorCallback callback) {
|
||||
+ final boolean mNocleanup = android.os.SystemProperties.getBoolean("persist.sys.phh.fingerprint.nocleanup", false);
|
||||
+ if(mNocleanup) return;
|
||||
mHandler.post(() -> {
|
||||
scheduleUpdateActiveUserWithoutHandler(userId);
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From ca2daaa7257fed79965afe595742fb8f394827da Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 20 Dec 2021 15:01:41 -0500
|
||||
Subject: [PATCH 25/50] Dynamically resize boot animation to match screen size
|
||||
|
||||
Change-Id: I54e49fc6b8c670103852e212d1416e27ff976205
|
||||
---
|
||||
cmds/bootanimation/BootAnimation.cpp | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
|
||||
index 528ac1d19603..337e9eba702d 100644
|
||||
--- a/cmds/bootanimation/BootAnimation.cpp
|
||||
+++ b/cmds/bootanimation/BootAnimation.cpp
|
||||
@@ -622,6 +622,28 @@ status_t BootAnimation::readyToRun() {
|
||||
mFlingerSurface = s;
|
||||
mTargetInset = -1;
|
||||
|
||||
+ if ( mAnimation != nullptr ) {
|
||||
+ SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width);
|
||||
+ int origWidth = mAnimation->width;
|
||||
+ if ( mAnimation->width*2 < mWidth ) {
|
||||
+ SLOGE("Making animation bigger");
|
||||
+ mAnimation->width *= 2;
|
||||
+ mAnimation->height *= 2;
|
||||
+ } else if ( mWidth < mAnimation->width ) {
|
||||
+ SLOGE("Making animation smaller");
|
||||
+ mAnimation->width /= 2;
|
||||
+ mAnimation->height /= 2;
|
||||
+ }
|
||||
+ for (Animation::Part& part : mAnimation->parts) {
|
||||
+ for(auto& frame: part.frames) {
|
||||
+ if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) {
|
||||
+ frame.trimWidth = mAnimation->width;
|
||||
+ frame.trimHeight = mAnimation->height;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// Rotate the boot animation according to the value specified in the sysprop
|
||||
// ro.bootanim.set_orientation_<display_id>. Four values are supported: ORIENTATION_0,
|
||||
// ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270.
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
From 622350d44f2db35c4762e1ba0db21338d29dac6d Mon Sep 17 00:00:00 2001
|
||||
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
||||
Date: Sat, 15 Oct 2022 09:33:56 +0000
|
||||
Subject: [PATCH 26/50] Revert "Remove more FDE methods from StorageManager"
|
||||
|
||||
This reverts commit bd13f84152449a3ead6fa8604fd31f48c0224676.
|
||||
|
||||
Change-Id: Ic394934ec27b1a486c60123130825d44dad73412
|
||||
---
|
||||
.../android/os/storage/StorageManager.java | 57 +++++++++++++++++++
|
||||
.../internal/os/RoSystemProperties.java | 4 ++
|
||||
2 files changed, 61 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
|
||||
index ee387e7c284f..0adc55598d9b 100644
|
||||
--- a/core/java/android/os/storage/StorageManager.java
|
||||
+++ b/core/java/android/os/storage/StorageManager.java
|
||||
@@ -1669,6 +1669,15 @@ public class StorageManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ /** {@hide}
|
||||
+ * Is this device encryptable or already encrypted?
|
||||
+ * @return true for encryptable or encrypted
|
||||
+ * false not encrypted and not encryptable
|
||||
+ */
|
||||
+ public static boolean isEncryptable() {
|
||||
+ return RoSystemProperties.CRYPTO_ENCRYPTABLE;
|
||||
+ }
|
||||
+
|
||||
/** {@hide}
|
||||
* Is this device encrypted?
|
||||
* <p>
|
||||
@@ -1702,6 +1711,54 @@ public class StorageManager {
|
||||
return isFileEncrypted();
|
||||
}
|
||||
|
||||
+ /** {@hide}
|
||||
+ * Is this device block encrypted?
|
||||
+ * @return true for block encrypted. (Implies isEncrypted() == true)
|
||||
+ * false not encrypted or file encrypted
|
||||
+ */
|
||||
+ public static boolean isBlockEncrypted() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /** {@hide}
|
||||
+ * Is this device block encrypted with credentials?
|
||||
+ * @return true for crediential block encrypted.
|
||||
+ * (Implies isBlockEncrypted() == true)
|
||||
+ * false not encrypted, file encrypted or default block encrypted
|
||||
+ */
|
||||
+ public static boolean isNonDefaultBlockEncrypted() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /** {@hide}
|
||||
+ * Is this device in the process of being block encrypted?
|
||||
+ * @return true for encrypting.
|
||||
+ * false otherwise
|
||||
+ * Whether device isEncrypted at this point is undefined
|
||||
+ * Note that only system services and CryptKeeper will ever see this return
|
||||
+ * true - no app will ever be launched in this state.
|
||||
+ * Also note that this state will not change without a teardown of the
|
||||
+ * framework, so no service needs to check for changes during their lifespan
|
||||
+ */
|
||||
+ public static boolean isBlockEncrypting() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /** {@hide}
|
||||
+ * Is this device non default block encrypted and in the process of
|
||||
+ * prompting for credentials?
|
||||
+ * @return true for prompting for credentials.
|
||||
+ * (Implies isNonDefaultBlockEncrypted() == true)
|
||||
+ * false otherwise
|
||||
+ * Note that only system services and CryptKeeper will ever see this return
|
||||
+ * true - no app will ever be launched in this state.
|
||||
+ * Also note that this state will not change without a teardown of the
|
||||
+ * framework, so no service needs to check for changes during their lifespan
|
||||
+ */
|
||||
+ public static boolean inCryptKeeperBounce() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
/** {@hide}
|
||||
* @deprecated Use {@link #isFileEncrypted} instead, since emulated FBE is no longer supported.
|
||||
*/
|
||||
diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java
|
||||
index 40d5c4761dff..66288706b0f1 100644
|
||||
--- a/core/java/com/android/internal/os/RoSystemProperties.java
|
||||
+++ b/core/java/com/android/internal/os/RoSystemProperties.java
|
||||
@@ -68,10 +68,14 @@ public class RoSystemProperties {
|
||||
public static final CryptoProperties.type_values CRYPTO_TYPE =
|
||||
CryptoProperties.type().orElse(CryptoProperties.type_values.NONE);
|
||||
// These are pseudo-properties
|
||||
+ public static final boolean CRYPTO_ENCRYPTABLE =
|
||||
+ CRYPTO_STATE != CryptoProperties.state_values.UNSUPPORTED;
|
||||
public static final boolean CRYPTO_ENCRYPTED =
|
||||
CRYPTO_STATE == CryptoProperties.state_values.ENCRYPTED;
|
||||
public static final boolean CRYPTO_FILE_ENCRYPTED =
|
||||
CRYPTO_TYPE == CryptoProperties.type_values.FILE;
|
||||
+ public static final boolean CRYPTO_BLOCK_ENCRYPTED =
|
||||
+ CRYPTO_TYPE == CryptoProperties.type_values.BLOCK;
|
||||
|
||||
public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG =
|
||||
"log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 59d9381e45331015cca06f2fcfa504365be0a657 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 3 Dec 2022 17:13:24 -0500
|
||||
Subject: [PATCH 27/50] Set old fingerprint sensors to security "strong"
|
||||
|
||||
This allows removing config_biometric_sensors from overlays, which led
|
||||
to Pixels not booting, because they are using AIDL biometric sensor, and
|
||||
despite its name, config_biometric_sensors is HIDL-specific
|
||||
---
|
||||
.../core/java/com/android/server/biometrics/AuthService.java | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
index 6f4ad13ba854..c692f5f9472c 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
@@ -655,7 +655,7 @@ public class AuthService extends SystemService {
|
||||
final int firstApiLevel = SystemProperties.getInt(SYSPROP_FIRST_API_LEVEL, 0);
|
||||
final int apiLevel = SystemProperties.getInt(SYSPROP_API_LEVEL, firstApiLevel);
|
||||
String[] configStrings = mInjector.getConfiguration(getContext());
|
||||
- if (configStrings.length == 0 && apiLevel == Build.VERSION_CODES.R) {
|
||||
+ if (configStrings.length == 0 && apiLevel <= Build.VERSION_CODES.R) {
|
||||
// For backwards compatibility with R where biometrics could work without being
|
||||
// configured in config_biometric_sensors. In the absence of a vendor provided
|
||||
// configuration, we assume the weakest biometric strength (i.e. convenience).
|
||||
@@ -690,7 +690,7 @@ public class AuthService extends SystemService {
|
||||
if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||
modalities.add(String.valueOf(BiometricAuthenticator.TYPE_FACE));
|
||||
}
|
||||
- final String strength = String.valueOf(Authenticators.BIOMETRIC_CONVENIENCE);
|
||||
+ final String strength = String.valueOf(Authenticators.BIOMETRIC_STRONG);
|
||||
final String[] configStrings = new String[modalities.size()];
|
||||
for (int i = 0; i < modalities.size(); ++i) {
|
||||
final String id = String.valueOf(i);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
From 60e2e07a4da5a9e375d798155f3b42aafa10590b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 14 Dec 2022 17:21:00 -0500
|
||||
Subject: [PATCH 28/50] Call Samsung's ISehSysInputDev to report screen state
|
||||
to touchscreen driver
|
||||
|
||||
This fixes touchscreen not waking up on Galaxy F23
|
||||
---
|
||||
services/core/Android.bp | 1 +
|
||||
.../server/display/LocalDisplayAdapter.java | 32 +++++++++++++++++++
|
||||
2 files changed, 33 insertions(+)
|
||||
|
||||
diff --git a/services/core/Android.bp b/services/core/Android.bp
|
||||
index 39204d9acf75..bb2b0bfdfaf0 100644
|
||||
--- a/services/core/Android.bp
|
||||
+++ b/services/core/Android.bp
|
||||
@@ -187,6 +187,7 @@ java_library_static {
|
||||
"com.android.sysprop.watchdog",
|
||||
"ImmutabilityAnnotation",
|
||||
"securebox",
|
||||
+ "vendor.samsung.hardware.sysinput-V1.2-java", // HIDL
|
||||
],
|
||||
javac_shard_size: 50,
|
||||
javacflags: [
|
||||
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
|
||||
index 89d865e5ae39..9f2793a16a28 100644
|
||||
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
|
||||
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
|
||||
@@ -33,6 +33,7 @@ import android.os.Trace;
|
||||
import android.util.DisplayUtils;
|
||||
import android.util.LongSparseArray;
|
||||
import android.util.Slog;
|
||||
+import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayAddress;
|
||||
@@ -51,6 +52,8 @@ import com.android.server.display.mode.DisplayModeDirector;
|
||||
import com.android.server.lights.LightsManager;
|
||||
import com.android.server.lights.LogicalLight;
|
||||
|
||||
+import vendor.samsung.hardware.sysinput.V1_1.ISehSysInputDev;
|
||||
+
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -234,6 +237,8 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
||||
|
||||
private DisplayEventReceiver.FrameRateOverride[] mFrameRateOverrides =
|
||||
new DisplayEventReceiver.FrameRateOverride[0];
|
||||
+ private boolean triedSamsungHal = false;
|
||||
+ private ISehSysInputDev samsungSysinput = null;
|
||||
|
||||
LocalDisplayDevice(IBinder displayToken, long physicalDisplayId,
|
||||
SurfaceControl.StaticDisplayInfo staticDisplayInfo,
|
||||
@@ -825,17 +830,44 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
||||
}
|
||||
mSidekickActive = false;
|
||||
}
|
||||
+ if (!triedSamsungHal) {
|
||||
+ triedSamsungHal = true;
|
||||
+ try {
|
||||
+ samsungSysinput = ISehSysInputDev.getService();
|
||||
+ } catch(Throwable t) {}
|
||||
+ }
|
||||
final int mode = getPowerModeForState(state);
|
||||
Trace.traceBegin(Trace.TRACE_TAG_POWER, "setDisplayState("
|
||||
+ "id=" + physicalDisplayId
|
||||
+ ", state=" + Display.stateToString(state) + ")");
|
||||
+
|
||||
+ if (samsungSysinput != null) {
|
||||
+ try {
|
||||
+ Log.d("PHH", "setTspEnable 1, " + state + ", true");
|
||||
+ samsungSysinput.setTspEnable(1, state, true);
|
||||
+ } catch(Throwable t) {
|
||||
+ Log.d("PHH", "Failed settings tsp enable", t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
try {
|
||||
mSurfaceControlProxy.setDisplayPowerMode(token, mode);
|
||||
Trace.traceCounter(Trace.TRACE_TAG_POWER, "DisplayPowerMode", mode);
|
||||
} finally {
|
||||
Trace.traceEnd(Trace.TRACE_TAG_POWER);
|
||||
}
|
||||
+
|
||||
+ if (samsungSysinput != null) {
|
||||
+ try {
|
||||
+ Log.d("PHH", "setTspEnable 1, " + state + ", false");
|
||||
+ samsungSysinput.setTspEnable(1, state, false);
|
||||
+ } catch(Throwable t) {
|
||||
+ Log.d("PHH", "Failed settings tsp enable", t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
setCommittedState(state);
|
||||
+
|
||||
// If we're entering a suspended (but not OFF) power state and we
|
||||
// have a sidekick available, tell it now that it can take control.
|
||||
if (Display.isSuspendedState(state) && state != Display.STATE_OFF
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
From 96803a190d0b605ac1f86c0d9c4698ba90f2ff55 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 2 Jun 2023 19:19:31 -0400
|
||||
Subject: [PATCH 29/50] Try catch around constrainNitsAndBacklightArrays, and
|
||||
falls back to dumb curve. It crashes on Xperia 1 IV.
|
||||
|
||||
---
|
||||
.../server/display/DisplayDeviceConfig.java | 56 ++++++++++---------
|
||||
1 file changed, 31 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
index b0ebab8e4002..77dafd5068d0 100644
|
||||
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
@@ -1903,37 +1903,43 @@ public class DisplayDeviceConfig {
|
||||
return;
|
||||
}
|
||||
|
||||
- // Use the (preferred) display device config mapping
|
||||
- final List<Point> points = map.getPoint();
|
||||
- final int size = points.size();
|
||||
+ try {
|
||||
+ // Use the (preferred) display device config mapping
|
||||
+ final List<Point> points = map.getPoint();
|
||||
+ final int size = points.size();
|
||||
|
||||
- float[] nits = new float[size];
|
||||
- float[] backlight = new float[size];
|
||||
+ float[] nits = new float[size];
|
||||
+ float[] backlight = new float[size];
|
||||
|
||||
- mInterpolationType = convertInterpolationType(map.getInterpolation());
|
||||
- int i = 0;
|
||||
- for (Point point : points) {
|
||||
- nits[i] = point.getNits().floatValue();
|
||||
- backlight[i] = point.getValue().floatValue();
|
||||
- if (i > 0) {
|
||||
- if (nits[i] < nits[i - 1]) {
|
||||
- Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
|
||||
- + " of configuration. Nits: " + nits[i] + " < " + nits[i - 1]);
|
||||
- return;
|
||||
- }
|
||||
+ mInterpolationType = convertInterpolationType(map.getInterpolation());
|
||||
+ int i = 0;
|
||||
+ for (Point point : points) {
|
||||
+ nits[i] = point.getNits().floatValue();
|
||||
+ backlight[i] = point.getValue().floatValue();
|
||||
+ if (i > 0) {
|
||||
+ if (nits[i] < nits[i - 1]) {
|
||||
+ Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
|
||||
+ + " of configuration. Nits: " + nits[i] + " < " + nits[i - 1]);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- if (backlight[i] < backlight[i - 1]) {
|
||||
- Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
|
||||
- + " of configuration. Value: " + backlight[i] + " < "
|
||||
- + backlight[i - 1]);
|
||||
- return;
|
||||
+ if (backlight[i] < backlight[i - 1]) {
|
||||
+ Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
|
||||
+ + " of configuration. Value: " + backlight[i] + " < "
|
||||
+ + backlight[i - 1]);
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
+ ++i;
|
||||
}
|
||||
- ++i;
|
||||
+ mRawNits = nits;
|
||||
+ mRawBacklight = backlight;
|
||||
+ constrainNitsAndBacklightArrays();
|
||||
+ } catch(Throwable t) {
|
||||
+ mRawNits = null;
|
||||
+ mRawBacklight = null;
|
||||
+ setSimpleMappingStrategyValues();
|
||||
}
|
||||
- mRawNits = nits;
|
||||
- mRawBacklight = backlight;
|
||||
- constrainNitsAndBacklightArrays();
|
||||
}
|
||||
|
||||
private Spline loadSdrHdrRatioMap(HighBrightnessMode hbmConfig) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
From 88330ecde45dddada9327c889cc9d9dd7d786d7d Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 17 Jun 2023 08:31:55 -0400
|
||||
Subject: [PATCH 30/50] Add Mediatek power hints on touch
|
||||
|
||||
Mediatek has multiple HALs (which existed concurrently), so it is a bit
|
||||
of a mess.
|
||||
From what I can tell, mOldMtkPerf is used on Android 10 vendors, while
|
||||
mMtkPerf is used on Android 11/12 vendors.
|
||||
If anyone has an Android 9 vendor and want to take a look, I think it
|
||||
would be something like this:
|
||||
vendor.mediatek.hardware.power.V2_0.IPower.powerHint()
|
||||
|
||||
On some devices, sending the touch boost isn't very helpful. Our guess
|
||||
is that Android 12 rendering got a lot heavier, and then touch boost is
|
||||
not enough. So, we add a property to /cheat/ and report a bigger boost:
|
||||
APP_ROTATE.
|
||||
On the few devices we've seen, touch boost only boosts scheduler, while
|
||||
app rotate will also for cpu min frequency.
|
||||
Experimentally using this app rotate boost indeed makes the device much
|
||||
smoother.
|
||||
|
||||
Change-Id: I9f1eac5a20b98920a5d0c8204fe4d165ba069f5a
|
||||
---
|
||||
services/core/Android.bp | 4 +-
|
||||
.../com/android/server/wm/DisplayPolicy.java | 49 +++++++++++++++++++
|
||||
2 files changed, 52 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/Android.bp b/services/core/Android.bp
|
||||
index bb2b0bfdfaf0..c4239779425f 100644
|
||||
--- a/services/core/Android.bp
|
||||
+++ b/services/core/Android.bp
|
||||
@@ -187,7 +187,9 @@ java_library_static {
|
||||
"com.android.sysprop.watchdog",
|
||||
"ImmutabilityAnnotation",
|
||||
"securebox",
|
||||
- "vendor.samsung.hardware.sysinput-V1.2-java", // HIDL
|
||||
+ // HIDL
|
||||
+ "vendor.mediatek.hardware.mtkpower-V1.1-java",
|
||||
+ "vendor.samsung.hardware.sysinput-V1.2-java",
|
||||
],
|
||||
javac_shard_size: 50,
|
||||
javacflags: [
|
||||
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
|
||||
index 8b3e4d38d736..0a8a26f0d4a6 100644
|
||||
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
|
||||
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
|
||||
@@ -217,6 +217,9 @@ public class DisplayPolicy {
|
||||
*/
|
||||
private boolean mRemoteInsetsControllerControlsSystemBars;
|
||||
|
||||
+ private vendor.mediatek.hardware.mtkpower.V1_1.IMtkPerf mMtkPerf;
|
||||
+ private vendor.mediatek.hardware.mtkpower.V1_0.IMtkPower mOldMtkPerf;
|
||||
+
|
||||
StatusBarManagerInternal getStatusBarManagerInternal() {
|
||||
synchronized (mServiceAcquireLock) {
|
||||
if (mStatusBarManagerInternal == null) {
|
||||
@@ -445,6 +448,19 @@ public class DisplayPolicy {
|
||||
mScreenOnEarly = true;
|
||||
mScreenOnFully = true;
|
||||
}
|
||||
+ try {
|
||||
+ mMtkPerf = vendor.mediatek.hardware.mtkpower.V1_1.IMtkPerf.getService();
|
||||
+ } catch(Throwable t) {
|
||||
+ android.util.Log.d("PHH-Power", "Retrieving mtkpower 1.0", t);
|
||||
+ mMtkPerf = null;
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ mOldMtkPerf = vendor.mediatek.hardware.mtkpower.V1_0.IMtkPower.getService();
|
||||
+ } catch(Throwable t) {
|
||||
+ android.util.Log.d("PHH-Power", "Retrieving mtkpower 1.0", t);
|
||||
+ mOldMtkPerf = null;
|
||||
+ }
|
||||
|
||||
final Looper looper = UiThread.getHandler().getLooper();
|
||||
mHandler = new PolicyHandler(looper);
|
||||
@@ -529,6 +545,17 @@ public class DisplayPolicy {
|
||||
mService.mPowerManagerInternal.setPowerBoost(
|
||||
Boost.INTERACTION, duration);
|
||||
}
|
||||
+ if(mOldMtkPerf != null) {
|
||||
+ try {
|
||||
+ android.util.Log.d("PHH-Power", "mtk1 fling power hint");
|
||||
+ int hint = 36; // MTKPOWER_HINT_APP_TOUCH
|
||||
+ if("rotate".equals(SystemProperties.get("persist.sys.phh.touch_hint")))
|
||||
+ hint = 35; // MTKPOWER_HINT_APP_ROTATE
|
||||
+ mOldMtkPerf.mtkPowerHint(hint, duration);
|
||||
+ } catch(Throwable t) {
|
||||
+ android.util.Log.d("PHH-Power", "Failed sending touch power hint", t);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -547,6 +574,28 @@ public class DisplayPolicy {
|
||||
if (listener != null) {
|
||||
listener.onTouchStart();
|
||||
}
|
||||
+ if(mMtkPerf != null) {
|
||||
+ try {
|
||||
+ android.util.Log.d("PHH-Power", "mtk power hint");
|
||||
+ int hint = 25; //MTKPOWER_HINT_APP_TOUCH
|
||||
+ if("rotate".equals(SystemProperties.get("persist.sys.phh.touch_hint")))
|
||||
+ hint = 24; // MTKPOWER_HINT_APP_ROTATE
|
||||
+ mMtkPerf.perfCusLockHint(hint, 1000);
|
||||
+ } catch(Throwable t) {
|
||||
+ android.util.Log.d("PHH-Power", "Failed sending touch power hint", t);
|
||||
+ }
|
||||
+ }
|
||||
+ if(mOldMtkPerf != null) {
|
||||
+ try {
|
||||
+ android.util.Log.d("PHH-Power", "mtk1 power hint");
|
||||
+ int hint = 36; // MTKPOWER_HINT_APP_TOUCH
|
||||
+ if("rotate".equals(SystemProperties.get("persist.sys.phh.touch_hint")))
|
||||
+ hint = 35; // MTKPOWER_HINT_APP_ROTATE
|
||||
+ mOldMtkPerf.mtkPowerHint(hint, 1000);
|
||||
+ } catch(Throwable t) {
|
||||
+ android.util.Log.d("PHH-Power", "Failed sending touch power hint", t);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
From a9e368d503270ae8988dce4c6c8927a4fbffe45d Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 5 Jul 2023 10:50:36 -0400
|
||||
Subject: [PATCH 31/50] Detect Moto dynamic hardware feature
|
||||
|
||||
Moto added a custom node in sysconfig XMLs:
|
||||
<unavailable-feature-conditional />
|
||||
This node reads a property and enables a feature based on it.
|
||||
|
||||
Take those into account to enable NFC on Moto devices which have
|
||||
NFC-less variants
|
||||
---
|
||||
.../java/com/android/server/SystemConfig.java | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java
|
||||
index 7fae31c0bb4b..6da8e9397829 100644
|
||||
--- a/services/core/java/com/android/server/SystemConfig.java
|
||||
+++ b/services/core/java/com/android/server/SystemConfig.java
|
||||
@@ -939,6 +939,25 @@ public class SystemConfig {
|
||||
}
|
||||
XmlUtils.skipCurrentTag(parser);
|
||||
} break;
|
||||
+ case "unavailable-feature-conditional": {
|
||||
+ if (allowFeatures) {
|
||||
+ String fname = parser.getAttributeValue(null, "name");
|
||||
+ String prop = parser.getAttributeValue(null, "prop");
|
||||
+ if (fname == null || prop == null) {
|
||||
+ Slog.w(TAG, "<" + name + "> without name in " + permFile
|
||||
+ + " at " + parser.getPositionDescription());
|
||||
+ } else {
|
||||
+ if(android.os.SystemProperties.getBoolean(prop, false)) {
|
||||
+ addFeature(fname, 0);
|
||||
+ } else {
|
||||
+ mUnavailableFeatures.add(fname);
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ logNotAllowedInPartition(name, permFile, parser);
|
||||
+ }
|
||||
+ XmlUtils.skipCurrentTag(parser);
|
||||
+ } break;
|
||||
case "allow-in-power-save-except-idle": {
|
||||
if (allowOverrideAppRestrictions) {
|
||||
String pkgname = parser.getAttributeValue(null, "package");
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From 93fb03fae7a6d3628f6197475f009f22448cb8d4 Mon Sep 17 00:00:00 2001
|
||||
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
||||
Date: Wed, 2 Aug 2023 20:59:53 +0800
|
||||
Subject: [PATCH 32/50] Restore getSimStateForSlotIndex in SubscriptionManager
|
||||
|
||||
MTK IMS still needs it here
|
||||
|
||||
Change-Id: I41bac57c68055f369232359a464642daab94403b
|
||||
---
|
||||
.../android/telephony/SubscriptionManager.java | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
|
||||
index 8e4ec0914563..a65a7e9ec2e6 100644
|
||||
--- a/telephony/java/android/telephony/SubscriptionManager.java
|
||||
+++ b/telephony/java/android/telephony/SubscriptionManager.java
|
||||
@@ -2558,6 +2558,20 @@ public class SubscriptionManager {
|
||||
return TelephonyManager.getDefault().isNetworkRoaming(subId);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns a constant indicating the state of sim for the slot index.
|
||||
+ *
|
||||
+ * @param slotIndex Logical SIM slot index.
|
||||
+ *
|
||||
+ * @see TelephonyManager.SimState
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @TelephonyManager.SimState
|
||||
+ public static int getSimStateForSlotIndex(int slotIndex) {
|
||||
+ return TelephonyManager.getSimStateForSlotIndex(slotIndex);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Set a field in the subscription database. Note not all fields are supported.
|
||||
*
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
From f7c1f8193abd44b136ce43af1b8999237450c253 Mon Sep 17 00:00:00 2001
|
||||
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
||||
Date: Sat, 12 Aug 2023 20:11:17 +0800
|
||||
Subject: [PATCH 33/50] Add runWithCleanCallingIdentity variant with both
|
||||
executor and return value
|
||||
|
||||
This complements the fixup to ImsPhoneCallTracker (in fw/o/t) for U
|
||||
|
||||
Change-Id: If444290787025e130dce4bdeaf92372ae32793fe
|
||||
---
|
||||
.../telephony/util/TelephonyUtils.java | 32 ++++++++++++++++++-
|
||||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
|
||||
index 9a8c9655375d..454080144d35 100644
|
||||
--- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
|
||||
+++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
|
||||
@@ -42,7 +42,9 @@ import com.android.internal.telephony.ITelephony;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
+import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
+import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
@@ -151,6 +153,34 @@ public final class TelephonyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Convenience method for running the provided action in the provided
|
||||
+ * executor enclosed in
|
||||
+ * {@link Binder#clearCallingIdentity}/{@link Binder#restoreCallingIdentity} and return
|
||||
+ * the result.
|
||||
+ *
|
||||
+ * Any exception thrown by the given action will need to be handled by caller.
|
||||
+ *
|
||||
+ */
|
||||
+ public static <T> T runWithCleanCallingIdentity(
|
||||
+ @NonNull Supplier<T> action, @NonNull Executor executor) {
|
||||
+ if (action != null) {
|
||||
+ if (executor != null) {
|
||||
+ try {
|
||||
+ return CompletableFuture.supplyAsync(
|
||||
+ () -> runWithCleanCallingIdentity(action), executor).get();
|
||||
+ } catch (ExecutionException | InterruptedException e) {
|
||||
+ Log.w(LOG_TAG, "TelephonyUtils : runWithCleanCallingIdentity exception: "
|
||||
+ + e.getMessage());
|
||||
+ return null;
|
||||
+ }
|
||||
+ } else {
|
||||
+ return runWithCleanCallingIdentity(action);
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Filter values in bundle to only basic types.
|
||||
*/
|
||||
@@ -319,4 +349,4 @@ public final class TelephonyUtils {
|
||||
return false;
|
||||
|
||||
}
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From cca4efcedbb0eedfaefdb8dfde39787690ad887d Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 6 Oct 2023 10:57:13 -0400
|
||||
Subject: [PATCH 34/50] Catch NPE in SystemUI
|
||||
|
||||
No idea why it triggers, but it crashes SystemUI on boot for my TV
|
||||
device
|
||||
---
|
||||
.../com/android/systemui/keyguard/KeyguardViewMediator.java | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
|
||||
index e9f494013e30..71d289b1369b 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
|
||||
@@ -3455,7 +3455,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
||||
Trace.beginSection("KeyguardViewMediator#handleMotifyStartedWakingUp");
|
||||
synchronized (KeyguardViewMediator.this) {
|
||||
if (DEBUG) Log.d(TAG, "handleNotifyWakingUp");
|
||||
- mKeyguardViewControllerLazy.get().onStartedWakingUp();
|
||||
+ try {
|
||||
+ mKeyguardViewControllerLazy.get().onStartedWakingUp();
|
||||
+ } catch(Throwable t) {
|
||||
+ android.util.Log.e("PHH", "handleNotifyStartedWakingUp crashed bip", t);
|
||||
+ }
|
||||
}
|
||||
Trace.endSection();
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 3dac2e291492531deb5acd89549ed8ca96bce107 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 27 Dec 2021 17:57:11 -0500
|
||||
Subject: [PATCH 35/50] Once we integrate Samsung Power hal in libpowermanager,
|
||||
libpowermanager and its deps require linking against
|
||||
vendor.samsung.hardware.miscpower@2.0
|
||||
|
||||
Change-Id: I9084f64e505009abe9420d28b44199605cee52d8
|
||||
---
|
||||
services/core/jni/Android.bp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
|
||||
index 36c13ca121e3..00e9cfa998b9 100644
|
||||
--- a/services/core/jni/Android.bp
|
||||
+++ b/services/core/jni/Android.bp
|
||||
@@ -204,6 +204,7 @@ cc_defaults {
|
||||
"service.incremental",
|
||||
"vendor.samsung.hardware.light@2.0",
|
||||
"vendor.samsung.hardware.light@3.0",
|
||||
+ "vendor.samsung.hardware.miscpower@2.0",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,826 @@
|
||||
From 68e397599248dac36747f768b933a250d76dd750 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 18 Dec 2022 18:20:40 -0500
|
||||
Subject: [PATCH 36/50] FOD support for Asus, Samsung recent Xiaomi and
|
||||
RedMagic 8 devices
|
||||
|
||||
Thanks Asus for providing a free device to make this support
|
||||
And thanks @davigamer987 for donating enough to get a Samsung FOD device
|
||||
to make this
|
||||
|
||||
Thanks @jgudec for Xiaomi support
|
||||
Thanks @boydaihungst for Redmagic 6 support
|
||||
|
||||
Co-authored-by: jgudec <jakov.gudec@gmail.com>
|
||||
Co-authored-by: Huy Hoang
|
||||
Change-Id: Ibd0f9ea8fba584a38c060fd9271549a5e106b4eb
|
||||
---
|
||||
packages/SystemUI/Android.bp | 4 +
|
||||
.../systemui/biometrics/UdfpsController.java | 56 ++++
|
||||
.../biometrics/UdfpsControllerOverlay.kt | 7 +-
|
||||
.../android/systemui/biometrics/UdfpsView.kt | 220 +++++++++++++
|
||||
services/core/Android.bp | 5 +
|
||||
.../server/biometrics/AuthService.java | 296 +++++++++++++++++-
|
||||
.../fingerprint/FingerprintService.java | 3 +-
|
||||
7 files changed, 585 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
|
||||
index 9fe68a31089f..8a1fc47e487b 100644
|
||||
--- a/packages/SystemUI/Android.bp
|
||||
+++ b/packages/SystemUI/Android.bp
|
||||
@@ -201,6 +201,10 @@ android_library {
|
||||
"LowLightDreamLib",
|
||||
"motion_tool_lib",
|
||||
"vendor.lineage.powershare-V1.0-java",
|
||||
+ "vendor.goodix.hardware.biometrics.fingerprint-V2.1-java",
|
||||
+ "vendor.xiaomi.hw.touchfeature-V1.0-java",
|
||||
+ "vendor.xiaomi.hardware.fingerprintextension-V1.0-java",
|
||||
+ "vendor.nubia.ifaa-V1.0-java",
|
||||
],
|
||||
manifest: "AndroidManifest.xml",
|
||||
additional_manifests: ["LineageManifest.xml"],
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
|
||||
index 3472a859ac82..19b67b5f3def 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
|
||||
@@ -48,6 +48,7 @@ import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.Process;
|
||||
import android.os.Trace;
|
||||
+import android.os.SystemProperties;
|
||||
import android.os.VibrationAttributes;
|
||||
import android.os.VibrationEffect;
|
||||
import android.util.Log;
|
||||
@@ -114,9 +115,13 @@ import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executor;
|
||||
+import java.io.File;
|
||||
+import java.io.FileWriter;
|
||||
+import java.io.IOException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
+import vendor.nubia.ifaa.V1_0.IIfaa;
|
||||
|
||||
/**
|
||||
* Shows and hides the under-display fingerprint sensor (UDFPS) overlay, handles UDFPS touch events,
|
||||
@@ -253,6 +258,46 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
mScreenOn = false;
|
||||
}
|
||||
};
|
||||
+ // Nubia 6 series fingerprint control command
|
||||
+ // cmd = 13 -> finger down
|
||||
+ // cmd = 14 -> after UI ready
|
||||
+ // cmd = 15 -> finger up
|
||||
+ public byte[] processCmd(int cmd, int param1, int param2, byte[] send_buf, int length) {
|
||||
+ try {
|
||||
+ if (cmd == 999) {
|
||||
+ Log.d(TAG, "processCmd: 999");
|
||||
+ return null;
|
||||
+ }
|
||||
+ ArrayList<Byte> sendList = new ArrayList<>();
|
||||
+ if (send_buf != null) {
|
||||
+ for (byte b : send_buf) {
|
||||
+ sendList.add(Byte.valueOf(b));
|
||||
+ }
|
||||
+ }
|
||||
+ if (send_buf == null) {
|
||||
+ Log.d(TAG, "FingerprintService send_buf = " + send_buf);
|
||||
+ }
|
||||
+ IIfaa iIfaaDaemon = IIfaa.getService();
|
||||
+ if (iIfaaDaemon == null) {
|
||||
+ Log.d(TAG, "processCmd: no iIfaaDaemon!");
|
||||
+ return null;
|
||||
+ }
|
||||
+ ArrayList<Byte> resultList = iIfaaDaemon.processCmd(cmd, param1, param2, sendList, length);
|
||||
+ int n = resultList.size();
|
||||
+ Log.d(TAG, "FingerprintService result length n = " + n);
|
||||
+ if (n == 0) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ byte[] result = new byte[n];
|
||||
+ for (int i = 0; i < n; i++) {
|
||||
+ result[i] = resultList.get(i).byteValue();
|
||||
+ }
|
||||
+ return result;
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ return null;
|
||||
+ }
|
||||
+ };
|
||||
|
||||
@Override
|
||||
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
|
||||
@@ -1241,10 +1286,17 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
view.configureDisplay(() -> dispatchOnUiReady(requestId));
|
||||
}
|
||||
}
|
||||
+ if(SystemProperties.get("ro.vendor.build.fingerprint").contains("nubia/NX669")) {
|
||||
+ processCmd(13, 0, 0, new byte[0], 0);
|
||||
+ }
|
||||
|
||||
for (Callback cb : mCallbacks) {
|
||||
cb.onFingerDown();
|
||||
}
|
||||
+ if(SystemProperties.get("ro.vendor.build.fingerprint").contains("nubia/NX669")) {
|
||||
+ processCmd(14, 0, 0, new byte[0], 0);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
private void onFingerUp(long requestId, @NonNull UdfpsView view) {
|
||||
@@ -1295,6 +1347,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
mFingerprintManager.onPointerUp(requestId, mSensorProps.sensorId);
|
||||
}
|
||||
}
|
||||
+ if(SystemProperties.get("ro.vendor.build.fingerprint").contains("nubia/NX669")) {
|
||||
+ processCmd(15, 0, 0, new byte[0], 0);
|
||||
+ }
|
||||
+
|
||||
for (Callback cb : mCallbacks) {
|
||||
cb.onFingerUp();
|
||||
}
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
|
||||
index d6ef94d18e71..bcc12831a62c 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
|
||||
@@ -133,7 +133,9 @@ class UdfpsControllerOverlay @JvmOverloads constructor(
|
||||
gravity = android.view.Gravity.TOP or android.view.Gravity.LEFT
|
||||
layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
||||
flags = (Utils.FINGERPRINT_OVERLAY_LAYOUT_PARAM_FLAGS or
|
||||
- WindowManager.LayoutParams.FLAG_SPLIT_TOUCH)
|
||||
+ WindowManager.LayoutParams.FLAG_SPLIT_TOUCH) or
|
||||
+ WindowManager.LayoutParams.FLAG_DIM_BEHIND
|
||||
+ dimAmount = 0.0f
|
||||
privateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY
|
||||
// Avoid announcing window title.
|
||||
accessibilityTitle = " "
|
||||
@@ -194,6 +196,9 @@ class UdfpsControllerOverlay @JvmOverloads constructor(
|
||||
windowManager.addView(this, coreLayoutParams.updateDimensions(animation))
|
||||
sensorRect = sensorBounds
|
||||
touchExplorationEnabled = accessibilityManager.isTouchExplorationEnabled
|
||||
+ dimUpdate = {
|
||||
+ windowManager.updateViewLayout(this, coreLayoutParams.updateDimensions(animation).apply { dimAmount = it })
|
||||
+ }
|
||||
overlayTouchListener = TouchExplorationStateChangeListener {
|
||||
if (accessibilityManager.isTouchExplorationEnabled) {
|
||||
setOnHoverListener { v, event -> onTouch(v, event, true) }
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
index 06dee7a2b9f6..4377dd7e70a7 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
@@ -19,16 +19,33 @@ import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
+import android.graphics.PixelFormat
|
||||
import android.graphics.PointF
|
||||
import android.graphics.Rect
|
||||
import android.graphics.RectF
|
||||
+import android.os.FileObserver
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
+import android.view.SurfaceHolder
|
||||
+import android.view.SurfaceView
|
||||
+import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import com.android.settingslib.udfps.UdfpsOverlayParams
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.doze.DozeReceiver
|
||||
+import java.io.File
|
||||
+import java.io.FileNotFoundException
|
||||
+
|
||||
+import vendor.goodix.hardware.biometrics.fingerprint.V2_1.IGoodixFingerprintDaemon
|
||||
+
|
||||
+import vendor.xiaomi.hw.touchfeature.V1_0.ITouchFeature
|
||||
+import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint
|
||||
+
|
||||
+import android.os.Handler
|
||||
+import android.os.HandlerThread
|
||||
+
|
||||
+import vendor.nubia.ifaa.V1_0.IIfaa
|
||||
|
||||
private const val TAG = "UdfpsView"
|
||||
|
||||
@@ -39,6 +56,54 @@ class UdfpsView(
|
||||
context: Context,
|
||||
attrs: AttributeSet?
|
||||
) : FrameLayout(context, attrs), DozeReceiver {
|
||||
+ private var currentOnIlluminatedRunnable: Runnable? = null
|
||||
+ private val mySurfaceView = SurfaceView(context)
|
||||
+ init {
|
||||
+ mySurfaceView.setVisibility(INVISIBLE)
|
||||
+ mySurfaceView.setZOrderOnTop(true)
|
||||
+ addView(mySurfaceView, FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
+ mySurfaceView.holder.addCallback(object: SurfaceHolder.Callback{
|
||||
+ override fun surfaceCreated(p0: SurfaceHolder) {
|
||||
+ Log.d("PHH", "Surface created!")
|
||||
+ val paint = Paint(0 /* flags */);
|
||||
+ paint.setAntiAlias(true);
|
||||
+ paint.setStyle(Paint.Style.FILL);
|
||||
+ val colorStr = android.os.SystemProperties.get("persist.sys.phh.fod_color", "00ff00");
|
||||
+ try {
|
||||
+ val parsedColor = Color.parseColor("#" + colorStr);
|
||||
+ val r = (parsedColor shr 16) and 0xff;
|
||||
+ val g = (parsedColor shr 8) and 0xff;
|
||||
+ val b = (parsedColor shr 0) and 0xff;
|
||||
+ paint.setARGB(255, r, g, b);
|
||||
+ } catch(t: Throwable) {
|
||||
+ Log.d("PHH", "Failed parsing color #" + colorStr, t);
|
||||
+ }
|
||||
+ var canvas: Canvas? = null
|
||||
+ try {
|
||||
+ canvas = p0.lockCanvas();
|
||||
+ Log.d("PHH", "Surface dimensions ${canvas.getWidth()*1.0f} ${canvas.getHeight()*1.0f}")
|
||||
+ canvas.drawOval(RectF(overlayParams.sensorBounds), paint);
|
||||
+ } finally {
|
||||
+ // Make sure the surface is never left in a bad state.
|
||||
+ if (canvas != null) {
|
||||
+ p0.unlockCanvasAndPost(canvas);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ currentOnIlluminatedRunnable?.run()
|
||||
+ }
|
||||
+
|
||||
+ override fun surfaceChanged(p0: SurfaceHolder, p1: Int, p2: Int, p3: Int) {
|
||||
+ Log.d("PHH", "Got surface size $p1 $p2 $p3")
|
||||
+ }
|
||||
+
|
||||
+ override fun surfaceDestroyed(p0: SurfaceHolder) {
|
||||
+ Log.d("PHH", "Surface destroyed!")
|
||||
+ }
|
||||
+ })
|
||||
+ mySurfaceView.holder.setFormat(PixelFormat.RGBA_8888)
|
||||
+
|
||||
+ }
|
||||
|
||||
// Use expanded overlay when feature flag is true, set by UdfpsViewController
|
||||
var useExpandedOverlay: Boolean = false
|
||||
@@ -67,6 +132,8 @@ class UdfpsView(
|
||||
/** Parameters that affect the position and size of the overlay. */
|
||||
var overlayParams = UdfpsOverlayParams()
|
||||
|
||||
+ var dimUpdate: (Float) -> Unit = {}
|
||||
+
|
||||
/** Debug message. */
|
||||
var debugMessage: String? = null
|
||||
set(value) {
|
||||
@@ -147,15 +214,168 @@ class UdfpsView(
|
||||
!(animationViewController?.shouldPauseAuth() ?: false)
|
||||
}
|
||||
|
||||
+ fun goodixCmd(id: Int) {
|
||||
+ val goodixSvc = IGoodixFingerprintDaemon.getService()
|
||||
+ if(goodixSvc != null) {
|
||||
+ goodixSvc.sendCommand(id, ArrayList(), { returnCode, resultData -> {
|
||||
+ Log.e("PHH-Enroll", "Goodix send command returned code "+ returnCode);
|
||||
+ }});
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ val asusGhbmOnAchieved = "/sys/class/drm/ghbm_on_achieved"
|
||||
+ var hasAsusGhbm = File(asusGhbmOnAchieved).exists()
|
||||
+ var samsungActualMaskBrightness = "/sys/class/lcd/panel/actual_mask_brightness"
|
||||
+ val hasSamsungMask = File(samsungActualMaskBrightness).exists()
|
||||
+ var fodFileObserver: FileObserver? = null
|
||||
+
|
||||
+ val xiaomiDispParam = "/sys/class/mi_display/disp-DSI-0/disp_param"
|
||||
+ var hasXiaomiLhbm = File(xiaomiDispParam).exists()
|
||||
+
|
||||
+ private val handlerThread = HandlerThread("UDFPS").also { it.start() }
|
||||
+ val myHandler = Handler(handlerThread.looper)
|
||||
+
|
||||
+ // This file contain current hbm value
|
||||
+ val nubiaHbmState = "/sys/kernel/lcd_enhance/hbm_state"
|
||||
+ var hasNubiaHbm = File(nubiaHbmState).exists()
|
||||
+
|
||||
fun configureDisplay(onDisplayConfigured: Runnable) {
|
||||
isDisplayConfigured = true
|
||||
animationViewController?.onDisplayConfiguring()
|
||||
mUdfpsDisplayMode?.enable(onDisplayConfigured)
|
||||
+
|
||||
+ mySurfaceView.setVisibility(VISIBLE)
|
||||
+ Log.d("PHH", "setting surface visible!")
|
||||
+
|
||||
+ val brightnessFiles = listOf(
|
||||
+ File("/sys/class/backlight/panel/brightness"),
|
||||
+ File("/sys/class/backlight/panel0-backlight/brightness"),
|
||||
+ File("/sys/devices/platform/soc/soc:mtk_leds/leds/lcd-backlight/brightness")
|
||||
+ )
|
||||
+ val maxBrightnessFiles = listOf(
|
||||
+ File("/sys/class/backlight/panel/max_brightness"),
|
||||
+ File("/sys/class/backlight/panel0-backlight/max_brightness"),
|
||||
+ File("/sys/devices/platform/soc/soc:mtk_leds/leds/lcd-backlight/max_brightness")
|
||||
+ )
|
||||
+
|
||||
+ var brightness: Double = 0.0
|
||||
+ var maxBrightness: Double = 0.0
|
||||
+ var bmFilesExist: Boolean = false
|
||||
+
|
||||
+ brightnessFiles.zip(maxBrightnessFiles) {bFile, mFile ->
|
||||
+ if (bFile.exists() && mFile.exists()) {
|
||||
+ bmFilesExist = true
|
||||
+ brightness = bFile.readText().toDouble()
|
||||
+ maxBrightness = mFile.readText().toDouble()
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ val dim = if (bmFilesExist) {
|
||||
+ 1.0 - Math.pow( (brightness / maxBrightness), 1/2.3);
|
||||
+ } else {
|
||||
+ 0.0
|
||||
+ }
|
||||
+
|
||||
+ // Assume HBM is max brightness
|
||||
+ Log.d("PHH-Enroll", "Brightness is $brightness / $maxBrightness, setting dim to $dim")
|
||||
+ if (hasAsusGhbm) {
|
||||
+ dimUpdate(dim.toFloat())
|
||||
+ }
|
||||
+ if (hasSamsungMask) {
|
||||
+ dimUpdate(dim.toFloat())
|
||||
+ }
|
||||
+
|
||||
+ if(android.os.SystemProperties.get("ro.vendor.build.fingerprint").contains("ASUS")) {
|
||||
+ goodixCmd(200001)
|
||||
+ }
|
||||
+
|
||||
+ if(hasXiaomiLhbm){
|
||||
+ Log.d("PHH-Enroll", "Xiaomi scenario in UdfpsView reached!")
|
||||
+ mySurfaceView.setVisibility(INVISIBLE)
|
||||
+
|
||||
+ IXiaomiFingerprint.getService().extCmd(android.os.SystemProperties.getInt("persist.phh.xiaomi.fod.enrollment.id", 4), 1);
|
||||
+ var res = ITouchFeature.getService().setTouchMode(0, 10, 1);
|
||||
+ if(res != 0){
|
||||
+ Log.d("PHH-Enroll", "SetTouchMode 10,1 was NOT executed successfully. Res is " + res)
|
||||
+ }
|
||||
+
|
||||
+ myHandler.postDelayed({
|
||||
+ var ret200 = ITouchFeature.getService().setTouchMode(0, 10, 1);
|
||||
+
|
||||
+ if(ret200 != 0){
|
||||
+ Log.d("PHH-Enroll", "myHandler.postDelayed 200ms -SetTouchMode was NOT executed successfully. Ret is " + ret200)
|
||||
+ }
|
||||
+
|
||||
+ myHandler.postDelayed({
|
||||
+ Log.d("PHH-Enroll", "myHandler.postDelayed 600ms - line prior to setTouchMode 10,0")
|
||||
+ var ret600 = ITouchFeature.getService().setTouchMode(0, 10, 0);
|
||||
+
|
||||
+ if(ret600 != 0){
|
||||
+ Log.d("PHH-Enroll", "myHandler.postDelayed 600ms -SetTouchMode 10,0 was NOT executed successfully. Ret is " + ret600)
|
||||
+ }
|
||||
+ }, 600)
|
||||
+ }, 200)
|
||||
+ }
|
||||
+ if(hasNubiaHbm) {
|
||||
+ Log.d("PHH-Enroll", "Nubia scenario in UdfpsView reached!")
|
||||
+ File(nubiaHbmState).writeText("4095")
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
fun unconfigureDisplay() {
|
||||
isDisplayConfigured = false
|
||||
animationViewController?.onDisplayUnconfigured()
|
||||
mUdfpsDisplayMode?.disable(null /* onDisabled */)
|
||||
+
|
||||
+ if (hasAsusGhbm) {
|
||||
+ fodFileObserver = object: FileObserver(asusGhbmOnAchieved, FileObserver.MODIFY) {
|
||||
+ override fun onEvent(event: Int, path: String): Unit {
|
||||
+ Log.d("PHH-Enroll", "Asus ghbm event")
|
||||
+ try {
|
||||
+ val spotOn = File(asusGhbmOnAchieved).readText().toInt()
|
||||
+ if(spotOn == 0) {
|
||||
+ dimUpdate(0.0f)
|
||||
+ fodFileObserver?.stopWatching()
|
||||
+ fodFileObserver = null
|
||||
+ }
|
||||
+ } catch(e: Exception) {
|
||||
+ Log.d("PHH-Enroll", "Failed dimpdate off", e)
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ fodFileObserver?.startWatching();
|
||||
+ } else if (hasSamsungMask) {
|
||||
+ fodFileObserver = object: FileObserver(asusGhbmOnAchieved, FileObserver.MODIFY) {
|
||||
+ override fun onEvent(event: Int, path: String): Unit {
|
||||
+ Log.d("PHH-Enroll", "samsung mask brightness event")
|
||||
+ try {
|
||||
+ val spotOn = File(samsungActualMaskBrightness).readText().toInt()
|
||||
+ if(spotOn == 0) {
|
||||
+ dimUpdate(0.0f)
|
||||
+ fodFileObserver?.stopWatching()
|
||||
+ fodFileObserver = null
|
||||
+ }
|
||||
+ } catch(e: Exception) {
|
||||
+ Log.d("PHH-Enroll", "Failed dimpdate off", e)
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ fodFileObserver?.startWatching();
|
||||
+ } else if(hasXiaomiLhbm) {
|
||||
+ IXiaomiFingerprint.getService().extCmd(android.os.SystemProperties.getInt("persist.phh.xiaomi.fod.enrollment.id", 4), 0);
|
||||
+ ITouchFeature.getService().setTouchMode(0, 10, 0);
|
||||
+ } else if(hasNubiaHbm) {
|
||||
+ Log.d("PHH-Enroll", "Nubia Restore brightness")
|
||||
+ File(nubiaHbmState).writeText(File("/sys/class/backlight/panel0-backlight/brightness").readText())
|
||||
+ } else {
|
||||
+ dimUpdate(0.0f)
|
||||
+ }
|
||||
+
|
||||
+ mySurfaceView.setVisibility(INVISIBLE)
|
||||
+ Log.d("PHH", "setting surface invisible!")
|
||||
+ if(android.os.SystemProperties.get("ro.vendor.build.fingerprint").contains("ASUS")) {
|
||||
+ goodixCmd(200003)
|
||||
+ }
|
||||
}
|
||||
}
|
||||
diff --git a/services/core/Android.bp b/services/core/Android.bp
|
||||
index c4239779425f..9b928082a380 100644
|
||||
--- a/services/core/Android.bp
|
||||
+++ b/services/core/Android.bp
|
||||
@@ -190,6 +190,11 @@ java_library_static {
|
||||
// HIDL
|
||||
"vendor.mediatek.hardware.mtkpower-V1.1-java",
|
||||
"vendor.samsung.hardware.sysinput-V1.2-java",
|
||||
+ "vendor.goodix.hardware.biometrics.fingerprint-V2.1-java",
|
||||
+ "vendor.samsung.hardware.biometrics.fingerprint-V3.0-java",
|
||||
+ "vendor.oplus.hardware.biometrics.fingerprint-V2.1-java",
|
||||
+ "vendor.oppo.hardware.biometrics.fingerprint-V2.1-java",
|
||||
+ "vendor.xiaomi.hardware.fingerprintextension-V1.0-java",
|
||||
],
|
||||
javac_shard_size: 50,
|
||||
javacflags: [
|
||||
diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
index c692f5f9472c..8194fbc2ac9e 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
@@ -78,6 +78,25 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
+import android.hardware.display.DisplayManager;
|
||||
+
|
||||
+import android.graphics.Point;
|
||||
+import android.text.TextUtils;
|
||||
+import android.util.DisplayMetrics;
|
||||
+import java.io.BufferedReader;
|
||||
+import java.io.File;
|
||||
+import java.io.FileReader;
|
||||
+import java.io.PrintWriter;
|
||||
+
|
||||
+import android.os.FileObserver;
|
||||
+import android.os.Build;
|
||||
+
|
||||
+import vendor.samsung.hardware.biometrics.fingerprint.V3_0.ISehBiometricsFingerprint;
|
||||
+import vendor.goodix.hardware.biometrics.fingerprint.V2_1.IGoodixFingerprintDaemon;
|
||||
+import vendor.samsung.hardware.sysinput.V1_0.ISehSysInputDev;
|
||||
+
|
||||
+import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint;
|
||||
+
|
||||
/**
|
||||
* System service that provides an interface for authenticating with biometrics and
|
||||
* PIN/pattern/password to BiometricPrompt and lock screen.
|
||||
@@ -96,6 +115,11 @@ public class AuthService extends SystemService {
|
||||
@VisibleForTesting
|
||||
final IAuthService.Stub mImpl;
|
||||
|
||||
+ private FileObserver fodFileObserver = null;
|
||||
+ private ISehBiometricsFingerprint mSamsungFingerprint = null;
|
||||
+
|
||||
+ private IXiaomiFingerprint mXiaomiFingerprint = null;
|
||||
+
|
||||
/**
|
||||
* Class for injecting dependencies into AuthService.
|
||||
* TODO(b/141025588): Replace with a dependency injection framework (e.g. Guice, Dagger).
|
||||
@@ -655,11 +679,11 @@ public class AuthService extends SystemService {
|
||||
final int firstApiLevel = SystemProperties.getInt(SYSPROP_FIRST_API_LEVEL, 0);
|
||||
final int apiLevel = SystemProperties.getInt(SYSPROP_API_LEVEL, firstApiLevel);
|
||||
String[] configStrings = mInjector.getConfiguration(getContext());
|
||||
- if (configStrings.length == 0 && apiLevel <= Build.VERSION_CODES.R) {
|
||||
+ if (configStrings.length == 0) {
|
||||
// For backwards compatibility with R where biometrics could work without being
|
||||
// configured in config_biometric_sensors. In the absence of a vendor provided
|
||||
// configuration, we assume the weakest biometric strength (i.e. convenience).
|
||||
- Slog.w(TAG, "Found R vendor partition without config_biometric_sensors");
|
||||
+ Slog.w(TAG, "Found vendor partition without config_biometric_sensors");
|
||||
configStrings = generateRSdkCompatibleConfiguration();
|
||||
}
|
||||
hidlConfigs = new SensorConfig[configStrings.length];
|
||||
@@ -674,6 +698,102 @@ public class AuthService extends SystemService {
|
||||
registerAuthenticators(hidlConfigs);
|
||||
|
||||
mInjector.publishBinderService(this, mImpl);
|
||||
+ try {
|
||||
+ mSamsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
+ android.util.Log.e("PHH", "Got samsung fingerprint HAL");
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.e("PHH", "Failed getting Samsung fingerprint HAL", e);
|
||||
+ }
|
||||
+ try {
|
||||
+ mXiaomiFingerprint = IXiaomiFingerprint.getService();
|
||||
+ android.util.Log.e("PHH", "Got xiaomi fingerprint HAL");
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.e("PHH", "Failed getting xiaomi fingerprint HAL", e);
|
||||
+ }
|
||||
+ if(samsungHasCmd("fod_enable") && mSamsungFingerprint != null) {
|
||||
+ samsungCmd("fod_enable,1,1,0");
|
||||
+ String actualMaskBrightnessPath = "/sys/class/lcd/panel/actual_mask_brightness";
|
||||
+ android.util.Log.e("PHH-Enroll", "Reading actual brightness file gives " + readFile(actualMaskBrightnessPath));
|
||||
+ fodFileObserver = new FileObserver(actualMaskBrightnessPath, FileObserver.MODIFY) {
|
||||
+ @Override
|
||||
+ public void onEvent(int event, String path) {
|
||||
+ String actualMask = readFile(actualMaskBrightnessPath);
|
||||
+ try {
|
||||
+ mSamsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
+ } catch(Exception e) {}
|
||||
+ Slog.d("PHH-Enroll", "New actual mask brightness is " + actualMask);
|
||||
+ try {
|
||||
+ int eventReq = 0;
|
||||
+ if("0".equals(actualMask)) {
|
||||
+ eventReq = 1; //released
|
||||
+ } else {
|
||||
+ eventReq = 2; //pressed
|
||||
+ }
|
||||
+ if(mSamsungFingerprint != null) {
|
||||
+ mSamsungFingerprint.sehRequest(22 /* SEM_FINGER_STATE */, eventReq, new java.util.ArrayList<Byte>(),
|
||||
+ (int retval, java.util.ArrayList<Byte> out) -> {} );
|
||||
+ }
|
||||
+ } catch(Exception e) {
|
||||
+ Slog.d("PHH-Enroll", "Failed setting samsung event for mask observer", e);
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ fodFileObserver.startWatching();
|
||||
+ }
|
||||
+
|
||||
+ String asusGhbmOnAchieved = "/sys/class/drm/ghbm_on_achieved";
|
||||
+ if( (new File(asusGhbmOnAchieved)).exists()) {
|
||||
+ fodFileObserver = new FileObserver(asusGhbmOnAchieved, FileObserver.MODIFY) {
|
||||
+ boolean wasOn = false;
|
||||
+ @Override
|
||||
+ public void onEvent(int event, String path) {
|
||||
+ String spotOn = readFile(asusGhbmOnAchieved);
|
||||
+ if("1".equals(spotOn)) {
|
||||
+ if(!wasOn) {
|
||||
+ try {
|
||||
+ IGoodixFingerprintDaemon goodixDaemon = IGoodixFingerprintDaemon.getService();
|
||||
+
|
||||
+ //Send UI ready
|
||||
+ goodixDaemon.sendCommand(200002, new java.util.ArrayList<Byte>(), (returnCode, resultData) -> {
|
||||
+ Slog.e(TAG, "Goodix send command touch pressed returned code "+ returnCode);
|
||||
+ });
|
||||
+ } catch(Throwable t) {
|
||||
+ Slog.d("PHH-Enroll", "Failed sending goodix command", t);
|
||||
+ }
|
||||
+ }
|
||||
+ wasOn = true;
|
||||
+ } else {
|
||||
+ wasOn = false;
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ fodFileObserver.startWatching();
|
||||
+ }
|
||||
+
|
||||
+ String xiaomiFodPressedStatusPath = "/sys/class/touch/touch_dev/fod_press_status";
|
||||
+ if(new File(xiaomiFodPressedStatusPath).exists() && mXiaomiFingerprint != null) {
|
||||
+ fodFileObserver = new FileObserver(xiaomiFodPressedStatusPath, FileObserver.MODIFY) {
|
||||
+ @Override
|
||||
+ public void onEvent(int event, String path) {
|
||||
+ String isFodPressed = readFile(xiaomiFodPressedStatusPath);
|
||||
+ Slog.d("PHH-Enroll", "Fod pressed status: " + isFodPressed);
|
||||
+ Slog.d("PHH-Enroll", "Within xiaomi scenario for FOD");
|
||||
+
|
||||
+ try {
|
||||
+ if("0".equals(isFodPressed)) {
|
||||
+ Slog.d("PHH-Enroll", "Fod un-pressed!");
|
||||
+ mXiaomiFingerprint.extCmd(android.os.SystemProperties.getInt("phh.xiaomi.fod.enrollment.id", 4), 0);
|
||||
+ } else if("1".equals(isFodPressed)) {
|
||||
+ Slog.d("PHH-Enroll", "Fod pressed!");
|
||||
+ mXiaomiFingerprint.extCmd(android.os.SystemProperties.getInt("phh.xiaomi.fod.enrollment.id", 4), 1);
|
||||
+ }
|
||||
+ } catch(Exception e) {
|
||||
+ Slog.d("PHH-Enroll", "Failed Xiaomi async extcmd", e);
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ fodFileObserver.startWatching();
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -797,18 +917,123 @@ public class AuthService extends SystemService {
|
||||
? modality : (modality & ~BiometricAuthenticator.TYPE_CREDENTIAL);
|
||||
}
|
||||
|
||||
+ private int[] dynamicUdfpsProps() {
|
||||
+ DisplayManager mDM = (DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE);
|
||||
+ Point displayRealSize = new Point();
|
||||
+ DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
+ mDM.getDisplay(0).getRealSize(displayRealSize);
|
||||
+ mDM.getDisplay(0).getMetrics(displayMetrics);
|
||||
+
|
||||
+ if(readFile("/sys/class/fingerprint/fingerprint/position") != null) {
|
||||
+ try {
|
||||
+ ISehSysInputDev s = ISehSysInputDev.getService();
|
||||
+ s.getTspFodInformation(0, (a, b) -> {
|
||||
+ Slog.d("PHH-Enroll", "TspFod info " + a + ", " + b);
|
||||
+ });
|
||||
+ s.getTspFodPosition(0, (a, b) -> {
|
||||
+ Slog.d("PHH-Enroll", "TspFod info " + a + ", " + b);
|
||||
+ });
|
||||
+ }catch(Throwable t) {
|
||||
+ Slog.d("PHH-Enroll", "heya ", t);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ android.util.Log.d("PHH", "Samsung fingerprint");
|
||||
+ String[] fodPositionArray = readFile("/sys/class/fingerprint/fingerprint/position").split(",");
|
||||
+ float bottomMM = Float.parseFloat(fodPositionArray[0]);
|
||||
+ float areaSizeMM = Float.parseFloat(fodPositionArray[5]);
|
||||
+ float heightMM = Float.parseFloat(fodPositionArray[2]);
|
||||
+ float bottomInch = bottomMM * 0.0393700787f;
|
||||
+ float areaSizeInch = areaSizeMM * 0.0393700787f;
|
||||
+ float heightInch = heightMM * 0.0393700787f;
|
||||
+ int bottomPx = (int)(bottomInch * displayMetrics.ydpi);
|
||||
+ int areaSizePx = (int)(areaSizeInch * displayMetrics.ydpi);
|
||||
+ int midDistPx = (int)(areaSizeInch * displayMetrics.ydpi / 2.0f);
|
||||
+
|
||||
+ float mW = areaSizePx/2;
|
||||
+ float mH = areaSizePx/2;
|
||||
+ float mX = displayRealSize.x/2;
|
||||
+ //float mY = displayRealSize.y - bottomPx - midDistPx;
|
||||
+ float mY = displayRealSize.y - (bottomInch * displayMetrics.ydpi) - (areaSizeInch * displayMetrics.ydpi / 2.0f);
|
||||
+
|
||||
+ samsungCmd(String.format("fod_rect,%d,%d,%d,%d", (int)(mX - mW/2), (int)(mY - mW/2), (int)(mX + mW/2), (int)(mY + mW/2)));
|
||||
+ Slog.d("PHH-Enroll", "Display real size is " + displayRealSize.y + ", dpy " + displayMetrics.ydpi);
|
||||
+
|
||||
+ int udfpsProps[] = new int[3];
|
||||
+ udfpsProps[0] = (int)mX;
|
||||
+ udfpsProps[1] = (int)mY;
|
||||
+ udfpsProps[2] = (int)mW;
|
||||
+
|
||||
+ try {
|
||||
+ mSamsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
+ Slog.d("PHH-Enroll", "Samsung ask for sensor status");
|
||||
+ mSamsungFingerprint.sehRequest(6, 0, new java.util.ArrayList(), (int retval, java.util.ArrayList<Byte> out) -> {
|
||||
+ Slog.d("PHH-Enroll", "Result is " + retval);
|
||||
+ for(int i=0; i<out.size(); i++) {
|
||||
+ Slog.d("PHH-Enroll", "\t" + i + ":" + out.get(i));
|
||||
+ }
|
||||
+ } );
|
||||
+ Slog.d("PHH-Enroll", "Samsung ask for sensor brightness value");
|
||||
+ mSamsungFingerprint.sehRequest(32, 0, new java.util.ArrayList(), (int retval, java.util.ArrayList<Byte> out) -> {
|
||||
+ Slog.d("PHH-Enroll", "Result is " + retval);
|
||||
+ for(int i=0; i<out.size(); i++) {
|
||||
+ Slog.d("PHH-Enroll", "\t" + i + ":" + out.get(i));
|
||||
+ }
|
||||
+ } );
|
||||
+
|
||||
+ } catch(Exception e) {
|
||||
+ Slog.d("PHH-Enroll", "Failed setting samsung3.0 fingerprint recognition", e);
|
||||
+ }
|
||||
+ return udfpsProps;
|
||||
+ }
|
||||
+
|
||||
+ if(android.os.SystemProperties.get("ro.vendor.build.fingerprint").contains("ASUS_I006D")) {
|
||||
+ int udfpsProps[] = new int[3];
|
||||
+ udfpsProps[0] = displayRealSize.x/2;
|
||||
+ udfpsProps[1] = 1741;
|
||||
+ udfpsProps[2] = 110;
|
||||
+ return udfpsProps;
|
||||
+ }
|
||||
+
|
||||
+ String fpLocation = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.location.X_Y");
|
||||
+ if(!TextUtils.isEmpty(fpLocation) && fpLocation.contains(",")) {
|
||||
+ int[] udfpsProps = new int[3];
|
||||
+ String[] coordinates = fpLocation.split(",");
|
||||
+ udfpsProps[0] = displayRealSize.x/2;
|
||||
+ udfpsProps[1] = Integer.parseInt(coordinates[1]) + 100;
|
||||
+
|
||||
+ String[] widthHeight = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.size.width_height").split(",");
|
||||
+
|
||||
+ udfpsProps[2] = (Integer.parseInt(widthHeight[0]) /2);
|
||||
+ return udfpsProps;
|
||||
+ }
|
||||
+
|
||||
+ return new int[0];
|
||||
+ }
|
||||
|
||||
private FingerprintSensorPropertiesInternal getHidlFingerprintSensorProps(int sensorId,
|
||||
@BiometricManager.Authenticators.Types int strength) {
|
||||
// The existence of config_udfps_sensor_props indicates that the sensor is UDFPS.
|
||||
- final int[] udfpsProps = getContext().getResources().getIntArray(
|
||||
+ int[] udfpsProps = getContext().getResources().getIntArray(
|
||||
com.android.internal.R.array.config_udfps_sensor_props);
|
||||
|
||||
// Non-empty workaroundLocations indicates that the sensor is SFPS.
|
||||
final List<SensorLocationInternal> workaroundLocations =
|
||||
getWorkaroundSensorProps(getContext());
|
||||
|
||||
- final boolean isUdfps = !ArrayUtils.isEmpty(udfpsProps);
|
||||
+ boolean isUdfps = !ArrayUtils.isEmpty(udfpsProps);
|
||||
+ if(!isUdfps) {
|
||||
+ try {
|
||||
+ udfpsProps = dynamicUdfpsProps();
|
||||
+ } catch(Throwable t) {
|
||||
+ Slog.e("PHH-Enroll", "Failed generating UDFPS props");
|
||||
+ }
|
||||
+ }
|
||||
+ isUdfps = !ArrayUtils.isEmpty(udfpsProps);
|
||||
+
|
||||
+ if(udfpsProps.length > 0) {
|
||||
+ Slog.d("PHH-Enroll", "Got udfps infos " + udfpsProps[0] + ", " + udfpsProps[1] + ", " + udfpsProps[2]);
|
||||
+ }
|
||||
|
||||
// config_is_powerbutton_fps indicates whether device has a power button fingerprint sensor.
|
||||
final boolean isPowerbuttonFps = getContext().getResources().getBoolean(
|
||||
@@ -876,4 +1101,67 @@ public class AuthService extends SystemService {
|
||||
componentInfo, resetLockoutRequiresHardwareAuthToken,
|
||||
resetLockoutRequiresChallenge);
|
||||
}
|
||||
+
|
||||
+ private static boolean samsungHasCmd(String cmd) {
|
||||
+ try {
|
||||
+ File f = new File("/sys/devices/virtual/sec/tsp/cmd_list");
|
||||
+ if(!f.exists()) return false;
|
||||
+
|
||||
+ android.util.Log.d("PHH", "Managed to grab cmd list, checking...");
|
||||
+ BufferedReader b = new BufferedReader(new FileReader(f));
|
||||
+ String line = null;
|
||||
+ while( (line = b.readLine()) != null) {
|
||||
+ if(line.equals(cmd)) return true;
|
||||
+ }
|
||||
+ android.util.Log.d("PHH", "... nope");
|
||||
+ return false;
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.d("PHH", "Failed reading cmd_list", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void samsungCmd(String cmd) {
|
||||
+ try {
|
||||
+ writeFile("/sys/devices/virtual/sec/tsp/cmd", cmd);
|
||||
+
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void writeFile(String path, String value) {
|
||||
+ try {
|
||||
+ PrintWriter writer = new PrintWriter(path, "UTF-8");
|
||||
+ writer.println(value);
|
||||
+ writer.close();
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.d("PHH", "Failed writing to " + path + ": " + value);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void writeFile(File file, String value) {
|
||||
+ try {
|
||||
+ PrintWriter writer = new PrintWriter(file, "UTF-8");
|
||||
+ writer.println(value);
|
||||
+ writer.close();
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.d("PHH", "Failed writing to " + file + ": " + value);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
|
||||
index 5ce0c8b384ef..df99478da964 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
|
||||
@@ -885,8 +885,9 @@ public class FingerprintService extends SystemService {
|
||||
filteredInstances = filterAvailableHalInstances(hidlSensors, aidlSensors);
|
||||
|
||||
final List<ServiceProvider> providers = new ArrayList<>();
|
||||
- providers.addAll(getHidlProviders(filteredInstances.first));
|
||||
providers.addAll(getAidlProviders(filteredInstances.second));
|
||||
+ if (providers.isEmpty())
|
||||
+ providers.addAll(getHidlProviders(filteredInstances.first));
|
||||
|
||||
return providers;
|
||||
});
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
From 6fcb492949bbf602572524213fb7eebd54b1be99 Mon Sep 17 00:00:00 2001
|
||||
From: ChonDoit <thphantomblog@gmail.com>
|
||||
Date: Thu, 24 Aug 2023 15:58:15 -0300
|
||||
Subject: [PATCH 37/50] Fix brightness slider curve for some devices
|
||||
|
||||
Some devices report max brightness as 2047 or 4095
|
||||
---
|
||||
.../settingslib/display/BrightnessUtils.java | 15 ++++++++++-----
|
||||
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/packages/SettingsLib/DisplayUtils/src/com/android/settingslib/display/BrightnessUtils.java b/packages/SettingsLib/DisplayUtils/src/com/android/settingslib/display/BrightnessUtils.java
|
||||
index 66ed10433459..f6820b4436fc 100644
|
||||
--- a/packages/SettingsLib/DisplayUtils/src/com/android/settingslib/display/BrightnessUtils.java
|
||||
+++ b/packages/SettingsLib/DisplayUtils/src/com/android/settingslib/display/BrightnessUtils.java
|
||||
@@ -16,13 +16,18 @@
|
||||
|
||||
package com.android.settingslib.display;
|
||||
|
||||
+import android.os.SystemProperties;
|
||||
import android.util.MathUtils;
|
||||
|
||||
+import com.android.internal.display.BrightnessSynchronizer;
|
||||
+
|
||||
/** Utility methods for calculating the display brightness. */
|
||||
public class BrightnessUtils {
|
||||
|
||||
+ public static final boolean LowGammaBrightness = Boolean.parseBoolean(SystemProperties.get("persist.sys.phh.low_gamma_brightness", "false"));
|
||||
+
|
||||
public static final int GAMMA_SPACE_MIN = 0;
|
||||
- public static final int GAMMA_SPACE_MAX = 65535;
|
||||
+ public static final int GAMMA_SPACE_MAX = LowGammaBrightness ? 255 : 65535;
|
||||
|
||||
// Hybrid Log Gamma constant values
|
||||
private static final float R = 0.5f;
|
||||
@@ -88,9 +93,8 @@ public class BrightnessUtils {
|
||||
// it shouldn't be out of bounds.
|
||||
final float normalizedRet = MathUtils.constrain(ret, 0, 12);
|
||||
|
||||
- // Re-normalize to the range [0, 1]
|
||||
- // in order to derive the correct setting value.
|
||||
- return MathUtils.lerp(min, max, normalizedRet / 12);
|
||||
+ return LowGammaBrightness ? MathUtils.constrain(BrightnessSynchronizer.brightnessIntToFloat(val),
|
||||
+ min, max) : MathUtils.lerp(min, max, normalizedRet / 12);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,6 +141,7 @@ public class BrightnessUtils {
|
||||
ret = A * MathUtils.log(normalizedVal - B) + C;
|
||||
}
|
||||
|
||||
- return Math.round(MathUtils.lerp(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, ret));
|
||||
+ return LowGammaBrightness ? BrightnessSynchronizer.brightnessFloatToInt(
|
||||
+ MathUtils.constrain(val, min, max)) : Math.round(MathUtils.lerp(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, ret));
|
||||
}
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 74de5557e6951ec79d2184bf41c2c4a2f7727dd0 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 18 Oct 2023 16:53:40 -0400
|
||||
Subject: [PATCH 38/50] Ignore cgroup creation errors
|
||||
|
||||
For old kernels who don't have those modern cgroups
|
||||
---
|
||||
core/jni/com_android_internal_os_Zygote.cpp | 2 ++
|
||||
services/core/java/com/android/server/am/ProcessList.java | 5 -----
|
||||
2 files changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
|
||||
index 56066b2d813c..4ee3e92910d0 100644
|
||||
--- a/core/jni/com_android_internal_os_Zygote.cpp
|
||||
+++ b/core/jni/com_android_internal_os_Zygote.cpp
|
||||
@@ -1806,10 +1806,12 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
|
||||
if (!is_system_server && getuid() == 0) {
|
||||
const int rc = createProcessGroup(uid, getpid());
|
||||
if (rc != 0) {
|
||||
+#if 0
|
||||
fail_fn(rc == -EROFS ? CREATE_ERROR("createProcessGroup failed, kernel missing "
|
||||
"CONFIG_CGROUP_CPUACCT?")
|
||||
: CREATE_ERROR("createProcessGroup(%d, %d) failed: %s", uid,
|
||||
/* pid= */ 0, strerror(-rc)));
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
|
||||
index b0f77604319b..23ca22fc73f4 100644
|
||||
--- a/services/core/java/com/android/server/am/ProcessList.java
|
||||
+++ b/services/core/java/com/android/server/am/ProcessList.java
|
||||
@@ -2433,14 +2433,9 @@ public final class ProcessList {
|
||||
// If we're not told to skip the process group creation, go create it.
|
||||
final int res = Process.createProcessGroup(uid, startResult.pid);
|
||||
if (res < 0) {
|
||||
- if (res == -OsConstants.ESRCH) {
|
||||
Slog.e(ActivityManagerService.TAG,
|
||||
"Unable to create process group for "
|
||||
+ app.processName + " (" + startResult.pid + ")");
|
||||
- } else {
|
||||
- throw new AssertionError("Unable to create process group for "
|
||||
- + app.processName + " (" + startResult.pid + ")");
|
||||
- }
|
||||
} else {
|
||||
app.mProcessGroupCreated = true;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
From f9abaf1a6cd90a580f9245434798e9325e037aae Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 18 Oct 2023 16:57:34 -0400
|
||||
Subject: [PATCH 39/50] Samsung tablets use SW_MACHINE_COVER rather than SW_LID
|
||||
|
||||
So check whether SW_MACHINE_COVER is declared, then use it
|
||||
Otherwise stick to SW_LID
|
||||
|
||||
Should fix https://github.com/phhusson/treble_experimentations/issues/2572
|
||||
---
|
||||
.../server/input/InputManagerService.java | 25 ++++++++++++++++---
|
||||
1 file changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
|
||||
index ff69719c9497..3b168b59423a 100644
|
||||
--- a/services/core/java/com/android/server/input/InputManagerService.java
|
||||
+++ b/services/core/java/com/android/server/input/InputManagerService.java
|
||||
@@ -369,6 +369,9 @@ public class InputManagerService extends IInputManager.Stub
|
||||
/** Switch code: Microphone. When set, the mic is muted. */
|
||||
public static final int SW_MUTE_DEVICE = 0x0e;
|
||||
|
||||
+ /** Switch code: Cover. When set, the cover is closed. */
|
||||
+ public static final int SW_MACHINE_COVER = 0x10;
|
||||
+
|
||||
public static final int SW_LID_BIT = 1 << SW_LID;
|
||||
public static final int SW_TABLET_MODE_BIT = 1 << SW_TABLET_MODE;
|
||||
public static final int SW_KEYPAD_SLIDE_BIT = 1 << SW_KEYPAD_SLIDE;
|
||||
@@ -380,6 +383,8 @@ public class InputManagerService extends IInputManager.Stub
|
||||
SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_JACK_PHYSICAL_INSERT_BIT | SW_LINEOUT_INSERT_BIT;
|
||||
public static final int SW_CAMERA_LENS_COVER_BIT = 1 << SW_CAMERA_LENS_COVER;
|
||||
public static final int SW_MUTE_DEVICE_BIT = 1 << SW_MUTE_DEVICE;
|
||||
+ public static final int SW_MACHINE_COVER_BIT = 1 << SW_MACHINE_COVER;
|
||||
+ private int mSwForLid = SW_LID;
|
||||
|
||||
// The following are layer numbers used for z-ordering the input overlay layers on the display.
|
||||
// This is used for ordering layers inside {@code DisplayContent#getInputOverlayLayer()}.
|
||||
@@ -488,6 +493,16 @@ public class InputManagerService extends IInputManager.Stub
|
||||
mWiredAccessoryCallbacks = callbacks;
|
||||
}
|
||||
|
||||
+ private void checkForSwMachineCover() {
|
||||
+ int machineCoverState = getSwitchState(-1 /* deviceId */, InputDevice.SOURCE_ANY, SW_MACHINE_COVER);
|
||||
+ if (machineCoverState != KEY_STATE_UNKNOWN) {
|
||||
+ android.util.Log.e("PHH", "Found a SW_MACHINE_COVER. Use this instead of SW_LID");
|
||||
+ mSwForLid = SW_MACHINE_COVER;
|
||||
+ } else {
|
||||
+ android.util.Log.e("PHH", "Not found a SW_MACHINE_COVER");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
void registerLidSwitchCallbackInternal(@NonNull LidSwitchCallback callback) {
|
||||
synchronized (mLidSwitchLock) {
|
||||
mLidSwitchCallbacks.add(callback);
|
||||
@@ -496,7 +511,8 @@ public class InputManagerService extends IInputManager.Stub
|
||||
// state will be reported as KEY_STATE_UNKNOWN. The callback will be triggered in
|
||||
// systemRunning().
|
||||
if (mSystemReady) {
|
||||
- boolean lidOpen = getSwitchState(-1 /* deviceId */, InputDevice.SOURCE_ANY, SW_LID)
|
||||
+ checkForSwMachineCover();
|
||||
+ boolean lidOpen = getSwitchState(-1 /* deviceId */, InputDevice.SOURCE_ANY, mSwForLid)
|
||||
== KEY_STATE_UP;
|
||||
callback.notifyLidSwitchChanged(0 /* whenNanos */, lidOpen);
|
||||
}
|
||||
@@ -534,7 +550,8 @@ public class InputManagerService extends IInputManager.Stub
|
||||
|
||||
// Send the initial lid switch state to any callback registered before the system was
|
||||
// ready.
|
||||
- int switchState = getSwitchState(-1 /* deviceId */, InputDevice.SOURCE_ANY, SW_LID);
|
||||
+ checkForSwMachineCover();
|
||||
+ int switchState = getSwitchState(-1 /* deviceId */, InputDevice.SOURCE_ANY, mSwForLid);
|
||||
for (int i = 0; i < mLidSwitchCallbacks.size(); i++) {
|
||||
LidSwitchCallback callback = mLidSwitchCallbacks.get(i);
|
||||
callback.notifyLidSwitchChanged(0 /* whenNanos */, switchState == KEY_STATE_UP);
|
||||
@@ -2328,8 +2345,8 @@ public class InputManagerService extends IInputManager.Stub
|
||||
+ ", mask=" + Integer.toHexString(switchMask));
|
||||
}
|
||||
|
||||
- if ((switchMask & SW_LID_BIT) != 0) {
|
||||
- final boolean lidOpen = ((switchValues & SW_LID_BIT) == 0);
|
||||
+ if ((switchMask & (1 << mSwForLid)) != 0) {
|
||||
+ final boolean lidOpen = ((switchValues & (1 << mSwForLid)) == 0);
|
||||
synchronized (mLidSwitchLock) {
|
||||
if (mSystemReady) {
|
||||
for (int i = 0; i < mLidSwitchCallbacks.size(); i++) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
From 8f5b0fa613b9ca70fe63ec78a1b27b86b6650559 Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Ponces <ponces26@gmail.com>
|
||||
Date: Fri, 20 Oct 2023 09:26:19 +0000
|
||||
Subject: [PATCH 40/50] Revert "Removed IWLAN legacy mode support"
|
||||
|
||||
This reverts commit 2832dee607ab33eee688abea206f4adfcfc896f1.
|
||||
---
|
||||
.../java/android/telephony/ServiceState.java | 30 ++++++++++++-------
|
||||
1 file changed, 20 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
|
||||
index 74cfbea91e00..698a106582d3 100644
|
||||
--- a/telephony/java/android/telephony/ServiceState.java
|
||||
+++ b/telephony/java/android/telephony/ServiceState.java
|
||||
@@ -1213,8 +1213,13 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
/**
|
||||
* Initialize the service state. Set everything to the default value.
|
||||
+ *
|
||||
+ * @param legacyMode {@code true} if the device is on IWLAN legacy mode, where IWLAN is
|
||||
+ * considered as a RAT on WWAN {@link NetworkRegistrationInfo}. {@code false} if the device
|
||||
+ * is on AP-assisted mode, where IWLAN should be reported through WLAN.
|
||||
+ * {@link NetworkRegistrationInfo}.
|
||||
*/
|
||||
- private void init() {
|
||||
+ private void init(boolean legacyMode) {
|
||||
if (DBG) Rlog.d(LOG_TAG, "init");
|
||||
mVoiceRegState = STATE_OUT_OF_SERVICE;
|
||||
mDataRegState = STATE_OUT_OF_SERVICE;
|
||||
@@ -1246,11 +1251,13 @@ public class ServiceState implements Parcelable {
|
||||
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
|
||||
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
||||
.build());
|
||||
- addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
|
||||
- .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
|
||||
- .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
|
||||
- .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
||||
- .build());
|
||||
+ if (!legacyMode) {
|
||||
+ addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
|
||||
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
|
||||
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
|
||||
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
||||
+ .build());
|
||||
+ }
|
||||
}
|
||||
mOperatorAlphaLongRaw = null;
|
||||
mOperatorAlphaShortRaw = null;
|
||||
@@ -1259,11 +1266,11 @@ public class ServiceState implements Parcelable {
|
||||
}
|
||||
|
||||
public void setStateOutOfService() {
|
||||
- init();
|
||||
+ init(true);
|
||||
}
|
||||
|
||||
public void setStateOff() {
|
||||
- init();
|
||||
+ init(true);
|
||||
mVoiceRegState = STATE_POWER_OFF;
|
||||
mDataRegState = STATE_POWER_OFF;
|
||||
}
|
||||
@@ -1271,11 +1278,14 @@ public class ServiceState implements Parcelable {
|
||||
/**
|
||||
* Set the service state to out-of-service
|
||||
*
|
||||
+ * @param legacyMode {@code true} if the device is on IWLAN legacy mode, where IWLAN is
|
||||
+ * considered as a RAT on WWAN {@link NetworkRegistrationInfo}. {@code false} if the device
|
||||
+ * is on AP-assisted mode, where IWLAN should be reported through WLAN.
|
||||
* @param powerOff {@code true} if this is a power off case (i.e. Airplane mode on).
|
||||
* @hide
|
||||
*/
|
||||
- public void setOutOfService(boolean powerOff) {
|
||||
- init();
|
||||
+ public void setOutOfService(boolean legacyMode, boolean powerOff) {
|
||||
+ init(legacyMode);
|
||||
if (powerOff) {
|
||||
mVoiceRegState = STATE_POWER_OFF;
|
||||
mDataRegState = STATE_POWER_OFF;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 48a560ce8e35aa566b5e7c13942b8ce665a1bddc Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 30 Oct 2023 19:25:27 -0400
|
||||
Subject: [PATCH 41/50] Add a prop to use linear backlight control
|
||||
|
||||
---
|
||||
.../settings/brightness/BrightnessController.java | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
|
||||
index bc915b0147f1..97e7b1f630c3 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
|
||||
@@ -361,9 +361,15 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
|
||||
: MetricsEvent.ACTION_BRIGHTNESS;
|
||||
minBacklight = mBrightnessMin;
|
||||
maxBacklight = mBrightnessMax;
|
||||
- final float valFloat = MathUtils.min(
|
||||
+ float valFloat = MathUtils.min(
|
||||
convertGammaToLinearFloat(value, minBacklight, maxBacklight),
|
||||
maxBacklight);
|
||||
+ if (android.os.SystemProperties.getBoolean("persist.sys.phh.linear_brightness", false)) {
|
||||
+ android.util.Log.e("PHH", "Linear brightness val " + value + " from " + minBacklight + " to " + maxBacklight + " makes " + valFloat);
|
||||
+ valFloat = value / 65536.0f;
|
||||
+ }
|
||||
+ final float finalValFloat = valFloat;
|
||||
+
|
||||
if (stopTracking) {
|
||||
// TODO(brightnessfloat): change to use float value instead.
|
||||
MetricsLogger.action(mContext, metric,
|
||||
@@ -374,7 +380,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
|
||||
if (!tracking) {
|
||||
AsyncTask.execute(new Runnable() {
|
||||
public void run() {
|
||||
- mDisplayManager.setBrightness(mDisplayId, valFloat);
|
||||
+ mDisplayManager.setBrightness(mDisplayId, finalValFloat);
|
||||
}
|
||||
});
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
From 0fd828ddefa89e1f5499650a2be3f45cfd527cd4 Mon Sep 17 00:00:00 2001
|
||||
From: MrHereAndThere <38396158+boydaihungst@users.noreply.github.com>
|
||||
Date: Fri, 17 Nov 2023 09:22:29 +0700
|
||||
Subject: [PATCH 42/50] fix(fod): Extra Dim overlap fod overlay
|
||||
|
||||
Extra Dim will set display panel brightness to lowest value possible, which will also effect FOD overlay.
|
||||
---
|
||||
.../systemui/biometrics/UdfpsController.java | 20 +++++++++++++++++--
|
||||
1 file changed, 18 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
|
||||
index 19b67b5f3def..ef5e4f617138 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
|
||||
@@ -42,6 +42,7 @@ import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayControllerCallback;
|
||||
+import android.hardware.display.ColorDisplayManager;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
@@ -184,6 +185,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
@NonNull private final UdfpsUtils mUdfpsUtils;
|
||||
@NonNull private final InputManager mInputManager;
|
||||
@NonNull private final UdfpsKeyguardAccessibilityDelegate mUdfpsKeyguardAccessibilityDelegate;
|
||||
+ @NonNull private final ColorDisplayManager mColorDisplayManager;
|
||||
+ private boolean mIgnoreExtraDim;
|
||||
private final boolean mIgnoreRefreshRate;
|
||||
|
||||
// Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
|
||||
@@ -898,7 +901,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
@NonNull UdfpsUtils udfpsUtils,
|
||||
@NonNull KeyguardFaceAuthInteractor keyguardFaceAuthInteractor,
|
||||
@NonNull UdfpsKeyguardAccessibilityDelegate udfpsKeyguardAccessibilityDelegate,
|
||||
- @NonNull Provider<UdfpsKeyguardViewModels> udfpsKeyguardViewModelsProvider) {
|
||||
+ @NonNull Provider<UdfpsKeyguardViewModels> udfpsKeyguardViewModelsProvider,
|
||||
+ @NonNull ColorDisplayManager colorDisplayManager) {
|
||||
mContext = context;
|
||||
mExecution = execution;
|
||||
mVibrator = vibrator;
|
||||
@@ -945,6 +949,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
mUdfpsUtils = udfpsUtils;
|
||||
mInputManager = inputManager;
|
||||
mUdfpsKeyguardAccessibilityDelegate = udfpsKeyguardAccessibilityDelegate;
|
||||
+ mColorDisplayManager = colorDisplayManager;
|
||||
|
||||
mTouchProcessor = mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)
|
||||
? singlePointerTouchProcessor : null;
|
||||
@@ -1025,7 +1030,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
|
||||
private void showUdfpsOverlay(@NonNull UdfpsControllerOverlay overlay) {
|
||||
mExecution.assertIsMainThread();
|
||||
-
|
||||
+ mIgnoreExtraDim = mColorDisplayManager.isReduceBrightColorsActivated();
|
||||
+ if (mIgnoreExtraDim) {
|
||||
+ Log.d(TAG, "Current extra dim state (showUdfpsOverlay): " + mIgnoreExtraDim);
|
||||
+ }
|
||||
mOverlay = overlay;
|
||||
final int requestReason = overlay.getRequestReason();
|
||||
if (requestReason == REASON_AUTH_KEYGUARD
|
||||
@@ -1244,6 +1252,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
return;
|
||||
}
|
||||
if (isOptical()) {
|
||||
+ if (mIgnoreExtraDim) {
|
||||
+ mColorDisplayManager.setReduceBrightColorsActivated(false);
|
||||
+ Log.d(TAG, "Extra dim disabled");
|
||||
+ }
|
||||
mLatencyTracker.onActionStart(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
|
||||
}
|
||||
// Refresh screen timeout and boost process priority if possible.
|
||||
@@ -1330,6 +1342,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
mActivePointerId = -1;
|
||||
mAcquiredReceived = false;
|
||||
if (mOnFingerDown) {
|
||||
+ if (mIgnoreExtraDim && isOptical()) {
|
||||
+ mColorDisplayManager.setReduceBrightColorsActivated(true);
|
||||
+ Log.d(TAG, "Extra dim restored");
|
||||
+ }
|
||||
if (mAlternateTouchProvider != null) {
|
||||
mBiometricExecutor.execute(() -> {
|
||||
mAlternateTouchProvider.onPointerUp(requestId);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
From c266c21c6731a1f337851a20b562c4df20e5482c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 10 Dec 2023 18:04:49 -0500
|
||||
Subject: [PATCH 43/50] Add support for Samsung full brightness on their AIDL
|
||||
HAL
|
||||
|
||||
---
|
||||
services/core/Android.bp | 4 ++
|
||||
.../android/server/lights/LightsService.java | 40 +++++++++++++++++++
|
||||
2 files changed, 44 insertions(+)
|
||||
|
||||
diff --git a/services/core/Android.bp b/services/core/Android.bp
|
||||
index 9b928082a380..6caa4b4ffd8d 100644
|
||||
--- a/services/core/Android.bp
|
||||
+++ b/services/core/Android.bp
|
||||
@@ -195,6 +195,10 @@ java_library_static {
|
||||
"vendor.oplus.hardware.biometrics.fingerprint-V2.1-java",
|
||||
"vendor.oppo.hardware.biometrics.fingerprint-V2.1-java",
|
||||
"vendor.xiaomi.hardware.fingerprintextension-V1.0-java",
|
||||
+
|
||||
+ //AIDL
|
||||
+ "vendor.samsung.hardware.biometrics.fingerprint-V1-java",
|
||||
+ "vendor.samsung.hardware.light-V1-java",
|
||||
],
|
||||
javac_shard_size: 50,
|
||||
javacflags: [
|
||||
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
|
||||
index caf9eba7d9a8..04ad3114d2ac 100644
|
||||
--- a/services/core/java/com/android/server/lights/LightsService.java
|
||||
+++ b/services/core/java/com/android/server/lights/LightsService.java
|
||||
@@ -45,8 +45,10 @@ import com.android.internal.util.DumpUtils;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.server.SystemService;
|
||||
|
||||
+import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
+import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -54,6 +56,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
+import vendor.samsung.hardware.light.ISehLights;
|
||||
+
|
||||
public class LightsService extends SystemService {
|
||||
static final String TAG = "LightsService";
|
||||
static final boolean DEBUG = false;
|
||||
@@ -64,6 +68,10 @@ public class LightsService extends SystemService {
|
||||
@Nullable
|
||||
private final Supplier<ILights> mVintfLights;
|
||||
|
||||
+ @Nullable
|
||||
+ private ISehLights mSamsungLights;
|
||||
+ private int mSamsungMaxBrightness;
|
||||
+
|
||||
@VisibleForTesting
|
||||
final LightsManagerBinderService mManagerService;
|
||||
|
||||
@@ -298,6 +306,17 @@ public class LightsService extends SystemService {
|
||||
int brightnessInt = BrightnessSynchronizer.brightnessFloatToInt(brightness);
|
||||
|
||||
if(mHwLight.id == 0) {
|
||||
+ if (mSamsungLights != null && SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
|
||||
+ HwLightState lightState = new HwLightState(); // don't care
|
||||
+ try {
|
||||
+ int v = (int)Math.round(brightness * mSamsungMaxBrightness);
|
||||
+ mSamsungLights.setLightState(mHwLight.id, lightState, v);
|
||||
+ Slog.e("PHH", "Set sammy brightness to " + v);
|
||||
+ } catch(Throwable t) {
|
||||
+ Slog.e("PHH", "Failed setting samsung brightness", t);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
|
||||
if(fp.matches(".*astarqlte.*")) {
|
||||
int newBrightness = brightnessInt;
|
||||
@@ -513,6 +532,27 @@ public class LightsService extends SystemService {
|
||||
mH = new Handler(looper);
|
||||
mVintfLights = service.get() != null ? service : null;
|
||||
|
||||
+ if (service.get() != null) {
|
||||
+ try {
|
||||
+ mSamsungLights = ISehLights.Stub.asInterface(service.get().asBinder().getExtension());
|
||||
+ mSamsungMaxBrightness = 510;
|
||||
+
|
||||
+ ArrayList<File> paths = new ArrayList<>();
|
||||
+ paths.add(new File("/sys/class/backlight/panel/max_brightness"));
|
||||
+ paths.add(new File("/sys/class/backlight/panel0-backlight/max_brightness"));
|
||||
+ paths.add(new File("/sys/devices/platform/soc/soc:mtk_leds/leds/lcd-backlight/max_brightness"));
|
||||
+ for(File f: paths) {
|
||||
+ try {
|
||||
+ List<String> lines = Files.readAllLines(f.toPath());
|
||||
+ mSamsungMaxBrightness = Integer.parseInt(lines.get(0));
|
||||
+ Slog.e("PHH", "" + f + " gave us " + mSamsungMaxBrightness);
|
||||
+ } catch(Throwable t) {}
|
||||
+ }
|
||||
+ } catch(Throwable t) {
|
||||
+ Slog.e("PHH", "Failed getting Samsung lights AIDL", t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
populateAvailableLights(context);
|
||||
mManagerService = new LightsManagerBinderService();
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0910830f2b078cf055e5d092b28f729678e61d47 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 26 Jan 2024 06:40:49 -0500
|
||||
Subject: [PATCH 44/50] Fix Xiaomi custom vendors implementing fingerprint
|
||||
properly
|
||||
|
||||
---
|
||||
.../src/com/android/systemui/biometrics/UdfpsView.kt | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
index 4377dd7e70a7..91053b2c5f8e 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
@@ -229,8 +229,13 @@ class UdfpsView(
|
||||
val hasSamsungMask = File(samsungActualMaskBrightness).exists()
|
||||
var fodFileObserver: FileObserver? = null
|
||||
|
||||
- val xiaomiDispParam = "/sys/class/mi_display/disp-DSI-0/disp_param"
|
||||
- var hasXiaomiLhbm = File(xiaomiDispParam).exists()
|
||||
+ val xiaomiDispParam = "/sys/class/mi_display/disp-DSI-0/disp_param"
|
||||
+ var hasXiaomiLhbm = try {
|
||||
+ val xiaomiFingerprintService = IXiaomiFingerprint.getService()
|
||||
+ File(xiaomiDispParam).exists() && xiaomiFingerprintService != null
|
||||
+ } catch(e: Exception) {
|
||||
+ false
|
||||
+ }
|
||||
|
||||
private val handlerThread = HandlerThread("UDFPS").also { it.start() }
|
||||
val myHandler = Handler(handlerThread.looper)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
From 4b2a6be76cfb9edfdbe040c0af98872a96e27195 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 28 Jan 2024 19:16:13 -0500
|
||||
Subject: [PATCH 45/50] Also override UDFPS infos on AIDL fingerprints --
|
||||
needed for FP on S24
|
||||
|
||||
---
|
||||
.../server/biometrics/AuthService.java | 6 ++---
|
||||
.../fingerprint/aidl/FingerprintProvider.java | 26 ++++++++++++++++++-
|
||||
2 files changed, 28 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
index 8194fbc2ac9e..1fffe381a34f 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
@@ -917,8 +917,8 @@ public class AuthService extends SystemService {
|
||||
? modality : (modality & ~BiometricAuthenticator.TYPE_CREDENTIAL);
|
||||
}
|
||||
|
||||
- private int[] dynamicUdfpsProps() {
|
||||
- DisplayManager mDM = (DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE);
|
||||
+ static public int[] dynamicUdfpsProps(Context ctxt) {
|
||||
+ DisplayManager mDM = (DisplayManager) ctxt.getSystemService(Context.DISPLAY_SERVICE);
|
||||
Point displayRealSize = new Point();
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
mDM.getDisplay(0).getRealSize(displayRealSize);
|
||||
@@ -1024,7 +1024,7 @@ public class AuthService extends SystemService {
|
||||
boolean isUdfps = !ArrayUtils.isEmpty(udfpsProps);
|
||||
if(!isUdfps) {
|
||||
try {
|
||||
- udfpsProps = dynamicUdfpsProps();
|
||||
+ udfpsProps = dynamicUdfpsProps(getContext());
|
||||
} catch(Throwable t) {
|
||||
Slog.e("PHH-Enroll", "Failed generating UDFPS props");
|
||||
}
|
||||
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java
|
||||
index 3eef411c86d8..c58f6477b072 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java
|
||||
@@ -37,6 +37,7 @@ import android.hardware.biometrics.common.ComponentInfo;
|
||||
import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||
import android.hardware.biometrics.fingerprint.PointerContext;
|
||||
import android.hardware.biometrics.fingerprint.SensorProps;
|
||||
+import android.hardware.biometrics.fingerprint.SensorLocation;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintAuthenticateOptions;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
@@ -190,9 +191,32 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
||||
BiometricsProtoEnums.MODALITY_FINGERPRINT, new BiometricNotificationImpl());
|
||||
|
||||
final List<SensorLocationInternal> workaroundLocations = getWorkaroundSensorProps(context);
|
||||
+android.util.Log.e("PHH-Enroll", "Poping AIDL fp provider");
|
||||
|
||||
for (SensorProps prop : props) {
|
||||
final int sensorId = prop.commonProps.sensorId;
|
||||
+ SensorLocation[] locations = prop.sensorLocations;
|
||||
+
|
||||
+ android.util.Log.e("PHH-Enroll", "Got fp props -- pre");
|
||||
+ for(SensorLocation loc: locations) {
|
||||
+ android.util.Log.e("PHH-Enroll", " - " + loc.sensorLocationX + ", " + loc.sensorLocationY + ", " +loc.sensorRadius + ", disp =" + loc.display + ", shape " + loc.sensorShape);
|
||||
+ }
|
||||
+ if (locations.length == 1 && locations[0].sensorLocationX == 0) {
|
||||
+ int[] otherValues = com.android.server.biometrics.AuthService.dynamicUdfpsProps(context);
|
||||
+ if (otherValues.length > 0) {
|
||||
+ SensorLocation loc = new SensorLocation();
|
||||
+ loc.sensorLocationX = otherValues[0];
|
||||
+ loc.sensorLocationY = otherValues[1];
|
||||
+ loc.sensorRadius = otherValues[2];
|
||||
+ locations[0] = loc;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ android.util.Log.e("PHH-Enroll", "Got fp props -- post");
|
||||
+ for(SensorLocation loc: locations) {
|
||||
+ android.util.Log.e("PHH-Enroll", " - " + loc.sensorLocationX + ", " + loc.sensorLocationY + ", " +loc.sensorRadius + ", disp =" + loc.display + ", shape " + loc.sensorShape);
|
||||
+ }
|
||||
+
|
||||
|
||||
final List<ComponentInfoInternal> componentInfo = new ArrayList<>();
|
||||
if (prop.commonProps.componentInfo != null) {
|
||||
@@ -212,7 +236,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
||||
prop.halControlsIllumination,
|
||||
true /* resetLockoutRequiresHardwareAuthToken */,
|
||||
!workaroundLocations.isEmpty() ? workaroundLocations :
|
||||
- Arrays.stream(prop.sensorLocations).map(location ->
|
||||
+ Arrays.stream(locations).map(location ->
|
||||
new SensorLocationInternal(
|
||||
location.display,
|
||||
location.sensorLocationX,
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From fc8191dbed0bceef0a4824a4aa3ca2e4a5260ac1 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 29 Jan 2024 17:06:34 -0500
|
||||
Subject: [PATCH 46/50] Try catch the Xiaomi calls
|
||||
|
||||
---
|
||||
.../src/com/android/systemui/biometrics/UdfpsView.kt | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
index 91053b2c5f8e..d47a7d2068fa 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
@@ -298,14 +298,16 @@ class UdfpsView(
|
||||
Log.d("PHH-Enroll", "Xiaomi scenario in UdfpsView reached!")
|
||||
mySurfaceView.setVisibility(INVISIBLE)
|
||||
|
||||
- IXiaomiFingerprint.getService().extCmd(android.os.SystemProperties.getInt("persist.phh.xiaomi.fod.enrollment.id", 4), 1);
|
||||
- var res = ITouchFeature.getService().setTouchMode(0, 10, 1);
|
||||
+ try {
|
||||
+ IXiaomiFingerprint.getService().extCmd(android.os.SystemProperties.getInt("persist.phh.xiaomi.fod.enrollment.id", 4), 1);
|
||||
+ } catch(t: Throwable) {}
|
||||
+ var res = try { ITouchFeature.getService().setTouchMode(0, 10, 1) } catch(t: Throwable){ -1 }
|
||||
if(res != 0){
|
||||
Log.d("PHH-Enroll", "SetTouchMode 10,1 was NOT executed successfully. Res is " + res)
|
||||
}
|
||||
|
||||
myHandler.postDelayed({
|
||||
- var ret200 = ITouchFeature.getService().setTouchMode(0, 10, 1);
|
||||
+ var ret200 = try { ITouchFeature.getService().setTouchMode(0, 10, 1); } catch(t: Throwable) { -1 }
|
||||
|
||||
if(ret200 != 0){
|
||||
Log.d("PHH-Enroll", "myHandler.postDelayed 200ms -SetTouchMode was NOT executed successfully. Ret is " + ret200)
|
||||
@@ -313,7 +315,7 @@ class UdfpsView(
|
||||
|
||||
myHandler.postDelayed({
|
||||
Log.d("PHH-Enroll", "myHandler.postDelayed 600ms - line prior to setTouchMode 10,0")
|
||||
- var ret600 = ITouchFeature.getService().setTouchMode(0, 10, 0);
|
||||
+ var ret600 = try { ITouchFeature.getService().setTouchMode(0, 10, 0); } catch(t: Throwable) { -1 }
|
||||
|
||||
if(ret600 != 0){
|
||||
Log.d("PHH-Enroll", "myHandler.postDelayed 600ms -SetTouchMode 10,0 was NOT executed successfully. Ret is " + ret600)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 1c4acee244781abae9e9655deff9c3c3e8010c46 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 29 Jan 2024 17:06:45 -0500
|
||||
Subject: [PATCH 47/50] Typo in observing Samsung brightness
|
||||
|
||||
---
|
||||
.../SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
index d47a7d2068fa..9f1fde7f2e3f 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
|
||||
@@ -353,7 +353,7 @@ class UdfpsView(
|
||||
};
|
||||
fodFileObserver?.startWatching();
|
||||
} else if (hasSamsungMask) {
|
||||
- fodFileObserver = object: FileObserver(asusGhbmOnAchieved, FileObserver.MODIFY) {
|
||||
+ fodFileObserver = object: FileObserver(samsungActualMaskBrightness, FileObserver.MODIFY) {
|
||||
override fun onEvent(event: Int, path: String): Unit {
|
||||
Log.d("PHH-Enroll", "samsung mask brightness event")
|
||||
try {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From f217e6629f2684cad122eaa9fb551e94291a8a56 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 29 Jan 2024 17:07:07 -0500
|
||||
Subject: [PATCH 48/50] Add Samsung sysinput
|
||||
|
||||
---
|
||||
services/core/Android.bp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/services/core/Android.bp b/services/core/Android.bp
|
||||
index 6caa4b4ffd8d..db3279814f21 100644
|
||||
--- a/services/core/Android.bp
|
||||
+++ b/services/core/Android.bp
|
||||
@@ -197,6 +197,7 @@ java_library_static {
|
||||
"vendor.xiaomi.hardware.fingerprintextension-V1.0-java",
|
||||
|
||||
//AIDL
|
||||
+ "vendor.samsung.hardware.sysinput-V1-java",
|
||||
"vendor.samsung.hardware.biometrics.fingerprint-V1-java",
|
||||
"vendor.samsung.hardware.light-V1-java",
|
||||
],
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
From a0b5d0f01c5181af0e7b0e0048c92e61cd9d58af Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 29 Jan 2024 17:15:38 -0500
|
||||
Subject: [PATCH 49/50] Bunch of FOD stuff -- commonize refreshing the
|
||||
services, start supporting AIDL Samsung
|
||||
|
||||
---
|
||||
.../server/biometrics/AuthService.java | 157 +++++++++++++++---
|
||||
1 file changed, 138 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
index 1fffe381a34f..a51fe5cdd66a 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/AuthService.java
|
||||
@@ -45,6 +45,7 @@ import android.hardware.biometrics.IAuthService;
|
||||
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
|
||||
import android.hardware.biometrics.IBiometricService;
|
||||
import android.hardware.biometrics.IBiometricServiceReceiver;
|
||||
+import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||
import android.hardware.biometrics.IInvalidationCallback;
|
||||
import android.hardware.biometrics.ITestSession;
|
||||
import android.hardware.biometrics.ITestSessionCallback;
|
||||
@@ -94,6 +95,7 @@ import android.os.Build;
|
||||
import vendor.samsung.hardware.biometrics.fingerprint.V3_0.ISehBiometricsFingerprint;
|
||||
import vendor.goodix.hardware.biometrics.fingerprint.V2_1.IGoodixFingerprintDaemon;
|
||||
import vendor.samsung.hardware.sysinput.V1_0.ISehSysInputDev;
|
||||
+import vendor.samsung.hardware.biometrics.fingerprint.ISehFingerprint;
|
||||
|
||||
import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint;
|
||||
|
||||
@@ -117,6 +119,8 @@ public class AuthService extends SystemService {
|
||||
|
||||
private FileObserver fodFileObserver = null;
|
||||
private ISehBiometricsFingerprint mSamsungFingerprint = null;
|
||||
+ private ISehFingerprint mSamsungFingerprintAidl = null;
|
||||
+ private vendor.samsung.hardware.sysinput.ISehSysInputDev mSamsungSysinputAidl = null;
|
||||
|
||||
private IXiaomiFingerprint mXiaomiFingerprint = null;
|
||||
|
||||
@@ -670,6 +674,101 @@ public class AuthService extends SystemService {
|
||||
* └── for (s : p.sensors)
|
||||
* └── BiometricService.registerAuthenticator(s)
|
||||
*/
|
||||
+
|
||||
+ private static void samsungSysinputCommand(String arg) {
|
||||
+ try {
|
||||
+ android.util.Log.e("PHH-Enroll", "SysinputCommand " + arg);
|
||||
+ var name = "default";
|
||||
+ var fqName = vendor.samsung.hardware.sysinput.ISehSysInputDev.DESCRIPTOR + "/" + name;
|
||||
+ var b = android.os.Binder.allowBlocking(android.os.ServiceManager.waitForDeclaredService(fqName));
|
||||
+ var samsungSysinputAidl = vendor.samsung.hardware.sysinput.ISehSysInputDev.Stub.asInterface(b);
|
||||
+ Thread.sleep(100);
|
||||
+ samsungSysinputAidl.setProperty(1 /*DEFAULT_TSP*/, 18, arg);
|
||||
+ android.util.Log.e("PHH-Enroll", "Done SysinputCommand");
|
||||
+ } catch(Throwable t) {
|
||||
+ android.util.Log.e("PHH-Enroll", "SysinputCommand", t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void refreshVendorServices() {
|
||||
+ try {
|
||||
+ mSamsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
+ android.util.Log.e("PHH", "Got samsung fingerprint HAL");
|
||||
+ } catch(Exception e) {
|
||||
+ if (e instanceof java.util.NoSuchElementException) {
|
||||
+ android.util.Log.e("PHH", "Failed getting Samsung fingerprint HAL, doesn't exist");
|
||||
+ } else {
|
||||
+ android.util.Log.e("PHH", "Failed getting Samsung fingerprint HAL", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ final String name = "default";
|
||||
+ final String fqName = IFingerprint.DESCRIPTOR + "/" + name;
|
||||
+ final IBinder fpBinder = Binder.allowBlocking(ServiceManager.waitForDeclaredService(fqName));
|
||||
+ //final IFingerprint fp = IFingerprint.Stub.asInterface(fpBinder);
|
||||
+ mSamsungFingerprintAidl = ISehFingerprint.Stub.asInterface(fpBinder.getExtension());
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.e("PHH", "Failed getting Samsung fingerprint AIDL HAL", e);
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ final String name = "default";
|
||||
+ final String fqName = vendor.samsung.hardware.sysinput.ISehSysInputDev.DESCRIPTOR + "/" + name;
|
||||
+ final IBinder b = Binder.allowBlocking(ServiceManager.waitForDeclaredService(fqName));
|
||||
+ mSamsungSysinputAidl = vendor.samsung.hardware.sysinput.ISehSysInputDev.Stub.asInterface(b);
|
||||
+ mSamsungSysinputAidl.registerCallback(new vendor.samsung.hardware.sysinput.ISehSysInputCallback.Stub() {
|
||||
+ @Override
|
||||
+ public void onReportInformation(int type, String data) {
|
||||
+ android.util.Log.e("PHH", "Received Sysinput Report Information " +type + ", " + data);
|
||||
+ }
|
||||
+ @Override
|
||||
+ public void onReportRawData(int type, int count, int[] data) {
|
||||
+ android.util.Log.e("PHH", "Received Sysinput Report RawData " + type + ", " + count);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getInterfaceVersion() {
|
||||
+ return this.VERSION;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getInterfaceHash() {
|
||||
+ return this.HASH;
|
||||
+ }
|
||||
+ });
|
||||
+ String res;
|
||||
+ res = mSamsungSysinputAidl.getProperty(1, 1);
|
||||
+ Thread.sleep(100);
|
||||
+ android.util.Log.e("PHH", "Got Samsung sysinput aidl feature " + res);
|
||||
+ res = mSamsungSysinputAidl.getProperty(1, 2);
|
||||
+ Thread.sleep(100);
|
||||
+ android.util.Log.e("PHH", "Got Samsung sysinput aidl cmd_list " + res);
|
||||
+ res = mSamsungSysinputAidl.getProperty(1, 3);
|
||||
+ Thread.sleep(100);
|
||||
+ android.util.Log.e("PHH", "Got Samsung sysinput aidl scrub_pos " + res);
|
||||
+ res = mSamsungSysinputAidl.getProperty(1, 4);
|
||||
+ Thread.sleep(100);
|
||||
+ android.util.Log.e("PHH", "Got Samsung sysinput aidl fod_info " + res);
|
||||
+ res = mSamsungSysinputAidl.getProperty(1, 5);
|
||||
+ Thread.sleep(100);
|
||||
+ android.util.Log.e("PHH", "Got Samsung sysinput aidl fod_pos " + res);
|
||||
+ } catch(Exception e) {
|
||||
+ android.util.Log.e("PHH", "Failed getting Samsung fingerprint AIDL HAL", e);
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ mXiaomiFingerprint = IXiaomiFingerprint.getService();
|
||||
+ android.util.Log.e("PHH", "Got xiaomi fingerprint HAL");
|
||||
+ } catch(Exception e) {
|
||||
+ if (e instanceof java.util.NoSuchElementException) {
|
||||
+ android.util.Log.e("PHH", "Failed getting xiaomi fingerprint HAL, doesn't exist");
|
||||
+ } else {
|
||||
+ android.util.Log.e("PHH", "Failed getting xiaomi fingerprint HAL", e);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void onStart() {
|
||||
mBiometricService = mInjector.getBiometricService();
|
||||
@@ -697,20 +796,11 @@ public class AuthService extends SystemService {
|
||||
// Registers HIDL and AIDL authenticators, but only HIDL configs need to be provided.
|
||||
registerAuthenticators(hidlConfigs);
|
||||
|
||||
+ refreshVendorServices();
|
||||
+
|
||||
mInjector.publishBinderService(this, mImpl);
|
||||
- try {
|
||||
- mSamsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
- android.util.Log.e("PHH", "Got samsung fingerprint HAL");
|
||||
- } catch(Exception e) {
|
||||
- android.util.Log.e("PHH", "Failed getting Samsung fingerprint HAL", e);
|
||||
- }
|
||||
- try {
|
||||
- mXiaomiFingerprint = IXiaomiFingerprint.getService();
|
||||
- android.util.Log.e("PHH", "Got xiaomi fingerprint HAL");
|
||||
- } catch(Exception e) {
|
||||
- android.util.Log.e("PHH", "Failed getting xiaomi fingerprint HAL", e);
|
||||
- }
|
||||
- if(samsungHasCmd("fod_enable") && mSamsungFingerprint != null) {
|
||||
+ //samsungSysinputCommand("fod_icon_visible,1");
|
||||
+ if(samsungHasCmd("fod_enable") && (mSamsungFingerprint != null || mSamsungFingerprintAidl != null)) {
|
||||
samsungCmd("fod_enable,1,1,0");
|
||||
String actualMaskBrightnessPath = "/sys/class/lcd/panel/actual_mask_brightness";
|
||||
android.util.Log.e("PHH-Enroll", "Reading actual brightness file gives " + readFile(actualMaskBrightnessPath));
|
||||
@@ -718,9 +808,7 @@ public class AuthService extends SystemService {
|
||||
@Override
|
||||
public void onEvent(int event, String path) {
|
||||
String actualMask = readFile(actualMaskBrightnessPath);
|
||||
- try {
|
||||
- mSamsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
- } catch(Exception e) {}
|
||||
+ refreshVendorServices();
|
||||
Slog.d("PHH-Enroll", "New actual mask brightness is " + actualMask);
|
||||
try {
|
||||
int eventReq = 0;
|
||||
@@ -965,22 +1053,53 @@ public class AuthService extends SystemService {
|
||||
udfpsProps[2] = (int)mW;
|
||||
|
||||
try {
|
||||
- mSamsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
+ ISehBiometricsFingerprint samsungFingerprint = null;
|
||||
+ samsungFingerprint = ISehBiometricsFingerprint.getService();
|
||||
Slog.d("PHH-Enroll", "Samsung ask for sensor status");
|
||||
- mSamsungFingerprint.sehRequest(6, 0, new java.util.ArrayList(), (int retval, java.util.ArrayList<Byte> out) -> {
|
||||
+ samsungFingerprint.sehRequest(6, 0, new java.util.ArrayList(), (int retval, java.util.ArrayList<Byte> out) -> {
|
||||
Slog.d("PHH-Enroll", "Result is " + retval);
|
||||
for(int i=0; i<out.size(); i++) {
|
||||
Slog.d("PHH-Enroll", "\t" + i + ":" + out.get(i));
|
||||
}
|
||||
} );
|
||||
Slog.d("PHH-Enroll", "Samsung ask for sensor brightness value");
|
||||
- mSamsungFingerprint.sehRequest(32, 0, new java.util.ArrayList(), (int retval, java.util.ArrayList<Byte> out) -> {
|
||||
+ samsungFingerprint.sehRequest(32, 0, new java.util.ArrayList(), (int retval, java.util.ArrayList<Byte> out) -> {
|
||||
Slog.d("PHH-Enroll", "Result is " + retval);
|
||||
for(int i=0; i<out.size(); i++) {
|
||||
Slog.d("PHH-Enroll", "\t" + i + ":" + out.get(i));
|
||||
}
|
||||
} );
|
||||
|
||||
+ } catch(Exception e) {
|
||||
+ if (e instanceof java.util.NoSuchElementException) {
|
||||
+ Slog.d("PHH-Enroll", "Failed setting samsung3.0 fingerprint recognition, doesn't exist");
|
||||
+ } else {
|
||||
+ Slog.d("PHH-Enroll", "Failed setting samsung3.0 fingerprint recognition", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ final String name = "default";
|
||||
+ final String fqName = IFingerprint.DESCRIPTOR + "/" + name;
|
||||
+ final IBinder fpBinder = Binder.allowBlocking(ServiceManager.waitForDeclaredService(fqName));
|
||||
+ final IFingerprint fp = IFingerprint.Stub.asInterface(fpBinder);
|
||||
+ final ISehFingerprint fpaidl = ISehFingerprint.Stub.asInterface(fpBinder.getExtension());
|
||||
+
|
||||
+ Slog.d("PHH-Enroll", "Samsung ask for sensor status");
|
||||
+ vendor.samsung.hardware.biometrics.fingerprint.SehResult sehres = fpaidl.sehRequest(0, 6, 0, new byte[0]);
|
||||
+
|
||||
+ Slog.d("PHH-Enroll", "Result is " + sehres.retValue);
|
||||
+ for(int i=0; i<sehres.data.length; i++) {
|
||||
+ Slog.d("PHH-Enroll", "\t" + i + ":" + sehres.data[i]);
|
||||
+ }
|
||||
+
|
||||
+ Slog.d("PHH-Enroll", "Samsung ask for sensor brightness value");
|
||||
+ sehres = fpaidl.sehRequest(0, 32, 0, new byte[0]);
|
||||
+
|
||||
+ Slog.d("PHH-Enroll", "Result is " + sehres.retValue);
|
||||
+ for(int i=0; i<sehres.data.length; i++) {
|
||||
+ Slog.d("PHH-Enroll", "\t" + i + ":" + sehres.data[i]);
|
||||
+ }
|
||||
} catch(Exception e) {
|
||||
Slog.d("PHH-Enroll", "Failed setting samsung3.0 fingerprint recognition", e);
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
From b472b40193287d699072c94e37007a6840171e14 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 4 Feb 2024 18:01:07 -0500
|
||||
Subject: [PATCH 50/50] Some Samsung devices use SW_FLIP 0x15 rather than
|
||||
SW_MACHINE_COVER 0x10, so use that
|
||||
|
||||
---
|
||||
.../server/input/InputManagerService.java | 25 +++++++++++++------
|
||||
1 file changed, 18 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
|
||||
index 3b168b59423a..1e00f77f8877 100644
|
||||
--- a/services/core/java/com/android/server/input/InputManagerService.java
|
||||
+++ b/services/core/java/com/android/server/input/InputManagerService.java
|
||||
@@ -371,6 +371,8 @@ public class InputManagerService extends IInputManager.Stub
|
||||
|
||||
/** Switch code: Cover. When set, the cover is closed. */
|
||||
public static final int SW_MACHINE_COVER = 0x10;
|
||||
+ // Samsung
|
||||
+ public static final int SW_FLIP = 0x15;
|
||||
|
||||
public static final int SW_LID_BIT = 1 << SW_LID;
|
||||
public static final int SW_TABLET_MODE_BIT = 1 << SW_TABLET_MODE;
|
||||
@@ -494,13 +496,22 @@ public class InputManagerService extends IInputManager.Stub
|
||||
}
|
||||
|
||||
private void checkForSwMachineCover() {
|
||||
- int machineCoverState = getSwitchState(-1 /* deviceId */, InputDevice.SOURCE_ANY, SW_MACHINE_COVER);
|
||||
- if (machineCoverState != KEY_STATE_UNKNOWN) {
|
||||
- android.util.Log.e("PHH", "Found a SW_MACHINE_COVER. Use this instead of SW_LID");
|
||||
- mSwForLid = SW_MACHINE_COVER;
|
||||
- } else {
|
||||
- android.util.Log.e("PHH", "Not found a SW_MACHINE_COVER");
|
||||
- }
|
||||
+ int machineCoverState = getSwitchState(-1, InputDevice.SOURCE_ANY, SW_MACHINE_COVER);
|
||||
+ if (machineCoverState != KEY_STATE_UNKNOWN) {
|
||||
+ android.util.Log.e("PHH", "Found a SW_MACHINE_COVER. Use this instead of SW_LID");
|
||||
+ mSwForLid = SW_MACHINE_COVER;
|
||||
+ } else {
|
||||
+ android.util.Log.e("PHH", "Not found a SW_MACHINE_COVER");
|
||||
+ }
|
||||
+
|
||||
+ int flip = getSwitchState(-1, InputDevice.SOURCE_ANY, SW_FLIP);
|
||||
+ if (flip != KEY_STATE_UNKNOWN) {
|
||||
+ android.util.Log.e("PHH", "Found a SW_FLIP. Use this instead of SW_LID");
|
||||
+ mSwForLid = SW_FLIP;
|
||||
+ } else {
|
||||
+ android.util.Log.e("PHH", "Not found a SW_FLIP");
|
||||
+ }
|
||||
+ android.util.Log.e("PHH", "Switch state got " + machineCoverState + " and " + flip);
|
||||
}
|
||||
|
||||
void registerLidSwitchCallbackInternal(@NonNull LidSwitchCallback callback) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From 8d695b3a2448e132263dd993265e95361bbb8540 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 26 Oct 2022 18:02:18 -0400
|
||||
Subject: [PATCH] Restore back the behavior of isValid(): It is legal to have
|
||||
non-working BpfMap. Dont abort a whole process (system_server...) just
|
||||
because we cant access bpf map. Also add isOk to include the additional
|
||||
checks for newer kernel versions
|
||||
|
||||
Change-Id: Ie7815c186400614f0c6b483c04aa8971af348380
|
||||
---
|
||||
common/native/bpf_headers/include/bpf/BpfMap.h | 16 ++++++++++------
|
||||
1 file changed, 10 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/common/native/bpf_headers/include/bpf/BpfMap.h b/common/native/bpf_headers/include/bpf/BpfMap.h
|
||||
index 51e6d162..6d74ff3a 100644
|
||||
--- a/common/native/bpf_headers/include/bpf/BpfMap.h
|
||||
+++ b/common/native/bpf_headers/include/bpf/BpfMap.h
|
||||
@@ -54,21 +54,25 @@ class BpfMap {
|
||||
|
||||
private:
|
||||
void abortOnKeyOrValueSizeMismatch() {
|
||||
- if (!mMapFd.ok()) abort();
|
||||
- if (isAtLeastKernelVersion(4, 14, 0)) {
|
||||
- if (bpfGetFdKeySize(mMapFd) != sizeof(Key)) abort();
|
||||
- if (bpfGetFdValueSize(mMapFd) != sizeof(Value)) abort();
|
||||
- }
|
||||
+ if (!isOk()) abort();
|
||||
}
|
||||
|
||||
protected:
|
||||
// flag must be within BPF_OBJ_FLAG_MASK, ie. 0, BPF_F_RDONLY, BPF_F_WRONLY
|
||||
BpfMap<Key, Value>(const char* pathname, uint32_t flags) {
|
||||
mMapFd.reset(mapRetrieve(pathname, flags));
|
||||
- abortOnKeyOrValueSizeMismatch();
|
||||
}
|
||||
|
||||
public:
|
||||
+ bool isOk() {
|
||||
+ if (!mMapFd.ok()) return false;
|
||||
+ if (isAtLeastKernelVersion(4, 14, 0)) {
|
||||
+ if (bpfGetFdKeySize(mMapFd) != sizeof(Key)) return false;
|
||||
+ if (bpfGetFdValueSize(mMapFd) != sizeof(Value)) return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
explicit BpfMap<Key, Value>(const char* pathname) : BpfMap<Key, Value>(pathname, 0) {}
|
||||
|
||||
#ifdef BPF_MAP_MAKE_VISIBLE_FOR_TESTING
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From ab486c5b5de2e5041085d53e7a2326f1feaa0d66 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 14 Aug 2019 23:37:10 +0200
|
||||
Subject: [PATCH 01/11] On Samsung, we need to send a hack-message to HAL to
|
||||
get all Sensors
|
||||
|
||||
Change-Id: Id6a1fa48340de61c418493668e9abd22c2599376
|
||||
---
|
||||
services/sensorservice/SensorDevice.cpp | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
|
||||
index 10ca990f87..e603f6d404 100644
|
||||
--- a/services/sensorservice/SensorDevice.cpp
|
||||
+++ b/services/sensorservice/SensorDevice.cpp
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <cstddef>
|
||||
#include <thread>
|
||||
|
||||
+#include <android-base/properties.h>
|
||||
using namespace android::hardware::sensors;
|
||||
using android::util::ProtoOutputStream;
|
||||
|
||||
@@ -76,6 +77,8 @@ SensorDevice::SensorDevice() {
|
||||
}
|
||||
|
||||
void SensorDevice::initializeSensorList() {
|
||||
+ if(::android::base::GetBoolProperty("persist.sys.phh.samsung_sensors", false))
|
||||
+ setMode(5555);
|
||||
if (mHalWrapper == nullptr) {
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 97a662c58df57f93b584a4e23661d8385c3da910 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Thu, 22 Oct 2020 23:22:46 +0200
|
||||
Subject: [PATCH 02/11] Matching an input with a display uses uniqueId
|
||||
|
||||
Not all devices have a `location`, notably bluetooth devices.
|
||||
However, we might still want to associate them with a screen,
|
||||
so match them with uniqueId indeed.
|
||||
|
||||
This is useful to have bluetooth keyboard in desktop mode for instance.
|
||||
|
||||
Change-Id: Ifcbc8329d54386f58e013270d9888316c0f516b6
|
||||
---
|
||||
services/inputflinger/reader/InputDevice.cpp | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp
|
||||
index 0a64a1c4a8..425091805b 100644
|
||||
--- a/services/inputflinger/reader/InputDevice.cpp
|
||||
+++ b/services/inputflinger/reader/InputDevice.cpp
|
||||
@@ -264,7 +264,10 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
|
||||
mAssociatedDisplayUniqueId = std::nullopt;
|
||||
mAssociatedViewport = std::nullopt;
|
||||
// Find the display port that corresponds to the current input port.
|
||||
- const std::string& inputPort = mIdentifier.location;
|
||||
+ std::string inputPort = mIdentifier.location;
|
||||
+ if (inputPort.empty()) {
|
||||
+ inputPort = mIdentifier.uniqueId;
|
||||
+ }
|
||||
if (!inputPort.empty()) {
|
||||
const std::unordered_map<std::string, uint8_t>& ports =
|
||||
readerConfig.portAssociations;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From c5d33188f0bd7a4a0c58ca6c7b4eb8c9cb6a129c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 5 Jan 2021 23:44:00 +0100
|
||||
Subject: [PATCH 03/11] unshared_oob didn't exist in O/P, so detect its
|
||||
supported based on vndk version
|
||||
|
||||
---
|
||||
cmds/installd/migrate_legacy_obb_data.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmds/installd/migrate_legacy_obb_data.sh b/cmds/installd/migrate_legacy_obb_data.sh
|
||||
index 7399681c3e..9d5b73eae2 100644
|
||||
--- a/cmds/installd/migrate_legacy_obb_data.sh
|
||||
+++ b/cmds/installd/migrate_legacy_obb_data.sh
|
||||
@@ -18,7 +18,7 @@
|
||||
rm -rf /data/media/0/Android/obb/test_probe
|
||||
mkdir -p /data/media/0/Android/obb/
|
||||
touch /data/media/0/Android/obb/test_probe
|
||||
-if ! test -f /data/media/0/Android/obb/test_probe ; then
|
||||
+if ! test -f /data/media/0/Android/obb/test_probe || [ "$(adb shell getprop ro.vndk.version)" -le 28 ]; then
|
||||
log -p i -t migrate_legacy_obb_data "No support for 'unshared_obb'. Not migrating"
|
||||
rm -rf /data/media/0/Android/obb/test_probe
|
||||
exit 0
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 08477babecfbec09c82923246636cf1a7dd72361 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 31 Mar 2021 23:36:03 +0200
|
||||
Subject: [PATCH 04/11] Remove Samsung system permission on sensors
|
||||
|
||||
---
|
||||
libs/sensor/Sensor.cpp | 1 +
|
||||
libs/sensor/include/sensor/Sensor.h | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libs/sensor/Sensor.cpp b/libs/sensor/Sensor.cpp
|
||||
index b6ea77deb5..91807a8a53 100644
|
||||
--- a/libs/sensor/Sensor.cpp
|
||||
+++ b/libs/sensor/Sensor.cpp
|
||||
@@ -429,6 +429,7 @@ const String8& Sensor::getStringType() const {
|
||||
}
|
||||
|
||||
const String8& Sensor::getRequiredPermission() const {
|
||||
+ if (mRequiredPermission == "com.samsung.permission.SSENSOR") return mFakeRequiredPermission;
|
||||
return mRequiredPermission;
|
||||
}
|
||||
|
||||
diff --git a/libs/sensor/include/sensor/Sensor.h b/libs/sensor/include/sensor/Sensor.h
|
||||
index bae8a1380b..afaafb321e 100644
|
||||
--- a/libs/sensor/include/sensor/Sensor.h
|
||||
+++ b/libs/sensor/include/sensor/Sensor.h
|
||||
@@ -125,6 +125,7 @@ private:
|
||||
uint32_t mFifoMaxEventCount;
|
||||
String8 mStringType;
|
||||
String8 mRequiredPermission;
|
||||
+ String8 mFakeRequiredPermission;
|
||||
bool mRequiredPermissionRuntime = false;
|
||||
int32_t mRequiredAppOp;
|
||||
int32_t mMaxDelay;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From b80980ed739b0392fed65f61f02ea7ba73bdc17b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 12 Dec 2021 08:45:36 -0500
|
||||
Subject: [PATCH 05/11] Mark accelerometer input as sensor exclusively if there
|
||||
are ABS axis
|
||||
|
||||
The reason this is needed is that on -fucked up- Xiami Mi A2 Lite and
|
||||
Galaxy J8, the input device reporting power button/vol- reports ACCELEROMETER
|
||||
input prop.
|
||||
This leads to wrong timestamping ioctl, leading to crashes and broken UI
|
||||
|
||||
Change-Id: I491ab89724c908ef09a23a6427d24a8889bf806a
|
||||
---
|
||||
services/inputflinger/reader/EventHub.cpp | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
|
||||
index 44e80a732c..88dd11467b 100644
|
||||
--- a/services/inputflinger/reader/EventHub.cpp
|
||||
+++ b/services/inputflinger/reader/EventHub.cpp
|
||||
@@ -2339,7 +2339,13 @@ void EventHub::openDeviceLocked(const std::string& devicePath) {
|
||||
|
||||
// Check whether this device is an accelerometer.
|
||||
if (device->propBitmask.test(INPUT_PROP_ACCELEROMETER)) {
|
||||
- device->classes |= InputDeviceClass::SENSOR;
|
||||
+ bool hasAxis = false;
|
||||
+ for (int i = 0; i <= ABS_MAX; i++) {
|
||||
+ if (device->absBitmask.test(i)) hasAxis = true;
|
||||
+ }
|
||||
+ if(hasAxis) {
|
||||
+ device->classes |= InputDeviceClass::SENSOR;
|
||||
+ }
|
||||
}
|
||||
|
||||
// Check whether this device has switches.
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From f6b0d117f3f68d7008ba7942f41f39d66a7f2b9f Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 25 Mar 2022 05:37:56 -0400
|
||||
Subject: [PATCH 06/11] MIUI13 devices hide their vibrator HAL behind
|
||||
non-default name: "vibratorfeature"
|
||||
|
||||
---
|
||||
services/vibratorservice/VibratorHalController.cpp | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/services/vibratorservice/VibratorHalController.cpp b/services/vibratorservice/VibratorHalController.cpp
|
||||
index c1795f5c32..345016efd6 100644
|
||||
--- a/services/vibratorservice/VibratorHalController.cpp
|
||||
+++ b/services/vibratorservice/VibratorHalController.cpp
|
||||
@@ -59,6 +59,12 @@ std::shared_ptr<HalWrapper> connectHal(std::shared_ptr<CallbackScheduler> schedu
|
||||
return std::make_shared<AidlHalWrapper>(std::move(scheduler), aidlHal);
|
||||
}
|
||||
|
||||
+ aidlHal = waitForVintfService<Aidl::IVibrator>(String16("vibratorfeature"));
|
||||
+ if (aidlHal) {
|
||||
+ ALOGV("Successfully connected to Xiaomi Vibrator HAL AIDL service.");
|
||||
+ return std::make_shared<AidlHalWrapper>(std::move(scheduler), aidlHal);
|
||||
+ }
|
||||
+
|
||||
sp<V1_0::IVibrator> halV1_0 = V1_0::IVibrator::getService();
|
||||
if (halV1_0 == nullptr) {
|
||||
ALOGV("Vibrator HAL service not available.");
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
From 4ee277ea428976a6b737a3846249902f8621388c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 27 Dec 2021 18:00:43 -0500
|
||||
Subject: [PATCH 07/11] powermanager: Add support Samsung miscpower HAL
|
||||
|
||||
Several various configurations need to be supported:
|
||||
- Android Pie vendors have a android.hardware.power HIDL default + "miscpower"
|
||||
- Android Q vendors have default HIDL android.hardware.power +
|
||||
ISehMiscPower
|
||||
- Android R vendors have default AIDL android.hardware.power +
|
||||
ISehMiscPower
|
||||
|
||||
ISehMiscPower is always in addition to android.hardware.power, not as a
|
||||
substituion
|
||||
|
||||
Only tested configuration ATM is the latest one
|
||||
|
||||
Change-Id: I182a91ccb0a89f9d0d7d41f36eccab218b553bbc
|
||||
---
|
||||
include/powermanager/PowerHalLoader.h | 3 +
|
||||
include/powermanager/PowerHalWrapper.h | 35 +++++++++-
|
||||
services/powermanager/Android.bp | 2 +
|
||||
services/powermanager/PowerHalController.cpp | 16 +++--
|
||||
services/powermanager/PowerHalLoader.cpp | 17 ++++-
|
||||
services/powermanager/PowerHalWrapper.cpp | 70 +++++++++++++++++++
|
||||
.../CompositionEngine/Android.bp | 1 +
|
||||
7 files changed, 138 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/include/powermanager/PowerHalLoader.h b/include/powermanager/PowerHalLoader.h
|
||||
index e0384f31db..944c225ef8 100644
|
||||
--- a/include/powermanager/PowerHalLoader.h
|
||||
+++ b/include/powermanager/PowerHalLoader.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <android/hardware/power/1.2/IPower.h>
|
||||
#include <android/hardware/power/1.3/IPower.h>
|
||||
#include <android/hardware/power/IPower.h>
|
||||
+#include <vendor/samsung/hardware/miscpower/2.0/ISehMiscPower.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
@@ -36,6 +37,7 @@ public:
|
||||
static sp<hardware::power::V1_1::IPower> loadHidlV1_1();
|
||||
static sp<hardware::power::V1_2::IPower> loadHidlV1_2();
|
||||
static sp<hardware::power::V1_3::IPower> loadHidlV1_3();
|
||||
+ static sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> loadHidlSeh();
|
||||
|
||||
private:
|
||||
static std::mutex gHalMutex;
|
||||
@@ -44,6 +46,7 @@ private:
|
||||
static sp<hardware::power::V1_1::IPower> gHalHidlV1_1 GUARDED_BY(gHalMutex);
|
||||
static sp<hardware::power::V1_2::IPower> gHalHidlV1_2 GUARDED_BY(gHalMutex);
|
||||
static sp<hardware::power::V1_3::IPower> gHalHidlV1_3 GUARDED_BY(gHalMutex);
|
||||
+ static sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> gHalHidlSeh GUARDED_BY(gHalMutex);
|
||||
|
||||
static sp<hardware::power::V1_0::IPower> loadHidlV1_0Locked()
|
||||
EXCLUSIVE_LOCKS_REQUIRED(gHalMutex);
|
||||
diff --git a/include/powermanager/PowerHalWrapper.h b/include/powermanager/PowerHalWrapper.h
|
||||
index 8028aa86e1..fc3385fbe3 100644
|
||||
--- a/include/powermanager/PowerHalWrapper.h
|
||||
+++ b/include/powermanager/PowerHalWrapper.h
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <android/hardware/power/IPower.h>
|
||||
#include <android/hardware/power/IPowerHintSession.h>
|
||||
#include <android/hardware/power/Mode.h>
|
||||
+#include <vendor/samsung/hardware/miscpower/2.0/ISehMiscPower.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
@@ -206,7 +207,10 @@ protected:
|
||||
// Wrapper for the AIDL Power HAL.
|
||||
class AidlHalWrapper : public HalWrapper {
|
||||
public:
|
||||
- explicit AidlHalWrapper(sp<hardware::power::IPower> handle) : mHandle(std::move(handle)) {}
|
||||
+ explicit AidlHalWrapper(sp<hardware::power::IPower> handle,
|
||||
+ sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> sehHandle)
|
||||
+ : mHandle(std::move(handle)),
|
||||
+ mHandleSeh(std::move(sehHandle)) {}
|
||||
virtual ~AidlHalWrapper() = default;
|
||||
|
||||
virtual HalResult<void> setBoost(hardware::power::Boost boost, int32_t durationMs) override;
|
||||
@@ -221,6 +225,7 @@ private:
|
||||
std::mutex mBoostMutex;
|
||||
std::mutex mModeMutex;
|
||||
sp<hardware::power::IPower> mHandle;
|
||||
+ sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> mHandleSeh;
|
||||
// Android framework only sends boost upto DISPLAY_UPDATE_IMMINENT.
|
||||
// Need to increase the array size if more boost supported.
|
||||
std::array<std::atomic<HalSupport>,
|
||||
@@ -231,6 +236,34 @@ private:
|
||||
mModeSupportedArray GUARDED_BY(mModeMutex) = {HalSupport::UNKNOWN};
|
||||
};
|
||||
|
||||
+class HidlHalWrapperSeh : public HalWrapper {
|
||||
+public:
|
||||
+ explicit HidlHalWrapperSeh(sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> hal1,
|
||||
+ sp<android::hardware::power::V1_1::IPower> hal2,
|
||||
+ sp<android::hardware::power::V1_0::IPower> hal3)
|
||||
+ : mHandleSeh(std::move(hal1)),
|
||||
+ mHandle11(std::move(hal2)),
|
||||
+ mHandle10(std::move(hal3)) {}
|
||||
+ virtual ~HidlHalWrapperSeh() = default;
|
||||
+
|
||||
+ virtual HalResult<void> setBoost(hardware::power::Boost boost, int32_t durationMs) override;
|
||||
+ virtual HalResult<void> setMode(hardware::power::Mode mode, bool enabled) override;
|
||||
+ virtual HalResult<sp<hardware::power::IPowerHintSession>> createHintSession(
|
||||
+ int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds,
|
||||
+ int64_t durationNanos) override;
|
||||
+ virtual HalResult<int64_t> getHintSessionPreferredRate() override;
|
||||
+
|
||||
+protected:
|
||||
+ virtual HalResult<void> sendPowerHint(hardware::power::V1_0::PowerHint hintId, uint32_t data);
|
||||
+
|
||||
+private:
|
||||
+ sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> mHandleSeh;
|
||||
+ sp<android::hardware::power::V1_1::IPower> mHandle11;
|
||||
+ sp<android::hardware::power::V1_0::IPower> mHandle10;
|
||||
+ HalResult<void> setInteractive(bool enabled);
|
||||
+ HalResult<void> setFeature(hardware::power::V1_0::Feature feature, bool enabled);
|
||||
+};
|
||||
+
|
||||
}; // namespace power
|
||||
|
||||
}; // namespace android
|
||||
diff --git a/services/powermanager/Android.bp b/services/powermanager/Android.bp
|
||||
index b34e54fd6b..390c2d843a 100644
|
||||
--- a/services/powermanager/Android.bp
|
||||
+++ b/services/powermanager/Android.bp
|
||||
@@ -41,6 +41,7 @@ cc_library_shared {
|
||||
"android.hardware.power@1.2",
|
||||
"android.hardware.power@1.3",
|
||||
"android.hardware.power-V4-cpp",
|
||||
+ "vendor.samsung.hardware.miscpower@2.0",
|
||||
],
|
||||
|
||||
export_shared_lib_headers: [
|
||||
@@ -49,6 +50,7 @@ cc_library_shared {
|
||||
"android.hardware.power@1.2",
|
||||
"android.hardware.power@1.3",
|
||||
"android.hardware.power-V4-cpp",
|
||||
+ "vendor.samsung.hardware.miscpower@2.0",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
diff --git a/services/powermanager/PowerHalController.cpp b/services/powermanager/PowerHalController.cpp
|
||||
index f89035fd1c..5546672f97 100644
|
||||
--- a/services/powermanager/PowerHalController.cpp
|
||||
+++ b/services/powermanager/PowerHalController.cpp
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <android/hardware/power/IPower.h>
|
||||
#include <android/hardware/power/IPowerHintSession.h>
|
||||
#include <android/hardware/power/Mode.h>
|
||||
+#include <vendor/samsung/hardware/miscpower/2.0/ISehMiscPower.h>
|
||||
#include <powermanager/PowerHalController.h>
|
||||
#include <powermanager/PowerHalLoader.h>
|
||||
#include <utils/Log.h>
|
||||
@@ -33,18 +34,25 @@ namespace power {
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
std::unique_ptr<HalWrapper> HalConnector::connect() {
|
||||
- if (sp<IPower> halAidl = PowerHalLoader::loadAidl()) {
|
||||
- return std::make_unique<AidlHalWrapper>(halAidl);
|
||||
+ sp<IPower> halAidl = PowerHalLoader::loadAidl();
|
||||
+ sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> halHidlSeh = PowerHalLoader::loadHidlSeh();
|
||||
+ if (halAidl) {
|
||||
+ return std::make_unique<AidlHalWrapper>(halAidl, halHidlSeh);
|
||||
}
|
||||
// If V1_0 isn't defined, none of them are
|
||||
- if (sp<V1_0::IPower> halHidlV1_0 = PowerHalLoader::loadHidlV1_0()) {
|
||||
+ sp<V1_0::IPower> halHidlV1_0 = PowerHalLoader::loadHidlV1_0();
|
||||
+ sp<V1_1::IPower> halHidlV1_1 = PowerHalLoader::loadHidlV1_1();
|
||||
+ if (halHidlSeh) {
|
||||
+ return std::make_unique<HidlHalWrapperSeh>(halHidlSeh, halHidlV1_1, halHidlV1_0);
|
||||
+ }
|
||||
+ if (halHidlV1_0) {
|
||||
if (sp<V1_3::IPower> halHidlV1_3 = PowerHalLoader::loadHidlV1_3()) {
|
||||
return std::make_unique<HidlHalWrapperV1_3>(halHidlV1_3);
|
||||
}
|
||||
if (sp<V1_2::IPower> halHidlV1_2 = PowerHalLoader::loadHidlV1_2()) {
|
||||
return std::make_unique<HidlHalWrapperV1_2>(halHidlV1_2);
|
||||
}
|
||||
- if (sp<V1_1::IPower> halHidlV1_1 = PowerHalLoader::loadHidlV1_1()) {
|
||||
+ if (halHidlV1_1) {
|
||||
return std::make_unique<HidlHalWrapperV1_1>(halHidlV1_1);
|
||||
}
|
||||
return std::make_unique<HidlHalWrapperV1_0>(halHidlV1_0);
|
||||
diff --git a/services/powermanager/PowerHalLoader.cpp b/services/powermanager/PowerHalLoader.cpp
|
||||
index 6bd40f8ff2..0ea43a4883 100644
|
||||
--- a/services/powermanager/PowerHalLoader.cpp
|
||||
+++ b/services/powermanager/PowerHalLoader.cpp
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <android/hardware/power/1.2/IPower.h>
|
||||
#include <android/hardware/power/1.3/IPower.h>
|
||||
#include <android/hardware/power/IPower.h>
|
||||
+#include <vendor/samsung/hardware/miscpower/2.0/ISehMiscPower.h>
|
||||
#include <binder/IServiceManager.h>
|
||||
#include <hardware/power.h>
|
||||
#include <hardware_legacy/power.h>
|
||||
@@ -59,6 +60,7 @@ sp<V1_0::IPower> PowerHalLoader::gHalHidlV1_0 = nullptr;
|
||||
sp<V1_1::IPower> PowerHalLoader::gHalHidlV1_1 = nullptr;
|
||||
sp<V1_2::IPower> PowerHalLoader::gHalHidlV1_2 = nullptr;
|
||||
sp<V1_3::IPower> PowerHalLoader::gHalHidlV1_3 = nullptr;
|
||||
+sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> PowerHalLoader::gHalHidlSeh = nullptr;
|
||||
|
||||
void PowerHalLoader::unloadAll() {
|
||||
std::lock_guard<std::mutex> lock(gHalMutex);
|
||||
@@ -102,10 +104,23 @@ sp<V1_3::IPower> PowerHalLoader::loadHidlV1_3() {
|
||||
return loadHal<V1_3::IPower>(gHalExists, gHalHidlV1_3, loadFn, "HIDL v1.3");
|
||||
}
|
||||
|
||||
+sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> PowerHalLoader::loadHidlSeh() {
|
||||
+ std::lock_guard<std::mutex> lock(gHalMutex);
|
||||
+ static bool gHalExists = true;
|
||||
+ static auto loadFn = []() { return vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower::getService(); };
|
||||
+ return loadHal<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower>(gHalExists, gHalHidlSeh, loadFn, "HIDL SEH v1.1");
|
||||
+}
|
||||
+
|
||||
sp<V1_0::IPower> PowerHalLoader::loadHidlV1_0Locked() {
|
||||
+ static bool gSecHalExists = true;
|
||||
+ static auto loadFnSec = []() { return V1_0::IPower::getService("power"); };
|
||||
+ auto hal = loadHal<V1_0::IPower>(gSecHalExists, gHalHidlV1_0, loadFnSec, "HIDL v1.0");
|
||||
+
|
||||
static bool gHalExists = true;
|
||||
static auto loadFn = []() { return V1_0::IPower::getService(); };
|
||||
- return loadHal<V1_0::IPower>(gHalExists, gHalHidlV1_0, loadFn, "HIDL v1.0");
|
||||
+ if(hal == nullptr)
|
||||
+ hal = loadHal<V1_0::IPower>(gHalExists, gHalHidlV1_0, loadFn, "HIDL v1.0");
|
||||
+ return hal;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
diff --git a/services/powermanager/PowerHalWrapper.cpp b/services/powermanager/PowerHalWrapper.cpp
|
||||
index 9e7adf8e5c..5167430a7c 100644
|
||||
--- a/services/powermanager/PowerHalWrapper.cpp
|
||||
+++ b/services/powermanager/PowerHalWrapper.cpp
|
||||
@@ -258,6 +258,10 @@ HalResult<void> AidlHalWrapper::setMode(Mode mode, bool enabled) {
|
||||
std::unique_lock<std::mutex> lock(mModeMutex);
|
||||
size_t idx = static_cast<size_t>(mode);
|
||||
|
||||
+ if (mHandleSeh != nullptr && mode == Mode::INTERACTIVE) {
|
||||
+ mHandleSeh->setInteractiveAsync(enabled, false);
|
||||
+ }
|
||||
+
|
||||
// Quick return if mode is not supported by HAL
|
||||
if (idx >= mModeSupportedArray.size() || mModeSupportedArray[idx] == HalSupport::OFF) {
|
||||
ALOGV("Skipped setMode %s because Power HAL doesn't support it", toString(mode).c_str());
|
||||
@@ -297,6 +301,72 @@ HalResult<int64_t> AidlHalWrapper::getHintSessionPreferredRate() {
|
||||
return HalResult<int64_t>::fromStatus(result, rate);
|
||||
}
|
||||
|
||||
+HalResult<void> HidlHalWrapperSeh::setBoost(Boost boost, int32_t durationMs) {
|
||||
+ if (boost == Boost::INTERACTION) {
|
||||
+ return sendPowerHint(V1_0::PowerHint::INTERACTION, durationMs);
|
||||
+ } else {
|
||||
+ ALOGV("Skipped setBoost %s because Power HAL AIDL not available", toString(boost).c_str());
|
||||
+ return HalResult<void>::unsupported();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+HalResult<void> HidlHalWrapperSeh::setMode(Mode mode, bool enabled) {
|
||||
+ uint32_t data = enabled ? 1 : 0;
|
||||
+ switch (mode) {
|
||||
+ case Mode::LAUNCH:
|
||||
+ return sendPowerHint(V1_0::PowerHint::LAUNCH, data);
|
||||
+ case Mode::LOW_POWER:
|
||||
+ return sendPowerHint(V1_0::PowerHint::LOW_POWER, data);
|
||||
+ case Mode::SUSTAINED_PERFORMANCE:
|
||||
+ return sendPowerHint(V1_0::PowerHint::SUSTAINED_PERFORMANCE, data);
|
||||
+ case Mode::VR:
|
||||
+ return sendPowerHint(V1_0::PowerHint::VR_MODE, data);
|
||||
+ case Mode::INTERACTIVE:
|
||||
+ return setInteractive(enabled);
|
||||
+ case Mode::DOUBLE_TAP_TO_WAKE:
|
||||
+ return setFeature(V1_0::Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE, enabled);
|
||||
+ default:
|
||||
+ ALOGV("Skipped setMode %s because Power HAL AIDL not available",
|
||||
+ toString(mode).c_str());
|
||||
+ return HalResult<void>::unsupported();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+HalResult<void> HidlHalWrapperSeh::sendPowerHint(V1_0::PowerHint hintId, uint32_t data) {
|
||||
+ if(mHandle11 != nullptr) {
|
||||
+ auto ret = mHandle11->powerHintAsync(hintId, data);
|
||||
+ return HalResult<void>::fromReturn(ret);
|
||||
+ } else {
|
||||
+ auto ret = mHandle10->powerHint(hintId, data);
|
||||
+ return HalResult<void>::fromReturn(ret);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+HalResult<void> HidlHalWrapperSeh::setInteractive(bool enabled) {
|
||||
+ if(mHandleSeh != nullptr) {
|
||||
+ mHandleSeh->setInteractiveAsync(enabled, false);
|
||||
+ }
|
||||
+ auto ret = mHandle10->setInteractive(enabled);
|
||||
+ return HalResult<void>::fromReturn(ret);
|
||||
+}
|
||||
+
|
||||
+HalResult<void> HidlHalWrapperSeh::setFeature(V1_0::Feature feature, bool enabled) {
|
||||
+ auto ret = mHandle10->setFeature(feature, enabled);
|
||||
+ return HalResult<void>::fromReturn(ret);
|
||||
+}
|
||||
+
|
||||
+HalResult<sp<Aidl::IPowerHintSession>> HidlHalWrapperSeh::createHintSession(
|
||||
+ int32_t, int32_t, const std::vector<int32_t>& threadIds, int64_t) {
|
||||
+ ALOGV("Skipped createHintSession(task num=%zu) because Power HAL not available",
|
||||
+ threadIds.size());
|
||||
+ return HalResult<sp<Aidl::IPowerHintSession>>::unsupported();
|
||||
+}
|
||||
+
|
||||
+HalResult<int64_t> HidlHalWrapperSeh::getHintSessionPreferredRate() {
|
||||
+ ALOGV("Skipped getHintSessionPreferredRate because Power HAL not available");
|
||||
+ return HalResult<int64_t>::unsupported();
|
||||
+}
|
||||
+
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
} // namespace power
|
||||
diff --git a/services/surfaceflinger/CompositionEngine/Android.bp b/services/surfaceflinger/CompositionEngine/Android.bp
|
||||
index f3a0186e3e..ee2dc91e5d 100644
|
||||
--- a/services/surfaceflinger/CompositionEngine/Android.bp
|
||||
+++ b/services/surfaceflinger/CompositionEngine/Android.bp
|
||||
@@ -38,6 +38,7 @@ cc_defaults {
|
||||
"libtimestats",
|
||||
"libui",
|
||||
"libutils",
|
||||
+ "vendor.samsung.hardware.miscpower@2.0",
|
||||
],
|
||||
static_libs: [
|
||||
"libmath",
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
From db291f8d395f87669f79fa6cd65fa67773e0c7de Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 18 Dec 2022 18:17:30 -0500
|
||||
Subject: [PATCH 08/11] FOD support for Samsung and Asus
|
||||
|
||||
---
|
||||
libs/gui/BLASTBufferQueue.cpp | 20 ++++++++++++++--
|
||||
libs/ui/Gralloc2.cpp | 1 -
|
||||
libs/ui/Gralloc3.cpp | 1 -
|
||||
libs/ui/Gralloc4.cpp | 1 -
|
||||
.../CompositionEngine/src/OutputLayer.cpp | 24 +++++++++++++++++++
|
||||
.../DisplayHardware/AidlComposerHal.cpp | 8 +++++++
|
||||
.../DisplayHardware/AidlComposerHal.h | 2 ++
|
||||
.../DisplayHardware/ComposerHal.h | 3 +++
|
||||
.../surfaceflinger/DisplayHardware/HWC2.cpp | 8 +++++++
|
||||
.../surfaceflinger/DisplayHardware/HWC2.h | 5 ++++
|
||||
.../DisplayHardware/HidlComposerHal.cpp | 7 ++++++
|
||||
.../DisplayHardware/HidlComposerHal.h | 2 ++
|
||||
12 files changed, 77 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
|
||||
index 207fa4fd31..a162658e30 100644
|
||||
--- a/libs/gui/BLASTBufferQueue.cpp
|
||||
+++ b/libs/gui/BLASTBufferQueue.cpp
|
||||
@@ -35,12 +35,21 @@
|
||||
|
||||
#include <private/gui/ComposerService.h>
|
||||
#include <private/gui/ComposerServiceAIDL.h>
|
||||
+#include <cutils/properties.h>
|
||||
|
||||
#include <android-base/thread_annotations.h>
|
||||
#include <chrono>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
+static bool sCheckedProps = false;
|
||||
+static bool sSamsungFod = false;
|
||||
+static void init_fod_props() {
|
||||
+ if(sCheckedProps) return;
|
||||
+ sCheckedProps = true;
|
||||
+ sSamsungFod = property_get_bool("persist.sys.phh.fod.samsung", false);
|
||||
+}
|
||||
+
|
||||
namespace {
|
||||
inline const char* boolToString(bool b) {
|
||||
return b ? "true" : "false";
|
||||
@@ -159,9 +168,16 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, bool updateDestinati
|
||||
|
||||
// safe default, most producers are expected to override this
|
||||
mProducer->setMaxDequeuedBufferCount(2);
|
||||
+ uint64_t usage = GraphicBuffer::USAGE_HW_COMPOSER |
|
||||
+ GraphicBuffer::USAGE_HW_TEXTURE;
|
||||
+
|
||||
+ init_fod_props();
|
||||
+ if(sSamsungFod && name.find("SurfaceView[UdfpsControllerOverlay]") != std::string::npos) {
|
||||
+ usage |= 0x400000000LL;
|
||||
+ }
|
||||
+
|
||||
mBufferItemConsumer = new BLASTBufferItemConsumer(mConsumer,
|
||||
- GraphicBuffer::USAGE_HW_COMPOSER |
|
||||
- GraphicBuffer::USAGE_HW_TEXTURE,
|
||||
+ usage,
|
||||
1, false, this);
|
||||
static std::atomic<uint32_t> nextId = 0;
|
||||
mProducerId = nextId++;
|
||||
diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp
|
||||
index 877b46908e..78e71c7ffa 100644
|
||||
--- a/libs/ui/Gralloc2.cpp
|
||||
+++ b/libs/ui/Gralloc2.cpp
|
||||
@@ -115,7 +115,6 @@ status_t Gralloc2Mapper::validateBufferDescriptorInfo(
|
||||
if (descriptorInfo->usage & ~validUsageBits) {
|
||||
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
|
||||
descriptorInfo->usage & ~validUsageBits);
|
||||
- return BAD_VALUE;
|
||||
}
|
||||
|
||||
// Gralloc2 implementations never understand non-BLOB with GPU_DATA_BUFFER
|
||||
diff --git a/libs/ui/Gralloc3.cpp b/libs/ui/Gralloc3.cpp
|
||||
index d2b92bb221..eff02330d8 100644
|
||||
--- a/libs/ui/Gralloc3.cpp
|
||||
+++ b/libs/ui/Gralloc3.cpp
|
||||
@@ -106,7 +106,6 @@ status_t Gralloc3Mapper::validateBufferDescriptorInfo(
|
||||
if (descriptorInfo->usage & ~validUsageBits) {
|
||||
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
|
||||
descriptorInfo->usage & ~validUsageBits);
|
||||
- return BAD_VALUE;
|
||||
}
|
||||
|
||||
// Gralloc3 implementations never understand non-BLOB with GPU_DATA_BUFFER
|
||||
diff --git a/libs/ui/Gralloc4.cpp b/libs/ui/Gralloc4.cpp
|
||||
index c788e8b87a..ce4beaa0e2 100644
|
||||
--- a/libs/ui/Gralloc4.cpp
|
||||
+++ b/libs/ui/Gralloc4.cpp
|
||||
@@ -129,7 +129,6 @@ static status_t validateBufferDescriptorInfo(IMapper::BufferDescriptorInfo* desc
|
||||
if (descriptorInfo->usage & ~validUsageBits) {
|
||||
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
|
||||
descriptorInfo->usage & ~validUsageBits);
|
||||
- return BAD_VALUE;
|
||||
}
|
||||
|
||||
// Combinations that are only allowed with gralloc 4.1.
|
||||
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
index fc5f8ca1d3..4b81cc1df0 100644
|
||||
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "system/graphics-base-v1.0.h"
|
||||
|
||||
#include <ui/HdrRenderTypeUtils.h>
|
||||
+#include <cutils/properties.h>
|
||||
|
||||
// TODO(b/129481165): remove the #pragma below and fix conversion issues
|
||||
#pragma clang diagnostic push
|
||||
@@ -36,6 +37,9 @@
|
||||
// TODO(b/129481165): remove the #pragma below and fix conversion issues
|
||||
#pragma clang diagnostic pop // ignored "-Wconversion"
|
||||
|
||||
+static bool sCheckedProps = false;
|
||||
+static bool sAsusFod = false;
|
||||
+
|
||||
using aidl::android::hardware::graphics::composer3::Composition;
|
||||
|
||||
namespace android::compositionengine {
|
||||
@@ -438,6 +442,26 @@ void OutputLayer::writeOutputDependentGeometryStateToHWC(HWC2::Layer* hwcLayer,
|
||||
->getHeight()));
|
||||
}
|
||||
|
||||
+ if(!sCheckedProps) {
|
||||
+ sCheckedProps = true;
|
||||
+ sAsusFod = property_get_bool("persist.sys.phh.fod.asus", false);
|
||||
+ }
|
||||
+
|
||||
+ if (strstr(getLayerFE().getDebugName(), "UdfpsControllerOverlay#") != nullptr) {
|
||||
+ if (sAsusFod) {
|
||||
+ if (auto error = hwcLayer->setLayerClass(5); error != hal::Error::NONE) {
|
||||
+ ALOGE("Failed setting Asus layer class");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (strstr(getLayerFE().getDebugName(), "SurfaceView[UdfpsControllerOverlay](BLAST)#") != nullptr) {
|
||||
+ if (sAsusFod) {
|
||||
+ if (auto error = hwcLayer->setLayerClass(4); error != hal::Error::NONE) {
|
||||
+ ALOGE("Failed setting Asus layer class");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ALOGV("Writing display frame [%d, %d, %d, %d]", displayFrame.left, displayFrame.top,
|
||||
displayFrame.right, displayFrame.bottom);
|
||||
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
|
||||
index c0eb36dc02..782e22cbc2 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
|
||||
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
|
||||
@@ -1599,5 +1599,13 @@ void AidlComposer::addDisplay(Display display) {
|
||||
void AidlComposer::onHotplugConnect(Display display) {
|
||||
addDisplay(display);
|
||||
}
|
||||
+
|
||||
+Error AidlComposer::setLayerClass(Display display, Layer layer, uint32_t layerClass) {
|
||||
+ (void) display;
|
||||
+ (void) layer;
|
||||
+ (void) layerClass;
|
||||
+ return Error::NONE;
|
||||
+}
|
||||
+
|
||||
} // namespace Hwc2
|
||||
} // namespace android
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
|
||||
index 8d21b491c3..349278771d 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
|
||||
@@ -238,6 +238,8 @@ public:
|
||||
Error setHdrConversionStrategy(HdrConversionStrategy, Hdr*) override;
|
||||
Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) override;
|
||||
|
||||
+ // Proprietary extensions
|
||||
+ Error setLayerClass(Display display, Layer layer, uint32_t layerClass) override;
|
||||
private:
|
||||
// Many public functions above simply write a command into the command
|
||||
// queue to batch the calls. validateDisplay and presentDisplay will call
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.h b/services/surfaceflinger/DisplayHardware/ComposerHal.h
|
||||
index cf677955bf..eb5a2bf786 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.h
|
||||
@@ -291,6 +291,9 @@ public:
|
||||
virtual Error setHdrConversionStrategy(
|
||||
::aidl::android::hardware::graphics::common::HdrConversionStrategy, Hdr*) = 0;
|
||||
virtual Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) = 0;
|
||||
+
|
||||
+ // Proprietary extensions
|
||||
+ virtual Error setLayerClass(Display display, Layer layer, uint32_t layerClass) = 0;
|
||||
};
|
||||
|
||||
} // namespace Hwc2
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
|
||||
index aaf2523338..2acb79ad2f 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
|
||||
@@ -1003,6 +1003,14 @@ Error Layer::setBlockingRegion(const Region& region) {
|
||||
return static_cast<Error>(intError);
|
||||
}
|
||||
|
||||
+Error Layer::setLayerClass(uint32_t layerClass) {
|
||||
+ if (CC_UNLIKELY(!mDisplay)) {
|
||||
+ return Error::BAD_DISPLAY;
|
||||
+ }
|
||||
+ auto intError = mComposer.setLayerClass(mDisplay->getId(), mId, layerClass);
|
||||
+ return static_cast<Error>(intError);
|
||||
+}
|
||||
+
|
||||
} // namespace impl
|
||||
} // namespace HWC2
|
||||
} // namespace android
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
|
||||
index 23dd3e5016..a63d609df7 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
|
||||
@@ -345,6 +345,9 @@ public:
|
||||
// AIDL HAL
|
||||
[[nodiscard]] virtual hal::Error setBrightness(float brightness) = 0;
|
||||
[[nodiscard]] virtual hal::Error setBlockingRegion(const android::Region& region) = 0;
|
||||
+
|
||||
+ // Proprietary HAL
|
||||
+ [[nodiscard]] virtual hal::Error setLayerClass(uint32_t layerClass) = 0;
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
@@ -396,6 +399,8 @@ public:
|
||||
hal::Error setBrightness(float brightness) override;
|
||||
hal::Error setBlockingRegion(const android::Region& region) override;
|
||||
|
||||
+ // Proprietary HAL
|
||||
+ hal::Error setLayerClass(uint32_t layerClass) override;
|
||||
private:
|
||||
// These are references to data owned by HWComposer, which will outlive
|
||||
// this HWC2::Layer, so these references are guaranteed to be valid for
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
|
||||
index 9b41da5754..f16c3f17a7 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
|
||||
@@ -1409,6 +1409,13 @@ Error HidlComposer::getPhysicalDisplayOrientation(Display, AidlTransform*) {
|
||||
"OptionalFeature::PhysicalDisplayOrientation is not supported on HIDL");
|
||||
}
|
||||
|
||||
+Error HidlComposer::setLayerClass(Display display, Layer layer, uint32_t layerClass) {
|
||||
+ mWriter.selectDisplay(display);
|
||||
+ mWriter.selectLayer(layer);
|
||||
+ mWriter.vendor800_1(layerClass);
|
||||
+ return Error::NONE;
|
||||
+}
|
||||
+
|
||||
void HidlComposer::registerCallback(ComposerCallback& callback) {
|
||||
const bool vsyncSwitchingSupported =
|
||||
isSupported(Hwc2::Composer::OptionalFeature::RefreshRateSwitching);
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
|
||||
index 0521acf9c4..1acb8b0efe 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
|
||||
@@ -346,6 +346,8 @@ public:
|
||||
Hdr*) override;
|
||||
Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) override;
|
||||
|
||||
+ // Proprietary extensions
|
||||
+ Error setLayerClass(Display display, Layer layer, uint32_t layerClass) override;
|
||||
private:
|
||||
class CommandWriter : public CommandWriterBase {
|
||||
public:
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user