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:
@ -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};
|
||||
|
Reference in New Issue
Block a user