[ActivityManager] Examine bad process before clean up application
record

Symptom:
Unable to launch activity

Root cause:
There are some cases that would start process while pid
assigned or already running. So the previous application
record will be clean up via handleAppDiedLocked(), but it
won't be removed from ActivityManager.mProcessNames since
the process is supposed to be restart later.

However, if the process is started from a background
operation and has named as a bad process, it silently fail
the launch. Then, the process won't ever be request to
start afterward. The process status is app.pid > 0 and
app.thread is null.

The application components are unable to launch since then.

Solution:
Examine bad process before clean up application record

Change-Id: I53dc06e49254094abc06e460c8b8b33f36803601
1 file changed