Merge "Return the correct root task when start activity from recents" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
83c1ab8a4b
@@ -1095,29 +1095,27 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
|||||||
return rootTask;
|
return rootTask;
|
||||||
}
|
}
|
||||||
} else if (candidateTask != null) {
|
} else if (candidateTask != null) {
|
||||||
final Task rootTask = candidateTask;
|
|
||||||
final int position = onTop ? POSITION_TOP : POSITION_BOTTOM;
|
final int position = onTop ? POSITION_TOP : POSITION_BOTTOM;
|
||||||
final Task launchRootTask = getLaunchRootTask(windowingMode, activityType, options,
|
final Task launchRootTask = getLaunchRootTask(windowingMode, activityType, options,
|
||||||
sourceTask, launchFlags);
|
sourceTask, launchFlags);
|
||||||
|
|
||||||
if (launchRootTask != null) {
|
if (launchRootTask != null) {
|
||||||
if (rootTask.getParent() == null) {
|
if (candidateTask.getParent() == null) {
|
||||||
launchRootTask.addChild(rootTask, position);
|
launchRootTask.addChild(candidateTask, position);
|
||||||
} else if (rootTask.getParent() != launchRootTask) {
|
} else if (candidateTask.getParent() != launchRootTask) {
|
||||||
rootTask.reparent(launchRootTask, position);
|
candidateTask.reparent(launchRootTask, position);
|
||||||
}
|
}
|
||||||
} else if (rootTask.getDisplayArea() != this || !rootTask.isRootTask()) {
|
} else if (candidateTask.getDisplayArea() != this || !candidateTask.isRootTask()) {
|
||||||
if (rootTask.getParent() == null) {
|
if (candidateTask.getParent() == null) {
|
||||||
addChild(rootTask, position);
|
addChild(candidateTask, position);
|
||||||
} else {
|
} else {
|
||||||
rootTask.reparent(this, onTop);
|
candidateTask.reparent(this, onTop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update windowing mode if necessary, e.g. moving a pinned task to fullscreen.
|
// Update windowing mode if necessary, e.g. moving a pinned task to fullscreen.
|
||||||
if (candidateTask.getWindowingMode() != windowingMode) {
|
if (candidateTask.getWindowingMode() != windowingMode) {
|
||||||
candidateTask.setWindowingMode(windowingMode);
|
candidateTask.setWindowingMode(windowingMode);
|
||||||
}
|
}
|
||||||
return rootTask;
|
return candidateTask.getRootTask();
|
||||||
}
|
}
|
||||||
return new Task.Builder(mAtmService)
|
return new Task.Builder(mAtmService)
|
||||||
.setWindowingMode(windowingMode)
|
.setWindowingMode(windowingMode)
|
||||||
|
|||||||
@@ -354,6 +354,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
throw new IllegalArgumentException("reparent: can't reparent to null " + this);
|
throw new IllegalArgumentException("reparent: can't reparent to null " + this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newParent == this) {
|
||||||
|
throw new IllegalArgumentException("Can not reparent to itself " + this);
|
||||||
|
}
|
||||||
|
|
||||||
final WindowContainer oldParent = mParent;
|
final WindowContainer oldParent = mParent;
|
||||||
if (mParent == newParent) {
|
if (mParent == newParent) {
|
||||||
throw new IllegalArgumentException("WC=" + this + " already child of " + mParent);
|
throw new IllegalArgumentException("WC=" + this + " already child of " + mParent);
|
||||||
|
|||||||
Reference in New Issue
Block a user