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
This commit is contained in:
Louis Chang
2020-04-27 15:51:42 +08:00
parent cf9ab7aa3a
commit edbda50a0e
2 changed files with 9 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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