diff options
author | John Spurlock <jspurlock@google.com> | 2013-05-16 09:10:05 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2013-05-18 14:29:40 -0400 |
commit | 79f7892c1002d2e7159d34537fcd6a46a2db4fb8 (patch) | |
tree | 77d9a603167c78b4702d892363bba835f8c17f50 /services/java/com/android/server/NotificationManagerService.java | |
parent | 743054f5b3ad088b00adac44bb6d1f542d4375db (diff) |
Deactivate notification listeners disabled at runtime.
PACKAGE_CHANGED is called when either the application or any
of its components change. Rework old early exit code to
handle component-level disabling wrt listeners.
Note PACKAGE_CHANGED can take quite a while to reach NMS.
Up to ten seconds (!) after component-disabling in app.
Bug:8982243
Change-Id: Ia325516140dd9288466a663192a5326019f071ab
Diffstat (limited to 'services/java/com/android/server/NotificationManagerService.java')
-rw-r--r-- | services/java/com/android/server/NotificationManagerService.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 903bc0bfc526..4348a81178f3 100644 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -1133,6 +1133,7 @@ public class NotificationManagerService extends INotificationManager.Stub boolean queryRestart = false; boolean queryRemove = false; boolean packageChanged = false; + boolean cancelNotifications = true; if (action.equals(Intent.ACTION_PACKAGE_ADDED) || (queryRemove=action.equals(Intent.ACTION_PACKAGE_REMOVED)) @@ -1163,7 +1164,7 @@ public class NotificationManagerService extends INotificationManager.Stub .getApplicationEnabledSetting(pkgName); if (enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED || enabled == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) { - return; + cancelNotifications = false; } } pkgList = new String[]{pkgName}; @@ -1172,8 +1173,10 @@ public class NotificationManagerService extends INotificationManager.Stub boolean anyListenersInvolved = false; if (pkgList != null && (pkgList.length > 0)) { for (String pkgName : pkgList) { - cancelAllNotificationsInt(pkgName, 0, 0, !queryRestart, - UserHandle.USER_ALL); + if (cancelNotifications) { + cancelAllNotificationsInt(pkgName, 0, 0, !queryRestart, + UserHandle.USER_ALL); + } if (mEnabledListenerPackageNames.contains(pkgName)) { anyListenersInvolved = true; } |