[automerge] Fix home controls showing on low light dream 2p: f501b295e1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22599030

Bug: 277746325
Change-Id: I6694fce6b985f2665917f58bd70ed310d6458776
This commit is contained in:
William Xiao
2023-04-12 17:26:25 +00:00
committed by Presubmit Automerger Backend
2 changed files with 21 additions and 0 deletions

View File

@@ -182,6 +182,10 @@ public class DreamOverlayStateController implements
* Returns collection of present {@link Complication}.
*/
public Collection<Complication> getComplications(boolean filterByAvailability) {
if (isLowLightActive()) {
// Don't show complications on low light.
return Collections.emptyList();
}
return Collections.unmodifiableCollection(filterByAvailability
? mComplications
.stream()

View File

@@ -234,6 +234,23 @@ public class DreamOverlayStateControllerTest extends SysuiTestCase {
.isTrue();
}
@Test
public void testComplicationsNotShownForLowLight() {
final Complication complication = Mockito.mock(Complication.class);
final DreamOverlayStateController stateController = getDreamOverlayStateController(true);
// Add a complication and verify it's returned in getComplications.
stateController.addComplication(complication);
mExecutor.runAllReady();
assertThat(stateController.getComplications().contains(complication))
.isTrue();
stateController.setLowLightActive(true);
mExecutor.runAllReady();
assertThat(stateController.getComplications()).isEmpty();
}
@Test
public void testNotifyLowLightChanged() {
final DreamOverlayStateController stateController = getDreamOverlayStateController(true);