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

Commit 5f62026b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Flicker free screen-on from AOD" into oc-dr1-dev

parents 928aad3e e4cb6c8a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public class DozeMachine {
                case UNINITIALIZED:
                case INITIALIZED:
                case DOZE:
                case DOZE_REQUEST_PULSE:
                case DOZE_AOD_PAUSED:
                    return Display.STATE_OFF;
                case DOZE_PULSING:
+1 −1
Original line number Diff line number Diff line
@@ -811,6 +811,7 @@ public class KeyguardViewMediator extends SystemUI {
        synchronized (this) {
            mDeviceInteractive = false;
            mGoingToSleep = false;
            mWakeAndUnlocking = false;

            resetKeyguardDonePendingLocked();
            mHideAnimationRun = false;
@@ -1957,7 +1958,6 @@ public class KeyguardViewMediator extends SystemUI {
            if (DEBUG) Log.d(TAG, "handleNotifyScreenTurnedOff");
            mStatusBarKeyguardViewManager.onScreenTurnedOff();
            mDrawnCallback = null;
            mWakeAndUnlocking = false;
        }
    }

+1 −4
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ public class DozeScrimController {
        // be invoked when we're done so that the caller can drop the pulse wakelock.
        mPulseCallback = callback;
        mPulseReason = reason;
        mScrimController.setDozeInFrontAlpha(1f);
        mHandler.post(mPulseIn);
    }

@@ -290,10 +291,6 @@ public class DozeScrimController {

            // Signal that the pulse is ready to turn the screen on and draw.
            pulseStarted();

            if (mDozeParameters.getAlwaysOn()) {
                mHandler.post(DozeScrimController.this::onScreenTurnedOn);
            }
        }
    };

+1 −1
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
        if (!mUpdateMonitor.isDeviceInteractive()) {
            if (!mStatusBarKeyguardViewManager.isShowing()) {
                return MODE_ONLY_WAKE;
            } else if (pulsingOrAod() && unlockingAllowed) {
            } else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
                return MODE_WAKE_AND_UNLOCK_PULSING;
            } else if (unlockingAllowed || !mUnlockMethodCache.isMethodSecure()) {
                return MODE_WAKE_AND_UNLOCK;
+45 −3
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.util.MathUtils;
import android.view.View;
import android.view.ViewGroup;
@@ -120,6 +119,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    private boolean mKeyguardFadingOutInProgress;
    private boolean mAnimatingDozeUnlock;
    private ValueAnimator mKeyguardFadeoutAnimation;
    /** Wake up from AOD transition is starting; need fully opaque front scrim */
    private boolean mWakingUpFromAodStarting;
    /** Wake up from AOD transition is in progress; need black tint */
    private boolean mWakingUpFromAodInProgress;
    /** Wake up from AOD transition is animating; need to reset when animation finishes */
    private boolean mWakingUpFromAodAnimationRunning;

    public ScrimController(LightBarController lightBarController, ScrimView scrimBehind,
            ScrimView scrimInFront, View headsUpScrim) {
@@ -187,9 +192,32 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        scheduleUpdate();
    }

    public void prepareWakeUpFromAod() {
        mWakingUpFromAodInProgress = true;
        mWakingUpFromAodStarting = true;
        mAnimateChange = false;
        scheduleUpdate();
        onPreDraw();
    }

    public void wakeUpFromAod() {
        if (mWakeAndUnlocking || mAnimateKeyguardFadingOut) {
            // Wake and unlocking has a separate transition that must not be interfered with.
            mWakingUpFromAodStarting = false;
            return;
        }
        if (mWakingUpFromAodStarting) {
            mWakingUpFromAodInProgress = true;
            mWakingUpFromAodStarting = false;
            mAnimateChange = true;
            scheduleUpdate();
        }
    }

    public void setWakeAndUnlocking() {
        mWakeAndUnlocking = true;
        mAnimatingDozeUnlock = true;
        mWakingUpFromAodStarting = false;
        scheduleUpdate();
    }

@@ -356,7 +384,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            setScrimBehindAlpha(mScrimBehindAlpha);
        } else {
            float fraction = Math.max(0, Math.min(mFraction, 1));
            if (mWakingUpFromAodStarting) {
                setScrimInFrontAlpha(1f);
            } else {
                setScrimInFrontAlpha(0f);
            }
            setScrimBehindAlpha(fraction
                    * (mScrimBehindAlphaKeyguard - mScrimBehindAlphaUnlocking)
                    + mScrimBehindAlphaUnlocking);
@@ -426,7 +458,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            scrimView.setViewAlpha(alpha);

            int dozeTint = Color.TRANSPARENT;
            if (mAnimatingDozeUnlock || mDozing) {

            boolean dozing = mAnimatingDozeUnlock || mDozing;
            boolean frontScrimDozing = mWakingUpFromAodInProgress;
            if (dozing || frontScrimDozing && scrim == mScrimInFront) {
                dozeTint = Color.BLACK;
            }
            scrimView.setTint(dozeTint);
@@ -458,6 +493,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
                    mKeyguardFadingOutInProgress = false;
                    mAnimatingDozeUnlock = false;
                }
                if (mWakingUpFromAodAnimationRunning) {
                    mWakingUpFromAodAnimationRunning = false;
                    mWakingUpFromAodInProgress = false;
                }
                scrim.setTag(TAG_KEY_ANIM, null);
                scrim.setTag(TAG_KEY_ANIM_TARGET, null);
            }
@@ -467,6 +506,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            mKeyguardFadingOutInProgress = true;
            mKeyguardFadeoutAnimation = anim;
        }
        if (mWakingUpFromAodInProgress) {
            mWakingUpFromAodAnimationRunning = true;
        }
        if (mSkipFirstFrame) {
            anim.setCurrentPlayTime(16);
        }
Loading