Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c9ac648 authored by Ariana Mott's avatar Ariana Mott
Browse files

Remove package AutomaticZenRules for revoked Notification Policy Access

Bug=28043240

Change-Id: If59fc043470a6dfe6b2426cd80ef53473ba8be42
parent 9713651b
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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) {
            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);
            }
        }
    }