event_manager: Reject bad state transitions for AppLaunchEvent

Enforce that all state transitions are as contractually documented
in wm's ActivityMetricsLaunchObserver. This in effect makes interleaving
events impossible.

Bad transitions are converted in the corresponding Failed/Cancelled
events if possible. If the original state was already terminal the
transition is completely dropped.

Bug: 147147942
Bug: 149790059
Test: manual (check logcat while running apps)
Change-Id: If84ad10621dee8407905d68ecd2062c7ceb4e9d0
2 files changed