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

Commit edbda50a authored by Louis Chang's avatar Louis Chang
Browse files

Allow non-leaf task to be moved to top

Non-leaf task was not able to moved to top because the task
was created from another user. Therefore, home task didn't
moved to top when entering split-screen on secondary user.

Check if the topmost task is current profile instead.

Bug: 154237928
Test: atest TaskStackTests
Change-Id: Iffa80d0bbadd3a54dcae3da6282aeafa094b0819
parent cf9ab7aa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3112,7 +3112,8 @@ class Task extends WindowContainer<WindowContainer> {

    @Override
    boolean showToCurrentUser() {
        return mForceShowForAllUsers || showForAllUsers() || mWmService.isCurrentProfile(mUserId);
        return mForceShowForAllUsers || showForAllUsers()
                || mWmService.isCurrentProfile(getTopMostTask().mUserId);
    }

    void setForceShowForAllUsers(boolean forceShowForAllUsers) {
+7 −0
Original line number Diff line number Diff line
@@ -72,6 +72,13 @@ public class TaskStackTests extends WindowTestsBase {
        stack.positionChildAt(WindowContainer.POSITION_TOP, task2, false /* includingParents */);
        assertEquals(stack.mChildren.get(0), task2);
        assertEquals(stack.mChildren.get(1), task1);

        // Non-leaf task should be moved to top regardless of the user id.
        createTaskInStack((ActivityStack) task2, 0 /* userId */);
        createTaskInStack((ActivityStack) task2, 1 /* userId */);
        stack.positionChildAt(WindowContainer.POSITION_TOP, task2, false /* includingParents */);
        assertEquals(stack.mChildren.get(0), task1);
        assertEquals(stack.mChildren.get(1), task2);
    }

    @Test