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

Commit 9ce46b64 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Longer bouncer delay and simpler delay logic" into qt-r1-dev

parents 1b159298 7825b944
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
    }
+3 −2
Original line number Diff line number Diff line
@@ -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,
+6 −3
Original line number Diff line number Diff line
@@ -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);
+4 −2
Original line number Diff line number Diff line
@@ -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);