Merge "Fix snippet part for Mainline Fast Pair API changes." into tm-dev
diff --git a/framework-t/api/system-current.txt b/framework-t/api/system-current.txt
index 03f9c8e..9fe55ce 100644
--- a/framework-t/api/system-current.txt
+++ b/framework-t/api/system-current.txt
@@ -123,7 +123,6 @@
public static class FastPairDataProviderService.FastPairManageAccountDeviceRequest {
method @NonNull public android.accounts.Account getAccount();
method @NonNull public android.nearby.FastPairAccountKeyDeviceMetadata getAccountKeyDeviceMetadata();
- method @Nullable public String getBleAddress();
method public int getRequestType();
}
@@ -138,32 +137,22 @@
}
public class FastPairDeviceMetadata {
- method @Nullable public String getAssistantSetupHalfSheet();
- method @Nullable public String getAssistantSetupNotification();
method public int getBleTxPower();
- method @Nullable public String getConfirmPinDescription();
- method @Nullable public String getConfirmPinTitle();
method @Nullable public String getConnectSuccessCompanionAppInstalled();
method @Nullable public String getConnectSuccessCompanionAppNotInstalled();
method public int getDeviceType();
method @Nullable public String getDownloadCompanionAppDescription();
method @Nullable public String getFailConnectGoToSettingsDescription();
- method @Nullable public String getFastPairTvConnectDeviceNoAccountDescription();
method @Nullable public byte[] getImage();
method @Nullable public String getImageUrl();
method @Nullable public String getInitialNotificationDescription();
method @Nullable public String getInitialNotificationDescriptionNoAccount();
method @Nullable public String getInitialPairingDescription();
method @Nullable public String getIntentUri();
- method @Nullable public String getLocale();
method @Nullable public String getName();
method @Nullable public String getOpenCompanionAppDescription();
method @Nullable public String getRetroactivePairingDescription();
method @Nullable public String getSubsequentPairingDescription();
- method @Nullable public String getSyncContactsDescription();
- method @Nullable public String getSyncContactsTitle();
- method @Nullable public String getSyncSmsDescription();
- method @Nullable public String getSyncSmsTitle();
method public float getTriggerDistance();
method @Nullable public String getTrueWirelessImageUrlCase();
method @Nullable public String getTrueWirelessImageUrlLeftBud();
@@ -177,32 +166,22 @@
public static final class FastPairDeviceMetadata.Builder {
ctor public FastPairDeviceMetadata.Builder();
method @NonNull public android.nearby.FastPairDeviceMetadata build();
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setAssistantSetupHalfSheet(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setAssistantSetupNotification(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setBleTxPower(int);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setConfirmPinDescription(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setConfirmPinTitle(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setConnectSuccessCompanionAppInstalled(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setConnectSuccessCompanionAppNotInstalled(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setDeviceType(int);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setDownloadCompanionAppDescription(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setFailConnectGoToSettingsDescription(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setFastPairTvConnectDeviceNoAccountDescription(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setImage(@Nullable byte[]);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setImageUrl(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setInitialNotificationDescription(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setInitialNotificationDescriptionNoAccount(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setInitialPairingDescription(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setIntentUri(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setLocale(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setName(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setOpenCompanionAppDescription(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setRetroactivePairingDescription(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setSubsequentPairingDescription(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setSyncContactsDescription(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setSyncContactsTitle(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setSyncSmsDescription(@Nullable String);
- method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setSyncSmsTitle(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setTriggerDistance(float);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setTrueWirelessImageUrlCase(@Nullable String);
method @NonNull public android.nearby.FastPairDeviceMetadata.Builder setTrueWirelessImageUrlLeftBud(@Nullable String);
@@ -217,24 +196,15 @@
method @Nullable public String getActionUrl();
method public int getActionUrlType();
method @Nullable public String getAppName();
- method public int getAttachmentType();
method @Nullable public byte[] getAuthenticationPublicKeySecp256r1();
- method @Nullable public byte[] getBleRecordBytes();
- method public int getDebugCategory();
- method @Nullable public String getDebugMessage();
method @Nullable public String getDescription();
method @Nullable public String getDeviceName();
method @Nullable public String getDisplayUrl();
- method @Nullable public String getEntityId();
- method @Nullable public String getFeatureGraphicUrl();
method public long getFirstObservationTimestampMillis();
- method @Nullable public String getGroupId();
method @Nullable public String getIconFfeUrl();
method @Nullable public byte[] getIconPng();
method @Nullable public String getId();
method public long getLastObservationTimestampMillis();
- method public int getLastUserExperience();
- method public long getLostMillis();
method @Nullable public String getMacAddress();
method @Nullable public String getPackageName();
method public long getPendingAppInstallTimestampMillis();
@@ -243,7 +213,6 @@
method @Nullable public String getTitle();
method @Nullable public String getTriggerId();
method public int getTxPower();
- method public int getType();
}
public static final class FastPairDiscoveryItem.Builder {
@@ -252,24 +221,15 @@
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setActionUrl(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setActionUrlType(int);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setAppName(@Nullable String);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setAttachmentType(int);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setAuthenticationPublicKeySecp256r1(@Nullable byte[]);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setBleRecordBytes(@Nullable byte[]);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setDebugCategory(int);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setDebugMessage(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setDescription(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setDeviceName(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setDisplayUrl(@Nullable String);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setEntityId(@Nullable String);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setFeatureGraphicUrl(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setFirstObservationTimestampMillis(long);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setGroupId(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setIconFfeUrl(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setIconPng(@Nullable byte[]);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setId(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setLastObservationTimestampMillis(long);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setLastUserExperience(int);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setLostMillis(long);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setMacAddress(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setPackageName(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setPendingAppInstallTimestampMillis(long);
@@ -278,7 +238,6 @@
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setTitle(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setTriggerId(@Nullable String);
method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setTxPower(int);
- method @NonNull public android.nearby.FastPairDiscoveryItem.Builder setType(int);
}
public class FastPairEligibleAccount {
@@ -445,10 +404,8 @@
field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2
field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0
field public static final int SCAN_MODE_NO_POWER = -1; // 0xffffffff
- field public static final int SCAN_TYPE_EXPOSURE_NOTIFICATION = 4; // 0x4
field public static final int SCAN_TYPE_FAST_PAIR = 1; // 0x1
- field public static final int SCAN_TYPE_NEARBY_PRESENCE = 3; // 0x3
- field public static final int SCAN_TYPE_NEARBY_SHARE = 2; // 0x2
+ field public static final int SCAN_TYPE_NEARBY_PRESENCE = 2; // 0x2
}
public static final class ScanRequest.Builder {
diff --git a/nearby/framework/java/android/nearby/FastPairDataProviderService.java b/nearby/framework/java/android/nearby/FastPairDataProviderService.java
index c6a1a65..b6c840d 100644
--- a/nearby/framework/java/android/nearby/FastPairDataProviderService.java
+++ b/nearby/framework/java/android/nearby/FastPairDataProviderService.java
@@ -479,15 +479,6 @@
return this.mRequestParcel.account;
}
/**
- * Get BleAddress.
- *
- * @hide
- */
- @SystemApi
- public @Nullable String getBleAddress() {
- return this.mRequestParcel.bleAddress;
- }
- /**
* Get account key device metadata.
*
* @hide
diff --git a/nearby/framework/java/android/nearby/FastPairDeviceMetadata.java b/nearby/framework/java/android/nearby/FastPairDeviceMetadata.java
index ea75271..04845c0 100644
--- a/nearby/framework/java/android/nearby/FastPairDeviceMetadata.java
+++ b/nearby/framework/java/android/nearby/FastPairDeviceMetadata.java
@@ -149,17 +149,6 @@
}
/**
- * Get Locale of the device.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getLocale() {
- return mMetadataParcel.locale;
- }
-
- /**
* Get InitialNotificationDescription, which is a translated string of
* "Tap to pair. Earbuds will be tied to %s" based on locale.
*
@@ -325,111 +314,6 @@
}
/**
- * Get ConfirmPinTitle, which is a translated string of
- * based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getConfirmPinTitle() {
- return mMetadataParcel.confirmPinTitle;
- }
-
- /**
- * Get ConfirmPinDescription, which is a translated string of "confirm pin" based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getConfirmPinDescription() {
- return mMetadataParcel.confirmPinDescription;
- }
-
- /**
- * Get SyncContactsTitle, which is a translated string of "sync contacts title" based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getSyncContactsTitle() {
- return mMetadataParcel.syncContactsTitle;
- }
-
- /**
- * Get SyncContactsDescription, which is a translated string of "sync contacts description"
- * based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getSyncContactsDescription() {
- return mMetadataParcel.syncContactsDescription;
- }
-
- /**
- * Get SyncSmsTitle, which is a translated string of "sync sms title" based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getSyncSmsTitle() {
- return mMetadataParcel.syncSmsTitle;
- }
-
- /**
- * Get SyncSmsDescription, which is a translated string of "sync sms description" based on
- * locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getSyncSmsDescription() {
- return mMetadataParcel.syncSmsDescription;
- }
-
- /**
- * Get AssistantSetupHalfSheet, which is a translated string of
- * "Tap to set up your Google Assistant" based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getAssistantSetupHalfSheet() {
- return mMetadataParcel.assistantSetupHalfSheet;
- }
-
- /**
- * Get AssistantSetupNotification, which is a translated string of
- * "Tap to set up your Google Assistant" based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getAssistantSetupNotification() {
- return mMetadataParcel.assistantSetupNotification;
- }
-
- /**
- * Get FastPairTvConnectDeviceNoAccountDescription, which is a translated string of
- * "Select connect to pair your %s with this device" based on locale.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getFastPairTvConnectDeviceNoAccountDescription() {
- return mMetadataParcel.fastPairTvConnectDeviceNoAccountDescription;
- }
-
- /**
* Builder used to create FastPairDeviceMetadata.
*
* @hide
@@ -457,7 +341,6 @@
mBuilderParcel.trueWirelessImageUrlLeftBud = null;
mBuilderParcel.trueWirelessImageUrlRightBud = null;
mBuilderParcel.trueWirelessImageUrlCase = null;
- mBuilderParcel.locale = null;
mBuilderParcel.initialNotificationDescription = null;
mBuilderParcel.initialNotificationDescriptionNoAccount = null;
mBuilderParcel.openCompanionAppDescription = null;
@@ -472,15 +355,6 @@
mBuilderParcel.retroactivePairingDescription = null;
mBuilderParcel.waitLaunchCompanionAppDescription = null;
mBuilderParcel.failConnectGoToSettingsDescription = null;
- mBuilderParcel.confirmPinTitle = null;
- mBuilderParcel.confirmPinDescription = null;
- mBuilderParcel.syncContactsTitle = null;
- mBuilderParcel.syncContactsDescription = null;
- mBuilderParcel.syncSmsTitle = null;
- mBuilderParcel.syncSmsDescription = null;
- mBuilderParcel.assistantSetupHalfSheet = null;
- mBuilderParcel.assistantSetupNotification = null;
- mBuilderParcel.fastPairTvConnectDeviceNoAccountDescription = null;
}
/**
@@ -628,20 +502,6 @@
}
/**
- * Set Locale.
- *
- * @param locale Device locale.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setLocale(@Nullable String locale) {
- mBuilderParcel.locale = locale;
- return this;
- }
-
- /**
* Set InitialNotificationDescription.
*
* @param initialNotificationDescription Initial notification description.
@@ -862,140 +722,6 @@
}
/**
- * Set ConfirmPinTitle.
- *
- * @param confirmPinTitle Title of the UI to ask the user to confirm the pin code.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setConfirmPinTitle(@Nullable String confirmPinTitle) {
- mBuilderParcel.confirmPinTitle = confirmPinTitle;
- return this;
- }
-
- /**
- * Set ConfirmPinDescription.
- *
- * @param confirmPinDescription Description of the UI to ask the user to confirm the pin
- * code.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setConfirmPinDescription(@Nullable String confirmPinDescription) {
- mBuilderParcel.confirmPinDescription = confirmPinDescription;
- return this;
- }
-
- /**
- * Set SyncContactsTitle.
- *
- * @param syncContactsTitle Title of the UI to ask the user to confirm to sync contacts.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setSyncContactsTitle(@Nullable String syncContactsTitle) {
- mBuilderParcel.syncContactsTitle = syncContactsTitle;
- return this;
- }
-
- /**
- * Set SyncContactsDescription.
- *
- * @param syncContactsDescription Description of the UI to ask the user to confirm to sync
- * contacts.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setSyncContactsDescription(@Nullable String syncContactsDescription) {
- mBuilderParcel.syncContactsDescription = syncContactsDescription;
- return this;
- }
-
- /**
- * Set SyncSmsTitle.
- *
- * @param syncSmsTitle Title of the UI to ask the user to confirm to sync SMS.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setSyncSmsTitle(@Nullable String syncSmsTitle) {
- mBuilderParcel.syncSmsTitle = syncSmsTitle;
- return this;
- }
-
- /**
- * Set SyncSmsDescription.
- *
- * @param syncSmsDescription Description of the UI to ask the user to confirm to sync SMS.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setSyncSmsDescription(@Nullable String syncSmsDescription) {
- mBuilderParcel.syncSmsDescription = syncSmsDescription;
- return this;
- }
-
- /**
- * Set AssistantSetupHalfSheet.
- *
- * @param assistantSetupHalfSheet Description in half sheet to ask user setup google
- * assistant.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setAssistantSetupHalfSheet(@Nullable String assistantSetupHalfSheet) {
- mBuilderParcel.assistantSetupHalfSheet = assistantSetupHalfSheet;
- return this;
- }
-
- /**
- * Set AssistantSetupNotification.
- *
- * @param assistantSetupNotification Description in notification to ask user setup google
- * assistant.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setAssistantSetupNotification(
- @Nullable String assistantSetupNotification) {
- mBuilderParcel.assistantSetupNotification = assistantSetupNotification;
- return this;
- }
-
- /**
- * Set FastPairTvConnectDeviceNoAccountDescription.
- *
- * @param fastPairTvConnectDeviceNoAccountDescription Description of the connect device
- * action on TV, when user is not logged
- * in.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setFastPairTvConnectDeviceNoAccountDescription(
- @Nullable String fastPairTvConnectDeviceNoAccountDescription) {
- mBuilderParcel.fastPairTvConnectDeviceNoAccountDescription =
- fastPairTvConnectDeviceNoAccountDescription;
- return this;
- }
-
- /**
* Build {@link FastPairDeviceMetadata} with the currently set configuration.
*
* @hide
diff --git a/nearby/framework/java/android/nearby/FastPairDiscoveryItem.java b/nearby/framework/java/android/nearby/FastPairDiscoveryItem.java
index bc6a6f8..ce7413a 100644
--- a/nearby/framework/java/android/nearby/FastPairDiscoveryItem.java
+++ b/nearby/framework/java/android/nearby/FastPairDiscoveryItem.java
@@ -48,16 +48,6 @@
}
/**
- * Get Type.
- *
- * @hide
- */
- @SystemApi
- public int getType() {
- return mMetadataParcel.type;
- }
-
- /**
* Get MacAddress.
*
* @hide
@@ -205,27 +195,6 @@
}
/**
- * Get GroupId.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getGroupId() {
- return mMetadataParcel.groupId;
- }
-
- /**
- * Get AttachmentType.
- *
- * @hide
- */
- @SystemApi
- public int getAttachmentType() {
- return mMetadataParcel.attachmentType;
- }
-
- /**
* Get PackageName.
*
* @hide
@@ -237,17 +206,6 @@
}
/**
- * Get FeatureGraphicUrl.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getFeatureGraphicUrl() {
- return mMetadataParcel.featureGraphicUrl;
- }
-
- /**
* Get TriggerId.
*
* @hide
@@ -283,69 +241,6 @@
}
/**
- * Get DebugMessage.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getDebugMessage() {
- return mMetadataParcel.debugMessage;
- }
-
- /**
- * Get DebugCategory.
- *
- * @hide
- */
- @SystemApi
- public int getDebugCategory() {
- return mMetadataParcel.debugCategory;
- }
-
- /**
- * Get LostMillis.
- */
- public long getLostMillis() {
- return mMetadataParcel.lostMillis;
- }
-
- /**
- * Get LastUserExperience.
- *
- * @hide
- */
- @SystemApi
- public int getLastUserExperience() {
- return mMetadataParcel.lastUserExperience;
- }
-
- /**
- * Get BleRecordBytes. Raw bytes of {@link android.bluetooth.le.ScanRecord}.
- * It is the most recent BLE advertisement related to this item.
- *
- * @return the most recent BLE advertisement in raw bytes of
- * {@link android.bluetooth.le.ScanRecord}.
- * @hide
- */
- @SystemApi
- @Nullable
- public byte[] getBleRecordBytes() {
- return mMetadataParcel.bleRecordBytes;
- }
-
- /**
- * Get EntityId.
- *
- * @hide
- */
- @SystemApi
- @Nullable
- public String getEntityId() {
- return mMetadataParcel.entityId;
- }
-
- /**
* Get authenticationPublicKeySecp256r1, which is same as AntiSpoof public key, see
* <a href="https://developers.google.com/nearby/fast-pair/spec#data_format">Data Format</a>.
*
@@ -394,20 +289,6 @@
}
/**
- * Set Nearby Type.
- *
- * @param type Nearby type.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setType(int type) {
- mBuilderParcel.type = type;
- return this;
- }
-
- /**
* Set MacAddress.
*
* @param macAddress Fast Pair device rotating mac address.
@@ -608,35 +489,6 @@
}
/**
- * Set GroupId.
- *
- * @param groupId ID used for associating several DiscoveryItems. These items may be
- * visually displayed together.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setGroupId(@Nullable String groupId) {
- mBuilderParcel.groupId = groupId;
- return this;
- }
-
- /**
- * Set AttachmentType.
- *
- * @param attachmentType Whether the attachment is created in debug namespace.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setAttachmentType(int attachmentType) {
- mBuilderParcel.attachmentType = attachmentType;
- return this;
- }
-
- /**
* Set PackageName.
*
* @param packageName Package name of the App that owns this item.
@@ -651,21 +503,6 @@
}
/**
- * Set FeatureGraphicUrl.
- *
- * @param featureGraphicUrl The "feature" graphic image url used for large sized list view
- * entries.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setFeatureGraphicUrl(@Nullable String featureGraphicUrl) {
- mBuilderParcel.featureGraphicUrl = featureGraphicUrl;
- return this;
- }
-
- /**
* Set TriggerId.
*
* @param triggerId TriggerId identifies the trigger/beacon that is attached with a message.
@@ -708,94 +545,6 @@
}
/**
- * Set DebugMessage.
- *
- * @param debugMessage Message written to bugreport for 3P developers.(No sensitive info)
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setDebugMessage(@Nullable String debugMessage) {
- mBuilderParcel.debugMessage = debugMessage;
- return this;
- }
-
- /**
- * Set DebugCategory.
- *
- * @param debugCategory Weather the item is filtered out on server.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setDebugCategory(int debugCategory) {
- mBuilderParcel.debugCategory = debugCategory;
- return this;
- }
-
- /**
- * Set LostMillis.
- *
- * @param lostMillis Client timestamp when the trigger (e.g. beacon) was last lost
- * (e.g. when Messages told us the beacon's no longer nearby).
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setLostMillis(long lostMillis) {
- mBuilderParcel.lostMillis = lostMillis;
- return this;
- }
-
- /**
- * Set LastUserExperience.
- *
- * @param lastUserExperience The kind of experience the user last had with this (e.g. if
- * they dismissed the notification, that's bad; but if they tapped
- * it, that's good).
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setLastUserExperience(int lastUserExperience) {
- mBuilderParcel.lastUserExperience = lastUserExperience;
- return this;
- }
-
- /**
- * Set BleRecordBytes.
- *
- * @param bleRecordBytes The most recent BLE advertisement related to this item. Raw bytes
- * of {@link android.bluetooth.le.ScanRecord}.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setBleRecordBytes(@Nullable byte[] bleRecordBytes) {
- mBuilderParcel.bleRecordBytes = bleRecordBytes;
- return this;
- }
-
- /**
- * Set EntityId.
- *
- * @param entityId An ID generated on the server to uniquely identify content.
- * @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
- * @hide
- */
- @SystemApi
- @NonNull
- public Builder setEntityId(@Nullable String entityId) {
- mBuilderParcel.entityId = entityId;
- return this;
- }
-
- /**
* Set authenticationPublicKeySecp256r1, which is same as AntiSpoof public key, see
* <a href="https://developers.google.com/nearby/fast-pair/spec#data_format">Data Format</a>
*
diff --git a/nearby/framework/java/android/nearby/ScanRequest.java b/nearby/framework/java/android/nearby/ScanRequest.java
index a90b72d..cf2dd43 100644
--- a/nearby/framework/java/android/nearby/ScanRequest.java
+++ b/nearby/framework/java/android/nearby/ScanRequest.java
@@ -44,12 +44,8 @@
/** Scan type for scanning devices using fast pair protocol. */
public static final int SCAN_TYPE_FAST_PAIR = 1;
- /** Scan type for scanning devices using nearby share protocol. */
- public static final int SCAN_TYPE_NEARBY_SHARE = 2;
/** Scan type for scanning devices using nearby presence protocol. */
- public static final int SCAN_TYPE_NEARBY_PRESENCE = 3;
- /** Scan type for scanning devices using exposure notification protocol. */
- public static final int SCAN_TYPE_EXPOSURE_NOTIFICATION = 4;
+ public static final int SCAN_TYPE_NEARBY_PRESENCE = 2;
/** Scan mode uses highest duty cycle. */
public static final int SCAN_MODE_LOW_LATENCY = 2;
@@ -130,9 +126,7 @@
*/
public static boolean isValidScanType(@ScanType int scanType) {
return scanType == SCAN_TYPE_FAST_PAIR
- || scanType == SCAN_TYPE_NEARBY_SHARE
- || scanType == SCAN_TYPE_NEARBY_PRESENCE
- || scanType == SCAN_TYPE_EXPOSURE_NOTIFICATION;
+ || scanType == SCAN_TYPE_NEARBY_PRESENCE;
}
/**
@@ -240,8 +234,7 @@
/** @hide **/
@Retention(RetentionPolicy.SOURCE)
- @IntDef({SCAN_TYPE_FAST_PAIR, SCAN_TYPE_NEARBY_SHARE, SCAN_TYPE_NEARBY_PRESENCE,
- SCAN_TYPE_EXPOSURE_NOTIFICATION})
+ @IntDef({SCAN_TYPE_FAST_PAIR, SCAN_TYPE_NEARBY_PRESENCE})
public @interface ScanType {
}
diff --git a/nearby/framework/java/android/nearby/aidl/FastPairDeviceMetadataParcel.aidl b/nearby/framework/java/android/nearby/aidl/FastPairDeviceMetadataParcel.aidl
index ef00321..d90f6a1 100644
--- a/nearby/framework/java/android/nearby/aidl/FastPairDeviceMetadataParcel.aidl
+++ b/nearby/framework/java/android/nearby/aidl/FastPairDeviceMetadataParcel.aidl
@@ -49,10 +49,6 @@
String trueWirelessImageUrlRightBud;
String trueWirelessImageUrlCase;
- // Stings to be displayed in notification surfaced for a device.
- // The locale of all of the Strings.
- String locale;
-
// The notification description for when the device is initially discovered.
String initialNotificationDescription;
@@ -100,31 +96,4 @@
// The description that indicates go to bluetooth settings when connection
// fail.
String failConnectGoToSettingsDescription;
-
- // The title of the UI to ask the user to confirm the pin code.
- String confirmPinTitle;
-
- // The description of the UI to ask the user to confirm the pin code.
- String confirmPinDescription;
-
- // The title of the UI to ask the user to confirm to sync contacts.
- String syncContactsTitle;
-
- // The description of the UI to ask the user to confirm to sync contacts.
- String syncContactsDescription;
-
- // The title of the UI to ask the user to confirm to sync SMS.
- String syncSmsTitle;
-
- // The description of the UI to ask the user to confirm to sync SMS.
- String syncSmsDescription;
-
- // The description in half sheet to ask user setup google assistant
- String assistantSetupHalfSheet;
-
- // The description in notification to ask user setup google assistant
- String assistantSetupNotification;
-
- // Description of the connect device action on TV, when user is not logged in.
- String fastPairTvConnectDeviceNoAccountDescription;
}
\ No newline at end of file
diff --git a/nearby/framework/java/android/nearby/aidl/FastPairDiscoveryItemParcel.aidl b/nearby/framework/java/android/nearby/aidl/FastPairDiscoveryItemParcel.aidl
index 5ba18bb..2cc2daa 100644
--- a/nearby/framework/java/android/nearby/aidl/FastPairDiscoveryItemParcel.aidl
+++ b/nearby/framework/java/android/nearby/aidl/FastPairDiscoveryItemParcel.aidl
@@ -26,8 +26,6 @@
// Online item: unique ID generated on server.
String id;
- int type;
-
// The most recent all upper case mac associated with this item.
// (Mac-to-DiscoveryItem is a many-to-many relationship)
String macAddress;
@@ -72,19 +70,9 @@
// Used in the second line of the notification, "Open in {} app"
String appName;
- // ID used for associating several DiscoveryItems. These items may be
- // visually displayed together.
- String groupId;
-
- // Whether the attachment is created in debug namespace
- int attachmentType;
-
// Package name of the App that owns this item.
String packageName;
- // The "feature" graphic image url used for large sized list view entries.
- String featureGraphicUrl;
-
// 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.
@@ -100,27 +88,6 @@
// A FIFE URL of the item icon displayed in Discovery item list.
String iconFifeUrl;
- // Message written to bugreport for 3P developers.(No sensitive info)
- // null if the item is valid
- String debugMessage;
-
- // Weather the item is filtered out on server.
- int debugCategory;
-
- // Client timestamp when the trigger (e.g. beacon) was last lost (e.g. when
- // Messages told us the beacon's no longer nearby).
- long lostMillis;
-
- // The kind of experience the user last had with this (e.g. if they dismissed
- // the notification, that's bad; but if they tapped it, that's good).
- int lastUserExperience;
-
- // The most recent BLE advertisement related to this item.
- byte[] bleRecordBytes;
-
- // An ID generated on the server to uniquely identify content.
- String entityId;
-
// Fast Pair antispoof key.
byte[] authenticationPublicKeySecp256r1;
}
\ No newline at end of file
diff --git a/nearby/framework/java/android/nearby/aidl/FastPairManageAccountDeviceRequestParcel.aidl b/nearby/framework/java/android/nearby/aidl/FastPairManageAccountDeviceRequestParcel.aidl
index 82cf550..59834b2 100644
--- a/nearby/framework/java/android/nearby/aidl/FastPairManageAccountDeviceRequestParcel.aidl
+++ b/nearby/framework/java/android/nearby/aidl/FastPairManageAccountDeviceRequestParcel.aidl
@@ -31,6 +31,4 @@
int requestType;
// Fast Pair account key-ed device metadata.
FastPairAccountKeyDeviceMetadataParcel accountKeyDeviceMetadata;
- // BLE address of the device at the device add time.
- String bleAddress;
}
\ No newline at end of file
diff --git a/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/FastPairUtils.java b/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/FastPairUtils.java
index 903ea90..00a365c 100644
--- a/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/FastPairUtils.java
+++ b/nearby/halfsheet/src/com/android/nearby/halfsheet/utils/FastPairUtils.java
@@ -85,7 +85,6 @@
.setId(item.getModelId())
.setFirstObservationTimestampMillis(item.getFirstObservationTimestampMillis())
.setLastObservationTimestampMillis(item.getLastObservationTimestampMillis())
- .setType(Cache.NearbyType.NEARBY_DEVICE)
.setActionUrl(item.getActionUrl())
.setActionUrlType(Cache.ResolvedUrlType.APP)
.setTitle(
diff --git a/nearby/service/java/com/android/server/nearby/common/ble/util/RangingUtils.java b/nearby/service/java/com/android/server/nearby/common/ble/util/RangingUtils.java
index 321e125..eec52ad 100644
--- a/nearby/service/java/com/android/server/nearby/common/ble/util/RangingUtils.java
+++ b/nearby/service/java/com/android/server/nearby/common/ble/util/RangingUtils.java
@@ -23,12 +23,19 @@
* square of the frequency of the propagation signal.
*/
public final class RangingUtils {
- /*
- * Key to variable names used in this class (viz. Physics):
+ private static final int MAX_RSSI_VALUE = 126;
+ private static final int MIN_RSSI_VALUE = -127;
+
+ private RangingUtils() {
+ }
+
+ /* This was original derived in {@link com.google.android.gms.beacon.util.RangingUtils} from
+ * <a href="http://en.wikipedia.org/wiki/Free-space_path_loss">Free-space_path_loss</a>.
+ * Duplicated here for easy reference.
*
* c = speed of light (2.9979 x 10^8 m/s);
* f = frequency (Bluetooth center frequency is 2.44175GHz = 2.44175x10^9 Hz);
- * l = wavelength (meters);
+ * l = wavelength (in meters);
* d = distance (from transmitter to receiver in meters);
* dB = decibels
* dBm = decibel milliwatts
@@ -40,124 +47,115 @@
*
* FSPL = (4 * pi * d / l)^2 = (4 * pi * d * f / c)^2
*
- * FSPL (dB) = 10*log10((4 * pi * d * f / c)^2)
- * = 20*log10(4 * pi * d * f / c)
- * = 20*log10(d) + 20*log10(f) + 20*log10(4*pi/c)
+ * FSPL (dB) = 10 * log10((4 * pi * d * f / c)^2)
+ * = 20 * log10(4 * pi * d * f / c)
+ * = (20 * log10(d)) + (20 * log10(f)) + (20 * log10(4 * pi/c))
*
* Calculating constants:
*
- * FSPL_FREQ = 20*log10(f)
- * = 20*log10(2.44175 * 10^9)
+ * FSPL_FREQ = 20 * log10(f)
+ * = 20 * log10(2.44175 * 10^9)
* = 187.75
*
- * FSPL_LIGHT = 20*log10(4*pi/c)
- * = 20*log10(4*pi/(2.9979*10^8))
+ * FSPL_LIGHT = 20 * log10(4 * pi/c)
+ * = 20 * log10(4 * pi/(2.9979 * 10^8))
+ * = 20 * log10(4 * pi/(2.9979 * 10^8))
+ * = 20 * log10(41.9172441s * 10^-9)
* = -147.55
*
- * FSPL_DISTANCE_1M = 20*log10(1m)
+ * FSPL_DISTANCE_1M = 20 * log10(1)
* = 0
*
* PATH_LOSS_AT_1M = FSPL_DISTANCE_1M + FSPL_FREQ + FSPL_LIGHT
- * = 0 + 187.75 + (-147.55)
- * = 40.20 [round to 41]
+ * = 0 + 187.75 + (-147.55)
+ * = 40.20db [round to 41db]
*
- * Note that PATH_LOSS_AT_1M is rounded to 41 instead to the more natural 40. The first version
- * of this file had a typo that caused the value to be close to 41; when this was discovered,
- * the value 41 was already used in many places, and it was more important to be consistent
- * rather than exact.
- *
- * Given this we can work out a formula for distance from a given RSSI (received signal strength
- * indicator) and a given value for the expected strength at one meter from the beacon (aka
- * calibrated transmission power). Both values are in dBm.
- *
- * FSPL = 20*log10(d) + PATH_LOSS_AT_1M = full_power - RSSI
- * 20*log10(d) + PATH_LOSS_AT_1M = power_at_1m + PATH_LOSS_AT_1M - RSSI
- * 20*log10(d) = power_at_1m - RSSI
- * log10(d) = (power_at_1m - RSSI) / 20
- * d = 10 ^ ((power_at_1m - RSSI) / 20)
- *
- * Note: because of how logarithms work, units get a bit funny. If you take a two values x and y
- * whose units are dBm, the value of x - y has units of dB, not dBm. Similarly, if x is dBm and
- * y is in dB, then x - y will be in dBm.
+ * Note: Rounding up makes us "closer" and makes us more aggressive at showing notifications.
*/
-
- /* (dBm) PATH_LOSS at 1m for isotropic antenna transmitting BLE */
- public static final int PATH_LOSS_AT_1M = 41;
-
- /** Different region categories, based on distance range. */
- public static final class Region {
-
- public static final int UNKNOWN = -1;
- public static final int NEAR = 0;
- public static final int MID = 1;
- public static final int FAR = 2;
-
- private Region() {}
- }
-
- // Cutoff distances between different regions.
- public static final double NEAR_TO_MID_METERS = 0.5;
- public static final double MID_TO_FAR_METERS = 2.0;
-
- public static final int DEFAULT_CALIBRATED_TX_POWER = -77;
-
- private RangingUtils() {}
+ private static final int RSSI_DROP_OFF_AT_1_M = 41;
/**
- * Convert RSSI to path loss using the free space path loss equation. See <a
- * href="http://en.wikipedia.org/wiki/Free-space_path_loss">Free-space_path_loss</a>
+ * Convert target distance and txPower to a RSSI value using the Log-distance path loss model
+ * with Path Loss at 1m of 41db.
*
- * @param rssi Received Signal Strength Indication (RSSI) in dBm
- * @param calibratedTxPower the calibrated power of the transmitter (dBm) at 1 meter
- * @return The calculated path loss.
+ * @return RSSI expected at distanceInMeters with device broadcasting at txPower.
*/
- public static int pathLossFromRssi(int rssi, int calibratedTxPower) {
- return calibratedTxPower + PATH_LOSS_AT_1M - rssi;
- }
-
- /**
- * Convert RSSI to distance using the free space path loss equation. See <a
- * href="http://en.wikipedia.org/wiki/Free-space_path_loss">Free-space_path_loss</a>
- *
- * @param rssi Received Signal Strength Indication (RSSI) in dBm
- * @param calibratedTxPower the calibrated power of the transmitter (dBm) at 1 meter
- * @return the distance at which that rssi value would occur in meters
- */
- public static double distanceFromRssi(int rssi, int calibratedTxPower) {
- return Math.pow(10, (calibratedTxPower - rssi) / 20.0);
- }
-
- /**
- * Determine the region of a beacon given its perceived distance.
- *
- * @param distance The measured distance in meters.
- * @return the region as one of the constants in {@link Region}.
- */
- public static int regionFromDistance(double distance) {
- if (distance < 0) {
- return Region.UNKNOWN;
- }
- if (distance <= NEAR_TO_MID_METERS) {
- return Region.NEAR;
- }
- if (distance <= MID_TO_FAR_METERS) {
- return Region.MID;
- }
- return Region.FAR;
- }
-
- /**
- * Convert distance to RSSI using the free space path loss equation. See <a
- * href="http://en.wikipedia.org/wiki/Free-space_path_loss">Free-space_path_loss</a>
- *
- * @param distanceInMeters distance in meters (m)
- * @param calibratedTxPower transmitted power (dBm) calibrated to 1 meter
- * @return the rssi (dBm) that would be measured at that distance
- */
- public static int rssiFromDistance(double distanceInMeters, int calibratedTxPower) {
+ public static int rssiFromTargetDistance(double distanceInMeters, int txPower) {
+ /*
+ * See <a href="https://en.wikipedia.org/wiki/Log-distance_path_loss_model">
+ * Log-distance path loss model</a>.
+ *
+ * PL = total path loss in db
+ * txPower = TxPower in dbm
+ * rssi = Received signal strength in dbm
+ * PL_0 = Path loss at reference distance d_0 {@link RSSI_DROP_OFF_AT_1_M} dbm
+ * d = length of path
+ * d_0 = reference distance (1 m)
+ * gamma = path loss exponent (2 in free space)
+ *
+ * Log-distance path loss (LDPL) formula:
+ *
+ * PL = txPower - rssi = PL_0 + 10 * gamma * log_10(d / d_0)
+ * txPower - rssi = RSSI_DROP_OFF_AT_1_M + 10 * 2 * log_10
+ * (distanceInMeters / 1)
+ * - rssi = -txPower + RSSI_DROP_OFF_AT_1_M + 20 * log_10(distanceInMeters)
+ * rssi = txPower - RSSI_DROP_OFF_AT_1_M - 20 * log_10(distanceInMeters)
+ */
+ txPower = adjustPower(txPower);
return distanceInMeters == 0
- ? calibratedTxPower + PATH_LOSS_AT_1M
- : (int) (calibratedTxPower - (20 * Math.log10(distanceInMeters)));
+ ? txPower
+ : (int) Math.floor((txPower - RSSI_DROP_OFF_AT_1_M)
+ - 20 * Math.log10(distanceInMeters));
+ }
+
+ /**
+ * Convert RSSI and txPower to a distance value using the Log-distance path loss model with Path
+ * Loss at 1m of 41db.
+ *
+ * @return distance in meters with device broadcasting at txPower and given RSSI.
+ */
+ public static double distanceFromRssiAndTxPower(int rssi, int txPower) {
+ /*
+ * See <a href="https://en.wikipedia.org/wiki/Log-distance_path_loss_model">Log-distance
+ * path
+ * loss model</a>.
+ *
+ * PL = total path loss in db
+ * txPower = TxPower in dbm
+ * rssi = Received signal strength in dbm
+ * PL_0 = Path loss at reference distance d_0 {@link RSSI_DROP_OFF_AT_1_M} dbm
+ * d = length of path
+ * d_0 = reference distance (1 m)
+ * gamma = path loss exponent (2 in free space)
+ *
+ * Log-distance path loss (LDPL) formula:
+ *
+ * PL = txPower - rssi = PL_0 + 10 * gamma * log_10(d /
+ * d_0)
+ * txPower - rssi = RSSI_DROP_OFF_AT_1_M + 10 * gamma * log_10(d /
+ * d_0)
+ * txPower - rssi - RSSI_DROP_OFF_AT_1_M = 10 * 2 * log_10
+ * (distanceInMeters / 1)
+ * txPower - rssi - RSSI_DROP_OFF_AT_1_M = 20 * log_10(distanceInMeters / 1)
+ * (txPower - rssi - RSSI_DROP_OFF_AT_1_M) / 20 = log_10(distanceInMeters)
+ * 10 ^ ((txPower - rssi - RSSI_DROP_OFF_AT_1_M) / 20) = distanceInMeters
+ */
+ txPower = adjustPower(txPower);
+ rssi = adjustPower(rssi);
+ return Math.pow(10, (txPower - rssi - RSSI_DROP_OFF_AT_1_M) / 20.0);
+ }
+
+ /**
+ * Prevents the power from becoming too large or too small.
+ */
+ private static int adjustPower(int power) {
+ if (power > MAX_RSSI_VALUE) {
+ return MAX_RSSI_VALUE;
+ }
+ if (power < MIN_RSSI_VALUE) {
+ return MIN_RSSI_VALUE;
+ }
+ return power;
}
}
diff --git a/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java b/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java
index b175234..4de4cee 100644
--- a/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java
+++ b/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java
@@ -27,7 +27,9 @@
import android.nearby.NearbyDevice;
import android.util.Log;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.server.nearby.common.ble.decode.FastPairDecoder;
+import com.android.server.nearby.common.ble.util.RangingUtils;
import com.android.server.nearby.common.bloomfilter.BloomFilter;
import com.android.server.nearby.common.bloomfilter.FastPairBloomFilterHasher;
import com.android.server.nearby.common.locator.Locator;
@@ -52,6 +54,8 @@
String mBleAddress;
// Need to be deleted after notification manager in use.
private boolean mIsFirst = false;
+ private FastPairDataProvider mPairDataProvider;
+ private static final double NEARBY_DISTANCE_THRESHOLD = 0.6;
/** The types about how the bloomfilter is processed. */
public enum ProcessBloomFilterType {
@@ -68,6 +72,12 @@
mContext = context;
}
+ @VisibleForTesting
+ FastPairAdvHandler(Context context, FastPairDataProvider dataProvider) {
+ mContext = context;
+ mPairDataProvider = dataProvider;
+ }
+
/**
* Handles all of the scanner result. Fast Pair will handle model id broadcast bloomfilter
* broadcast and battery level broadcast.
@@ -75,23 +85,32 @@
public void handleBroadcast(NearbyDevice device) {
FastPairDevice fastPairDevice = (FastPairDevice) device;
mBleAddress = fastPairDevice.getBluetoothAddress();
- FastPairDataProvider dataProvider = FastPairDataProvider.getInstance();
- if (dataProvider == null) {
+ if (mPairDataProvider == null) {
+ mPairDataProvider = FastPairDataProvider.getInstance();
+ }
+ if (mPairDataProvider == null) {
return;
}
- List<Account> accountList = dataProvider.loadFastPairEligibleAccounts();
+ List<Account> accountList = mPairDataProvider.loadFastPairEligibleAccounts();
if (FastPairDecoder.checkModelId(fastPairDevice.getData())) {
byte[] model = FastPairDecoder.getModelId(fastPairDevice.getData());
Log.d(TAG, "On discovery model id " + Hex.bytesToStringLowercase(model));
// Use api to get anti spoofing key from model id.
try {
Rpcs.GetObservedDeviceResponse response =
- dataProvider.loadFastPairAntispoofKeyDeviceMetadata(model);
+ mPairDataProvider.loadFastPairAntispoofKeyDeviceMetadata(model);
if (response == null) {
Log.e(TAG, "server does not have model id "
+ Hex.bytesToStringLowercase(model));
return;
}
+ // Check the distance of the device if the distance is larger than the threshold
+ // do not show half sheet.
+ if (!isNearby(fastPairDevice.getRssi(),
+ response.getDevice().getBleTxPower() == 0 ? fastPairDevice.getTxPower()
+ : response.getDevice().getBleTxPower())) {
+ return;
+ }
Locator.get(mContext, FastPairHalfSheetManager.class).showHalfSheet(
DataUtils.toScanFastPairStoreItem(
response, mBleAddress,
@@ -111,7 +130,7 @@
}
for (Account account : accountList) {
List<Data.FastPairDeviceWithAccountKey> listDevices =
- dataProvider.loadFastPairDeviceWithAccountKey(account);
+ mPairDataProvider.loadFastPairDeviceWithAccountKey(account);
Data.FastPairDeviceWithAccountKey recognizedDevice =
findRecognizedDevice(listDevices,
new BloomFilter(bloomFilterByteArray,
@@ -120,6 +139,15 @@
if (recognizedDevice != null) {
Log.d(TAG, "find matched device show notification to remind"
+ " user to pair");
+ // Check the distance of the device if the distance is larger than the
+ // threshold
+ // do not show half sheet.
+ if (!isNearby(fastPairDevice.getRssi(),
+ recognizedDevice.getDiscoveryItem().getTxPower() == 0
+ ? fastPairDevice.getTxPower()
+ : recognizedDevice.getDiscoveryItem().getTxPower())) {
+ return;
+ }
// Check if the device is already paired
List<Cache.StoredFastPairItem> storedFastPairItemList =
Locator.get(mContext, FastPairCacheManager.class)
@@ -141,8 +169,9 @@
// Get full info from api the initial request will only return
// part of the info due to size limit.
List<Data.FastPairDeviceWithAccountKey> resList =
- dataProvider.loadFastPairDeviceWithAccountKey(account,
- List.of(recognizedDevice.getAccountKey().toByteArray()));
+ mPairDataProvider.loadFastPairDeviceWithAccountKey(account,
+ List.of(recognizedDevice.getAccountKey()
+ .toByteArray()));
if (resList != null && resList.size() > 0) {
//Saved device from footprint does not have ble address so
// fill ble address with current scan result.
@@ -154,7 +183,7 @@
Locator.get(mContext, FastPairController.class).pair(
new DiscoveryItem(mContext, storedDiscoveryItem),
resList.get(0).getAccountKey().toByteArray(),
- /** companionApp=*/ null);
+ /** companionApp=*/null);
}
}
}
@@ -212,4 +241,11 @@
return null;
}
+ /**
+ * Check the device distance for certain rssi value.
+ */
+ boolean isNearby(int rssi, int txPower) {
+ return RangingUtils.distanceFromRssiAndTxPower(rssi, txPower) < NEARBY_DISTANCE_THRESHOLD;
+ }
+
}
diff --git a/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java b/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java
index 16c04de..2d7cba9 100644
--- a/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java
+++ b/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java
@@ -103,8 +103,9 @@
private final BroadcastReceiver mScreenBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
- Log.d(TAG, "onReceive: ACTION_SCREEN_ON.");
+ if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)
+ || intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
+ Log.d(TAG, "onReceive: ACTION_SCREEN_ON or boot complete.");
invalidateScan();
} else if (intent.getAction().equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
processBluetoothConnectionEvent(intent);
@@ -149,6 +150,7 @@
mIntentFilter.addAction(Intent.ACTION_SCREEN_ON);
mIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
+ mIntentFilter.addAction(Intent.ACTION_BOOT_COMPLETED);
mLocatorContextWrapper.getContext()
.registerReceiver(mScreenBroadcastReceiver, mIntentFilter);
diff --git a/nearby/service/java/com/android/server/nearby/fastpair/cache/DiscoveryItem.java b/nearby/service/java/com/android/server/nearby/fastpair/cache/DiscoveryItem.java
index b8a9796..6065f99 100644
--- a/nearby/service/java/com/android/server/nearby/fastpair/cache/DiscoveryItem.java
+++ b/nearby/service/java/com/android/server/nearby/fastpair/cache/DiscoveryItem.java
@@ -47,7 +47,7 @@
*/
public class DiscoveryItem implements Comparable<DiscoveryItem> {
- private static final String ACTION_FAST_PAIR =
+ private static final String ACTION_FAST_PAIR =
"com.android.server.nearby:ACTION_FAST_PAIR";
private static final int BEACON_STALENESS_MILLIS = 120000;
private static final int ITEM_EXPIRATION_MILLIS = 20000;
@@ -66,14 +66,15 @@
Cache.StoredDiscoveryItem.State.STATE_DISABLED_BY_SYSTEM_VALUE
})
@Retention(RetentionPolicy.SOURCE)
- public @interface ItemState {}
+ public @interface ItemState {
+ }
public DiscoveryItem(LocatorContextWrapper locatorContextWrapper,
Cache.StoredDiscoveryItem mStoredDiscoveryItem) {
this.mFastPairCacheManager =
locatorContextWrapper.getLocator().get(FastPairCacheManager.class);
this.mClock =
- locatorContextWrapper.getLocator().get(Clock.class);
+ locatorContextWrapper.getLocator().get(Clock.class);
this.mStoredDiscoveryItem = mStoredDiscoveryItem;
}
@@ -91,23 +92,6 @@
return storedDiscoveryItem.build();
}
- /** @return True if the item is currently nearby. */
- public boolean isNearby() {
- return isNearby(mStoredDiscoveryItem, mClock.millis());
- }
-
- /**
- * Checks if the item is Nearby
- */
- static boolean isNearby(Cache.StoredDiscoveryItem item, long currentTimeMillis) {
- // A notification may disappear early, if we get a lost callback from Messages.
- // But regardless, if we haven't detected the thing in Xmin, consider it gone.
- return !isLost(item)
- && !isExpired(
- currentTimeMillis,
- item.getLastObservationTimestampMillis());
- }
-
/**
* Checks if store discovery item support fast pair or not.
*/
@@ -122,28 +106,6 @@
}
/**
- * Sets the pairing result to done.
- */
- public void setPairingProcessDone(boolean success) {
- setLastUserExperience(success ? Cache.StoredDiscoveryItem.ExperienceType.EXPERIENCE_GOOD
- : Cache.StoredDiscoveryItem.ExperienceType.EXPERIENCE_BAD);
- setLostMillis(mClock.millis());
- Log.d("FastPairDiscovery",
- "FastPair: set Lost when pairing process done, " + getId());
- }
-
- /**
- * Sets the store discovery item lost time.
- */
- public void setLostMillis(long lostMillis) {
- mStoredDiscoveryItem = mStoredDiscoveryItem.toBuilder().setLostMillis(lostMillis).build();
-
- mStoredDiscoveryItem = mStoredDiscoveryItem.toBuilder().clearRssi().build();
-
- mFastPairCacheManager.saveDiscoveryItem(this);
- }
-
- /**
* Sets the store discovery item mac address.
*/
public void setMacAddress(String address) {
@@ -153,28 +115,6 @@
}
/**
- * Sets the user experience to be good or bad.
- */
- public void setLastUserExperience(Cache.StoredDiscoveryItem.ExperienceType experienceType) {
- mStoredDiscoveryItem = mStoredDiscoveryItem.toBuilder()
- .setLastUserExperience(experienceType).build();
- mFastPairCacheManager.saveDiscoveryItem(this);
- }
- /**
- * Gets the user experience to be good or bad.
- */
- public Cache.StoredDiscoveryItem.ExperienceType getLastUserExperience() {
- return mStoredDiscoveryItem.getLastUserExperience();
- }
-
- /**
- * Checks if the item is lost.
- */
- private static boolean isLost(Cache.StoredDiscoveryItem item) {
- return item.getLastObservationTimestampMillis() <= item.getLostMillis();
- }
-
- /**
* Checks if the item is expired. Expired items are those over getItemExpirationMillis() eg. 2
* minutes
*/
@@ -224,39 +164,16 @@
/** Checks if the item has enough data to be shown */
public boolean isReadyForDisplay() {
- if (isOffline()) {
- return true;
- }
boolean hasUrlOrPopularApp = !mStoredDiscoveryItem.getActionUrl().isEmpty();
return !TextUtils.isEmpty(mStoredDiscoveryItem.getTitle()) && hasUrlOrPopularApp;
}
- /** Checks if the item has server error */
- public boolean isDisabledByServer() {
- return mStoredDiscoveryItem.getDebugCategory()
- == Cache.StoredDiscoveryItem.DebugMessageCategory.STATUS_DISABLED_BY_SERVER;
- }
-
- private boolean isOffline() {
- return isOfflineType(getType());
- }
-
- /** Checks if the item can be generated on client side. */
- private static boolean isOfflineType(Cache.NearbyType type) {
- return type == Cache.NearbyType.NEARBY_CHROMECAST || type == Cache.NearbyType.NEARBY_WEAR;
- }
-
/** Checks if the action url is app install */
public boolean isApp() {
return mStoredDiscoveryItem.getActionUrlType() == Cache.ResolvedUrlType.APP;
}
- /** Checks if it's device item. e.g. Chromecast / Wear */
- public boolean isDevice() {
- return isDeviceType(mStoredDiscoveryItem.getType());
- }
-
/** Returns true if an item is muted, or if state is unavailable. */
public boolean isMuted() {
return mStoredDiscoveryItem.getState() != Cache.StoredDiscoveryItem.State.STATE_ENABLED;
@@ -293,25 +210,16 @@
/** Gets hash code of UI related data so we can collapse identical items. */
public int getUiHashCode() {
- switch (mStoredDiscoveryItem.getType()) {
- case NEARBY_CHROMECAST:
- case NEARBY_WEAR:
- // For the special-case device types, show one item per type.
- return Objects.hashCode(mStoredDiscoveryItem.getType());
- case NEARBY_DEVICE:
- case NEARBY_TYPE_UNKNOWN:
- default:
- return Objects.hash(
- mStoredDiscoveryItem.getType(),
+ return Objects.hash(
mStoredDiscoveryItem.getTitle(),
mStoredDiscoveryItem.getDescription(),
mStoredDiscoveryItem.getAppName(),
mStoredDiscoveryItem.getDisplayUrl(),
mStoredDiscoveryItem.getMacAddress());
- }
}
// Getters below
+
/**
* Returns the id of store discovery item.
*/
@@ -321,14 +229,6 @@
}
/**
- * Returns the type of store discovery item.
- */
- @Nullable
- public Cache.NearbyType getType() {
- return mStoredDiscoveryItem.getType();
- }
-
- /**
* Returns the title of discovery item.
*/
@Nullable
@@ -376,7 +276,7 @@
Intent intent = parseIntentScheme(mStoredDiscoveryItem.getActionUrl());
if (intent == null) {
Log.d("FastPairDiscoveryItem", "FastPair: fail to parse action url "
- + mStoredDiscoveryItem.getActionUrl());
+ + mStoredDiscoveryItem.getActionUrl());
return null;
}
return intent.getStringExtra(EXTRA_FAST_PAIR_SECRET);
@@ -407,15 +307,6 @@
return mStoredDiscoveryItem.getPackageName();
}
-
- /**
- * Returns the feature graph url of discovery item.
- */
- @Nullable
- private String getHeroImage() {
- return mStoredDiscoveryItem.getFeatureGraphicUrl();
- }
-
/**
* Returns the action url of discovery item.
*/
@@ -433,14 +324,6 @@
}
/**
- * Returns the ble record of discovery item.
- */
- @Nullable
- public byte[] getBleRecordBytes() {
- return mStoredDiscoveryItem.getBleRecordBytes().toByteArray();
- }
-
- /**
* Returns the TX power of discovery item.
*/
@Nullable
@@ -472,7 +355,7 @@
@Nullable
public Double getEstimatedDistance() {
// In the future, we may want to do a foreground subscription to leverage onDistanceChanged.
- return RangingUtils.distanceFromRssi(mStoredDiscoveryItem.getRssi(),
+ return RangingUtils.distanceFromRssiAndTxPower(mStoredDiscoveryItem.getRssi(),
mStoredDiscoveryItem.getTxPower());
}
@@ -501,15 +384,6 @@
}
/**
- * Gets group id of storedDiscoveryItem.
- */
- @Nullable
- public String getGroupId() {
- return mStoredDiscoveryItem.getGroupId();
- }
-
-
- /**
* Compares this object to the specified object: 1. By device type. Device setups are 'greater
* than' beacons. 2. By relevance. More relevant items are 'greater than' less relevant items.
* 3.By distance. Nearer items are 'greater than' further items.
@@ -518,10 +392,6 @@
*/
@Override
public int compareTo(DiscoveryItem another) {
- if (getType() != another.getType()) {
- // For device type v.s. beacon type, rank device item higher.
- return isDevice() ? 1 : -1;
- }
// For items of the same relevance, compare distance.
Double distance1 = getEstimatedDistance();
Double distance2 = another.getEstimatedDistance();
@@ -531,12 +401,6 @@
return -distance1.compareTo(distance2);
}
-
- public Integer getTriggerIdAttachmentTypeHash() {
- return Objects.hash(mStoredDiscoveryItem.getTriggerId(),
- mStoredDiscoveryItem.getAttachmentType());
- }
-
@Nullable
public String getTriggerId() {
return mStoredDiscoveryItem.getTriggerId();
@@ -558,9 +422,7 @@
@Override
public String toString() {
return String.format(
- "[type=%s], [triggerId=%s], [id=%s], [title=%s], [url=%s], "
- + "[ready=%s], [macAddress=%s]",
- getType().name(),
+ "[triggerId=%s], [id=%s], [title=%s], [url=%s], [ready=%s], [macAddress=%s]",
getTriggerId(),
getId(),
getTitle(),
diff --git a/nearby/service/java/com/android/server/nearby/provider/Utils.java b/nearby/service/java/com/android/server/nearby/provider/Utils.java
index 22e31cd..0f1c567 100644
--- a/nearby/service/java/com/android/server/nearby/provider/Utils.java
+++ b/nearby/service/java/com/android/server/nearby/provider/Utils.java
@@ -79,31 +79,11 @@
if (metadataParcel.discoveryItem.appName != null) {
storedDiscoveryItemBuilder.setAppName(metadataParcel.discoveryItem.appName);
}
- Cache.DiscoveryAttachmentType attachmentType =
- Cache.DiscoveryAttachmentType.forNumber(
- metadataParcel.discoveryItem.attachmentType);
- if (attachmentType != null) {
- storedDiscoveryItemBuilder.setAttachmentType(attachmentType);
- }
if (metadataParcel.discoveryItem.authenticationPublicKeySecp256r1 != null) {
storedDiscoveryItemBuilder.setAuthenticationPublicKeySecp256R1(
ByteString.copyFrom(
metadataParcel.discoveryItem.authenticationPublicKeySecp256r1));
}
- if (metadataParcel.discoveryItem.bleRecordBytes != null) {
- storedDiscoveryItemBuilder.setBleRecordBytes(
- ByteString.copyFrom(metadataParcel.discoveryItem.bleRecordBytes));
- }
- Cache.StoredDiscoveryItem.DebugMessageCategory debugMessageCategory =
- Cache.StoredDiscoveryItem.DebugMessageCategory.forNumber(
- metadataParcel.discoveryItem.debugCategory);
- if (debugMessageCategory != null) {
- storedDiscoveryItemBuilder.setDebugCategory(debugMessageCategory);
- }
- if (metadataParcel.discoveryItem.debugMessage != null) {
- storedDiscoveryItemBuilder.setDebugMessage(
- metadataParcel.discoveryItem.debugMessage);
- }
if (metadataParcel.discoveryItem.description != null) {
storedDiscoveryItemBuilder.setDescription(
metadataParcel.discoveryItem.description);
@@ -116,19 +96,8 @@
storedDiscoveryItemBuilder.setDisplayUrl(
metadataParcel.discoveryItem.displayUrl);
}
- if (metadataParcel.discoveryItem.entityId != null) {
- storedDiscoveryItemBuilder.setEntityId(
- metadataParcel.discoveryItem.entityId);
- }
- if (metadataParcel.discoveryItem.featureGraphicUrl != null) {
- storedDiscoveryItemBuilder.setFeatureGraphicUrl(
- metadataParcel.discoveryItem.featureGraphicUrl);
- }
storedDiscoveryItemBuilder.setFirstObservationTimestampMillis(
metadataParcel.discoveryItem.firstObservationTimestampMillis);
- if (metadataParcel.discoveryItem.groupId != null) {
- storedDiscoveryItemBuilder.setGroupId(metadataParcel.discoveryItem.groupId);
- }
if (metadataParcel.discoveryItem.iconFifeUrl != null) {
storedDiscoveryItemBuilder.setIconFifeUrl(
metadataParcel.discoveryItem.iconFifeUrl);
@@ -142,13 +111,6 @@
}
storedDiscoveryItemBuilder.setLastObservationTimestampMillis(
metadataParcel.discoveryItem.lastObservationTimestampMillis);
- Cache.StoredDiscoveryItem.ExperienceType experienceType =
- Cache.StoredDiscoveryItem.ExperienceType.forNumber(
- metadataParcel.discoveryItem.lastUserExperience);
- if (experienceType != null) {
- storedDiscoveryItemBuilder.setLastUserExperience(experienceType);
- }
- storedDiscoveryItemBuilder.setLostMillis(metadataParcel.discoveryItem.lostMillis);
if (metadataParcel.discoveryItem.macAddress != null) {
storedDiscoveryItemBuilder.setMacAddress(
metadataParcel.discoveryItem.macAddress);
@@ -173,30 +135,9 @@
storedDiscoveryItemBuilder.setTriggerId(metadataParcel.discoveryItem.triggerId);
}
storedDiscoveryItemBuilder.setTxPower(metadataParcel.discoveryItem.txPower);
- Cache.NearbyType type =
- Cache.NearbyType.forNumber(metadataParcel.discoveryItem.type);
- if (type != null) {
- storedDiscoveryItemBuilder.setType(type);
- }
}
if (metadataParcel.metadata != null) {
FastPairStrings.Builder stringsBuilder = FastPairStrings.newBuilder();
- if (metadataParcel.metadata.assistantSetupHalfSheet != null) {
- stringsBuilder.setAssistantHalfSheetDescription(
- metadataParcel.metadata.assistantSetupHalfSheet);
- }
- if (metadataParcel.metadata.assistantSetupNotification != null) {
- stringsBuilder.setAssistantNotificationDescription(
- metadataParcel.metadata.assistantSetupNotification);
- }
- if (metadataParcel.metadata.confirmPinDescription != null) {
- stringsBuilder.setConfirmPinDescription(
- metadataParcel.metadata.confirmPinDescription);
- }
- if (metadataParcel.metadata.confirmPinTitle != null) {
- stringsBuilder.setConfirmPinTitle(
- metadataParcel.metadata.confirmPinTitle);
- }
if (metadataParcel.metadata.connectSuccessCompanionAppInstalled != null) {
stringsBuilder.setPairingFinishedCompanionAppInstalled(
metadataParcel.metadata.connectSuccessCompanionAppInstalled);
@@ -209,10 +150,6 @@
stringsBuilder.setPairingFailDescription(
metadataParcel.metadata.failConnectGoToSettingsDescription);
}
- if (metadataParcel.metadata.fastPairTvConnectDeviceNoAccountDescription != null) {
- stringsBuilder.setFastPairTvConnectDeviceNoAccountDescription(
- metadataParcel.metadata.fastPairTvConnectDeviceNoAccountDescription);
- }
if (metadataParcel.metadata.initialNotificationDescription != null) {
stringsBuilder.setTapToPairWithAccount(
metadataParcel.metadata.initialNotificationDescription);
@@ -233,21 +170,6 @@
stringsBuilder.setSubsequentPairingDescription(
metadataParcel.metadata.subsequentPairingDescription);
}
- if (metadataParcel.metadata.syncContactsDescription != null) {
- stringsBuilder.setSyncContactsDescription(
- metadataParcel.metadata.syncContactsDescription);
- }
- if (metadataParcel.metadata.syncContactsTitle != null) {
- stringsBuilder.setSyncContactsTitle(
- metadataParcel.metadata.syncContactsTitle);
- }
- if (metadataParcel.metadata.syncSmsDescription != null) {
- stringsBuilder.setSyncSmsDescription(
- metadataParcel.metadata.syncSmsDescription);
- }
- if (metadataParcel.metadata.syncSmsTitle != null) {
- stringsBuilder.setSyncSmsTitle(metadataParcel.metadata.syncSmsTitle);
- }
if (metadataParcel.metadata.waitLaunchCompanionAppDescription != null) {
stringsBuilder.setWaitAppLaunchDescription(
metadataParcel.metadata.waitLaunchCompanionAppDescription);
@@ -357,20 +279,6 @@
}
Rpcs.ObservedDeviceStrings.Builder stringsBuilder = Rpcs.ObservedDeviceStrings.newBuilder();
- if (metadata.deviceMetadata.assistantSetupHalfSheet != null) {
- stringsBuilder
- .setAssistantSetupHalfSheet(metadata.deviceMetadata.assistantSetupHalfSheet);
- }
- if (metadata.deviceMetadata.assistantSetupNotification != null) {
- stringsBuilder.setAssistantSetupNotification(
- metadata.deviceMetadata.assistantSetupNotification);
- }
- if (metadata.deviceMetadata.confirmPinDescription != null) {
- stringsBuilder.setConfirmPinDescription(metadata.deviceMetadata.confirmPinDescription);
- }
- if (metadata.deviceMetadata.confirmPinTitle != null) {
- stringsBuilder.setConfirmPinTitle(metadata.deviceMetadata.confirmPinTitle);
- }
if (metadata.deviceMetadata.connectSuccessCompanionAppInstalled != null) {
stringsBuilder.setConnectSuccessCompanionAppInstalled(
metadata.deviceMetadata.connectSuccessCompanionAppInstalled);
@@ -387,10 +295,6 @@
stringsBuilder.setFailConnectGoToSettingsDescription(
metadata.deviceMetadata.failConnectGoToSettingsDescription);
}
- if (metadata.deviceMetadata.fastPairTvConnectDeviceNoAccountDescription != null) {
- stringsBuilder.setFastPairTvConnectDeviceNoAccountDescription(
- metadata.deviceMetadata.fastPairTvConnectDeviceNoAccountDescription);
- }
if (metadata.deviceMetadata.initialNotificationDescription != null) {
stringsBuilder.setInitialNotificationDescription(
metadata.deviceMetadata.initialNotificationDescription);
@@ -403,9 +307,6 @@
stringsBuilder.setInitialPairingDescription(
metadata.deviceMetadata.initialPairingDescription);
}
- if (metadata.deviceMetadata.locale != null) {
- stringsBuilder.setLocale(metadata.deviceMetadata.locale);
- }
if (metadata.deviceMetadata.openCompanionAppDescription != null) {
stringsBuilder.setOpenCompanionAppDescription(
metadata.deviceMetadata.openCompanionAppDescription);
@@ -418,22 +319,6 @@
stringsBuilder.setSubsequentPairingDescription(
metadata.deviceMetadata.subsequentPairingDescription);
}
- if (metadata.deviceMetadata.syncContactsDescription != null) {
- stringsBuilder.setSyncContactsDescription(
- metadata.deviceMetadata.syncContactsDescription);
- }
- if (metadata.deviceMetadata.syncContactsTitle != null) {
- stringsBuilder.setSyncContactsTitle(
- metadata.deviceMetadata.syncContactsTitle);
- }
- if (metadata.deviceMetadata.syncSmsDescription != null) {
- stringsBuilder.setSyncSmsDescription(
- metadata.deviceMetadata.syncSmsDescription);
- }
- if (metadata.deviceMetadata.syncSmsTitle != null) {
- stringsBuilder.setSyncSmsTitle(
- metadata.deviceMetadata.syncSmsTitle);
- }
if (metadata.deviceMetadata.unableToConnectDescription != null) {
stringsBuilder.setUnableToConnectDescription(
metadata.deviceMetadata.unableToConnectDescription);
@@ -513,28 +398,18 @@
discoveryItemParcel.actionUrl = storedDiscoveryItem.getActionUrl();
discoveryItemParcel.actionUrlType = storedDiscoveryItem.getActionUrlType().getNumber();
discoveryItemParcel.appName = storedDiscoveryItem.getAppName();
- discoveryItemParcel.attachmentType = storedDiscoveryItem.getAttachmentType().getNumber();
discoveryItemParcel.authenticationPublicKeySecp256r1 =
storedDiscoveryItem.getAuthenticationPublicKeySecp256R1().toByteArray();
- discoveryItemParcel.bleRecordBytes = storedDiscoveryItem.getBleRecordBytes().toByteArray();
- discoveryItemParcel.debugCategory = storedDiscoveryItem.getDebugCategory().getNumber();
- discoveryItemParcel.debugMessage = storedDiscoveryItem.getDebugMessage();
discoveryItemParcel.description = storedDiscoveryItem.getDescription();
discoveryItemParcel.deviceName = storedDiscoveryItem.getDeviceName();
discoveryItemParcel.displayUrl = storedDiscoveryItem.getDisplayUrl();
- discoveryItemParcel.entityId = storedDiscoveryItem.getEntityId();
- discoveryItemParcel.featureGraphicUrl = storedDiscoveryItem.getFeatureGraphicUrl();
discoveryItemParcel.firstObservationTimestampMillis =
storedDiscoveryItem.getFirstObservationTimestampMillis();
- discoveryItemParcel.groupId = storedDiscoveryItem.getGroupId();
discoveryItemParcel.iconFifeUrl = storedDiscoveryItem.getIconFifeUrl();
discoveryItemParcel.iconPng = storedDiscoveryItem.getIconPng().toByteArray();
discoveryItemParcel.id = storedDiscoveryItem.getId();
discoveryItemParcel.lastObservationTimestampMillis =
storedDiscoveryItem.getLastObservationTimestampMillis();
- discoveryItemParcel.lastUserExperience =
- storedDiscoveryItem.getLastUserExperience().getNumber();
- discoveryItemParcel.lostMillis = storedDiscoveryItem.getLostMillis();
discoveryItemParcel.macAddress = storedDiscoveryItem.getMacAddress();
discoveryItemParcel.packageName = storedDiscoveryItem.getPackageName();
discoveryItemParcel.pendingAppInstallTimestampMillis =
@@ -544,7 +419,6 @@
discoveryItemParcel.title = storedDiscoveryItem.getTitle();
discoveryItemParcel.triggerId = storedDiscoveryItem.getTriggerId();
discoveryItemParcel.txPower = storedDiscoveryItem.getTxPower();
- discoveryItemParcel.type = storedDiscoveryItem.getType().getNumber();
return discoveryItemParcel;
}
@@ -564,27 +438,17 @@
FastPairStrings fpStrings = storedDiscoveryItem.getFastPairStrings();
FastPairDeviceMetadataParcel metadataParcel = new FastPairDeviceMetadataParcel();
- metadataParcel.assistantSetupHalfSheet = fpStrings.getAssistantHalfSheetDescription();
- metadataParcel.assistantSetupNotification = fpStrings.getAssistantNotificationDescription();
- metadataParcel.confirmPinDescription = fpStrings.getConfirmPinDescription();
- metadataParcel.confirmPinTitle = fpStrings.getConfirmPinTitle();
metadataParcel.connectSuccessCompanionAppInstalled =
fpStrings.getPairingFinishedCompanionAppInstalled();
metadataParcel.connectSuccessCompanionAppNotInstalled =
fpStrings.getPairingFinishedCompanionAppNotInstalled();
metadataParcel.failConnectGoToSettingsDescription = fpStrings.getPairingFailDescription();
- metadataParcel.fastPairTvConnectDeviceNoAccountDescription =
- fpStrings.getFastPairTvConnectDeviceNoAccountDescription();
metadataParcel.initialNotificationDescription = fpStrings.getTapToPairWithAccount();
metadataParcel.initialNotificationDescriptionNoAccount =
fpStrings.getTapToPairWithoutAccount();
metadataParcel.initialPairingDescription = fpStrings.getInitialPairingDescription();
metadataParcel.retroactivePairingDescription = fpStrings.getRetroactivePairingDescription();
metadataParcel.subsequentPairingDescription = fpStrings.getSubsequentPairingDescription();
- metadataParcel.syncContactsDescription = fpStrings.getSyncContactsDescription();
- metadataParcel.syncContactsTitle = fpStrings.getSyncContactsTitle();
- metadataParcel.syncSmsDescription = fpStrings.getSyncSmsDescription();
- metadataParcel.syncSmsTitle = fpStrings.getSyncSmsTitle();
metadataParcel.waitLaunchCompanionAppDescription = fpStrings.getWaitAppLaunchDescription();
Cache.FastPairInformation fpInformation = storedDiscoveryItem.getFastPairInformation();
diff --git a/nearby/service/java/com/android/server/nearby/util/DataUtils.java b/nearby/service/java/com/android/server/nearby/util/DataUtils.java
index 0b01bc0..8bb83e9 100644
--- a/nearby/service/java/com/android/server/nearby/util/DataUtils.java
+++ b/nearby/service/java/com/android/server/nearby/util/DataUtils.java
@@ -84,12 +84,6 @@
+ fastPairStrings.getRetroactivePairingDescription()
+ ", waitAppLaunchDescription=" + fastPairStrings.getWaitAppLaunchDescription()
+ ", pairingFailDescription=" + fastPairStrings.getPairingFailDescription()
- + ", assistantHalfSheetDescription="
- + fastPairStrings.getAssistantHalfSheetDescription()
- + ", assistantNotificationDescription="
- + fastPairStrings.getAssistantNotificationDescription()
- + ", fastPairTvConnectDeviceNoAccountDescription="
- + fastPairStrings.getFastPairTvConnectDeviceNoAccountDescription()
+ "]";
}
@@ -112,10 +106,6 @@
.setRetroactivePairingDescription(strings.getRetroactivePairingDescription())
.setWaitAppLaunchDescription(strings.getWaitLaunchCompanionAppDescription())
.setPairingFailDescription(strings.getFailConnectGoToSettingsDescription())
- .setAssistantHalfSheetDescription(strings.getAssistantSetupHalfSheet())
- .setAssistantNotificationDescription(strings.getAssistantSetupNotification())
- .setFastPairTvConnectDeviceNoAccountDescription(
- strings.getFastPairTvConnectDeviceNoAccountDescription())
.build();
}
}
diff --git a/nearby/service/proto/src/fastpair/cache.proto b/nearby/service/proto/src/fastpair/cache.proto
index 12731fb..d4c7c3d 100644
--- a/nearby/service/proto/src/fastpair/cache.proto
+++ b/nearby/service/proto/src/fastpair/cache.proto
@@ -112,9 +112,6 @@
string id = 1;
// REQUIRED
- NearbyType type = 2;
-
- // REQUIRED
// The most recent all upper case mac associated with this item.
// (Mac-to-DiscoveryItem is a many-to-many relationship)
string mac_address = 4;
@@ -164,28 +161,18 @@
// Used in the second line of the notification, "Open in {} app"
string app_name = 25;
- // ID used for associating several DiscoveryItems. These items may be
- // visually displayed together.
- 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.
int64 attachment_creation_sec = 28;
- // Whether the attachment is created in debug namespace
- DiscoveryAttachmentType attachment_type = 29;
-
// Package name of the App that owns this item.
string package_name = 30;
// The average star rating of the app.
float star_rating = 31;
- // The "feature" graphic image url used for large sized list view entries.
- 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.
@@ -201,27 +188,6 @@
// A FIFE URL of the item icon displayed in Discovery item list.
string icon_fife_url = 49;
- // Message written to bugreport for 3P developers.(No sensitive info)
- // null if the item is valid
- string debug_message = 37;
-
- // Weather the item is filtered out on server.
- 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).
- 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).
- ExperienceType last_user_experience = 42;
-
- // The most recent BLE advertisement related to this item.
- bytes ble_record_bytes = 43;
-
- // An ID generated on the server to uniquely identify content.
- string entity_id = 44;
-
// See equivalent field in NearbyItem.
bytes authentication_public_key_secp256r1 = 45;
@@ -235,7 +201,7 @@
FastPairStrings fast_pair_strings = 48;
// Deprecated fields.
- reserved 3, 12, 13, 14, 15, 16, 18, 21, 24, 27, 33, 35, 39, 40;
+ reserved 2, 3, 12, 13, 14, 15, 16, 18, 21, 24, 26, 27, 29, 32, 33, 35, 37, 38, 39, 40, 41, 42, 43, 44;
}
enum ResolvedUrlType {
RESOLVED_URL_TYPE_UNKNOWN = 0;
diff --git a/nearby/service/proto/src/fastpair/fast_pair_string.proto b/nearby/service/proto/src/fastpair/fast_pair_string.proto
index 6dfc19a..f318c1a 100644
--- a/nearby/service/proto/src/fastpair/fast_pair_string.proto
+++ b/nearby/service/proto/src/fastpair/fast_pair_string.proto
@@ -36,30 +36,5 @@
// 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;
+ reserved 10, 11, 12, 13, 14,15, 16, 17, 18;
}
diff --git a/nearby/service/proto/src/fastpair/rpcs.proto b/nearby/service/proto/src/fastpair/rpcs.proto
index 0399d09..bce4378 100644
--- a/nearby/service/proto/src/fastpair/rpcs.proto
+++ b/nearby/service/proto/src/fastpair/rpcs.proto
@@ -234,9 +234,6 @@
// Strings to be displayed in notifications surfaced for a device.
message ObservedDeviceStrings {
- // The locale of all of the strings.
- string locale = 1;
-
// The notification description for when the device is initially discovered.
string initial_notification_description = 2;
@@ -285,32 +282,7 @@
// fail.
string fail_connect_go_to_settings_description = 15;
- // The title of the UI to ask the user to confirm the pin code.
- string confirm_pin_title = 16;
-
- // The description of the UI to ask the user to confirm the pin code.
- string confirm_pin_description = 17;
-
- // The title of the UI to ask the user to confirm to sync contacts.
- string sync_contacts_title = 18;
-
- // The description of the UI to ask the user to confirm to sync contacts.
- string sync_contacts_description = 19;
-
- // The title of the UI to ask the user to confirm to sync SMS.
- string sync_sms_title = 20;
-
- // The description of the UI to ask the user to confirm to sync SMS.
- string sync_sms_description = 21;
-
- // The description in half sheet to ask user setup google assistant
- string assistant_setup_half_sheet = 22;
-
- // The description in notification to ask user setup google assistant
- string assistant_setup_notification = 23;
-
- // Description of the connect device action on TV, when user is not logged in.
- string fast_pair_tv_connect_device_no_account_description = 24;
+ reserved 1, 16, 17, 18, 19, 20, 21, 22, 23, 24;
}
// The buffer size range of a Fast Pair devices support dynamic buffer size.
diff --git a/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairAntispoofKeyDeviceMetadataTest.java b/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairAntispoofKeyDeviceMetadataTest.java
index 226efbb..65c061b 100644
--- a/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairAntispoofKeyDeviceMetadataTest.java
+++ b/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairAntispoofKeyDeviceMetadataTest.java
@@ -105,12 +105,7 @@
/* Verifies DeviceMetadata. */
private static void ensureFastPairDeviceMetadataAsExpected(FastPairDeviceMetadata metadata) {
- assertThat(metadata.getAssistantSetupHalfSheet()).isEqualTo(ASSISTANT_SETUP_HALFSHEET);
- assertThat(metadata.getAssistantSetupNotification())
- .isEqualTo(ASSISTANT_SETUP_NOTIFICATION);
assertThat(metadata.getBleTxPower()).isEqualTo(BLE_TX_POWER);
- assertThat(metadata.getConfirmPinDescription()).isEqualTo(CONFIRM_PIN_DESCRIPTION);
- assertThat(metadata.getConfirmPinTitle()).isEqualTo(CONFIRM_PIN_TITLE);
assertThat(metadata.getConnectSuccessCompanionAppInstalled())
.isEqualTo(CONNECT_SUCCESS_COMPANION_APP_INSTALLED);
assertThat(metadata.getConnectSuccessCompanionAppNotInstalled())
@@ -120,8 +115,6 @@
.isEqualTo(DOWNLOAD_COMPANION_APP_DESCRIPTION);
assertThat(metadata.getFailConnectGoToSettingsDescription())
.isEqualTo(FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION);
- assertThat(metadata.getFastPairTvConnectDeviceNoAccountDescription())
- .isEqualTo(FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
assertThat(metadata.getImage()).isEqualTo(IMAGE);
assertThat(metadata.getImageUrl()).isEqualTo(IMAGE_URL);
assertThat(metadata.getInitialNotificationDescription())
@@ -130,7 +123,6 @@
.isEqualTo(INITIAL_NOTIFICATION_DESCRIPTION_NO_ACCOUNT);
assertThat(metadata.getInitialPairingDescription()).isEqualTo(INITIAL_PAIRING_DESCRIPTION);
assertThat(metadata.getIntentUri()).isEqualTo(INTENT_URI);
- assertThat(metadata.getLocale()).isEqualTo(LOCALE);
assertThat(metadata.getName()).isEqualTo(NAME);
assertThat(metadata.getOpenCompanionAppDescription())
.isEqualTo(OPEN_COMPANION_APP_DESCRIPTION);
@@ -138,10 +130,6 @@
.isEqualTo(RETRO_ACTIVE_PAIRING_DESCRIPTION);
assertThat(metadata.getSubsequentPairingDescription())
.isEqualTo(SUBSEQUENT_PAIRING_DESCRIPTION);
- assertThat(metadata.getSyncContactsDescription()).isEqualTo(SYNC_CONTACT_DESCRPTION);
- assertThat(metadata.getSyncContactsTitle()).isEqualTo(SYNC_CONTACTS_TITLE);
- assertThat(metadata.getSyncSmsDescription()).isEqualTo(SYNC_SMS_DESCRIPTION);
- assertThat(metadata.getSyncSmsTitle()).isEqualTo(SYNC_SMS_TITLE);
assertThat(metadata.getTriggerDistance()).isWithin(DELTA).of(TRIGGER_DISTANCE);
assertThat(metadata.getTrueWirelessImageUrlCase()).isEqualTo(TRUE_WIRELESS_IMAGE_URL_CASE);
assertThat(metadata.getTrueWirelessImageUrlLeftBud())
@@ -171,19 +159,13 @@
/* Generates FastPairDeviceMetadata. */
private static FastPairDeviceMetadata genFastPairDeviceMetadata() {
FastPairDeviceMetadata.Builder builder = new FastPairDeviceMetadata.Builder();
- builder.setAssistantSetupHalfSheet(ASSISTANT_SETUP_HALFSHEET);
- builder.setAssistantSetupNotification(ASSISTANT_SETUP_NOTIFICATION);
builder.setBleTxPower(BLE_TX_POWER);
- builder.setConfirmPinDescription(CONFIRM_PIN_DESCRIPTION);
- builder.setConfirmPinTitle(CONFIRM_PIN_TITLE);
builder.setConnectSuccessCompanionAppInstalled(CONNECT_SUCCESS_COMPANION_APP_INSTALLED);
builder.setConnectSuccessCompanionAppNotInstalled(
CONNECT_SUCCESS_COMPANION_APP_NOT_INSTALLED);
builder.setDeviceType(DEVICE_TYPE);
builder.setDownloadCompanionAppDescription(DOWNLOAD_COMPANION_APP_DESCRIPTION);
builder.setFailConnectGoToSettingsDescription(FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION);
- builder.setFastPairTvConnectDeviceNoAccountDescription(
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
builder.setImage(IMAGE);
builder.setImageUrl(IMAGE_URL);
builder.setInitialNotificationDescription(INITIAL_NOTIFICATION_DESCRIPTION);
@@ -191,15 +173,10 @@
INITIAL_NOTIFICATION_DESCRIPTION_NO_ACCOUNT);
builder.setInitialPairingDescription(INITIAL_PAIRING_DESCRIPTION);
builder.setIntentUri(INTENT_URI);
- builder.setLocale(LOCALE);
builder.setName(NAME);
builder.setOpenCompanionAppDescription(OPEN_COMPANION_APP_DESCRIPTION);
builder.setRetroactivePairingDescription(RETRO_ACTIVE_PAIRING_DESCRIPTION);
builder.setSubsequentPairingDescription(SUBSEQUENT_PAIRING_DESCRIPTION);
- builder.setSyncContactsDescription(SYNC_CONTACT_DESCRPTION);
- builder.setSyncContactsTitle(SYNC_CONTACTS_TITLE);
- builder.setSyncSmsDescription(SYNC_SMS_DESCRIPTION);
- builder.setSyncSmsTitle(SYNC_SMS_TITLE);
builder.setTriggerDistance(TRIGGER_DISTANCE);
builder.setTrueWirelessImageUrlCase(TRUE_WIRELESS_IMAGE_URL_CASE);
builder.setTrueWirelessImageUrlLeftBud(TRUE_WIRELESS_IMAGE_URL_LEFT_BUD);
diff --git a/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairDataProviderServiceTest.java b/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairDataProviderServiceTest.java
index 171b6e8..160da56 100644
--- a/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairDataProviderServiceTest.java
+++ b/nearby/tests/cts/fastpair/src/android/nearby/cts/FastPairDataProviderServiceTest.java
@@ -577,7 +577,6 @@
new FastPairManageAccountDeviceRequestParcel();
requestParcel.account = MANAGE_ACCOUNT;
requestParcel.requestType = MANAGE_ACCOUNT_REQUEST_TYPE;
- requestParcel.bleAddress = BLE_ADDRESS;
requestParcel.accountKeyDeviceMetadata =
genHappyPathFastPairAccountkeyDeviceMetadataParcel();
@@ -628,24 +627,15 @@
builder.setActionUrl(ACTION_URL);
builder.setActionUrlType(ACTION_URL_TYPE);
builder.setAppName(APP_NAME);
- builder.setAttachmentType(ATTACHMENT_TYPE);
builder.setAuthenticationPublicKeySecp256r1(AUTHENTICATION_PUBLIC_KEY_SEC_P256R1);
- builder.setBleRecordBytes(BLE_RECORD_BYTES);
- builder.setDebugCategory(DEBUG_CATEGORY);
- builder.setDebugMessage(DEBUG_MESSAGE);
builder.setDescription(DESCRIPTION);
builder.setDeviceName(DEVICE_NAME);
builder.setDisplayUrl(DISPLAY_URL);
- builder.setEntityId(ENTITY_ID);
- builder.setFeatureGraphicUrl(FEATURE_GRAPHIC_URL);
builder.setFirstObservationTimestampMillis(FIRST_OBSERVATION_TIMESTAMP_MILLIS);
- builder.setGroupId(GROUP_ID);
builder.setIconFfeUrl(ICON_FIFE_URL);
builder.setIconPng(ICON_PNG);
builder.setId(ID);
builder.setLastObservationTimestampMillis(LAST_OBSERVATION_TIMESTAMP_MILLIS);
- builder.setLastUserExperience(LAST_USER_EXPERIENCE);
- builder.setLostMillis(LOST_MILLIS);
builder.setMacAddress(MAC_ADDRESS);
builder.setPackageName(PACKAGE_NAME);
builder.setPendingAppInstallTimestampMillis(PENDING_APP_INSTALL_TIMESTAMP_MILLIS);
@@ -654,7 +644,6 @@
builder.setTitle(TITLE);
builder.setTriggerId(TRIGGER_ID);
builder.setTxPower(TX_POWER);
- builder.setType(TYPE);
return builder.build();
}
@@ -666,24 +655,15 @@
parcel.actionUrl = ACTION_URL;
parcel.actionUrlType = ACTION_URL_TYPE;
parcel.appName = APP_NAME;
- parcel.attachmentType = ATTACHMENT_TYPE;
parcel.authenticationPublicKeySecp256r1 = AUTHENTICATION_PUBLIC_KEY_SEC_P256R1;
- parcel.bleRecordBytes = BLE_RECORD_BYTES;
- parcel.debugCategory = DEBUG_CATEGORY;
- parcel.debugMessage = DEBUG_MESSAGE;
parcel.description = DESCRIPTION;
parcel.deviceName = DEVICE_NAME;
parcel.displayUrl = DISPLAY_URL;
- parcel.entityId = ENTITY_ID;
- parcel.featureGraphicUrl = FEATURE_GRAPHIC_URL;
parcel.firstObservationTimestampMillis = FIRST_OBSERVATION_TIMESTAMP_MILLIS;
- parcel.groupId = GROUP_ID;
parcel.iconFifeUrl = ICON_FIFE_URL;
parcel.iconPng = ICON_PNG;
parcel.id = ID;
parcel.lastObservationTimestampMillis = LAST_OBSERVATION_TIMESTAMP_MILLIS;
- parcel.lastUserExperience = LAST_USER_EXPERIENCE;
- parcel.lostMillis = LOST_MILLIS;
parcel.macAddress = MAC_ADDRESS;
parcel.packageName = PACKAGE_NAME;
parcel.pendingAppInstallTimestampMillis = PENDING_APP_INSTALL_TIMESTAMP_MILLIS;
@@ -692,7 +672,6 @@
parcel.title = TITLE;
parcel.triggerId = TRIGGER_ID;
parcel.txPower = TX_POWER;
- parcel.type = TYPE;
return parcel;
}
@@ -700,19 +679,13 @@
/* Generates Happy Path DeviceMetadata. */
private static FastPairDeviceMetadata genHappyPathFastPairDeviceMetadata() {
FastPairDeviceMetadata.Builder builder = new FastPairDeviceMetadata.Builder();
- builder.setAssistantSetupHalfSheet(ASSISTANT_SETUP_HALFSHEET);
- builder.setAssistantSetupNotification(ASSISTANT_SETUP_NOTIFICATION);
builder.setBleTxPower(BLE_TX_POWER);
- builder.setConfirmPinDescription(CONFIRM_PIN_DESCRIPTION);
- builder.setConfirmPinTitle(CONFIRM_PIN_TITLE);
builder.setConnectSuccessCompanionAppInstalled(CONNECT_SUCCESS_COMPANION_APP_INSTALLED);
builder.setConnectSuccessCompanionAppNotInstalled(
CONNECT_SUCCESS_COMPANION_APP_NOT_INSTALLED);
builder.setDeviceType(DEVICE_TYPE);
builder.setDownloadCompanionAppDescription(DOWNLOAD_COMPANION_APP_DESCRIPTION);
builder.setFailConnectGoToSettingsDescription(FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION);
- builder.setFastPairTvConnectDeviceNoAccountDescription(
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
builder.setImage(IMAGE);
builder.setImageUrl(IMAGE_URL);
builder.setInitialNotificationDescription(INITIAL_NOTIFICATION_DESCRIPTION);
@@ -720,15 +693,10 @@
INITIAL_NOTIFICATION_DESCRIPTION_NO_ACCOUNT);
builder.setInitialPairingDescription(INITIAL_PAIRING_DESCRIPTION);
builder.setIntentUri(INTENT_URI);
- builder.setLocale(LOCALE);
builder.setName(NAME);
builder.setOpenCompanionAppDescription(OPEN_COMPANION_APP_DESCRIPTION);
builder.setRetroactivePairingDescription(RETRO_ACTIVE_PAIRING_DESCRIPTION);
builder.setSubsequentPairingDescription(SUBSEQUENT_PAIRING_DESCRIPTION);
- builder.setSyncContactsDescription(SYNC_CONTACT_DESCRPTION);
- builder.setSyncContactsTitle(SYNC_CONTACTS_TITLE);
- builder.setSyncSmsDescription(SYNC_SMS_DESCRIPTION);
- builder.setSyncSmsTitle(SYNC_SMS_TITLE);
builder.setTriggerDistance(TRIGGER_DISTANCE);
builder.setTrueWirelessImageUrlCase(TRUE_WIRELESS_IMAGE_URL_CASE);
builder.setTrueWirelessImageUrlLeftBud(TRUE_WIRELESS_IMAGE_URL_LEFT_BUD);
@@ -745,19 +713,13 @@
private static FastPairDeviceMetadataParcel genHappyPathFastPairDeviceMetadataParcel() {
FastPairDeviceMetadataParcel parcel = new FastPairDeviceMetadataParcel();
- parcel.assistantSetupHalfSheet = ASSISTANT_SETUP_HALFSHEET;
- parcel.assistantSetupNotification = ASSISTANT_SETUP_NOTIFICATION;
parcel.bleTxPower = BLE_TX_POWER;
- parcel.confirmPinDescription = CONFIRM_PIN_DESCRIPTION;
- parcel.confirmPinTitle = CONFIRM_PIN_TITLE;
parcel.connectSuccessCompanionAppInstalled = CONNECT_SUCCESS_COMPANION_APP_INSTALLED;
parcel.connectSuccessCompanionAppNotInstalled =
CONNECT_SUCCESS_COMPANION_APP_NOT_INSTALLED;
parcel.deviceType = DEVICE_TYPE;
parcel.downloadCompanionAppDescription = DOWNLOAD_COMPANION_APP_DESCRIPTION;
parcel.failConnectGoToSettingsDescription = FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION;
- parcel.fastPairTvConnectDeviceNoAccountDescription =
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION;
parcel.image = IMAGE;
parcel.imageUrl = IMAGE_URL;
parcel.initialNotificationDescription = INITIAL_NOTIFICATION_DESCRIPTION;
@@ -765,15 +727,10 @@
INITIAL_NOTIFICATION_DESCRIPTION_NO_ACCOUNT;
parcel.initialPairingDescription = INITIAL_PAIRING_DESCRIPTION;
parcel.intentUri = INTENT_URI;
- parcel.locale = LOCALE;
parcel.name = NAME;
parcel.openCompanionAppDescription = OPEN_COMPANION_APP_DESCRIPTION;
parcel.retroactivePairingDescription = RETRO_ACTIVE_PAIRING_DESCRIPTION;
parcel.subsequentPairingDescription = SUBSEQUENT_PAIRING_DESCRIPTION;
- parcel.syncContactsDescription = SYNC_CONTACT_DESCRPTION;
- parcel.syncContactsTitle = SYNC_CONTACTS_TITLE;
- parcel.syncSmsDescription = SYNC_SMS_DESCRIPTION;
- parcel.syncSmsTitle = SYNC_SMS_TITLE;
parcel.triggerDistance = TRIGGER_DISTANCE;
parcel.trueWirelessImageUrlCase = TRUE_WIRELESS_IMAGE_URL_CASE;
parcel.trueWirelessImageUrlLeftBud = TRUE_WIRELESS_IMAGE_URL_LEFT_BUD;
@@ -830,7 +787,6 @@
FastPairDataProviderService.FastPairManageAccountDeviceRequest request) {
assertThat(request.getAccount()).isEqualTo(MANAGE_ACCOUNT);
assertThat(request.getRequestType()).isEqualTo(MANAGE_ACCOUNT_REQUEST_TYPE);
- assertThat(request.getBleAddress()).isEqualTo(BLE_ADDRESS);
ensureHappyPathAsExpected(request.getAccountKeyDeviceMetadata());
}
@@ -876,15 +832,8 @@
/* Verifies Happy Path DeviceMetadataParcel. */
private static void ensureHappyPathAsExpected(FastPairDeviceMetadataParcel metadataParcel) {
assertThat(metadataParcel).isNotNull();
-
- assertThat(metadataParcel.assistantSetupHalfSheet).isEqualTo(ASSISTANT_SETUP_HALFSHEET);
- assertThat(metadataParcel.assistantSetupNotification).isEqualTo(
- ASSISTANT_SETUP_NOTIFICATION);
-
assertThat(metadataParcel.bleTxPower).isEqualTo(BLE_TX_POWER);
- assertThat(metadataParcel.confirmPinDescription).isEqualTo(CONFIRM_PIN_DESCRIPTION);
- assertThat(metadataParcel.confirmPinTitle).isEqualTo(CONFIRM_PIN_TITLE);
assertThat(metadataParcel.connectSuccessCompanionAppInstalled).isEqualTo(
CONNECT_SUCCESS_COMPANION_APP_INSTALLED);
assertThat(metadataParcel.connectSuccessCompanionAppNotInstalled).isEqualTo(
@@ -896,8 +845,6 @@
assertThat(metadataParcel.failConnectGoToSettingsDescription).isEqualTo(
FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION);
- assertThat(metadataParcel.fastPairTvConnectDeviceNoAccountDescription).isEqualTo(
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
assertThat(metadataParcel.image).isEqualTo(IMAGE);
assertThat(metadataParcel.imageUrl).isEqualTo(IMAGE_URL);
@@ -908,7 +855,6 @@
assertThat(metadataParcel.initialPairingDescription).isEqualTo(INITIAL_PAIRING_DESCRIPTION);
assertThat(metadataParcel.intentUri).isEqualTo(INTENT_URI);
- assertThat(metadataParcel.locale).isEqualTo(LOCALE);
assertThat(metadataParcel.name).isEqualTo(NAME);
assertThat(metadataParcel.openCompanionAppDescription).isEqualTo(
@@ -919,10 +865,6 @@
assertThat(metadataParcel.subsequentPairingDescription).isEqualTo(
SUBSEQUENT_PAIRING_DESCRIPTION);
- assertThat(metadataParcel.syncContactsDescription).isEqualTo(SYNC_CONTACT_DESCRPTION);
- assertThat(metadataParcel.syncContactsTitle).isEqualTo(SYNC_CONTACTS_TITLE);
- assertThat(metadataParcel.syncSmsDescription).isEqualTo(SYNC_SMS_DESCRIPTION);
- assertThat(metadataParcel.syncSmsTitle).isEqualTo(SYNC_SMS_TITLE);
assertThat(metadataParcel.triggerDistance).isWithin(DELTA).of(TRIGGER_DISTANCE);
assertThat(metadataParcel.trueWirelessImageUrlCase).isEqualTo(TRUE_WIRELESS_IMAGE_URL_CASE);
@@ -943,12 +885,7 @@
/* Verifies Happy Path DeviceMetadata. */
private static void ensureHappyPathAsExpected(FastPairDeviceMetadata metadata) {
- assertThat(metadata.getAssistantSetupHalfSheet()).isEqualTo(ASSISTANT_SETUP_HALFSHEET);
- assertThat(metadata.getAssistantSetupNotification())
- .isEqualTo(ASSISTANT_SETUP_NOTIFICATION);
assertThat(metadata.getBleTxPower()).isEqualTo(BLE_TX_POWER);
- assertThat(metadata.getConfirmPinDescription()).isEqualTo(CONFIRM_PIN_DESCRIPTION);
- assertThat(metadata.getConfirmPinTitle()).isEqualTo(CONFIRM_PIN_TITLE);
assertThat(metadata.getConnectSuccessCompanionAppInstalled())
.isEqualTo(CONNECT_SUCCESS_COMPANION_APP_INSTALLED);
assertThat(metadata.getConnectSuccessCompanionAppNotInstalled())
@@ -958,8 +895,6 @@
.isEqualTo(DOWNLOAD_COMPANION_APP_DESCRIPTION);
assertThat(metadata.getFailConnectGoToSettingsDescription())
.isEqualTo(FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION);
- assertThat(metadata.getFastPairTvConnectDeviceNoAccountDescription())
- .isEqualTo(FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
assertThat(metadata.getImage()).isEqualTo(IMAGE);
assertThat(metadata.getImageUrl()).isEqualTo(IMAGE_URL);
assertThat(metadata.getInitialNotificationDescription())
@@ -968,7 +903,6 @@
.isEqualTo(INITIAL_NOTIFICATION_DESCRIPTION_NO_ACCOUNT);
assertThat(metadata.getInitialPairingDescription()).isEqualTo(INITIAL_PAIRING_DESCRIPTION);
assertThat(metadata.getIntentUri()).isEqualTo(INTENT_URI);
- assertThat(metadata.getLocale()).isEqualTo(LOCALE);
assertThat(metadata.getName()).isEqualTo(NAME);
assertThat(metadata.getOpenCompanionAppDescription())
.isEqualTo(OPEN_COMPANION_APP_DESCRIPTION);
@@ -976,10 +910,6 @@
.isEqualTo(RETRO_ACTIVE_PAIRING_DESCRIPTION);
assertThat(metadata.getSubsequentPairingDescription())
.isEqualTo(SUBSEQUENT_PAIRING_DESCRIPTION);
- assertThat(metadata.getSyncContactsDescription()).isEqualTo(SYNC_CONTACT_DESCRPTION);
- assertThat(metadata.getSyncContactsTitle()).isEqualTo(SYNC_CONTACTS_TITLE);
- assertThat(metadata.getSyncSmsDescription()).isEqualTo(SYNC_SMS_DESCRIPTION);
- assertThat(metadata.getSyncSmsTitle()).isEqualTo(SYNC_SMS_TITLE);
assertThat(metadata.getTriggerDistance()).isWithin(DELTA).of(TRIGGER_DISTANCE);
assertThat(metadata.getTrueWirelessImageUrlCase()).isEqualTo(TRUE_WIRELESS_IMAGE_URL_CASE);
assertThat(metadata.getTrueWirelessImageUrlLeftBud())
@@ -1000,27 +930,18 @@
assertThat(itemParcel.actionUrl).isEqualTo(ACTION_URL);
assertThat(itemParcel.actionUrlType).isEqualTo(ACTION_URL_TYPE);
assertThat(itemParcel.appName).isEqualTo(APP_NAME);
- assertThat(itemParcel.attachmentType).isEqualTo(ATTACHMENT_TYPE);
assertThat(itemParcel.authenticationPublicKeySecp256r1)
.isEqualTo(AUTHENTICATION_PUBLIC_KEY_SEC_P256R1);
- assertThat(itemParcel.bleRecordBytes).isEqualTo(BLE_RECORD_BYTES);
- assertThat(itemParcel.debugCategory).isEqualTo(DEBUG_CATEGORY);
- assertThat(itemParcel.debugMessage).isEqualTo(DEBUG_MESSAGE);
assertThat(itemParcel.description).isEqualTo(DESCRIPTION);
assertThat(itemParcel.deviceName).isEqualTo(DEVICE_NAME);
assertThat(itemParcel.displayUrl).isEqualTo(DISPLAY_URL);
- assertThat(itemParcel.entityId).isEqualTo(ENTITY_ID);
- assertThat(itemParcel.featureGraphicUrl).isEqualTo(FEATURE_GRAPHIC_URL);
assertThat(itemParcel.firstObservationTimestampMillis)
.isEqualTo(FIRST_OBSERVATION_TIMESTAMP_MILLIS);
- assertThat(itemParcel.groupId).isEqualTo(GROUP_ID);
assertThat(itemParcel.iconFifeUrl).isEqualTo(ICON_FIFE_URL);
assertThat(itemParcel.iconPng).isEqualTo(ICON_PNG);
assertThat(itemParcel.id).isEqualTo(ID);
assertThat(itemParcel.lastObservationTimestampMillis)
.isEqualTo(LAST_OBSERVATION_TIMESTAMP_MILLIS);
- assertThat(itemParcel.lastUserExperience).isEqualTo(LAST_USER_EXPERIENCE);
- assertThat(itemParcel.lostMillis).isEqualTo(LOST_MILLIS);
assertThat(itemParcel.macAddress).isEqualTo(MAC_ADDRESS);
assertThat(itemParcel.packageName).isEqualTo(PACKAGE_NAME);
assertThat(itemParcel.pendingAppInstallTimestampMillis)
@@ -1030,7 +951,6 @@
assertThat(itemParcel.title).isEqualTo(TITLE);
assertThat(itemParcel.triggerId).isEqualTo(TRIGGER_ID);
assertThat(itemParcel.txPower).isEqualTo(TX_POWER);
- assertThat(itemParcel.type).isEqualTo(TYPE);
}
/* Verifies Happy Path FastPairDiscoveryItem. */
@@ -1038,27 +958,18 @@
assertThat(item.getActionUrl()).isEqualTo(ACTION_URL);
assertThat(item.getActionUrlType()).isEqualTo(ACTION_URL_TYPE);
assertThat(item.getAppName()).isEqualTo(APP_NAME);
- assertThat(item.getAttachmentType()).isEqualTo(ATTACHMENT_TYPE);
assertThat(item.getAuthenticationPublicKeySecp256r1())
.isEqualTo(AUTHENTICATION_PUBLIC_KEY_SEC_P256R1);
- assertThat(item.getBleRecordBytes()).isEqualTo(BLE_RECORD_BYTES);
- assertThat(item.getDebugCategory()).isEqualTo(DEBUG_CATEGORY);
- assertThat(item.getDebugMessage()).isEqualTo(DEBUG_MESSAGE);
assertThat(item.getDescription()).isEqualTo(DESCRIPTION);
assertThat(item.getDeviceName()).isEqualTo(DEVICE_NAME);
assertThat(item.getDisplayUrl()).isEqualTo(DISPLAY_URL);
- assertThat(item.getEntityId()).isEqualTo(ENTITY_ID);
- assertThat(item.getFeatureGraphicUrl()).isEqualTo(FEATURE_GRAPHIC_URL);
assertThat(item.getFirstObservationTimestampMillis())
.isEqualTo(FIRST_OBSERVATION_TIMESTAMP_MILLIS);
- assertThat(item.getGroupId()).isEqualTo(GROUP_ID);
assertThat(item.getIconFfeUrl()).isEqualTo(ICON_FIFE_URL);
assertThat(item.getIconPng()).isEqualTo(ICON_PNG);
assertThat(item.getId()).isEqualTo(ID);
assertThat(item.getLastObservationTimestampMillis())
.isEqualTo(LAST_OBSERVATION_TIMESTAMP_MILLIS);
- assertThat(item.getLastUserExperience()).isEqualTo(LAST_USER_EXPERIENCE);
- assertThat(item.getLostMillis()).isEqualTo(LOST_MILLIS);
assertThat(item.getMacAddress()).isEqualTo(MAC_ADDRESS);
assertThat(item.getPackageName()).isEqualTo(PACKAGE_NAME);
assertThat(item.getPendingAppInstallTimestampMillis())
@@ -1068,7 +979,6 @@
assertThat(item.getTitle()).isEqualTo(TITLE);
assertThat(item.getTriggerId()).isEqualTo(TRIGGER_ID);
assertThat(item.getTxPower()).isEqualTo(TX_POWER);
- assertThat(item.getType()).isEqualTo(TYPE);
}
/* Verifies Happy Path EligibleAccountParcel[]. */
diff --git a/nearby/tests/cts/fastpair/src/android/nearby/cts/ScanRequestTest.java b/nearby/tests/cts/fastpair/src/android/nearby/cts/ScanRequestTest.java
index 019f8ec..3a73b9f 100644
--- a/nearby/tests/cts/fastpair/src/android/nearby/cts/ScanRequestTest.java
+++ b/nearby/tests/cts/fastpair/src/android/nearby/cts/ScanRequestTest.java
@@ -21,10 +21,8 @@
import static android.nearby.ScanRequest.SCAN_MODE_LOW_LATENCY;
import static android.nearby.ScanRequest.SCAN_MODE_LOW_POWER;
import static android.nearby.ScanRequest.SCAN_MODE_NO_POWER;
-import static android.nearby.ScanRequest.SCAN_TYPE_EXPOSURE_NOTIFICATION;
import static android.nearby.ScanRequest.SCAN_TYPE_FAST_PAIR;
import static android.nearby.ScanRequest.SCAN_TYPE_NEARBY_PRESENCE;
-import static android.nearby.ScanRequest.SCAN_TYPE_NEARBY_SHARE;
import static com.google.common.truth.Truth.assertThat;
@@ -80,7 +78,7 @@
@SdkSuppress(minSdkVersion = 32, codeName = "T")
public void testSetWorkSource_nullValue() {
ScanRequest request = new ScanRequest.Builder()
- .setScanType(SCAN_TYPE_EXPOSURE_NOTIFICATION)
+ .setScanType(SCAN_TYPE_FAST_PAIR)
.setWorkSource(null)
.build();
@@ -94,14 +92,14 @@
public void testToString() {
WorkSource workSource = getWorkSource();
ScanRequest request = new ScanRequest.Builder()
- .setScanType(SCAN_TYPE_NEARBY_SHARE)
+ .setScanType(SCAN_TYPE_FAST_PAIR)
.setScanMode(SCAN_MODE_BALANCED)
.setBleEnabled(true)
.setWorkSource(workSource)
.build();
assertThat(request.toString()).isEqualTo(
- "Request[scanType=2, scanMode=SCAN_MODE_BALANCED, "
+ "Request[scanType=1, scanMode=SCAN_MODE_BALANCED, "
+ "enableBle=true, workSource=WorkSource{" + UID + " " + APP_NAME
+ "}, scanFilters=[]]");
}
@@ -132,9 +130,7 @@
@SdkSuppress(minSdkVersion = 32, codeName = "T")
public void test_isValidScanType() {
assertThat(ScanRequest.isValidScanType(SCAN_TYPE_FAST_PAIR)).isTrue();
- assertThat(ScanRequest.isValidScanType(SCAN_TYPE_NEARBY_SHARE)).isTrue();
assertThat(ScanRequest.isValidScanType(SCAN_TYPE_NEARBY_PRESENCE)).isTrue();
- assertThat(ScanRequest.isValidScanType(SCAN_TYPE_EXPOSURE_NOTIFICATION)).isTrue();
assertThat(ScanRequest.isValidScanType(0)).isFalse();
assertThat(ScanRequest.isValidScanType(5)).isFalse();
diff --git a/nearby/tests/unit/src/android/nearby/ScanRequestTest.java b/nearby/tests/unit/src/android/nearby/ScanRequestTest.java
index 020f6d6..a45d8bb 100644
--- a/nearby/tests/unit/src/android/nearby/ScanRequestTest.java
+++ b/nearby/tests/unit/src/android/nearby/ScanRequestTest.java
@@ -18,10 +18,8 @@
import static android.nearby.ScanRequest.SCAN_MODE_BALANCED;
import static android.nearby.ScanRequest.SCAN_MODE_LOW_POWER;
-import static android.nearby.ScanRequest.SCAN_TYPE_EXPOSURE_NOTIFICATION;
import static android.nearby.ScanRequest.SCAN_TYPE_FAST_PAIR;
import static android.nearby.ScanRequest.SCAN_TYPE_NEARBY_PRESENCE;
-import static android.nearby.ScanRequest.SCAN_TYPE_NEARBY_SHARE;
import static com.google.common.truth.Truth.assertThat;
@@ -82,7 +80,7 @@
public void testSetWorkSource() {
WorkSource workSource = getWorkSource();
ScanRequest request = new ScanRequest.Builder()
- .setScanType(SCAN_TYPE_NEARBY_SHARE)
+ .setScanType(SCAN_TYPE_FAST_PAIR)
.setWorkSource(workSource)
.build();
@@ -93,7 +91,7 @@
@Test
public void testSetWorkSource_nullValue() {
ScanRequest request = new ScanRequest.Builder()
- .setScanType(SCAN_TYPE_EXPOSURE_NOTIFICATION)
+ .setScanType(SCAN_TYPE_FAST_PAIR)
.setWorkSource(null)
.build();
@@ -106,14 +104,14 @@
public void testToString() {
WorkSource workSource = getWorkSource();
ScanRequest request = new ScanRequest.Builder()
- .setScanType(SCAN_TYPE_NEARBY_SHARE)
+ .setScanType(SCAN_TYPE_FAST_PAIR)
.setScanMode(SCAN_MODE_BALANCED)
.setBleEnabled(true)
.setWorkSource(workSource)
.build();
assertThat(request.toString()).isEqualTo(
- "Request[scanType=2, scanMode=SCAN_MODE_BALANCED, "
+ "Request[scanType=1, scanMode=SCAN_MODE_BALANCED, "
+ "enableBle=true, workSource=WorkSource{1001 android.nearby.tests}, "
+ "scanFilters=[]]");
}
diff --git a/nearby/tests/unit/src/com/android/server/nearby/common/ble/util/RangingUtilsTest.java b/nearby/tests/unit/src/com/android/server/nearby/common/ble/util/RangingUtilsTest.java
index 2926015..ebe72b3 100644
--- a/nearby/tests/unit/src/com/android/server/nearby/common/ble/util/RangingUtilsTest.java
+++ b/nearby/tests/unit/src/com/android/server/nearby/common/ble/util/RangingUtilsTest.java
@@ -32,17 +32,14 @@
public void distanceFromRssi_getCorrectValue() {
// Distance expected to be 1.0 meters based on an RSSI/TxPower of -41dBm
// Using params: int rssi (dBm), int calibratedTxPower (dBm)
- double distance = RangingUtils.distanceFromRssi(-41, -41);
+ double distance = RangingUtils.distanceFromRssiAndTxPower(-82, -41);
assertThat(distance).isWithin(DELTA).of(1.0);
- double distance2 = RangingUtils.distanceFromRssi(-70, -50);
+ double distance2 = RangingUtils.distanceFromRssiAndTxPower(-111, -50);
assertThat(distance2).isWithin(DELTA).of(10.0);
- // testing that the double values are not casted to integers
- double distance3 = RangingUtils.distanceFromRssi(-67, -77);
- assertThat(distance3).isWithin(DELTA).of(0.31622776601683794);
-
- double distance4 = RangingUtils.distanceFromRssi(-50, -70);
+ //rssi txpower
+ double distance4 = RangingUtils.distanceFromRssiAndTxPower(-50, -29);
assertThat(distance4).isWithin(DELTA).of(0.1);
}
@@ -50,8 +47,17 @@
public void testRssiFromDistance() {
// RSSI expected at 1 meter based on the calibrated tx field of -41dBm
// Using params: distance (m), int calibratedTxPower (dBm),
- int rssi = RangingUtils.rssiFromDistance(1.0, -41);
+ int rssi = RangingUtils.rssiFromTargetDistance(1.0, -41);
- assertThat(rssi).isEqualTo(-41);
+ assertThat(rssi).isEqualTo(-82);
+ }
+
+ @Test
+ public void testOutOfRange() {
+ double distance = RangingUtils.distanceFromRssiAndTxPower(-200, -41);
+ assertThat(distance).isWithin(DELTA).of(177.82794);
+
+ distance = RangingUtils.distanceFromRssiAndTxPower(200, -41);
+ assertThat(distance).isWithin(DELTA).of(0);
}
}
diff --git a/nearby/tests/unit/src/com/android/server/nearby/fastpair/FastPairAdvHandlerTest.java b/nearby/tests/unit/src/com/android/server/nearby/fastpair/FastPairAdvHandlerTest.java
new file mode 100644
index 0000000..346a961
--- /dev/null
+++ b/nearby/tests/unit/src/com/android/server/nearby/fastpair/FastPairAdvHandlerTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * 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
+ *
+ * http://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.
+ */
+
+package com.android.server.nearby.fastpair;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.nearby.FastPairDevice;
+
+import com.android.server.nearby.common.locator.LocatorContextWrapper;
+import com.android.server.nearby.fastpair.halfsheet.FastPairHalfSheetManager;
+import com.android.server.nearby.fastpair.notification.FastPairNotificationManager;
+import com.android.server.nearby.provider.FastPairDataProvider;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import service.proto.Rpcs;
+
+public class FastPairAdvHandlerTest {
+ @Mock
+ private Context mContext;
+ @Mock
+ private FastPairDataProvider mFastPairDataProvider;
+ @Mock
+ private FastPairHalfSheetManager mFastPairHalfSheetManager;
+ @Mock
+ private FastPairNotificationManager mFastPairNotificationManager;
+ private static final String BLUETOOTH_ADDRESS = "AA:BB:CC:DD";
+ private static final int CLOSE_RSSI = -80;
+ private static final int FAR_AWAY_RSSI = -120;
+ private static final int TX_POWER = -70;
+ private static final byte[] INITIAL_BYTE_ARRAY = new byte[]{0x01, 0x02, 0x03};
+
+ LocatorContextWrapper mLocatorContextWrapper;
+ FastPairAdvHandler mFastPairAdvHandler;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+
+ mLocatorContextWrapper = new LocatorContextWrapper(mContext);
+ mLocatorContextWrapper.getLocator().overrideBindingForTest(
+ FastPairHalfSheetManager.class, mFastPairHalfSheetManager
+ );
+ mLocatorContextWrapper.getLocator().overrideBindingForTest(
+ FastPairNotificationManager.class, mFastPairNotificationManager
+ );
+ when(mFastPairDataProvider.loadFastPairAntispoofKeyDeviceMetadata(any()))
+ .thenReturn(Rpcs.GetObservedDeviceResponse.getDefaultInstance());
+ mFastPairAdvHandler = new FastPairAdvHandler(mLocatorContextWrapper, mFastPairDataProvider);
+ }
+
+ @Test
+ public void testInitialBroadcast() {
+ FastPairDevice fastPairDevice = new FastPairDevice.Builder()
+ .setData(INITIAL_BYTE_ARRAY)
+ .setBluetoothAddress(BLUETOOTH_ADDRESS)
+ .setRssi(CLOSE_RSSI)
+ .setTxPower(TX_POWER)
+ .build();
+
+ mFastPairAdvHandler.handleBroadcast(fastPairDevice);
+
+ verify(mFastPairHalfSheetManager).showHalfSheet(any());
+ }
+
+ @Test
+ public void testInitialBroadcast_farAway_notShowHalfSheet() {
+ FastPairDevice fastPairDevice = new FastPairDevice.Builder()
+ .setData(INITIAL_BYTE_ARRAY)
+ .setBluetoothAddress(BLUETOOTH_ADDRESS)
+ .setRssi(FAR_AWAY_RSSI)
+ .setTxPower(TX_POWER)
+ .build();
+
+ mFastPairAdvHandler.handleBroadcast(fastPairDevice);
+
+ verify(mFastPairHalfSheetManager, never()).showHalfSheet(any());
+ }
+
+ @Test
+ public void testSubsequentBroadcast() {
+ byte[] fastPairRecordWithBloomFilter =
+ new byte[]{
+ (byte) 0x02,
+ (byte) 0x01,
+ (byte) 0x02, // Flags
+ (byte) 0x02,
+ (byte) 0x0A,
+ (byte) 0xEB, // Tx Power (-20)
+ (byte) 0x0B,
+ (byte) 0x16,
+ (byte) 0x2C,
+ (byte) 0xFE, // FastPair Service Data
+ (byte) 0x00, // Flags (model ID length = 3)
+ (byte) 0x40, // Account key hash flags (length = 4, type = 0)
+ (byte) 0x11,
+ (byte) 0x22,
+ (byte) 0x33,
+ (byte) 0x44, // Account key hash (0x11223344)
+ (byte) 0x11, // Account key salt flags (length = 1, type = 1)
+ (byte) 0x55, // Account key salt
+ };
+ FastPairDevice fastPairDevice = new FastPairDevice.Builder()
+ .setData(fastPairRecordWithBloomFilter)
+ .setBluetoothAddress(BLUETOOTH_ADDRESS)
+ .setRssi(CLOSE_RSSI)
+ .setTxPower(TX_POWER)
+ .build();
+
+ mFastPairAdvHandler.handleBroadcast(fastPairDevice);
+
+ verify(mFastPairHalfSheetManager, never()).showHalfSheet(any());
+ }
+}
diff --git a/nearby/tests/unit/src/com/android/server/nearby/fastpair/testing/FakeDiscoveryItems.java b/nearby/tests/unit/src/com/android/server/nearby/fastpair/testing/FakeDiscoveryItems.java
index aa7e6f6..c406e47 100644
--- a/nearby/tests/unit/src/com/android/server/nearby/fastpair/testing/FakeDiscoveryItems.java
+++ b/nearby/tests/unit/src/com/android/server/nearby/fastpair/testing/FakeDiscoveryItems.java
@@ -42,7 +42,6 @@
item.setState(Cache.StoredDiscoveryItem.State.STATE_ENABLED);
item.setId(FAST_PAIR_ID);
item.setDescription(DEFAULT_DESCRIPITON);
- item.setType(Cache.NearbyType.NEARBY_DEVICE);
item.setTriggerId(triggerId);
item.setMacAddress(DEFAULT_MAC_ADDRESS);
item.setFirstObservationTimestampMillis(DEFAULT_TIMESTAMP);
diff --git a/nearby/tests/unit/src/com/android/server/nearby/metrics/NearbyMetricsTest.java b/nearby/tests/unit/src/com/android/server/nearby/metrics/NearbyMetricsTest.java
index c4d1ee2..91962ce 100644
--- a/nearby/tests/unit/src/com/android/server/nearby/metrics/NearbyMetricsTest.java
+++ b/nearby/tests/unit/src/com/android/server/nearby/metrics/NearbyMetricsTest.java
@@ -17,7 +17,7 @@
package com.android.server.nearby.metrics;
import static android.nearby.ScanRequest.SCAN_MODE_BALANCED;
-import static android.nearby.ScanRequest.SCAN_TYPE_NEARBY_SHARE;
+import static android.nearby.ScanRequest.SCAN_TYPE_FAST_PAIR;
import android.nearby.NearbyDeviceParcelable;
import android.nearby.PublicCredential;
@@ -59,7 +59,7 @@
private final ScanRequest.Builder mScanRequestBuilder =
new ScanRequest.Builder()
.setScanMode(SCAN_MODE_BALANCED)
- .setScanType(SCAN_TYPE_NEARBY_SHARE);
+ .setScanType(SCAN_TYPE_FAST_PAIR);
private final ScanRequest mScanRequest = mScanRequestBuilder.setWorkSource(mWorkSource).build();
private final ScanRequest mScanRequestWithEmptyWorkSource =
mScanRequestBuilder.setWorkSource(mEmptyWorkSource).build();
@@ -103,7 +103,7 @@
SESSION_ID,
NearbyStatsLog
.NEARBY_DEVICE_SCAN_STATE_CHANGED__SCAN_STATE__NEARBY_SCAN_STATE_STARTED,
- SCAN_TYPE_NEARBY_SHARE,
+ SCAN_TYPE_FAST_PAIR,
0,
0,
"",
@@ -119,7 +119,7 @@
SESSION_ID,
NearbyStatsLog
.NEARBY_DEVICE_SCAN_STATE_CHANGED__SCAN_STATE__NEARBY_SCAN_STATE_STARTED,
- SCAN_TYPE_NEARBY_SHARE,
+ SCAN_TYPE_FAST_PAIR,
0,
0,
"",
@@ -135,7 +135,7 @@
SESSION_ID,
NearbyStatsLog
.NEARBY_DEVICE_SCAN_STATE_CHANGED__SCAN_STATE__NEARBY_SCAN_STATE_STOPPED,
- SCAN_TYPE_NEARBY_SHARE,
+ SCAN_TYPE_FAST_PAIR,
0,
0,
"",
@@ -151,7 +151,7 @@
SESSION_ID,
NearbyStatsLog
.NEARBY_DEVICE_SCAN_STATE_CHANGED__SCAN_STATE__NEARBY_SCAN_STATE_STOPPED,
- SCAN_TYPE_NEARBY_SHARE,
+ SCAN_TYPE_FAST_PAIR,
0,
0,
"",
@@ -167,7 +167,7 @@
SESSION_ID,
NearbyStatsLog
.NEARBY_DEVICE_SCAN_STATE_CHANGED__SCAN_STATE__NEARBY_SCAN_STATE_DISCOVERED,
- SCAN_TYPE_NEARBY_SHARE,
+ SCAN_TYPE_FAST_PAIR,
SCAN_MEDIUM,
RSSI,
FAST_PAIR_MODEL_ID,
@@ -184,7 +184,7 @@
SESSION_ID,
NearbyStatsLog
.NEARBY_DEVICE_SCAN_STATE_CHANGED__SCAN_STATE__NEARBY_SCAN_STATE_DISCOVERED,
- SCAN_TYPE_NEARBY_SHARE,
+ SCAN_TYPE_FAST_PAIR,
SCAN_MEDIUM,
RSSI,
FAST_PAIR_MODEL_ID,
diff --git a/nearby/tests/unit/src/com/android/server/nearby/provider/UtilsTest.java b/nearby/tests/unit/src/com/android/server/nearby/provider/UtilsTest.java
index 205d5c2..eeea319 100644
--- a/nearby/tests/unit/src/com/android/server/nearby/provider/UtilsTest.java
+++ b/nearby/tests/unit/src/com/android/server/nearby/provider/UtilsTest.java
@@ -310,13 +310,6 @@
private static void ensureHappyPathAsExpected(FastPairDeviceMetadataParcel metadataParcel) {
assertThat(metadataParcel).isNotNull();
- assertThat(metadataParcel.assistantSetupHalfSheet).isEqualTo(ASSISTANT_SETUP_HALFSHEET);
- assertThat(metadataParcel.assistantSetupNotification).isEqualTo(
- ASSISTANT_SETUP_NOTIFICATION);
-
-
- assertThat(metadataParcel.confirmPinDescription).isEqualTo(CONFIRM_PIN_DESCRIPTION);
- assertThat(metadataParcel.confirmPinTitle).isEqualTo(CONFIRM_PIN_TITLE);
assertThat(metadataParcel.connectSuccessCompanionAppInstalled).isEqualTo(
CONNECT_SUCCESS_COMPANION_APP_INSTALLED);
assertThat(metadataParcel.connectSuccessCompanionAppNotInstalled).isEqualTo(
@@ -326,8 +319,6 @@
assertThat(metadataParcel.failConnectGoToSettingsDescription).isEqualTo(
FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION);
- assertThat(metadataParcel.fastPairTvConnectDeviceNoAccountDescription).isEqualTo(
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
assertThat(metadataParcel.initialNotificationDescription).isEqualTo(
INITIAL_NOTIFICATION_DESCRIPTION);
@@ -341,10 +332,6 @@
assertThat(metadataParcel.subsequentPairingDescription).isEqualTo(
SUBSEQUENT_PAIRING_DESCRIPTION);
- assertThat(metadataParcel.syncContactsDescription).isEqualTo(SYNC_CONTACT_DESCRPTION);
- assertThat(metadataParcel.syncContactsTitle).isEqualTo(SYNC_CONTACTS_TITLE);
- assertThat(metadataParcel.syncSmsDescription).isEqualTo(SYNC_SMS_DESCRIPTION);
- assertThat(metadataParcel.syncSmsTitle).isEqualTo(SYNC_SMS_TITLE);
assertThat(metadataParcel.trueWirelessImageUrlCase).isEqualTo(TRUE_WIRELESS_IMAGE_URL_CASE);
assertThat(metadataParcel.trueWirelessImageUrlLeftBud).isEqualTo(
@@ -378,27 +365,18 @@
assertThat(itemParcel.actionUrl).isEqualTo(ACTION_URL);
assertThat(itemParcel.actionUrlType).isEqualTo(ACTION_URL_TYPE);
assertThat(itemParcel.appName).isEqualTo(APP_NAME);
- assertThat(itemParcel.attachmentType).isEqualTo(ATTACHMENT_TYPE);
assertThat(itemParcel.authenticationPublicKeySecp256r1)
.isEqualTo(AUTHENTICATION_PUBLIC_KEY_SEC_P256R1);
- assertThat(itemParcel.bleRecordBytes).isEqualTo(BLE_RECORD_BYTES);
- assertThat(itemParcel.debugCategory).isEqualTo(DEBUG_CATEGORY);
- assertThat(itemParcel.debugMessage).isEqualTo(DEBUG_MESSAGE);
assertThat(itemParcel.description).isEqualTo(DESCRIPTION);
assertThat(itemParcel.deviceName).isEqualTo(DEVICE_NAME);
assertThat(itemParcel.displayUrl).isEqualTo(DISPLAY_URL);
- assertThat(itemParcel.entityId).isEqualTo(ENTITY_ID);
- assertThat(itemParcel.featureGraphicUrl).isEqualTo(FEATURE_GRAPHIC_URL);
assertThat(itemParcel.firstObservationTimestampMillis)
.isEqualTo(FIRST_OBSERVATION_TIMESTAMP_MILLIS);
- assertThat(itemParcel.groupId).isEqualTo(GROUP_ID);
assertThat(itemParcel.iconFifeUrl).isEqualTo(ICON_FIFE_URL);
assertThat(itemParcel.iconPng).isEqualTo(ICON_PNG);
assertThat(itemParcel.id).isEqualTo(ID);
assertThat(itemParcel.lastObservationTimestampMillis)
.isEqualTo(LAST_OBSERVATION_TIMESTAMP_MILLIS);
- assertThat(itemParcel.lastUserExperience).isEqualTo(LAST_USER_EXPERIENCE);
- assertThat(itemParcel.lostMillis).isEqualTo(LOST_MILLIS);
assertThat(itemParcel.macAddress).isEqualTo(MAC_ADDRESS);
assertThat(itemParcel.packageName).isEqualTo(PACKAGE_NAME);
assertThat(itemParcel.pendingAppInstallTimestampMillis)
@@ -408,7 +386,6 @@
assertThat(itemParcel.title).isEqualTo(TITLE);
assertThat(itemParcel.triggerId).isEqualTo(TRIGGER_ID);
assertThat(itemParcel.txPower).isEqualTo(TX_POWER);
- assertThat(itemParcel.type).isEqualTo(TYPE);
}
private static FastPairEligibleAccountParcel genHappyPathFastPairEligibleAccountParcel() {
@@ -461,19 +438,13 @@
private static FastPairDeviceMetadataParcel genHappyPathFastPairDeviceMetadataParcel() {
FastPairDeviceMetadataParcel parcel = new FastPairDeviceMetadataParcel();
- parcel.assistantSetupHalfSheet = ASSISTANT_SETUP_HALFSHEET;
- parcel.assistantSetupNotification = ASSISTANT_SETUP_NOTIFICATION;
parcel.bleTxPower = BLE_TX_POWER;
- parcel.confirmPinDescription = CONFIRM_PIN_DESCRIPTION;
- parcel.confirmPinTitle = CONFIRM_PIN_TITLE;
parcel.connectSuccessCompanionAppInstalled = CONNECT_SUCCESS_COMPANION_APP_INSTALLED;
parcel.connectSuccessCompanionAppNotInstalled =
CONNECT_SUCCESS_COMPANION_APP_NOT_INSTALLED;
parcel.deviceType = DEVICE_TYPE;
parcel.downloadCompanionAppDescription = DOWNLOAD_COMPANION_APP_DESCRIPTION;
parcel.failConnectGoToSettingsDescription = FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION;
- parcel.fastPairTvConnectDeviceNoAccountDescription =
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION;
parcel.image = IMAGE;
parcel.imageUrl = IMAGE_URL;
parcel.initialNotificationDescription = INITIAL_NOTIFICATION_DESCRIPTION;
@@ -481,15 +452,10 @@
INITIAL_NOTIFICATION_DESCRIPTION_NO_ACCOUNT;
parcel.initialPairingDescription = INITIAL_PAIRING_DESCRIPTION;
parcel.intentUri = INTENT_URI;
- parcel.locale = LOCALE;
parcel.name = NAME;
parcel.openCompanionAppDescription = OPEN_COMPANION_APP_DESCRIPTION;
parcel.retroactivePairingDescription = RETRO_ACTIVE_PAIRING_DESCRIPTION;
parcel.subsequentPairingDescription = SUBSEQUENT_PAIRING_DESCRIPTION;
- parcel.syncContactsDescription = SYNC_CONTACT_DESCRPTION;
- parcel.syncContactsTitle = SYNC_CONTACTS_TITLE;
- parcel.syncSmsDescription = SYNC_SMS_DESCRIPTION;
- parcel.syncSmsTitle = SYNC_SMS_TITLE;
parcel.triggerDistance = TRIGGER_DISTANCE;
parcel.trueWirelessImageUrlCase = TRUE_WIRELESS_IMAGE_URL_CASE;
parcel.trueWirelessImageUrlLeftBud = TRUE_WIRELESS_IMAGE_URL_LEFT_BUD;
@@ -508,30 +474,18 @@
storedDiscoveryItemBuilder.setActionUrl(ACTION_URL);
storedDiscoveryItemBuilder.setActionUrlType(Cache.ResolvedUrlType.WEBPAGE);
storedDiscoveryItemBuilder.setAppName(APP_NAME);
- storedDiscoveryItemBuilder.setAttachmentType(
- Cache.DiscoveryAttachmentType.DISCOVERY_ATTACHMENT_TYPE_NORMAL);
storedDiscoveryItemBuilder.setAuthenticationPublicKeySecp256R1(
ByteString.copyFrom(AUTHENTICATION_PUBLIC_KEY_SEC_P256R1));
- storedDiscoveryItemBuilder.setBleRecordBytes(ByteString.copyFrom(BLE_RECORD_BYTES));
- storedDiscoveryItemBuilder.setDebugCategory(
- Cache.StoredDiscoveryItem.DebugMessageCategory.STATUS_VALID_NOTIFICATION);
- storedDiscoveryItemBuilder.setDebugMessage(DEBUG_MESSAGE);
storedDiscoveryItemBuilder.setDescription(DESCRIPTION);
storedDiscoveryItemBuilder.setDeviceName(DEVICE_NAME);
storedDiscoveryItemBuilder.setDisplayUrl(DISPLAY_URL);
- storedDiscoveryItemBuilder.setEntityId(ENTITY_ID);
- storedDiscoveryItemBuilder.setFeatureGraphicUrl(FEATURE_GRAPHIC_URL);
storedDiscoveryItemBuilder.setFirstObservationTimestampMillis(
FIRST_OBSERVATION_TIMESTAMP_MILLIS);
- storedDiscoveryItemBuilder.setGroupId(GROUP_ID);
storedDiscoveryItemBuilder.setIconFifeUrl(ICON_FIFE_URL);
storedDiscoveryItemBuilder.setIconPng(ByteString.copyFrom(ICON_PNG));
storedDiscoveryItemBuilder.setId(ID);
storedDiscoveryItemBuilder.setLastObservationTimestampMillis(
LAST_OBSERVATION_TIMESTAMP_MILLIS);
- storedDiscoveryItemBuilder.setLastUserExperience(
- Cache.StoredDiscoveryItem.ExperienceType.EXPERIENCE_GOOD);
- storedDiscoveryItemBuilder.setLostMillis(LOST_MILLIS);
storedDiscoveryItemBuilder.setMacAddress(MAC_ADDRESS);
storedDiscoveryItemBuilder.setPackageName(PACKAGE_NAME);
storedDiscoveryItemBuilder.setPendingAppInstallTimestampMillis(
@@ -541,21 +495,14 @@
storedDiscoveryItemBuilder.setTitle(TITLE);
storedDiscoveryItemBuilder.setTriggerId(TRIGGER_ID);
storedDiscoveryItemBuilder.setTxPower(TX_POWER);
- storedDiscoveryItemBuilder.setType(Cache.NearbyType.NEARBY_PROXIMITY_BEACON);
FastPairStrings.Builder stringsBuilder = FastPairStrings.newBuilder();
- stringsBuilder.setAssistantHalfSheetDescription(ASSISTANT_SETUP_HALFSHEET);
- stringsBuilder.setAssistantNotificationDescription(ASSISTANT_SETUP_NOTIFICATION);
- stringsBuilder.setConfirmPinDescription(CONFIRM_PIN_DESCRIPTION);
- stringsBuilder.setConfirmPinTitle(CONFIRM_PIN_TITLE);
stringsBuilder.setPairingFinishedCompanionAppInstalled(
CONNECT_SUCCESS_COMPANION_APP_INSTALLED);
stringsBuilder.setPairingFinishedCompanionAppNotInstalled(
CONNECT_SUCCESS_COMPANION_APP_NOT_INSTALLED);
stringsBuilder.setPairingFailDescription(
FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION);
- stringsBuilder.setFastPairTvConnectDeviceNoAccountDescription(
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
stringsBuilder.setTapToPairWithAccount(
INITIAL_NOTIFICATION_DESCRIPTION);
stringsBuilder.setTapToPairWithoutAccount(
@@ -563,10 +510,6 @@
stringsBuilder.setInitialPairingDescription(INITIAL_PAIRING_DESCRIPTION);
stringsBuilder.setRetroactivePairingDescription(RETRO_ACTIVE_PAIRING_DESCRIPTION);
stringsBuilder.setSubsequentPairingDescription(SUBSEQUENT_PAIRING_DESCRIPTION);
- stringsBuilder.setSyncContactsDescription(SYNC_CONTACT_DESCRPTION);
- stringsBuilder.setSyncContactsTitle(SYNC_CONTACTS_TITLE);
- stringsBuilder.setSyncSmsDescription(SYNC_SMS_DESCRIPTION);
- stringsBuilder.setSyncSmsTitle(SYNC_SMS_TITLE);
stringsBuilder.setWaitAppLaunchDescription(WAIT_LAUNCH_COMPANION_APP_DESCRIPTION);
storedDiscoveryItemBuilder.setFastPairStrings(stringsBuilder.build());
@@ -606,24 +549,15 @@
parcel.actionUrl = ACTION_URL;
parcel.actionUrlType = ACTION_URL_TYPE;
parcel.appName = APP_NAME;
- parcel.attachmentType = ATTACHMENT_TYPE;
parcel.authenticationPublicKeySecp256r1 = AUTHENTICATION_PUBLIC_KEY_SEC_P256R1;
- parcel.bleRecordBytes = BLE_RECORD_BYTES;
- parcel.debugCategory = DEBUG_CATEGORY;
- parcel.debugMessage = DEBUG_MESSAGE;
parcel.description = DESCRIPTION;
parcel.deviceName = DEVICE_NAME;
parcel.displayUrl = DISPLAY_URL;
- parcel.entityId = ENTITY_ID;
- parcel.featureGraphicUrl = FEATURE_GRAPHIC_URL;
parcel.firstObservationTimestampMillis = FIRST_OBSERVATION_TIMESTAMP_MILLIS;
- parcel.groupId = GROUP_ID;
parcel.iconFifeUrl = ICON_FIFE_URL;
parcel.iconPng = ICON_PNG;
parcel.id = ID;
parcel.lastObservationTimestampMillis = LAST_OBSERVATION_TIMESTAMP_MILLIS;
- parcel.lastUserExperience = LAST_USER_EXPERIENCE;
- parcel.lostMillis = LOST_MILLIS;
parcel.macAddress = MAC_ADDRESS;
parcel.packageName = PACKAGE_NAME;
parcel.pendingAppInstallTimestampMillis = PENDING_APP_INSTALL_TIMESTAMP_MILLIS;
@@ -632,7 +566,6 @@
parcel.title = TITLE;
parcel.triggerId = TRIGGER_ID;
parcel.txPower = TX_POWER;
- parcel.type = TYPE;
return parcel;
}
@@ -659,10 +592,6 @@
.setDevice(deviceBuilder.build())
.setImage(ByteString.copyFrom(IMAGE))
.setStrings(Rpcs.ObservedDeviceStrings.newBuilder()
- .setAssistantSetupHalfSheet(ASSISTANT_SETUP_HALFSHEET)
- .setAssistantSetupNotification(ASSISTANT_SETUP_NOTIFICATION)
- .setConfirmPinDescription(CONFIRM_PIN_DESCRIPTION)
- .setConfirmPinTitle(CONFIRM_PIN_TITLE)
.setConnectSuccessCompanionAppInstalled(
CONNECT_SUCCESS_COMPANION_APP_INSTALLED)
.setConnectSuccessCompanionAppNotInstalled(
@@ -671,29 +600,18 @@
DOWNLOAD_COMPANION_APP_DESCRIPTION)
.setFailConnectGoToSettingsDescription(
FAIL_CONNECT_GOTO_SETTINGS_DESCRIPTION)
- .setFastPairTvConnectDeviceNoAccountDescription(
- FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION)
.setInitialNotificationDescription(
INITIAL_NOTIFICATION_DESCRIPTION)
.setInitialNotificationDescriptionNoAccount(
INITIAL_NOTIFICATION_DESCRIPTION_NO_ACCOUNT)
.setInitialPairingDescription(
INITIAL_PAIRING_DESCRIPTION)
- .setLocale(LOCALE)
.setOpenCompanionAppDescription(
OPEN_COMPANION_APP_DESCRIPTION)
.setRetroactivePairingDescription(
RETRO_ACTIVE_PAIRING_DESCRIPTION)
.setSubsequentPairingDescription(
SUBSEQUENT_PAIRING_DESCRIPTION)
- .setSyncContactsDescription(
- SYNC_CONTACT_DESCRPTION)
- .setSyncContactsTitle(
- SYNC_CONTACTS_TITLE)
- .setSyncSmsDescription(
- SYNC_SMS_DESCRIPTION)
- .setSyncSmsTitle(
- SYNC_SMS_TITLE)
.setUnableToConnectDescription(
UNABLE_TO_CONNECT_DESCRIPTION)
.setUnableToConnectTitle(
diff --git a/nearby/tests/unit/src/com/android/server/nearby/util/DataUtilsTest.java b/nearby/tests/unit/src/com/android/server/nearby/util/DataUtilsTest.java
index 9152c07..f098600 100644
--- a/nearby/tests/unit/src/com/android/server/nearby/util/DataUtilsTest.java
+++ b/nearby/tests/unit/src/com/android/server/nearby/util/DataUtilsTest.java
@@ -92,12 +92,6 @@
.isEqualTo(MESSAGE_WAIT_LAUNCH_COMPANION_APP_DESCRIPTION);
assertThat(strings.getPairingFailDescription())
.isEqualTo(MESSAGE_FAIL_CONNECT_DESCRIPTION);
- assertThat(strings.getAssistantHalfSheetDescription())
- .isEqualTo(MESSAGE_ASSISTANT_HALF_SHEET_DESCRIPTION);
- assertThat(strings.getAssistantNotificationDescription())
- .isEqualTo(MESSAGE_ASSISTANT_NOTIFICATION_DESCRIPTION);
- assertThat(strings.getFastPairTvConnectDeviceNoAccountDescription())
- .isEqualTo(MESSAGE_FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION);
}
@Test
@@ -124,10 +118,7 @@
+ "subsequentPairingDescription=message 6, "
+ "retroactivePairingDescription=message 7, "
+ "waitAppLaunchDescription=message 8, "
- + "pairingFailDescription=message 9, "
- + "assistantHalfSheetDescription=message 11, "
- + "assistantNotificationDescription=message 12, "
- + "fastPairTvConnectDeviceNoAccountDescription=message 10]");
+ + "pairingFailDescription=message 9]");
}
private static GetObservedDeviceResponse createObservedDeviceResponse() {
@@ -168,13 +159,7 @@
.setWaitLaunchCompanionAppDescription(
MESSAGE_WAIT_LAUNCH_COMPANION_APP_DESCRIPTION)
.setFailConnectGoToSettingsDescription(
- MESSAGE_FAIL_CONNECT_DESCRIPTION)
- .setAssistantSetupHalfSheet(
- MESSAGE_ASSISTANT_HALF_SHEET_DESCRIPTION)
- .setAssistantSetupNotification(
- MESSAGE_ASSISTANT_NOTIFICATION_DESCRIPTION)
- .setFastPairTvConnectDeviceNoAccountDescription(
- MESSAGE_FAST_PAIR_TV_CONNECT_DEVICE_NO_ACCOUNT_DESCRIPTION))
+ MESSAGE_FAIL_CONNECT_DESCRIPTION))
.build();
}
}