summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christopher Tate <ctate@google.com> 2013-10-09 22:18:41 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-10-09 22:18:41 +0000
commitd606be2562f937584a274eba5b595c5a08e4dbdc (patch)
tree46c8a859f6414cec9c26445a063305e1a0e1c2e0
parent24305da7d66682930764e77695a884dd78b49039 (diff)
parent06e5fed139b69eb231a6e26c67b462a515aba469 (diff)
Merge "Don't crash when component enable/disable broadcasts race with uninstall" into klp-dev
-rw-r--r--services/java/com/android/server/NotificationManagerService.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index b881934879d6..7431f1d0af43 100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -1167,11 +1167,19 @@ public class NotificationManagerService extends INotificationManager.Stub
}
if (packageChanged) {
// We cancel notifications for packages which have just been disabled
- final int enabled = mContext.getPackageManager()
- .getApplicationEnabledSetting(pkgName);
- if (enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED
- || enabled == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
- cancelNotifications = false;
+ try {
+ final int enabled = mContext.getPackageManager()
+ .getApplicationEnabledSetting(pkgName);
+ if (enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+ || enabled == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
+ cancelNotifications = false;
+ }
+ } catch (IllegalArgumentException e) {
+ // Package doesn't exist; probably racing with uninstall.
+ // cancelNotifications is already true, so nothing to do here.
+ if (DBG) {
+ Slog.i(TAG, "Exception trying to look up app enabled setting", e);
+ }
}
}
pkgList = new String[]{pkgName};