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

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

Merge "Only delay bouncer if bypass is off" into qt-r1-dev

parents 1c99d77a 04ec6df5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -134,11 +134,13 @@ public class SystemUIFactory {
    public KeyguardBouncer createKeyguardBouncer(Context context, ViewMediatorCallback callback,
            LockPatternUtils lockPatternUtils,  ViewGroup container,
            DismissCallbackRegistry dismissCallbackRegistry,
            KeyguardBouncer.BouncerExpansionCallback expansionCallback) {
            KeyguardBouncer.BouncerExpansionCallback expansionCallback,
            KeyguardBypassController bypassController) {
        return new KeyguardBouncer(context, callback, lockPatternUtils, container,
                dismissCallbackRegistry, FalsingManagerFactory.getInstance(context),
                expansionCallback, UnlockMethodCache.getInstance(context),
                KeyguardUpdateMonitor.getInstance(context), new Handler(Looper.getMainLooper()));
                KeyguardUpdateMonitor.getInstance(context), bypassController,
                new Handler(Looper.getMainLooper()));
    }

    public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
+6 −2
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class KeyguardBouncer {
                }
            };
    private final Runnable mRemoveViewRunnable = this::removeView;
    private final KeyguardBypassController mKeyguardBypassController;
    protected KeyguardHostView mKeyguardView;
    private final Runnable mResetRunnable = ()-> {
        if (mKeyguardView != null) {
@@ -97,7 +98,8 @@ public class KeyguardBouncer {
            LockPatternUtils lockPatternUtils, ViewGroup container,
            DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager,
            BouncerExpansionCallback expansionCallback, UnlockMethodCache unlockMethodCache,
            KeyguardUpdateMonitor keyguardUpdateMonitor, Handler handler) {
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            KeyguardBypassController keyguardBypassController, Handler handler) {
        mContext = context;
        mCallback = callback;
        mLockPatternUtils = lockPatternUtils;
@@ -109,6 +111,7 @@ public class KeyguardBouncer {
        mHandler = handler;
        mUnlockMethodCache = unlockMethodCache;
        mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
        mKeyguardBypassController = keyguardBypassController;
    }

    public void show(boolean resetSecuritySelection) {
@@ -171,7 +174,8 @@ public class KeyguardBouncer {
        // Split up the work over multiple frames.
        DejankUtils.removeCallbacks(mResetRunnable);
        if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer()
                && !mKeyguardUpdateMonitor.userNeedsStrongAuth()) {
                && !mKeyguardUpdateMonitor.userNeedsStrongAuth()
                && !mKeyguardBypassController.getBypassEnabled()) {
            mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY);
        } else {
            DejankUtils.postAfterTraversal(mShowRunnable);
+1 −1
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        mBiometricUnlockController = biometricUnlockController;
        mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
                mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
                mExpansionCallback);
                mExpansionCallback, bypassController);
        mNotificationPanelView = notificationPanelView;
        notificationPanelView.addExpansionListener(this);
        mBypassController = bypassController;
+14 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.never;
@@ -84,6 +85,8 @@ public class KeyguardBouncerTest extends SysuiTestCase {
    @Mock
    private UnlockMethodCache mUnlockMethodCache;
    @Mock
    private KeyguardBypassController mKeyguardBypassController;
    @Mock
    private Handler mHandler;

    private KeyguardBouncer mBouncer;
@@ -98,7 +101,8 @@ public class KeyguardBouncerTest extends SysuiTestCase {
        when(mKeyguardHostView.getHeight()).thenReturn(500);
        mBouncer = new KeyguardBouncer(getContext(), mViewMediatorCallback,
                mLockPatternUtils, container, mDismissCallbackRegistry, mFalsingManager,
                mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor, mHandler) {
                mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor,
                mKeyguardBypassController, mHandler) {
            @Override
            protected void inflateView() {
                super.inflateView();
@@ -390,6 +394,15 @@ public class KeyguardBouncerTest extends SysuiTestCase {
        verify(mHandler).removeCallbacks(eq(showRunnable.getValue()));
    }

    @Test
    public void testShow_delaysIfFaceAuthIsRunning_unlessBypass() {
        when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
        when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
        mBouncer.show(true /* reset */);

        verify(mHandler, never()).postDelayed(any(), anyLong());
    }

    @Test
    public void testRegisterUpdateMonitorCallback() {
        verify(mKeyguardUpdateMonitor).registerCallback(any());