Merge "Allow non-leaf task to be moved to top" into rvc-dev

This commit is contained in:
Louis Chang
2020-04-28 07:46:16 +00:00
committed by Android (Google) Code Review
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