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

Commit e893eff6 authored by Ganesh Olekar's avatar Ganesh Olekar Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE Fix auto-grant of AR runtime permission if device is...

Merge "DO NOT MERGE Fix auto-grant of AR runtime permission if device is upgrading from pre-Q" into qt-dev
parents 750c978d 84b1160c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1011,4 +1011,10 @@ public abstract class PackageManagerInternal {
     * that b/141413692 is not reproducible on Q.
     */
    public abstract void userRemovedForTest();

    /**
     * Get installed SDK version of the package
     * @param pkg package for which to retrieve the installed sdk version
     */
    public abstract int getInstalledSdkVersion(PackageParser.Package pkg);
}
+5 −0
Original line number Diff line number Diff line
@@ -25152,6 +25152,11 @@ public class PackageManagerService extends IPackageManager.Stub
        public void userRemovedForTest() {
            mBlockDeleteOnUserRemoveForTest.open();
        }
        @Override
        public int getInstalledSdkVersion(PackageParser.Package pkg) {
            return PackageManagerService.this.getSettingsVersionForPackage(pkg).sdkVersion;
        }
    }
    @GuardedBy("mPackages")
+19 −13
Original line number Diff line number Diff line
@@ -1096,8 +1096,13 @@ public class PermissionManagerService {
                        // or has updated its target SDK and AR is no longer implicit to it.
                        // This is a compatibility workaround for apps when AR permission was
                        // split in Q.
                        // b/210065877: Check that the installed version is pre Q to auto-grant in
                        // case of OS update
                        if (mPackageManagerInt.getInstalledSdkVersion(pkg)
                                < Build.VERSION_CODES.Q) {
                            int numSplitPerms = PermissionManager.SPLIT_PERMISSIONS.size();
                        for (int splitPermNum = 0; splitPermNum < numSplitPerms; splitPermNum++) {
                            for (int splitPermNum = 0; splitPermNum < numSplitPerms;
                                    splitPermNum++) {
                                PermissionManager.SplitPermissionInfo sp =
                                        PermissionManager.SPLIT_PERMISSIONS.get(splitPermNum);
                                String splitPermName = sp.getSplitPermission();
@@ -1115,6 +1120,7 @@ public class PermissionManagerService {
                            }
                        }
                    }
                }

                // Limit ephemeral apps to ephemeral allowed permissions.
                if (pkg.applicationInfo.isInstantApp() && !bp.isInstant()) {