diff options
author | riddle_hsu <riddle_hsu@htc.com> | 2014-07-31 00:26:51 +0800 |
---|---|---|
committer | riddle_hsu <riddle_hsu@htc.com> | 2014-07-31 00:26:51 +0800 |
commit | 1df4d9f8c772bb77a13205b81091771ea8ba4fbc (patch) | |
tree | 867f135375cb067acc4530d354da1374eab2b6cb | |
parent | 8224edb94f6421a2d910362c56940dcf991847e6 (diff) | |
download | base-1df4d9f8c772bb77a13205b81091771ea8ba4fbc.tar.gz |
[ActivityManager] Avoid mistaking visibility by finishing task.
Sympton:
Next activity only adds to history but does not launch/resume then results ANR.
Root Cause:
In a rare timing, some windows are switched at the same time,
it will cause some finishing records on the top temporarily,
then set startIt to false that skip to resume the real top activty.
Solution:
If all activities in a task are finishing, do not use it to check.
The behavior/checking is the same concept as in JellyBean:
// If starting in an existing task, find where that is...
boolean startIt = true;
for (int i = NH-1; i >= 0; i--) {
ActivityRecord p = mHistory.get(i);
if (p.finishing) { // <--
continue;
}
Change-Id: I9d81a7b5182400c52e173da23eee61c74692beee
-rw-r--r--[-rwxr-xr-x] | services/java/com/android/server/am/ActivityStack.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 75d32e3b74bb..c151cc8a9ee2 100755..100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -1705,6 +1705,10 @@ final class ActivityStack { boolean startIt = true; for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) { task = mTaskHistory.get(taskNdx); + if (task.getTopActivity() == null) { + // All activities in task are finishing. + continue; + } if (task == r.task) { // Here it is! Now, if this is not yet visible to the // user, then just add it without starting; it will |