Skip to content

Commit c4a202a

Browse files
PaeP3nguinAndroid Build Coastguard Worker
authored andcommitted
Fix home controls showing on low light dream
Low light should never show complications, so short circuit early and don't return any in the state controller. Bug: 277746325 Test: atest DreamOverlayStateControllerTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f501b295e11d22455f661707adad9d020b193d25) Merged-In: Iae6388dafa69098b70e9229bc562172fec1fb149 Change-Id: Iae6388dafa69098b70e9229bc562172fec1fb149
1 parent adb11ed commit c4a202a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ public Collection<Complication> getComplications() {
182182
* Returns collection of present {@link Complication}.
183183
*/
184184
public Collection<Complication> getComplications(boolean filterByAvailability) {
185+
if (isLowLightActive()) {
186+
// Don't show complications on low light.
187+
return Collections.emptyList();
188+
}
185189
return Collections.unmodifiableCollection(filterByAvailability
186190
? mComplications
187191
.stream()

packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,23 @@ public void testComplicationWithNoTypeNotFiltered() {
234234
.isTrue();
235235
}
236236

237+
@Test
238+
public void testComplicationsNotShownForLowLight() {
239+
final Complication complication = Mockito.mock(Complication.class);
240+
final DreamOverlayStateController stateController = getDreamOverlayStateController(true);
241+
242+
// Add a complication and verify it's returned in getComplications.
243+
stateController.addComplication(complication);
244+
mExecutor.runAllReady();
245+
assertThat(stateController.getComplications().contains(complication))
246+
.isTrue();
247+
248+
stateController.setLowLightActive(true);
249+
mExecutor.runAllReady();
250+
251+
assertThat(stateController.getComplications()).isEmpty();
252+
}
253+
237254
@Test
238255
public void testNotifyLowLightChanged() {
239256
final DreamOverlayStateController stateController = getDreamOverlayStateController(true);

0 commit comments

Comments
 (0)