summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matías Hernández <matiashe@google.com> 2024-04-23 15:51:41 +0200
committer Matías Hernández <matiashe@google.com> 2024-04-24 11:53:03 +0200
commit803800cc1bde0ded9cf14340888169e547bf3a5c (patch)
tree1a140c8e91e0c8ba1769c5c6f888b1a4996f960a
parent52d345f538645076ee285e652ce2539ec70e13fe (diff)
Add support for rules with filter=ALL in ZenModesBackend
Add (hidden) getter and setter and new value for mAllowChannels, which is normally set through allowPriorityChannels(). Bug: 327419222 Bug: 331267485 Test: atest ZenModeTest Flag: android.app.modes_ui Change-Id: Iee75e4cdc2c89bbef60677ff5ee65690fcb29fc5
-rw-r--r--core/java/android/service/notification/ZenPolicy.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/core/java/android/service/notification/ZenPolicy.java b/core/java/android/service/notification/ZenPolicy.java
index 786d768bc55b..1d7091c52d7a 100644
--- a/core/java/android/service/notification/ZenPolicy.java
+++ b/core/java/android/service/notification/ZenPolicy.java
@@ -349,23 +349,29 @@ public final class ZenPolicy implements Parcelable {
/**
* Indicates no explicit setting for which channels may bypass DND when this policy is active.
* Defaults to {@link #CHANNEL_POLICY_PRIORITY}.
+ *
+ * @hide
*/
@FlaggedApi(Flags.FLAG_MODES_API)
- private static final int CHANNEL_POLICY_UNSET = 0;
+ public static final int CHANNEL_POLICY_UNSET = 0;
/**
* Indicates that channels marked as {@link NotificationChannel#canBypassDnd()} can bypass DND
* when this policy is active.
+ *
+ * @hide
*/
@FlaggedApi(Flags.FLAG_MODES_API)
- private static final int CHANNEL_POLICY_PRIORITY = 1;
+ public static final int CHANNEL_POLICY_PRIORITY = 1;
/**
* Indicates that no channels can bypass DND when this policy is active, even those marked as
* {@link NotificationChannel#canBypassDnd()}.
+ *
+ * @hide
*/
@FlaggedApi(Flags.FLAG_MODES_API)
- private static final int CHANNEL_POLICY_NONE = 2;
+ public static final int CHANNEL_POLICY_NONE = 2;
/** @hide */
public ZenPolicy() {
@@ -564,6 +570,13 @@ public final class ZenPolicy implements Parcelable {
}
/**
+ * @hide
+ */
+ public @ChannelType int getAllowedChannels() {
+ return mAllowChannels;
+ }
+
+ /**
* Whether this policy allows {@link NotificationChannel channels} marked as
* {@link NotificationChannel#canBypassDnd()} to bypass DND. If {@link #STATE_ALLOW}, these
* channels may bypass; if {@link #STATE_DISALLOW}, then even notifications from channels
@@ -999,6 +1012,12 @@ public final class ZenPolicy implements Parcelable {
mZenPolicy.mAllowChannels = allow ? CHANNEL_POLICY_PRIORITY : CHANNEL_POLICY_NONE;
return this;
}
+
+ /** @hide */
+ public @NonNull Builder allowChannels(@ChannelType int channelType) {
+ mZenPolicy.mAllowChannels = channelType;
+ return this;
+ }
}
@Override