Skip to content
Commit 4fce120b authored by Tony Mak's avatar Tony Mak
Browse files

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
parent 3acdae62
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment