Wait for the death of precede instance of the launching process

...from a context without global AM lock held.

Previous CL was waiting for it with global AM lock held, which
would result sluggish of the system. Now moving the waiting prior
to start the new instance of the process.

In the case of precedence hasn't died yet, don't reuse the old
instance of ContentProviderRecord, otherwise when we clean up
the old ProcessRecord, the client of new ContentProvider instance
could get killed unexpectedly.

Bug: 141857656
Test: Manual (See the bug comment #49 for the procedure)
Change-Id: I957e2f443b3f9688ca449cfccc68aba22aff7f05
3 files changed