If the ServiceRecord already has a ProcessRecord attached
in startServiceLocked(), whitelist the process at that point
(previously we'd just set the valiable to true, and not add
the token)

If the process was already attached, realStartServiceLocked()
wouldn't run.

Also, don't remove bg actvity starts token as soon as the service
is stopped in stopServiceLocked() - instead only remove the token
in the timeout callback.

Bug: 131240614
Bug: 130810805
Test: manual (for the quoted bugs)
Change-Id: I0e704e7b6e8cbafb026c90533fbe4a193a47c883
2 files changed