[automerger skipped] [RESTRICT AUTOMERGE] Fix potential out of bounds writes in LogEvent. am: 53251a491f am: 60b00ec30f -s ours am: 2e7b3476cf -s ours

am skip reason: subject contains skip directive

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I584cec38325c98d3dfca7c9f9374354b31c710da