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

Commit 62115695 authored by Chris.CC Lee's avatar Chris.CC Lee Committed by Luca Stefani
Browse files

Fix AoD front scrim being opaque at DOZE_PULSING.

When doze state changed from DOZE to DOZE_PULSING on devices not
supporting doze_brightness_sensor_type sensor, there would be no
sensor events to update the AoD front scrim. And due to the scrim was
set to opaque at DOZE state, most views on the statusbar will be
invisible. This patch change the scrim to transparent again at leaving
DOZE state.

Bug: 148129743
Test: atest DozeScreenBrightnessTest
Change-Id: I2c079d081b04f00a929ae5c4475639685f9f7e69
parent 1c478748
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -161,6 +161,10 @@ public class DozeScreenBrightness extends BroadcastReceiver implements DozeMachi
                // again, it will only show after the brightness sensor has stabilized,
                // again, it will only show after the brightness sensor has stabilized,
                // avoiding a potential flicker.
                // avoiding a potential flicker.
                scrimOpacity = 255;
                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.
                scrimOpacity = 0;
            } else if (brightnessReady) {
            } else if (brightnessReady) {
                // Only unblank scrim once brightness is ready.
                // Only unblank scrim once brightness is ready.
                scrimOpacity = computeScrimOpacity(sensorValue);
                scrimOpacity = computeScrimOpacity(sensorValue);
+14 −0
Original line number Original line Diff line number Diff line
@@ -170,6 +170,20 @@ public class DozeScreenBrightnessTest extends SysuiTestCase {
        assertEquals(DEFAULT_BRIGHTNESS, mServiceFake.screenBrightness);
        assertEquals(DEFAULT_BRIGHTNESS, mServiceFake.screenBrightness);
    }
    }


    @Test
    public void testPulsing_withoutLightSensor_setsAoDDimmingScrimTransparent() throws Exception {
        mScreen = new DozeScreenBrightness(mContext, mServiceFake, mSensorManager,
                null /* sensor */, mHostFake, null /* handler */,
                DEFAULT_BRIGHTNESS, SENSOR_TO_BRIGHTNESS, SENSOR_TO_OPACITY,
                true /* debuggable */);
        mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
        mScreen.transitionTo(INITIALIZED, DOZE);

        mScreen.transitionTo(DOZE, DOZE_REQUEST_PULSE);

        assertEquals(0f, mHostFake.aodDimmingScrimOpacity, 0.001f /* delta */);
    }

    @Test
    @Test
    public void testNullSensor() throws Exception {
    public void testNullSensor() throws Exception {
        mScreen = new DozeScreenBrightness(mContext, mServiceFake, mSensorManager,
        mScreen = new DozeScreenBrightness(mContext, mServiceFake, mSensorManager,