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: I26f04664eec7a12e2a295c8906cf75a2b89da811
This commit is contained in:
@@ -167,6 +167,10 @@ public class DozeScreenBrightness extends BroadcastReceiver implements DozeMachi
|
||||
// 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.
|
||||
scrimOpacity = 0;
|
||||
} else if (brightnessReady) {
|
||||
// Only unblank scrim once brightness is ready.
|
||||
scrimOpacity = computeScrimOpacity(sensorValue);
|
||||
|
||||
@@ -172,6 +172,21 @@ public class DozeScreenBrightnessTest extends SysuiTestCase {
|
||||
assertEquals(1, mServiceFake.screenBrightness);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPulsing_withoutLightSensor_setsAoDDimmingScrimTransparent() throws Exception {
|
||||
mScreen = new DozeScreenBrightness(mContext, mServiceFake, mSensorManager,
|
||||
null /* sensor */, mBroadcastDispatcher, mDozeHost, null /* handler */,
|
||||
DEFAULT_BRIGHTNESS, SENSOR_TO_BRIGHTNESS, SENSOR_TO_OPACITY,
|
||||
true /* debuggable */);
|
||||
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
||||
mScreen.transitionTo(INITIALIZED, DOZE);
|
||||
reset(mDozeHost);
|
||||
|
||||
mScreen.transitionTo(DOZE, DOZE_REQUEST_PULSE);
|
||||
|
||||
verify(mDozeHost).setAodDimmingScrim(eq(0f));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDockedAod_usesLightSensor() {
|
||||
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
||||
|
||||
Reference in New Issue
Block a user