Add fast pair proto to third_party/nearby/fastpair

PiperOrigin-RevId: 540977348
This commit is contained in:
Qin Wang
2023-06-16 13:09:38 -07:00
committed by Copybara-Service
parent 44fb9b4fa2
commit 4b13033389
5 changed files with 608 additions and 10 deletions
+3
View File
@@ -5,7 +5,10 @@ licenses(["notice"])
proto_library(
name = "fastpair_proto",
srcs = [
"cache.proto",
"data.proto",
"enum.proto",
"fast_pair_string.proto",
"fastpair_rpcs.proto",
],
visibility = [
+93
View File
@@ -0,0 +1,93 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package nearby.fastpair.proto;
import "third_party/nearby/fastpair/proto/enum.proto";
option java_multiple_files = true;
// The buffer size range of a Fast Pair devices support dynamic buffer size.
message BufferSizeRange {
// The max buffer size in ms.
optional int32 max_size = 1;
// The min buffer size in ms.
optional int32 min_size = 2;
// The default buffer size in ms.
optional int32 default_size = 3;
// The codec of this buffer size range.
optional int32 codec = 4;
}
// A locally cached Fast Pair device associating an account key with the
// bluetooth address of the device.
message StoredFastPairItem {
// The device's public mac address.
string mac_address = 1;
// The account key written to the device.
bytes account_key = 2;
// When user need to update provider name, enable this value to trigger
// writing new name to provider.
optional bool need_to_update_provider_name = 3;
// The retry times to update name into provider.
optional int32 update_name_retries = 4;
// Latest firmware version from the server.
optional string latest_firmware_version = 5;
// The firmware version that is on the device.
optional string device_firmware_version = 6;
// The timestamp from the last time we fetched the firmware version from the
// device.
optional int64 last_check_firmware_timestamp_millis = 7;
// The timestamp from the last time we fetched the firmware version from
// server.
optional int64 last_server_query_timestamp_millis = 8;
// Only allows one bloom filter check process to create gatt connection and
// try to read the firmware version value.
optional bool can_read_firmware = 9;
// Device's model id.
string model_id = 10;
// Features that this Fast Pair device supports.
repeated FastPairFeature features = 11;
// When true, the latest uploaded event to FMA is connected. We use
// it as the previous ACL state when getting the BluetoothAdapter STATE_OFF to
// determine if need to upload the disconnect event to FMA.
optional bool fma_state_is_connected = 13;
// Device's buffer size range.
repeated BufferSizeRange buffer_size_ranges = 18;
// The additional account key if this device could be associated with multiple
// accounts. Notes that for this device, the account_key field is the basic
// one which will not be associated with the accounts.
repeated bytes additional_account_keys = 19;
// Deprecated fields.
reserved 14, 15, 16, 17;
}
+229 -10
View File
@@ -12,10 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto2";
syntax = "proto3";
package nearby.fastpair.proto;
import "third_party/nearby/fastpair/proto/enum.proto";
import "third_party/nearby/fastpair/proto/fast_pair_string.proto";
option java_multiple_files = true;
// Information about Fast Pair. This will either contain a Fast Pair device
@@ -30,29 +33,245 @@ message FastPairInfo {
// A device that has been Fast Paired with.
message FastPairDevice {
// The account key which was written to the device after pairing completed.
optional bytes account_key = 1;
bytes account_key = 1;
// The stored discovery item which represents the notification that should be
// associated with the device. Note, this is stored as a raw byte array
// instead of StoredDiscoveryItem because icing only supports proto lite and
// StoredDiscoveryItem is handed around as a nano proto in implementation,
// which are not compatible with each other.
optional bytes discovery_item_bytes = 3;
bytes discovery_item_bytes = 3;
// SHA256 of "account key + headset's public address", this is used to
// identify the paired headset. Because of adding account key to generate the
// hash value, it makes the information anonymous, even for the same headset,
// different accounts have different values.
optional bytes sha256_account_key_public_address = 4;
bytes sha256_account_key_public_address = 4;
// Deprecated fields.
reserved 2;
}
// The status of the user's consent opt-in.
enum OptInStatus {
STATUS_UNKNOWN = 0;
STATUS_OPTED_IN = 1;
STATUS_OPTED_OUT = 2;
STATUS_ERROR_RETRIEVING_FROM_FOOTPRINTS_SERVER = 3;
// Additional images for True Wireless Fast Pair devices.
message TrueWirelessHeadsetImages {
// Image URL for the left bud.
optional string left_bud_url = 1;
// Image URL for the right bud.
optional string right_bud_url = 2;
// Image URL for the case.
optional string case_url = 3;
}
// Relevance indicates how relevant the item is to the user.
message Relevance {
// Whether the item is good, ok, poor, etc. Corresponds to levels found in
// the Discoverer Notification Policy Worksheet:
// https://docs.google.com/a/google.com/spreadsheets/d/1atc1-RNLb7fAGvGdWXlh86Qy2IY9T_dj2v4gFUhdPF0/edit?usp=sharing
Evaluation evaluation = 1;
// To get this relevance, the item can be at most this far away.
// Note: Supported in v11+.
// TODO(jfarfel): Replace with Targeting.
optional double max_distance = 2;
}
message StoredRelevance {
Relevance relevance = 1;
// The last time that this relevance passed targeting. A relevance with no
// targeting always passes. Null if it failed, or we haven't checked yet.
optional int64 targeting_true_millis = 2;
}
// Additional information relevant only for Fast Pair devices.
message FastPairInformation {
// When true, Fast Pair will only create a bond with the device and not
// attempt to connect any profiles (for example, A2DP or HFP).
// TODO(b/128545971): Transition this to a feature.
optional bool data_only_connection = 1;
// Additional images that are attached specifically for true wireless Fast
// Pair devices.
optional TrueWirelessHeadsetImages true_wireless_images = 3;
}
// Data for a DiscoveryItem created from server response and client scan result.
// Only caching original data from scan result, server response, timestamps
// and user actions. Do not save generated data in this object.
// Next ID: 51
message StoredDiscoveryItem {
enum State {
// Default unknown state.
STATE_UNKNOWN = 0;
// The item is normal.
STATE_ENABLED = 1;
// The item has been muted by user.
STATE_MUTED = 2;
// The item has been disabled by us (likely temporarily).
STATE_DISABLED_BY_SYSTEM = 3;
}
// The status of the item.
enum DebugMessageCategory {
// Default unknown state.
STATUS_UNKNOWN = 0;
// The item is valid and visible in notification.
STATUS_VALID_NOTIFICATION = 1;
// The item made it to list but not to notification.
STATUS_VALID_LIST_VIEW = 2;
// The item is filtered out on client. Never made it to list view.
STATUS_DISABLED_BY_CLIENT = 3;
// The item is filtered out by server. Never made it to client.
STATUS_DISABLED_BY_SERVER = 4;
}
enum ExperienceType {
EXPERIENCE_UNKNOWN = 0;
EXPERIENCE_GOOD = 1;
EXPERIENCE_BAD = 2;
}
// REQUIRED
// Offline item: unique ID generated on client.
// Online item: unique ID generated on server.
optional string id = 1;
// REQUIRED
optional NearbyType type = 2;
// REQUIRED
// The most recent all upper case mac associated with this item.
// (Mac-to-DiscoveryItem is a many-to-many relationship)
optional string mac_address = 4;
// REQUIRED
optional string action_url = 5;
// The bluetooth device name from advertisment
optional string device_name = 6;
// REQUIRED
// Item's title
optional string title = 7;
// Item's description.
optional string description = 8;
// The URL for display
optional string display_url = 9;
// REQUIRED
// Client timestamp when the beacon was last observed in BLE scan.
optional int64 last_observation_timestamp_millis = 10;
// REQUIRED
// Client timestamp when the beacon was first observed in BLE scan.
optional int64 first_observation_timestamp_millis = 11;
// REQUIRED
// Item's current state. e.g. if the item is blocked.
optional State state = 17;
// The resolved url type for the action_url.
optional ResolvedUrlType action_url_type = 19;
// The timestamp when the user is redirected to Play Store after clicking on
// the item.
optional int64 pending_app_install_timestamp_millis = 20;
// Beacon's RSSI value
optional int32 rssi = 22;
// Beacon's tx power
optional int32 tx_power = 23;
// Human readable name of the app designated to open the uri
// Used in the second line of the notification, "Open in {} app"
optional string app_name = 25;
// ID used for associating several DiscoveryItems. These items may be
// visually displayed together.
optional string group_id = 26;
// The timestamp when the attachment was created on PBS server. In case there
// are duplicate
// items with the same scanId/groupID, only show the one with the latest
// timestamp.
optional int64 attachment_creation_sec = 28;
// Package name of the App that owns this item.
optional string package_name = 30;
// The average star rating of the app.
optional float star_rating = 31;
// The "feature" graphic image url used for large sized list view entries.
optional string feature_graphic_url = 32;
// TriggerId identifies the trigger/beacon that is attached with a message.
// It's generated from server for online messages to synchronize formatting
// across client versions.
// Example:
// * BLE_UID: 3||deadbeef
// * BLE_URL: http://trigger.id
// See go/discovery-store-message-and-trigger-id for more details.
optional string trigger_id = 34;
// Bytes of item icon in PNG format displayed in Discovery item list.
optional bytes icon_png = 36;
// How relevant the message is to the user. May be used by the client to
// determine how to display the NearbyItem. >1 relevance makes sense only if
// each has targeting (e.g., a maximum distance threshold). In that case, the
// item's relevance is the maximum one where the targeting is satisfied.
repeated StoredRelevance stored_relevances = 40;
// A FIFE URL of the item icon displayed in Discovery item list.
optional string icon_fife_url = 49;
// Message written to bugreport for 3P developers.(No sensitive info)
// null if the item is valid
optional string debug_message = 37;
// Weather the item is filtered out on server.
optional DebugMessageCategory debug_category = 38;
// Client timestamp when the trigger (e.g. beacon) was last lost (e.g. when
// Messages told us the beacon's no longer nearby).
optional int64 lost_millis = 41;
// The kind of expereince the user last had with this (e.g. if they dismissed
// the notification, that's bad; but if they tapped it, that's good).
optional ExperienceType last_user_experience = 42;
// The most recent BLE advertisement related to this item.
optional bytes ble_record_bytes = 43;
// An ID generated on the server to uniquely identify content.
optional string entity_id = 44;
// See equivalent field in NearbyItem.
optional bytes authentication_public_key_secp256r1 = 45;
// See equivalent field in NearbyItem.
optional FastPairInformation fast_pair_information = 46;
// Fast pair strings
optional FastPairStrings fast_pair_strings = 48;
// The time of the account key's association.
// We use device local time for this field, so could be inaccurate.
optional int64 account_key_association_local_timestamp_ms = 50;
// Deprecated fields.
reserved 3, 12, 13, 14, 15, 16, 18, 21, 24, 27, 33, 35, 39;
}
+78
View File
@@ -0,0 +1,78 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package nearby.fastpair.proto;
option java_multiple_files = true;
// Features that can be enabled for a Fast Pair device.
enum FastPairFeature {
FAST_PAIR_FEATURE_UNKNOWN = 0;
FAST_PAIR_FEATURE_SILENCE_MODE = 1;
FAST_PAIR_FEATURE_WIRELESS_CHARGING = 2;
FAST_PAIR_FEATURE_DYNAMIC_BUFFER_SIZE = 3;
FAST_PAIR_FEATURE_NO_PERSONALIZED_NAME = 4;
FAST_PAIR_FEATURE_EDDYSTONE_TRACKING = 5;
FAST_PAIR_FEATURE_SMART_AUDIO_SOURCE_SWITCHING = 6;
FAST_PAIR_FEATURE_NOT_SUPPORTED_RING = 7;
}
// The status of the user's consent opt-in.
enum OptInStatus {
OPT_IN_STATUS_UNKNOWN = 0;
OPT_IN_STATUS_OPTED_IN = 1;
OPT_IN_STATUS_OPTED_OUT = 2;
OPT_IN_STATUS_ERROR_RETRIEVING_FROM_FOOTPRINTS_SERVER = 3;
}
// The type of a NearbyItem. Determines how the item is handled (e.g. we may
// display a different notification style for different types). It may not
// indicate the source of the data (e.g., an attachment on the Proximity Beacon
// Service that represents a device needing to be set up might become a
// NearbyItem with type=DEVICE).
enum NearbyType {
NEARBY_TYPE_UNKNOWN = 0;
// Proximity Beacon Service (PBS). This is the only type of nearbyItems which
// can be customized by 3p and therefore the intents passed should not be
// completely trusted. Deprecated already.
NEARBY_TYPE_PROXIMITY_BEACON = 1;
// Physical Web URL beacon. Deprecated already.
NEARBY_TYPE_PHYSICAL_WEB = 2;
NEARBY_TYPE_CHROMECAST = 3;
NEARBY_TYPE_WEAR = 4;
NEARBY_TYPE_DEVICE = 6;
NEARBY_TYPE_POPULAR_HERE = 7;
}
enum ResolvedUrlType {
RESOLVED_URL_TYPE_UNKNOWN = 0;
RESOLVED_URL_TYPE_WEBPAGE = 1;
RESOLVED_URL_TYPE_APP = 2;
}
// Used when evaluating Relevance of a NearbyItem
// Values correspond to levels in the Discoverer Notification Policy Worksheet:
// https://docs.google.com/a/google.com/spreadsheets/d/1atc1-RNLb7fAGvGdWXlh86Qy2IY9T_dj2v4gFUhdPF0/edit?usp=sharing
enum Evaluation {
EVALUATION_UNKNOWN = 0;
EVALUATION_BAD = 100;
EVALUATION_POOR = 200;
EVALUATION_NEUTRAL = 300;
EVALUATION_OK = 400;
EVALUATION_GOOD = 500;
EVALUATION_GREAT = 600;
EVALUATION_AMAZING = 700;
}
+205
View File
@@ -0,0 +1,205 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package nearby.fastpair.proto;
option java_multiple_files = true;
// Data for Fast Pair related string
message FastPairStrings {
// Required for initial pairing, used when there is a Google account on the
// device
string tap_to_pair_with_account = 1;
// Required for initial pairing, used when there is no Google account on the
// device
string tap_to_pair_without_account = 2;
// Description for initial pairing
optional string initial_pairing_description = 3;
// Description after successfully paired the device with companion app
// installed
optional string pairing_finished_companion_app_installed = 4;
// Description after successfully paired the device with companion app not
// installed
optional string pairing_finished_companion_app_not_installed = 5;
// Description when phone found the device that associates with user's account
// before remind user to pair with new device.
optional string subsequent_pairing_description = 6;
// TV Description when phone found the device that associates with user's
// account before remind user to pair with new device.
optional string subsequent_pairing_description_on_tv = 65;
// Description when fast pair finds the user paired with device manually
// reminds user to opt the device into cloud.
optional string retroactive_pairing_description = 7;
// Description when user click setup device while device is still pairing
optional string wait_app_launch_description = 8;
// Description when user fail to pair with device
optional string pairing_fail_description = 9;
// Title to ask the user to confirm the pin code.
optional string confirm_pin_title = 10;
// Description to ask the user to confirm the pin code.
optional string confirm_pin_description = 11;
// The title of the UI to ask the user to confirm to sync contacts.
optional string sync_contacts_title = 12;
// The description of the UI to ask the user to confirm to sync contacts.
optional string sync_contacts_description = 13;
// The title of the UI to ask the user to confirm to sync SMS.
optional string sync_sms_title = 14;
// The description of the UI to ask the user to confirm to sync SMS.
optional string sync_sms_description = 15;
// The description for half sheet to ask user to setup google assistant.
optional string assistant_half_sheet_description = 16;
// The description for notification to ask user to setup google assistant.
optional string assistant_notification_description = 17;
// Description of the connect device action on TV, when user is not logged in.
optional string fast_pair_tv_connect_device_no_account_description = 18;
// Description for wear os pairing on the slice.
optional string wear_os_tap_to_set_up = 19;
// If present then this title will be used for the initial connect half sheet.
optional string initial_connect_sheet_title = 30;
optional string finder_enable_sheet_title = 20;
optional string finder_enable_sheet_find_device_toggle = 21;
optional string finder_enable_sheet_finder_network_title = 22;
optional string finder_enable_sheet_finder_network_toggle = 23;
optional string finder_enable_sheet_description_find_nearby_devices_info = 24;
optional string finder_enable_sheet_description_location_anonymous_info = 25;
optional string finder_enable_sheet_description_location_encrypted_info = 26;
optional string finder_enable_sheet_description_turn_off_in_settings = 27;
optional string finder_enable_sheet_beacon_description = 31;
optional string finder_enable_sheet_add_tracking = 32;
optional string finder_enable_sheet_location_encrypted = 33;
optional string finder_enable_sheet_add_to_find_my_device_button = 34;
optional string finder_enable_sheet_adding_device = 35;
optional string finder_enable_sheet_download_device_app = 36;
optional string finder_enable_sheet_download_find_my_device = 37;
optional string finder_enable_sheet_download_find_my_device_description = 38;
optional string finder_enable_sheet_added_device = 39;
optional string finder_enable_sheet_generic_failure_title = 40;
optional string finder_enable_sheet_generic_failure_details = 41;
optional string finder_enable_sheet_device_already_provisioned_title = 42;
optional string finder_enable_sheet_device_already_provisioned_description =
43;
optional string finder_enable_sheet_use_find_my_device_description = 44;
optional string finder_enable_sheet_use_find_my_device_button = 45;
optional string finder_enable_sheet_enable_last_known_location_description =
46;
optional string finder_enable_sheet_enable_last_known_location_learn_more =
112;
optional string finder_enable_sheet_enable_last_known_location_button = 47;
optional string finder_enable_sheet_leave_dialog_title = 48;
optional string finder_enable_sheet_leave_dialog_content = 49;
optional string finder_enable_sheet_leave_dialog_continue_setup_button = 50;
optional string finder_enable_sheet_leave_dialog_leave_button = 51;
optional string finder_enable_sheet_device_added_toast = 52;
optional string
finder_enable_sheet_already_provisioned_shared_device_button_title = 53;
optional string
finder_enable_sheet_already_provisioned_shared_device_button_subtitle =
54;
optional string
finder_enable_sheet_already_provisioned_take_ownership_button_title = 55;
optional string
finder_enable_sheet_already_provisioned_take_ownership_button_subtitle =
56;
optional string finder_enable_sheet_shared_device_title = 57;
optional string finder_enable_sheet_shared_device_description = 58;
optional string finder_enable_sheet_take_ownership_title = 59;
optional string finder_enable_sheet_take_ownership_forget_device_title = 60;
optional string finder_enable_sheet_take_ownership_forget_device_subtitle =
61;
optional string finder_enable_sheet_take_ownership_factory_reset_title = 62;
optional string finder_enable_sheet_take_ownership_factory_reset_subtitle =
63;
optional string finder_enable_sheet_take_ownership_pair_device_title = 64;
optional string finder_enable_sheet_fast_pair_prompt_sub_image_text = 66;
optional string finder_enable_sheet_pairing_failure_title = 67;
optional string finder_enable_sheet_pairing_failure_subtitle = 68;
optional string finder_enable_sheet_too_many_failures_subtitle = 69;
optional string finder_enable_sheet_too_many_failures_button = 70;
optional string finder_enable_sheet_provisioning_prompt_description = 71;
optional string finder_enable_sheet_provisioning_learn_more = 72;
optional string finder_enable_sheet_take_ownership_positive_button = 73;
optional string finder_enable_sheet_factory_reset_positive_button = 74;
optional string finder_enable_sheet_use_find_my_device_title = 75;
optional string finder_enable_sheet_enable_location_title = 76;
optional string finder_enable_sheet_enable_location_description = 77;
optional string finder_enable_sheet_enable_last_known_location_title = 78;
optional string
finder_enable_sheet_pairing_and_provisioning_completed_description = 79;
optional string finder_enable_sheet_start_using_device_title = 80;
optional string finder_enable_sheet_retroactive_pair_description = 82;
optional string finder_enable_sheet_shared_device_learn_more = 83;
optional string finder_enable_sheet_provisioning_failure_title = 84;
optional string finder_enable_sheet_provisioning_failure_subtitle = 85;
optional string finder_enable_sheet_too_many_failures_title = 86;
optional string finder_upgrade_notification_title = 87;
optional string finder_upgrade_notification_content = 88;
optional string
finder_enable_sheet_retroactive_pairing_already_provisioned_sub_image_text =
89;
optional string finder_enable_sheet_retroactive_provisioning_title = 90;
optional string finder_enable_sheet_retroactive_provisioning_description = 91;
optional string finder_enable_sheet_retroactive_provisioning_learn_more = 92;
optional string finder_enable_sheet_retroactive_provisioning_sub_image_text =
93;
optional string finder_enable_sheet_invalid_android_version_title = 94;
optional string finder_enable_sheet_invalid_android_version_description = 95;
optional string finder_enable_sheet_open_companion_app_title = 96;
optional string finder_enable_sheet_open_companion_app_description = 97;
optional string finder_enable_sheet_lock_screen_title = 98;
optional string finder_enable_sheet_lock_screen_description = 99;
optional string finder_enable_sheet_lock_screen_dialog_title = 100;
optional string finder_enable_sheet_lock_screen_dialog_content = 101;
optional string finder_enable_sheet_lock_screen_set_button = 109;
optional string finder_enable_sheet_lock_screen_dialog_continue_setup_button =
102;
optional string finder_enable_sheet_lock_screen_dialog_leave_button = 103;
optional string finder_enable_sheet_lock_screen_learn_more = 111;
optional string finder_enable_sheet_finder_network_prompt_title = 104;
optional string finder_enable_sheet_finder_network_prompt_description = 105;
optional string finder_enable_sheet_finder_network_prompt_join_button = 113;
optional string finder_enable_sheet_finder_network_prompt_learn_more = 114;
optional string finder_enable_sheet_acceptable_use_prompt_title = 106;
optional string finder_enable_sheet_acceptable_use_prompt_description = 107;
optional string finder_enable_sheet_acceptable_use_learn_more = 108;
optional string finder_enable_sheet_acceptable_use_agree_button = 110;
// Description that teaches screen-reader users to turn on the talkback on
// their watches.
optional string
accessibility_instruction_of_turning_on_talkback_on_pixel_watch = 81;
// Deleted fields.
reserved 28, 29;
}