Merge "Unlock newly created managed profiles." into nyc-dev
This commit is contained in:
@@ -237,10 +237,19 @@ final class UserController {
|
|||||||
AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, userId);
|
AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We only attempt to unlock real users here; we delay unlocking
|
// We need to delay unlocking managed profiles until the parent user
|
||||||
// profiles until after the parent user is unlocked.
|
// is also unlocked.
|
||||||
if (getUserManager().isManagedProfile(userId)) {
|
if (getUserManager().isManagedProfile(userId)) {
|
||||||
Slog.d(TAG, "User " + userId + " is managed profile; delaying unlock attempt");
|
final UserInfo parent = getUserManager().getProfileParent(userId);
|
||||||
|
if (parent != null
|
||||||
|
&& isUserRunningLocked(parent.id, ActivityManager.FLAG_AND_UNLOCKED)) {
|
||||||
|
Slog.d(TAG, "User " + userId + " (parent " + parent.id
|
||||||
|
+ "): attempting unlock because parent is unlocked");
|
||||||
|
maybeUnlockUser(userId);
|
||||||
|
} else {
|
||||||
|
Slog.d(TAG, "User " + userId + " (parent " + parent.id
|
||||||
|
+ "): delaying unlock because parent is locked");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
maybeUnlockUser(userId);
|
maybeUnlockUser(userId);
|
||||||
}
|
}
|
||||||
@@ -909,17 +918,15 @@ final class UserController {
|
|||||||
synchronized (mService) {
|
synchronized (mService) {
|
||||||
final UserState uss = mStartedUsers.get(userId);
|
final UserState uss = mStartedUsers.get(userId);
|
||||||
finishUserUnlocking(uss, progress);
|
finishUserUnlocking(uss, progress);
|
||||||
}
|
|
||||||
|
|
||||||
// We just unlocked a user, so let's now attempt to unlock any managed
|
// We just unlocked a user, so let's now attempt to unlock any
|
||||||
// profiles under that user.
|
// managed profiles under that user.
|
||||||
synchronized (mService) {
|
|
||||||
for (int i = 0; i < mStartedUsers.size(); i++) {
|
for (int i = 0; i < mStartedUsers.size(); i++) {
|
||||||
final int testUserId = mStartedUsers.keyAt(i);
|
final int testUserId = mStartedUsers.keyAt(i);
|
||||||
final UserInfo parent = getUserManager().getProfileParent(testUserId);
|
final UserInfo parent = getUserManager().getProfileParent(testUserId);
|
||||||
if (parent != null && parent.id == userId && testUserId != userId) {
|
if (parent != null && parent.id == userId && testUserId != userId) {
|
||||||
Slog.d(TAG, "Found user " + testUserId + " with parent " + userId
|
Slog.d(TAG, "User " + testUserId + " (parent " + parent.id
|
||||||
+ "; attempting unlock");
|
+ "): attempting unlock because parent was just unlocked");
|
||||||
maybeUnlockUser(testUserId);
|
maybeUnlockUser(testUserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user