Ensure to update top process state when launching activity

- Combine addPackage, clearWaitingToKill and updateProcessInfo
  into onStartActivity that reduces the amount of messages and
  acquiring lock.
- Invoke onStartActivity after setting activity state to ensure
  oom adjustment uses the latest state (currently the order is
  ensured by lock contention but it is too implicit).
- Make the message of onStartActivity always enqueue at front so
  the process can gain the top state earlier.

Test: AppLaunchTest
Bug: 123043091
Change-Id: Id8d00273a5dc88526c3c158c49423c15fb99a0d5
5 files changed