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

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

Merge "Synchronize and slow down fade in" into qt-r1-dev am: e392d5bb

am: 57e14fed

Change-Id: Ifc14d4dafbd99f8ade0b26e9599d3bda5f9daff2
parents 70ff4a64 57e14fed
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -50,9 +50,23 @@ public interface DozeHost {
     */
     */
    void onSlpiTap(float x, float y);
    void onSlpiTap(float x, float y);


    /**
     * Artificially dim down the the display by changing scrim opacities.
     * @param scrimOpacity opacity from 0 to 1.
     */
    default void setAodDimmingScrim(float scrimOpacity) {}
    default void setAodDimmingScrim(float scrimOpacity) {}

    /**
     * Sets the actual display brightness.
     * @param value from 0 to 255.
     */
    void setDozeScreenBrightness(int value);
    void setDozeScreenBrightness(int value);


    /**
     * Makes scrims black and changes animation durations.
     */
    default void prepareForGentleWakeUp() {}

    void onIgnoreTouchWhilePulsing(boolean ignore);
    void onIgnoreTouchWhilePulsing(boolean ignore);


    /**
    /**
+5 −2
Original line number Original line Diff line number Diff line
@@ -82,7 +82,10 @@ public class DozeScreenState implements DozeMachine.Part {
        boolean messagePending = mHandler.hasCallbacks(mApplyPendingScreenState);
        boolean messagePending = mHandler.hasCallbacks(mApplyPendingScreenState);
        boolean pulseEnding = oldState  == DozeMachine.State.DOZE_PULSE_DONE
        boolean pulseEnding = oldState  == DozeMachine.State.DOZE_PULSE_DONE
                && newState == DozeMachine.State.DOZE_AOD;
                && newState == DozeMachine.State.DOZE_AOD;
        if (messagePending || oldState == DozeMachine.State.INITIALIZED || pulseEnding) {
        boolean turningOn = (oldState == DozeMachine.State.DOZE_AOD_PAUSED
                || oldState  == DozeMachine.State.DOZE) && newState == DozeMachine.State.DOZE_AOD;
        boolean justInitialized = oldState == DozeMachine.State.INITIALIZED;
        if (messagePending || justInitialized || pulseEnding || turningOn) {
            // During initialization, we hide the navigation bar. That is however only applied after
            // During initialization, we hide the navigation bar. That is however only applied after
            // a traversal; setting the screen state here is immediate however, so it can happen
            // a traversal; setting the screen state here is immediate however, so it can happen
            // that the screen turns on again before the navigation bar is hidden. To work around
            // that the screen turns on again before the navigation bar is hidden. To work around
@@ -91,7 +94,7 @@ public class DozeScreenState implements DozeMachine.Part {


            // Delay screen state transitions even longer while animations are running.
            // Delay screen state transitions even longer while animations are running.
            boolean shouldDelayTransition = newState == DozeMachine.State.DOZE_AOD
            boolean shouldDelayTransition = newState == DozeMachine.State.DOZE_AOD
                    && mParameters.shouldControlScreenOff();
                    && mParameters.shouldControlScreenOff() && !turningOn;


            if (shouldDelayTransition) {
            if (shouldDelayTransition) {
                mWakeLock.setAcquired(true);
                mWakeLock.setAcquired(true);
+1 −1
Original line number Original line Diff line number Diff line
@@ -201,7 +201,7 @@ public class DozeTriggers implements DozeMachine.Part {
            // Let's prepare the display to wake-up by drawing black.
            // Let's prepare the display to wake-up by drawing black.
            // This will cover the hardware wake-up sequence, where the display
            // This will cover the hardware wake-up sequence, where the display
            // becomes black for a few frames.
            // becomes black for a few frames.
            mDozeHost.setAodDimmingScrim(255f);
            mDozeHost.setAodDimmingScrim(1f);
        }
        }
        mMachine.wakeUp();
        mMachine.wakeUp();
    }
    }
+1 −0
Original line number Original line Diff line number Diff line
@@ -130,6 +130,7 @@ public class DozeUi implements DozeMachine.Part {
                break;
                break;
            case DOZE:
            case DOZE:
            case DOZE_AOD_PAUSED:
            case DOZE_AOD_PAUSED:
                mHost.prepareForGentleWakeUp();
                unscheduleTimeTick();
                unscheduleTimeTick();
                break;
                break;
            case DOZE_REQUEST_PULSE:
            case DOZE_REQUEST_PULSE:
+14 −0
Original line number Original line Diff line number Diff line
@@ -486,6 +486,20 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
        mState.AOD.setAodFrontScrimAlpha(alpha);
        mState.AOD.setAodFrontScrimAlpha(alpha);
    }
    }


    /**
     * Set front scrim to black, cancelling animations, in order to prepare to fade them
     * away once the display turns on.
     */
    public void prepareForGentleWakeUp() {
        if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()) {
            mCurrentInFrontAlpha = 1f;
            mAnimateChange = false;
            updateScrims();
            mAnimateChange = true;
            mAnimationDuration = ANIMATION_DURATION_LONG;
        }
    }

    /**
    /**
     * If the lock screen sensor is active.
     * If the lock screen sensor is active.
     */
     */
Loading