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

Commit e8359c64 authored by Aaron Liu's avatar Aaron Liu Committed by Automerger Merge Worker
Browse files

Merge "[Bouncer] fix user switch race condition" into tm-dev am: 60f8672e am: c0532af1

parents e0a8b1cb c0532af1
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -67,12 +67,6 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>

    private final KeyguardUpdateMonitorCallback mUpdateCallback =
            new KeyguardUpdateMonitorCallback() {
                @Override
                public void onUserSwitchComplete(int userId) {
                    mKeyguardSecurityContainerController.showPrimarySecurityScreen(
                            false /* turning off */);
                }

                @Override
                public void onTrustGrantedWithFlags(int flags, int userId) {
                    if (userId != KeyguardUpdateMonitor.getCurrentUser()) return;
+4 −0
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
    private int mLastOrientation = Configuration.ORIENTATION_UNDEFINED;

    private SecurityMode mCurrentSecurityMode = SecurityMode.Invalid;
    private UserSwitcherController.UserSwitchCallback mUserSwitchCallback =
            () -> showPrimarySecurityScreen(false);

    @VisibleForTesting
    final Gefingerpoken mGlobalTouchListener = new Gefingerpoken() {
@@ -295,6 +297,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
        mView.setSwipeListener(mSwipeListener);
        mView.addMotionEventListener(mGlobalTouchListener);
        mConfigurationController.addCallback(mConfigurationListener);
        mUserSwitcherController.addUserSwitchCallback(mUserSwitchCallback);
    }

    @Override
@@ -302,6 +305,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
        mUpdateMonitor.removeCallback(mKeyguardUpdateMonitorCallback);
        mConfigurationController.removeCallback(mConfigurationListener);
        mView.removeMotionEventListener(mGlobalTouchListener);
        mUserSwitcherController.removeUserSwitchCallback(mUserSwitchCallback);
    }

    /** */
+10 −0
Original line number Diff line number Diff line
@@ -287,4 +287,14 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
        verify(mView).initMode(MODE_DEFAULT, mGlobalSettings, mFalsingManager,
                mUserSwitcherController);
    }

    @Test
    public void addUserSwitchCallback() {
        mKeyguardSecurityContainerController.onViewAttached();
        verify(mUserSwitcherController)
                .addUserSwitchCallback(any(UserSwitcherController.UserSwitchCallback.class));
        mKeyguardSecurityContainerController.onViewDetached();
        verify(mUserSwitcherController)
                .removeUserSwitchCallback(any(UserSwitcherController.UserSwitchCallback.class));
    }
}