Merge "DO NOT MERGE Fix auto-grant of AR runtime permission if device is upgrading from pre-Q" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e893eff6f2
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25152,6 +25152,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,21 +1096,27 @@ 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.
|
||||||
int numSplitPerms = PermissionManager.SPLIT_PERMISSIONS.size();
|
// b/210065877: Check that the installed version is pre Q to auto-grant in
|
||||||
for (int splitPermNum = 0; splitPermNum < numSplitPerms; splitPermNum++) {
|
// case of OS update
|
||||||
PermissionManager.SplitPermissionInfo sp =
|
if (mPackageManagerInt.getInstalledSdkVersion(pkg)
|
||||||
PermissionManager.SPLIT_PERMISSIONS.get(splitPermNum);
|
< Build.VERSION_CODES.Q) {
|
||||||
String splitPermName = sp.getSplitPermission();
|
int numSplitPerms = PermissionManager.SPLIT_PERMISSIONS.size();
|
||||||
if (sp.getNewPermissions().contains(permName)
|
for (int splitPermNum = 0; splitPermNum < numSplitPerms;
|
||||||
&& origPermissions.hasInstallPermission(splitPermName)) {
|
splitPermNum++) {
|
||||||
upgradedActivityRecognitionPermission = splitPermName;
|
PermissionManager.SplitPermissionInfo sp =
|
||||||
newImplicitPermissions.add(permName);
|
PermissionManager.SPLIT_PERMISSIONS.get(splitPermNum);
|
||||||
|
String splitPermName = sp.getSplitPermission();
|
||||||
|
if (sp.getNewPermissions().contains(permName)
|
||||||
|
&& origPermissions.hasInstallPermission(splitPermName)) {
|
||||||
|
upgradedActivityRecognitionPermission = splitPermName;
|
||||||
|
newImplicitPermissions.add(permName);
|
||||||
|
|
||||||
if (DEBUG_PERMISSIONS) {
|
if (DEBUG_PERMISSIONS) {
|
||||||
Slog.i(TAG, permName + " is newly added for "
|
Slog.i(TAG, permName + " is newly added for "
|
||||||
+ pkg.packageName);
|
+ pkg.packageName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user