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/libs/incident/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 channelId = 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}
70
71message ListenersDisablingEffectsProto {
72    option (android.msg_privacy).dest = DEST_AUTOMATIC;
73
74    optional int32 hint = 1;
75    repeated ManagedServiceInfoProto listeners = 2;
76}
77
78message ManagedServiceInfoProto {
79    option (android.msg_privacy).dest = DEST_AUTOMATIC;
80
81    optional android.content.ComponentNameProto component = 1;
82    optional int32 user_id = 2;
83    optional string service = 3;
84    optional bool is_system = 4;
85    optional bool is_guest = 5;
86}
87
88message ManagedServicesProto {
89    option (android.msg_privacy).dest = DEST_AUTOMATIC;
90
91    optional string caption = 1;
92
93    message ServiceProto {
94        option (android.msg_privacy).dest = DEST_AUTOMATIC;
95
96        // Package or component name.
97        repeated string name = 1;
98        optional int32 user_id = 2;
99        optional bool is_primary = 3;
100    }
101    repeated ServiceProto approved = 2;
102
103    // All of this type/caption enabled for current profiles.
104    repeated android.content.ComponentNameProto enabled = 3;
105
106
107    repeated ManagedServiceInfoProto live_services = 4;
108
109    // Snoozed for current profiles.
110    repeated android.content.ComponentNameProto snoozed = 5;
111}
112
113message RankingHelperProto {
114    option (android.msg_privacy).dest = DEST_AUTOMATIC;
115
116    repeated string notification_signal_extractors = 1;
117
118    message RecordProto {
119        option (android.msg_privacy).dest = DEST_AUTOMATIC;
120
121        optional string package = 1;
122        // Default value is UNKNOWN_UID = USER_NULL = -10000.
123        optional int32 uid = 2;
124        // Default is IMPORTANCE_UNSPECIFIED (-1000).
125        optional sint32 importance = 3;
126        // Default is PRIORITY_DEFAULT (0).
127        optional int32 priority = 4;
128        // Default is VISIBILITY_NO_OVERRIDE (-1000).
129        optional sint32 visibility = 5;
130        // Default is true.
131        optional bool show_badge = 6;
132        repeated android.app.NotificationChannelProto channels = 7;
133        repeated android.app.NotificationChannelGroupProto channel_groups = 8;
134    }
135    repeated RecordProto records = 2;
136    repeated RecordProto records_restored_without_uid = 3;
137}
138
139enum ZenMode {
140    ZEN_MODE_OFF = 0;
141    ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
142    ZEN_MODE_NO_INTERRUPTIONS = 2;
143    ZEN_MODE_ALARMS = 3;
144}
145
146// An android.service.notification.Condition object.
147message ConditionProto {
148    option (android.msg_privacy).dest = DEST_EXPLICIT;
149
150    optional string id = 1;
151    optional string summary = 2;
152    optional string line_1 = 3;
153    optional string line_2 = 4;
154    optional int32 icon = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
155
156    enum State {
157        // Indicates that Do Not Disturb should be turned off.
158        STATE_FALSE = 0;
159        // Indicates that Do Not Disturb should be turned on.
160        STATE_TRUE = 1;
161        STATE_UNKNOWN = 2;
162        STATE_ERROR = 3;
163    }
164    optional State state = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
165
166    optional int32 flags = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
167}
168
169// An android.service.notification.ZenModeConfig.ZenRule object.
170message ZenRuleProto {
171    option (android.msg_privacy).dest = DEST_EXPLICIT;
172
173    // Required for automatic ZenRules (unique).
174    optional string id = 1;
175    // Required for automatic ZenRules.
176    optional string name = 2;
177    // Required for automatic ZenRules.
178    optional int64 creation_time_ms = 3 [
179        (android.privacy).dest = DEST_AUTOMATIC
180    ];
181    optional bool enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
182    // Package name, only used for manual ZenRules.
183    optional string enabler = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
184    // User manually disabled this instance.
185    optional bool is_snoozing = 6 [
186        (android.privacy).dest = DEST_AUTOMATIC
187    ];
188    optional ZenMode zen_mode = 7 [
189        (android.privacy).dest = DEST_AUTOMATIC
190    ];
191
192    // Required for automatic ZenRules.
193    optional string condition_id = 8;
194    optional ConditionProto condition = 9;
195    optional android.content.ComponentNameProto component = 10;
196}
197
198// A dump from com.android.server.notification.ZenModeHelper.
199message ZenModeProto {
200    option (android.msg_privacy).dest = DEST_AUTOMATIC;
201
202    optional ZenMode zen_mode = 1;
203    repeated ZenRuleProto enabled_active_conditions = 2;
204    optional int32 suppressed_effects = 3;
205    repeated android.content.ComponentNameProto suppressors = 4;
206    optional android.app.PolicyProto policy = 5;
207}
208