summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/notification
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2018-04-13 10:57:09 -0700
committerTony Wickham <twickham@google.com>2018-04-13 10:57:09 -0700
commita6f5869d8f75baeef70ae8509a812b6778a60879 (patch)
tree15e192ea0a0fe08349b327986fe7cde747e1033f /src/com/android/launcher3/notification
parent2998e43256d2c41059507a9fb9debee4cd8e41e5 (diff)
downloadandroid_packages_apps_Trebuchet-a6f5869d8f75baeef70ae8509a812b6778a60879.tar.gz
android_packages_apps_Trebuchet-a6f5869d8f75baeef70ae8509a812b6778a60879.tar.bz2
android_packages_apps_Trebuchet-a6f5869d8f75baeef70ae8509a812b6778a60879.zip
Ignore null notifications
There seems to be an edge case where we can get a null notification in onNotificationRemoved(); there's nothing actionable about that, so just ignore it to prevent NPE. Also add null check to onNotificationPosted() for good measure. Bug: 69140873 Change-Id: I3586bf435d05aee38b99dffd3d01315b433e8476
Diffstat (limited to 'src/com/android/launcher3/notification')
-rw-r--r--src/com/android/launcher3/notification/NotificationListener.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/launcher3/notification/NotificationListener.java b/src/com/android/launcher3/notification/NotificationListener.java
index 1fd70780b..117287ba7 100644
--- a/src/com/android/launcher3/notification/NotificationListener.java
+++ b/src/com/android/launcher3/notification/NotificationListener.java
@@ -219,6 +219,10 @@ public class NotificationListener extends NotificationListenerService {
@Override
public void onNotificationPosted(final StatusBarNotification sbn) {
super.onNotificationPosted(sbn);
+ if (sbn == null) {
+ // There is a bug in platform where we can get a null notification; just ignore it.
+ return;
+ }
mWorkerHandler.obtainMessage(MSG_NOTIFICATION_POSTED, new NotificationPostedMsg(sbn))
.sendToTarget();
if (sStatusBarNotificationsChangedListener != null) {
@@ -244,6 +248,10 @@ public class NotificationListener extends NotificationListenerService {
@Override
public void onNotificationRemoved(final StatusBarNotification sbn) {
super.onNotificationRemoved(sbn);
+ if (sbn == null) {
+ // There is a bug in platform where we can get a null notification; just ignore it.
+ return;
+ }
Pair<PackageUserKey, NotificationKeyData> packageUserKeyAndNotificationKey
= new Pair<>(PackageUserKey.fromNotification(sbn),
NotificationKeyData.fromNotification(sbn));