Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b77d15fc authored by Julia Reynolds's avatar Julia Reynolds
Browse files

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
parent 3a6037d1
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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" />

+10 −2
Original line number Diff line number Diff line
@@ -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();
        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) {