From ae8b96964c45414f08868f7ca727507637440e13 Mon Sep 17 00:00:00 2001 From: Darrell Shi Date: Fri, 18 Feb 2022 23:00:06 +0000 Subject: [PATCH] Change default showClockAndComplications to false. This makes sure existing behaviors don't change, and only dreams that specify show dream overlay complications get them. Test: atest DreamOverlayServiceTest Bug: 214456383 Fix: 214456383 Change-Id: I5c94484d5af592159a07257137a138e41d0c6b53 --- core/java/android/service/dreams/DreamService.java | 2 +- .../android/systemui/dreams/DreamOverlayServiceTest.java | 8 ++++---- .../systemui/dreams/DreamOverlayStateControllerTest.java | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java index 345917220b6b4..7da0e12564257 100644 --- a/core/java/android/service/dreams/DreamService.java +++ b/core/java/android/service/dreams/DreamService.java @@ -219,7 +219,7 @@ public class DreamService extends Service implements Window.Callback { * The default value for whether to show complications on the overlay. * @hide */ - public static final boolean DEFAULT_SHOW_COMPLICATIONS = true; + public static final boolean DEFAULT_SHOW_COMPLICATIONS = false; private final IDreamManager mDreamManager; private final Handler mHandler = new Handler(Looper.getMainLooper()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java index 58ffbfa763281..8e4708f26a9e6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java @@ -147,19 +147,19 @@ public class DreamOverlayServiceTest extends SysuiTestCase { } @Test - public void testShouldShowComplicationsTrueByDefault() { + public void testShouldShowComplicationsFalseByDefault() { mService.onBind(new Intent()); - assertThat(mService.shouldShowComplications()).isTrue(); + assertThat(mService.shouldShowComplications()).isFalse(); } @Test public void testShouldShowComplicationsSetByIntentExtra() { final Intent intent = new Intent(); - intent.putExtra(DreamService.EXTRA_SHOW_COMPLICATIONS, false); + intent.putExtra(DreamService.EXTRA_SHOW_COMPLICATIONS, true); mService.onBind(intent); - assertThat(mService.shouldShowComplications()).isFalse(); + assertThat(mService.shouldShowComplications()).isTrue(); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java index 515a1ac814a95..81aa42b38b9a0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java @@ -126,6 +126,7 @@ public class DreamOverlayStateControllerTest extends SysuiTestCase { public void testComplicationFilteringWhenShouldShowComplications() { final DreamOverlayStateController stateController = new DreamOverlayStateController(mExecutor); + stateController.setShouldShowComplications(true); final Complication alwaysAvailableComplication = Mockito.mock(Complication.class); final Complication weatherComplication = Mockito.mock(Complication.class);