Don't relaunch activity in TaskRecord.size if caller deferResume

If the caller of TaskRecord.resize() requested resume to be deferred,
then we also don't want to ensure configuration on the top activity in
the task as that can lead to a re-launch. In this case the caller will
handle things.

Test: manual
Change-Id: I247c4409d4bd19c8ae801e1720aa415d55395201
Fixes: 37767027
This commit is contained in:
Wale Ogunwale
2017-05-01 07:41:08 -07:00
parent 030107f0bd
commit ea3d3fdefd
2 changed files with 7 additions and 8 deletions

View File

@@ -2328,6 +2328,9 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
return true;
}
// TODO: We should add ActivityRecord.shouldBeVisible() that checks if the activity should
// be visible based on the stack, task, and lockscreen state and use that here instead. The
// method should be based on the logic in ActivityStack.ensureActivitiesVisibleLocked().
// Skip updating configuration for activity is a stack that shouldn't be visible.
if (stack.shouldBeVisible(null /* starting */) == STACK_INVISIBLE) {
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,

View File

@@ -550,15 +550,11 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
boolean kept = true;
if (updatedConfig) {
final ActivityRecord r = topRunningActivityLocked();
if (r != null) {
if (r != null && !deferResume) {
kept = r.ensureActivityConfigurationLocked(0 /* globalChanges */, preserveWindow);
if (!deferResume) {
// All other activities must be made visible with their correct configuration.
mService.mStackSupervisor.ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS);
if (!kept) {
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
}
mService.mStackSupervisor.ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS);
if (!kept) {
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
}
}
}