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

Commit ab57ff9b authored by Eric Lin's avatar Eric Lin Committed by Android (Google) Code Review
Browse files

Merge "Reset hidden state when reordering bubble task." into main

parents 215b9458 3761fe1c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ class BubbleControllerTest(flags: FlagsParameterization) {
                taskView,
                true, /* visible */
                true, /* reorder */
                false, /* toggleHiddenOnReorder */
                false, /* syncHiddenWithVisibilityOnReorder */
            )
        } else {
            verify(baseTransitions).setTaskViewVisible(taskView, true /* visible */)
+11 −5
Original line number Diff line number Diff line
@@ -473,7 +473,8 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV
    /** See {@link #setTaskViewVisible(TaskViewTaskController, boolean, boolean, boolean)}. */
    public void setTaskViewVisible(TaskViewTaskController taskView, boolean visible,
            boolean reorder) {
        setTaskViewVisible(taskView, visible, reorder, true /* toggleHiddenOnReorder */);
        setTaskViewVisible(taskView, visible, reorder,
                true /* syncHiddenWithVisibilityOnReorder */);
    }

    /**
@@ -484,13 +485,15 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV
     *                 be reordered as per the given {@code visible}. For {@code visible = true},
     *                 task will be reordered to top. For {@code visible = false}, task will be
     *                 reordered to the bottom
     * @param toggleHiddenOnReorder Whether to also toggle the hidden state of the task. This only
     *                              takes effect if {@code reorder} is {@code true}.
     * @param syncHiddenWithVisibilityOnReorder Whether to also synchronize the hidden state of
     *                                          the task with the target visibility when
     *                                          reordering. This only takes effect if {@code
     *                                          reorder} is {@code true}.
     * @throws IllegalStateException If the flag {@link FLAG_ENABLE_CREATE_ANY_BUBBLE} and
     *                               {@link FLAG_EXCLUDE_TASK_FROM_RECENTS} are not enabled.
     */
    public void setTaskViewVisible(TaskViewTaskController taskView, boolean visible,
            boolean reorder, boolean toggleHiddenOnReorder) {
            boolean reorder, boolean syncHiddenWithVisibilityOnReorder) {
        final TaskViewRepository.TaskViewState state = useRepo()
                ? mTaskViewRepo.byTaskView(taskView)
                : mTaskViews.get(taskView);
@@ -504,12 +507,15 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV

        final WindowContainerTransaction wct = new WindowContainerTransaction();
        wct.setBounds(taskView.getTaskInfo().token, state.mBounds);
        if (reorder && !toggleHiddenOnReorder) {
        if (reorder && !syncHiddenWithVisibilityOnReorder) {
            if (!BubbleAnythingFlagHelper.enableCreateAnyBubbleWithForceExcludedFromRecents()) {
                throw new IllegalStateException(
                    "Flag " + FLAG_ENABLE_CREATE_ANY_BUBBLE + " and "
                        + FLAG_EXCLUDE_TASK_FROM_RECENTS + " are not enabled");
            }
            // Reset hidden state to fix corner case where surface was destroyed before task
            // appeared in #prepareOpenAnimation.
            wct.setHidden(taskView.getTaskInfo().token, false /* hidden */);
            // Order of setAlwaysOnTop() and reorder() matters; hierarchy ops apply sequentially.
            wct.setAlwaysOnTop(taskView.getTaskInfo().token, visible /* alwaysOnTop */);
        } else {
+3 −2
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ public class TaskViewTransitionsTest extends ShellTestCase {
    }

    @Test
    public void testSetTaskVisibility_reorderNoToggleHidden_resetsAlwaysOnTopAndReorder() {
    public void testSetTaskVisibility_reorderNoHiddenVisibilitySync_resetsAlwaysOnTopAndReorder() {
        assumeTrue(Transitions.ENABLE_SHELL_TRANSITIONS);
        assumeTrue(TaskViewTransitions.useRepo());
        assumeTrue(BubbleAnythingFlagHelper.enableCreateAnyBubbleWithForceExcludedFromRecents());
@@ -297,7 +297,7 @@ public class TaskViewTransitionsTest extends ShellTestCase {
        when(mToken.asBinder()).thenReturn(mockBinder);

        mTaskViewTransitions.setTaskViewVisible(mTaskViewTaskController, false /* visible */,
                true /* reorder */, false /* toggleHiddenOnReorder */);
                true /* reorder */, false /* syncHiddenWithVisibilityOnReorder */);

        final TaskViewTransitions.PendingTransition pending =
                mTaskViewTransitions.findPending(mTaskViewTaskController, TRANSIT_TO_BACK);
@@ -306,6 +306,7 @@ public class TaskViewTransitionsTest extends ShellTestCase {
        assertThat(chgs.keySet()).containsExactly(mockBinder);
        assertThat(chgs.get(mockBinder).getConfiguration().windowConfiguration.getBounds())
                .isEqualTo(bounds);
        assertThat(chgs.get(mockBinder).getHidden()).isFalse();
        final List<WindowContainerTransaction.HierarchyOp> ops = pending.mWct.getHierarchyOps();
        assertThat(ops).hasSize(2);
        assertThat(ops.get(0).isAlwaysOnTop()).isFalse();