Merge "Clear launch root tasks when WM shell is killed" into sc-dev
This commit is contained in:
@@ -5058,6 +5058,10 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
}
|
||||
} else {
|
||||
// No longer managed by any organizer.
|
||||
final TaskDisplayArea taskDisplayArea = getDisplayArea();
|
||||
if (taskDisplayArea != null) {
|
||||
taskDisplayArea.removeLaunchRootTask(this);
|
||||
}
|
||||
setForceHidden(FLAG_FORCE_HIDDEN_FOR_TASK_ORG, false /* set */);
|
||||
if (mCreatedByOrganizer) {
|
||||
removeImmediately("setTaskOrganizer");
|
||||
|
||||
@@ -1135,12 +1135,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
||||
"Can't set not mCreatedByOrganizer as launch root tr=" + rootTask);
|
||||
}
|
||||
|
||||
LaunchRootTaskDef def = null;
|
||||
for (int i = mLaunchRootTasks.size() - 1; i >= 0; --i) {
|
||||
if (mLaunchRootTasks.get(i).task.mTaskId != rootTask.mTaskId) continue;
|
||||
def = mLaunchRootTasks.get(i);
|
||||
}
|
||||
|
||||
LaunchRootTaskDef def = getLaunchRootTaskDef(rootTask);
|
||||
if (def != null) {
|
||||
// Remove so we add to the end of the list.
|
||||
mLaunchRootTasks.remove(def);
|
||||
@@ -1156,6 +1151,23 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
||||
}
|
||||
}
|
||||
|
||||
void removeLaunchRootTask(Task rootTask) {
|
||||
LaunchRootTaskDef def = getLaunchRootTaskDef(rootTask);
|
||||
if (def != null) {
|
||||
mLaunchRootTasks.remove(def);
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable LaunchRootTaskDef getLaunchRootTaskDef(Task rootTask) {
|
||||
LaunchRootTaskDef def = null;
|
||||
for (int i = mLaunchRootTasks.size() - 1; i >= 0; --i) {
|
||||
if (mLaunchRootTasks.get(i).task.mTaskId != rootTask.mTaskId) continue;
|
||||
def = mLaunchRootTasks.get(i);
|
||||
break;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
Task getLaunchRootTask(int windowingMode, int activityType, ActivityOptions options) {
|
||||
// Try to use the launch root task in options if available.
|
||||
if (options != null) {
|
||||
|
||||
Reference in New Issue
Block a user