1/* 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 23// Message to be sent from the phone SDK to the IHU SDK. 24message PhoneToCarMessage { 25 // The unique key of the message notification, same in phone and car. 26 // This will be the StatusBarNotification id of the original message 27 // notification posted on the phone. 28 string notification_key = 1; 29 30 // The different types of messages to be sent from the phone SDK. 31 oneof message_data { 32 // Metadata of a new conversation (new in the history of the current 33 // connection between phone and IHU SDKs). 34 ConversationNotification conversation = 2; 35 // Metadata of a new conversation received in an existing conversation. 36 MessagingStyleMessage message = 3; 37 // Fulfillment update of an action that was requested previously by 38 // the IHU SDK. 39 ActionStatusUpdate status_update = 4; 40 // Metadata of a new sender avatar icon. 41 AvatarIconSync avatar_icon_sync = 5; 42 // Request to remove all data related to a messaging application. 43 ClearAppDataRequest clear_app_data_request = 6; 44 // Informs SDK whether this feature has been enabled/disabled. 45 FeatureEnabledStateChange feature_enabled_state_change = 7; 46 // Details about the connected phone. 47 PhoneMetadata phone_metadata = 8; 48 } 49 50 // A byte array containing an undefined message. This field may contain 51 // supplemental information for a message_data, or contain all of the 52 // data for the PhoneToCarMessage. 53 bytes metadata = 9; 54} 55 56// Message to be sent from the IHU SDK to the phone SDK. 57message CarToPhoneMessage { 58 // The unique key of the message notification, same in phone and car. 59 // This will be the StatusBarNotification id of the original message 60 // notification posted on the phone. 61 string notification_key = 1; 62 63 // An action request to be fulfilled on the Phone side. 64 Action action_request = 2; 65 66 // A byte array containing an undefined message. This field may contain 67 // supplemental information for a message_data, or contain all of the 68 // data for the CarToPhoneMessage. 69 bytes metadata = 3; 70} 71 72// Message to be sent from the Phone SDK to the IHU SDK after an Action 73// has been completed. The request_id in this update will correspond to 74// the request_id of the original Action message. 75message ActionStatusUpdate { 76 // The different result types after completing an action. 77 enum Status { 78 UNKNOWN = 0; 79 SUCCESSFUL = 1; 80 ERROR = 2; 81 } 82 83 // Unique ID of the action. 84 string request_id = 1; 85 86 // The status of completing the action. 87 Status status = 2; 88 89 // Optional error message / explanation if the status resulted in an error. 90 string error_explanation = 3; 91} 92 93// A message notification originating from the user's phone. 94message ConversationNotification { 95 96 // Display name of the application that posted this notification. 97 string messaging_app_display_name = 1; 98 99 // Package name of the application that posted this notification. 100 string messaging_app_package_name = 2; 101 102 // MessagingStyle metadata of this conversation. 103 MessagingStyle messaging_style = 3; 104 105 // The time, in milliseconds, this message notification was last updated. 106 int64 time_ms = 4; 107 108 // Small app icon of the application that posted this notification. 109 bytes app_icon = 5; 110} 111 112// MessagingStyle metadata that matches MessagingStyle formatting. 113message MessagingStyle { 114 // List of messages and their metadata. 115 repeated MessagingStyleMessage messaging_style_msg = 1; 116 117 // The Conversation title of this conversation. 118 string convo_title = 2; 119 120 // String of the user, needed for MessagingStyle. 121 string user_display_name = 3; 122 123 // True if this is a group conversation. 124 bool is_group_convo = 4; 125} 126 127// Message metadata that matches MessagingStyle formatting. 128message MessagingStyleMessage { 129 // Contents of the message. 130 string text_message = 1; 131 132 // Timestamp of when the message notification was originally posted on the 133 // phone. 134 int64 timestamp = 2; 135 136 // Details of the sender who sent the message. 137 Person sender = 3; 138 139 // If the message is read on the phone. 140 bool is_read = 4; 141} 142 143// Sends over an avatar icon. This should be sent once per unique sender 144// (per unique app) during a phone to car connection. 145message AvatarIconSync { 146 // Metadata of the person. 147 Person person = 1; 148 149 // Display name of the application that posted this notification. 150 string messaging_app_display_name = 2; 151 152 // Package name of the application that posted this notification. 153 string messaging_app_package_name = 3; 154} 155 156// Request to clear all internal data and remove notifications for 157// a specific messaging application. 158message ClearAppDataRequest { 159 // Specifies which messaging app's data to remove. 160 string messaging_app_package_name = 1; 161} 162 163// Message to inform whether user has disabled/enabled this feature. 164message FeatureEnabledStateChange { 165 // Enabled state of the feature. 166 bool enabled = 1; 167} 168 169// Details of the phone that is connected to the IHU. 170message PhoneMetadata { 171 // MAC address of the phone. 172 string bluetooth_device_address = 1; 173} 174 175// Metadata about a sender. 176message Person { 177 // Sender's name. 178 string name = 1; 179 180 // Sender's avatar icon. 181 bytes avatar = 2; 182 183 // Sender's low-resolution thumbnail 184 bytes thumbnail = 3; 185} 186 187// Action on a notification, initiated by the user on the IHU. 188message Action { 189 // Different types of actions user can do on the IHU notification. 190 enum ActionName { 191 UNKNOWN_ACTION_NAME = 0; 192 MARK_AS_READ = 1; 193 REPLY = 2; 194 DISMISS = 3; 195 } 196 197 // Same as the PhoneToCar and CarToPhone messages's notification_key. 198 // As mentioned above, this notification id should be the same on the 199 // phone and the car. This will be the StatusBarNotification id of the 200 // original message notification posted on the phone. 201 string notification_key = 1; 202 203 //Optional, used to capture data like the reply string. 204 repeated MapEntry map_entry = 2; 205 206 // Name of the action. 207 ActionName action_name = 3; 208 209 // Unique id of this action. 210 string request_id = 4; 211} 212 213// Backwards compatible way of supporting a map. 214message MapEntry { 215 // Key for the map. 216 string key = 1; 217 218 // Value that is mapped to this key. 219 string value = 2; 220} 221