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

Commit 29674dda authored by Hai Zhang's avatar Hai Zhang
Browse files

Don't set REVOKED_COMPAT for background permission that isn't granted.

Fixes: 148890737
Fixes: 148891305
Test: atest SplitPermissionTest
Test: atest PermissionFlagsTest
Change-Id: I4960334160bbe5f7e02c75f46e51c68b0119ae90
parent c5794df2
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -2126,6 +2126,8 @@ public class AppOpsService extends IAppOpsService.Stub {
            UserHandle user = UserHandle.getUserHandleForUid(uid);
            boolean isRevokedCompat;
            if (permissionInfo.backgroundPermission != null) {
                if (packageManager.checkPermission(permissionInfo.backgroundPermission, packageName)
                        == PackageManager.PERMISSION_GRANTED) {
                    boolean isBackgroundRevokedCompat = mode != AppOpsManager.MODE_ALLOWED;

                    if (isBackgroundRevokedCompat && supportsRuntimePermissions) {
@@ -2145,6 +2147,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                    } finally {
                        Binder.restoreCallingIdentity(identity);
                    }
                }

                isRevokedCompat = mode != AppOpsManager.MODE_ALLOWED
                        && mode != AppOpsManager.MODE_FOREGROUND;