Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41af993c authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

Merge "Delay unlock attempts for managed profiles." into nyc-dev

am: 6e0b305f

* commit '6e0b305f':
  Delay unlock attempts for managed profiles.

Change-Id: I942bb9d7abe9abe3f7993636c333b8d1ff4d9a89
parents c5de9018 6e0b305f
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -237,9 +237,15 @@ final class UserController {
                        AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, userId);
            }

            // We only attempt to unlock real users here; we delay unlocking
            // profiles until after the parent user is unlocked.
            if (getUserManager().isManagedProfile(userId)) {
                Slog.d(TAG, "User " + userId + " is managed profile; delaying unlock attempt");
            } else {
                maybeUnlockUser(userId);
            }
        }
    }

    /**
     * Step from {@link UserState#STATE_RUNNING_LOCKED} to
@@ -905,6 +911,20 @@ final class UserController {
            finishUserUnlocking(uss, progress);
        }

        // We just unlocked a user, so let's now attempt to unlock any managed
        // profiles under that user.
        synchronized (mService) {
            for (int i = 0; i < mStartedUsers.size(); i++) {
                final int testUserId = mStartedUsers.keyAt(i);
                final UserInfo parent = getUserManager().getProfileParent(testUserId);
                if (parent != null && parent.id == userId && testUserId != userId) {
                    Slog.d(TAG, "Found user " + testUserId + " with parent " + userId
                            + "; attempting unlock");
                    maybeUnlockUser(testUserId);
                }
            }
        }

        return true;
    }