Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +0 −5 Original line number Diff line number Diff line Loading @@ -822,11 +822,6 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen // Checks if container should be updated before apply new parentInfo. final boolean shouldUpdateContainer = taskContainer.shouldUpdateContainer(parentInfo); taskContainer.updateTaskFragmentParentInfo(parentInfo); if (!taskContainer.isVisible()) { // Don't update containers if the task is not visible. We only update containers when // parentInfo#isVisibleRequested is true. return; } // If the last direct activity of the host task is dismissed and the overlay container is // the only taskFragment, the overlay container should also be dismissed. Loading libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/OverlayPresentationTest.java +27 −1 Original line number Diff line number Diff line Loading @@ -475,8 +475,10 @@ public class OverlayPresentationTest { @Test public void testOnTaskFragmentParentInfoChanged_positionOnlyChange_earlyReturn() { final TaskFragmentContainer overlayContainer = createTestOverlayContainer(TASK_ID, "test"); final TaskContainer taskContainer = overlayContainer.getTaskContainer(); assertThat(taskContainer.getOverlayContainer()).isEqualTo(overlayContainer); spyOn(taskContainer); final TaskContainer.TaskProperties taskProperties = taskContainer.getTaskProperties(); final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo( Loading @@ -495,6 +497,30 @@ public class OverlayPresentationTest { .that(taskContainer.getOverlayContainer()).isNull(); } @Test public void testOnTaskFragmentParentInfoChanged_invisibleTask_callDismissOverlayContainer() { final TaskFragmentContainer overlayContainer = createTestOverlayContainer(TASK_ID, "test"); final TaskContainer taskContainer = overlayContainer.getTaskContainer(); assertThat(taskContainer.getOverlayContainer()).isEqualTo(overlayContainer); spyOn(taskContainer); final TaskContainer.TaskProperties taskProperties = taskContainer.getTaskProperties(); final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo( new Configuration(taskProperties.getConfiguration()), taskProperties.getDisplayId(), false /* visible */, false /* hasDirectActivity */, null /* decorSurface */); mSplitController.onTaskFragmentParentInfoChanged(mTransaction, TASK_ID, parentInfo); // The parent info must be applied to the task container verify(taskContainer).updateTaskFragmentParentInfo(parentInfo); verify(mSplitController, never()).updateContainer(any(), any()); assertWithMessage("The overlay container must still be dismissed even if " + "#updateContainer is not called") .that(taskContainer.getOverlayContainer()).isNull(); } /** * A simplified version of {@link SplitController.ActivityStartMonitor * #createOrUpdateOverlayTaskFragmentIfNeeded} Loading Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +0 −5 Original line number Diff line number Diff line Loading @@ -822,11 +822,6 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen // Checks if container should be updated before apply new parentInfo. final boolean shouldUpdateContainer = taskContainer.shouldUpdateContainer(parentInfo); taskContainer.updateTaskFragmentParentInfo(parentInfo); if (!taskContainer.isVisible()) { // Don't update containers if the task is not visible. We only update containers when // parentInfo#isVisibleRequested is true. return; } // If the last direct activity of the host task is dismissed and the overlay container is // the only taskFragment, the overlay container should also be dismissed. Loading
libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/OverlayPresentationTest.java +27 −1 Original line number Diff line number Diff line Loading @@ -475,8 +475,10 @@ public class OverlayPresentationTest { @Test public void testOnTaskFragmentParentInfoChanged_positionOnlyChange_earlyReturn() { final TaskFragmentContainer overlayContainer = createTestOverlayContainer(TASK_ID, "test"); final TaskContainer taskContainer = overlayContainer.getTaskContainer(); assertThat(taskContainer.getOverlayContainer()).isEqualTo(overlayContainer); spyOn(taskContainer); final TaskContainer.TaskProperties taskProperties = taskContainer.getTaskProperties(); final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo( Loading @@ -495,6 +497,30 @@ public class OverlayPresentationTest { .that(taskContainer.getOverlayContainer()).isNull(); } @Test public void testOnTaskFragmentParentInfoChanged_invisibleTask_callDismissOverlayContainer() { final TaskFragmentContainer overlayContainer = createTestOverlayContainer(TASK_ID, "test"); final TaskContainer taskContainer = overlayContainer.getTaskContainer(); assertThat(taskContainer.getOverlayContainer()).isEqualTo(overlayContainer); spyOn(taskContainer); final TaskContainer.TaskProperties taskProperties = taskContainer.getTaskProperties(); final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo( new Configuration(taskProperties.getConfiguration()), taskProperties.getDisplayId(), false /* visible */, false /* hasDirectActivity */, null /* decorSurface */); mSplitController.onTaskFragmentParentInfoChanged(mTransaction, TASK_ID, parentInfo); // The parent info must be applied to the task container verify(taskContainer).updateTaskFragmentParentInfo(parentInfo); verify(mSplitController, never()).updateContainer(any(), any()); assertWithMessage("The overlay container must still be dismissed even if " + "#updateContainer is not called") .that(taskContainer.getOverlayContainer()).isNull(); } /** * A simplified version of {@link SplitController.ActivityStartMonitor * #createOrUpdateOverlayTaskFragmentIfNeeded} Loading