diff options
4 files changed, 18 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 26d3d86778e4..9feca3d2865a 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -933,6 +933,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { == LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; } + public boolean userNeedsStrongAuth() { + return mStrongAuthTracker.getStrongAuthForUser(getCurrentUser()) + != LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED; + } + public boolean needsSlowUnlockTransition() { return mNeedsSlowUnlockTransition; } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index 0fdab014439b..34cc70c1c42d 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -60,6 +60,7 @@ import com.android.systemui.statusbar.phone.ScrimState; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; +import com.android.systemui.statusbar.phone.UnlockMethodCache; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.util.InjectionInflationController; import com.android.systemui.util.leak.GarbageMonitor; @@ -130,8 +131,8 @@ public class SystemUIFactory { KeyguardBouncer.BouncerExpansionCallback expansionCallback) { return new KeyguardBouncer(context, callback, lockPatternUtils, container, dismissCallbackRegistry, FalsingManagerFactory.getInstance(context), - expansionCallback, KeyguardUpdateMonitor.getInstance(context), - new Handler(Looper.getMainLooper())); + expansionCallback, UnlockMethodCache.getInstance(context), + KeyguardUpdateMonitor.getInstance(context), 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 0b994ff46f29..f5d058c32f0b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -54,7 +54,7 @@ import java.io.PrintWriter; public class KeyguardBouncer { private static final String TAG = "KeyguardBouncer"; - static final long BOUNCER_FACE_DELAY = 800; + static final long BOUNCER_FACE_DELAY = 1200; static final float ALPHA_EXPANSION_THRESHOLD = 0.95f; static final float EXPANSION_HIDDEN = 1f; static final float EXPANSION_VISIBLE = 0f; @@ -68,6 +68,7 @@ public class KeyguardBouncer { private final Handler mHandler; private final BouncerExpansionCallback mExpansionCallback; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; + private final UnlockMethodCache mUnlockMethodCache; private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() { @Override @@ -95,7 +96,7 @@ public class KeyguardBouncer { public KeyguardBouncer(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils, ViewGroup container, DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager, - BouncerExpansionCallback expansionCallback, + BouncerExpansionCallback expansionCallback, UnlockMethodCache unlockMethodCache, KeyguardUpdateMonitor keyguardUpdateMonitor, Handler handler) { mContext = context; mCallback = callback; @@ -106,6 +107,7 @@ public class KeyguardBouncer { mDismissCallbackRegistry = dismissCallbackRegistry; mExpansionCallback = expansionCallback; mHandler = handler; + mUnlockMethodCache = unlockMethodCache; mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback); } @@ -168,7 +170,8 @@ public class KeyguardBouncer { // Split up the work over multiple frames. DejankUtils.removeCallbacks(mResetRunnable); - if (mKeyguardUpdateMonitor.isFaceDetectionRunning()) { + if (mUnlockMethodCache.isUnlockingWithFacePossible() && !needsFullscreenBouncer() + && !mKeyguardUpdateMonitor.userNeedsStrongAuth()) { mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY); } else { DejankUtils.postAfterTraversal(mShowRunnable); 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 3bc5f3e62aaa..4e0ef56ad830 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 @@ -82,6 +82,8 @@ public class KeyguardBouncerTest extends SysuiTestCase { @Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor; @Mock + private UnlockMethodCache mUnlockMethodCache; + @Mock private Handler mHandler; private KeyguardBouncer mBouncer; @@ -96,7 +98,7 @@ public class KeyguardBouncerTest extends SysuiTestCase { when(mKeyguardHostView.getHeight()).thenReturn(500); mBouncer = new KeyguardBouncer(getContext(), mViewMediatorCallback, mLockPatternUtils, container, mDismissCallbackRegistry, mFalsingManager, - mExpansionCallback, mKeyguardUpdateMonitor, mHandler) { + mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor, mHandler) { @Override protected void inflateView() { super.inflateView(); @@ -377,7 +379,7 @@ public class KeyguardBouncerTest extends SysuiTestCase { @Test public void testShow_delaysIfFaceAuthIsRunning() { - when(mKeyguardUpdateMonitor.isFaceDetectionRunning()).thenReturn(true); + when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true); mBouncer.show(true /* reset */); ArgumentCaptor<Runnable> showRunnable = ArgumentCaptor.forClass(Runnable.class); |