diff --git a/Misc/Features/GrapheneOS.txt b/Misc/Features/GrapheneOS.txt index 2cff398e..a45c666d 100644 --- a/Misc/Features/GrapheneOS.txt +++ b/Misc/Features/GrapheneOS.txt @@ -3,10 +3,6 @@ RQ3A.211001.001.2021100606 QQ3A.200805.001.2020.09.11.14 PQ3B.190801.002.2019.08.25.15 -appops reset fix -13 https://github.com/GrapheneOS/platform_frameworks_base/commit/41446b749e0851572e280f88b37db05f6283e0c3 -13 https://github.com/GrapheneOS/platform_frameworks_base/commit/e7022b12acbc1b87c07f9c4ed7b22bae9588c7ea - https time 12 https://github.com/GrapheneOS/platform_frameworks_base/commit/1d4e3f495b7b544f6314f04243e9d47b3f8e7102 12 https://github.com/GrapheneOS/platform_frameworks_base/commit/2c04a077ec9f3ac6857885199f49f4845b70ec2e @@ -60,6 +56,10 @@ nojit 9 https://github.com/GrapheneOS/platform_build/commit/5b9927197e63593b9220d1a9280021252ef205e9 9 https://github.com/GrapheneOS/platform_build/commit/e36c7aefaa78a1ed5b94c7f51d29277008eea232 +[implemented] appops reset fix +13 https://github.com/GrapheneOS/platform_frameworks_base/commit/41446b749e0851572e280f88b37db05f6283e0c3 +13 https://github.com/GrapheneOS/platform_frameworks_base/commit/e7022b12acbc1b87c07f9c4ed7b22bae9588c7ea + [implemented] reject system app updates of same versioncode 13 https://github.com/GrapheneOS/platform_frameworks_base/commit/9a42266d62406e781148a720836962197157e71f 13 https://github.com/GrapheneOS/platform_frameworks_base/commit/69dc926f33cec82434fe0d6aa78f83340298d6de diff --git a/Patches/LineageOS-19.1/android_frameworks_base/0027-appops_reset_fix-1.patch b/Patches/LineageOS-19.1/android_frameworks_base/0027-appops_reset_fix-1.patch new file mode 100644 index 00000000..452f0b6b --- /dev/null +++ b/Patches/LineageOS-19.1/android_frameworks_base/0027-appops_reset_fix-1.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dmitry Muhomor +Date: Fri, 6 Jan 2023 17:20:46 +0200 +Subject: [PATCH] Revert "Null safe package name in AppOps writeState" + +This reverts commit 0b925d4f46ef9d0f25fa5fd56e996280e9a98c71. + +Reverted commit introduced a bug: +it skipped the "pkg" tag for ops with null package name. +This meant that ops with null package name were serialized differently than ops with non-null +package name. +Tag hierarchy became the following: +for non-null package name ops: "pkg" -> "uid" -> "op" -> "st" +for null package name ops: "uid" -> "op" -> "st" + +Uid ops have the same first two tags as null package name ops started to have: +"uid" -> "op". (refer to the loop over uidStatesClone elements above). + +This led to type confusion during deserialization that happens in readState(): +null package name ops were deserialized as uid ops, through readUidOps() instead of through +readPackage(). + +Uid ops are serialized differently than uid element inside package ops, specifically the latter +skips the op mode ("m") attribute when the op mode is at its default value. + +Op mode attribute is read unconditionally in readUidOps(), which led to +XmlPullParserException: Missing attribute "m" +exception. + +This exception is caught in readState(), and is handled by discarding all deserialized state, +which meant that all appops got reset to their default values. + +Subsequent commit adds skipping of ops with null package name during serialization: +they are invalid, package name is defined and treated as @NonNull in multiple places. +Such ops are being constructed due to another bug. +--- + .../core/java/com/android/server/appop/AppOpsService.java | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java +index 3808e0c93a38..c1e5b7eeafc2 100644 +--- a/services/core/java/com/android/server/appop/AppOpsService.java ++++ b/services/core/java/com/android/server/appop/AppOpsService.java +@@ -5126,15 +5126,13 @@ public class AppOpsService extends IAppOpsService.Stub { + String lastPkg = null; + for (int i=0; i +Date: Fri, 6 Jan 2023 17:22:29 +0200 +Subject: [PATCH] appops: skip ops for invalid null package during state + serialization + +There's a bug that leads to construction of ops for invalid null package name. +Package name should always be non-null, it's defined and treated as such in AppOpsService. +It being null leads to crashes in system_server when appops state is serialized. + +Previous commit reverted a buggy workaround for this bug, add a new workaround to prevent these +crashes. +--- + services/core/java/com/android/server/appop/AppOpsService.java | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java +index c1e5b7eeafc2..162e4d91d1a2 100644 +--- a/services/core/java/com/android/server/appop/AppOpsService.java ++++ b/services/core/java/com/android/server/appop/AppOpsService.java +@@ -5126,6 +5126,9 @@ public class AppOpsService extends IAppOpsService.Stub { + String lastPkg = null; + for (int i=0; i +Date: Fri, 6 Jan 2023 17:20:46 +0200 +Subject: [PATCH] Revert "Null safe package name in AppOps writeState" + +This reverts commit 0b925d4f46ef9d0f25fa5fd56e996280e9a98c71. + +Reverted commit introduced a bug: +it skipped the "pkg" tag for ops with null package name. +This meant that ops with null package name were serialized differently than ops with non-null +package name. +Tag hierarchy became the following: +for non-null package name ops: "pkg" -> "uid" -> "op" -> "st" +for null package name ops: "uid" -> "op" -> "st" + +Uid ops have the same first two tags as null package name ops started to have: +"uid" -> "op". (refer to the loop over uidStatesClone elements above). + +This led to type confusion during deserialization that happens in readState(): +null package name ops were deserialized as uid ops, through readUidOps() instead of through +readPackage(). + +Uid ops are serialized differently than uid element inside package ops, specifically the latter +skips the op mode ("m") attribute when the op mode is at its default value. + +Op mode attribute is read unconditionally in readUidOps(), which led to +XmlPullParserException: Missing attribute "m" +exception. + +This exception is caught in readState(), and is handled by discarding all deserialized state, +which meant that all appops got reset to their default values. + +Subsequent commit adds skipping of ops with null package name during serialization: +they are invalid, package name is defined and treated as @NonNull in multiple places. +Such ops are being constructed due to another bug. +--- + .../core/java/com/android/server/appop/AppOpsService.java | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java +index e31c952e10f9..db51cbdb525e 100644 +--- a/services/core/java/com/android/server/appop/AppOpsService.java ++++ b/services/core/java/com/android/server/appop/AppOpsService.java +@@ -5197,15 +5197,13 @@ public class AppOpsService extends IAppOpsService.Stub { + String lastPkg = null; + for (int i=0; i +Date: Fri, 6 Jan 2023 17:22:29 +0200 +Subject: [PATCH] appops: skip ops for invalid null package during state + serialization + +There's a bug that leads to construction of ops for invalid null package name. +Package name should always be non-null, it's defined and treated as such in AppOpsService. +It being null leads to crashes in system_server when appops state is serialized. + +Previous commit reverted a buggy workaround for this bug, add a new workaround to prevent these +crashes. +--- + services/core/java/com/android/server/appop/AppOpsService.java | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java +index db51cbdb525e..6bf4c3bb7742 100644 +--- a/services/core/java/com/android/server/appop/AppOpsService.java ++++ b/services/core/java/com/android/server/appop/AppOpsService.java +@@ -5197,6 +5197,9 @@ public class AppOpsService extends IAppOpsService.Stub { + String lastPkg = null; + for (int i=0; i