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: I90adf45a6611ab8bc953765c72af77a6a4f7aae8
This commit is contained in:
@@ -1011,4 +1011,10 @@ public abstract class PackageManagerInternal {
|
|||||||
* that b/141413692 is not reproducible on Q.
|
* that b/141413692 is not reproducible on Q.
|
||||||
*/
|
*/
|
||||||
public abstract void userRemovedForTest();
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25165,6 +25165,11 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
public void userRemovedForTest() {
|
public void userRemovedForTest() {
|
||||||
mBlockDeleteOnUserRemoveForTest.open();
|
mBlockDeleteOnUserRemoveForTest.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInstalledSdkVersion(PackageParser.Package pkg) {
|
||||||
|
return PackageManagerService.this.getSettingsVersionForPackage(pkg).sdkVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GuardedBy("mPackages")
|
@GuardedBy("mPackages")
|
||||||
|
|||||||
@@ -1096,8 +1096,13 @@ public class PermissionManagerService {
|
|||||||
// 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) {
|
||||||
int numSplitPerms = PermissionManager.SPLIT_PERMISSIONS.size();
|
int numSplitPerms = PermissionManager.SPLIT_PERMISSIONS.size();
|
||||||
for (int splitPermNum = 0; splitPermNum < numSplitPerms; splitPermNum++) {
|
for (int splitPermNum = 0; splitPermNum < numSplitPerms;
|
||||||
|
splitPermNum++) {
|
||||||
PermissionManager.SplitPermissionInfo sp =
|
PermissionManager.SplitPermissionInfo sp =
|
||||||
PermissionManager.SPLIT_PERMISSIONS.get(splitPermNum);
|
PermissionManager.SPLIT_PERMISSIONS.get(splitPermNum);
|
||||||
String splitPermName = sp.getSplitPermission();
|
String splitPermName = sp.getSplitPermission();
|
||||||
@@ -1115,6 +1120,7 @@ public class PermissionManagerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Limit ephemeral apps to ephemeral allowed permissions.
|
// Limit ephemeral apps to ephemeral allowed permissions.
|
||||||
if (pkg.applicationInfo.isInstantApp() && !bp.isInstant()) {
|
if (pkg.applicationInfo.isInstantApp() && !bp.isInstant()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user