[ActivityManager] Fix index OOB when resetting removed task

Assume task T has an activity X lives in process P.
When P is died and before death recipient being called,
start activity with flag RESET_TASK_IF_NEEDED to bring the
existed task T.

Then scheduleResumeActivity IPC will fail and trigger start
a new process that removes task T.

That results resetTaskIfNeededLocked cannot find the task
when continuing the start flow.

Detail:
https://code.google.com/p/android/issues/detail?id=159558

Change-Id: Icc400c7a6c481a3f78657e9fb83cf0c3a17dde68
1 file changed