Merge "Proper fix for setDeviceOwner() permission check." into sc-v2-dev am: f70489f2d0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15953790 Change-Id: I64e728a54e89c7151e80eecb75c89b77f53c889e
This commit is contained in:
@@ -10633,19 +10633,21 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
}
|
||||
}
|
||||
final String adminPkg = admin.getPackageName();
|
||||
try {
|
||||
// Install the profile owner if not present.
|
||||
if (!mIPackageManager.isPackageAvailable(adminPkg, userId)) {
|
||||
mIPackageManager.installExistingPackageAsUser(adminPkg, userId,
|
||||
PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS,
|
||||
PackageManager.INSTALL_REASON_POLICY,
|
||||
/* allowlistedRestrictedPermissions= */ null);
|
||||
mInjector.binderWithCleanCallingIdentity(() -> {
|
||||
try {
|
||||
// Install the profile owner if not present.
|
||||
if (!mIPackageManager.isPackageAvailable(adminPkg, userId)) {
|
||||
mIPackageManager.installExistingPackageAsUser(adminPkg, userId,
|
||||
PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS,
|
||||
PackageManager.INSTALL_REASON_POLICY,
|
||||
/* allowlistedRestrictedPermissions= */ null);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// Does not happen, same process
|
||||
Slogf.wtf(LOG_TAG, e, "Failed to install admin package %s for user %d",
|
||||
adminPkg, userId);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// Does not happen, same process
|
||||
Slogf.wtf(LOG_TAG, e, "Failed to install admin package %s for user %d",
|
||||
adminPkg, userId);
|
||||
}
|
||||
});
|
||||
|
||||
// Set admin.
|
||||
setActiveAdmin(profileOwner, /* refreshing= */ true, userId);
|
||||
|
||||
Reference in New Issue
Block a user