mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-02-03 02:40:07 -05:00
Pull in the special permissions reset bugfix from GrapheneOS
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
b1da856762
commit
fb7bf503b1
@ -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
|
||||
|
@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
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<allOps.size(); i++) {
|
||||
AppOpsManager.PackageOps pkg = allOps.get(i);
|
||||
- if (!Objects.equals(pkg.getPackageName(), lastPkg)) {
|
||||
+ if (!pkg.getPackageName().equals(lastPkg)) {
|
||||
if (lastPkg != null) {
|
||||
out.endTag(null, "pkg");
|
||||
}
|
||||
lastPkg = pkg.getPackageName();
|
||||
- if (lastPkg != null) {
|
||||
- out.startTag(null, "pkg");
|
||||
- out.attribute(null, "n", lastPkg);
|
||||
- }
|
||||
+ out.startTag(null, "pkg");
|
||||
+ out.attribute(null, "n", lastPkg);
|
||||
}
|
||||
out.startTag(null, "uid");
|
||||
out.attributeInt(null, "n", pkg.getUid());
|
@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
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<allOps.size(); i++) {
|
||||
AppOpsManager.PackageOps pkg = allOps.get(i);
|
||||
+ if (pkg.getPackageName() == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
if (!pkg.getPackageName().equals(lastPkg)) {
|
||||
if (lastPkg != null) {
|
||||
out.endTag(null, "pkg");
|
@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
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<allOps.size(); i++) {
|
||||
AppOpsManager.PackageOps pkg = allOps.get(i);
|
||||
- if (!Objects.equals(pkg.getPackageName(), lastPkg)) {
|
||||
+ if (!pkg.getPackageName().equals(lastPkg)) {
|
||||
if (lastPkg != null) {
|
||||
out.endTag(null, "pkg");
|
||||
}
|
||||
lastPkg = pkg.getPackageName();
|
||||
- if (lastPkg != null) {
|
||||
- out.startTag(null, "pkg");
|
||||
- out.attribute(null, "n", lastPkg);
|
||||
- }
|
||||
+ out.startTag(null, "pkg");
|
||||
+ out.attribute(null, "n", lastPkg);
|
||||
}
|
||||
out.startTag(null, "uid");
|
||||
out.attributeInt(null, "n", pkg.getUid());
|
@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
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<allOps.size(); i++) {
|
||||
AppOpsManager.PackageOps pkg = allOps.get(i);
|
||||
+ if (pkg.getPackageName() == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
if (!pkg.getPackageName().equals(lastPkg)) {
|
||||
if (lastPkg != null) {
|
||||
out.endTag(null, "pkg");
|
@ -169,6 +169,8 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0023-Skip_Screen_Animation.patc
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0024-Burnin_Protection.patch"; #SystemUI: add burnIn protection (arter97)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0025-Monet_Toggle.patch"; #Make monet based theming user configurable (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0026-Crash_Details.patch"; #Add an option to show the details of an application error to the user (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0027-appops_reset_fix-1.patch"; #Revert "Null safe package name in AppOps writeState" (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0027-appops_reset_fix-2.patch"; #appops: skip ops for invalid null package during state serialization (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0007-ABI_Warning.patch"; #Warn when running activity from 32 bit app on ARM64 devices. (AOSP)
|
||||
hardenLocationConf services/core/java/com/android/server/location/gnss/gps_debug.conf; #Harden the default GPS config
|
||||
changeDefaultDNS; #Change the default DNS servers
|
||||
|
@ -177,6 +177,8 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0028-Remove_Legacy_Package_Quer
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0029-Strict_versionCode_Checks-1.patch"; #Don't allow updating system packages to the same versionCode (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0029-Strict_versionCode_Checks-2.patch"; #Prefer package from OS image over equal version of upgraded system package (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0030-agnss.goog_override.patch"; #Replace agnss.goog with the Broadcom PSDS server (heavily based off of a GrapheneOS patch)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0031-appops_reset_fix-1.patch"; #Revert "Null safe package name in AppOps writeState" (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0031-appops_reset_fix-2.patch"; #appops: skip ops for invalid null package during state serialization (GrapheneOS)
|
||||
hardenLocationConf services/core/java/com/android/server/location/gnss/gps_debug.conf; #Harden the default GPS config
|
||||
changeDefaultDNS; #Change the default DNS servers
|
||||
sed -i 's/DEFAULT_USE_COMPACTION = false;/DEFAULT_USE_COMPACTION = true;/' services/core/java/com/android/server/am/CachedAppOptimizer.java; #Enable app compaction by default (GrapheneOS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user