[ActivityManager] fix NPE in ActivityStack.resetTargetTaskIfNeededLocked.
Symptom: in .ActivityStack.resetTargetTaskIfNeededLocked, "allowTaskReparenting" if case will call setTask to remove activities from task, that will caused numActivities in main for-loop not consist with task.mActivities size. caused NPE will happend in finish activities for-loop due to get null object from activities when clearWhenTaskReset" as true case. Root Cause: when clearWhenTaskReset as true, will set "end" variable as numActivities -1, but if calling setTask to remove activities from task, end value will out of date & not same with task.mActivities size. Solution: use activities.size() - 1 to assign end value. Change-Id: I5d7fe22e1df2fc61738db23402e7c42cf6d8c4cc
This commit is contained in:
@@ -2269,7 +2269,7 @@ final class ActivityStack {
|
||||
// In this case, we want to finish this activity
|
||||
// and everything above it, so be sneaky and pretend
|
||||
// like these are all in the reply chain.
|
||||
end = numActivities - 1;
|
||||
end = activities.size() - 1;
|
||||
} else if (replyChainEnd < 0) {
|
||||
end = i;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user