Loading core/java/android/app/NotificationManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.provider.Settings.Global; import android.service.notification.StatusBarNotification; import android.service.notification.ZenModeConfig; import android.util.Log; import android.util.proto.ProtoOutputStream; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -1061,6 +1062,27 @@ public class NotificationManager { + "]"; } /** @hide */ public void toProto(ProtoOutputStream proto, long fieldId) { final long pToken = proto.start(fieldId); bitwiseToProtoEnum(proto, PolicyProto.PRIORITY_CATEGORIES, priorityCategories); proto.write(PolicyProto.PRIORITY_CALL_SENDER, priorityCallSenders); proto.write(PolicyProto.PRIORITY_MESSAGE_SENDER, priorityMessageSenders); bitwiseToProtoEnum( proto, PolicyProto.SUPPRESSED_VISUAL_EFFECTS, suppressedVisualEffects); proto.end(pToken); } private static void bitwiseToProtoEnum(ProtoOutputStream proto, long fieldId, int data) { for (int i = 1; data > 0; ++i, data >>>= 1) { if ((data & 1) == 1) { proto.write(fieldId, i); } } } public static String suppressedEffectsToString(int effects) { if (effects <= 0) return ""; final StringBuilder sb = new StringBuilder(); Loading core/proto/android/app/notificationmanager.proto 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; option java_package = "android.app"; option java_multiple_files = true; package android.app; /** * An android.app.NotificationMananger.Policy object. */ message PolicyProto { enum Category { CATEGORY_UNKNOWN = 0; // Reminder notifications are prioritized. REMINDERS = 1; // Event notifications are prioritized. EVENTS = 2; // Message notifications are prioritized. MESSAGES = 3; // Calls are prioritized. CALLS = 4; // Calls from repeat callers are prioritized. REPEAT_CALLERS = 5; } repeated Category priority_categories = 1; enum Sender { // Any sender is prioritized. ANY = 0; // Saved contacts are prioritized. CONTACTS = 1; // Only starred contacts are prioritized. STARRED = 2; } Sender priority_call_sender = 2; Sender priority_message_sender = 3; enum SuppressedVisualEffect { SVE_UNKNOWN = 0; // Whether notifications suppressed by DND should not interrupt visually // (e.g. with notification lights or by turning the screen on) when the // screen is off. SCREEN_OFF = 1; // Whether notifications suppressed by DND should not interrupt visually // when the screen is on (e.g. by peeking onto the screen). SCREEN_ON = 2; } repeated SuppressedVisualEffect suppressed_visual_effects = 4; } core/proto/android/service/notification.proto +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package android.service.notification; option java_multiple_files = true; option java_outer_classname = "NotificationServiceProto"; import "frameworks/base/core/proto/android/app/notificationmanager.proto"; import "frameworks/base/core/proto/android/content/component_name.proto"; message NotificationServiceDumpProto { Loading Loading @@ -98,7 +99,7 @@ message ZenModeProto { repeated string enabled_active_conditions = 2; int32 suppressed_effects = 3; repeated string suppressors = 4; string policy = 5; android.app.PolicyProto policy = 5; } enum ZenMode { Loading services/core/java/com/android/server/notification/ZenModeHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -567,7 +567,7 @@ public class ZenModeHelper { proto.write(ZenModeProto.ENABLED_ACTIVE_CONDITIONS, rule.toString()); } } proto.write(ZenModeProto.POLICY, mConfig.toNotificationPolicy().toString()); mConfig.toNotificationPolicy().toProto(proto, ZenModeProto.POLICY); proto.write(ZenModeProto.SUPPRESSED_EFFECTS, mSuppressedEffects); } } Loading Loading
core/java/android/app/NotificationManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.provider.Settings.Global; import android.service.notification.StatusBarNotification; import android.service.notification.ZenModeConfig; import android.util.Log; import android.util.proto.ProtoOutputStream; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -1061,6 +1062,27 @@ public class NotificationManager { + "]"; } /** @hide */ public void toProto(ProtoOutputStream proto, long fieldId) { final long pToken = proto.start(fieldId); bitwiseToProtoEnum(proto, PolicyProto.PRIORITY_CATEGORIES, priorityCategories); proto.write(PolicyProto.PRIORITY_CALL_SENDER, priorityCallSenders); proto.write(PolicyProto.PRIORITY_MESSAGE_SENDER, priorityMessageSenders); bitwiseToProtoEnum( proto, PolicyProto.SUPPRESSED_VISUAL_EFFECTS, suppressedVisualEffects); proto.end(pToken); } private static void bitwiseToProtoEnum(ProtoOutputStream proto, long fieldId, int data) { for (int i = 1; data > 0; ++i, data >>>= 1) { if ((data & 1) == 1) { proto.write(fieldId, i); } } } public static String suppressedEffectsToString(int effects) { if (effects <= 0) return ""; final StringBuilder sb = new StringBuilder(); Loading
core/proto/android/app/notificationmanager.proto 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; option java_package = "android.app"; option java_multiple_files = true; package android.app; /** * An android.app.NotificationMananger.Policy object. */ message PolicyProto { enum Category { CATEGORY_UNKNOWN = 0; // Reminder notifications are prioritized. REMINDERS = 1; // Event notifications are prioritized. EVENTS = 2; // Message notifications are prioritized. MESSAGES = 3; // Calls are prioritized. CALLS = 4; // Calls from repeat callers are prioritized. REPEAT_CALLERS = 5; } repeated Category priority_categories = 1; enum Sender { // Any sender is prioritized. ANY = 0; // Saved contacts are prioritized. CONTACTS = 1; // Only starred contacts are prioritized. STARRED = 2; } Sender priority_call_sender = 2; Sender priority_message_sender = 3; enum SuppressedVisualEffect { SVE_UNKNOWN = 0; // Whether notifications suppressed by DND should not interrupt visually // (e.g. with notification lights or by turning the screen on) when the // screen is off. SCREEN_OFF = 1; // Whether notifications suppressed by DND should not interrupt visually // when the screen is on (e.g. by peeking onto the screen). SCREEN_ON = 2; } repeated SuppressedVisualEffect suppressed_visual_effects = 4; }
core/proto/android/service/notification.proto +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package android.service.notification; option java_multiple_files = true; option java_outer_classname = "NotificationServiceProto"; import "frameworks/base/core/proto/android/app/notificationmanager.proto"; import "frameworks/base/core/proto/android/content/component_name.proto"; message NotificationServiceDumpProto { Loading Loading @@ -98,7 +99,7 @@ message ZenModeProto { repeated string enabled_active_conditions = 2; int32 suppressed_effects = 3; repeated string suppressors = 4; string policy = 5; android.app.PolicyProto policy = 5; } enum ZenMode { Loading
services/core/java/com/android/server/notification/ZenModeHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -567,7 +567,7 @@ public class ZenModeHelper { proto.write(ZenModeProto.ENABLED_ACTIVE_CONDITIONS, rule.toString()); } } proto.write(ZenModeProto.POLICY, mConfig.toNotificationPolicy().toString()); mConfig.toNotificationPolicy().toProto(proto, ZenModeProto.POLICY); proto.write(ZenModeProto.SUPPRESSED_EFFECTS, mSuppressedEffects); } } Loading