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

Commit d21cc637 authored by William Xiao's avatar William Xiao Committed by Automerger Merge Worker
Browse files

Merge changes from topic "presubmit-am-57d52d57ff4341f4a6a8262caebf7e00" into...

Merge changes from topic "presubmit-am-57d52d57ff4341f4a6a8262caebf7e00" into tm-qpr-dev-plus-aosp am: d7f491f7 am: ba518571

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



Change-Id: Ifc33f96fe73a2362fa65995aa7586060b76df9b8
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3895ea24 ba518571
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -184,6 +184,10 @@ public class DreamOverlayStateController implements
     * Returns collection of present {@link Complication}.
     * Returns collection of present {@link Complication}.
     */
     */
    public Collection<Complication> getComplications(boolean filterByAvailability) {
    public Collection<Complication> getComplications(boolean filterByAvailability) {
        if (isLowLightActive()) {
            // Don't show complications on low light.
            return Collections.emptyList();
        }
        return Collections.unmodifiableCollection(filterByAvailability
        return Collections.unmodifiableCollection(filterByAvailability
                ? mComplications
                ? mComplications
                .stream()
                .stream()
+17 −0
Original line number Original line Diff line number Diff line
@@ -234,6 +234,23 @@ public class DreamOverlayStateControllerTest extends SysuiTestCase {
                .isTrue();
                .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
    @Test
    public void testNotifyLowLightChanged() {
    public void testNotifyLowLightChanged() {
        final DreamOverlayStateController stateController = getDreamOverlayStateController(true);
        final DreamOverlayStateController stateController = getDreamOverlayStateController(true);