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

Commit f6b59e32 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Only show 'scanning' animation on bouncer" into qt-dev

am: c39db916

Change-Id: I50dd693d93f02776d195c81b848dc52a33f835f9
parents 105c5a71 c39db916
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public class KeyguardIndicationController implements StateListener {

    private final int mSlowThreshold;
    private final int mFastThreshold;
    private LockIcon mLockIcon;
    private final LockIcon mLockIcon;
    private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;

    private String mRestingIndication;
@@ -672,5 +672,10 @@ public class KeyguardIndicationController implements StateListener {
                updateIndication(false);
            }
        }

        @Override
        public void onKeyguardBouncerChanged(boolean bouncer) {
            mLockIcon.setBouncerVisible(bouncer);
        }
    };
}
+19 −5
Original line number Diff line number Diff line
@@ -57,8 +57,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
    private int mDensity;
    private boolean mPulsing;
    private boolean mDozing;
    private boolean mBouncerVisible;
    private boolean mLastDozing;
    private boolean mLastPulsing;
    private boolean mLastBouncerVisible;

    private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */);
    private float mDarkAmount;
@@ -109,9 +111,9 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        int state = getState();
        mIsFaceUnlockState = state == STATE_SCANNING_FACE;
        if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing
                || mLastScreenOn != mScreenOn || force) {
                || mLastScreenOn != mScreenOn || mLastBouncerVisible != mBouncerVisible || force) {
            int iconAnimRes = getAnimationResForTransition(mLastState, state, mLastPulsing,
                    mPulsing, mLastDozing, mDozing);
                    mPulsing, mLastDozing, mDozing, mBouncerVisible);
            boolean isAnim = iconAnimRes != -1;

            Drawable icon;
@@ -159,6 +161,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
            mLastScreenOn = mScreenOn;
            mLastDozing = mDozing;
            mLastPulsing = mPulsing;
            mLastBouncerVisible = mBouncerVisible;
        }

        setVisibility(mDozing && !mPulsing ? GONE : VISIBLE);
@@ -231,8 +234,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
    }

    private static int getAnimationResForTransition(int oldState, int newState,
            boolean wasPulsing, boolean pulsing,
            boolean wasDozing, boolean dozing) {
            boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing,
            boolean bouncerVisible) {

        // Never animate when screen is off
        if (dozing && !pulsing) {
@@ -249,7 +252,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
            return com.android.internal.R.anim.lock_unlock;
        } else if (justLocked) {
            return com.android.internal.R.anim.lock_lock;
        } else if (newState == STATE_SCANNING_FACE) {
        } else if (newState == STATE_SCANNING_FACE && bouncerVisible) {
            return com.android.internal.R.anim.lock_scanning;
        } else if (!wasPulsing && pulsing && newState != STATE_LOCK_OPEN) {
            return com.android.internal.R.anim.lock_in;
@@ -298,4 +301,15 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        int color = ColorUtils.blendARGB(Color.TRANSPARENT, Color.WHITE, mDarkAmount);
        drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
    }

    /**
     * If bouncer is visible or not.
     */
    public void setBouncerVisible(boolean bouncerVisible) {
        if (mBouncerVisible == bouncerVisible) {
            return;
        }
        mBouncerVisible = bouncerVisible;
        update();
    }
}