Remove REVOKE runtime perms from systemui

Instead, limit them to only being able to revoke
the notification permission specifically

Fixes: 208562972
Test: DefaultPermissionGrantPolicyTest, enable flag and turn off notifs
for an app

Change-Id: Ie2769a49499eac404e015a703cd725858e23e79f
This commit is contained in:
Julia Reynolds
2021-12-10 12:24:31 -05:00
parent 3a6037d159
commit b77d15fc92
2 changed files with 10 additions and 3 deletions

View File

@@ -218,7 +218,6 @@
<!-- notifications & DND access -->
<uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS" />
<uses-permission android:name="android.permission.REVOKE_RUNTIME_PERMISSIONS" />
<uses-permission android:name="android.permission.GET_RUNTIME_PERMISSIONS" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

View File

@@ -167,6 +167,7 @@ public final class PermissionHelper {
public void setNotificationPermission(String packageName, @UserIdInt int userId, boolean grant,
boolean userSet) {
assertFlag();
final long callingId = Binder.clearCallingIdentity();
try {
if (grant) {
mPermManager.grantRuntimePermission(packageName, NOTIFICATION_PERMISSION, userId);
@@ -180,13 +181,20 @@ public final class PermissionHelper {
}
} catch (RemoteException e) {
Slog.e(TAG, "Could not reach system server", e);
} finally {
Binder.restoreCallingIdentity(callingId);
}
}
public void setNotificationPermission(PackagePermission pkgPerm) {
assertFlag();
setNotificationPermission(
pkgPerm.packageName, pkgPerm.userId, pkgPerm.granted, pkgPerm.userSet);
final long callingId = Binder.clearCallingIdentity();
try {
setNotificationPermission(
pkgPerm.packageName, pkgPerm.userId, pkgPerm.granted, pkgPerm.userSet);
} finally {
Binder.restoreCallingIdentity(callingId);
}
}
public boolean isPermissionFixed(String packageName, @UserIdInt int userId) {