s/core: Remove useless ro.apex.updatable override
This doesn't work anymore on r29; remove it. If we want to boot on devices where apexes are broken, we have to find another way.
This commit is contained in:
parent
2eb02ceb6b
commit
714720852e
|
@ -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 <tingyi364@gmail.com>
|
From: Isaac Chen <tingyi364@gmail.com>
|
||||||
Date: Wed, 23 Jun 2021 13:07:30 +0800
|
Date: Wed, 23 Jun 2021 13:07:30 +0800
|
||||||
Subject: [PATCH 1/2] init: Do not start console service when debuggable
|
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.
|
# TODO(b/135984674): reset all necessary properties here.
|
||||||
setprop sys.boot_completed ""
|
setprop sys.boot_completed ""
|
||||||
--
|
--
|
||||||
2.43.1
|
2.44.0
|
||||||
|
|
||||||
|
|
|
@ -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 <phh@phh.me>
|
From: Pierre-Hugues Husson <phh@phh.me>
|
||||||
Date: Wed, 23 Feb 2022 17:37:47 -0500
|
Date: Wed, 23 Feb 2022 17:37:47 -0500
|
||||||
Subject: [PATCH 2/2] init: Override select system properties
|
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.
|
* adb secure props and logd can be overridden from system.
|
||||||
|
|
||||||
Change-Id: I94efa3f108ae97711026f099f367b6bea325629f
|
Change-Id: I94efa3f108ae97711026f099f367b6bea325629f
|
||||||
---
|
---
|
||||||
init/property_service.cpp | 42 +++++++++++++++++++++++++++++++++++----
|
init/property_service.cpp | 16 ++++++++++++----
|
||||||
1 file changed, 38 insertions(+), 4 deletions(-)
|
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
diff --git a/init/property_service.cpp b/init/property_service.cpp
|
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
|
--- a/init/property_service.cpp
|
||||||
+++ b/init/property_service.cpp
|
+++ b/init/property_service.cpp
|
||||||
@@ -64,6 +64,8 @@
|
@@ -64,6 +64,7 @@
|
||||||
#include <selinux/android.h>
|
#include <selinux/android.h>
|
||||||
#include <selinux/label.h>
|
#include <selinux/label.h>
|
||||||
#include <selinux/selinux.h>
|
#include <selinux/selinux.h>
|
||||||
+#include <sys/utsname.h>
|
|
||||||
+
|
+
|
||||||
#include "debug_ramdisk.h"
|
#include "debug_ramdisk.h"
|
||||||
#include "epoll.h"
|
#include "epoll.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
@@ -704,6 +706,26 @@ uint32_t InitPropertySet(const std::string& name, const std::string& value) {
|
@@ -796,13 +797,20 @@ static void LoadProperties(char* data, const char* filter, const char* filename,
|
||||||
static Result<void> load_properties_from_file(const char*, const char*,
|
|
||||||
std::map<std::string, std::string>*);
|
|
||||||
|
|
||||||
+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<DIR, decltype(&closedir)>{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,
|
|
||||||
std::string error;
|
std::string error;
|
||||||
if (CheckPermissions(key, value, context, cr, &error) == PROP_SUCCESS) {
|
if (CheckPermissions(key, value, context, cr, &error) == PROP_SUCCESS) {
|
||||||
auto it = properties->find(key);
|
auto it = properties->find(key);
|
||||||
+ const char *new_value = value;
|
+ const char *new_value = value;
|
||||||
+
|
+
|
||||||
+ if (strcmp("ro.apex.updatable", key) == 0) {
|
|
||||||
+ new_value = kernel_supports_capex() ? "true" : "false";
|
|
||||||
+ }
|
|
||||||
if (it == properties->end()) {
|
if (it == properties->end()) {
|
||||||
- (*properties)[key] = value;
|
- (*properties)[key] = value;
|
||||||
- } else if (it->second != value) {
|
- } else if (it->second != value) {
|
||||||
|
@ -70,9 +37,7 @@ index 013924778..90c6fa538 100644
|
||||||
<< "' with new value '" << value << "'";
|
<< "' with new value '" << value << "'";
|
||||||
- it->second = value;
|
- it->second = value;
|
||||||
- }
|
- }
|
||||||
+ if (strcmp("ro.apex.updatable", key) == 0) {
|
+ if (strstr(key, "adb") || strstr(key, "secure") || strstr(key, "ro.logd.kernel")
|
||||||
+ LOG(WARNING) << "... Ignored apex by kernel version";
|
|
||||||
+ } else if (strstr(key, "adb") || strstr(key, "secure") || strstr(key, "ro.logd.kernel")
|
|
||||||
+ || strcmp("ro.control_privapp_permissions", key) == 0) {
|
+ || strcmp("ro.control_privapp_permissions", key) == 0) {
|
||||||
+ LOG(WARNING) << "... Ignored";
|
+ LOG(WARNING) << "... Ignored";
|
||||||
+ } else {
|
+ } else {
|
||||||
|
@ -83,5 +48,5 @@ index 013924778..90c6fa538 100644
|
||||||
LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value
|
LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value
|
||||||
<< "' in property file '" << filename << "': " << error;
|
<< "' in property file '" << filename << "': " << error;
|
||||||
--
|
--
|
||||||
2.43.1
|
2.44.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue