Loading services/core/java/com/android/server/wm/RootWindowContainer.java +8 −0 Original line number Diff line number Diff line Loading @@ -1577,6 +1577,14 @@ class RootWindowContainer extends WindowContainer<DisplayContent> return false; } if (DesktopExperienceFlags.ENABLE_DISPLAY_CONTENT_MODE_MANAGEMENT.isTrue() && DesktopExperienceFlags.ENABLE_MIRROR_DISPLAY_NO_ACTIVITY.isTrue()) { if (!display.mDisplay.canHostTasks()) { // Can't launch home on display that cannot host tasks. return false; } } return true; } Loading services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java +17 −0 Original line number Diff line number Diff line Loading @@ -1084,6 +1084,23 @@ public class RootWindowContainerTests extends WindowTestsBase { verify(mRootWindowContainer, never()).resolveSecondaryHomeActivity(anyInt(), any()); } /** * Tests that secondary home activity should not be resolved if display cannot host tasks. */ @Test public void testStartSecondaryHomeOnDisplayCannotHostTasks() { // Create secondary displays. final TestDisplayContent secondDisplay = new TestDisplayContent.Builder(mAtm, 1000, 1500).build(); spyOn(secondDisplay.mDisplay); doReturn(false).when(secondDisplay.mDisplay).canHostTasks(); mRootWindowContainer.startHomeOnDisplay(0 /* userId */, "testStartSecondaryHome", secondDisplay.mDisplayId, true /* allowInstrumenting */, true /* fromHomeKey */); verify(mRootWindowContainer, never()).resolveSecondaryHomeActivity(anyInt(), any()); } /** * Tests that when starting {@link ResolverActivity} for home, it should use the standard * activity type (in a new root task) so the order of back stack won't be broken. Loading Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +8 −0 Original line number Diff line number Diff line Loading @@ -1577,6 +1577,14 @@ class RootWindowContainer extends WindowContainer<DisplayContent> return false; } if (DesktopExperienceFlags.ENABLE_DISPLAY_CONTENT_MODE_MANAGEMENT.isTrue() && DesktopExperienceFlags.ENABLE_MIRROR_DISPLAY_NO_ACTIVITY.isTrue()) { if (!display.mDisplay.canHostTasks()) { // Can't launch home on display that cannot host tasks. return false; } } return true; } Loading
services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java +17 −0 Original line number Diff line number Diff line Loading @@ -1084,6 +1084,23 @@ public class RootWindowContainerTests extends WindowTestsBase { verify(mRootWindowContainer, never()).resolveSecondaryHomeActivity(anyInt(), any()); } /** * Tests that secondary home activity should not be resolved if display cannot host tasks. */ @Test public void testStartSecondaryHomeOnDisplayCannotHostTasks() { // Create secondary displays. final TestDisplayContent secondDisplay = new TestDisplayContent.Builder(mAtm, 1000, 1500).build(); spyOn(secondDisplay.mDisplay); doReturn(false).when(secondDisplay.mDisplay).canHostTasks(); mRootWindowContainer.startHomeOnDisplay(0 /* userId */, "testStartSecondaryHome", secondDisplay.mDisplayId, true /* allowInstrumenting */, true /* fromHomeKey */); verify(mRootWindowContainer, never()).resolveSecondaryHomeActivity(anyInt(), any()); } /** * Tests that when starting {@link ResolverActivity} for home, it should use the standard * activity type (in a new root task) so the order of back stack won't be broken. Loading