diff options
| author | 2015-10-20 16:34:05 +0800 | |
|---|---|---|
| committer | 2015-10-20 16:34:05 +0800 | |
| commit | 9caeef72ee19caab9193eb76fc82ff99f7c9534e (patch) | |
| tree | f744f9d596a068828ed80c784199145ce1f733bd | |
| parent | 59d548e1e54fa753d3776647b98dc34ea7c27685 (diff) | |
Ensure state transition of paused activity.
If there are 2 activties launched during screen off.
Both of them will be scheduled to pause immediately.
But if the first one does not complete pause in time,
and the second one is a non-fullscreen activity, the
first one will still be visible and no need to stop.
After the second one complete pause, mPausingActivity
is cleared, then the first one's complete pause is failed
and keep state at pausing. If it calls finish, it cannot
be destroyed because its state is pausing so expect it will
be paused later, but actually is has complete paused.
Sample and video:
https://code.google.com/p/android/issues/detail?id=190955
Solution:
A failed-to-pause activity should still change state to paused
if it is pausing. Then when the first activity calls finish,
it will satisfy the condition in ActivityStack.finishActivityLocked
"r.state != ActivityState.PAUSING" to continue the finish flow.
Change-Id: I2f211ddf5039b332b0c7d01ccd043aa18fe168f7
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityStack.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 6e348766bfdb..a47e7c622891 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -941,10 +941,13 @@ final class ActivityStack { r.userId, System.identityHashCode(r), r.shortComponentName, mPausingActivity != null ? mPausingActivity.shortComponentName : "(none)"); - if (r.finishing && r.state == ActivityState.PAUSING) { - if (DEBUG_PAUSE) Slog.v(TAG, - "Executing finish of failed to pause activity: " + r); - finishCurrentActivityLocked(r, FINISH_AFTER_VISIBLE, false); + if (r.state == ActivityState.PAUSING) { + r.state = ActivityState.PAUSED; + if (r.finishing) { + if (DEBUG_PAUSE) Slog.v(TAG, + "Executing finish of failed to pause activity: " + r); + finishCurrentActivityLocked(r, FINISH_AFTER_VISIBLE, false); + } } } } |