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

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

Merge "Fix jank while unlocking and security is set" into lmp-dev

parents 4605b292 416493bf
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone;

import android.content.Context;
import android.view.Choreographer;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@@ -43,7 +44,8 @@ public class KeyguardBouncer {
    private StatusBarWindowManager mWindowManager;
    private KeyguardViewBase mKeyguardView;
    private ViewGroup mRoot;
    private boolean mFadingOut;
    private boolean mShowingSoon;
    private Choreographer mChoreographer = Choreographer.getInstance();

    public KeyguardBouncer(Context context, ViewMediatorCallback callback,
            LockPatternUtils lockPatternUtils, StatusBarWindowManager windowManager,
@@ -57,7 +59,7 @@ public class KeyguardBouncer {

    public void show() {
        ensureView();
        if (mRoot.getVisibility() == View.VISIBLE) {
        if (mRoot.getVisibility() == View.VISIBLE || mShowingSoon) {

            // show() updates the current security method. This is needed in case we are already
            // showing and the current security method changed.
@@ -68,10 +70,27 @@ public class KeyguardBouncer {
        // Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole
        // Keyguard. If we need to authenticate, show the bouncer.
        if (!mKeyguardView.dismiss()) {
            mShowingSoon = true;

            // Split up the work over multiple frames.
            mChoreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, mShowRunnable,
                    null, 48);
        }
    }

    private final Runnable mShowRunnable = new Runnable() {
        @Override
        public void run() {
            mRoot.setVisibility(View.VISIBLE);
            mKeyguardView.onResume();
            mKeyguardView.startAppearAnimation();
            mShowingSoon = false;
        }
    };

    private void cancelShowRunnable() {
        mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, mShowRunnable, null);
        mShowingSoon = false;
    }

    public void showWithDismissAction(OnDismissAction r) {
@@ -81,6 +100,7 @@ public class KeyguardBouncer {
    }

    public void hide(boolean destroyView) {
        cancelShowRunnable();
         if (mKeyguardView != null) {
            mKeyguardView.setOnDismissAction(null);
            mKeyguardView.cleanUp();
@@ -107,6 +127,7 @@ public class KeyguardBouncer {
     * Reset the state of the view.
     */
    public void reset() {
        cancelShowRunnable();
        inflateView();
    }

@@ -127,7 +148,7 @@ public class KeyguardBouncer {
    }

    public boolean isShowing() {
        return mRoot != null && mRoot.getVisibility() == View.VISIBLE && !mFadingOut;
        return mShowingSoon || (mRoot != null && mRoot.getVisibility() == View.VISIBLE);
    }

    public void prepare() {
+10 −1
Original line number Diff line number Diff line
@@ -507,7 +507,16 @@ public class NavigationBarView extends LinearLayout {
        }
    }


    @Override
    public void setVisibility(int visibility) {
        super.setVisibility(visibility);
        boolean visible = visibility == View.VISIBLE;
        getBackButton().getBackground().setVisible(visible, false /* restart */);
        getHomeButton().getBackground().setVisible(visible, false /* restart */);
        getRecentsButton().getBackground().setVisible(visible, false /* restart */);
        getMenuButton().getBackground().setVisible(visible, false /* restart */);
        getImeSwitchButton().getBackground().setVisible(visible, false /* restart */);
    }

    /*
    @Override
+4 −2
Original line number Diff line number Diff line
@@ -2364,8 +2364,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mStackScroller.setVisibility(View.VISIBLE);
        mNotificationPanel.setVisibility(View.GONE);

        setAreThereNotifications(); // show the clear button

        mNotificationPanel.closeQs();

        mExpandedVisible = false;
@@ -3580,6 +3578,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        disable(mDisabledUnmodified, true /* animate */);
    }

    public boolean isKeyguardFadingAway() {
        return mKeyguardFadingAway;
    }

    /**
     * Notifies that the Keyguard fading away animation is done.
     */
+26 −2
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ public class StatusBarKeyguardViewManager {
    // When hiding the Keyguard with timing supplied from WindowManager, better be early than late.
    private static final long HIDE_TIMING_CORRECTION_MS = -3 * 16;

    // Delay for showing the navigation bar when the bouncer appears. This should be kept in sync
    // with the appear animations of the PIN/pattern/password views.
    private static final long NAV_BAR_SHOW_DELAY_BOUNCER = 320;

    private static String TAG = "StatusBarKeyguardViewManager";

    private final Context mContext;
@@ -323,12 +327,30 @@ public class StatusBarKeyguardViewManager {
        return mBouncer.isShowing();
    }

    private long getNavBarShowDelay() {
        if (mPhoneStatusBar.isKeyguardFadingAway()) {
            return mPhoneStatusBar.getKeyguardFadingAwayDelay();
        } else {

            // Keyguard is not going away, thus we are showing the navigation bar because the
            // bouncer is appearing.
            return NAV_BAR_SHOW_DELAY_BOUNCER;
        }
    }

    private Runnable mMakeNavigationBarVisibleRunnable = new Runnable() {
        @Override
        public void run() {
            mPhoneStatusBar.getNavigationBarView().setVisibility(View.VISIBLE);
        }
    };

    private void updateStates() {
        int vis = mContainer.getSystemUiVisibility();
        boolean showing = mShowing;
        boolean occluded = mOccluded;
        boolean bouncerShowing = mBouncer.isShowing();
        boolean bouncerDismissible = bouncerShowing && !mBouncer.needsFullscreenBouncer();
        boolean bouncerDismissible = !mBouncer.needsFullscreenBouncer();

        if ((bouncerDismissible || !showing) != (mLastBouncerDismissible || !mLastShowing)
                || mFirstUpdate) {
@@ -342,8 +364,10 @@ public class StatusBarKeyguardViewManager {
                != (!(mLastShowing && !mLastOccluded) || mLastBouncerShowing) || mFirstUpdate) {
            if (mPhoneStatusBar.getNavigationBarView() != null) {
                if (!(showing && !occluded) || bouncerShowing) {
                    mPhoneStatusBar.getNavigationBarView().setVisibility(View.VISIBLE);
                    mContainer.postOnAnimationDelayed(mMakeNavigationBarVisibleRunnable,
                            getNavBarShowDelay());
                } else {
                    mContainer.removeCallbacks(mMakeNavigationBarVisibleRunnable);
                    mPhoneStatusBar.getNavigationBarView().setVisibility(View.GONE);
                }
            }
+14 −2
Original line number Diff line number Diff line
@@ -55,13 +55,25 @@ public class StatusBarWindowView extends FrameLayout {
    @Override
    protected boolean fitSystemWindows(Rect insets) {
        if (getFitsSystemWindows()) {
            boolean changed = insets.left != getPaddingLeft()
                    || insets.top != getPaddingTop()
                    || insets.right != getPaddingRight()
                    || insets.bottom != getPaddingBottom();
            if (changed) {
                setPadding(insets.left, insets.top, insets.right, 0);
            }
            insets.left = 0;
            insets.top = 0;
            insets.right = 0;
        } else {
            boolean changed = getPaddingLeft() != 0
                    || getPaddingRight() != 0
                    || getPaddingTop() != 0
                    || getPaddingBottom() != 0;
            if (changed) {
                setPadding(0, 0, 0, 0);
            }
        }
        return false;
    }