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

Commit 00e4d91d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Do not reposition leaf tasks from grandparent tasks" into rvc-qpr-dev am: b842240b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12208321

Change-Id: Iae5021aa8041386c88218e0f155a13ba2ba7b2d4
parents 05c29c86 b842240b
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -928,12 +928,9 @@ class ActivityStack extends Task {
        mCurrentUser = userId;

        super.switchUser(userId);
        forAllLeafTasks((t) -> {
            if (t.showToCurrentUser() && t != this) {
                mChildren.remove(t);
                mChildren.add(t);
        if (isLeafTask() && showToCurrentUser()) {
            getParent().positionChildAt(POSITION_TOP, this, false /*includeParents*/);
        }
        }, true /* traverseTopToBottom */);
    }

    void minimalResumeActivityLocked(ActivityRecord r) {
+1 −1
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                    }
                }
            } else {
                throw new RuntimeException("Reparenting leaf Tasks is not supported now.");
                throw new RuntimeException("Reparenting leaf Tasks is not supported now. " + task);
            }
        } else {
            // Ugh, of course ActivityStack has its own special reorder logic...
+15 −0
Original line number Diff line number Diff line
@@ -186,4 +186,19 @@ public class TaskTests extends WindowTestsBase {
            assertTrue(r.finishing);
        });
    }

    @Test
    public void testSwitchUser() {
        final Task rootTask = createTaskStackOnDisplay(mDisplayContent);
        final Task childTask = createTaskInStack((ActivityStack) rootTask, 0 /* userId */);
        final Task leafTask1 = createTaskInStack((ActivityStack) childTask, 10 /* userId */);
        final Task leafTask2 = createTaskInStack((ActivityStack) childTask, 0 /* userId */);
        assertEquals(1, rootTask.getChildCount());
        assertEquals(leafTask2, childTask.getTopChild());

        doReturn(true).when(leafTask1).showToCurrentUser();
        rootTask.switchUser(10);
        assertEquals(1, rootTask.getChildCount());
        assertEquals(leafTask1, childTask.getTopChild());
    }
}