summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2013-10-09 14:39:15 -0700
committerChristopher Tate <ctate@google.com>2013-10-09 15:02:17 -0700
commit06e5fed139b69eb231a6e26c67b462a515aba469 (patch)
treec5970d5b80b430e635eeefd7832d081f52b0304b /services/java/com/android/server
parentefeb6f3c1b6123188e78b1c8a15e0eb331ebc8ee (diff)
downloadframeworks_base-06e5fed139b69eb231a6e26c67b462a515aba469.zip
frameworks_base-06e5fed139b69eb231a6e26c67b462a515aba469.tar.gz
frameworks_base-06e5fed139b69eb231a6e26c67b462a515aba469.tar.bz2
Don't crash when component enable/disable broadcasts race with uninstall
Bug 11154482 Change-Id: I55107fec51bf5efada136052c451f293976360d6
Diffstat (limited to 'services/java/com/android/server')
-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 b881934..7431f1d 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};