fastpair_data.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. syntax = "proto2";
  5. package nearby.fastpair;
  6. import "context_fence.proto";
  7. import "enums.proto";
  8. import "message_set.proto";
  9. // Information about Fast Pair. This will either contain an account key and
  10. // discovery item bytes or an opt in status.
  11. message FastPairInfo {
  12. // Footprints stores data contained in the message set, see
  13. // https://g3doc.corp.google.com/personalization/footprints/g3doc/client-docs/index.md#data-format-and-storage
  14. extend proto2.bridge.MessageSet {
  15. optional FastPairInfo message_set_extension = 190536965;
  16. }
  17. oneof info {
  18. OptInStatus opt_in_status = 1;
  19. FastPairDevice device = 2;
  20. }
  21. }
  22. // A device that has been Fast Paired with.
  23. message FastPairDevice {
  24. // The account key which was written to the device after pairing completed.
  25. optional bytes account_key = 1;
  26. // The stored discovery item which represents the notification that should be
  27. // associated with the device. Note, this is stored as a raw byte array
  28. // instead of StoredDiscoveryItem because icing only supports proto lite and
  29. // StoredDiscoveryItem is handed around as a nano proto in implementation,
  30. // which are not compatible with each other.
  31. optional bytes discovery_item_bytes = 3;
  32. // SHA256 of "account key + headset's public address", this is used to
  33. // identify the paired headset. Because of adding account key to generate the
  34. // hash value, it makes the information anonymous, even for the same headset,
  35. // different accounts have different values.
  36. optional bytes sha256_account_key_public_address = 4;
  37. // Deprecated fields.
  38. reserved 2;
  39. }
  40. // Additional images for True Wireless Fast Pair devices.
  41. message TrueWirelessHeadsetImages {
  42. // Image URL for the left bud.
  43. optional string left_bud_url = 1;
  44. // Image URL for the right bud.
  45. optional string right_bud_url = 2;
  46. // Image URL for the case.
  47. optional string case_url = 3;
  48. }
  49. message CompanionAppDetails {
  50. // Companion app slice provider's authority.
  51. optional string authority = 1;
  52. // Companion app certificate value.
  53. optional string certificate_hash = 2;
  54. // Deprecated fields.
  55. reserved 3;
  56. }
  57. // Relevance indicates how relevant the item is to the user.
  58. message Relevance {
  59. // REQUIRED
  60. // Whether the item is good, ok, poor, etc. Corresponds to levels found in
  61. // the Discoverer Notification Policy Worksheet:
  62. // https://docs.google.com/a/google.com/spreadsheets/d/1atc1-RNLb7fAGvGdWXlh86Qy2IY9T_dj2v4gFUhdPF0/edit?usp=sharing
  63. optional Evaluation evaluation = 1;
  64. // To get this relevance, the item can be at most this far away.
  65. // Note: Supported in v11+.
  66. // TODO(jfarfel): Replace with Targeting.
  67. optional double max_distance = 2;
  68. // To get this relevance, the item must pass this targeting rule (if set).
  69. // Note: Supported in v11+. Prior to v11, clients expected targeting to be
  70. // set via field 12 on the NearbyItem.
  71. // See go/discoverer-notification-targeting
  72. // TODO(jfarfel): Replace with Targeting.
  73. optional personalization.context.ContextFence targeting_fence = 3;
  74. }
  75. message StoredRelevance {
  76. optional Relevance relevance = 1;
  77. // The last time that this relevance passed targeting. A relevance with no
  78. // targeting always passes. Null if it failed, or we haven't checked yet.
  79. optional int64 targeting_true_millis = 2;
  80. }
  81. // Additional information relevant only for Fast Pair devices.
  82. message FastPairInformation {
  83. // When true, Fast Pair will only create a bond with the device and not
  84. // attempt to connect any profiles (for example, A2DP or HFP).
  85. // TODO(b/128545971): Transition this to a feature.
  86. optional bool data_only_connection = 1;
  87. // The type of the manufacturer (first party, third party, etc).
  88. optional ManufacturerType manufacturer_type = 2;
  89. // Additional images that are attached specifically for true wireless Fast
  90. // Pair devices.
  91. optional TrueWirelessHeadsetImages true_wireless_images = 3;
  92. // When true, this device can support assistant function.
  93. // TODO(b/128545971): Transition this to a feature.
  94. optional bool assistant_supported = 4;
  95. // Features supported by the Fast Pair device.
  96. repeated FastPairFeature features = 5;
  97. // Optional, the name of the company producing this Fast Pair device.
  98. optional string company_name = 6;
  99. // Optional, the type of device.
  100. optional DeviceType device_type = 7;
  101. }
  102. message FastPairStrings {
  103. // Required for initial pairing, used when there is a Google account on the
  104. // device
  105. optional string tap_to_pair_with_account = 1;
  106. // Required for initial pairing, used when there is no Google account on the
  107. // device
  108. optional string tap_to_pair_without_account = 2;
  109. // Description for initial pairing
  110. optional string initial_pairing_description = 3;
  111. // Description after successfully paired the device with companion app
  112. // installed
  113. optional string pairing_finished_companion_app_installed = 4;
  114. // Description after successfully paired the device with companion app not
  115. // installed
  116. optional string pairing_finished_companion_app_not_installed = 5;
  117. // Description when phone found the device that associates with user's account
  118. // before remind user to pair with new device.
  119. optional string subsequent_pairing_description = 6;
  120. // Description when fast pair finds the user paired with device manually
  121. // reminds user to opt the device into cloud.
  122. optional string retroactive_pairing_description = 7;
  123. // Description when user click setup device while device is still pairing
  124. optional string wait_app_launch_description = 8;
  125. // Description when user fail to pair with device
  126. optional string pairing_fail_description = 9;
  127. // Title to ask the user to confirm the pin code.
  128. optional string confirm_pin_title = 10;
  129. // Description to ask the user to confirm the pin code.
  130. optional string confirm_pin_description = 11;
  131. // The title of the UI to ask the user to confirm to sync contacts.
  132. optional string sync_contacts_title = 12;
  133. // The description of the UI to ask the user to confirm to sync contacts.
  134. optional string sync_contacts_description = 13;
  135. // The title of the UI to ask the user to confirm to sync SMS.
  136. optional string sync_sms_title = 14;
  137. // The description of the UI to ask the user to confirm to sync SMS.
  138. optional string sync_sms_description = 15;
  139. // The description for half sheet to ask user to setup google assistant.
  140. optional string assistant_half_sheet_description = 16;
  141. // The description for notification to ask user to setup google assistant.
  142. optional string assistant_notification_description = 17;
  143. }
  144. // Data for a DiscoveryItem created from server response and client scan result.
  145. // Only caching original data from scan result, server response, timestamps
  146. // and user actions. Do not save generated data in this object.
  147. message StoredDiscoveryItem {
  148. enum State {
  149. // Default unknown state.
  150. STATE_UNKNOWN = 0;
  151. // The item is normal.
  152. STATE_ENABLED = 1;
  153. // The item has been muted by user.
  154. STATE_MUTED = 2;
  155. // The item has been disabled by us (likely temporarily).
  156. STATE_DISABLED_BY_SYSTEM = 3;
  157. }
  158. // The status of the item.
  159. enum DebugMessageCategory {
  160. // Default unknown state.
  161. STATUS_UNKNOWN = 0;
  162. // The item is valid and visible in notification.
  163. STATUS_VALID_NOTIFICATION = 1;
  164. // The item made it to list but not to notification.
  165. STATUS_VALID_LIST_VIEW = 2;
  166. // The item is filtered out on client. Never made it to list view.
  167. STATUS_DISABLED_BY_CLIENT = 3;
  168. // The item is filtered out by server. Never made it to client.
  169. STATUS_DISABLED_BY_SERVER = 4;
  170. }
  171. enum ExperienceType {
  172. EXPERIENCE_UNKNOWN = 0;
  173. EXPERIENCE_GOOD = 1;
  174. EXPERIENCE_BAD = 2;
  175. }
  176. // REQUIRED
  177. // Offline item: unique ID generated on client.
  178. // Online item: unique ID generated on server.
  179. optional string id = 1;
  180. // REQUIRED
  181. optional NearbyType type = 2;
  182. // REQUIRED
  183. // The most recent all upper case mac associated with this item.
  184. // (Mac-to-DiscoveryItem is a many-to-many relationship)
  185. optional string mac_address = 4;
  186. // REQUIRED
  187. optional string action_url = 5;
  188. // The bluetooth device name from advertisment
  189. optional string device_name = 6;
  190. // REQUIRED
  191. // Item's title
  192. optional string title = 7;
  193. // Item's description.
  194. optional string description = 8;
  195. // The URL for display
  196. optional string display_url = 9;
  197. // REQUIRED
  198. // Client timestamp when the beacon was last observed in BLE scan.
  199. optional int64 last_observation_timestamp_millis = 10;
  200. // REQUIRED
  201. // Client timestamp when the beacon was first observed in BLE scan.
  202. optional int64 first_observation_timestamp_millis = 11;
  203. // REQUIRED
  204. // Item's current state. e.g. if the item is blocked.
  205. optional State state = 17;
  206. // The resolved url type for the action_url.
  207. optional ResolvedUrlType action_url_type = 19;
  208. // The timestamp when the user is redirected to Play Store after clicking on
  209. // the item.
  210. optional int64 pending_app_install_timestamp_millis = 20;
  211. // Beacon's RSSI value
  212. optional int32 rssi = 22;
  213. // Beacon's tx power
  214. optional int32 tx_power = 23;
  215. // Human readable name of the app designated to open the uri
  216. // Used in the second line of the notification, "Open in {} app"
  217. optional string app_name = 25;
  218. // ID used for associating several DiscoveryItems. These items may be
  219. // visually displayed together.
  220. optional string group_id = 26;
  221. // The timestamp when the attachment was created on PBS server. In case there
  222. // are duplicate
  223. // items with the same scanId/groupID, only show the one with the latest
  224. // timestamp.
  225. optional int64 attachment_creation_sec = 28;
  226. // Whether the attachment is created in debug namespace
  227. optional DiscoveryAttachmentType attachment_type = 29;
  228. // Package name of the App that owns this item.
  229. optional string package_name = 30;
  230. // The average star rating of the app.
  231. optional float star_rating = 31;
  232. // The "feature" graphic image url used for large sized list view entries.
  233. optional string feature_graphic_url = 32;
  234. // TriggerId identifies the trigger/beacon that is attached with a message.
  235. // It's generated from server for online messages to synchronize formatting
  236. // across client versions.
  237. // Example:
  238. // * BLE_UID: 3||deadbeef
  239. // * BLE_URL: http://trigger.id
  240. // See go/discovery-store-message-and-trigger-id for more details.
  241. optional string trigger_id = 34;
  242. // Bytes of item icon in PNG format displayed in Discovery item list.
  243. optional bytes icon_png = 36;
  244. // Message written to bugreport for 3P developers.(No sensitive info)
  245. // null if the item is valid
  246. optional string debug_message = 37;
  247. // Weather the item is filtered out on server.
  248. optional DebugMessageCategory debug_category = 38;
  249. // How relevant the message is to the user. May be used by the client to
  250. // determine how to display the NearbyItem. >1 relevance makes sense only if
  251. // each has targeting (e.g., a maximum distance threshold). In that case, the
  252. // item's relevance is the maximum one where the targeting is satisfied.
  253. repeated StoredRelevance stored_relevances = 40;
  254. // Client timestamp when the trigger (e.g. beacon) was last lost (e.g. when
  255. // Messages told us the beacon's no longer nearby).
  256. optional int64 lost_millis = 41;
  257. // The kind of expereince the user last had with this (e.g. if they dismissed
  258. // the notification, that's bad; but if they tapped it, that's good).
  259. optional ExperienceType last_user_experience = 42;
  260. // The most recent BLE advertisement related to this item.
  261. optional bytes ble_record_bytes = 43;
  262. // An ID generated on the server to uniquely identify content.
  263. optional string entity_id = 44;
  264. // See equivalent field in NearbyItem.
  265. optional bytes authentication_public_key_secp256r1 = 45;
  266. // See equivalent field in NearbyItem.
  267. optional FastPairInformation fast_pair_information = 46;
  268. // Companion app detail.
  269. optional CompanionAppDetails companion_detail = 47;
  270. // Fast pair strings
  271. optional FastPairStrings fast_pair_strings = 48;
  272. // Deprecated fields.
  273. reserved 3, 12, 13, 14, 15, 16, 18, 21, 24, 27, 33, 35, 39;
  274. }