Fix NPE in logActionClick
Problem:
The issue could happen when clicking on the archive button on the
notification from Gmail repeatedly and quickly. Tapping the Archive
button will change the notification layout to something custom
with a single UNDO button. The bug happens when the notification object
is already updated, while logActionClick of the old action button is
still running.
Proposed solution:
1. Add sanity check to avoid NPE, array index out of bounds.
2. To ensure that the action object is the one we want, use PendingIntent in
Notification.Action as a token.
logActionClick is just used as logging, and the problem seems only happen
in repetitive clicks, so just bailing out should be fine.
Test: Have a Gmail notification, taps archive button repeatedly.
Observe no crash.
Test: Ensure that log is sent in normal cases by checking logcat.
FIXES: 128804769
Change-Id: Ic04fd9288cba5253179bf1f478a7454e44f31703
1 file changed