Only delay bouncer if bypass is off
Test: pull up bouncer with bypass on and off Test: atest KeyguardBouncerTest Fixes: 137563419 Change-Id: I5ca00ebacda2c893bf62d5c882fe0a244b77f4fc
This commit is contained in:
@@ -114,11 +114,12 @@ public class SystemUIFactory {
|
|||||||
LockPatternUtils lockPatternUtils, ViewGroup container,
|
LockPatternUtils lockPatternUtils, ViewGroup container,
|
||||||
DismissCallbackRegistry dismissCallbackRegistry,
|
DismissCallbackRegistry dismissCallbackRegistry,
|
||||||
KeyguardBouncer.BouncerExpansionCallback expansionCallback,
|
KeyguardBouncer.BouncerExpansionCallback expansionCallback,
|
||||||
FalsingManager falsingManager) {
|
FalsingManager falsingManager, KeyguardBypassController bypassController) {
|
||||||
return new KeyguardBouncer(context, callback, lockPatternUtils, container,
|
return new KeyguardBouncer(context, callback, lockPatternUtils, container,
|
||||||
dismissCallbackRegistry, falsingManager,
|
dismissCallbackRegistry, falsingManager,
|
||||||
expansionCallback, UnlockMethodCache.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,
|
public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class KeyguardBouncer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final Runnable mRemoveViewRunnable = this::removeView;
|
private final Runnable mRemoveViewRunnable = this::removeView;
|
||||||
|
private final KeyguardBypassController mKeyguardBypassController;
|
||||||
protected KeyguardHostView mKeyguardView;
|
protected KeyguardHostView mKeyguardView;
|
||||||
private final Runnable mResetRunnable = ()-> {
|
private final Runnable mResetRunnable = ()-> {
|
||||||
if (mKeyguardView != null) {
|
if (mKeyguardView != null) {
|
||||||
@@ -97,7 +98,8 @@ public class KeyguardBouncer {
|
|||||||
LockPatternUtils lockPatternUtils, ViewGroup container,
|
LockPatternUtils lockPatternUtils, ViewGroup container,
|
||||||
DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager,
|
DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager,
|
||||||
BouncerExpansionCallback expansionCallback, UnlockMethodCache unlockMethodCache,
|
BouncerExpansionCallback expansionCallback, UnlockMethodCache unlockMethodCache,
|
||||||
KeyguardUpdateMonitor keyguardUpdateMonitor, Handler handler) {
|
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||||
|
KeyguardBypassController keyguardBypassController, Handler handler) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
mLockPatternUtils = lockPatternUtils;
|
mLockPatternUtils = lockPatternUtils;
|
||||||
@@ -109,6 +111,7 @@ public class KeyguardBouncer {
|
|||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mUnlockMethodCache = unlockMethodCache;
|
mUnlockMethodCache = unlockMethodCache;
|
||||||
mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
|
mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
|
||||||
|
mKeyguardBypassController = keyguardBypassController;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(boolean resetSecuritySelection) {
|
public void show(boolean resetSecuritySelection) {
|
||||||
@@ -171,7 +174,8 @@ public class KeyguardBouncer {
|
|||||||
// Split up the work over multiple frames.
|
// Split up the work over multiple frames.
|
||||||
DejankUtils.removeCallbacks(mResetRunnable);
|
DejankUtils.removeCallbacks(mResetRunnable);
|
||||||
if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer()
|
if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer()
|
||||||
&& !mKeyguardUpdateMonitor.userNeedsStrongAuth()) {
|
&& !mKeyguardUpdateMonitor.userNeedsStrongAuth()
|
||||||
|
&& !mKeyguardBypassController.getBypassEnabled()) {
|
||||||
mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY);
|
mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY);
|
||||||
} else {
|
} else {
|
||||||
DejankUtils.postAfterTraversal(mShowRunnable);
|
DejankUtils.postAfterTraversal(mShowRunnable);
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
mBiometricUnlockController = biometricUnlockController;
|
mBiometricUnlockController = biometricUnlockController;
|
||||||
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
|
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
|
||||||
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
|
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
|
||||||
mExpansionCallback, falsingManager);
|
mExpansionCallback, falsingManager, bypassController);
|
||||||
mNotificationPanelView = notificationPanelView;
|
mNotificationPanelView = notificationPanelView;
|
||||||
notificationPanelView.addExpansionListener(this);
|
notificationPanelView.addExpansionListener(this);
|
||||||
mBypassController = bypassController;
|
mBypassController = bypassController;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyLong;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
@@ -84,6 +85,8 @@ public class KeyguardBouncerTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
private UnlockMethodCache mUnlockMethodCache;
|
private UnlockMethodCache mUnlockMethodCache;
|
||||||
@Mock
|
@Mock
|
||||||
|
private KeyguardBypassController mKeyguardBypassController;
|
||||||
|
@Mock
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
private KeyguardBouncer mBouncer;
|
private KeyguardBouncer mBouncer;
|
||||||
@@ -98,7 +101,8 @@ public class KeyguardBouncerTest extends SysuiTestCase {
|
|||||||
when(mKeyguardHostView.getHeight()).thenReturn(500);
|
when(mKeyguardHostView.getHeight()).thenReturn(500);
|
||||||
mBouncer = new KeyguardBouncer(getContext(), mViewMediatorCallback,
|
mBouncer = new KeyguardBouncer(getContext(), mViewMediatorCallback,
|
||||||
mLockPatternUtils, container, mDismissCallbackRegistry, mFalsingManager,
|
mLockPatternUtils, container, mDismissCallbackRegistry, mFalsingManager,
|
||||||
mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor, mHandler) {
|
mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor,
|
||||||
|
mKeyguardBypassController, mHandler) {
|
||||||
@Override
|
@Override
|
||||||
protected void inflateView() {
|
protected void inflateView() {
|
||||||
super.inflateView();
|
super.inflateView();
|
||||||
@@ -390,6 +394,15 @@ public class KeyguardBouncerTest extends SysuiTestCase {
|
|||||||
verify(mHandler).removeCallbacks(eq(showRunnable.getValue()));
|
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
|
@Test
|
||||||
public void testRegisterUpdateMonitorCallback() {
|
public void testRegisterUpdateMonitorCallback() {
|
||||||
verify(mKeyguardUpdateMonitor).registerCallback(any());
|
verify(mKeyguardUpdateMonitor).registerCallback(any());
|
||||||
|
|||||||
Reference in New Issue
Block a user