1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18package android.service.notification; 19 20option java_multiple_files = true; 21option java_outer_classname = "NotificationServiceProto"; 22 23import "frameworks/base/core/proto/android/app/notification_channel.proto"; 24import "frameworks/base/core/proto/android/app/notification_channel_group.proto"; 25import "frameworks/base/core/proto/android/app/notificationmanager.proto"; 26import "frameworks/base/core/proto/android/content/component_name.proto"; 27import "frameworks/base/core/proto/android/media/audioattributes.proto"; 28import "frameworks/base/core/proto/android/privacy.proto"; 29 30message NotificationServiceDumpProto { 31 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 32 33 repeated NotificationRecordProto records = 1; 34 35 optional ZenModeProto zen = 2; 36 37 optional ManagedServicesProto notification_listeners = 3; 38 39 optional int32 listener_hints = 4; 40 41 repeated ListenersDisablingEffectsProto listeners_disabling_effects = 5; 42 43 optional ManagedServicesProto notification_assistants = 6; 44 45 optional ManagedServicesProto condition_providers = 7; 46 47 optional RankingHelperProto ranking_config = 8; 48} 49 50message NotificationRecordProto { 51 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 52 53 optional string key = 1; 54 55 enum State { 56 ENQUEUED = 0; 57 POSTED = 1; 58 SNOOZED = 2; 59 } 60 optional State state = 2; 61 optional int32 flags = 3; 62 optional string channel_id = 4 [ (.android.privacy).dest = DEST_EXPLICIT ]; 63 optional string sound = 5 [ (.android.privacy).dest = DEST_EXPLICIT ]; 64 optional .android.media.AudioAttributesProto audio_attributes = 6; 65 optional bool can_vibrate = 7; 66 optional bool can_show_light = 8; 67 optional string group_key = 9 [ (.android.privacy).dest = DEST_EXPLICIT ]; 68 optional sint32 importance = 10; 69 // The package the notification was posted for. 70 optional string package = 11; 71 // The package that posted the notification. It might not be the same as package. 72 optional string delegate_package = 12; 73} 74 75message ListenersDisablingEffectsProto { 76 option (android.msg_privacy).dest = DEST_AUTOMATIC; 77 78 optional int32 hint = 1; 79 reserved 2; // ManagedServiceInfoProto listeners 80 repeated android.content.ComponentNameProto listener_components = 3; 81} 82 83message ManagedServiceInfoProto { 84 option (android.msg_privacy).dest = DEST_AUTOMATIC; 85 86 optional android.content.ComponentNameProto component = 1; 87 optional int32 user_id = 2; 88 optional string service = 3; 89 optional bool is_system = 4; 90 optional bool is_guest = 5; 91} 92 93message ManagedServicesProto { 94 option (android.msg_privacy).dest = DEST_AUTOMATIC; 95 96 // Hard-coded string identifying what the service config is for 97 // (eg: "notification assistant" or "notification listener"). 98 optional string caption = 1; 99 100 message ServiceProto { 101 option (android.msg_privacy).dest = DEST_AUTOMATIC; 102 103 // Package or component name. 104 repeated string name = 1; 105 optional int32 user_id = 2; 106 optional bool is_primary = 3; 107 } 108 repeated ServiceProto approved = 2; 109 110 // All of this type/caption enabled for current profiles. 111 repeated android.content.ComponentNameProto enabled = 3; 112 113 114 repeated ManagedServiceInfoProto live_services = 4; 115 116 // Snoozed for current profiles. 117 repeated android.content.ComponentNameProto snoozed = 5; 118} 119 120message RankingHelperProto { 121 option (android.msg_privacy).dest = DEST_AUTOMATIC; 122 123 repeated string notification_signal_extractors = 1; 124 125 message RecordProto { 126 option (android.msg_privacy).dest = DEST_AUTOMATIC; 127 128 optional string package = 1; 129 // Default value is UNKNOWN_UID = USER_NULL = -10000. 130 optional int32 uid = 2; 131 // Default is IMPORTANCE_UNSPECIFIED (-1000). 132 optional sint32 importance = 3; 133 // Default is PRIORITY_DEFAULT (0). 134 optional int32 priority = 4; 135 // Default is VISIBILITY_NO_OVERRIDE (-1000). 136 optional sint32 visibility = 5; 137 // Default is true. 138 optional bool show_badge = 6; 139 repeated android.app.NotificationChannelProto channels = 7; 140 repeated android.app.NotificationChannelGroupProto channel_groups = 8; 141 } 142 repeated RecordProto records = 2; 143 repeated RecordProto records_restored_without_uid = 3; 144} 145 146enum ZenMode { 147 ZEN_MODE_OFF = 0; 148 ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1; 149 ZEN_MODE_NO_INTERRUPTIONS = 2; 150 ZEN_MODE_ALARMS = 3; 151} 152 153// An android.service.notification.Condition object. 154message ConditionProto { 155 option (android.msg_privacy).dest = DEST_EXPLICIT; 156 157 // The URI representing the rule being updated. 158 optional string id = 1; 159 // A user visible description of the rule state. 160 optional string summary = 2; 161 // Android generated strings that detail when ZenMode will end. 162 optional string line_1 = 3; 163 optional string line_2 = 4; 164 optional int32 icon = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; 165 166 enum State { 167 // Indicates that Do Not Disturb should be turned off. 168 STATE_FALSE = 0; 169 // Indicates that Do Not Disturb should be turned on. 170 STATE_TRUE = 1; 171 STATE_UNKNOWN = 2; 172 STATE_ERROR = 3; 173 } 174 optional State state = 6 [ (android.privacy).dest = DEST_AUTOMATIC ]; 175 176 optional int32 flags = 7 [ (android.privacy).dest = DEST_AUTOMATIC ]; 177} 178 179// An android.service.notification.ZenModeConfig.ZenRule object. 180message ZenRuleProto { 181 option (android.msg_privacy).dest = DEST_EXPLICIT; 182 183 // Required for automatic ZenRules (unique). 184 optional string id = 1; 185 // Required for automatic ZenRules. 186 optional string name = 2; 187 // Required for automatic ZenRules. 188 optional int64 creation_time_ms = 3 [ 189 (android.privacy).dest = DEST_AUTOMATIC 190 ]; 191 optional bool enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; 192 // Package name, only used for manual ZenRules. 193 optional string enabler = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; 194 // User manually disabled this instance. 195 optional bool is_snoozing = 6 [ 196 (android.privacy).dest = DEST_AUTOMATIC 197 ]; 198 optional ZenMode zen_mode = 7 [ 199 (android.privacy).dest = DEST_AUTOMATIC 200 ]; 201 202 // Required for automatic ZenRules. The condition's ID, which is the URI 203 // representing the rule being updated. 204 optional string condition_id = 8; 205 optional ConditionProto condition = 9; 206 optional android.content.ComponentNameProto component = 10; 207 optional ZenPolicyProto zenPolicy = 11; 208 209 // Indicates whether this ZenRule has been modified after its initial creation 210 optional bool modified = 12 [ (android.privacy).dest = DEST_AUTOMATIC ]; 211} 212 213// A dump from com.android.server.notification.ZenModeHelper. 214message ZenModeProto { 215 option (android.msg_privacy).dest = DEST_AUTOMATIC; 216 217 optional ZenMode zen_mode = 1; 218 repeated ZenRuleProto enabled_active_conditions = 2; 219 optional int32 suppressed_effects = 3; 220 repeated android.content.ComponentNameProto suppressors = 4; 221 optional android.app.PolicyProto policy = 5; 222} 223 224// An android.service.notification.ZenPolicy object 225message ZenPolicyProto { 226 option (android.msg_privacy).dest = DEST_AUTOMATIC; 227 228 enum State { 229 STATE_UNSET = 0; 230 STATE_ALLOW = 1; 231 STATE_DISALLOW = 2; 232 } 233 234 // Notifications and sounds allowed/disallowed when DND is active 235 optional State reminders = 1; 236 optional State events = 2; 237 optional State messages = 3; 238 optional State calls = 4; 239 optional State repeat_callers = 5; 240 optional State alarms = 6; 241 optional State media = 7; 242 optional State system = 8; 243 244 // Visual effects allowed/disallowed for intercepted notifications when DND is active 245 optional State full_screen_intent = 9; 246 optional State lights = 10; 247 optional State peek = 11; 248 optional State status_bar = 12; 249 optional State badge= 13; 250 optional State ambient = 14; 251 optional State notification_list = 15; 252 253 enum Sender { 254 SENDER_UNSET = 0; 255 // Any sender is prioritized. 256 SENDER_ANY = 1; 257 // Saved contacts are prioritized. 258 SENDER_CONTACTS = 2; 259 // Only starred contacts are prioritized. 260 SENDER_STARRED = 3; 261 // No calls/messages are prioritized. 262 SENDER_NONE = 4; 263 } 264 optional Sender priority_calls = 16; 265 optional Sender priority_messages = 17; 266} 267 268// Next Tag: 2 269message PackageRemoteViewInfoProto { 270 optional string package_name = 1; 271 // add per-package additional info here (like channels) 272} 273 274// Next Tag: 2 275message NotificationRemoteViewsProto { 276 repeated PackageRemoteViewInfoProto package_remote_view_info = 1; 277}