DO NOT MERGE Fix auto-grant of AR runtime permission if device is upgrading from pre-Q
Test: Manually install app apks targeting Q and verifying that AR permission is not auto-granted Test: atest ActivityRecognitionPermissionTest Bug: 210065877 Change-Id: I7004055c9573d17f31255c2b1adee1e0aeeb238f
This commit is contained in:
@@ -998,4 +998,10 @@ public abstract class PackageManagerInternal {
|
|||||||
* Returns {@code true} if the package is suspending any packages for the user.
|
* Returns {@code true} if the package is suspending any packages for the user.
|
||||||
*/
|
*/
|
||||||
public abstract boolean isSuspendingAnyPackages(String suspendingPackage, int userId);
|
public abstract boolean isSuspendingAnyPackages(String suspendingPackage, int userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get installed SDK version of the package
|
||||||
|
* @param pkg package for which to retrieve the installed sdk version
|
||||||
|
*/
|
||||||
|
public abstract int getInstalledSdkVersion(AndroidPackage pkg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25158,6 +25158,11 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
public boolean isSuspendingAnyPackages(String suspendingPackage, int userId) {
|
public boolean isSuspendingAnyPackages(String suspendingPackage, int userId) {
|
||||||
return PackageManagerService.this.isSuspendingAnyPackages(suspendingPackage, userId);
|
return PackageManagerService.this.isSuspendingAnyPackages(suspendingPackage, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInstalledSdkVersion(AndroidPackage pkg) {
|
||||||
|
return PackageManagerService.this.getSettingsVersionForPackage(pkg).sdkVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
|
|||||||
@@ -2771,10 +2771,15 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
// or has updated its target SDK and AR is no longer implicit to it.
|
// 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
|
// This is a compatibility workaround for apps when AR permission was
|
||||||
// split in Q.
|
// 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) {
|
||||||
final List<SplitPermissionInfoParcelable> permissionList =
|
final List<SplitPermissionInfoParcelable> permissionList =
|
||||||
getSplitPermissions();
|
getSplitPermissions();
|
||||||
int numSplitPerms = permissionList.size();
|
int numSplitPerms = permissionList.size();
|
||||||
for (int splitPermNum = 0; splitPermNum < numSplitPerms; splitPermNum++) {
|
for (int splitPermNum = 0; splitPermNum < numSplitPerms;
|
||||||
|
splitPermNum++) {
|
||||||
SplitPermissionInfoParcelable sp = permissionList.get(splitPermNum);
|
SplitPermissionInfoParcelable sp = permissionList.get(splitPermNum);
|
||||||
String splitPermName = sp.getSplitPermission();
|
String splitPermName = sp.getSplitPermission();
|
||||||
if (sp.getNewPermissions().contains(permName)
|
if (sp.getNewPermissions().contains(permName)
|
||||||
@@ -2791,6 +2796,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(b/140256621): The package instant app method has been removed
|
// TODO(b/140256621): The package instant app method has been removed
|
||||||
// as part of work in b/135203078, so this has been commented out in the meantime
|
// as part of work in b/135203078, so this has been commented out in the meantime
|
||||||
|
|||||||
Reference in New Issue
Block a user