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

Commit 735fa433 authored by Fyodor Kupolov's avatar Fyodor Kupolov Committed by Android (Google) Code Review
Browse files

Merge "Call unlockUserKey in a synchronized section" into nyc-dev

parents c7656ffc cca1c654
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -927,19 +927,18 @@ final class UserController {

    boolean unlockUserCleared(final int userId, byte[] token, byte[] secret,
            IProgressListener listener) {
        final UserState uss;
        synchronized (mService) {
            // Bail if user isn't actually running, otherwise register the given
            // listener to watch for unlock progress
            uss = mStartedUsers.get(userId);
            final UserState uss = mStartedUsers.get(userId);
            if (uss == null) {
                notifyFinished(userId, listener);
                return false;
            } else {
                uss.mUnlockProgress.addListener(listener);
            }
        }

            // TODO Move this block outside of synchronized if it causes lock contention
            if (!StorageManager.isUserKeyUnlocked(userId)) {
                final UserInfo userInfo = getUserInfo(userId);
                final IMountService mountService = getMountService();
@@ -952,7 +951,6 @@ final class UserController {
                }
            }

        synchronized (mService) {
            finishUserUnlocking(uss);

            // We just unlocked a user, so let's now attempt to unlock any