Set correct stack before restoring tasks
When restoring a task when starting it from recents, we need to set all the relevant state for the transition before we actually restore the task and attach the docked stack, as all kinds of weird things might go wrong otherwise. Bug: 28194162 Bug: 27607141 Change-Id: I21d173a43c62d425e507e8cc3a1a576f95cfe048
This commit is contained in:
@@ -4356,18 +4356,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
? new ActivityOptions(bOptions) : null;
|
? new ActivityOptions(bOptions) : null;
|
||||||
final int launchStackId = (activityOptions != null)
|
final int launchStackId = (activityOptions != null)
|
||||||
? activityOptions.getLaunchStackId() : INVALID_STACK_ID;
|
? activityOptions.getLaunchStackId() : INVALID_STACK_ID;
|
||||||
|
|
||||||
if (launchStackId == HOME_STACK_ID) {
|
if (launchStackId == HOME_STACK_ID) {
|
||||||
throw new IllegalArgumentException("startActivityFromRecentsInner: Task "
|
throw new IllegalArgumentException("startActivityFromRecentsInner: Task "
|
||||||
+ taskId + " can't be launch in the home stack.");
|
+ taskId + " can't be launch in the home stack.");
|
||||||
}
|
}
|
||||||
task = anyTaskForIdLocked(taskId, RESTORE_FROM_RECENTS, launchStackId);
|
|
||||||
if (task == null) {
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"startActivityFromRecentsInner: Task " + taskId + " not found.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (launchStackId != INVALID_STACK_ID) {
|
|
||||||
if (launchStackId == DOCKED_STACK_ID) {
|
if (launchStackId == DOCKED_STACK_ID) {
|
||||||
mWindowManager.setDockedStackCreateState(
|
mWindowManager.setDockedStackCreateState(
|
||||||
activityOptions.getDockCreateMode(), null /* initialBounds */);
|
activityOptions.getDockCreateMode(), null /* initialBounds */);
|
||||||
@@ -4378,6 +4371,16 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
deferUpdateBounds(HOME_STACK_ID);
|
deferUpdateBounds(HOME_STACK_ID);
|
||||||
mWindowManager.prepareAppTransition(TRANSIT_DOCK_TASK_FROM_RECENTS, false);
|
mWindowManager.prepareAppTransition(TRANSIT_DOCK_TASK_FROM_RECENTS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task = anyTaskForIdLocked(taskId, RESTORE_FROM_RECENTS, launchStackId);
|
||||||
|
if (task == null) {
|
||||||
|
continueUpdateBounds(HOME_STACK_ID);
|
||||||
|
mWindowManager.executeAppTransition();
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"startActivityFromRecentsInner: Task " + taskId + " not found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (launchStackId != INVALID_STACK_ID) {
|
||||||
if (task.stack.mStackId != launchStackId) {
|
if (task.stack.mStackId != launchStackId) {
|
||||||
moveTaskToStackLocked(
|
moveTaskToStackLocked(
|
||||||
taskId, launchStackId, ON_TOP, FORCE_FOCUS, "startActivityFromRecents",
|
taskId, launchStackId, ON_TOP, FORCE_FOCUS, "startActivityFromRecents",
|
||||||
|
|||||||
Reference in New Issue
Block a user