From ea3d3fdefd7a89f2e93ec692298660ce63aff4b2 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Mon, 1 May 2017 07:41:08 -0700 Subject: 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 --- services/core/java/com/android/server/am/ActivityRecord.java | 3 +++ services/core/java/com/android/server/am/TaskRecord.java | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 158175f4b0d9..7bd8b0b3209a 100644 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -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, diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java index 056fec526502..2b4cb8dbefd8 100644 --- a/services/core/java/com/android/server/am/TaskRecord.java +++ b/services/core/java/com/android/server/am/TaskRecord.java @@ -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(); } } } -- cgit v1.2.3-59-g8ed1b