Fix lock held error when setting DO for AAOS
Fixes: 221460888 Test: manual verification with logcat Change-Id: I7beef692f01e32e0724273d2f9773e051c81c331
This commit is contained in:
@@ -8610,20 +8610,23 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
admin.getPackageName(), userId, "set-device-owner");
|
||||
|
||||
Slogf.i(LOG_TAG, "Device owner set: " + admin + " on user " + userId);
|
||||
|
||||
if (setProfileOwnerOnCurrentUserIfNecessary
|
||||
&& mInjector.userManagerIsHeadlessSystemUserMode()) {
|
||||
int currentForegroundUser = getCurrentForegroundUserId();
|
||||
Slogf.i(LOG_TAG, "setDeviceOwner(): setting " + admin
|
||||
+ " as profile owner on user " + currentForegroundUser);
|
||||
// Sets profile owner on current foreground user since
|
||||
// the human user will complete the DO setup workflow from there.
|
||||
manageUserUnchecked(/* deviceOwner= */ admin, /* profileOwner= */ admin,
|
||||
/* managedUser= */ currentForegroundUser, /* adminExtras= */ null,
|
||||
/* showDisclaimer= */ false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (setProfileOwnerOnCurrentUserIfNecessary
|
||||
&& mInjector.userManagerIsHeadlessSystemUserMode()) {
|
||||
int currentForegroundUser;
|
||||
synchronized (getLockObject()) {
|
||||
currentForegroundUser = getCurrentForegroundUserId();
|
||||
}
|
||||
Slogf.i(LOG_TAG, "setDeviceOwner(): setting " + admin
|
||||
+ " as profile owner on user " + currentForegroundUser);
|
||||
// Sets profile owner on current foreground user since
|
||||
// the human user will complete the DO setup workflow from there.
|
||||
manageUserUnchecked(/* deviceOwner= */ admin, /* profileOwner= */ admin,
|
||||
/* managedUser= */ currentForegroundUser, /* adminExtras= */ null,
|
||||
/* showDisclaimer= */ false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user