Merge "Remove package AutomaticZenRules for revoked Notification Policy Access" into nyc-dev

This commit is contained in:
Ariana Mott
2016-04-08 01:31:40 +00:00
committed by Android (Google) Code Review

View File

@@ -490,8 +490,15 @@ public class VrManagerService extends SystemService implements EnabledComponentC
private void revokeNotificationPolicyAccess(String pkg) {
NotificationManager nm = mContext.getSystemService(NotificationManager.class);
if (mPreviousNotificationPolicyAccessPackage != null) {
nm.setNotificationPolicyAccessGranted(mPreviousNotificationPolicyAccessPackage, false);
mPreviousNotificationPolicyAccessPackage = null;
if (mPreviousNotificationPolicyAccessPackage.equals(pkg)) {
// Remove any DND zen rules possibly created by the package.
nm.removeAutomaticZenRules(mPreviousNotificationPolicyAccessPackage);
// Remove Notification Policy Access.
nm.setNotificationPolicyAccessGranted(mPreviousNotificationPolicyAccessPackage, false);
mPreviousNotificationPolicyAccessPackage = null;
} else {
Slog.e(TAG, "Couldn't remove Notification Policy Access for package: " + pkg);
}
}
}