Fixes 2 race conditions in MetricsLoggerService

- in dump, the array of pending intent was iterated without locking
  against logEvent. This can throw a ConcurrentModificationException
  if at the same time logEvent sends intents and remove them from the
  array.
- in getEvents, the returned reference was reading the reference of the
  last event after releasing the lock on mEvents, which can cause
  callers to miss events if at the same time logEvent is called and
  mLastEventReference is incremented.

Bug: 28204408
Change-Id: I7ff21d4d2c0b02d8e0b47310430dff7d8a87f0bf
1 file changed