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

Commit 7e09b8f9 authored by Lingyu Feng's avatar Lingyu Feng Committed by Android (Google) Code Review
Browse files

Merge "Check parent TDA in TaskDisplayArea#shouldKeepNoTask()" into main

parents 0ce492eb d5f6e7bd
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1627,7 +1627,14 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
    }

    boolean shouldKeepNoTask() {
        return mShouldKeepNoTask;
        if (mShouldKeepNoTask) {
            return true;
        }

        // A TaskDisplayArea can have another child TaskDisplayArea, so we should check all it's
        // parent TaskDisplayArea.
        return getParent() != null && getParent().asTaskDisplayArea() != null
                && getParent().asTaskDisplayArea().shouldKeepNoTask();
    }

    @Override
+12 −0
Original line number Diff line number Diff line
@@ -586,6 +586,18 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
        assertTrue(defaultTaskDisplayArea.mChildren.contains(task));
    }

    @Test
    public void testPrepareForRemoval_childTaskDisplayAreaShouldKeepNoTask() {
        final TaskDisplayArea parentTDA = mDefaultDisplay.getDefaultTaskDisplayArea();
        final TaskDisplayArea childTDA = new TaskDisplayArea(mWm, "childTDA",
                FEATURE_VENDOR_FIRST, false /* createdByOrganizer */, true /* canHostHomeTask */);
        parentTDA.addChild(childTDA, POSITION_TOP);
        parentTDA.prepareForRemoval();

        assertTrue(parentTDA.shouldKeepNoTask());
        assertTrue(childTDA.shouldKeepNoTask());
    }

    private void assertGetOrCreateRootTask(int windowingMode, int activityType, Task candidateTask,
            boolean reuseCandidate) {
        final TaskDisplayArea taskDisplayArea = candidateTask.getDisplayArea();