diff options
author | Wale Ogunwale <ogunwale@google.com> | 2015-07-12 15:14:01 -0700 |
---|---|---|
committer | Wale Ogunwale <ogunwale@google.com> | 2015-07-12 15:14:01 -0700 |
commit | 3f529ee7fa913531331310e00c4cc4dc471f5d1d (patch) | |
tree | b3abc68a1b9fe711642a2ca035e9363abb1a3282 /services | |
parent | 12bb956828d2df983baa0dad2523ab19b1a4577b (diff) | |
download | frameworks_base-3f529ee7fa913531331310e00c4cc4dc471f5d1d.zip frameworks_base-3f529ee7fa913531331310e00c4cc4dc471f5d1d.tar.gz frameworks_base-3f529ee7fa913531331310e00c4cc4dc471f5d1d.tar.bz2 |
Finish already paused activity if it should be finished after pausing
If the app requests its activity to be finished allow it to be finished
immediately if the activity is already paused.
Also, don't schedule stop for an activity that was already finished in
ActivityStack.stopActivityLocked().
Bug: 22170595
Bug: 22397812
Change-Id: If349f7d3070a1fd2c0688fda7381b42f625ed9e4
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/am/ActivityStack.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 8c3a950..470bbb0 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -2669,8 +2669,13 @@ final class ActivityStack { if (!r.finishing) { if (!mService.isSleeping()) { if (DEBUG_STATES) Slog.d(TAG_STATES, "no-history finish of " + r); - requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, null, - "stop-no-history", false); + if (requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, null, + "stop-no-history", false)) { + // Activity was finished, no need to continue trying to schedule stop. + adjustFocusedActivityLocked(r, "stopActivityFinished"); + r.resumeKeyDispatchingLocked(); + return; + } } else { if (DEBUG_STATES) Slog.d(TAG_STATES, "Not finishing noHistory " + r + " on stop because we're just sleeping"); @@ -2963,6 +2968,7 @@ final class ActivityStack { r.state = ActivityState.FINISHING; if (mode == FINISH_IMMEDIATELY + || (mode == FINISH_AFTER_PAUSE && prevState == ActivityState.PAUSED) || prevState == ActivityState.STOPPED || prevState == ActivityState.INITIALIZING) { // If this activity is already stopped, we can just finish |