From 079e45346d106adbcf6db2cf08216c1a450c26db Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Wed, 17 Aug 2022 21:13:14 -0400 Subject: [PATCH] Initial patchset for AOSP 13 --- ...support-glob-matching-for-properties.patch | 36 ++++++ ...d.version.incremental-to-signal-OTA-.patch | 121 ++++++++++++++++++ ...riding-system-properties-from-vendor.patch | 27 ++++ ...tart-console-service-when-debuggable.patch | 31 +++++ 4 files changed, 215 insertions(+) create mode 100644 frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch create mode 100644 frameworks/base/0002-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch create mode 100644 system/core/0001-Stop-overriding-system-properties-from-vendor.patch create mode 100644 system/core/0002-init-Do-not-start-console-service-when-debuggable.patch diff --git a/frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch b/frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch new file mode 100644 index 0000000..db651de --- /dev/null +++ b/frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch @@ -0,0 +1,36 @@ +From 0f7b66cc9930141f645569f354e901bef5ae384b Mon Sep 17 00:00:00 2001 +From: Peter Cai +Date: Tue, 12 Oct 2021 21:37:22 -0400 +Subject: [PATCH 1/2] PackageParser: support glob matching for properties + +Needed to make phh's vendor overlays work +--- + core/java/android/content/pm/PackageParser.java | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java +index 44dc28d2b0fa..27c0795d47d2 100644 +--- a/core/java/android/content/pm/PackageParser.java ++++ b/core/java/android/content/pm/PackageParser.java +@@ -2535,8 +2535,16 @@ 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; ++ if (propValues[i].startsWith("+") && propValues[i].endsWith("*")) { ++ // Glob matching ++ int idx = TextUtils.indexOf(currValue, propValues[i].substring(1, propValues[i].length() - 1)); ++ if (idx < 0) { ++ return false; ++ } ++ } else { ++ if (!TextUtils.equals(currValue, propValues[i])) { ++ return false; ++ } + } + } + return true; +-- +2.37.2 + diff --git a/frameworks/base/0002-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch b/frameworks/base/0002-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch new file mode 100644 index 0000000..2899273 --- /dev/null +++ b/frameworks/base/0002-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch @@ -0,0 +1,121 @@ +From 381aa92ab038fc6c0157c5b9396218e80ed3ae65 Mon Sep 17 00:00:00 2001 +From: dhacker29 +Date: Tue, 24 Nov 2015 01:53:47 -0500 +Subject: [PATCH 2/2] fw/b: Use ro.build.version.incremental to signal OTA + upgrades + +[PeterCxy]: On T, there is a new class PackagePartitions that is +responsible for detecting updates to not just the system, but also other +partitions. Most of the fingerprint detection were moved there, and thus +modifications were made there to use the +ro..build.version.incremental property. + +Squash of: + +Author: dhacker29 +Date: Tue Nov 24 01:53:47 2015 -0500 + Core: Use ro.build.date to signal mIsUpgrade + + M: We use a static fingerprint that is only changed when a new OEM build is released, so + every flash shows Android is starting instead of upgrading. This will fix that. + N: even though we dont have the dexopt sceen on N, this is still needed to delete the + correct caches, and grant/deny specific runtime permissions like a true oem update + would do. + Updated for Nougat By: BeansTown106 + + Change-Id: I0e3ed5c8f0351e48944432ae6a0c5194ddeff1fa + +Author: Sam Mortimer +Date: Fri Sep 28 13:45:00 2018 -0700 + fw/b UserManagerService: Use ro.build.date to signal upgrades + + *) We changed PackageManagerService to use Build.DATE instead of + Build.FINGERPRINT to detect upgrade. Do the same for + UserManagerService. + *) Affects generation of preboot intent and app data migration. + + Change-Id: I56887b7ca842afdcf3cf84b27b4c04667cf43307 + +Author: Wang Han <416810799@qq.com> +Date: Sat Dec 29 23:33:20 2018 +0800 + ShortcutService: Use ro.build.date to signal package scanning + + * Affects system apps scanning. + + Change-Id: I5f6d6647929f5b5ae7e820b18e95bf5ed2ec8d1c + +Author: maxwen +Date: Tue Nov 19 01:02:01 2019 +0100 + base: Use ro.build.date to clear cache dirs on update + + instead of using ro.build.fingerprint we explictly need to use ro.build.date + + Change-Id: Ib3e80e58eb8c9a21c108e9f5cd2dbdb7ada8e3a4 + +Author: maxwen +Date: Wed Oct 28 07:07:10 2020 -0400 + One more Build.FINGERPRINT to Build.DATE change + + Change-Id: I13dbf3d7f6587d3fcd6591cc0f861b34b6d5561c + +Change-Id: If0eb969ba509981f9209ffa37a949d9042ef4c2a +--- + core/java/android/app/admin/SystemUpdateInfo.java | 4 ++-- + core/java/android/content/pm/PackagePartitions.java | 4 ++-- + services/core/java/com/android/server/pm/ShortcutService.java | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/core/java/android/app/admin/SystemUpdateInfo.java b/core/java/android/app/admin/SystemUpdateInfo.java +index b88bf76c96ca..fdf2b3f54311 100644 +--- a/core/java/android/app/admin/SystemUpdateInfo.java ++++ b/core/java/android/app/admin/SystemUpdateInfo.java +@@ -132,7 +132,7 @@ public final class SystemUpdateInfo implements Parcelable { + out.startTag(null, tag); + out.attributeLong(null, ATTR_RECEIVED_TIME, mReceivedTime); + out.attributeInt(null, ATTR_SECURITY_PATCH_STATE, mSecurityPatchState); +- out.attribute(null, ATTR_ORIGINAL_BUILD , Build.FINGERPRINT); ++ out.attribute(null, ATTR_ORIGINAL_BUILD , Build.VERSION.INCREMENTAL); + out.endTag(null, tag); + } + +@@ -141,7 +141,7 @@ public final class SystemUpdateInfo implements Parcelable { + public static SystemUpdateInfo readFromXml(TypedXmlPullParser parser) { + // If an OTA has been applied (build fingerprint has changed), discard stale info. + final String buildFingerprint = parser.getAttributeValue(null, ATTR_ORIGINAL_BUILD ); +- if (!Build.FINGERPRINT.equals(buildFingerprint)) { ++ if (!Build.VERSION.INCREMENTAL.equals(buildFingerprint)) { + return null; + } + try { +diff --git a/core/java/android/content/pm/PackagePartitions.java b/core/java/android/content/pm/PackagePartitions.java +index ff80e614be58..8bf0d5ffff76 100644 +--- a/core/java/android/content/pm/PackagePartitions.java ++++ b/core/java/android/content/pm/PackagePartitions.java +@@ -129,9 +129,9 @@ public class PackagePartitions { + final String[] digestProperties = new String[SYSTEM_PARTITIONS.size() + 1]; + for (int i = 0; i < SYSTEM_PARTITIONS.size(); i++) { + final String partitionName = SYSTEM_PARTITIONS.get(i).getName(); +- digestProperties[i] = "ro." + partitionName + ".build.fingerprint"; ++ digestProperties[i] = "ro." + partitionName + ".build.version.incremental"; + } +- digestProperties[SYSTEM_PARTITIONS.size()] = "ro.build.fingerprint"; // build fingerprint ++ digestProperties[SYSTEM_PARTITIONS.size()] = "ro.build.version.incremental"; // build fingerprint + return SystemProperties.digestOf(digestProperties); + } + +diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java +index f2bcf5e461a7..0e66d1a7a7ef 100644 +--- a/services/core/java/com/android/server/pm/ShortcutService.java ++++ b/services/core/java/com/android/server/pm/ShortcutService.java +@@ -5136,7 +5136,7 @@ public class ShortcutService extends IShortcutService.Stub { + + // Injection point. + String injectBuildFingerprint() { +- return Build.FINGERPRINT; ++ return Build.VERSION.INCREMENTAL; + } + + final void wtf(String message) { +-- +2.37.2 + diff --git a/system/core/0001-Stop-overriding-system-properties-from-vendor.patch b/system/core/0001-Stop-overriding-system-properties-from-vendor.patch new file mode 100644 index 0000000..902423a --- /dev/null +++ b/system/core/0001-Stop-overriding-system-properties-from-vendor.patch @@ -0,0 +1,27 @@ +From edc01c6d7e6cebfaa1e7301b4d1dbc1541fd83b0 Mon Sep 17 00:00:00 2001 +From: Pierre-Hugues Husson +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 + diff --git a/system/core/0002-init-Do-not-start-console-service-when-debuggable.patch b/system/core/0002-init-Do-not-start-console-service-when-debuggable.patch new file mode 100644 index 0000000..eb41947 --- /dev/null +++ b/system/core/0002-init-Do-not-start-console-service-when-debuggable.patch @@ -0,0 +1,31 @@ +From 1d0dc75a012a6a336beb420a3642b2837da9ed8a Mon Sep 17 00:00:00 2001 +From: Isaac Chen +Date: Wed, 23 Jun 2021 13:07:30 +0800 +Subject: [PATCH 2/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. + +Signed-off-by: Isaac Chen +Change-Id: I34cfd6b42d3b9aee4b3e63181480cfb8b1255f29 +--- + rootdir/init.rc | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/rootdir/init.rc b/rootdir/init.rc +index cd71aa8aa..417de0d4a 100644 +--- a/rootdir/init.rc ++++ b/rootdir/init.rc +@@ -1268,9 +1268,6 @@ on property:ro.debuggable=1 + # Give reads to anyone for the accessibility trace folder on debug builds. + chmod 0775 /data/misc/a11ytrace + +-on init && property:ro.debuggable=1 +- start console +- + on userspace-reboot-requested + # TODO(b/135984674): reset all necessary properties here. + setprop sys.boot_completed "" +-- +2.37.2 +