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

Commit 4ab8b4fc authored by Svet Ganov's avatar Svet Ganov
Browse files

Do not disable app ops on a permission revocation for modern apps.

We were disabling both permission and app ops for modern apps - to
have app ops as a safety net. This creates the issue that if a
permission is revoked (which disables the app op) and data is
cleared, then apps that get permissions granted by default would
end up with th permission but not the app op and will not work.
We still enable the app op on a permission grant to ensure that
a legacy app with a disabled app ops will have the app op enabled
if updated and the permission is then granted.

bug:22464566

Change-Id: Ia5f4de42bcaf6f736e50d6f3109878ff2ce8ff9f
parent b9b20815
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
                    return false;
                }

                // Enable the permission app op before the permission grant.
                // Ensure the permission app op enabled before the permission grant.
                if (permission.hasAppOp() && !permission.isAppOpAllowed()) {
                    permission.setAppOpAllowed(true);
                    mAppOps.setMode(permission.getAppOp(), uid, mPackageInfo.packageName,
@@ -385,13 +385,6 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
                    return false;
                }

                // Disable the permission app op before the permission.
                if (permission.hasAppOp() && permission.isAppOpAllowed()) {
                    permission.setAppOpAllowed(false);
                    mAppOps.setMode(permission.getAppOp(), uid, mPackageInfo.packageName,
                            AppOpsManager.MODE_IGNORED);
                }

                // Revoke the permission if needed.
                if (permission.isGranted()) {
                    permission.setGranted(false);