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

Commit d65119ec authored by Jerry Chang's avatar Jerry Chang
Browse files

Fix timeout when dismissing split screen to two pane mode

After I1a0c4d17, the expanding task will first be resized to fullscreen
then reparent to TDA after the divider bar fling animation finished. If
the expanding app is expanding to two pane mode, the resuming of the
second activity might be skpped due to the task in another side of the
split is already empty and invisible.

Update the drag-to-dismiss flow to reorder the expanding task on the top
of dismissing task. So the content in the dismissing side won't flicker
during the dismissing transition and the activity resume won't be
skipped in the expanding side.

Fix: 243368173
Test: atest WMShellFlickerTests
Test: atest WMShellUnitTests
Test: put Settings and Chrome in split screen,
      drag divider bar to dismiss Chrome,
      verified the expanding transition won't timeout
Change-Id: Id16c1d9b4849d5f600de9524ffebb91aba73a721
parent 76395aec
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -45,11 +45,6 @@ class MainStage extends StageTaskListener {
                iconProvider);
    }

    @Override
    void dismiss(WindowContainerTransaction wct, boolean toTop) {
        deactivate(wct, toTop);
    }

    boolean isActive() {
        return mIsActive;
    }
+0 −5
Original line number Diff line number Diff line
@@ -42,11 +42,6 @@ class SideStage extends StageTaskListener {
                iconProvider);
    }

    @Override
    void dismiss(WindowContainerTransaction wct, boolean toTop) {
        removeAllTasks(wct, toTop);
    }

    boolean removeAllTasks(WindowContainerTransaction wct, boolean toTop) {
        if (mChildrenTaskInfo.size() == 0) return false;
        wct.reparentTasks(
+5 −7
Original line number Diff line number Diff line
@@ -901,13 +901,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            // Expand to top side split as full screen for fading out decor animation and dismiss
            // another side split(Moving its children to bottom).
            mIsExiting = true;
            final StageTaskListener tempFullStage = childrenToTop;
            final StageTaskListener dismissStage = mMainStage == childrenToTop
                    ? mSideStage : mMainStage;
            tempFullStage.resetBounds(wct);
            wct.setSmallestScreenWidthDp(tempFullStage.mRootTaskInfo.token,
            childrenToTop.resetBounds(wct);
            wct.reorder(childrenToTop.mRootTaskInfo.token, true);
            wct.setSmallestScreenWidthDp(childrenToTop.mRootTaskInfo.token,
                    SMALLEST_SCREEN_WIDTH_DP_UNDEFINED);
            dismissStage.dismiss(wct, false /* toTop */);
        }
        mSyncQueue.queue(wct);
        mSyncQueue.runInSync(t -> {
@@ -924,7 +921,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                childrenToTop.fadeOutDecor(() -> {
                    WindowContainerTransaction finishedWCT = new WindowContainerTransaction();
                    mIsExiting = false;
                    childrenToTop.dismiss(finishedWCT, true /* toTop */);
                    mMainStage.deactivate(finishedWCT, childrenToTop == mMainStage /* toTop */);
                    mSideStage.removeAllTasks(finishedWCT, childrenToTop == mSideStage /* toTop */);
                    finishedWCT.reorder(mRootTaskInfo.token, false /* toTop */);
                    finishedWCT.setForceTranslucent(mRootTaskInfo.token, true);
                    finishedWCT.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1);
+0 −5
Original line number Diff line number Diff line
@@ -106,11 +106,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
        taskOrganizer.createRootTask(displayId, WINDOWING_MODE_MULTI_WINDOW, this);
    }

    /**
     * General function for dismiss this stage.
     */
    void dismiss(WindowContainerTransaction wct, boolean toTop) {}

    int getChildCount() {
        return mChildrenTaskInfo.size();
    }
+0 −2
Original line number Diff line number Diff line
@@ -227,7 +227,6 @@ public class StageCoordinatorTests extends ShellTestCase {
        mStageCoordinator.exitSplitScreen(testTaskId, EXIT_REASON_RETURN_HOME);
        verify(mMainStage).reorderChild(eq(testTaskId), eq(true),
                any(WindowContainerTransaction.class));
        verify(mSideStage).dismiss(any(WindowContainerTransaction.class), eq(false));
        verify(mMainStage).resetBounds(any(WindowContainerTransaction.class));
    }

@@ -241,7 +240,6 @@ public class StageCoordinatorTests extends ShellTestCase {
        verify(mSideStage).reorderChild(eq(testTaskId), eq(true),
                any(WindowContainerTransaction.class));
        verify(mSideStage).resetBounds(any(WindowContainerTransaction.class));
        verify(mMainStage).dismiss(any(WindowContainerTransaction.class), eq(false));
    }

    @Test