am d606be25: Merge "Don\'t crash when component enable/disable broadcasts race with uninstall" into klp-dev

* commit 'd606be2562f937584a274eba5b595c5a08e4dbdc':
  Don't crash when component enable/disable broadcasts race with uninstall
This commit is contained in:
Christopher Tate
2013-10-09 15:21:49 -07:00
committed by Android Git Automerger

View File

@ -1167,11 +1167,19 @@ public class NotificationManagerService extends INotificationManager.Stub
} }
if (packageChanged) { if (packageChanged) {
// We cancel notifications for packages which have just been disabled // We cancel notifications for packages which have just been disabled
final int enabled = mContext.getPackageManager() try {
.getApplicationEnabledSetting(pkgName); final int enabled = mContext.getPackageManager()
if (enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED .getApplicationEnabledSetting(pkgName);
|| enabled == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) { if (enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED
cancelNotifications = false; || 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}; pkgList = new String[]{pkgName};