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

Commit c630d1b3 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...

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17958492



Change-Id: Ia37387c51f93505c17ed3ce06bca2bd3a49e8f27
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9cef81ac e8359c64
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));
    }
}