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

Commit 8643a61f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make sure userSwitchComplete is dispatched after screen is unfrozen."

parents d1217af1 c32668c1
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
@@ -2185,8 +2185,6 @@ class UserController implements Handler.Callback {
        mHandler.sendMessage(mHandler.obtainMessage(COMPLETE_USER_SWITCH_MSG, newUserId, 0));

        uss.switching = false;
        mHandler.removeMessages(REPORT_USER_SWITCH_COMPLETE_MSG);
        mHandler.sendMessage(mHandler.obtainMessage(REPORT_USER_SWITCH_COMPLETE_MSG, newUserId, 0));
        stopGuestOrEphemeralUserIfBackground(oldUserId);
        stopUserOnSwitchIfEnforced(oldUserId);
        if (oldUserId == UserHandle.USER_SYSTEM) {
@@ -2200,21 +2198,22 @@ class UserController implements Handler.Callback {

    @VisibleForTesting
    void completeUserSwitch(int newUserId) {
        if (isUserSwitchUiEnabled()) {
            // If there is no challenge set, dismiss the keyguard right away
            if (!mInjector.getKeyguardManager().isDeviceSecure(newUserId)) {
                // Wait until the keyguard is dismissed to unfreeze
                mInjector.dismissKeyguard(
                        new Runnable() {
                            public void run() {
        final boolean isUserSwitchUiEnabled = isUserSwitchUiEnabled();
        final Runnable runnable = () -> {
            if (isUserSwitchUiEnabled) {
                unfreezeScreen();
            }
                        },
                        "User Switch");
                return;
            mHandler.removeMessages(REPORT_USER_SWITCH_COMPLETE_MSG);
            mHandler.sendMessage(mHandler.obtainMessage(
                    REPORT_USER_SWITCH_COMPLETE_MSG, newUserId, 0));
        };

        // If there is no challenge set, dismiss the keyguard right away
        if (isUserSwitchUiEnabled && !mInjector.getKeyguardManager().isDeviceSecure(newUserId)) {
            // Wait until the keyguard is dismissed to unfreeze
            mInjector.dismissKeyguard(runnable, "User Switch");
        } else {
                unfreezeScreen();
            }
            runnable.run();
        }
    }