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

Commit e93698b8 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix scrim handling when dismissing Keyguard in occluded case

Test: Manual, no security, Keyguard occluded, pull down shade,
press settings, ensure smooth scrim animation.
Test: Manual, with pattern, Keyguard occluded, pull down shade,
press settings, solve pattern, ensure smooth scrim animations.

Change-Id: I74e13844573e94d9fdc016ba33171c7c64a4f0f4
parent 3e68bb5d
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    private boolean mWakeAndUnlocking;
    protected boolean mAnimateChange;
    private boolean mUpdatePending;
    private boolean mExpanding;
    private boolean mTracking;
    private boolean mAnimateKeyguardFadingOut;
    protected long mDurationOverride = -1;
    private long mAnimationDelay;
@@ -122,12 +122,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    }

    public void onTrackingStarted() {
        mExpanding = true;
        mTracking = true;
        mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
    }

    public void onExpandingFinished() {
        mExpanding = false;
        mTracking = false;
    }

    public void setPanelExpansion(float fraction) {
@@ -137,7 +137,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            if (mPinnedHeadsUpCount != 0) {
                updateHeadsUpScrim(false);
            }
            if (mKeyguardFadeoutAnimation != null) {
            if (mKeyguardFadeoutAnimation != null && mTracking) {
                mKeyguardFadeoutAnimation.cancel();
            }
        }
@@ -145,7 +145,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,

    public void setBouncerShowing(boolean showing) {
        mBouncerShowing = showing;
        mAnimateChange = !mExpanding && !mDontAnimateBouncerChanges;
        mAnimateChange = !mTracking && !mDontAnimateBouncerChanges;
        scheduleUpdate();
    }

@@ -268,7 +268,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    }

    private void updateScrimKeyguard() {
        if (mExpanding && mDarkenWhileDragging) {
        if (mTracking && mDarkenWhileDragging) {
            float behindFraction = Math.max(0, Math.min(mFraction, 1));
            float fraction = 1 - behindFraction;
            fraction = (float) Math.pow(fraction, 0.8f);
@@ -277,7 +277,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            setScrimBehindColor(behindFraction * mScrimBehindAlphaKeyguard);
        } else if (mBouncerShowing && !mBouncerIsKeyguard) {
            setScrimInFrontColor(getScrimInFrontAlpha());
            setScrimBehindColor(0f);
            updateScrimNormal();
        } else if (mBouncerShowing) {
            setScrimInFrontColor(0f);
            setScrimBehindColor(mScrimBehindAlpha);
@@ -473,7 +473,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    }

    private void updateScrim(boolean animate, View scrim, float alpha, float currentAlpha) {
        if (mKeyguardFadingOutInProgress) {
        if (mKeyguardFadingOutInProgress && mKeyguardFadeoutAnimation.getCurrentPlayTime() != 0) {
            return;
        }

+13 −11
Original line number Diff line number Diff line
@@ -330,17 +330,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
            });
        } else {
            executeAfterKeyguardGoneAction();
            if (mFingerprintUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING) {
            boolean wakeUnlockPulsing =
                    mFingerprintUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING;
            if (wakeUnlockPulsing) {
                delay = 0;
                fadeoutDuration = 240;
            }
            mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
            mFingerprintUnlockController.startKeyguardFadingAway();
                mPhoneStatusBar.setKeyguardFadingAway(startTime, 0, 240);
            mBouncer.hide(true /* destroyView */);
            updateStates();
            if (wakeUnlockPulsing) {
                mStatusBarWindowManager.setKeyguardFadingAway(true);
                mPhoneStatusBar.fadeKeyguardWhilePulsing();
                animateScrimControllerKeyguardFadingOut(0, 240, new Runnable() {
                    @Override
                    public void run() {
                        mPhoneStatusBar.hideKeyguard();
                    }
                }, false /* skipFirstFrame */);
                animateScrimControllerKeyguardFadingOut(delay, fadeoutDuration,
                        mPhoneStatusBar::hideKeyguard, false /* skipFirstFrame */);
            } else {
                mFingerprintUnlockController.startKeyguardFadingAway();
                mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
@@ -367,9 +371,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
                }
            }
            mStatusBarWindowManager.setKeyguardShowing(false);
            mBouncer.hide(true /* destroyView */);
            mViewMediatorCallback.keyguardGone();
            updateStates();
        }
    }