Merge "Make sure notification listener stays unbound on reboot when badging disabled" into ub-launcher3-edmonton
diff --git a/src/com/android/launcher3/notification/NotificationListener.java b/src/com/android/launcher3/notification/NotificationListener.java
index 117287b..b527b6a 100644
--- a/src/com/android/launcher3/notification/NotificationListener.java
+++ b/src/com/android/launcher3/notification/NotificationListener.java
@@ -150,22 +150,12 @@
public void onCreate() {
super.onCreate();
sIsCreated = true;
- mNotificationBadgingObserver = new SettingsObserver.Secure(getContentResolver()) {
- @Override
- public void onSettingChanged(boolean isNotificationBadgingEnabled) {
- if (!isNotificationBadgingEnabled) {
- requestUnbind();
- }
- }
- };
- mNotificationBadgingObserver.register(NOTIFICATION_BADGING);
}
@Override
public void onDestroy() {
super.onDestroy();
sIsCreated = false;
- mNotificationBadgingObserver.unregister();
}
public static @Nullable NotificationListener getInstanceIfConnected() {
@@ -203,6 +193,17 @@
public void onListenerConnected() {
super.onListenerConnected();
sIsConnected = true;
+
+ mNotificationBadgingObserver = new SettingsObserver.Secure(getContentResolver()) {
+ @Override
+ public void onSettingChanged(boolean isNotificationBadgingEnabled) {
+ if (!isNotificationBadgingEnabled) {
+ requestUnbind();
+ }
+ }
+ };
+ mNotificationBadgingObserver.register(NOTIFICATION_BADGING);
+
onNotificationFullRefresh();
}
@@ -214,6 +215,7 @@
public void onListenerDisconnected() {
super.onListenerDisconnected();
sIsConnected = false;
+ mNotificationBadgingObserver.unregister();
}
@Override