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

Commit a106225b authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Either reuse sensor values or don't dim down at all" into rvc-dev

parents 19df5240 389a0185
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -161,15 +161,8 @@ public class DozeScreenBrightness extends BroadcastReceiver implements DozeMachi
            }

            int scrimOpacity = -1;
            if (mPaused || mScreenOff) {
                // If AOD is paused, force the screen black until the
                // sensor reports a new brightness. This ensures that when the screen comes on
                // again, it will only show after the brightness sensor has stabilized,
                // avoiding a potential flicker.
                scrimOpacity = 255;
            } else if (!mScreenOff && mLightSensor == null) {
                // No light sensor but previous state turned the screen black. Make the scrim
                // transparent and below views visible.
            if (mLightSensor == null) {
                // No light sensor, scrims are always transparent.
                scrimOpacity = 0;
            } else if (brightnessReady) {
                // Only unblank scrim once brightness is ready.
+0 −25
Original line number Diff line number Diff line
@@ -247,31 +247,6 @@ public class DozeScreenBrightnessTest extends SysuiTestCase {
        verify(mDozeHost).setAodDimmingScrim(eq(10f / 255f));
    }

    @Test
    public void pausingAod_softBlanks_withSpuriousSensorDuringPause() throws Exception {
        mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
        mScreen.transitionTo(INITIALIZED, DOZE_AOD);
        mScreen.transitionTo(DOZE_AOD, DOZE_AOD_PAUSING);
        mScreen.transitionTo(DOZE_AOD_PAUSING, DOZE_AOD_PAUSED);

        reset(mDozeHost);
        mSensor.sendSensorEvent(1);
        verify(mDozeHost).setAodDimmingScrim(eq(1f));
    }

    @Test
    public void screenOff_softBlanks() throws Exception {
        mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
        mScreen.transitionTo(INITIALIZED, DOZE_AOD);
        mScreen.transitionTo(DOZE_AOD, DOZE);
        verify(mDozeHost).setAodDimmingScrim(eq(1f));

        reset(mDozeHost);
        mScreen.transitionTo(DOZE, DOZE_AOD);
        mSensor.sendSensorEvent(2);
        verify(mDozeHost).setAodDimmingScrim(eq(0f));
    }

    @Test
    public void pausingAod_unblanksAfterSensor() throws Exception {
        mScreen.transitionTo(UNINITIALIZED, INITIALIZED);