system/core: Do not disable property override unconditionally

This commit is contained in:
Peter Cai 2023-04-21 13:09:46 -04:00
parent f044689371
commit b7968f2d3d
3 changed files with 36 additions and 32 deletions

View File

@ -1,27 +0,0 @@
From edc01c6d7e6cebfaa1e7301b4d1dbc1541fd83b0 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 7 Oct 2021 15:48:11 -0400
Subject: [PATCH 1/2] Stop overriding system properties from vendor
This is annoying to disable apexes, or force adb
Change-Id: Ifd0072c631349b23945df4ab401ba26eca07131f
---
init/property_service.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 9f7c21543..bb295586a 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -726,7 +726,6 @@ 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;
}
} else {
LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value
--
2.37.2

View File

@ -1,7 +1,7 @@
From 1d0dc75a012a6a336beb420a3642b2837da9ed8a Mon Sep 17 00:00:00 2001
From f53da166596fc34df3255b1c5120fd7cdcf21e5f Mon Sep 17 00:00:00 2001
From: Isaac Chen <tingyi364@gmail.com>
Date: Wed, 23 Jun 2021 13:07:30 +0800
Subject: [PATCH 2/2] init: Do not start console service when debuggable
Subject: [PATCH 1/2] init: Do not start console service when debuggable
Google added a check for this in R, when it's running it will show a
notification about that performance is impacted.
@ -13,10 +13,10 @@ Change-Id: I34cfd6b42d3b9aee4b3e63181480cfb8b1255f29
1 file changed, 3 deletions(-)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index cd71aa8aa..417de0d4a 100644
index 02e51d2c4..ab45bb032 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -1268,9 +1268,6 @@ on property:ro.debuggable=1
@@ -1277,9 +1277,6 @@ on property:ro.debuggable=1
# Give reads to anyone for the accessibility trace folder on debug builds.
chmod 0775 /data/misc/a11ytrace
@ -27,5 +27,5 @@ index cd71aa8aa..417de0d4a 100644
# TODO(b/135984674): reset all necessary properties here.
setprop sys.boot_completed ""
--
2.37.2
2.40.0

View File

@ -0,0 +1,31 @@
From cad2e8dd3b7b9362d042948c181878a61db1cf13 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Fri, 21 Apr 2023 13:08:48 -0400
Subject: [PATCH 2/2] Let system override some properties (ro.apex.updatable,
ro.adb.secure, etc.)
Change-Id: I3c84fa617f0ab7990abb0d905230a8703cf39bf7
---
init/property_service.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 26341b196..ff7861351 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -726,7 +726,11 @@ 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 || strstr(key, "adb") || strstr(key, "secure")) {
+ LOG(WARNING) << "... Ignored";
+ } else {
+ it->second = value;
+ }
}
} else {
LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value
--
2.40.0