Fixed mark-profile-owner-on-organization-owned-device for non-profile users
It was throwing a NPE as such users are "orphan". Test: adb shell dpm mark-profile-owner-on-organization-owned-device com.afwsamples.testdpc/.DeviceAdminReceiver Fixes: 182189140 Change-Id: Ib02d767a23c53c1c2886728c2f338628149f7868
This commit is contained in:
@@ -13639,6 +13639,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
mInjector.binderWithCleanCallingIdentity(() -> {
|
||||
// Clear restriction as user.
|
||||
final UserHandle parentUser = mUserManager.getProfileParent(UserHandle.of(userId));
|
||||
if (parentUser == null) {
|
||||
throw new IllegalStateException(String.format("User %d is not a profile", userId));
|
||||
}
|
||||
if (!parentUser.isSystem()) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Only the profile owner of a managed profile on the"
|
||||
|
||||
Reference in New Issue
Block a user