Initial unified commit for Android 13, with TrebleDroid GSI target, syncing up to 20221111
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
From 9d5a7fac46a27db0efe27f902933ded495102458 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 c6588d2cd..545426fd9 100644
|
||||
--- a/linker/linker.cpp
|
||||
+++ b/linker/linker.cpp
|
||||
@@ -93,7 +93,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";
|
||||
|
||||
@@ -3365,10 +3364,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,78 @@
|
||||
From fe04ccfd62f79856ffcfe3a10d905f12362c1094 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 | 38 ++++++++++++++++++++
|
||||
1 file changed, 38 insertions(+)
|
||||
|
||||
diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp
|
||||
index 1cb15c3df..d6e7e3e68 100644
|
||||
--- a/libc/system_properties/system_properties.cpp
|
||||
+++ b/libc/system_properties/system_properties.cpp
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
@@ -50,6 +51,32 @@
|
||||
#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;
|
||||
+
|
||||
+ int fd = open("/proc/self/comm", O_RDONLY);
|
||||
+ if(fd<0) return;
|
||||
+ read(fd, comm, sizeof(comm)-1);
|
||||
+ for(unsigned i=0; i<sizeof(comm); i++)
|
||||
+ if(comm[i] == '\n')
|
||||
+ comm[i] = 0;
|
||||
+ close(fd);
|
||||
+
|
||||
+ //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 - 1);
|
||||
+
|
||||
+ __system_property_get(propName, comm_override);
|
||||
+}
|
||||
+
|
||||
static bool is_dir(const char* pathname) {
|
||||
struct stat info;
|
||||
if (stat(pathname, &info) == -1) {
|
||||
@@ -216,6 +243,17 @@ void SystemProperties::ReadCallback(const prop_info* pi,
|
||||
}
|
||||
|
||||
int SystemProperties::Get(const char* name, char* value) {
|
||||
+ read_self();
|
||||
+ if(strcmp(comm_override, "vendor") == 0) {
|
||||
+ if(strcmp(name, "ro.product.device") == 0) {
|
||||
+ int r = Get("ro.product.vendor.device", value);
|
||||
+ if(r>0) return r;
|
||||
+ }
|
||||
+ if(strcmp(name, "ro.product.manufacturer") == 0) {
|
||||
+ int r = Get("ro.product.vendor.manufacturer", value);
|
||||
+ if(r>0) return r;
|
||||
+ }
|
||||
+ }
|
||||
const prop_info* pi = Find(name);
|
||||
|
||||
if (pi != nullptr) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From edee230e9ff11d779322b76646aa5b7e48e10ab9 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 a042f900..ea3645af 100644
|
||||
--- a/update_verifier/update_verifier.cpp
|
||||
+++ b/update_verifier/update_verifier.cpp
|
||||
@@ -310,7 +310,7 @@ int update_verifier(int argc, char** argv) {
|
||||
sp<IBootControl> module = IBootControl::getService();
|
||||
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,56 @@
|
||||
From 3127d705a0024e37f94174b17b94cf2fb331e7e4 Mon Sep 17 00:00:00 2001
|
||||
From: sooti <sooti85@gmail.com>
|
||||
Date: Tue, 12 Oct 2021 14:32:52 +0300
|
||||
Subject: [PATCH 1/5] build: remove emulator crap from GSI
|
||||
|
||||
Change-Id: Id45f3ff1d31e3d4492f956e68a1eb4b2fb82ce63
|
||||
---
|
||||
target/product/emulator.mk | 6 +++---
|
||||
target/product/emulator_vendor.mk | 6 +++---
|
||||
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
|
||||
index 36da1f7034..1497c061fc 100644
|
||||
--- a/target/product/emulator.mk
|
||||
+++ b/target/product/emulator.mk
|
||||
@@ -36,7 +36,7 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
PRODUCT_PACKAGE_OVERLAYS := device/generic/goldfish/overlay
|
||||
|
||||
-PRODUCT_CHARACTERISTICS := emulator
|
||||
+# PRODUCT_CHARACTERISTICS := emulator
|
||||
|
||||
PRODUCT_FULL_TREBLE_OVERRIDE := true
|
||||
|
||||
@@ -56,5 +56,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
|
||||
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.25.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 5f354b54b48358256e5f6251939edfaa1d4127ff 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/5] 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 01897b77d2..a0a7c0d2fc 100644
|
||||
--- a/target/product/aosp_arm64.mk
|
||||
+++ b/target/product/aosp_arm64.mk
|
||||
@@ -51,9 +51,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.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 43119ff620379b3710f1411b0e965ed0b10982fc 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 1/8] 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 1e713fc5860318d2a99f31718fea884c8d461923 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 2/8] 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 69a8a2ed..b63c1359 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,115 @@
|
||||
From 383c762e65ba755da5f424cea56f7249fb4aa852 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 3/8] 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 53017e2d..7f2c2e68 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;
|
||||
@@ -3904,7 +3908,7 @@ 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 5f9392d1..90f0fee6 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 b63c1359..87db4f81 100644
|
||||
--- a/libsepol/cil/src/cil_resolve_ast.c
|
||||
+++ b/libsepol/cil/src/cil_resolve_ast.c
|
||||
@@ -517,7 +517,13 @@ int cil_resolve_aliasactual(struct cil_tree_node *current, void *extra_args, enu
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -558,7 +564,12 @@ int cil_resolve_alias_to_actual(struct cil_tree_node *current, enum cil_flavor 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 f1ee5e7fb0ef1bbed930d955ce34601f91850762 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 4/8] 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 09c02af9..5c0e99c3 100644
|
||||
--- a/libsepol/cil/src/cil_post.c
|
||||
+++ b/libsepol/cil/src/cil_post.c
|
||||
@@ -491,7 +491,23 @@ int cil_post_genfscon_context_compare(const void *a, const void *b)
|
||||
{
|
||||
struct cil_genfscon *a_genfscon = *(struct cil_genfscon**)a;
|
||||
struct cil_genfscon *b_genfscon = *(struct cil_genfscon**)b;
|
||||
- return context_compare(a_genfscon->context, b_genfscon->context);
|
||||
+ int rc = context_compare(a_genfscon->context, b_genfscon->context);
|
||||
+ if(rc) {
|
||||
+ fprintf(stderr, "hello %s\n", a_genfscon->fs_str);
|
||||
+ int bypass = 0;
|
||||
+ /*
|
||||
+ * This conflict has been seen on Xiaomi Mi 9:
|
||||
+ * - AOSP Q says (genfscon sysfs /devices/virtual/block/ (u object_r sysfs_devices_block ((s0) (s0))))
|
||||
+ * - stock rom says (genfscon sysfs /devices/virtual/block/ (u object_r sysfs_ufs_target ((s0) (s0))))
|
||||
+ */
|
||||
+ if(strcmp(a_genfscon->path_str, "/devices/virtual/block/") == 0)
|
||||
+ bypass = 1;
|
||||
+ if(bypass == 1) {
|
||||
+ fprintf(stderr, "Received conflicting %s vs %s but ignore\n", a_genfscon->path_str, b_genfscon->path_str);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return rc;
|
||||
}
|
||||
|
||||
int cil_post_netifcon_context_compare(const void *a, const void *b)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From d023a3be8b43e5539ac5aab02f0fa96c03ed9901 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 5/8] 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 e52b44d4..3b8a2bd8 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 9cd3d8a0becbd182f5fe77af64ca7611ceba6fd1 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 6/8] 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 5c0e99c3..97bf54f8 100644
|
||||
--- a/libsepol/cil/src/cil_post.c
|
||||
+++ b/libsepol/cil/src/cil_post.c
|
||||
@@ -502,6 +502,10 @@ 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,27 @@
|
||||
From 81a82adb74c53b1671f24cb69a140a7915707f0f Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 2 Mar 2018 22:49:55 +0100
|
||||
Subject: [PATCH 7/8] Enable multipl_decls by default. This is needed because
|
||||
8.0 init doesn't add -m
|
||||
|
||||
Change-Id: I43dc661d519f7b8576d72a828d8cbd444592bf5e
|
||||
---
|
||||
secilc/secilc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/secilc/secilc.c b/secilc/secilc.c
|
||||
index a51630b2..d9841ab0 100644
|
||||
--- a/secilc/secilc.c
|
||||
+++ b/secilc/secilc.c
|
||||
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
|
||||
int target = SEPOL_TARGET_SELINUX;
|
||||
int mls = -1;
|
||||
int disable_dontaudit = 0;
|
||||
- int multiple_decls = 0;
|
||||
+ int multiple_decls = 1;
|
||||
int disable_neverallow = 0;
|
||||
int preserve_tunables = 0;
|
||||
int qualified_names = 0;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From 426de61556334b4b1024f615302dadb1ed6d6ac8 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 8/8] 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 90f0fee6..023fd6c7 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,313 @@
|
||||
From c3bb65b010f19b31a56b8c5d10ef182b32894fbf 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/26] 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 | 193 +++++++++++++-----
|
||||
.../managerdefault/AudioPolicyManager.h | 3 +
|
||||
2 files changed, 141 insertions(+), 55 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
index 744609f27b..224dae3820 100644
|
||||
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
@@ -675,6 +675,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 =
|
||||
@@ -697,9 +708,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.
|
||||
@@ -716,7 +738,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
|
||||
@@ -731,7 +760,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;
|
||||
@@ -739,6 +773,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);
|
||||
@@ -4520,76 +4584,95 @@ 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 = 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;
|
||||
- config.channel_mask = sourceDesc->config().channel_mask;
|
||||
- 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;
|
||||
- getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
|
||||
- &stream, sourceDesc->uid(), &config, &flags,
|
||||
- &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
|
||||
- nullptr, &outputType, &isSpatialized);
|
||||
- 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;
|
||||
- }
|
||||
- sourceDesc->setSwOutput(outputDesc);
|
||||
- } else {
|
||||
- // Same for "raw patches" aka created from createAudioPatch API
|
||||
- SortedVector<audio_io_handle_t> outputs =
|
||||
+ 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;
|
||||
+ config.channel_mask = sourceDesc->config().channel_mask;
|
||||
+ 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;
|
||||
+ getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
|
||||
+ &stream, sourceDesc->uid(), &config, &flags,
|
||||
+ &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
|
||||
+ nullptr, &outputType, &isSpatialized);
|
||||
+ 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;
|
||||
+ }
|
||||
+ sourceDesc->setSwOutput(outputDesc);
|
||||
+ } 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 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);
|
||||
}
|
||||
- sourceDesc->setSwOutput(outputDesc);
|
||||
}
|
||||
// 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() ?
|
||||
+ srcMixPortConfig.ext.mix.usecase.stream = (sourceDesc != nullptr && !sourceDesc->isInternal()) ?
|
||||
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 db0ee15de8..97fa6f6f81 100644
|
||||
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
@@ -938,6 +938,9 @@ protected:
|
||||
|
||||
SoundTriggerSessionCollection mSoundTriggerSessions;
|
||||
|
||||
+ sp<AudioPatch> mCallTxPatch;
|
||||
+ sp<AudioPatch> mCallRxPatch;
|
||||
+
|
||||
HwAudioOutputCollection mHwOutputs;
|
||||
SourceClientCollection mAudioSources;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
From 9f20882e39d7af72c514669b7611785fa50ae567 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/26] 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 d446e9667b..2f0ce75e47 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.25.1
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
From 76a5783fe2514d7b9d97faa8e221403c02fbcf6a 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/26] 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 80410ab463..b386046c19 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>
|
||||
@@ -143,6 +144,7 @@ const String16 CameraService::kWatchAllClientsFlag("all");
|
||||
static std::set<String8> sServiceErrorEventSet;
|
||||
|
||||
CameraService::CameraService() :
|
||||
+ mPhysicalFrontCamStatus(false),
|
||||
mEventLog(DEFAULT_EVENT_LOG_LENGTH),
|
||||
mNumberOfCameras(0),
|
||||
mNumberOfCamerasWithoutSystemCamera(0),
|
||||
@@ -1945,6 +1947,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);
|
||||
}
|
||||
|
||||
@@ -2063,6 +2066,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& cameraId, int32_t torchStrength,
|
||||
const sp<IBinder>& clientBinder) {
|
||||
Mutex::Autolock lock(mServiceLock);
|
||||
@@ -3318,6 +3342,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 d96ea008bc..5b77139040 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.h
|
||||
+++ b/services/camera/libcameraservice/CameraService.h
|
||||
@@ -226,6 +226,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.25.1
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From 931ab68c6977b02c8a65ebf63e853b03edcd7145 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/26] 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 2f0ce75e47..b35d34a599 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>
|
||||
@@ -983,6 +984,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.25.1
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
From 14ee2d68ff8ebca3b91c6700f292c26f19cd8949 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/26] 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 b35d34a599..456c5a935c 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.25.1
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
From 3955d4df29c79d35948995b150b81326f7ae1b46 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/26] 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 456c5a935c..45ee70ab6e 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.25.1
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From 1deb067cc7b98962ebb0622804ba9b03d9c74d4a 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/26] 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 6ef16b3ca8..3dd15d9fe9 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -36,6 +36,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>
|
||||
@@ -205,6 +206,15 @@ std::vector<std::string> CameraProviderManager::getCameraDeviceIds() const {
|
||||
deviceIds.push_back(id);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ 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;
|
||||
}
|
||||
|
||||
@@ -271,6 +281,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.25.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From cdfd6eea207f2cec68e46949895a78075dbbe636 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/26] 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 418b7ebe88..a97f76be59 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
|
||||
@@ -311,6 +311,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.25.1
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From 0a037727edf7f2fed2aab9ae61a4d09a8addd226 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/26] 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 981c56942c..7c4e4d9bcd 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -164,6 +164,7 @@ cc_library_shared {
|
||||
"android.hardware.camera.device@3.6",
|
||||
"android.hardware.camera.device@3.7",
|
||||
"android.hardware.camera.device-V1-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 d60565fb68..b02cf26445 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.25.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From ce5c36ff7b82f4ef0add790744795d9f6f2e06e7 Mon Sep 17 00:00:00 2001
|
||||
From: Emilian Peev <epeev@google.com>
|
||||
Date: Fri, 5 Aug 2022 17:28:06 -0700
|
||||
Subject: [PATCH 10/26] Camera: Avoid unnecessary close of buffer acquire fence
|
||||
fds
|
||||
|
||||
According to the gralloc lock documentation:
|
||||
The ownership of acquireFence is always transferred to the callee, even
|
||||
on errors.
|
||||
|
||||
Bug: 241455881
|
||||
Test: Manual using camera application
|
||||
Change-Id: Ieec34b54aaa7f0d773eccb593c3daaa3e41bae0b
|
||||
Merged-In: Ieec34b54aaa7f0d773eccb593c3daaa3e41bae0b
|
||||
---
|
||||
.../camera/libcameraservice/device3/Camera3OutputStream.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
|
||||
index 69163a5620..e66624dc6e 100644
|
||||
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
|
||||
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
|
||||
@@ -331,7 +331,7 @@ status_t Camera3OutputStream::fixUpHidlJpegBlobHeader(ANativeWindowBuffer* anwBu
|
||||
status_t res =
|
||||
gbLocker.lockAsync(
|
||||
GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_RARELY,
|
||||
- &mapped, fenceFd.get());
|
||||
+ &mapped, fenceFd.release());
|
||||
if (res != OK) {
|
||||
ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
|
||||
return res;
|
||||
@@ -1308,7 +1308,7 @@ void Camera3OutputStream::dumpImageToDisk(nsecs_t timestamp,
|
||||
void* mapped = nullptr;
|
||||
base::unique_fd fenceFd(dup(fence));
|
||||
status_t res = graphicBuffer->lockAsync(GraphicBuffer::USAGE_SW_READ_OFTEN, &mapped,
|
||||
- fenceFd.get());
|
||||
+ fenceFd.release());
|
||||
if (res != OK) {
|
||||
ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
|
||||
return;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From 22bcca382ca3b924606970b995d51974c6f05103 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 11/26] 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 7c2f34f46e..6ee3b3e5d8 100644
|
||||
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
|
||||
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
|
||||
@@ -193,8 +193,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.25.1
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
From 29802ae4be55eeb7a309b7439f0eecf8ecfcdc45 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 12/26] 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 45ee70ab6e..2bf5705512 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, ",");
|
||||
+
|
||||
+ //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.25.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 83d18a9021866184f0dacf407f684cf0a6575a6e 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 13/26] 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 99507eee5d..e31cc21b17 100644
|
||||
--- a/services/audiopolicy/engine/common/src/EngineBase.cpp
|
||||
+++ b/services/audiopolicy/engine/common/src/EngineBase.cpp
|
||||
@@ -222,9 +222,9 @@ engineConfig::ParsingResult EngineBase::loadAudioPolicyEngineConfig()
|
||||
}
|
||||
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.25.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From a5cddb1ec7a5b8bb8a6b141fe56d9364d222eaa6 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 14/26] 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.
|
||||
---
|
||||
.../camera/libcameraservice/common/CameraProviderManager.cpp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
index 3dd15d9fe9..93af10a0e7 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -255,7 +255,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 =
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
From 254173b6f4964ff5dcdea58ef5c7e76069702577 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 15/26] 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 7c4e4d9bcd..1faeb60ba7 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -165,6 +165,7 @@ cc_library_shared {
|
||||
"android.hardware.camera.device@3.7",
|
||||
"android.hardware.camera.device-V1-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 b02cf26445..947ddba0ee 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.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 5f4855966f38284865f38bb1ed95a26380771719 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 16/26] 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 2bf5705512..78812b1098 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.25.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 5ee043ccc5e7accb3d0d62647dcf0c7b7361122a 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 17/26] 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 78812b1098..9addf7dbdc 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) {
|
||||
ALOGE("%s: no source found with name=%s", __func__, devTag);
|
||||
return BAD_VALUE;
|
||||
} else if (source == NULL) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From dbfbd7b96c1d3fe76164b098852fad50f66b5af8 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 18/26] 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 6f560d558d..92cf03e418 100644
|
||||
--- a/services/audiopolicy/engine/config/src/EngineConfig.cpp
|
||||
+++ b/services/audiopolicy/engine/config/src/EngineConfig.cpp
|
||||
@@ -724,7 +724,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.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From f8e7a493e3986f0d2d4328018730c036445a7ab9 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 7 Aug 2021 11:11:39 +0200
|
||||
Subject: [PATCH 19/26] When aux cameras are enabled, ignore "system only"
|
||||
camera flag (it shouldnt be q security issue since secure cameras are listed
|
||||
otherwise)
|
||||
|
||||
---
|
||||
.../libcameraservice/common/CameraProviderManager.cpp | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
index 93af10a0e7..aa353f465f 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -990,10 +990,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.25.1
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
From ce0f16b2b6ebbfcc62525e4c318797e545538e7d Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 11 Oct 2021 16:10:42 -0400
|
||||
Subject: [PATCH 20/26] 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/FactoryHalHidl.cpp | 5 +++--
|
||||
media/libaudiohal/impl/Android.bp | 18 ++++++++++++++++++
|
||||
3 files changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/media/libaudiohal/Android.bp b/media/libaudiohal/Android.bp
|
||||
index 5f63e8de04..aa1d825d2f 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/FactoryHalHidl.cpp b/media/libaudiohal/FactoryHalHidl.cpp
|
||||
index 590fec5443..46b6bd757a 100644
|
||||
--- a/media/libaudiohal/FactoryHalHidl.cpp
|
||||
+++ b/media/libaudiohal/FactoryHalHidl.cpp
|
||||
@@ -36,12 +36,13 @@ namespace {
|
||||
*/
|
||||
#define CONC_VERSION(maj, min) #maj "." #min
|
||||
#define DECLARE_VERSION(maj, min) std::make_pair(std::make_pair(maj, min), CONC_VERSION(maj, min))
|
||||
-static constexpr std::array<std::pair<std::pair<int, int>, const char*>, 5> sAudioHALVersions = {
|
||||
+static constexpr std::array<std::pair<std::pair<int, int>, const char*>, 6> sAudioHALVersions = {
|
||||
DECLARE_VERSION(7, 1),
|
||||
DECLARE_VERSION(7, 0),
|
||||
DECLARE_VERSION(6, 0),
|
||||
DECLARE_VERSION(5, 0),
|
||||
- DECLARE_VERSION(4, 0)
|
||||
+ DECLARE_VERSION(4, 0),
|
||||
+ DECLARE_VERSION(2, 0)
|
||||
};
|
||||
|
||||
bool createHalService(const std::string& version, const std::string& interface,
|
||||
diff --git a/media/libaudiohal/impl/Android.bp b/media/libaudiohal/impl/Android.bp
|
||||
index d30883a95c..7bba88ca0a 100644
|
||||
--- a/media/libaudiohal/impl/Android.bp
|
||||
+++ b/media/libaudiohal/impl/Android.bp
|
||||
@@ -68,6 +68,24 @@ cc_defaults {
|
||||
],
|
||||
}
|
||||
|
||||
+cc_library_shared {
|
||||
+ name: "libaudiohal@2.0",
|
||||
+ defaults: ["libaudiohal_default"],
|
||||
+ 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: ["libaudiohal_default"],
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From ee6534d8bfbcdd264117a7b532df594187a5e4b2 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 30 Jan 2022 07:40:19 -0500
|
||||
Subject: [PATCH 21/26] Fix parsing audio hal 7.0 audio policies
|
||||
|
||||
Google changed separator from natural "," to weird " "
|
||||
We broke its support in "FIH devices: Fix "Earpiece" audio output"
|
||||
|
||||
Change-Id: I458b8b6a6498dd9cf748e00843ff65c561579902
|
||||
---
|
||||
.../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 9addf7dbdc..9d3d9fd169 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -428,7 +428,7 @@ PolicySerializer::deserialize<AudioProfileTraits>(
|
||||
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, ",");
|
||||
+ 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) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From d9bbe176ad0158145237d374783b758548a6fd67 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sat, 12 Mar 2022 18:07:43 -0500
|
||||
Subject: [PATCH 22/26] fixup! Not all sources in a route are valid. Dont
|
||||
ignore the whole route because of one broken source
|
||||
|
||||
---
|
||||
.../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 9d3d9fd169..95d2463230 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) {
|
||||
+ if (source == NULL && false) {
|
||||
ALOGE("%s: no source found with name=%s", __func__, devTag);
|
||||
return BAD_VALUE;
|
||||
} else if (source == NULL) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
From 422b02721cd031ff27143dde4823984a0c02bd2d 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 23/26] Add a prop to change Samsung flash strength
|
||||
|
||||
---
|
||||
services/camera/libcameraservice/Android.bp | 1 +
|
||||
.../common/hidl/HidlProviderInfo.cpp | 14 +++++++++++++-
|
||||
2 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
|
||||
index 1faeb60ba7..8c588065cf 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -166,6 +166,7 @@ cc_library_shared {
|
||||
"android.hardware.camera.device-V1-ndk",
|
||||
"vendor.samsung.hardware.camera.provider@3.0",
|
||||
"vendor.samsung.hardware.camera.provider@4.0",
|
||||
+ "vendor.samsung.hardware.camera.device@5.0",
|
||||
"media_permission-aidl-cpp",
|
||||
],
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
index 947ddba0ee..fd7615a446 100644
|
||||
--- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
+++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
@@ -29,6 +29,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>
|
||||
+#include <vendor/samsung/hardware/camera/device/5.0/ISehCameraDevice.h>
|
||||
|
||||
namespace {
|
||||
const bool kEnableLazyHal(property_get_bool("ro.camera.enableLazyHal", false));
|
||||
@@ -781,7 +782,18 @@ 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;
|
||||
+
|
||||
+ Status s;
|
||||
+ if(seh != nullptr) {
|
||||
+ s = seh->sehSetTorchModeStrength(enabled ? TorchMode::ON : TorchMode::OFF, flashStrength);
|
||||
+ } else {
|
||||
+ s = interface->setTorchMode(enabled ? TorchMode::ON : TorchMode::OFF);
|
||||
+ }
|
||||
+
|
||||
return mapToStatusT(s);
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From 9c5799a9da1fa402dd113b104f129217b1eb7f41 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 2 May 2022 17:37:09 -0400
|
||||
Subject: [PATCH 24/26] Support variable flash strength on samsung hal 4.0
|
||||
|
||||
---
|
||||
services/camera/libcameraservice/Android.bp | 1 +
|
||||
.../libcameraservice/common/hidl/HidlProviderInfo.cpp | 6 ++++++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
|
||||
index 8c588065cf..769862aaa2 100644
|
||||
--- a/services/camera/libcameraservice/Android.bp
|
||||
+++ b/services/camera/libcameraservice/Android.bp
|
||||
@@ -167,6 +167,7 @@ cc_library_shared {
|
||||
"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 fd7615a446..2fa7dcef7f 100644
|
||||
--- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
+++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
|
||||
@@ -30,6 +30,7 @@
|
||||
#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));
|
||||
@@ -787,9 +788,14 @@ status_t HidlProviderInfo::HidlDeviceInfo3::setTorchMode(bool enabled) {
|
||||
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);
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 92661ad5a047752ce253d12bf5bf40fad7771bea Mon Sep 17 00:00:00 2001
|
||||
From: ponces <ponces26@gmail.com>
|
||||
Date: Mon, 24 Oct 2022 09:38:34 +0100
|
||||
Subject: [PATCH 25/26] 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 95d2463230..ef310977b2 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.25.1
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
From 377da1b5b5df90be27f2571b52f93db0cb8aaeb8 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 9 Nov 2022 17:10:52 -0500
|
||||
Subject: [PATCH 26/26] Fix audio hal 2.0 support. Fixup of Revert "Remove
|
||||
support for audio HAL V2 from the framework"
|
||||
|
||||
---
|
||||
media/libaudiohal/impl/Android.bp | 5 +++++
|
||||
media/libaudiohal/impl/DeviceHalHidl.cpp | 10 ++++++++++
|
||||
media/libaudiohal/impl/DevicesFactoryHalHidl.cpp | 4 ++++
|
||||
3 files changed, 19 insertions(+)
|
||||
|
||||
diff --git a/media/libaudiohal/impl/Android.bp b/media/libaudiohal/impl/Android.bp
|
||||
index 7bba88ca0a..e53289c935 100644
|
||||
--- a/media/libaudiohal/impl/Android.bp
|
||||
+++ b/media/libaudiohal/impl/Android.bp
|
||||
@@ -71,6 +71,11 @@ cc_defaults {
|
||||
cc_library_shared {
|
||||
name: "libaudiohal@2.0",
|
||||
defaults: ["libaudiohal_default"],
|
||||
+ srcs: [
|
||||
+ ":audio_core_hal_client_sources",
|
||||
+ ":audio_effect_hal_client_sources",
|
||||
+ "EffectsFactoryHalHidlEntry.cpp",
|
||||
+ ],
|
||||
shared_libs: [
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.hardware.audio.common@2.0-util",
|
||||
diff --git a/media/libaudiohal/impl/DeviceHalHidl.cpp b/media/libaudiohal/impl/DeviceHalHidl.cpp
|
||||
index 0cdf621c7a..1dffa87c90 100644
|
||||
--- a/media/libaudiohal/impl/DeviceHalHidl.cpp
|
||||
+++ b/media/libaudiohal/impl/DeviceHalHidl.cpp
|
||||
@@ -516,6 +516,7 @@ status_t DeviceHalHidl::removeDeviceEffect(
|
||||
status_t DeviceHalHidl::setConnectedState(const struct audio_port_v7 *port, bool connected) {
|
||||
TIME_CHECK();
|
||||
if (mDevice == 0) return NO_INIT;
|
||||
+#if MAJOR_VERSION > 2
|
||||
#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
|
||||
if (supportsSetConnectedState7_1) {
|
||||
AudioPort hidlPort;
|
||||
@@ -538,11 +539,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) {
|
||||
@@ -551,6 +558,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 4069a6bdbd..e9d2af5d2c 100644
|
||||
--- a/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
|
||||
+++ b/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
|
||||
@@ -114,6 +114,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.
|
||||
@@ -130,6 +131,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.25.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 425ab90a2c6b4b92f3c18152f92b22511de556ba 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/30] 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 a25ac210f9c8..ed26223948b0 100644
|
||||
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
||||
@@ -317,9 +317,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.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From b8fc79c1f7c07e725a3e211119b4393d665d4658 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/30] 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 5177cb4f8549..f593dc38bc1c 100644
|
||||
--- a/core/java/android/os/Environment.java
|
||||
+++ b/core/java/android/os/Environment.java
|
||||
@@ -1471,7 +1471,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.25.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 74723cfbaaf7e2df53940f9935798a8297e1289f 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/30] 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 fc4da0b93c83..e8ec4be49f4f 100644
|
||||
--- a/services/core/java/com/android/server/StorageManagerService.java
|
||||
+++ b/services/core/java/com/android/server/StorageManagerService.java
|
||||
@@ -1610,7 +1610,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.25.1
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
From b9fdd321006e6cc79697bc6224a60ac330a6e24e Mon Sep 17 00:00:00 2001
|
||||
From: Danny Lin <danny@kdrag0n.dev>
|
||||
Date: Sat, 16 Oct 2021 05:27:57 -0700
|
||||
Subject: [PATCH 04/30] Add support for app signature spoofing
|
||||
|
||||
This is needed by microG GmsCore to pretend to be the official Google
|
||||
Play Services package, because client apps check the package signature
|
||||
to make sure it matches Google's official certificate.
|
||||
|
||||
This was forward-ported from the Android 10 patch by gudenau:
|
||||
https://github.com/microg/android_packages_apps_GmsCore/pull/957
|
||||
|
||||
Changes made for Android 11:
|
||||
- Updated PackageInfo calls
|
||||
- Added new permission to public API surface, needed for
|
||||
PermissionController which is now an updatable APEX on 11
|
||||
- Added a dummy permission group to allow users to manage the
|
||||
permission through the PermissionController UI
|
||||
(by Vachounet <vachounet@live.fr>)
|
||||
- Updated location provider comment for conciseness
|
||||
|
||||
Changes made for Android 12:
|
||||
- Moved mayFakeSignature into lock-free Computer subclass
|
||||
- Always get permissions for packages that request signature spoofing
|
||||
(otherwise permissions are usually ommitted and thus the permission
|
||||
check doesn't work properly)
|
||||
- Optimize mayFakeSignature check order to improve performance
|
||||
|
||||
Changes made for Android 13:
|
||||
- Computer subclass is now an independent class.
|
||||
|
||||
Change-Id: Ied7d6ce0b83a2d2345c3abba0429998d86494a88
|
||||
---
|
||||
core/api/current.txt | 2 ++
|
||||
core/res/AndroidManifest.xml | 15 ++++++++++
|
||||
core/res/res/values/strings.xml | 12 ++++++++
|
||||
.../com/android/server/pm/ComputerEngine.java | 30 +++++++++++++++++--
|
||||
4 files changed, 56 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/api/current.txt b/core/api/current.txt
|
||||
index c8a43db2f9c2..277183036c60 100644
|
||||
--- a/core/api/current.txt
|
||||
+++ b/core/api/current.txt
|
||||
@@ -87,6 +87,7 @@ package android {
|
||||
field public static final String DUMP = "android.permission.DUMP";
|
||||
field public static final String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR";
|
||||
field public static final String FACTORY_TEST = "android.permission.FACTORY_TEST";
|
||||
+ field public static final String FAKE_PACKAGE_SIGNATURE = "android.permission.FAKE_PACKAGE_SIGNATURE";
|
||||
field public static final String FOREGROUND_SERVICE = "android.permission.FOREGROUND_SERVICE";
|
||||
field public static final String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS";
|
||||
field public static final String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED";
|
||||
@@ -222,6 +223,7 @@ package android {
|
||||
field public static final String CALL_LOG = "android.permission-group.CALL_LOG";
|
||||
field public static final String CAMERA = "android.permission-group.CAMERA";
|
||||
field public static final String CONTACTS = "android.permission-group.CONTACTS";
|
||||
+ field public static final String FAKE_PACKAGE = "android.permission-group.FAKE_PACKAGE";
|
||||
field public static final String LOCATION = "android.permission-group.LOCATION";
|
||||
field public static final String MICROPHONE = "android.permission-group.MICROPHONE";
|
||||
field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES";
|
||||
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
|
||||
index 6e48de5ba31f..cef98d01a44c 100644
|
||||
--- a/core/res/AndroidManifest.xml
|
||||
+++ b/core/res/AndroidManifest.xml
|
||||
@@ -3542,6 +3542,21 @@
|
||||
android:description="@string/permdesc_getPackageSize"
|
||||
android:protectionLevel="normal" />
|
||||
|
||||
+ <!-- Dummy user-facing group for faking package signature -->
|
||||
+ <permission-group android:name="android.permission-group.FAKE_PACKAGE"
|
||||
+ android:label="@string/permgrouplab_fake_package_signature"
|
||||
+ android:description="@string/permgroupdesc_fake_package_signature"
|
||||
+ android:request="@string/permgrouprequest_fake_package_signature"
|
||||
+ android:priority="100" />
|
||||
+
|
||||
+ <!-- Allows an application to change the package signature as
|
||||
+ seen by applications -->
|
||||
+ <permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE"
|
||||
+ android:permissionGroup="android.permission-group.UNDEFINED"
|
||||
+ android:protectionLevel="signature|privileged"
|
||||
+ android:label="@string/permlab_fakePackageSignature"
|
||||
+ android:description="@string/permdesc_fakePackageSignature" />
|
||||
+
|
||||
<!-- @deprecated No longer useful, see
|
||||
{@link android.content.pm.PackageManager#addPackageToPreferred}
|
||||
for details. -->
|
||||
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
|
||||
index c6b60f586047..ecf5034f18bb 100644
|
||||
--- a/core/res/res/values/strings.xml
|
||||
+++ b/core/res/res/values/strings.xml
|
||||
@@ -974,6 +974,18 @@
|
||||
|
||||
<!-- Permissions -->
|
||||
|
||||
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
+ <string name="permlab_fakePackageSignature">Spoof package signature</string>
|
||||
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
+ <string name="permdesc_fakePackageSignature">Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only!</string>
|
||||
+ <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
+ <string name="permgrouplab_fake_package_signature">Spoof package signature</string>
|
||||
+ <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
+ <string name="permgroupdesc_fake_package_signature">allow to spoof package signature</string>
|
||||
+ <!-- Message shown to the user when the apps requests permission from this group. If ever possible this should stay below 80 characters (assuming the parameters takes 20 characters). Don't abbreviate until the message reaches 120 characters though. [CHAR LIMIT=120] -->
|
||||
+ <string name="permgrouprequest_fake_package_signature">Allow
|
||||
+ <b><xliff:g id="app_name" example="Gmail">%1$s</xliff:g></b> to spoof package signature?</string>
|
||||
+
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_statusBar">disable or modify status bar</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
|
||||
index 259ca655d2b9..674b22e28a83 100644
|
||||
--- a/services/core/java/com/android/server/pm/ComputerEngine.java
|
||||
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java
|
||||
@@ -1591,6 +1591,29 @@ public class ComputerEngine implements Computer {
|
||||
return result;
|
||||
}
|
||||
|
||||
+ private boolean requestsFakeSignature(AndroidPackage p) {
|
||||
+ return p.getMetaData() != null &&
|
||||
+ p.getMetaData().getString("fake-signature") != null;
|
||||
+ }
|
||||
+
|
||||
+ private PackageInfo mayFakeSignature(AndroidPackage p, PackageInfo pi,
|
||||
+ Set<String> permissions) {
|
||||
+ try {
|
||||
+ if (p.getMetaData() != null &&
|
||||
+ p.getTargetSdkVersion() > Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
+ String sig = p.getMetaData().getString("fake-signature");
|
||||
+ if (sig != null &&
|
||||
+ permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE")) {
|
||||
+ pi.signatures = new Signature[] {new Signature(sig)};
|
||||
+ }
|
||||
+ }
|
||||
+ } catch (Throwable t) {
|
||||
+ // We should never die because of any failures, this is system code!
|
||||
+ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t);
|
||||
+ }
|
||||
+ return pi;
|
||||
+ }
|
||||
+
|
||||
public final PackageInfo generatePackageInfo(PackageStateInternal ps,
|
||||
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
|
||||
if (!mUserManager.exists(userId)) return null;
|
||||
@@ -1620,13 +1643,14 @@ public class ComputerEngine implements Computer {
|
||||
final int[] gids = (flags & PackageManager.GET_GIDS) == 0 ? EMPTY_INT_ARRAY
|
||||
: mPermissionManager.getGidsForUid(UserHandle.getUid(userId, ps.getAppId()));
|
||||
// Compute granted permissions only if package has requested permissions
|
||||
- final Set<String> permissions = ((flags & PackageManager.GET_PERMISSIONS) == 0
|
||||
+ final Set<String> permissions = (((flags & PackageManager.GET_PERMISSIONS) == 0
|
||||
+ && !requestsFakeSignature(p))
|
||||
|| ArrayUtils.isEmpty(p.getRequestedPermissions())) ? Collections.emptySet()
|
||||
: mPermissionManager.getGrantedPermissions(ps.getPackageName(), userId);
|
||||
|
||||
- PackageInfo packageInfo = PackageInfoUtils.generate(p, gids, flags,
|
||||
+ PackageInfo packageInfo = mayFakeSignature(p, PackageInfoUtils.generate(p, gids, flags,
|
||||
state.getFirstInstallTime(), ps.getLastUpdateTime(), permissions, state, userId,
|
||||
- ps);
|
||||
+ ps), permissions);
|
||||
|
||||
if (packageInfo == null) {
|
||||
return null;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 0d723d79284ffb84a029d354580492876fbc9454 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 05/30] 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 c4e84a4cd138..2654f499db09 100644
|
||||
--- a/services/core/java/com/android/server/ConsumerIrService.java
|
||||
+++ b/services/core/java/com/android/server/ConsumerIrService.java
|
||||
@@ -49,14 +49,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.25.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 03b1fceea0b1a47ba2a03993eea5f2521c418944 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 1 Jun 2022 16:56:20 -0400
|
||||
Subject: [PATCH 06/30] 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 7193b93dba7f..aaa2887d7c5b 100644
|
||||
--- a/core/java/android/hardware/Camera.java
|
||||
+++ b/core/java/android/hardware/Camera.java
|
||||
@@ -452,6 +452,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 228d05b05083..1d7005075d3f 100644
|
||||
--- a/core/java/android/hardware/camera2/CameraManager.java
|
||||
+++ b/core/java/android/hardware/camera2/CameraManager.java
|
||||
@@ -1727,6 +1727,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.25.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 2888eb102d00b8eaabaec536ca2ce0b95eb5fd4b 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 07/30] 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 e032f65f3427..f96d8bd9bc55 100644
|
||||
--- a/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
@@ -8675,7 +8675,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.25.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 429e3b26107f94404f3e7c01a368a5ec91c0389b 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 08/30] 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 132dfb42e983..db95bc2ac2bb 100644
|
||||
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
|
||||
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
|
||||
@@ -959,6 +959,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()) {
|
||||
@@ -966,10 +970,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.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 1ff57569827f74f2ebcaea4ac0e7fad6458a834a 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 09/30] 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 0d49f5fffb4b..1fc974ebc56f 100644
|
||||
--- a/services/core/jni/Android.bp
|
||||
+++ b/services/core/jni/Android.bp
|
||||
@@ -186,6 +186,8 @@ cc_defaults {
|
||||
"android.system.suspend.control.internal-cpp",
|
||||
"android.system.suspend-V1-ndk",
|
||||
"service.incremental",
|
||||
+ "vendor.samsung.hardware.light@2.0",
|
||||
+ "vendor.samsung.hardware.light@3.0",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
From 626dae36e22f0cfce7a7f40ae812d2ed219055e1 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 10/30] 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 9c673caf6f08..427d062de831 100644
|
||||
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
@@ -2010,6 +2010,27 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
? Sensor.TYPE_PROXIMITY : SensorUtils.NO_FALLBACK;
|
||||
mProximitySensor = SensorUtils.findSensor(mSensorManager, proxSensor.type, proxSensor.name,
|
||||
fallbackType);
|
||||
+ 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);
|
||||
@@ -2971,6 +2992,20 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
if (mProximitySensorEnabled) {
|
||||
final long time = SystemClock.uptimeMillis();
|
||||
+ if("com.samsung.sensor.touch_proximity".equals(mProximitySensor.getStringType())) {
|
||||
+ int v = (int)event.values[0];
|
||||
+ boolean positive = (v <= 4);
|
||||
+ android.util.Log.d("PHH", "Samsung sensor changed " + positive + ":" + v);
|
||||
+ handleProximitySensorEvent(time, positive);
|
||||
+ return;
|
||||
+ }
|
||||
+ 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.25.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 55ecbae148221eb507c4f22cef9858b2966f2ee7 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 11/30] 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 a66f0177176d..acfe6c9e17d7 100644
|
||||
--- a/services/core/java/com/android/server/pm/UserManagerService.java
|
||||
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
|
||||
@@ -6315,12 +6315,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.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From cde569bb7e39cbfbcff17846cb3b397deb29bb1b 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 12/30] 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 0e818a3fc5ad..d885f55843b1 100644
|
||||
--- a/core/java/android/view/KeyEvent.java
|
||||
+++ b/core/java/android/view/KeyEvent.java
|
||||
@@ -2042,6 +2042,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.25.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From a382316556ded590fe9a26f50b7f712fd5e0a2b4 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 13/30] 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 427d062de831..1de60dd46046 100644
|
||||
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||
@@ -2034,6 +2034,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.25.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 0890446fae292d38fa640a10ee6ea0a2ab02a1e1 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 14/30] 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 60a344f153ab..18d80f3f80f4 100644
|
||||
--- a/services/core/java/com/android/server/power/PowerManagerService.java
|
||||
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
|
||||
@@ -1134,9 +1134,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.25.1
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From 7e0acc722c9fd061310aa48ec023e1ccb5bb58a0 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 15/30] Re-implement fnmatch-like behaviour for RRO java-side
|
||||
|
||||
T: Also apply to FrameworkParsingPackageUtils (@PeterCxy)
|
||||
|
||||
Change-Id: Id38292a9a1453aa87b8401c1fdb390fa4e63c7d1
|
||||
---
|
||||
core/java/android/content/pm/PackageParser.java | 13 +++++++++++--
|
||||
.../pm/parsing/FrameworkParsingPackageUtils.java | 13 +++++++++++--
|
||||
2 files changed, 22 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
|
||||
index 995092117f4d..28efda00393d 100644
|
||||
--- a/core/java/android/content/pm/PackageParser.java
|
||||
+++ b/core/java/android/content/pm/PackageParser.java
|
||||
@@ -2544,8 +2544,17 @@ public class PackageParser {
|
||||
for (int i = 0; i < propNames.length; i++) {
|
||||
// Check property value: make sure it is both set and equal to expected value
|
||||
final String currValue = SystemProperties.get(propNames[i]);
|
||||
- if (!TextUtils.equals(currValue, 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;
|
||||
diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
||||
index 3e1c5bb3d7ec..8182e9e0c771 100644
|
||||
--- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
||||
+++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
||||
@@ -215,8 +215,17 @@ public class FrameworkParsingPackageUtils {
|
||||
for (int i = 0; i < propNames.length; i++) {
|
||||
// Check property value: make sure it is both set and equal to expected value
|
||||
final String currValue = SystemProperties.get(propNames[i]);
|
||||
- if (!TextUtils.equals(currValue, 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.25.1
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
From de11206d21f61a22c3f39bceb60dacf741ce99bf Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 6 Dec 2020 12:20:08 +0100
|
||||
Subject: [PATCH 16/30] Make rounded corners padding overridable with
|
||||
persist.sys.phh.rounded_corners_padding
|
||||
|
||||
Change-Id: I481c1c8849b2f22a7cdfb2896a6d3c2e7e3b44d9
|
||||
---
|
||||
.../src/com/android/systemui/qs/QuickStatusBarHeader.java | 7 +++++--
|
||||
.../systemui/statusbar/phone/KeyguardStatusBarView.java | 7 +++++--
|
||||
.../statusbar/phone/StatusBarContentInsetsProvider.kt | 5 ++++-
|
||||
3 files changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
|
||||
index b0e2f8368703..614b0c03c696 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
|
||||
@@ -23,6 +23,7 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
+import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.AlarmClock;
|
||||
import android.util.AttributeSet;
|
||||
@@ -263,8 +264,10 @@ public class QuickStatusBarHeader extends FrameLayout implements TunerService.Tu
|
||||
|
||||
mConfigShowBatteryEstimate = resources.getBoolean(R.bool.config_showBatteryEstimateQSBH);
|
||||
|
||||
- mRoundedCornerPadding = resources.getDimensionPixelSize(
|
||||
- R.dimen.rounded_corner_content_padding);
|
||||
+ mRoundedCornerPadding = SystemProperties.getInt("persist.sys.phh.rounded_corners_padding", -1);
|
||||
+ if(mRoundedCornerPadding == -1)
|
||||
+ mRoundedCornerPadding = resources.getDimensionPixelSize(
|
||||
+ R.dimen.rounded_corner_content_padding);
|
||||
|
||||
int qsOffsetHeight = SystemBarUtils.getQuickQsOffsetHeight(mContext);
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
|
||||
index 5119b8f95aa8..cc8b2d5c0913 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
|
||||
@@ -28,6 +28,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Pair;
|
||||
+import android.os.SystemProperties;
|
||||
import android.util.TypedValue;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.Gravity;
|
||||
@@ -187,8 +188,10 @@ public class KeyguardStatusBarView extends RelativeLayout {
|
||||
R.dimen.ongoing_appops_dot_min_padding);
|
||||
mCutoutSideNudge = getResources().getDimensionPixelSize(
|
||||
R.dimen.display_cutout_margin_consumption);
|
||||
- mRoundedCornerPadding = res.getDimensionPixelSize(
|
||||
- R.dimen.rounded_corner_content_padding);
|
||||
+ mRoundedCornerPadding = SystemProperties.getInt("persist.sys.phh.rounded_corners_padding", -1);
|
||||
+ if(mRoundedCornerPadding == -1)
|
||||
+ mRoundedCornerPadding = res.getDimensionPixelSize(
|
||||
+ R.dimen.rounded_corner_content_padding);
|
||||
}
|
||||
|
||||
private void updateVisibilities() {
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt
|
||||
index f5462bc0fba5..c09ab6db814b 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt
|
||||
@@ -39,6 +39,7 @@ import com.android.systemui.util.leak.RotationUtils.Rotation
|
||||
import com.android.systemui.util.leak.RotationUtils.getExactRotation
|
||||
import com.android.systemui.util.leak.RotationUtils.getResourcesForRotation
|
||||
import com.android.systemui.util.traceSection
|
||||
+import android.os.SystemProperties
|
||||
|
||||
import java.io.PrintWriter
|
||||
import java.lang.Math.max
|
||||
@@ -231,7 +232,9 @@ class StatusBarContentInsetsProvider @Inject constructor(
|
||||
): Rect {
|
||||
val currentRotation = getExactRotation(context)
|
||||
|
||||
- val roundedCornerPadding = rotatedResources
|
||||
+ var roundedCornerPadding = SystemProperties.getInt("persist.sys.phh.rounded_corners_padding", -1);
|
||||
+ if(roundedCornerPadding == -1)
|
||||
+ roundedCornerPadding = rotatedResources
|
||||
.getDimensionPixelSize(R.dimen.rounded_corner_content_padding)
|
||||
val minDotPadding = if (isPrivacyDotEnabled)
|
||||
rotatedResources.getDimensionPixelSize(R.dimen.ongoing_appops_dot_min_padding)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 5f1362a864dcf873e2606ff2c4a9399ca70db814 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 17/30] 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 a78c64b6538d..f4bae98e1bf8 100644
|
||||
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
@@ -5176,7 +5176,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.25.1
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
From cd02e06d6fbde606706c1771193da2832a22ce44 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 21:24:12 +0800
|
||||
Subject: [PATCH 18/30] 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 b6f86527b747..1036cc75c71a 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -8028,6 +8028,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.25.1
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From 2f2bc2764b387a03026cf0e2b645b0b9ed86f038 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 13:46:15 +0800
|
||||
Subject: [PATCH 19/30] 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 1036cc75c71a..437379e5587c 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -3164,6 +3164,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.25.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From b8cd5cff6a7541dd1e70a91a8c6e43b928af250b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 21:26:45 +0800
|
||||
Subject: [PATCH 20/30] 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 437379e5587c..aacc69757e6a 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -8092,7 +8092,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);
|
||||
@@ -8146,7 +8146,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.25.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From ce4850163c105cf0baa193bcc9efad2a54478d2f Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Ponces <ponces26@gmail.com>
|
||||
Date: Tue, 2 Feb 2021 10:20:51 +0000
|
||||
Subject: [PATCH 21/30] 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 8d77c4a194a9..e9f253433740 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java
|
||||
@@ -110,7 +110,9 @@ public interface WakeLock {
|
||||
} else {
|
||||
mActiveClients.put(why, count - 1);
|
||||
}
|
||||
- inner.release();
|
||||
+ if (inner.isHeld()) {
|
||||
+ inner.release();
|
||||
+ }
|
||||
}
|
||||
|
||||
/** @see PowerManager.WakeLock#wrap(Runnable) */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 8b657065ea65f1b7140ad04e31b6e8a69ffc490c 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 22/30] 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 7d8f2ff92200..bd79b727fd05 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;
|
||||
|
||||
@@ -100,8 +103,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.25.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 899145af82436c53748638465187b48df26a224b 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 23/30] 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 83a7b3f01a95..78c74ed51910 100644
|
||||
--- a/core/java/android/view/DisplayCutout.java
|
||||
+++ b/core/java/android/view/DisplayCutout.java
|
||||
@@ -1055,11 +1055,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.25.1
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
From f6b967da32661d88c205b496571e0c8f14ca197c 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 24/30] 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.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From c3645feb413833f5e320fb4cb9d8b6a7457b8ff3 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 25/30] 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 d655721615b6..6c1368c63b76 100644
|
||||
--- a/core/res/res/values/config.xml
|
||||
+++ b/core/res/res/values/config.xml
|
||||
@@ -993,7 +993,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>
|
||||
@@ -1025,7 +1025,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.25.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 4a7e481c942057784ee61c40d50c0ae47b139440 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 26/30] 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 1fc974ebc56f..c73b29739cbf 100644
|
||||
--- a/services/core/jni/Android.bp
|
||||
+++ b/services/core/jni/Android.bp
|
||||
@@ -188,6 +188,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.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 98ff48370d40fdcb784ac6a2f2333530eea2473b 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 27/30] 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 2a3f34ae3cd4..23087a4df68a 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
|
||||
@@ -729,6 +729,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.25.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From a243391a6fadaa01b3f2b8e0b8653dd23db277ab Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 17 Dec 2021 17:16:14 -0500
|
||||
Subject: [PATCH 28/30] Reduce the size of udfps enroll progress bar. Some
|
||||
devices have their udfps pretty low, and the progress bar would make the icon
|
||||
at the wrong place
|
||||
|
||||
Change-Id: I1609ad9ca316293dcaaf07f7e681d11aadfcd29c
|
||||
---
|
||||
packages/SystemUI/res/values/config.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
|
||||
index 3d56c2522f07..341ee91750f8 100644
|
||||
--- a/packages/SystemUI/res/values/config.xml
|
||||
+++ b/packages/SystemUI/res/values/config.xml
|
||||
@@ -577,7 +577,7 @@
|
||||
|
||||
<!-- The radius of the enrollment progress bar, in dp -->
|
||||
<integer name="config_udfpsEnrollProgressBar" translatable="false">
|
||||
- 280
|
||||
+ 70
|
||||
</integer>
|
||||
|
||||
<!-- The time (in ms) needed to trigger the lock icon view's long-press affordance -->
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 7ef5766dd4a6b7e48ab14388283705446fd6e2cc 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 29/30] Dynamically resize boot animation to match screen size
|
||||
|
||||
Change-Id: I54e49fc6b8c670103852e212d1416e27ff976205
|
||||
---
|
||||
cmds/bootanimation/BootAnimation.cpp | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
|
||||
index 50c8e933d25f..cb1818729157 100644
|
||||
--- a/cmds/bootanimation/BootAnimation.cpp
|
||||
+++ b/cmds/bootanimation/BootAnimation.cpp
|
||||
@@ -583,6 +583,26 @@ status_t BootAnimation::readyToRun() {
|
||||
mFlingerSurface = s;
|
||||
mTargetInset = -1;
|
||||
|
||||
+ 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;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
projectSceneToWindow();
|
||||
|
||||
// Register a display event receiver
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
From a4efb74c6ddd11ed5bace13786dbb0a633ec4753 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 30/30] Revert "Remove more FDE methods from StorageManager"
|
||||
|
||||
This reverts commit bd13f84152449a3ead6fa8604fd31f48c0224676.
|
||||
---
|
||||
.../android/os/storage/StorageManager.java | 69 ++++++++++++++++---
|
||||
.../internal/os/RoSystemProperties.java | 4 ++
|
||||
2 files changed, 65 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
|
||||
index 497bfa6380bc..646a7095c1b3 100644
|
||||
--- a/core/java/android/os/storage/StorageManager.java
|
||||
+++ b/core/java/android/os/storage/StorageManager.java
|
||||
@@ -1681,13 +1681,18 @@ public class StorageManager {
|
||||
}
|
||||
|
||||
/** {@hide}
|
||||
- * Is this device encrypted?
|
||||
- * <p>
|
||||
- * Note: all devices launching with Android 10 (API level 29) or later are
|
||||
- * required to be encrypted. This should only ever return false for
|
||||
- * in-development devices on which encryption has not yet been configured.
|
||||
- *
|
||||
- * @return true if encrypted, false if not encrypted
|
||||
+ * 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 already encrypted?
|
||||
+ * @return true for encrypted. (Implies isEncryptable() == true)
|
||||
+ * false not encrypted
|
||||
*/
|
||||
public static boolean isEncrypted() {
|
||||
return RoSystemProperties.CRYPTO_ENCRYPTED;
|
||||
@@ -1696,7 +1701,7 @@ public class StorageManager {
|
||||
/** {@hide}
|
||||
* Is this device file encrypted?
|
||||
* @return true for file encrypted. (Implies isEncrypted() == true)
|
||||
- * false not encrypted or using "managed" encryption
|
||||
+ * false not encrypted or block encrypted
|
||||
*/
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
public static boolean isFileEncryptedNativeOnly() {
|
||||
@@ -1706,6 +1711,54 @@ public class StorageManager {
|
||||
return RoSystemProperties.CRYPTO_FILE_ENCRYPTED;
|
||||
}
|
||||
|
||||
+ /** {@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} */
|
||||
public static boolean isFileEncryptedEmulatedOnly() {
|
||||
return SystemProperties.getBoolean(StorageManager.PROP_EMULATE_FBE, false);
|
||||
diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java
|
||||
index 98d81c9598b8..8b659f927633 100644
|
||||
--- a/core/java/com/android/internal/os/RoSystemProperties.java
|
||||
+++ b/core/java/com/android/internal/os/RoSystemProperties.java
|
||||
@@ -60,10 +60,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.25.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From decca5cc3881636fadc994f6ab0c5bea127ef8f2 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 | 13 ++++++++-----
|
||||
1 file changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/common/native/bpf_headers/include/bpf/BpfMap.h b/common/native/bpf_headers/include/bpf/BpfMap.h
|
||||
index 2bee2ee..9e8a783 100644
|
||||
--- a/common/native/bpf_headers/include/bpf/BpfMap.h
|
||||
+++ b/common/native/bpf_headers/include/bpf/BpfMap.h
|
||||
@@ -50,14 +50,17 @@ class BpfMap {
|
||||
// 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));
|
||||
- if (mMapFd < 0) abort();
|
||||
- if (isAtLeastKernelVersion(4, 14, 0)) {
|
||||
- if (bpfGetFdKeySize(mMapFd) != sizeof(Key)) abort();
|
||||
- if (bpfGetFdValueSize(mMapFd) != sizeof(Value)) abort();
|
||||
- }
|
||||
}
|
||||
|
||||
public:
|
||||
+ bool isOk() {
|
||||
+ if (mMapFd < 0) 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) {}
|
||||
|
||||
BpfMap<Key, Value>(bpf_map_type map_type, uint32_t max_entries, uint32_t map_flags = 0) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 1cd9026a5662a35e1b6181baf7b02cfa9f8a0570 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 1/8] 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 de050e02d0..3daeece62b 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::hardware::Return;
|
||||
using android::util::ProtoOutputStream;
|
||||
@@ -77,6 +78,8 @@ SensorDevice::SensorDevice() {
|
||||
}
|
||||
|
||||
void SensorDevice::initializeSensorList() {
|
||||
+ if(::android::base::GetBoolProperty("persist.sys.phh.samsung_sensors", false))
|
||||
+ setMode(5555);
|
||||
if (mHalWrapper == nullptr) {
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 448c8549bc90e6738b68c50d2318a8cca7dd1db0 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 2/8] 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 ba5083bec3..72f824110b 100644
|
||||
--- a/services/inputflinger/reader/InputDevice.cpp
|
||||
+++ b/services/inputflinger/reader/InputDevice.cpp
|
||||
@@ -304,7 +304,10 @@ void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config
|
||||
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 = config->portAssociations;
|
||||
const auto& displayPort = ports.find(inputPort);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 6d0350654547eca97cc4b05ed8b4f03f9b5fc215 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 3/8] 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.25.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 6fca75b0d3125be0d0a1edc9d7aedf755b681e63 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 4/8] 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 ec0ced8663..19da9d70ba 100644
|
||||
--- a/libs/sensor/Sensor.cpp
|
||||
+++ b/libs/sensor/Sensor.cpp
|
||||
@@ -433,6 +433,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.25.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 884ffbeb725f8d5de1fb26ceb0fad85e97b20e94 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 5/8] 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 d6a6bd214e..febce0ae6b 100644
|
||||
--- a/services/inputflinger/reader/EventHub.cpp
|
||||
+++ b/services/inputflinger/reader/EventHub.cpp
|
||||
@@ -2124,7 +2124,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.25.1
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
From b4ed1474579b4f673f095542de7303460d968f0a 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 6/8] 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 | 5 ++
|
||||
include/powermanager/PowerHalWrapper.h | 36 +++++++++-
|
||||
services/powermanager/Android.bp | 1 +
|
||||
services/powermanager/PowerHalController.cpp | 7 +-
|
||||
services/powermanager/PowerHalLoader.cpp | 17 ++++-
|
||||
services/powermanager/PowerHalWrapper.cpp | 70 ++++++++++++++++++++
|
||||
6 files changed, 133 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/powermanager/PowerHalLoader.h b/include/powermanager/PowerHalLoader.h
|
||||
index ed6f6f35f5..cf1d76e3d1 100644
|
||||
--- a/include/powermanager/PowerHalLoader.h
|
||||
+++ b/include/powermanager/PowerHalLoader.h
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <android-base/thread_annotations.h>
|
||||
#include <android/hardware/power/1.1/IPower.h>
|
||||
#include <android/hardware/power/IPower.h>
|
||||
+#include <vendor/samsung/hardware/miscpower/2.0/ISehMiscPower.h>
|
||||
+
|
||||
|
||||
namespace android {
|
||||
|
||||
@@ -32,12 +34,15 @@ public:
|
||||
static sp<hardware::power::IPower> loadAidl();
|
||||
static sp<hardware::power::V1_0::IPower> loadHidlV1_0();
|
||||
static sp<hardware::power::V1_1::IPower> loadHidlV1_1();
|
||||
+ static sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> loadHidlSeh();
|
||||
|
||||
private:
|
||||
static std::mutex gHalMutex;
|
||||
static sp<hardware::power::IPower> gHalAidl GUARDED_BY(gHalMutex);
|
||||
static sp<hardware::power::V1_0::IPower> gHalHidlV1_0 GUARDED_BY(gHalMutex);
|
||||
static sp<hardware::power::V1_1::IPower> gHalHidlV1_1 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 dfb0ff59a0..9ad805dfcd 100644
|
||||
--- a/include/powermanager/PowerHalWrapper.h
|
||||
+++ b/include/powermanager/PowerHalWrapper.h
|
||||
@@ -23,6 +23,8 @@
|
||||
#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 {
|
||||
|
||||
@@ -181,7 +183,10 @@ private:
|
||||
// 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;
|
||||
@@ -196,6 +201,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>,
|
||||
@@ -206,6 +212,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 6fbba3f568..08280dd20f 100644
|
||||
--- a/services/powermanager/Android.bp
|
||||
+++ b/services/powermanager/Android.bp
|
||||
@@ -39,6 +39,7 @@ cc_library_shared {
|
||||
"android.hardware.power@1.0",
|
||||
"android.hardware.power@1.1",
|
||||
"android.hardware.power-V3-cpp",
|
||||
+ "vendor.samsung.hardware.miscpower@2.0",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
diff --git a/services/powermanager/PowerHalController.cpp b/services/powermanager/PowerHalController.cpp
|
||||
index 8c225d5d02..f67fbae08b 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>
|
||||
@@ -34,11 +35,15 @@ namespace power {
|
||||
|
||||
std::unique_ptr<HalWrapper> HalConnector::connect() {
|
||||
sp<IPower> halAidl = PowerHalLoader::loadAidl();
|
||||
+ sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> halHidlSeh = PowerHalLoader::loadHidlSeh();
|
||||
if (halAidl) {
|
||||
- return std::make_unique<AidlHalWrapper>(halAidl);
|
||||
+ return std::make_unique<AidlHalWrapper>(halAidl, halHidlSeh);
|
||||
}
|
||||
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_1) {
|
||||
return std::make_unique<HidlHalWrapperV1_1>(halHidlV1_0, halHidlV1_1);
|
||||
}
|
||||
diff --git a/services/powermanager/PowerHalLoader.cpp b/services/powermanager/PowerHalLoader.cpp
|
||||
index 1f1b43a607..9b20e67f7a 100644
|
||||
--- a/services/powermanager/PowerHalLoader.cpp
|
||||
+++ b/services/powermanager/PowerHalLoader.cpp
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <android/hardware/power/1.1/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>
|
||||
@@ -55,6 +56,8 @@ std::mutex PowerHalLoader::gHalMutex;
|
||||
sp<IPower> PowerHalLoader::gHalAidl = nullptr;
|
||||
sp<V1_0::IPower> PowerHalLoader::gHalHidlV1_0 = nullptr;
|
||||
sp<V1_1::IPower> PowerHalLoader::gHalHidlV1_1 = nullptr;
|
||||
+sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> PowerHalLoader::gHalHidlSeh = nullptr;
|
||||
+
|
||||
|
||||
void PowerHalLoader::unloadAll() {
|
||||
std::lock_guard<std::mutex> lock(gHalMutex);
|
||||
@@ -82,10 +85,22 @@ sp<V1_1::IPower> PowerHalLoader::loadHidlV1_1() {
|
||||
return loadHal<V1_1::IPower>(gHalExists, gHalHidlV1_1, loadFn, "HIDL v1.1");
|
||||
}
|
||||
|
||||
+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 gHalExists = true;
|
||||
+ static auto loadFnSec = []() { return V1_0::IPower::getService("power"); };
|
||||
+ auto hal = loadHal<V1_0::IPower>(gHalExists, gHalHidlV1_0, loadFnSec, "HIDL v1.0");
|
||||
+
|
||||
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 d74bd23a8d..a83990f2a4 100644
|
||||
--- a/services/powermanager/PowerHalWrapper.cpp
|
||||
+++ b/services/powermanager/PowerHalWrapper.cpp
|
||||
@@ -209,6 +209,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());
|
||||
@@ -248,6 +252,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
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0d9755d3ea258834a6475c19fcf4bf40575a63bd Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 12 Jan 2022 04:07:34 -0500
|
||||
Subject: [PATCH 7/8] Fix loading power hidl v1.0
|
||||
|
||||
Change-Id: Ife20a98d2a11c79c7b42f359f30c28e2dede1f25
|
||||
---
|
||||
services/powermanager/PowerHalLoader.cpp | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/powermanager/PowerHalLoader.cpp b/services/powermanager/PowerHalLoader.cpp
|
||||
index 9b20e67f7a..cd7f2312e2 100644
|
||||
--- a/services/powermanager/PowerHalLoader.cpp
|
||||
+++ b/services/powermanager/PowerHalLoader.cpp
|
||||
@@ -93,10 +93,11 @@ sp<vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower> PowerHalLoader::lo
|
||||
}
|
||||
|
||||
sp<V1_0::IPower> PowerHalLoader::loadHidlV1_0Locked() {
|
||||
- static bool gHalExists = true;
|
||||
+ static bool gSecHalExists = true;
|
||||
static auto loadFnSec = []() { return V1_0::IPower::getService("power"); };
|
||||
- auto hal = loadHal<V1_0::IPower>(gHalExists, gHalHidlV1_0, loadFnSec, "HIDL v1.0");
|
||||
+ 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(); };
|
||||
if(hal == nullptr)
|
||||
hal = loadHal<V1_0::IPower>(gHalExists, gHalHidlV1_0, loadFn, "HIDL v1.0");
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 2c4b374b4b9a742fdb743ff9e96f03d4d12bd69d 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 8/8] 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.25.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 33d56a10cff544e55f14eb2be0ab832c373d1fd1 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 14 Nov 2021 13:47:29 -0500
|
||||
Subject: [PATCH] Pie MTK IMS calls static
|
||||
ImsManager.updateImsServiceConfig(Context,int,boolean). Bring it back
|
||||
|
||||
Change-Id: I3dd66d436629d37c8ec795df6569736195ae570e
|
||||
---
|
||||
src/java/com/android/ims/ImsManager.java | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
|
||||
index c41426d..2c6d656 100644
|
||||
--- a/src/java/com/android/ims/ImsManager.java
|
||||
+++ b/src/java/com/android/ims/ImsManager.java
|
||||
@@ -1667,6 +1667,14 @@ public class ImsManager implements FeatureUpdates {
|
||||
}
|
||||
}
|
||||
|
||||
+ public static void updateImsServiceConfig(Context context, int phoneId, boolean force) {
|
||||
+ ImsManager mgr = ImsManager.getInstance(context, phoneId);
|
||||
+ if (mgr != null) {
|
||||
+ mgr.updateImsServiceConfig();
|
||||
+ }
|
||||
+ Rlog.e(TAG, "updateImsServiceConfig: ImsManager null, returning without update.");
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Push configuration updates to the ImsService implementation.
|
||||
*/
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From d840969544f6ac3822ce444a8c1ff48ae30523ea Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Mon, 5 Sep 2022 14:02:37 -0400
|
||||
Subject: [PATCH 1/6] SubscriptionController: Do not override default calling
|
||||
account from third-party apps
|
||||
|
||||
When the user has selected a calling account from a third-party app as
|
||||
default, it should not be overridden by the rest of the telephony
|
||||
subsystem (e.g. SIM subcription updates, or default SIM slot selection).
|
||||
|
||||
Otherwise, it creates a somewhat annoying situation where the user has
|
||||
to keep re-selecting the desired calling account after every reboot.
|
||||
|
||||
Test: manual
|
||||
Change-Id: Iccab64e9b3b3ab4773bd8944d47c2006f229d472
|
||||
---
|
||||
.../internal/telephony/SubscriptionController.java | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
|
||||
index 7e762d7af0..f2bff8b15f 100644
|
||||
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
|
||||
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
|
||||
@@ -2846,7 +2846,14 @@ public class SubscriptionController extends ISub.Stub {
|
||||
PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount();
|
||||
logd("[setDefaultVoiceSubId] current phoneAccountHandle=" + currentHandle);
|
||||
|
||||
- if (!Objects.equals(currentHandle, newHandle)) {
|
||||
+ String currentPackageName =
|
||||
+ currentHandle == null ? null : currentHandle.getComponentName().getPackageName();
|
||||
+ boolean currentIsSim = "com.android.phone".equals(currentPackageName);
|
||||
+ // Do not override user selected outgoing calling account
|
||||
+ // if the user has selected a third-party app as default
|
||||
+ boolean shouldKeepOutgoingAccount = currentHandle != null && !currentIsSim;
|
||||
+
|
||||
+ if (!Objects.equals(currentHandle, newHandle) && !shouldKeepOutgoingAccount) {
|
||||
telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
|
||||
logd("[setDefaultVoiceSubId] change to phoneAccountHandle=" + newHandle);
|
||||
} else {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 406506e3a8df83f592f7dc34d27ed074917ffef1 Mon Sep 17 00:00:00 2001
|
||||
From: Artem Borisov <dedsa2002@gmail.com>
|
||||
Date: Sat, 10 Nov 2018 17:19:17 +0000
|
||||
Subject: [PATCH 2/6] Telephony: Don not call onUssdRelease for Huawei RIL
|
||||
|
||||
Huawei RIL doesn't seem to work properly with USSD_MODE_NW_RELEASE,
|
||||
always releasing USSD when it should be finished instead.
|
||||
Let's explicitly call onUssdFinished in this case.
|
||||
|
||||
Change-Id: I69faed1c51d4582834879975d6ab13daf7f48ad4
|
||||
---
|
||||
src/java/com/android/internal/telephony/GsmCdmaPhone.java | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
index ff8412f1a5..6dc1312790 100644
|
||||
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
@@ -2834,7 +2834,11 @@ public class GsmCdmaPhone extends Phone {
|
||||
if (found != null) {
|
||||
// Complete pending USSD
|
||||
if (isUssdRelease) {
|
||||
- found.onUssdRelease();
|
||||
+ if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) {
|
||||
+ found.onUssdFinished(ussdMessage, isUssdRequest);
|
||||
+ } else {
|
||||
+ found.onUssdRelease();
|
||||
+ }
|
||||
} else if (isUssdError) {
|
||||
found.onUssdFinishedError();
|
||||
} else {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 85e87b4870db60bbf2548602df0195b3008e8ee8 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 6 Dec 2021 16:28:22 -0500
|
||||
Subject: [PATCH 3/6] Fix baseband being too long to fit into a 91 chars
|
||||
property, preventing telephony subsystem from starting
|
||||
|
||||
Change-Id: I1762e4a8cc137626be89f350229d6be162bdaf57
|
||||
---
|
||||
src/java/com/android/internal/telephony/GsmCdmaPhone.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
index 6dc1312790..d909085979 100644
|
||||
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
@@ -3128,7 +3128,7 @@ public class GsmCdmaPhone extends Phone {
|
||||
String version = (String)ar.result;
|
||||
if (version != null) {
|
||||
int length = version.length();
|
||||
- final int MAX_VERSION_LEN = SystemProperties.PROP_VALUE_MAX/2;
|
||||
+ final int MAX_VERSION_LEN = SystemProperties.PROP_VALUE_MAX/2 - 2;
|
||||
TelephonyManager.from(mContext).setBasebandVersionForPhone(getPhoneId(),
|
||||
length <= MAX_VERSION_LEN ? version
|
||||
: version.substring(length - MAX_VERSION_LEN, length));
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
From c2731d2e7e1b32628ce9b7fb7d4201dc84a7bfd8 Mon Sep 17 00:00:00 2001
|
||||
From: ironydelerium <42721860+ironydelerium@users.noreply.github.com>
|
||||
Date: Fri, 31 Dec 2021 02:20:28 -0800
|
||||
Subject: [PATCH 4/6] Reintroduce 'public void
|
||||
TelephonyMetrics.writeRilSendSms(int, int, int, int)'. (#8)
|
||||
|
||||
The MediaTek IMS package for Android Q, at the very least (likely for the rest, too)
|
||||
invoke this method in their `sendSms` method; Google, in their infinite wisdom,
|
||||
decided that this method needed a message ID passed in as well, changing the signature
|
||||
to 'public void TelephonyMetrics.writeRilSendSms(int, int, int, int, long)' and resulting
|
||||
in a MethodNotFoundException being raised in com.mediatek.ims, crashing it.
|
||||
|
||||
Fixes https://github.com/phhusson/treble_experimentations/issues/2125.
|
||||
|
||||
Co-authored-by: Sarah Vandomelen <sarah@sightworks.com>
|
||||
Change-Id: I9b42dc0fe83aeb2952f066e48282bad6ed89e473
|
||||
---
|
||||
.../telephony/metrics/TelephonyMetrics.java | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java b/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java
|
||||
index 3fdbfe0ed7..fb8011c3df 100644
|
||||
--- a/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java
|
||||
+++ b/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java
|
||||
@@ -2320,6 +2320,19 @@ public class TelephonyMetrics {
|
||||
smsSession.increaseExpectedResponse();
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Write Send SMS event (backwards-compatible method for R and earlier IMS implementations)
|
||||
+ *
|
||||
+ * @param phoneId Phone id
|
||||
+ * @param rilSerial RIL request serial number
|
||||
+ * @param tech SMS RAT
|
||||
+ * @param format SMS format. Either {@link SmsMessage#FORMAT_3GPP} or
|
||||
+ * {@link SmsMessage#FORMAT_3GPP2}.
|
||||
+ */
|
||||
+ public void writeRilSendSms(int phoneId, int rilSerial, int tech, int format) {
|
||||
+ writeRilSendSms(phoneId, rilSerial, tech, format, 0);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Write Send SMS event using ImsService. Expecting response from
|
||||
* {@link #writeOnSmsSolicitedResponse}.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
From 7a8573a733734e6d8cb627078ae28a179bcea7d5 Mon Sep 17 00:00:00 2001
|
||||
From: Raphael Mounier <mounierr07@gmail.com>
|
||||
Date: Thu, 6 Oct 2022 08:35:38 +0200
|
||||
Subject: [PATCH 5/6] Fix signalstrength for huawei kirin (hi6250, hi3670)
|
||||
|
||||
The RILUtils.convertHalSignalStrength function does not work correctly under Huawei hi6250 and hi3660 platform. We have therefore replaced this function with a new one specifically for this Kirin platform.
|
||||
|
||||
23/11/2021 :
|
||||
Initial release for Android 11
|
||||
|
||||
06/10/2022 :
|
||||
Android 13 release
|
||||
---
|
||||
.../com/android/internal/telephony/RIL.java | 119 ++++++++++++++++++
|
||||
.../internal/telephony/RadioIndication.java | 21 +++-
|
||||
2 files changed, 136 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
|
||||
index 8b94aec967..979ff1ec29 100644
|
||||
--- a/src/java/com/android/internal/telephony/RIL.java
|
||||
+++ b/src/java/com/android/internal/telephony/RIL.java
|
||||
@@ -5914,6 +5914,125 @@ public class RIL extends BaseCommands implements CommandsInterface {
|
||||
new CellSignalStrengthNr());
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Fixup for SignalStrength for Huawei device
|
||||
+ * @param signalStrength the initial signal strength
|
||||
+ * @return a new SignalStrength
|
||||
+ */
|
||||
+ public SignalStrength fixupSignalStrengthHuawei(android.hardware.radio.V1_0.SignalStrength signalStrength) {
|
||||
+ int gsmSignalStrength = signalStrength.gw.signalStrength;
|
||||
+ int gsmBitErrorRate = signalStrength.gw.bitErrorRate;
|
||||
+ int gsmTimingAdvance = signalStrength.gw.timingAdvance;
|
||||
+ int mWcdmaRscp = 0;
|
||||
+ int mWcdmaEcio = 0;
|
||||
+ int cdmaDbm = signalStrength.cdma.dbm;
|
||||
+ int cdmaEcio = signalStrength.cdma.ecio;
|
||||
+ int evdoDbm = signalStrength.evdo.dbm;
|
||||
+ int evdoEcio = signalStrength.evdo.ecio;
|
||||
+ int evdoSnr = signalStrength.evdo.signalNoiseRatio;
|
||||
+ int lteSignalStrength = signalStrength.lte.signalStrength;
|
||||
+ int lteRsrp = signalStrength.lte.rsrp;
|
||||
+ int lteRsrq = signalStrength.lte.rsrq;
|
||||
+ int lteRssnr = signalStrength.lte.rssnr;
|
||||
+ int lteCqi = signalStrength.lte.cqi;
|
||||
+ int lteTimingAdvance = signalStrength.lte.timingAdvance;
|
||||
+ int mGsm = 0;
|
||||
+ int mRat = 0;
|
||||
+
|
||||
+
|
||||
+
|
||||
+ //Calcul level with Rssnr, Rsrq, Rsrp value - so specify KEY_PARAMETERS_USED_FOR_LTE_SIGNAL_BAR_INT (parameters_used_for_lte_signal_bar_int) to use this 3 values
|
||||
+ //RSRP = 1 << 0
|
||||
+ //RSRQ = 1 << 1
|
||||
+ //RSSNR = 1 << 2
|
||||
+ //
|
||||
+ if (lteRsrp != 0) { // LTE
|
||||
+ // Nothing to DO
|
||||
+ } else if (gsmSignalStrength == 0 && lteRsrp == 0) { // 3G
|
||||
+ lteRsrp = (mWcdmaRscp & 0xFF) - 256;
|
||||
+ lteRsrq = (mWcdmaEcio & 0xFF) - 256;
|
||||
+ if (lteRsrp > -20) { // None or Unknown
|
||||
+ lteRssnr = -200;
|
||||
+ } else if (lteRsrp >= -85) { // Great
|
||||
+ lteRssnr = 300;
|
||||
+ } else if (lteRsrp >= -95) { // Good
|
||||
+ lteRssnr = 129;
|
||||
+ } else if (lteRsrp >= -105) { // Moderate
|
||||
+ lteRssnr = 44;
|
||||
+ } else if (lteRsrp >= -115) { // Poor
|
||||
+ lteRssnr = 9;
|
||||
+ } else if (lteRsrp >= -140) { // None or Unknown
|
||||
+ lteRssnr = -200;
|
||||
+ }
|
||||
+ } else if (mWcdmaRscp == 0 && lteRsrp == 0) { // 2G
|
||||
+ lteRsrp = (gsmSignalStrength & 0xFF) - 256;
|
||||
+ if (lteRsrp > -20) { // None or Unknown
|
||||
+ lteRsrq = -21;
|
||||
+ lteRssnr = -200;
|
||||
+ } else if (lteRsrp >= -85) { // Great
|
||||
+ lteRsrq = -3;
|
||||
+ lteRssnr = 300;
|
||||
+ } else if (lteRsrp >= -95) { // Good
|
||||
+ lteRsrq = -7;
|
||||
+ lteRssnr = 129;
|
||||
+ } else if (lteRsrp >= -105) { // Moderate
|
||||
+ lteRsrq = -12;
|
||||
+ lteRssnr = 44;
|
||||
+ } else if (lteRsrp >= -115) { // Poor
|
||||
+ lteRsrq = -17;
|
||||
+ lteRssnr = 9;
|
||||
+ } else if (lteRsrp >= -140) { // None or Unknown
|
||||
+ lteRsrq = -21;
|
||||
+ lteRssnr = -200;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ // 4G - LTE
|
||||
+ // .lte = {.signalStrength = 99, .rsrp = -104, .rsrq = -16, .rssnr = -4, .cqi = 2147483647, .timingAdvance = -1},
|
||||
+ // public CellSignalStrengthLte(int rssi, int rsrp, int rsrq, int rssnr, int cqi, int timingAdvance) {
|
||||
+ CellSignalStrengthLte lteStrength = new CellSignalStrengthLte(SignalStrength.INVALID,
|
||||
+ lteRsrp,
|
||||
+ lteRsrq,
|
||||
+ lteRssnr,
|
||||
+ lteCqi,
|
||||
+ lteTimingAdvance);
|
||||
+
|
||||
+ // GSM
|
||||
+ // .gw = {.signalStrength = -91, .bitErrorRate = -1, .timingAdvance = 0}
|
||||
+ // public CellSignalStrengthGsm(int rssi, int ber, int ta) {
|
||||
+ // rssi in dBm [-113, -51] or UNAVAILABLE
|
||||
+ // bit error rate (0-7, 99) TS 27.007 8.5 or UNAVAILABLE
|
||||
+ CellSignalStrengthGsm gsmStrength = new CellSignalStrengthGsm(gsmSignalStrength,
|
||||
+ gsmBitErrorRate,
|
||||
+ gsmTimingAdvance);
|
||||
+
|
||||
+ if (RILJ_LOGD) {
|
||||
+ riljLog("Huawei signal : LTE dbm : " + String.valueOf(lteStrength.getDbm()) +
|
||||
+ ", level : " + String.valueOf(lteStrength.getLevel()) +
|
||||
+ ", Rsrp : " + String.valueOf(lteStrength.getRsrp()) +
|
||||
+ ", Rsrq : " + String.valueOf(lteStrength.getRsrq()) +
|
||||
+ ", Rssi : " + String.valueOf(lteStrength.getRssi()) +
|
||||
+ ", Rssnr : " + String.valueOf(lteStrength.getRssnr()));
|
||||
+ riljLog("Huawei signal : GSM dbm : " + String.valueOf(gsmStrength.getDbm()) +
|
||||
+ ", errorrate : " + String.valueOf(gsmStrength.getBitErrorRate()) +
|
||||
+ ", timingadvance : " + String.valueOf(gsmStrength.getTimingAdvance()));
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+
|
||||
+ // Perhaps add also gsm signalStrength
|
||||
+ return new SignalStrength(
|
||||
+ new CellSignalStrengthCdma(),
|
||||
+ gsmStrength,
|
||||
+ new CellSignalStrengthWcdma(),
|
||||
+ new CellSignalStrengthTdscdma(),
|
||||
+ lteStrength,
|
||||
+ new CellSignalStrengthNr());
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+
|
||||
/**
|
||||
* Get the HAL version.
|
||||
*
|
||||
diff --git a/src/java/com/android/internal/telephony/RadioIndication.java b/src/java/com/android/internal/telephony/RadioIndication.java
|
||||
index c7244be82e..5df3f99896 100644
|
||||
--- a/src/java/com/android/internal/telephony/RadioIndication.java
|
||||
+++ b/src/java/com/android/internal/telephony/RadioIndication.java
|
||||
@@ -241,13 +241,26 @@ public class RadioIndication extends IRadioIndication.Stub {
|
||||
|
||||
public void currentSignalStrength(int indicationType,
|
||||
android.hardware.radio.V1_0.SignalStrength signalStrength) {
|
||||
- mRil.processIndication(RIL.RADIO_SERVICE, indicationType);
|
||||
|
||||
- SignalStrength ssInitial = RILUtils.convertHalSignalStrength(signalStrength);
|
||||
+ SignalStrength ss = null;
|
||||
+
|
||||
+ mRil.processIndication(RIL.RADIO_SERVICE, indicationType);
|
||||
|
||||
- SignalStrength ss = mRil.fixupSignalStrength10(ssInitial);
|
||||
// Note this is set to "verbose" because it happens frequently
|
||||
- if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, ss);
|
||||
+ if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, signalStrength);
|
||||
+
|
||||
+ // Fix signalStrength for Huawei
|
||||
+ String hardware = android.os.SystemProperties.get("ro.hardware", "");
|
||||
+ if(hardware.contains("hi3660") || hardware.contains("hi6250") || hardware.contains("hi3670") || hardware.contains("kirin"))
|
||||
+ {
|
||||
+ if (RIL.RILJ_LOGV) mRil.riljLog("currentSignalStrength Found Huawei device");
|
||||
+ ss = mRil.fixupSignalStrengthHuawei(signalStrength);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ SignalStrength ssInitial = RILUtils.convertHalSignalStrength(signalStrength);
|
||||
+ ss = mRil.fixupSignalStrength10(ssInitial);
|
||||
+ }
|
||||
|
||||
if (mRil.mSignalStrengthRegistrant != null) {
|
||||
mRil.mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult (null, ss, null));
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
From 7c87dcbab602de571b3bb3ada764eeac4e1ac623 Mon Sep 17 00:00:00 2001
|
||||
From: corneranchu <corneranchu@gmail.com>
|
||||
Date: Sat, 1 Oct 2022 01:49:58 +0000
|
||||
Subject: [PATCH 6/6] telephony: forward-port support for forceCognitive
|
||||
|
||||
* This is needed on some MTK devices. Android 10 refactored some code,
|
||||
so now the "non-persistent/cognitive" filter is relocated to RIL and
|
||||
also in DcTracker.setupData().
|
||||
|
||||
Change-Id: I7dd387a9f064a969ca5774e53b05388de12aa308
|
||||
---
|
||||
src/java/com/android/internal/telephony/RadioDataProxy.java | 4 +++-
|
||||
.../android/internal/telephony/dataconnection/DcTracker.java | 3 ++-
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/RadioDataProxy.java b/src/java/com/android/internal/telephony/RadioDataProxy.java
|
||||
index cbc762a59d..868a926667 100644
|
||||
--- a/src/java/com/android/internal/telephony/RadioDataProxy.java
|
||||
+++ b/src/java/com/android/internal/telephony/RadioDataProxy.java
|
||||
@@ -21,6 +21,7 @@ import android.net.LinkProperties;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
+import android.os.SystemProperties;
|
||||
import android.telephony.Rlog;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.data.DataProfile;
|
||||
@@ -234,7 +235,8 @@ public class RadioDataProxy extends RadioServiceProxy {
|
||||
} else {
|
||||
ArrayList<android.hardware.radio.V1_0.DataProfileInfo> dpis = new ArrayList<>();
|
||||
for (DataProfile dp : profiles) {
|
||||
- if (dp.isPersistent()) {
|
||||
+ boolean forceCognitive = SystemProperties.getBoolean("persist.sys.phh.radio.force_cognitive", false);
|
||||
+ if (dp.isPersistent() || forceCognitive) {
|
||||
dpis.add(RILUtils.convertToHalDataProfile10(dp));
|
||||
}
|
||||
}
|
||||
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
|
||||
index 28f69dcdc9..3e73e2b9ef 100755
|
||||
--- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
|
||||
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
|
||||
@@ -2160,8 +2160,9 @@ public class DcTracker extends Handler {
|
||||
}
|
||||
|
||||
// profile id is only meaningful when the profile is persistent on the modem.
|
||||
+ boolean forceCognitive = SystemProperties.getBoolean("persist.sys.phh.radio.force_cognitive", false);
|
||||
int profileId = DATA_PROFILE_INVALID;
|
||||
- if (apnSetting.isPersistent()) {
|
||||
+ if (apnSetting.isPersistent() || forceCognitive) {
|
||||
profileId = apnSetting.getProfileId();
|
||||
if (profileId == DATA_PROFILE_DEFAULT) {
|
||||
profileId = getApnProfileID(apnContext.getApnType());
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 62293368d2752ebf78577d2ad0c6d77c1800f034 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 19 Dec 2021 17:03:15 -0500
|
||||
Subject: [PATCH] Add a vendor800 command, to be able to call vendor-specific
|
||||
hwc functions
|
||||
|
||||
Change-Id: Icbef1e9e3a331ae3bd5a05687d545851d94d88a8
|
||||
---
|
||||
.../composer-command-buffer/2.1/ComposerCommandBuffer.h | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h
|
||||
index 499d3b96e..489578468 100644
|
||||
--- a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h
|
||||
+++ b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h
|
||||
@@ -402,6 +402,12 @@ class CommandWriterBase {
|
||||
endCommand();
|
||||
}
|
||||
|
||||
+ void vendor800_1(uint32_t val) {
|
||||
+ beginCommand(0x800 << 16, 1);
|
||||
+ write(val);
|
||||
+ endCommand();
|
||||
+ }
|
||||
+
|
||||
protected:
|
||||
template <typename T>
|
||||
void beginCommand(T command, uint16_t length) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 17d39de543bf4034bb9877a01b0a501aa7ebaf1d Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 14 Aug 2018 21:48:19 +0200
|
||||
Subject: [PATCH 1/2] Act as usb device when there is no hal, but we believe we
|
||||
are a device
|
||||
|
||||
Change-Id: I036090738525fd8cc63534d52d02ab1852950a7d
|
||||
---
|
||||
.../usb/UsbConnectionBroadcastReceiver.java | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java
|
||||
index 1a1f8ba414..b3981e3865 100644
|
||||
--- a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java
|
||||
+++ b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java
|
||||
@@ -90,6 +90,13 @@ public class UsbConnectionBroadcastReceiver extends BroadcastReceiver implements
|
||||
mFunctions = functions;
|
||||
mDataRole = mUsbBackend.getDataRole();
|
||||
mPowerRole = mUsbBackend.getPowerRole();
|
||||
+ //If we have no USB HAL, mDataRole is invalid
|
||||
+ //But we can't be connected AND have none data_role, so it's safe.
|
||||
+ //It would be better to fix UsbManager when no HAL is available, but that's more work
|
||||
+ if(mDataRole == UsbPortStatus.DATA_ROLE_NONE &&
|
||||
+ intent.getExtras().getBoolean(UsbManager.USB_CONNECTED) &&
|
||||
+ !intent.getExtras().getBoolean(UsbManager.USB_HOST_CONNECTED))
|
||||
+ mDataRole = UsbPortStatus.DATA_ROLE_DEVICE;
|
||||
} else if (UsbManager.ACTION_USB_PORT_CHANGED.equals(intent.getAction())) {
|
||||
UsbPortStatus portStatus = intent.getExtras()
|
||||
.getParcelable(UsbManager.EXTRA_PORT_STATUS);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From cab0069178e3525d340c03525d1ef2f6b3094bc6 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 2 May 2022 17:44:28 -0400
|
||||
Subject: [PATCH 2/2] Ignore cancelled fingerprint events, they are expected,
|
||||
plus add more fingerprint enroll logs
|
||||
|
||||
---
|
||||
.../biometrics/fingerprint/FingerprintEnrollEnrolling.java | 3 +++
|
||||
.../biometrics/fingerprint/FingerprintEnrollFindSensor.java | 1 +
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
|
||||
index de778bdf10..52b8604b00 100644
|
||||
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
|
||||
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
|
||||
@@ -492,6 +492,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
|
||||
@Override
|
||||
public void onEnrollmentError(int errMsgId, CharSequence errString) {
|
||||
+ android.util.Log.e("PHH-Enroll", "heyo " + errMsgId + ", " + errString , new Exception());
|
||||
+ if (errMsgId == 5) return;
|
||||
+
|
||||
FingerprintErrorDialog.showErrorDialog(this, errMsgId);
|
||||
stopIconAnimation();
|
||||
if (!mCanAssumeUdfps) {
|
||||
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
|
||||
index b5782cd510..909c29f2c7 100644
|
||||
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
|
||||
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
|
||||
@@ -235,6 +235,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
||||
|
||||
@Override
|
||||
public void onEnrollmentError(int errMsgId, CharSequence errString) {
|
||||
+ android.util.Log.e("PHH-Enroll", "heyo " + errMsgId + ", " + errString + ", " + mNextClicked, new Exception());
|
||||
if (mNextClicked && errMsgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
|
||||
mNextClicked = false;
|
||||
proceedToEnrolling(false /* cancelEnrollment */);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
From 29cbd9798ebec900adf442aae8e49aa33ec274bd Mon Sep 17 00:00:00 2001
|
||||
From: "tzu-hsien.huang" <tzu-hsien.huang@mediatek.com>
|
||||
Date: Wed, 20 Jul 2022 15:12:01 +0800
|
||||
Subject: [PATCH 1/6] Additionally check le_set_event_mask command resturn
|
||||
status with UNSUPPORTED_LMP_OR_LL_PARAMETER
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In GD BT stack, stack will check each return status of HCI Commands. E.g. reset , le_set_event_mask, set_event_mask …etc.
|
||||
In BT spec 5.2, SIG add some parameters for le_set_event_mask for le audio, like LE Terminate BIG Complete event: Supported.
|
||||
However, some legacy chips do not support LE Audio feature, and controller will return Status: Unsupported LMP Parameter Value when it receives this HCI Command
|
||||
When it checks the return value and find the status is not SUCCESS, it will cause FAIL and cannot be compatible with old legacy chip.
|
||||
After brushing GSI, Bluetooth will turn off automatically when it is turned on.
|
||||
So all CTS test will always fail.
|
||||
|
||||
Check le_set_event_mask command return status with SUCCESS or UNSUPPORTED_LMP_OR_LL_PARAMETER
|
||||
|
||||
Bug: 239662211
|
||||
Test: CtsBluetoothTestCases
|
||||
Change-Id: I2b0cede7f47eecd2124a386e958773289eb6f11c
|
||||
---
|
||||
system/gd/hci/controller.cc | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc
|
||||
index da5986fcb7..8be21a20a3 100644
|
||||
--- a/system/gd/hci/controller.cc
|
||||
+++ b/system/gd/hci/controller.cc
|
||||
@@ -540,7 +540,7 @@ struct Controller::impl {
|
||||
void le_set_event_mask(uint64_t le_event_mask) {
|
||||
std::unique_ptr<LeSetEventMaskBuilder> packet = LeSetEventMaskBuilder::Create(le_event_mask);
|
||||
hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn(
|
||||
- this, &Controller::impl::check_status<LeSetEventMaskCompleteView>));
|
||||
+ this, &Controller::impl::check_event_mask_status<LeSetEventMaskCompleteView>));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -551,6 +551,15 @@ struct Controller::impl {
|
||||
ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS);
|
||||
}
|
||||
|
||||
+ template <class T>
|
||||
+ void check_event_mask_status(CommandCompleteView view) {
|
||||
+ ASSERT(view.IsValid());
|
||||
+ auto status_view = T::Create(view);
|
||||
+ ASSERT(status_view.IsValid());
|
||||
+ ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS ||
|
||||
+ status_view.GetStatus() == ErrorCode::UNSUPPORTED_LMP_OR_LL_PARAMETER);
|
||||
+ }
|
||||
+
|
||||
#define OP_CODE_MAPPING(name) \
|
||||
case OpCode::name: { \
|
||||
uint16_t index = (uint16_t)OpCodeIndex::name; \
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
From 372796a9b26af8396c42591adc9c735c06892b5c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 25 May 2020 21:25:12 +0200
|
||||
Subject: [PATCH 2/6] Add persist.sys.phh.disable_a2dp_offload property to
|
||||
force a2dp offload
|
||||
|
||||
---
|
||||
system/btif/src/btif_av.cc | 7 ++++++-
|
||||
system/stack/a2dp/a2dp_codec_config.cc | 9 +++++++--
|
||||
2 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/system/btif/src/btif_av.cc b/system/btif/src/btif_av.cc
|
||||
index 8ae8db8add..5e0bccb134 100644
|
||||
--- a/system/btif/src/btif_av.cc
|
||||
+++ b/system/btif/src/btif_av.cc
|
||||
@@ -981,9 +981,14 @@ bt_status_t BtifAvSource::Init(
|
||||
osi_property_get("ro.bluetooth.a2dp_offload.supported", value_sup, "false");
|
||||
osi_property_get("persist.bluetooth.a2dp_offload.disabled", value_dis,
|
||||
"false");
|
||||
+ char value_phh[PROPERTY_VALUE_MAX] = {'\0'};
|
||||
+ osi_property_get("persist.sys.phh.disable_a2dp_offload", value_phh, "false");
|
||||
a2dp_offload_enabled_ =
|
||||
(strcmp(value_sup, "true") == 0) && (strcmp(value_dis, "false") == 0);
|
||||
- BTIF_TRACE_DEBUG("a2dp_offload.enable = %d", a2dp_offload_enabled_);
|
||||
+ if(strcmp(value_phh, "true") == 0)
|
||||
+ a2dp_offload_enabled_ = false;
|
||||
+
|
||||
+ LOG_ERROR("a2dp_offload.enable = %s", a2dp_offload_enabled_ ? "on" : "off");
|
||||
|
||||
callbacks_ = callbacks;
|
||||
if (a2dp_offload_enabled_) {
|
||||
diff --git a/system/stack/a2dp/a2dp_codec_config.cc b/system/stack/a2dp/a2dp_codec_config.cc
|
||||
index 52e0f6fcb1..d3ac2b9365 100644
|
||||
--- a/system/stack/a2dp/a2dp_codec_config.cc
|
||||
+++ b/system/stack/a2dp/a2dp_codec_config.cc
|
||||
@@ -557,13 +557,18 @@ bool A2dpCodecs::init() {
|
||||
char* tok = NULL;
|
||||
char* tmp_token = NULL;
|
||||
bool offload_codec_support[BTAV_A2DP_CODEC_INDEX_MAX] = {false};
|
||||
- char value_sup[PROPERTY_VALUE_MAX], value_dis[PROPERTY_VALUE_MAX];
|
||||
+ char value_sup[PROPERTY_VALUE_MAX], value_dis[PROPERTY_VALUE_MAX], value_phh[PROPERTY_VALUE_MAX];
|
||||
|
||||
osi_property_get("ro.bluetooth.a2dp_offload.supported", value_sup, "false");
|
||||
osi_property_get("persist.bluetooth.a2dp_offload.disabled", value_dis,
|
||||
"false");
|
||||
+ osi_property_get("persist.sys.phh.disable_a2dp_offload", value_phh, "false");
|
||||
a2dp_offload_status =
|
||||
(strcmp(value_sup, "true") == 0) && (strcmp(value_dis, "false") == 0);
|
||||
+ if(strcmp(value_phh, "true") == 0)
|
||||
+ a2dp_offload_status = false;
|
||||
+
|
||||
+ LOG_ERROR("Got a2dp offload status %s", a2dp_offload_status ? "on" : "off");
|
||||
|
||||
if (a2dp_offload_status) {
|
||||
char value_cap[PROPERTY_VALUE_MAX];
|
||||
@@ -652,7 +657,7 @@ bool A2dpCodecs::init() {
|
||||
}
|
||||
}
|
||||
|
||||
- return (!ordered_source_codecs_.empty() && !ordered_sink_codecs_.empty());
|
||||
+ return (!ordered_source_codecs_.empty() && !ordered_sink_codecs_.empty()) && !a2dp_offload_status;
|
||||
}
|
||||
|
||||
A2dpCodecConfig* A2dpCodecs::findSourceCodecConfig(
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From a9b8b7c86f5ec307c44b4fbe4de3fd3f223f77f7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 24 Aug 2022 10:41:29 -0400
|
||||
Subject: [PATCH 3/6] gd: hci: Ignore unexpected status events
|
||||
|
||||
For some reason, on some old devices, the controller will report a
|
||||
remote to support SNIFF_SUBRATING even when it does not. Just ignore the
|
||||
error here (the status event comes from the failure response).
|
||||
|
||||
Change-Id: Ifb9a65fd77f21d15a8dc1ced9240194d38218ef6
|
||||
---
|
||||
system/gd/hci/hci_layer.cc | 15 +++++++--------
|
||||
1 file changed, 7 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc
|
||||
index 57d7e55fff..b5a9d065be 100644
|
||||
--- a/system/gd/hci/hci_layer.cc
|
||||
+++ b/system/gd/hci/hci_layer.cc
|
||||
@@ -195,14 +195,13 @@ struct HciLayer::impl {
|
||||
EventView::Create(PacketView<kLittleEndian>(std::make_shared<std::vector<uint8_t>>(std::vector<uint8_t>()))));
|
||||
command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(move(command_complete_view));
|
||||
} else {
|
||||
- ASSERT_LOG(
|
||||
- command_queue_.front().waiting_for_status_ == is_status,
|
||||
- "0x%02hx (%s) was not expecting %s event",
|
||||
- op_code,
|
||||
- OpCodeText(op_code).c_str(),
|
||||
- logging_id.c_str());
|
||||
-
|
||||
- command_queue_.front().GetCallback<TResponse>()->Invoke(move(response_view));
|
||||
+ if (command_queue_.front().waiting_for_status_ == is_status) {
|
||||
+ command_queue_.front().GetCallback<TResponse>()->Invoke(move(response_view));
|
||||
+ } else {
|
||||
+ CommandCompleteView command_complete_view = CommandCompleteView::Create(
|
||||
+ EventView::Create(PacketView<kLittleEndian>(std::make_shared<std::vector<uint8_t>>(std::vector<uint8_t>()))));
|
||||
+ command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(move(command_complete_view));
|
||||
+ }
|
||||
}
|
||||
|
||||
command_queue_.pop_front();
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
From f33456723161bd07c435c62a16d3ae19c499c5c7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 24 Aug 2022 15:45:18 -0400
|
||||
Subject: [PATCH 4/6] audio_hal_interface: Optionally use sysbta HAL
|
||||
|
||||
Required to support sysbta, our system-side bt audio implementation.
|
||||
|
||||
Change-Id: I59973e6ec84c5923be8a7c67b36b2e237f000860
|
||||
---
|
||||
system/audio_hal_interface/aidl/client_interface_aidl.cc | 6 +++---
|
||||
system/audio_hal_interface/aidl/client_interface_aidl.h | 7 +++++++
|
||||
system/audio_hal_interface/hal_version_manager.cc | 9 ++++++++-
|
||||
3 files changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.cc b/system/audio_hal_interface/aidl/client_interface_aidl.cc
|
||||
index 814c6c7796..a38b6da495 100644
|
||||
--- a/system/audio_hal_interface/aidl/client_interface_aidl.cc
|
||||
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.cc
|
||||
@@ -55,7 +55,7 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface(
|
||||
|
||||
bool BluetoothAudioClientInterface::is_aidl_available() {
|
||||
auto service = AServiceManager_checkService(
|
||||
- kDefaultAudioProviderFactoryInterface.c_str());
|
||||
+ audioProviderFactoryInterface().c_str());
|
||||
return (service != nullptr);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ BluetoothAudioClientInterface::GetAudioCapabilities(SessionType session_type) {
|
||||
}
|
||||
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
|
||||
::ndk::SpAIBinder(AServiceManager_getService(
|
||||
- kDefaultAudioProviderFactoryInterface.c_str())));
|
||||
+ audioProviderFactoryInterface().c_str())));
|
||||
|
||||
if (provider_factory == nullptr) {
|
||||
LOG(ERROR) << __func__ << ", can't get capability from unknown factory";
|
||||
@@ -100,7 +100,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() {
|
||||
}
|
||||
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
|
||||
::ndk::SpAIBinder(AServiceManager_getService(
|
||||
- kDefaultAudioProviderFactoryInterface.c_str())));
|
||||
+ audioProviderFactoryInterface().c_str())));
|
||||
|
||||
if (provider_factory == nullptr) {
|
||||
LOG(ERROR) << __func__ << ", can't get capability from unknown factory";
|
||||
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.h b/system/audio_hal_interface/aidl/client_interface_aidl.h
|
||||
index 87dd450997..36d5fa5e86 100644
|
||||
--- a/system/audio_hal_interface/aidl/client_interface_aidl.h
|
||||
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.h
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "bluetooth_audio_port_impl.h"
|
||||
#include "common/message_loop_thread.h"
|
||||
#include "transport_instance.h"
|
||||
+#include "osi/include/properties.h"
|
||||
|
||||
#define BLUETOOTH_AUDIO_HAL_PROP_DISABLED \
|
||||
"persist.bluetooth.bluetooth_audio_hal.disabled"
|
||||
@@ -115,6 +116,12 @@ class BluetoothAudioClientInterface {
|
||||
// "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default";
|
||||
static inline const std::string kDefaultAudioProviderFactoryInterface =
|
||||
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
|
||||
+ static inline const std::string kSystemAudioProviderFactoryInterface =
|
||||
+ std::string() + IBluetoothAudioProviderFactory::descriptor + "/sysbta";
|
||||
+ static inline const std::string audioProviderFactoryInterface() {
|
||||
+ return osi_property_get_bool("persist.bluetooth.system_audio_hal.enabled", false)
|
||||
+ ? kSystemAudioProviderFactoryInterface : kDefaultAudioProviderFactoryInterface;
|
||||
+ }
|
||||
|
||||
private:
|
||||
IBluetoothTransportInstance* transport_;
|
||||
diff --git a/system/audio_hal_interface/hal_version_manager.cc b/system/audio_hal_interface/hal_version_manager.cc
|
||||
index a2c192f37d..c3d1cf35c2 100644
|
||||
--- a/system/audio_hal_interface/hal_version_manager.cc
|
||||
+++ b/system/audio_hal_interface/hal_version_manager.cc
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "aidl/audio_aidl_interfaces.h"
|
||||
+#include "osi/include/properties.h"
|
||||
|
||||
namespace bluetooth {
|
||||
namespace audio {
|
||||
@@ -33,6 +34,12 @@ using ::aidl::android::hardware::bluetooth::audio::
|
||||
|
||||
static const std::string kDefaultAudioProviderFactoryInterface =
|
||||
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
|
||||
+static const std::string kSystemAudioProviderFactoryInterface =
|
||||
+ std::string() + IBluetoothAudioProviderFactory::descriptor + "/sysbta";
|
||||
+static inline const std::string audioProviderFactoryInterface() {
|
||||
+ return osi_property_get_bool("persist.bluetooth.system_audio_hal.enabled", false)
|
||||
+ ? kSystemAudioProviderFactoryInterface : kDefaultAudioProviderFactoryInterface;
|
||||
+}
|
||||
|
||||
std::unique_ptr<HalVersionManager> HalVersionManager::instance_ptr =
|
||||
std::make_unique<HalVersionManager>();
|
||||
@@ -92,7 +99,7 @@ HalVersionManager::GetProvidersFactory_2_0() {
|
||||
|
||||
HalVersionManager::HalVersionManager() {
|
||||
if (AServiceManager_checkService(
|
||||
- kDefaultAudioProviderFactoryInterface.c_str()) != nullptr) {
|
||||
+ audioProviderFactoryInterface().c_str()) != nullptr) {
|
||||
hal_version_ = BluetoothAudioHalVersion::VERSION_AIDL_V1;
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 076360dab811912807739673ae8fd4d4a559f269 Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Ponces <ponces26@gmail.com>
|
||||
Date: Thu, 17 Jun 2021 15:48:53 +0100
|
||||
Subject: [PATCH 5/6] Add option to change eSCO Transport Unit Size
|
||||
|
||||
Fixes Bluetooth calls on some Samsung devices if set to 16.
|
||||
|
||||
It's still unknown if other Treble devices need other values so it's preferred to leave this able to be configured with another integer.
|
||||
|
||||
This applies to mSBC T2, T1 and CVSD codecs
|
||||
|
||||
Change-Id: I3e5897c2ce983042b9a4bef9def6744ba4253bcb
|
||||
---
|
||||
system/device/src/esco_parameters.cc | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/system/device/src/esco_parameters.cc b/system/device/src/esco_parameters.cc
|
||||
index 143e230a39..431aaacf17 100644
|
||||
--- a/system/device/src/esco_parameters.cc
|
||||
+++ b/system/device/src/esco_parameters.cc
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "check.h"
|
||||
|
||||
-static const enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = {
|
||||
+#include <cutils/properties.h>
|
||||
+static enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = {
|
||||
// CVSD D1
|
||||
{
|
||||
.transmit_bandwidth = TXRX_64KBITS_RATE,
|
||||
@@ -215,5 +216,10 @@ enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec) {
|
||||
CHECK(codec >= 0) << "codec index " << (int)codec << "< 0";
|
||||
CHECK(codec < ESCO_NUM_CODECS) << "codec index " << (int)codec << " > "
|
||||
<< ESCO_NUM_CODECS;
|
||||
+ int escoTransportUnitSize = property_get_int32("persist.sys.bt.esco_transport_unit_size", 0);
|
||||
+ if(escoTransportUnitSize) {
|
||||
+ default_esco_parameters[codec].input_transport_unit_size = escoTransportUnitSize;
|
||||
+ default_esco_parameters[codec].output_transport_unit_size = escoTransportUnitSize;
|
||||
+ }
|
||||
return default_esco_parameters[codec];
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
From 7665e4dfaf048902ca10a0d6b26ba1ac0a26d750 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 17 Oct 2021 17:17:13 -0400
|
||||
Subject: [PATCH 6/6] Don't abort when failing to get real-time priority
|
||||
|
||||
On some devices (like OP6), for unknown reason, trying to go to realtime
|
||||
fails with EPERM.
|
||||
There is no good reason to actually require real-time, so don't fail
|
||||
when we don't get it
|
||||
This fixes gabeldorsche on OP6
|
||||
Not yet legacy bluetooth stack
|
||||
|
||||
Change-Id: Id25dac186628e933185bdfd640498004459b375a
|
||||
---
|
||||
system/btif/src/btif_a2dp_sink.cc | 2 +-
|
||||
system/btif/src/btif_a2dp_source.cc | 2 +-
|
||||
system/osi/src/alarm.cc | 12 +++++++++++-
|
||||
system/stack/btu/btu_task.cc | 2 +-
|
||||
4 files changed, 14 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/system/btif/src/btif_a2dp_sink.cc b/system/btif/src/btif_a2dp_sink.cc
|
||||
index 665965a3cb..d1f00ceed1 100644
|
||||
--- a/system/btif/src/btif_a2dp_sink.cc
|
||||
+++ b/system/btif/src/btif_a2dp_sink.cc
|
||||
@@ -197,7 +197,7 @@ bool btif_a2dp_sink_init() {
|
||||
/* Schedule the rest of the operations */
|
||||
if (!btif_a2dp_sink_cb.worker_thread.EnableRealTimeScheduling()) {
|
||||
#if defined(OS_ANDROID)
|
||||
- LOG(FATAL) << __func__
|
||||
+ LOG(ERROR) << __func__
|
||||
<< ": Failed to increase A2DP decoder thread priority";
|
||||
#endif
|
||||
}
|
||||
diff --git a/system/btif/src/btif_a2dp_source.cc b/system/btif/src/btif_a2dp_source.cc
|
||||
index f13abac71a..a6a84b519e 100644
|
||||
--- a/system/btif/src/btif_a2dp_source.cc
|
||||
+++ b/system/btif/src/btif_a2dp_source.cc
|
||||
@@ -364,7 +364,7 @@ static void btif_a2dp_source_startup_delayed() {
|
||||
LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str());
|
||||
if (!btif_a2dp_source_thread.EnableRealTimeScheduling()) {
|
||||
#if defined(OS_ANDROID)
|
||||
- LOG(FATAL) << __func__ << ": unable to enable real time scheduling";
|
||||
+ LOG(ERROR) << __func__ << ": unable to enable real time scheduling";
|
||||
#endif
|
||||
}
|
||||
if (!bluetooth::audio::a2dp::init(&btif_a2dp_source_thread)) {
|
||||
diff --git a/system/osi/src/alarm.cc b/system/osi/src/alarm.cc
|
||||
index 19baacbd68..6db41099b8 100644
|
||||
--- a/system/osi/src/alarm.cc
|
||||
+++ b/system/osi/src/alarm.cc
|
||||
@@ -678,7 +678,17 @@ static bool timer_create_internal(const clockid_t clock_id, timer_t* timer) {
|
||||
sigevent.sigev_notify = SIGEV_THREAD;
|
||||
sigevent.sigev_notify_function = (void (*)(union sigval))timer_callback;
|
||||
sigevent.sigev_notify_attributes = &thread_attr;
|
||||
- if (timer_create(clock_id, &sigevent, timer) == -1) {
|
||||
+
|
||||
+ int ret = timer_create(clock_id, &sigevent, timer);
|
||||
+ if (ret == -1) {
|
||||
+ LOG_ERROR("%s failed to create timer with RT err %s... Try again without RT", __func__, strerror(errno));
|
||||
+ // Recreate timer without RT priority
|
||||
+ memset(&sigevent, 0, sizeof(sigevent));
|
||||
+ sigevent.sigev_notify = SIGEV_THREAD;
|
||||
+ sigevent.sigev_notify_function = (void (*)(union sigval))timer_callback;
|
||||
+ ret = timer_create(clock_id, &sigevent, timer);
|
||||
+ }
|
||||
+ if (ret == -1) {
|
||||
LOG_ERROR("%s unable to create timer with clock %d: %s", __func__, clock_id,
|
||||
strerror(errno));
|
||||
if (clock_id == CLOCK_BOOTTIME_ALARM) {
|
||||
diff --git a/system/stack/btu/btu_task.cc b/system/stack/btu/btu_task.cc
|
||||
index 5f3260763f..2f937cd3ee 100644
|
||||
--- a/system/stack/btu/btu_task.cc
|
||||
+++ b/system/stack/btu/btu_task.cc
|
||||
@@ -122,7 +122,7 @@ void main_thread_start_up() {
|
||||
}
|
||||
if (!main_thread.EnableRealTimeScheduling()) {
|
||||
#if defined(OS_ANDROID)
|
||||
- LOG(FATAL) << __func__ << ": unable to enable real time scheduling";
|
||||
+ LOG(ERROR) << __func__ << ": unable to enable real time scheduling";
|
||||
#else
|
||||
LOG(ERROR) << __func__ << ": unable to enable real time scheduling";
|
||||
#endif
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From cbf0d08f4f750c05cbd91c5384f1f8ed90ac8fb9 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 26 Oct 2022 18:10:04 -0400
|
||||
Subject: [PATCH 1/3] Allow failing to load bpf programs, for BPF-less devices
|
||||
|
||||
Change-Id: I68ba3be2e15c188e56e32a6ecf844e1ca64d560f
|
||||
---
|
||||
netd/BpfHandler.cpp | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/netd/BpfHandler.cpp b/netd/BpfHandler.cpp
|
||||
index 6ae26c38f..8262f7530 100644
|
||||
--- a/netd/BpfHandler.cpp
|
||||
+++ b/netd/BpfHandler.cpp
|
||||
@@ -71,8 +71,15 @@ static Status initPrograms(const char* cg2_path) {
|
||||
ALOGE("Failed to open the cgroup directory: %s", strerror(ret));
|
||||
return statusFromErrno(ret, "Open the cgroup directory failed");
|
||||
}
|
||||
- RETURN_IF_NOT_OK(attachProgramToCgroup(BPF_EGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_EGRESS));
|
||||
- RETURN_IF_NOT_OK(attachProgramToCgroup(BPF_INGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_INGRESS));
|
||||
+ auto ret = attachProgramToCgroup(BPF_EGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_EGRESS);
|
||||
+ if (!isOk(ret)) {
|
||||
+ ALOGE("Failed loading egress program");
|
||||
+ }
|
||||
+
|
||||
+ auto ret2 = attachProgramToCgroup(BPF_INGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_INGRESS);
|
||||
+ if (!isOk(ret)) {
|
||||
+ ALOGE("Failed loading ingress program");
|
||||
+ }
|
||||
|
||||
// For the devices that support cgroup socket filter, the socket filter
|
||||
// should be loaded successfully by bpfloader. So we attach the filter to
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 516f4a9638dac7895ace937585b242a4c0b61c16 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 26 Oct 2022 18:10:46 -0400
|
||||
Subject: [PATCH 2/3] BpfMap() implemented new checks for kernel >=4.14 but as
|
||||
assert. Since we removed the asset but moved those checks into isOk, use isOk
|
||||
as well
|
||||
|
||||
Change-Id: Ia7fa7494a2c320aa521e915d4926e8748d472689
|
||||
---
|
||||
service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
|
||||
index 9ebef4d6d..ee30f3db3 100644
|
||||
--- a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
|
||||
+++ b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
|
||||
@@ -102,13 +102,13 @@ int bpfGetIfaceStatsInternal(const char* iface, Stats* stats,
|
||||
int bpfGetIfaceStats(const char* iface, Stats* stats) {
|
||||
BpfMapRO<uint32_t, StatsValue> ifaceStatsMap(IFACE_STATS_MAP_PATH);
|
||||
int ret;
|
||||
- if (!ifaceStatsMap.isValid()) {
|
||||
+ if (!ifaceStatsMap.isValid() || !ifaceStatsMap.isOk()) {
|
||||
ret = -errno;
|
||||
ALOGE("get ifaceStats map fd failed: %s", strerror(errno));
|
||||
return ret;
|
||||
}
|
||||
BpfMapRO<uint32_t, IfaceValue> ifaceIndexNameMap(IFACE_INDEX_NAME_MAP_PATH);
|
||||
- if (!ifaceIndexNameMap.isValid()) {
|
||||
+ if (!ifaceIndexNameMap.isValid() || !ifaceStatsMap.isOk()) {
|
||||
ret = -errno;
|
||||
ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno));
|
||||
return ret;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From dcc343ca4d70d0b9dd8e6a9ff08af85d47bc31bf Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 26 Oct 2022 18:11:10 -0400
|
||||
Subject: [PATCH 3/3] Dont delete UID from BpfMap on BPF-less kernel
|
||||
|
||||
Change-Id: I93b5b8237f6655cb47e0b0584c54cad73a51e7b2
|
||||
---
|
||||
service-t/src/com/android/server/net/NetworkStatsService.java | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/service-t/src/com/android/server/net/NetworkStatsService.java b/service-t/src/com/android/server/net/NetworkStatsService.java
|
||||
index 4f0f3411a..d45e8fa58 100644
|
||||
--- a/service-t/src/com/android/server/net/NetworkStatsService.java
|
||||
+++ b/service-t/src/com/android/server/net/NetworkStatsService.java
|
||||
@@ -2421,6 +2421,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
* @param uid
|
||||
*/
|
||||
private void deleteKernelTagData(int uid) {
|
||||
+ if(mCookieTagMap == null) return;
|
||||
try {
|
||||
mCookieTagMap.forEach((key, value) -> {
|
||||
// If SkDestroyListener deletes the socket tag while this code is running,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0e585594a973b9b93ae4ea6bf19df42263c73079 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 13 Oct 2021 10:56:52 -0400
|
||||
Subject: [PATCH 1/2] Support no-bpf usecase
|
||||
|
||||
Change-Id: I75a427a2a41aa4ab1104ad88a891bef0dc2d9c91
|
||||
---
|
||||
bpfloader/BpfLoader.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
|
||||
index 5cd80b7..bbfa7a8 100644
|
||||
--- a/bpfloader/BpfLoader.cpp
|
||||
+++ b/bpfloader/BpfLoader.cpp
|
||||
@@ -194,8 +194,8 @@ int main(int argc, char** argv) {
|
||||
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
|
||||
"problems or startup script race.");
|
||||
ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
|
||||
- sleep(20);
|
||||
- return 2;
|
||||
+ android::base::SetProperty("bpf.progs_loaded", "1");
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 7083e9ecf6b296d9490ac12b124b91d48772f046 Mon Sep 17 00:00:00 2001
|
||||
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
||||
Date: Wed, 19 Oct 2022 02:20:05 +0000
|
||||
Subject: [PATCH 2/2] Revert "detect inability to write to index != 0 of bpf
|
||||
map array"
|
||||
|
||||
This reverts commit ead9d83423877458023056f6ccf9390950d6726f.
|
||||
---
|
||||
bpfloader/BpfLoader.cpp | 9 ---------
|
||||
1 file changed, 9 deletions(-)
|
||||
|
||||
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
|
||||
index bbfa7a8..9ace0fa 100644
|
||||
--- a/bpfloader/BpfLoader.cpp
|
||||
+++ b/bpfloader/BpfLoader.cpp
|
||||
@@ -199,15 +199,6 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
- int key = 1;
|
||||
- int value = 123;
|
||||
- android::base::unique_fd map(
|
||||
- android::bpf::createMap(BPF_MAP_TYPE_ARRAY, sizeof(key), sizeof(value), 2, 0));
|
||||
- if (android::bpf::writeToMapEntry(map, &key, &value, BPF_ANY)) {
|
||||
- ALOGE("Critical kernel bug - failure to write into index 1 of 2 element bpf map array.");
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
if (android::base::SetProperty("bpf.progs_loaded", "1") == false) {
|
||||
ALOGE("Failed to set bpf.progs_loaded property");
|
||||
return 1;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From 0778d5951884c0c536da6e1e8174e37e9097c7f0 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 23 Feb 2022 17:37:47 -0500
|
||||
Subject: [PATCH 01/14] Let system override ro.apex.updatable
|
||||
|
||||
APEX are broken because of a kernel bug in Android 10 devices
|
||||
So we have system set ro.apex.updatable = false
|
||||
However, vendor can override system, which prevents us from setting this
|
||||
to false
|
||||
So, ignore the override policy for this prop
|
||||
---
|
||||
init/property_service.cpp | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/init/property_service.cpp b/init/property_service.cpp
|
||||
index 8db414a97..3bbd248ef 100644
|
||||
--- a/init/property_service.cpp
|
||||
+++ b/init/property_service.cpp
|
||||
@@ -727,8 +727,12 @@ static void LoadProperties(char* data, const char* filter, const char* filename,
|
||||
} else if (it->second != value) {
|
||||
LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second
|
||||
<< "' with new value '" << value << "'";
|
||||
- it->second = value;
|
||||
- }
|
||||
+ if(strcmp("ro.apex.updatable", key) == 0) {
|
||||
+ LOG(WARNING) << "... Ignored";
|
||||
+ } else {
|
||||
+ it->second = value;
|
||||
+ }
|
||||
+ }
|
||||
} else {
|
||||
LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value
|
||||
<< "' in property file '" << filename << "': " << error;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user