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();
|
final String adminPkg = admin.getPackageName();
|
||||||
try {
|
mInjector.binderWithCleanCallingIdentity(() -> {
|
||||||
// Install the profile owner if not present.
|
try {
|
||||||
if (!mIPackageManager.isPackageAvailable(adminPkg, userId)) {
|
// Install the profile owner if not present.
|
||||||
mIPackageManager.installExistingPackageAsUser(adminPkg, userId,
|
if (!mIPackageManager.isPackageAvailable(adminPkg, userId)) {
|
||||||
PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS,
|
mIPackageManager.installExistingPackageAsUser(adminPkg, userId,
|
||||||
PackageManager.INSTALL_REASON_POLICY,
|
PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS,
|
||||||
/* allowlistedRestrictedPermissions= */ null);
|
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.
|
// Set admin.
|
||||||
setActiveAdmin(profileOwner, /* refreshing= */ true, userId);
|
setActiveAdmin(profileOwner, /* refreshing= */ true, userId);
|
||||||
|
|||||||
Reference in New Issue
Block a user