Split attachApplication to more accurately identify app startup

Previously, while handling the attachApplication from an app at
startup, the system started the broadcast (and service) AnR timeout
countdown as soon as it sent async bindApplication request to the app.

This increased the likelyhood of AnRs under CPU contention since some
fixed process initialization costs were included in the broadcast handling
delay.

Now, we split the the attachApplication into 2 phases, there's now a new
finishAttachApplication which apps call right before they start executing any
custom code. This new call unblocks any pending broadcast/service scheduling
and starts the appropriate AnR timeout countdowns.

Test: atest AsyncProcessStartTest
Bug: 253908737
Change-Id: I61046201281acf6686290d0ab83174ab134d5ef2
6 files changed