Merge "Be more discriminating when canceling notifications on changing packages." into jb-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
01827ce9f2
@@ -494,10 +494,11 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
String action = intent.getAction();
|
||||
|
||||
boolean queryRestart = false;
|
||||
boolean packageChanged = false;
|
||||
|
||||
if (action.equals(Intent.ACTION_PACKAGE_REMOVED)
|
||||
|| action.equals(Intent.ACTION_PACKAGE_RESTARTED)
|
||||
|| action.equals(Intent.ACTION_PACKAGE_CHANGED)
|
||||
|| (packageChanged=action.equals(Intent.ACTION_PACKAGE_CHANGED))
|
||||
|| (queryRestart=action.equals(Intent.ACTION_QUERY_PACKAGE_RESTART))
|
||||
|| action.equals(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE)) {
|
||||
String pkgList[] = null;
|
||||
@@ -514,6 +515,15 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
if (pkgName == null) {
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
pkgList = new String[]{pkgName};
|
||||
}
|
||||
if (pkgList != null && (pkgList.length > 0)) {
|
||||
|
||||
Reference in New Issue
Block a user