[DO NOT MERGE] Handle IllegalStateException in APM event handling. am: 60a456a0a6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16576688

Change-Id: If0517cac3a8955660e1276682efbc6825e751ed5