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:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user