blob: 6329d0484bbd645ded6a09ae83183f6302625eb8 [file] [log] [blame]
Ritwika Mitra626bfc32019-11-08 09:35:25 -08001/*
2 * Copyright (C) 2019 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 = "proto3";
18
19package com.android.car.messenger.proto;
20
21option java_package = "com.android.car.messenger.NotificationMsgProto";
22
23message PhoneToCarMessage {
24 // The unique key of the message notification, same in phone and car.
25 // This will be the StatusBarNotification id of the original message notification posted on the
26 // phone.
27 string notification_key = 1;
28
29 // Categorizing what type of message this is, so the receiver understands what type of
30 // message_data is being sent, and the purpose of the message. The expected message_type(s) with
31 // their message_data type (for now) are:
32 // "NEW_CONVERSATION" - ConversationNotification expected,
33 // "NEW_MESSAGE" - MessagingStyleMessageProto expected,
34 // "ACTION_STATUS_UPDATE" - ActionStatusUpdate expected,
35 // "OTHER" - metadata expected.
36 //
37 // The message_type field is a string and not an enum so that new message types can be added in a
38 // backwards compatible way. New message types that require a message_data structure that was
39 // introduced in later releases will be put in the metadata field.
40 //
41 // NOTE: while a message type like "NEW_CONVERSATION" is required to have a
42 // ConversationNotification message, it may also have a metadata message as well.
43 string message_type = 2;
44
45 oneof message_data {
46 ConversationNotification conversation = 3;
47 MessagingStyleMessage message = 4;
48 ActionStatusUpdate status_update = 5;
49 }
50
51 // A byte array containing an undefined message. This field may contain supplemental information
52 // for a message_data, or contain all of the data for the PhoneToCarMessage.
53 bytes metadata = 6;
54}
55
56message CarToPhoneMessage {
57 // The unique key of the message notification, same in phone and car.
58 // This will be the StatusBarNotification id of the original message notification posted on the
59 // phone.
60 string notification_key = 1;
61
62 Action action_request = 2;
63
64 bytes metadata = 3;
65}
66
67message ActionStatusUpdate {
68 enum Status {
69 SUCCESSFUL = 0;
70 ERROR = 1;
71 }
72
73 // Unique ID of the action
74 int64 request_id = 1;
75
76 Status status = 2;
77
78 string error_explanation = 3;
79}
80
81// A message notification originating from the user's phone.
82message ConversationNotification {
83
84 // Display name of the application that posted this notification.
85 string messaging_app_display_name = 1;
86
87 // Package name of the application that posted this notification.
88 string messaging_app_package_name = 2;
89
90 MessagingStyle messaging_style = 3;
91
92 // The time, in milliseconds, this message notification was last updated.
93 int64 time_ms = 4;
94
95 bytes app_icon = 5;
96}
97
98message MessagingStyle {
99 repeated MessagingStyleMessage messaging_style_msg = 1;
100
101 string convo_title = 2;
102
103 // String of the user, needed for MessagingStyle
104 string user_display_name = 3;
105
106 bool is_group_convo = 4;
107}
108
109message MessagingStyleMessage {
110 string text_message = 1;
111
112 int64 timestamp = 2;
113
114 Person sender = 3;
115
116 // If the message is read on the phone.
117 bool is_read = 4;
118}
119
120message Person {
121 string name = 1;
122
123 bytes icon = 2;
124}
125
126message Action {
127 enum ActionName {
128 MARK_AS_READ = 0;
129 REPLY = 1;
130 DISMISS = 2;
131 }
132
133 // Same as the PhoneToCar and CarToPhone messages's notification_key.
134 // As mentioned above, this notification id should be the same on the phone and the car.
135 // This will be the StatusBarNotification id of the original message notification posted on the
136 // phone.
137 string notification_key = 1;
138
139 //Optional, used to capture data like the reply string.
Ritwika Mitra2e3741b2020-01-23 10:41:41 -0800140 repeated ActionDataFieldEntry action_data_field = 2;
Ritwika Mitra626bfc32019-11-08 09:35:25 -0800141
142 ActionName action_name = 3;
143
144 // Unique id of this action.
145 int64 request_id = 4;
146}
Ritwika Mitra2e3741b2020-01-23 10:41:41 -0800147
148message ActionDataFieldEntry {
149 string key = 1;
150 string value = 2;
151}