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

Commit 6e0b305f authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

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

parents f86f9867 5dab713f
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;
    }