[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
This commit is contained in:
4
services/java/com/android/server/am/ActivityStack.java
Executable file → Normal file
4
services/java/com/android/server/am/ActivityStack.java
Executable file → Normal file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user