summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-06-28 14:14:44 -0700
committerTony Wickham <twickham@google.com>2017-06-28 14:14:44 -0700
commitcba189344d82753ccce0cc5479771c5a78e85c56 (patch)
tree8a52f769b2cf873aa5c9705efb45b51d21a07d36 /src
parent59fbea393b91b6156e42d2487cde6c3827fb7574 (diff)
downloadandroid_packages_apps_Trebuchet-cba189344d82753ccce0cc5479771c5a78e85c56.tar.gz
android_packages_apps_Trebuchet-cba189344d82753ccce0cc5479771c5a78e85c56.tar.bz2
android_packages_apps_Trebuchet-cba189344d82753ccce0cc5479771c5a78e85c56.zip
Ensure notification listener is connected before getting notifications
There was a potential race condition where we would try to do a full refresh of notifications before the listener was connected. Now we skip the full refresh if we aren't connected, which is fine because we also do a full refresh in onListenerConnected() anyway. Bug: 62107069 Change-Id: I2fe4f49eb8a840230d32034be11fe7765a366e75
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/notification/NotificationListener.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/launcher3/notification/NotificationListener.java b/src/com/android/launcher3/notification/NotificationListener.java
index baaa66aea..8121fd55f 100644
--- a/src/com/android/launcher3/notification/NotificationListener.java
+++ b/src/com/android/launcher3/notification/NotificationListener.java
@@ -127,8 +127,9 @@ public class NotificationListener extends NotificationListenerService {
}
sNotificationsChangedListener = listener;
- if (sNotificationListenerInstance != null) {
- sNotificationListenerInstance.onNotificationFullRefresh();
+ NotificationListener notificationListener = getInstanceIfConnected();
+ if (notificationListener != null) {
+ notificationListener.onNotificationFullRefresh();
}
}