Use isLeafTask() to check whether to save state.

We meant to save states for all leaf tasks, including one layer task,
which is excluded by the condition checked before.

Bug: 152318088
Test: Smoke tests.
Change-Id: Iadd8aa60ffe254398d242a12dae39148314891c8
This commit is contained in:
Garfield Tan
2020-03-24 10:32:29 -07:00
parent a7c9f7cb4c
commit 59a60fa81a

View File

@@ -610,11 +610,7 @@ class Task extends WindowContainer<WindowContainer> {
return;
}
// TODO(xutan): Removed type check after stack and task is merged.
// Before the real merge of stack and task, we need to avoid saving state of stacks. Once
// the merge is finished we can just pass DisplayContent because both windowing mode and
// bounds are set in the merged task.
if (oldParent instanceof ActivityStack) {
if (isLeafTask()) {
// This task is going away, so save the last state if necessary.
saveLaunchingStateIfNeeded(((WindowContainer) oldParent).getDisplayContent());
}