diff --git a/system/core/0001-init-Do-not-start-console-service-when-debuggable.patch b/system/core/0001-init-Do-not-start-console-service-when-debuggable.patch index d82a182..e5d4383 100644 --- a/system/core/0001-init-Do-not-start-console-service-when-debuggable.patch +++ b/system/core/0001-init-Do-not-start-console-service-when-debuggable.patch @@ -1,4 +1,4 @@ -From 9a08bf33057b2fe1ec3e4e2d922a67462bafe347 Mon Sep 17 00:00:00 2001 +From ce23dec99926b3e688ae5cd85f5da71c8765f89c Mon Sep 17 00:00:00 2001 From: Isaac Chen Date: Wed, 23 Jun 2021 13:07:30 +0800 Subject: [PATCH 1/2] init: Do not start console service when debuggable @@ -27,5 +27,5 @@ index 317f80908..9dc09ea4a 100644 # TODO(b/135984674): reset all necessary properties here. setprop sys.boot_completed "" -- -2.43.1 +2.44.0 diff --git a/system/core/0002-init-Override-select-system-properties.patch b/system/core/0002-init-Override-select-system-properties.patch index ec54513..631840d 100644 --- a/system/core/0002-init-Override-select-system-properties.patch +++ b/system/core/0002-init-Override-select-system-properties.patch @@ -1,66 +1,33 @@ -From a0aa4c41f921134482737cf32437854816aba057 Mon Sep 17 00:00:00 2001 +From b5256522214257f1a5f8ee5ecac84609993f8129 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Wed, 23 Feb 2022 17:37:47 -0500 Subject: [PATCH 2/2] init: Override select system properties -* ro.apex.updatable is overridden based on the kernel version and - vendor. * adb secure props and logd can be overridden from system. Change-Id: I94efa3f108ae97711026f099f367b6bea325629f --- - init/property_service.cpp | 42 +++++++++++++++++++++++++++++++++++---- - 1 file changed, 38 insertions(+), 4 deletions(-) + init/property_service.cpp | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/init/property_service.cpp b/init/property_service.cpp -index 013924778..90c6fa538 100644 +index 013924778..ce164372a 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp -@@ -64,6 +64,8 @@ +@@ -64,6 +64,7 @@ #include #include #include -+#include + #include "debug_ramdisk.h" #include "epoll.h" #include "init.h" -@@ -704,6 +706,26 @@ uint32_t InitPropertySet(const std::string& name, const std::string& value) { - static Result load_properties_from_file(const char*, const char*, - std::map*); - -+static bool kernel_supports_capex() { -+ // Put a threshold at >= 5.0 -+ struct utsname buf; -+ uname(&buf); -+ const char *where = buf.release; -+ int a = atoi(where); -+ if (a >= 5) return true; -+ -+ // If there are vendor apexes, we most likely actually need them -+ auto dir = std::unique_ptr{opendir("/vendor/apex"), closedir}; -+ if (!dir) { -+ return false; -+ } -+ for (struct dirent* ent = readdir(dir.get()); ent; ent = readdir(dir.get())) { -+ if(strstr(ent->d_name, "apex")) return true; -+ } -+ -+ return false; -+} -+ - /* - * Filter is used to decide which properties to load: NULL loads all keys, - * "ro.foo.*" is a prefix match, and "ro.foo.bar" is an exact match. -@@ -796,13 +818,25 @@ static void LoadProperties(char* data, const char* filter, const char* filename, +@@ -796,13 +797,20 @@ static void LoadProperties(char* data, const char* filter, const char* filename, std::string error; if (CheckPermissions(key, value, context, cr, &error) == PROP_SUCCESS) { auto it = properties->find(key); + const char *new_value = value; + -+ if (strcmp("ro.apex.updatable", key) == 0) { -+ new_value = kernel_supports_capex() ? "true" : "false"; -+ } if (it == properties->end()) { - (*properties)[key] = value; - } else if (it->second != value) { @@ -70,9 +37,7 @@ index 013924778..90c6fa538 100644 << "' with new value '" << value << "'"; - it->second = value; - } -+ if (strcmp("ro.apex.updatable", key) == 0) { -+ LOG(WARNING) << "... Ignored apex by kernel version"; -+ } else if (strstr(key, "adb") || strstr(key, "secure") || strstr(key, "ro.logd.kernel") ++ if (strstr(key, "adb") || strstr(key, "secure") || strstr(key, "ro.logd.kernel") + || strcmp("ro.control_privapp_permissions", key) == 0) { + LOG(WARNING) << "... Ignored"; + } else { @@ -83,5 +48,5 @@ index 013924778..90c6fa538 100644 LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value << "' in property file '" << filename << "': " << error; -- -2.43.1 +2.44.0