Loading packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,9 @@ import org.mockito.MockitoAnnotations; public class DreamOverlayServiceTest extends SysuiTestCase { private static final ComponentName LOW_LIGHT_COMPONENT = new ComponentName("package", "lowlight"); private static final ComponentName HOME_CONTROL_PANEL_DREAM_COMPONENT = new ComponentName("package", "homeControlPanel"); private static final String DREAM_COMPONENT = "package/dream"; private static final String WINDOW_NAME = "test"; private final FakeSystemClock mFakeSystemClock = new FakeSystemClock(); Loading Loading @@ -194,6 +197,7 @@ public class DreamOverlayServiceTest extends SysuiTestCase { mUiEventLogger, mTouchInsetManager, LOW_LIGHT_COMPONENT, HOME_CONTROL_PANEL_DREAM_COMPONENT, mDreamOverlayCallbackController, WINDOW_NAME); } Loading Loading @@ -316,6 +320,19 @@ public class DreamOverlayServiceTest extends SysuiTestCase { verify(mStateController).setLowLightActive(true); } @Test public void testHomeControlPanelSetsByStartDream() throws RemoteException { final IDreamOverlayClient client = getClient(); // Inform the overlay service of dream starting. client.startDream(mWindowParams, mDreamOverlayCallback, HOME_CONTROL_PANEL_DREAM_COMPONENT.flattenToString(), false /*shouldShowComplication*/); mMainExecutor.runAllReady(); assertThat(mService.getDreamComponent()).isEqualTo(HOME_CONTROL_PANEL_DREAM_COMPONENT); verify(mStateController).setHomeControlPanelActive(true); } @Test public void testOnEndDream() throws RemoteException { final IDreamOverlayClient client = getClient(); Loading packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,23 @@ public class DreamOverlayStateControllerTest extends SysuiTestCase { .isTrue(); } @Test public void testComplicationsNotShownForHomeControlPanelDream() { 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.setHomeControlPanelActive(true); mExecutor.runAllReady(); assertThat(stateController.getComplications()).isEmpty(); } @Test public void testComplicationsNotShownForLowLight() { final Complication complication = Mockito.mock(Complication.class); Loading packages/SystemUI/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -980,6 +980,11 @@ --> <integer name="config_sfpsSensorWidth">200</integer> <!-- Component name for Home Panel Dream --> <string name="config_homePanelDreamComponent" translatable="false"> @null </string> <!-- They are service names that, if enabled, will cause the magnification settings button to never hide after timeout. Loading packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java +10 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.dreams; import static com.android.systemui.dreams.dagger.DreamModule.DREAM_OVERLAY_WINDOW_TITLE; import static com.android.systemui.dreams.dagger.DreamModule.DREAM_TOUCH_INSET_MANAGER; import static com.android.systemui.dreams.dagger.DreamModule.HOME_CONTROL_PANEL_DREAM_COMPONENT; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -76,6 +77,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; @Nullable private final ComponentName mLowLightDreamComponent; @Nullable private final ComponentName mHomeControlPanelDreamComponent; private final UiEventLogger mUiEventLogger; private final WindowManager mWindowManager; private final String mWindowTitle; Loading Loading @@ -165,6 +168,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ @Named(DREAM_TOUCH_INSET_MANAGER) TouchInsetManager touchInsetManager, @Nullable @Named(LowLightDreamModule.LOW_LIGHT_DREAM_COMPONENT) ComponentName lowLightDreamComponent, @Nullable @Named(HOME_CONTROL_PANEL_DREAM_COMPONENT) ComponentName homeControlPanelDreamComponent, DreamOverlayCallbackController dreamOverlayCallbackController, @Named(DREAM_OVERLAY_WINDOW_TITLE) String windowTitle) { super(executor); Loading @@ -173,6 +178,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ mWindowManager = windowManager; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLowLightDreamComponent = lowLightDreamComponent; mHomeControlPanelDreamComponent = homeControlPanelDreamComponent; mKeyguardUpdateMonitor.registerCallback(mKeyguardCallback); mStateController = stateController; mUiEventLogger = uiEventLogger; Loading Loading @@ -249,6 +255,10 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ final ComponentName dreamComponent = getDreamComponent(); mStateController.setLowLightActive( dreamComponent != null && dreamComponent.equals(mLowLightDreamComponent)); mStateController.setHomeControlPanelActive( dreamComponent != null && dreamComponent.equals(mHomeControlPanelDreamComponent)); mUiEventLogger.log(DreamOverlayEvent.DREAM_OVERLAY_COMPLETE_START); mDreamOverlayCallbackController.onStartDream(); Loading packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java +10 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class DreamOverlayStateController implements public static final int STATE_DREAM_EXIT_ANIMATIONS_RUNNING = 1 << 3; public static final int STATE_HAS_ASSISTANT_ATTENTION = 1 << 4; public static final int STATE_DREAM_OVERLAY_STATUS_BAR_VISIBLE = 1 << 5; private static final int STATE_HOME_CONTROL_ACTIVE = 1 << 6; private static final int OP_CLEAR_STATE = 1; private static final int OP_SET_STATE = 2; Loading Loading @@ -186,7 +186,7 @@ public class DreamOverlayStateController implements * Returns collection of present {@link Complication}. */ public Collection<Complication> getComplications(boolean filterByAvailability) { if (isLowLightActive()) { if (isLowLightActive() || containsState(STATE_HOME_CONTROL_ACTIVE)) { // Don't show complications on low light. return Collections.emptyList(); } Loading Loading @@ -350,6 +350,14 @@ public class DreamOverlayStateController implements modifyState(active ? OP_SET_STATE : OP_CLEAR_STATE, STATE_LOW_LIGHT_ACTIVE); } /** * Sets whether home control panel is active. * @param active {@code true} if home control panel is active, {@code false} otherwise. */ public void setHomeControlPanelActive(boolean active) { modifyState(active ? OP_SET_STATE : OP_CLEAR_STATE, STATE_HOME_CONTROL_ACTIVE); } /** * Sets whether dream content and dream overlay entry animations are finished. * @param finished {@code true} if entry animations are finished, {@code false} otherwise. Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,9 @@ import org.mockito.MockitoAnnotations; public class DreamOverlayServiceTest extends SysuiTestCase { private static final ComponentName LOW_LIGHT_COMPONENT = new ComponentName("package", "lowlight"); private static final ComponentName HOME_CONTROL_PANEL_DREAM_COMPONENT = new ComponentName("package", "homeControlPanel"); private static final String DREAM_COMPONENT = "package/dream"; private static final String WINDOW_NAME = "test"; private final FakeSystemClock mFakeSystemClock = new FakeSystemClock(); Loading Loading @@ -194,6 +197,7 @@ public class DreamOverlayServiceTest extends SysuiTestCase { mUiEventLogger, mTouchInsetManager, LOW_LIGHT_COMPONENT, HOME_CONTROL_PANEL_DREAM_COMPONENT, mDreamOverlayCallbackController, WINDOW_NAME); } Loading Loading @@ -316,6 +320,19 @@ public class DreamOverlayServiceTest extends SysuiTestCase { verify(mStateController).setLowLightActive(true); } @Test public void testHomeControlPanelSetsByStartDream() throws RemoteException { final IDreamOverlayClient client = getClient(); // Inform the overlay service of dream starting. client.startDream(mWindowParams, mDreamOverlayCallback, HOME_CONTROL_PANEL_DREAM_COMPONENT.flattenToString(), false /*shouldShowComplication*/); mMainExecutor.runAllReady(); assertThat(mService.getDreamComponent()).isEqualTo(HOME_CONTROL_PANEL_DREAM_COMPONENT); verify(mStateController).setHomeControlPanelActive(true); } @Test public void testOnEndDream() throws RemoteException { final IDreamOverlayClient client = getClient(); Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,23 @@ public class DreamOverlayStateControllerTest extends SysuiTestCase { .isTrue(); } @Test public void testComplicationsNotShownForHomeControlPanelDream() { 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.setHomeControlPanelActive(true); mExecutor.runAllReady(); assertThat(stateController.getComplications()).isEmpty(); } @Test public void testComplicationsNotShownForLowLight() { final Complication complication = Mockito.mock(Complication.class); Loading
packages/SystemUI/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -980,6 +980,11 @@ --> <integer name="config_sfpsSensorWidth">200</integer> <!-- Component name for Home Panel Dream --> <string name="config_homePanelDreamComponent" translatable="false"> @null </string> <!-- They are service names that, if enabled, will cause the magnification settings button to never hide after timeout. Loading
packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java +10 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.dreams; import static com.android.systemui.dreams.dagger.DreamModule.DREAM_OVERLAY_WINDOW_TITLE; import static com.android.systemui.dreams.dagger.DreamModule.DREAM_TOUCH_INSET_MANAGER; import static com.android.systemui.dreams.dagger.DreamModule.HOME_CONTROL_PANEL_DREAM_COMPONENT; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -76,6 +77,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; @Nullable private final ComponentName mLowLightDreamComponent; @Nullable private final ComponentName mHomeControlPanelDreamComponent; private final UiEventLogger mUiEventLogger; private final WindowManager mWindowManager; private final String mWindowTitle; Loading Loading @@ -165,6 +168,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ @Named(DREAM_TOUCH_INSET_MANAGER) TouchInsetManager touchInsetManager, @Nullable @Named(LowLightDreamModule.LOW_LIGHT_DREAM_COMPONENT) ComponentName lowLightDreamComponent, @Nullable @Named(HOME_CONTROL_PANEL_DREAM_COMPONENT) ComponentName homeControlPanelDreamComponent, DreamOverlayCallbackController dreamOverlayCallbackController, @Named(DREAM_OVERLAY_WINDOW_TITLE) String windowTitle) { super(executor); Loading @@ -173,6 +178,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ mWindowManager = windowManager; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLowLightDreamComponent = lowLightDreamComponent; mHomeControlPanelDreamComponent = homeControlPanelDreamComponent; mKeyguardUpdateMonitor.registerCallback(mKeyguardCallback); mStateController = stateController; mUiEventLogger = uiEventLogger; Loading Loading @@ -249,6 +255,10 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ final ComponentName dreamComponent = getDreamComponent(); mStateController.setLowLightActive( dreamComponent != null && dreamComponent.equals(mLowLightDreamComponent)); mStateController.setHomeControlPanelActive( dreamComponent != null && dreamComponent.equals(mHomeControlPanelDreamComponent)); mUiEventLogger.log(DreamOverlayEvent.DREAM_OVERLAY_COMPLETE_START); mDreamOverlayCallbackController.onStartDream(); Loading
packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java +10 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class DreamOverlayStateController implements public static final int STATE_DREAM_EXIT_ANIMATIONS_RUNNING = 1 << 3; public static final int STATE_HAS_ASSISTANT_ATTENTION = 1 << 4; public static final int STATE_DREAM_OVERLAY_STATUS_BAR_VISIBLE = 1 << 5; private static final int STATE_HOME_CONTROL_ACTIVE = 1 << 6; private static final int OP_CLEAR_STATE = 1; private static final int OP_SET_STATE = 2; Loading Loading @@ -186,7 +186,7 @@ public class DreamOverlayStateController implements * Returns collection of present {@link Complication}. */ public Collection<Complication> getComplications(boolean filterByAvailability) { if (isLowLightActive()) { if (isLowLightActive() || containsState(STATE_HOME_CONTROL_ACTIVE)) { // Don't show complications on low light. return Collections.emptyList(); } Loading Loading @@ -350,6 +350,14 @@ public class DreamOverlayStateController implements modifyState(active ? OP_SET_STATE : OP_CLEAR_STATE, STATE_LOW_LIGHT_ACTIVE); } /** * Sets whether home control panel is active. * @param active {@code true} if home control panel is active, {@code false} otherwise. */ public void setHomeControlPanelActive(boolean active) { modifyState(active ? OP_SET_STATE : OP_CLEAR_STATE, STATE_HOME_CONTROL_ACTIVE); } /** * Sets whether dream content and dream overlay entry animations are finished. * @param finished {@code true} if entry animations are finished, {@code false} otherwise. Loading