summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2019-08-21 22:39:10 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-08-21 22:39:10 +0000
commit2315c1e62ac7eb3fa68cde13038fce194caeb3fc (patch)
treea559de52685eddce79b0792a733fcf3444d6dabd
parent3792fb408a924baf68a9d9b85750368360142146 (diff)
parent055ef94e994fe9fcbcca16c29fd23f3f9b97df25 (diff)
Merge "Only delay bouncer if bypass is off"
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIFactory.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java15
4 files changed, 24 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
index 7e3b42389637..d5c928b4d198 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
@@ -140,11 +140,12 @@ public class SystemUIFactory {
LockPatternUtils lockPatternUtils, ViewGroup container,
DismissCallbackRegistry dismissCallbackRegistry,
KeyguardBouncer.BouncerExpansionCallback expansionCallback,
- FalsingManager falsingManager) {
+ FalsingManager falsingManager, KeyguardBypassController bypassController) {
return new KeyguardBouncer(context, callback, lockPatternUtils, container,
dismissCallbackRegistry, falsingManager,
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,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index c4d346ccaefb..dc9b373de688 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -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);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 3508c90bc8a2..ccb85fa64364 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -221,7 +221,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mBiometricUnlockController = biometricUnlockController;
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
- mExpansionCallback, falsingManager);
+ mExpansionCallback, falsingManager, bypassController);
mNotificationPanelView = notificationPanelView;
notificationPanelView.addExpansionListener(this);
mBypassController = bypassController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
index 907e695f2513..cd60e47eef50 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
@@ -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();
@@ -391,6 +395,15 @@ public class KeyguardBouncerTest extends SysuiTestCase {
}
@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());
}