summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/service/notification/ZenModeConfig.java4
-rw-r--r--core/java/android/service/notification/ZenPolicy.java29
2 files changed, 32 insertions, 1 deletions
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index f2fa45d59c1e..e819c963ae45 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -1551,7 +1551,9 @@ public class ZenModeConfig implements Parcelable {
if (component != null) {
component.writeToProto(proto, ZenRuleProto.COMPONENT);
}
- // TODO: write zenPolicy to proto (b/115370281)
+ if (zenPolicy != null) {
+ zenPolicy.writeToProto(proto, ZenRuleProto.ZEN_POLICY);
+ }
proto.end(token);
}
diff --git a/core/java/android/service/notification/ZenPolicy.java b/core/java/android/service/notification/ZenPolicy.java
index 88825f08967e..1ccf529d3009 100644
--- a/core/java/android/service/notification/ZenPolicy.java
+++ b/core/java/android/service/notification/ZenPolicy.java
@@ -21,6 +21,7 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.proto.ProtoOutputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -852,6 +853,34 @@ public final class ZenPolicy implements Parcelable {
}
/**
+ * @hide
+ */
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ final long token = proto.start(fieldId);
+
+ proto.write(ZenPolicyProto.REMINDERS, getPriorityCategoryReminders());
+ proto.write(ZenPolicyProto.EVENTS, getPriorityCategoryEvents());
+ proto.write(ZenPolicyProto.MESSAGES, getPriorityCategoryMessages());
+ proto.write(ZenPolicyProto.CALLS, getPriorityCategoryCalls());
+ proto.write(ZenPolicyProto.REPEAT_CALLERS, getPriorityCategoryRepeatCallers());
+ proto.write(ZenPolicyProto.ALARMS, getPriorityCategoryAlarms());
+ proto.write(ZenPolicyProto.MEDIA, getPriorityCategoryMedia());
+ proto.write(ZenPolicyProto.SYSTEM, getPriorityCategorySystem());
+
+ proto.write(ZenPolicyProto.FULL_SCREEN_INTENT, getVisualEffectFullScreenIntent());
+ proto.write(ZenPolicyProto.LIGHTS, getVisualEffectLights());
+ proto.write(ZenPolicyProto.PEEK, getVisualEffectPeek());
+ proto.write(ZenPolicyProto.STATUS_BAR, getVisualEffectStatusBar());
+ proto.write(ZenPolicyProto.BADGE, getVisualEffectBadge());
+ proto.write(ZenPolicyProto.AMBIENT, getVisualEffectAmbient());
+ proto.write(ZenPolicyProto.NOTIFICATION_LIST, getVisualEffectNotificationList());
+
+ proto.write(ZenPolicyProto.PRIORITY_MESSAGES, getPriorityMessageSenders());
+ proto.write(ZenPolicyProto.PRIORITY_CALLS, getPriorityCallSenders());
+ proto.end(token);
+ }
+
+ /**
* Makes deep copy of this ZenPolicy.
* @hide
*/