Merge "Attempt to fix NPE when reparent to the original task." into sc-dev
This commit is contained in:
@@ -1837,12 +1837,16 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
return autoRemoveRecents || (!hasChild() && !getHasBeenVisible());
|
return autoRemoveRecents || (!hasChild() && !getHasBeenVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Completely remove all activities associated with an existing task. */
|
private void clearPinnedTaskIfNeed() {
|
||||||
void performClearTask(String reason) {
|
|
||||||
// The original task is to be removed, try remove also the pinned task.
|
// The original task is to be removed, try remove also the pinned task.
|
||||||
if (mChildPipActivity != null && mChildPipActivity.getTask() != null) {
|
if (mChildPipActivity != null && mChildPipActivity.getTask() != null) {
|
||||||
mTaskSupervisor.removeRootTask(mChildPipActivity.getTask());
|
mTaskSupervisor.removeRootTask(mChildPipActivity.getTask());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Completely remove all activities associated with an existing task. */
|
||||||
|
void performClearTask(String reason) {
|
||||||
|
clearPinnedTaskIfNeed();
|
||||||
// Broken down into to cases to avoid object create due to capturing mStack.
|
// Broken down into to cases to avoid object create due to capturing mStack.
|
||||||
if (getRootTask() == null) {
|
if (getRootTask() == null) {
|
||||||
forAllActivities((r) -> {
|
forAllActivities((r) -> {
|
||||||
@@ -3220,7 +3224,7 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
mRemoving = true;
|
mRemoving = true;
|
||||||
|
|
||||||
EventLogTags.writeWmTaskRemoved(mTaskId, reason);
|
EventLogTags.writeWmTaskRemoved(mTaskId, reason);
|
||||||
|
clearPinnedTaskIfNeed();
|
||||||
// If applicable let the TaskOrganizer know the Task is vanishing.
|
// If applicable let the TaskOrganizer know the Task is vanishing.
|
||||||
setTaskOrganizer(null);
|
setTaskOrganizer(null);
|
||||||
|
|
||||||
@@ -5439,10 +5443,12 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
// force hidden flag.
|
// force hidden flag.
|
||||||
if (!isForceHidden()) {
|
if (!isForceHidden()) {
|
||||||
final Task lastParentBeforePip = topActivity.getLastParentBeforePip();
|
final Task lastParentBeforePip = topActivity.getLastParentBeforePip();
|
||||||
topActivity.reparent(lastParentBeforePip,
|
if (lastParentBeforePip.isAttached()) {
|
||||||
lastParentBeforePip.getChildCount() /* top */,
|
topActivity.reparent(lastParentBeforePip,
|
||||||
"movePinnedActivityToOriginalTask");
|
lastParentBeforePip.getChildCount() /* top */,
|
||||||
lastParentBeforePip.moveToFront("movePinnedActivityToOriginalTask");
|
"movePinnedActivityToOriginalTask");
|
||||||
|
lastParentBeforePip.moveToFront("movePinnedActivityToOriginalTask");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user