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

Commit 601462f2 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Speedup unlock when authenticating with fingerprint"

parents 7b4e8873 f3b3bee1
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -171,6 +171,11 @@ public class KeyguardViewMediator extends SystemUI {
     */
    private static final String KEYGUARD_ANALYTICS_SETTING = "keyguard_analytics";

    /**
     * How much faster we collapse the lockscreen when authenticating with fingerprint.
     */
    private static final float FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR = 1.3f;

    /** The stream type that the lock sounds are tied to. */
    private int mUiSoundsStreamType;

@@ -441,7 +446,8 @@ public class KeyguardViewMediator extends SystemUI {
            if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                mViewMediatorCallback.keyguardDone(true);
            } else {
                mStatusBarKeyguardViewManager.animateCollapsePanels();
                mStatusBarKeyguardViewManager.animateCollapsePanels(
                        FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR);
            }
        };

+3 −2
Original line number Diff line number Diff line
@@ -511,9 +511,10 @@ public class NotificationPanelView extends PanelView implements
    }

    @Override
    protected void flingToHeight(float vel, boolean expand, float target) {
    protected void flingToHeight(float vel, boolean expand, float target,
            float collapseSpeedUpFactor) {
        mHeadsUpTouchHelper.notifyFling(!expand);
        super.flingToHeight(vel, expand, target);
        super.flingToHeight(vel, expand, target, collapseSpeedUpFactor);
    }

    @Override
+3 −3
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public class PanelBar extends FrameLayout {
        mPanelHolder.setSelectedPanel(mTouchingPanel);
        for (PanelView pv : mPanels) {
            if (pv != panel) {
                pv.collapse(false /* delayed */);
                pv.collapse(false /* delayed */, 1.0f /* speedUpFactor */);
            }
        }
    }
@@ -186,11 +186,11 @@ public class PanelBar extends FrameLayout {
                (fullyOpenedPanel!=null)?" fullyOpened":"", fullyClosed?" fullyClosed":"");
    }

    public void collapseAllPanels(boolean animate, boolean delayed) {
    public void collapseAllPanels(boolean animate, boolean delayed, float speedUpFactor) {
        boolean waiting = false;
        for (PanelView pv : mPanels) {
            if (animate && !pv.isFullyCollapsed()) {
                pv.collapse(delayed);
                pv.collapse(delayed, speedUpFactor);
                waiting = true;
            } else {
                pv.resetViews();
+21 −8
Original line number Diff line number Diff line
@@ -101,6 +101,12 @@ public abstract class PanelView extends FrameLayout {

    private boolean mPeekPending;
    private boolean mCollapseAfterPeek;

    /**
     * Speed-up factor to be used when {@link #mFlingCollapseRunnable} runs the next time.
     */
    private float mNextCollapseSpeedUpFactor = 1.0f;

    private boolean mExpanding;
    private boolean mGestureWaitForTouchSlop;
    private Runnable mPeekRunnable = new Runnable() {
@@ -164,7 +170,7 @@ public abstract class PanelView extends FrameLayout {
                    postOnAnimation(new Runnable() {
                        @Override
                        public void run() {
                            collapse(false /* delayed */);
                            collapse(false /* delayed */, 1.0f /* speedUpFactor */);
                        }
                    });
                }
@@ -563,12 +569,17 @@ public abstract class PanelView extends FrameLayout {
    }

    protected void fling(float vel, boolean expand) {
        fling(vel, expand, 1.0f /* collapseSpeedUpFactor */);
    }

    protected void fling(float vel, boolean expand, float collapseSpeedUpFactor) {
        cancelPeek();
        float target = expand ? getMaxPanelHeight() : 0.0f;
        flingToHeight(vel, expand, target);
        flingToHeight(vel, expand, target, collapseSpeedUpFactor);
    }

    protected void flingToHeight(float vel, boolean expand, float target) {
    protected void flingToHeight(float vel, boolean expand, float target,
            float collapseSpeedUpFactor) {
        // Hack to make the expand transition look nice when clear all button is visible - we make
        // the animation only to the last notification, and then jump to the maximum panel height so
        // clear all just fades in and the decelerating motion is towards the last notification.
@@ -600,7 +611,8 @@ public abstract class PanelView extends FrameLayout {
            // Make it shorter if we run a canned animation
            if (vel == 0) {
                animator.setDuration((long)
                        (animator.getDuration() * getCannedFlingDurationFactor()));
                        (animator.getDuration() * getCannedFlingDurationFactor()
                                / collapseSpeedUpFactor));
            }
        }
        animator.addListener(new AnimatorListenerAdapter() {
@@ -745,7 +757,7 @@ public abstract class PanelView extends FrameLayout {
        mBar = panelBar;
    }

    public void collapse(boolean delayed) {
    public void collapse(boolean delayed, float speedUpFactor) {
        if (DEBUG) logf("collapse: " + this);
        if (mPeekPending || mPeekAnimator != null) {
            mCollapseAfterPeek = true;
@@ -761,9 +773,10 @@ public abstract class PanelView extends FrameLayout {
            mClosing = true;
            notifyExpandingStarted();
            if (delayed) {
                mNextCollapseSpeedUpFactor = speedUpFactor;
                postDelayed(mFlingCollapseRunnable, 120);
            } else {
                fling(0, false /* expand */);
                fling(0, false /* expand */, speedUpFactor);
            }
        }
    }
@@ -771,7 +784,7 @@ public abstract class PanelView extends FrameLayout {
    private final Runnable mFlingCollapseRunnable = new Runnable() {
        @Override
        public void run() {
            fling(0, false /* expand */);
            fling(0, false /* expand */, mNextCollapseSpeedUpFactor);
        }
    };

@@ -975,7 +988,7 @@ public abstract class PanelView extends FrameLayout {
    protected final Runnable mPostCollapseRunnable = new Runnable() {
        @Override
        public void run() {
            collapse(false /* delayed */);
            collapse(false /* delayed */, 1.0f /* speedUpFactor */);
        }
    };

+14 −6
Original line number Diff line number Diff line
@@ -1981,14 +1981,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    }

    public void animateCollapsePanels(int flags) {
        animateCollapsePanels(flags, false /* force */, false /* delayed */);
        animateCollapsePanels(flags, false /* force */, false /* delayed */,
                1.0f /* speedUpFactor */);
    }

    public void animateCollapsePanels(int flags, boolean force) {
        animateCollapsePanels(flags, force, false /* delayed*/);
        animateCollapsePanels(flags, force, false /* delayed */, 1.0f /* speedUpFactor */);
    }

    public void animateCollapsePanels(int flags, boolean force, boolean delayed) {
        animateCollapsePanels(flags, force, delayed, 1.0f /* speedUpFactor */);
    }

    public void animateCollapsePanels(int flags, boolean force, boolean delayed,
            float speedUpFactor) {
        if (!force &&
                (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED)) {
            runPostCollapseRunnables();
@@ -2012,7 +2018,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            mStatusBarWindowManager.setStatusBarFocusable(false);

            mStatusBarWindow.cancelExpandHelper();
            mStatusBarView.collapseAllPanels(true /* animate */, delayed);
            mStatusBarView.collapseAllPanels(true /* animate */, delayed, speedUpFactor);
        }
    }

@@ -2055,7 +2061,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,

    public void animateCollapseQuickSettings() {
        if (mState == StatusBarState.SHADE) {
            mStatusBarView.collapseAllPanels(true, false /* delayed */);
            mStatusBarView.collapseAllPanels(true, false /* delayed */, 1.0f /* speedUpFactor */);
        }
    }

@@ -2068,7 +2074,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        }

        // Ensure the panel is fully collapsed (just in case; bug 6765842, 7260868)
        mStatusBarView.collapseAllPanels(/*animate=*/ false, false /* delayed*/);
        mStatusBarView.collapseAllPanels(/*animate=*/ false, false /* delayed*/,
                1.0f /* speedUpFactor */);

        mNotificationPanel.closeQs();

@@ -2158,7 +2165,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            mStatusBarWindowState = state;
            if (DEBUG_WINDOW_STATE) Log.d(TAG, "Status bar " + windowStateToString(state));
            if (!showing && mState == StatusBarState.SHADE) {
                mStatusBarView.collapseAllPanels(false /* animate */, false /* delayed */);
                mStatusBarView.collapseAllPanels(false /* animate */, false /* delayed */,
                        1.0f /* speedUpFactor */);
            }
        }
        if (mNavigationBarView != null
Loading