Merge "Fix home controls showing on low light dream" into tm-qpr-dev
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user