Longer bouncer delay and simpler delay logic

Delay it for a little longer and always delay bouncer even if auth
didn't start yet.

Test: atest KeyguardBouncerTest
Test: swipe up from bouncer twice (before and after face auth)
Test: reboot, swipe up, observe no delay
Fixes: 134064323
Change-Id: I723e3ae72a6ba34c05ce41fa989c186c399f3ada
This commit is contained in:
Lucas Dupin
2019-06-03 20:22:39 -07:00
parent 63b02d86ae
commit 7825b944b7
4 changed files with 18 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);