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

Commit eb41dfb3 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Cleanup zen rule instances."

parents ac7579a6 c8e54e8d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ interface INotificationManager
    AutomaticZenRule addAutomaticZenRule(in AutomaticZenRule automaticZenRule);
    boolean updateAutomaticZenRule(in AutomaticZenRule automaticZenRule);
    boolean removeAutomaticZenRule(String id);
    boolean removeAutomaticZenRules(String packageName);

    byte[] getBackupPayload(int user);
    void applyRestore(in byte[] payload, int user);
+14 −0
Original line number Diff line number Diff line
@@ -469,6 +469,20 @@ public class NotificationManager
        return false;
    }

    /**
     * Deletes all automatic zen rules owned by the given package.
     *
     * @hide
     */
    public boolean removeAutomaticZenRules(String packageName) {
        INotificationManager service = getService();
        try {
            return service.removeAutomaticZenRules(packageName);
        } catch (RemoteException e) {
        }
        return false;
    }

    /**
     * Checks the ability to read/modify notification policy for the calling package.
     *
+1 −1
Original line number Diff line number Diff line
@@ -1110,7 +1110,7 @@ public class ZenModeConfig implements Parcelable {
            if (!Objects.equals(id, to.id)) {
                d.addLine(item, "id", id, to.id);
            }
            if (creationTime == to.creationTime) {
            if (creationTime != to.creationTime) {
                d.addLine(item, "creationTime", creationTime, to.creationTime);
            }
        }
+5 −0
Original line number Diff line number Diff line
@@ -5389,6 +5389,11 @@ public final class ActivityManagerService extends ActivityManagerNative
                    removeUriPermissionsForPackageLocked(packageName, userId, true);
                }
                // Remove all zen rules created by this package; revoke it's zen access.
                INotificationManager inm = NotificationManager.getService();
                inm.removeAutomaticZenRules(packageName);
                inm.setNotificationPolicyAccessGranted(packageName, false);
                Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED,
                        Uri.fromParts("package", packageName, null));
                intent.putExtra(Intent.EXTRA_UID, pkgUid);
+8 −0
Original line number Diff line number Diff line
@@ -1633,6 +1633,14 @@ public class NotificationManagerService extends SystemService {
            return mZenModeHelper.removeAutomaticZenRule(id, "removeAutomaticZenRule");
        }

        @Override
        public boolean removeAutomaticZenRules(String packageName) throws RemoteException {
            Preconditions.checkNotNull(packageName, "Package name is null");
            enforceSystemOrSystemUI("removeAutomaticZenRules");

            return mZenModeHelper.removeAutomaticZenRules(packageName, "removeAutomaticZenRules");
        }

        @Override
        public void setInterruptionFilter(String pkg, int filter) throws RemoteException {
            enforcePolicyAccess(pkg, "setInterruptionFilter");
Loading