Merge "Do not reposition leaf tasks from grandparent tasks" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b842240bae
@@ -928,12 +928,9 @@ class ActivityStack extends Task {
|
|||||||
mCurrentUser = userId;
|
mCurrentUser = userId;
|
||||||
|
|
||||||
super.switchUser(userId);
|
super.switchUser(userId);
|
||||||
forAllLeafTasks((t) -> {
|
if (isLeafTask() && showToCurrentUser()) {
|
||||||
if (t.showToCurrentUser() && t != this) {
|
getParent().positionChildAt(POSITION_TOP, this, false /*includeParents*/);
|
||||||
mChildren.remove(t);
|
}
|
||||||
mChildren.add(t);
|
|
||||||
}
|
|
||||||
}, true /* traverseTopToBottom */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void minimalResumeActivityLocked(ActivityRecord r) {
|
void minimalResumeActivityLocked(ActivityRecord r) {
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Reparenting leaf Tasks is not supported now.");
|
throw new RuntimeException("Reparenting leaf Tasks is not supported now. " + task);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ugh, of course ActivityStack has its own special reorder logic...
|
// Ugh, of course ActivityStack has its own special reorder logic...
|
||||||
|
|||||||
@@ -186,4 +186,19 @@ public class TaskTests extends WindowTestsBase {
|
|||||||
assertTrue(r.finishing);
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user