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
diff --git a/src/com/android/launcher3/notification/NotificationListener.java b/src/com/android/launcher3/notification/NotificationListener.java
index baaa66a..8121fd5 100644
--- a/src/com/android/launcher3/notification/NotificationListener.java
+++ b/src/com/android/launcher3/notification/NotificationListener.java
@@ -127,8 +127,9 @@
}
sNotificationsChangedListener = listener;
- if (sNotificationListenerInstance != null) {
- sNotificationListenerInstance.onNotificationFullRefresh();
+ NotificationListener notificationListener = getInstanceIfConnected();
+ if (notificationListener != null) {
+ notificationListener.onNotificationFullRefresh();
}
}