[nearby][clean up] Delete all Fast Pair AOSP and HalfSheetUX code
Test: -m Fix: 292812342 Fix: 297413048 Fix: 214879640 Ignore-AOSP-First: merge conflicts, need to be merged in downstream first Change-Id: I7efa92469f0c061a972a7dadf6a38686b78c61b4 Merged-In: I7efa92469f0c061a972a7dadf6a38686b78c61b4
This commit is contained in:
parent
966bb3e0d6
commit
fcd2b7ccb0
477 changed files with 11 additions and 61636 deletions
|
|
@ -52,5 +52,7 @@ java_library {
|
|||
static_libs: [
|
||||
"modules-utils-preconditions",
|
||||
],
|
||||
visibility: ["//packages/modules/Connectivity/nearby/tests:__subpackages__"],
|
||||
visibility: [
|
||||
"//packages/modules/Connectivity/nearby/tests:__subpackages__",
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,183 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.nearby.aidl.FastPairAccountKeyDeviceMetadataParcel;
|
||||
|
||||
/**
|
||||
* Class for metadata of a Fast Pair device associated with an account.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class FastPairAccountKeyDeviceMetadata {
|
||||
|
||||
FastPairAccountKeyDeviceMetadataParcel mMetadataParcel;
|
||||
|
||||
FastPairAccountKeyDeviceMetadata(FastPairAccountKeyDeviceMetadataParcel metadataParcel) {
|
||||
this.mMetadataParcel = metadataParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Device Account Key, which uniquely identifies a Fast Pair device associated with an
|
||||
* account. AccountKey is 16 bytes: first byte is 0x04. Other 15 bytes are randomly generated.
|
||||
*
|
||||
* @return 16-byte Account Key.
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public byte[] getDeviceAccountKey() {
|
||||
return mMetadataParcel.deviceAccountKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a hash value of device's account key and public bluetooth address without revealing the
|
||||
* public bluetooth address. Sha256 hash value is 32 bytes.
|
||||
*
|
||||
* @return 32-byte Sha256 hash value.
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public byte[] getSha256DeviceAccountKeyPublicAddress() {
|
||||
return mMetadataParcel.sha256DeviceAccountKeyPublicAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get metadata of a Fast Pair device type.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public FastPairDeviceMetadata getFastPairDeviceMetadata() {
|
||||
if (mMetadataParcel.metadata == null) {
|
||||
return null;
|
||||
}
|
||||
return new FastPairDeviceMetadata(mMetadataParcel.metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fast Pair discovery item, which is tied to both the device type and the account.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public FastPairDiscoveryItem getFastPairDiscoveryItem() {
|
||||
if (mMetadataParcel.discoveryItem == null) {
|
||||
return null;
|
||||
}
|
||||
return new FastPairDiscoveryItem(mMetadataParcel.discoveryItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder used to create FastPairAccountKeyDeviceMetadata.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
private final FastPairAccountKeyDeviceMetadataParcel mBuilderParcel;
|
||||
|
||||
/**
|
||||
* Default constructor of Builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public Builder() {
|
||||
mBuilderParcel = new FastPairAccountKeyDeviceMetadataParcel();
|
||||
mBuilderParcel.deviceAccountKey = null;
|
||||
mBuilderParcel.sha256DeviceAccountKeyPublicAddress = null;
|
||||
mBuilderParcel.metadata = null;
|
||||
mBuilderParcel.discoveryItem = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Account Key.
|
||||
*
|
||||
* @param deviceAccountKey Fast Pair device account key, which is 16 bytes: first byte is
|
||||
* 0x04. Next 15 bytes are randomly generated.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setDeviceAccountKey(@Nullable byte[] deviceAccountKey) {
|
||||
mBuilderParcel.deviceAccountKey = deviceAccountKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sha256 hash value of account key and public bluetooth address.
|
||||
*
|
||||
* @param sha256DeviceAccountKeyPublicAddress 32-byte sha256 hash value of account key and
|
||||
* public bluetooth address.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setSha256DeviceAccountKeyPublicAddress(
|
||||
@Nullable byte[] sha256DeviceAccountKeyPublicAddress) {
|
||||
mBuilderParcel.sha256DeviceAccountKeyPublicAddress =
|
||||
sha256DeviceAccountKeyPublicAddress;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set Fast Pair metadata.
|
||||
*
|
||||
* @param metadata Fast Pair metadata.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setFastPairDeviceMetadata(@Nullable FastPairDeviceMetadata metadata) {
|
||||
if (metadata == null) {
|
||||
mBuilderParcel.metadata = null;
|
||||
} else {
|
||||
mBuilderParcel.metadata = metadata.mMetadataParcel;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Fast Pair discovery item.
|
||||
*
|
||||
* @param discoveryItem Fast Pair discovery item.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setFastPairDiscoveryItem(@Nullable FastPairDiscoveryItem discoveryItem) {
|
||||
if (discoveryItem == null) {
|
||||
mBuilderParcel.discoveryItem = null;
|
||||
} else {
|
||||
mBuilderParcel.discoveryItem = discoveryItem.mMetadataParcel;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build {@link FastPairAccountKeyDeviceMetadata} with the currently set configuration.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public FastPairAccountKeyDeviceMetadata build() {
|
||||
return new FastPairAccountKeyDeviceMetadata(mBuilderParcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.nearby.aidl.FastPairAntispoofKeyDeviceMetadataParcel;
|
||||
|
||||
/**
|
||||
* Class for a type of registered Fast Pair device keyed by modelID, or antispoofKey.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class FastPairAntispoofKeyDeviceMetadata {
|
||||
|
||||
FastPairAntispoofKeyDeviceMetadataParcel mMetadataParcel;
|
||||
FastPairAntispoofKeyDeviceMetadata(
|
||||
FastPairAntispoofKeyDeviceMetadataParcel metadataParcel) {
|
||||
this.mMetadataParcel = metadataParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Antispoof public key.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public byte[] getAntispoofPublicKey() {
|
||||
return this.mMetadataParcel.antispoofPublicKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get metadata of a Fast Pair device type.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public FastPairDeviceMetadata getFastPairDeviceMetadata() {
|
||||
if (this.mMetadataParcel.deviceMetadata == null) {
|
||||
return null;
|
||||
}
|
||||
return new FastPairDeviceMetadata(this.mMetadataParcel.deviceMetadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder used to create FastPairAntispoofkeyDeviceMetadata.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
private final FastPairAntispoofKeyDeviceMetadataParcel mBuilderParcel;
|
||||
|
||||
/**
|
||||
* Default constructor of Builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public Builder() {
|
||||
mBuilderParcel = new FastPairAntispoofKeyDeviceMetadataParcel();
|
||||
mBuilderParcel.antispoofPublicKey = null;
|
||||
mBuilderParcel.deviceMetadata = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AntiSpoof public key, which uniquely identify a Fast Pair device type.
|
||||
*
|
||||
* @param antispoofPublicKey is 64 bytes, see <a href="https://developers.google.com/nearby/fast-pair/spec#data_format">Data Format</a>.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setAntispoofPublicKey(@Nullable byte[] antispoofPublicKey) {
|
||||
mBuilderParcel.antispoofPublicKey = antispoofPublicKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Fast Pair metadata, which is the property of a Fast Pair device type, including
|
||||
* device images and strings.
|
||||
*
|
||||
* @param metadata Fast Pair device meta data.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setFastPairDeviceMetadata(@Nullable FastPairDeviceMetadata metadata) {
|
||||
if (metadata != null) {
|
||||
mBuilderParcel.deviceMetadata = metadata.mMetadataParcel;
|
||||
} else {
|
||||
mBuilderParcel.deviceMetadata = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build {@link FastPairAntispoofKeyDeviceMetadata} with the currently set configuration.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public FastPairAntispoofKeyDeviceMetadata build() {
|
||||
return new FastPairAntispoofKeyDeviceMetadata(mBuilderParcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,714 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.nearby.aidl.ByteArrayParcel;
|
||||
import android.nearby.aidl.FastPairAccountDevicesMetadataRequestParcel;
|
||||
import android.nearby.aidl.FastPairAccountKeyDeviceMetadataParcel;
|
||||
import android.nearby.aidl.FastPairAntispoofKeyDeviceMetadataRequestParcel;
|
||||
import android.nearby.aidl.FastPairEligibleAccountParcel;
|
||||
import android.nearby.aidl.FastPairEligibleAccountsRequestParcel;
|
||||
import android.nearby.aidl.FastPairManageAccountDeviceRequestParcel;
|
||||
import android.nearby.aidl.FastPairManageAccountRequestParcel;
|
||||
import android.nearby.aidl.IFastPairAccountDevicesMetadataCallback;
|
||||
import android.nearby.aidl.IFastPairAntispoofKeyDeviceMetadataCallback;
|
||||
import android.nearby.aidl.IFastPairDataProvider;
|
||||
import android.nearby.aidl.IFastPairEligibleAccountsCallback;
|
||||
import android.nearby.aidl.IFastPairManageAccountCallback;
|
||||
import android.nearby.aidl.IFastPairManageAccountDeviceCallback;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A service class for fast pair data providers outside the system server.
|
||||
*
|
||||
* Fast pair providers should be wrapped in a non-exported service which returns the result of
|
||||
* {@link #getBinder()} from the service's {@link android.app.Service#onBind(Intent)} method. The
|
||||
* service should not be exported so that components other than the system server cannot bind to it.
|
||||
* Alternatively, the service may be guarded by a permission that only system server can obtain.
|
||||
*
|
||||
* <p>Fast Pair providers are identified by their UID / package name.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract class FastPairDataProviderService extends Service {
|
||||
/**
|
||||
* The action the wrapping service should have in its intent filter to implement the
|
||||
* {@link android.nearby.FastPairDataProviderBase}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String ACTION_FAST_PAIR_DATA_PROVIDER =
|
||||
"android.nearby.action.FAST_PAIR_DATA_PROVIDER";
|
||||
|
||||
/**
|
||||
* Manage request type to add, or opt-in.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int MANAGE_REQUEST_ADD = 0;
|
||||
|
||||
/**
|
||||
* Manage request type to remove, or opt-out.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int MANAGE_REQUEST_REMOVE = 1;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(value = {
|
||||
MANAGE_REQUEST_ADD,
|
||||
MANAGE_REQUEST_REMOVE})
|
||||
@interface ManageRequestType {}
|
||||
|
||||
/**
|
||||
* Error code for bad request.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int ERROR_CODE_BAD_REQUEST = 0;
|
||||
|
||||
/**
|
||||
* Error code for internal error.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int ERROR_CODE_INTERNAL_ERROR = 1;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(value = {
|
||||
ERROR_CODE_BAD_REQUEST,
|
||||
ERROR_CODE_INTERNAL_ERROR})
|
||||
@interface ErrorCode {}
|
||||
|
||||
private final IBinder mBinder;
|
||||
private final String mTag;
|
||||
|
||||
/**
|
||||
* Constructor of FastPairDataProviderService.
|
||||
*
|
||||
* @param tag TAG for on device logging.
|
||||
* @hide
|
||||
*/
|
||||
public FastPairDataProviderService(@NonNull String tag) {
|
||||
mBinder = new Service();
|
||||
mTag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public final IBinder onBind(@NonNull Intent intent) {
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be invoked when an AntispoofKeyed device metadata is loaded.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface FastPairAntispoofKeyDeviceMetadataCallback {
|
||||
|
||||
/**
|
||||
* Invoked once the meta data is loaded.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onFastPairAntispoofKeyDeviceMetadataReceived(
|
||||
@NonNull FastPairAntispoofKeyDeviceMetadata metadata);
|
||||
|
||||
/** Invoked in case of error.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onError(@ErrorCode int code, @Nullable String message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be invoked when Fast Pair devices of a given account is loaded.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface FastPairAccountDevicesMetadataCallback {
|
||||
|
||||
/**
|
||||
* Should be invoked once the metadatas are loaded.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onFastPairAccountDevicesMetadataReceived(
|
||||
@NonNull Collection<FastPairAccountKeyDeviceMetadata> metadatas);
|
||||
/**
|
||||
* Invoked in case of error.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onError(@ErrorCode int code, @Nullable String message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be invoked when FastPair eligible accounts are loaded.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface FastPairEligibleAccountsCallback {
|
||||
|
||||
/**
|
||||
* Should be invoked once the eligible accounts are loaded.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onFastPairEligibleAccountsReceived(
|
||||
@NonNull Collection<FastPairEligibleAccount> accounts);
|
||||
/**
|
||||
* Invoked in case of error.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onError(@ErrorCode int code, @Nullable String message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be invoked when a management action is finished.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface FastPairManageActionCallback {
|
||||
|
||||
/**
|
||||
* Should be invoked once the manage action is successful.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onSuccess();
|
||||
/**
|
||||
* Invoked in case of error.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void onError(@ErrorCode int code, @Nullable String message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fulfills the Fast Pair device metadata request by using callback to send back the
|
||||
* device meta data of a given modelId.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void onLoadFastPairAntispoofKeyDeviceMetadata(
|
||||
@NonNull FastPairAntispoofKeyDeviceMetadataRequest request,
|
||||
@NonNull FastPairAntispoofKeyDeviceMetadataCallback callback);
|
||||
|
||||
/**
|
||||
* Fulfills the account tied Fast Pair devices metadata request by using callback to send back
|
||||
* all Fast Pair device's metadata of a given account.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void onLoadFastPairAccountDevicesMetadata(
|
||||
@NonNull FastPairAccountDevicesMetadataRequest request,
|
||||
@NonNull FastPairAccountDevicesMetadataCallback callback);
|
||||
|
||||
/**
|
||||
* Fulfills the Fast Pair eligible accounts request by using callback to send back Fast Pair
|
||||
* eligible accounts.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void onLoadFastPairEligibleAccounts(
|
||||
@NonNull FastPairEligibleAccountsRequest request,
|
||||
@NonNull FastPairEligibleAccountsCallback callback);
|
||||
|
||||
/**
|
||||
* Fulfills the Fast Pair account management request by using callback to send back result.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void onManageFastPairAccount(
|
||||
@NonNull FastPairManageAccountRequest request,
|
||||
@NonNull FastPairManageActionCallback callback);
|
||||
|
||||
/**
|
||||
* Fulfills the request to manage device-account mapping by using callback to send back result.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void onManageFastPairAccountDevice(
|
||||
@NonNull FastPairManageAccountDeviceRequest request,
|
||||
@NonNull FastPairManageActionCallback callback);
|
||||
|
||||
/**
|
||||
* Class for reading FastPairAntispoofKeyDeviceMetadataRequest, which specifies the model ID of
|
||||
* a Fast Pair device. To fulfill this request, corresponding
|
||||
* {@link FastPairAntispoofKeyDeviceMetadata} should be fetched and returned.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static class FastPairAntispoofKeyDeviceMetadataRequest {
|
||||
|
||||
private final FastPairAntispoofKeyDeviceMetadataRequestParcel mMetadataRequestParcel;
|
||||
|
||||
private FastPairAntispoofKeyDeviceMetadataRequest(
|
||||
final FastPairAntispoofKeyDeviceMetadataRequestParcel metaDataRequestParcel) {
|
||||
this.mMetadataRequestParcel = metaDataRequestParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modelId (24 bit), the key for FastPairAntispoofKeyDeviceMetadata in the same format
|
||||
* returned by Google at device registration time.
|
||||
*
|
||||
* ModelId format is defined at device registration time, see
|
||||
* <a href="https://developers.google.com/nearby/fast-pair/spec#model_id">Model ID</a>.
|
||||
* @return raw bytes of modelId in the same format returned by Google at device registration
|
||||
* time.
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull byte[] getModelId() {
|
||||
return this.mMetadataRequestParcel.modelId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for reading FastPairAccountDevicesMetadataRequest, which specifies the Fast Pair
|
||||
* account and the allow list of the FastPair device keys saved to the account (i.e., FastPair
|
||||
* accountKeys).
|
||||
*
|
||||
* A Fast Pair accountKey is created when a Fast Pair device is saved to an account. It is per
|
||||
* Fast Pair device per account.
|
||||
*
|
||||
* To retrieve all Fast Pair accountKeys saved to an account, the caller needs to set
|
||||
* account with an empty allow list.
|
||||
*
|
||||
* To retrieve metadata of a selected list of Fast Pair devices saved to an account, the caller
|
||||
* needs to set account with a non-empty allow list.
|
||||
* @hide
|
||||
*/
|
||||
public static class FastPairAccountDevicesMetadataRequest {
|
||||
|
||||
private final FastPairAccountDevicesMetadataRequestParcel mMetadataRequestParcel;
|
||||
|
||||
private FastPairAccountDevicesMetadataRequest(
|
||||
final FastPairAccountDevicesMetadataRequestParcel metaDataRequestParcel) {
|
||||
this.mMetadataRequestParcel = metaDataRequestParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get FastPair account, whose Fast Pair devices' metadata is requested.
|
||||
*
|
||||
* @return a FastPair account.
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull Account getAccount() {
|
||||
return this.mMetadataRequestParcel.account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get allowlist of Fast Pair devices using a collection of deviceAccountKeys.
|
||||
* Note that as a special case, empty list actually means all FastPair devices under the
|
||||
* account instead of none.
|
||||
*
|
||||
* DeviceAccountKey is 16 bytes: first byte is 0x04. Other 15 bytes are randomly generated.
|
||||
*
|
||||
* @return allowlist of Fast Pair devices using a collection of deviceAccountKeys.
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull Collection<byte[]> getDeviceAccountKeys() {
|
||||
if (this.mMetadataRequestParcel.deviceAccountKeys == null) {
|
||||
return new ArrayList<byte[]>(0);
|
||||
}
|
||||
List<byte[]> deviceAccountKeys =
|
||||
new ArrayList<>(this.mMetadataRequestParcel.deviceAccountKeys.length);
|
||||
for (ByteArrayParcel deviceAccountKey : this.mMetadataRequestParcel.deviceAccountKeys) {
|
||||
deviceAccountKeys.add(deviceAccountKey.byteArray);
|
||||
}
|
||||
return deviceAccountKeys;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for reading FastPairEligibleAccountsRequest. Upon receiving this request, Fast Pair
|
||||
* eligible accounts should be returned to bind Fast Pair devices.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static class FastPairEligibleAccountsRequest {
|
||||
@SuppressWarnings("UnusedVariable")
|
||||
private final FastPairEligibleAccountsRequestParcel mAccountsRequestParcel;
|
||||
|
||||
private FastPairEligibleAccountsRequest(
|
||||
final FastPairEligibleAccountsRequestParcel accountsRequestParcel) {
|
||||
this.mAccountsRequestParcel = accountsRequestParcel;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for reading FastPairManageAccountRequest. If the request type is MANAGE_REQUEST_ADD,
|
||||
* the account is enabled to bind Fast Pair devices; If the request type is
|
||||
* MANAGE_REQUEST_REMOVE, the account is disabled to bind more Fast Pair devices. Furthermore,
|
||||
* all existing bounded Fast Pair devices are unbounded.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static class FastPairManageAccountRequest {
|
||||
|
||||
private final FastPairManageAccountRequestParcel mAccountRequestParcel;
|
||||
|
||||
private FastPairManageAccountRequest(
|
||||
final FastPairManageAccountRequestParcel accountRequestParcel) {
|
||||
this.mAccountRequestParcel = accountRequestParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get request type: MANAGE_REQUEST_ADD, or MANAGE_REQUEST_REMOVE.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @ManageRequestType int getRequestType() {
|
||||
return this.mAccountRequestParcel.requestType;
|
||||
}
|
||||
/**
|
||||
* Get account.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull Account getAccount() {
|
||||
return this.mAccountRequestParcel.account;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for reading FastPairManageAccountDeviceRequest. If the request type is
|
||||
* MANAGE_REQUEST_ADD, then a Fast Pair device is bounded to a Fast Pair account. If the
|
||||
* request type is MANAGE_REQUEST_REMOVE, then a Fast Pair device is removed from a Fast Pair
|
||||
* account.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static class FastPairManageAccountDeviceRequest {
|
||||
|
||||
private final FastPairManageAccountDeviceRequestParcel mRequestParcel;
|
||||
|
||||
private FastPairManageAccountDeviceRequest(
|
||||
final FastPairManageAccountDeviceRequestParcel requestParcel) {
|
||||
this.mRequestParcel = requestParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get request type: MANAGE_REQUEST_ADD, or MANAGE_REQUEST_REMOVE.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @ManageRequestType int getRequestType() {
|
||||
return this.mRequestParcel.requestType;
|
||||
}
|
||||
/**
|
||||
* Get account.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull Account getAccount() {
|
||||
return this.mRequestParcel.account;
|
||||
}
|
||||
/**
|
||||
* Get account key device metadata.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @NonNull FastPairAccountKeyDeviceMetadata getAccountKeyDeviceMetadata() {
|
||||
return new FastPairAccountKeyDeviceMetadata(
|
||||
this.mRequestParcel.accountKeyDeviceMetadata);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback class that sends back FastPairAntispoofKeyDeviceMetadata.
|
||||
*/
|
||||
private final class WrapperFastPairAntispoofKeyDeviceMetadataCallback implements
|
||||
FastPairAntispoofKeyDeviceMetadataCallback {
|
||||
|
||||
private IFastPairAntispoofKeyDeviceMetadataCallback mCallback;
|
||||
|
||||
private WrapperFastPairAntispoofKeyDeviceMetadataCallback(
|
||||
IFastPairAntispoofKeyDeviceMetadataCallback callback) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends back FastPairAntispoofKeyDeviceMetadata.
|
||||
*/
|
||||
@Override
|
||||
public void onFastPairAntispoofKeyDeviceMetadataReceived(
|
||||
@NonNull FastPairAntispoofKeyDeviceMetadata metadata) {
|
||||
try {
|
||||
mCallback.onFastPairAntispoofKeyDeviceMetadataReceived(metadata.mMetadataParcel);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@ErrorCode int code, @Nullable String message) {
|
||||
try {
|
||||
mCallback.onError(code, message);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback class that sends back collection of FastPairAccountKeyDeviceMetadata.
|
||||
*/
|
||||
private final class WrapperFastPairAccountDevicesMetadataCallback implements
|
||||
FastPairAccountDevicesMetadataCallback {
|
||||
|
||||
private IFastPairAccountDevicesMetadataCallback mCallback;
|
||||
|
||||
private WrapperFastPairAccountDevicesMetadataCallback(
|
||||
IFastPairAccountDevicesMetadataCallback callback) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends back collection of FastPairAccountKeyDeviceMetadata.
|
||||
*/
|
||||
@Override
|
||||
public void onFastPairAccountDevicesMetadataReceived(
|
||||
@NonNull Collection<FastPairAccountKeyDeviceMetadata> metadatas) {
|
||||
FastPairAccountKeyDeviceMetadataParcel[] metadataParcels =
|
||||
new FastPairAccountKeyDeviceMetadataParcel[metadatas.size()];
|
||||
int i = 0;
|
||||
for (FastPairAccountKeyDeviceMetadata metadata : metadatas) {
|
||||
metadataParcels[i] = metadata.mMetadataParcel;
|
||||
i = i + 1;
|
||||
}
|
||||
try {
|
||||
mCallback.onFastPairAccountDevicesMetadataReceived(metadataParcels);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@ErrorCode int code, @Nullable String message) {
|
||||
try {
|
||||
mCallback.onError(code, message);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback class that sends back eligible Fast Pair accounts.
|
||||
*/
|
||||
private final class WrapperFastPairEligibleAccountsCallback implements
|
||||
FastPairEligibleAccountsCallback {
|
||||
|
||||
private IFastPairEligibleAccountsCallback mCallback;
|
||||
|
||||
private WrapperFastPairEligibleAccountsCallback(
|
||||
IFastPairEligibleAccountsCallback callback) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends back the eligible Fast Pair accounts.
|
||||
*/
|
||||
@Override
|
||||
public void onFastPairEligibleAccountsReceived(
|
||||
@NonNull Collection<FastPairEligibleAccount> accounts) {
|
||||
int i = 0;
|
||||
FastPairEligibleAccountParcel[] accountParcels =
|
||||
new FastPairEligibleAccountParcel[accounts.size()];
|
||||
for (FastPairEligibleAccount account: accounts) {
|
||||
accountParcels[i] = account.mAccountParcel;
|
||||
i = i + 1;
|
||||
}
|
||||
try {
|
||||
mCallback.onFastPairEligibleAccountsReceived(accountParcels);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@ErrorCode int code, @Nullable String message) {
|
||||
try {
|
||||
mCallback.onError(code, message);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback class that sends back Fast Pair account management result.
|
||||
*/
|
||||
private final class WrapperFastPairManageAccountCallback implements
|
||||
FastPairManageActionCallback {
|
||||
|
||||
private IFastPairManageAccountCallback mCallback;
|
||||
|
||||
private WrapperFastPairManageAccountCallback(
|
||||
IFastPairManageAccountCallback callback) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends back Fast Pair account opt in result.
|
||||
*/
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
try {
|
||||
mCallback.onSuccess();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@ErrorCode int code, @Nullable String message) {
|
||||
try {
|
||||
mCallback.onError(code, message);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call back class that sends back account-device mapping management result.
|
||||
*/
|
||||
private final class WrapperFastPairManageAccountDeviceCallback implements
|
||||
FastPairManageActionCallback {
|
||||
|
||||
private IFastPairManageAccountDeviceCallback mCallback;
|
||||
|
||||
private WrapperFastPairManageAccountDeviceCallback(
|
||||
IFastPairManageAccountDeviceCallback callback) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends back the account-device mapping management result.
|
||||
*/
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
try {
|
||||
mCallback.onSuccess();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@ErrorCode int code, @Nullable String message) {
|
||||
try {
|
||||
mCallback.onError(code, message);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(mTag, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class Service extends IFastPairDataProvider.Stub {
|
||||
|
||||
Service() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFastPairAntispoofKeyDeviceMetadata(
|
||||
@NonNull FastPairAntispoofKeyDeviceMetadataRequestParcel requestParcel,
|
||||
IFastPairAntispoofKeyDeviceMetadataCallback callback) {
|
||||
onLoadFastPairAntispoofKeyDeviceMetadata(
|
||||
new FastPairAntispoofKeyDeviceMetadataRequest(requestParcel),
|
||||
new WrapperFastPairAntispoofKeyDeviceMetadataCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFastPairAccountDevicesMetadata(
|
||||
@NonNull FastPairAccountDevicesMetadataRequestParcel requestParcel,
|
||||
IFastPairAccountDevicesMetadataCallback callback) {
|
||||
onLoadFastPairAccountDevicesMetadata(
|
||||
new FastPairAccountDevicesMetadataRequest(requestParcel),
|
||||
new WrapperFastPairAccountDevicesMetadataCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFastPairEligibleAccounts(
|
||||
@NonNull FastPairEligibleAccountsRequestParcel requestParcel,
|
||||
IFastPairEligibleAccountsCallback callback) {
|
||||
onLoadFastPairEligibleAccounts(new FastPairEligibleAccountsRequest(requestParcel),
|
||||
new WrapperFastPairEligibleAccountsCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void manageFastPairAccount(
|
||||
@NonNull FastPairManageAccountRequestParcel requestParcel,
|
||||
IFastPairManageAccountCallback callback) {
|
||||
onManageFastPairAccount(new FastPairManageAccountRequest(requestParcel),
|
||||
new WrapperFastPairManageAccountCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void manageFastPairAccountDevice(
|
||||
@NonNull FastPairManageAccountDeviceRequestParcel requestParcel,
|
||||
IFastPairManageAccountDeviceCallback callback) {
|
||||
onManageFastPairAccountDevice(new FastPairManageAccountDeviceRequest(requestParcel),
|
||||
new WrapperFastPairManageAccountDeviceCallback(callback));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,683 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.nearby.aidl.FastPairDeviceMetadataParcel;
|
||||
|
||||
/**
|
||||
* Class for the properties of a given type of Fast Pair device, including images and text.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class FastPairDeviceMetadata {
|
||||
|
||||
FastPairDeviceMetadataParcel mMetadataParcel;
|
||||
|
||||
FastPairDeviceMetadata(
|
||||
FastPairDeviceMetadataParcel metadataParcel) {
|
||||
this.mMetadataParcel = metadataParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ImageUrl, which will be displayed in notification.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getImageUrl() {
|
||||
return mMetadataParcel.imageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IntentUri, which will be launched to install companion app.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getIntentUri() {
|
||||
return mMetadataParcel.intentUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get BLE transmit power, as described in Fast Pair spec, see
|
||||
* <a href="https://developers.google.com/nearby/fast-pair/spec#transmit_power">Transmit Power</a>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getBleTxPower() {
|
||||
return mMetadataParcel.bleTxPower;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fast Pair Half Sheet trigger distance in meters.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public float getTriggerDistance() {
|
||||
return mMetadataParcel.triggerDistance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fast Pair device image, which is submitted at device registration time to display on
|
||||
* notification. It is a 32-bit PNG with dimensions of 512px by 512px.
|
||||
*
|
||||
* @return Fast Pair device image in 32-bit PNG with dimensions of 512px by 512px.
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public byte[] getImage() {
|
||||
return mMetadataParcel.image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fast Pair device type.
|
||||
* DEVICE_TYPE_UNSPECIFIED = 0;
|
||||
* HEADPHONES = 1;
|
||||
* TRUE_WIRELESS_HEADPHONES = 7;
|
||||
* @hide
|
||||
*/
|
||||
public int getDeviceType() {
|
||||
return mMetadataParcel.deviceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fast Pair device name. e.g., "Pixel Buds A-Series".
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getName() {
|
||||
return mMetadataParcel.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get true wireless image url for left bud.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getTrueWirelessImageUrlLeftBud() {
|
||||
return mMetadataParcel.trueWirelessImageUrlLeftBud;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get true wireless image url for right bud.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getTrueWirelessImageUrlRightBud() {
|
||||
return mMetadataParcel.trueWirelessImageUrlRightBud;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get true wireless image url for case.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getTrueWirelessImageUrlCase() {
|
||||
return mMetadataParcel.trueWirelessImageUrlCase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get InitialNotificationDescription, which is a translated string of
|
||||
* "Tap to pair. Earbuds will be tied to %s" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getInitialNotificationDescription() {
|
||||
return mMetadataParcel.initialNotificationDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get InitialNotificationDescriptionNoAccount, which is a translated string of
|
||||
* "Tap to pair with this device" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getInitialNotificationDescriptionNoAccount() {
|
||||
return mMetadataParcel.initialNotificationDescriptionNoAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OpenCompanionAppDescription, which is a translated string of
|
||||
* "Tap to finish setup" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getOpenCompanionAppDescription() {
|
||||
return mMetadataParcel.openCompanionAppDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UpdateCompanionAppDescription, which is a translated string of
|
||||
* "Tap to update device settings and finish setup" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getUpdateCompanionAppDescription() {
|
||||
return mMetadataParcel.updateCompanionAppDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DownloadCompanionAppDescription, which is a translated string of
|
||||
* "Tap to download device app on Google Play and see all features" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getDownloadCompanionAppDescription() {
|
||||
return mMetadataParcel.downloadCompanionAppDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UnableToConnectTitle, which is a translated string of
|
||||
* "Unable to connect" based on locale.
|
||||
*/
|
||||
@Nullable
|
||||
public String getUnableToConnectTitle() {
|
||||
return mMetadataParcel.unableToConnectTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UnableToConnectDescription, which is a translated string of
|
||||
* "Try manually pairing to the device" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getUnableToConnectDescription() {
|
||||
return mMetadataParcel.unableToConnectDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get InitialPairingDescription, which is a translated string of
|
||||
* "%s will appear on devices linked with %s" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getInitialPairingDescription() {
|
||||
return mMetadataParcel.initialPairingDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ConnectSuccessCompanionAppInstalled, which is a translated string of
|
||||
* "Your device is ready to be set up" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getConnectSuccessCompanionAppInstalled() {
|
||||
return mMetadataParcel.connectSuccessCompanionAppInstalled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ConnectSuccessCompanionAppNotInstalled, which is a translated string of
|
||||
* "Download the device app on Google Play to see all available features" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getConnectSuccessCompanionAppNotInstalled() {
|
||||
return mMetadataParcel.connectSuccessCompanionAppNotInstalled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SubsequentPairingDescription, which is a translated string of
|
||||
* "Connect %s to this phone" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getSubsequentPairingDescription() {
|
||||
return mMetadataParcel.subsequentPairingDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get RetroactivePairingDescription, which is a translated string of
|
||||
* "Save device to %s for faster pairing to your other devices" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getRetroactivePairingDescription() {
|
||||
return mMetadataParcel.retroactivePairingDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WaitLaunchCompanionAppDescription, which is a translated string of
|
||||
* "This will take a few moments" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getWaitLaunchCompanionAppDescription() {
|
||||
return mMetadataParcel.waitLaunchCompanionAppDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get FailConnectGoToSettingsDescription, which is a translated string of
|
||||
* "Try manually pairing to the device by going to Settings" based on locale.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getFailConnectGoToSettingsDescription() {
|
||||
return mMetadataParcel.failConnectGoToSettingsDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder used to create FastPairDeviceMetadata.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
private final FastPairDeviceMetadataParcel mBuilderParcel;
|
||||
|
||||
/**
|
||||
* Default constructor of Builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public Builder() {
|
||||
mBuilderParcel = new FastPairDeviceMetadataParcel();
|
||||
mBuilderParcel.imageUrl = null;
|
||||
mBuilderParcel.intentUri = null;
|
||||
mBuilderParcel.name = null;
|
||||
mBuilderParcel.bleTxPower = 0;
|
||||
mBuilderParcel.triggerDistance = 0;
|
||||
mBuilderParcel.image = null;
|
||||
mBuilderParcel.deviceType = 0; // DEVICE_TYPE_UNSPECIFIED
|
||||
mBuilderParcel.trueWirelessImageUrlLeftBud = null;
|
||||
mBuilderParcel.trueWirelessImageUrlRightBud = null;
|
||||
mBuilderParcel.trueWirelessImageUrlCase = null;
|
||||
mBuilderParcel.initialNotificationDescription = null;
|
||||
mBuilderParcel.initialNotificationDescriptionNoAccount = null;
|
||||
mBuilderParcel.openCompanionAppDescription = null;
|
||||
mBuilderParcel.updateCompanionAppDescription = null;
|
||||
mBuilderParcel.downloadCompanionAppDescription = null;
|
||||
mBuilderParcel.unableToConnectTitle = null;
|
||||
mBuilderParcel.unableToConnectDescription = null;
|
||||
mBuilderParcel.initialPairingDescription = null;
|
||||
mBuilderParcel.connectSuccessCompanionAppInstalled = null;
|
||||
mBuilderParcel.connectSuccessCompanionAppNotInstalled = null;
|
||||
mBuilderParcel.subsequentPairingDescription = null;
|
||||
mBuilderParcel.retroactivePairingDescription = null;
|
||||
mBuilderParcel.waitLaunchCompanionAppDescription = null;
|
||||
mBuilderParcel.failConnectGoToSettingsDescription = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ImageUlr.
|
||||
*
|
||||
* @param imageUrl Image Ulr.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setImageUrl(@Nullable String imageUrl) {
|
||||
mBuilderParcel.imageUrl = imageUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set IntentUri.
|
||||
*
|
||||
* @param intentUri Intent uri.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setIntentUri(@Nullable String intentUri) {
|
||||
mBuilderParcel.intentUri = intentUri;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set device name.
|
||||
*
|
||||
* @param name Device name.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setName(@Nullable String name) {
|
||||
mBuilderParcel.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ble transmission power.
|
||||
*
|
||||
* @param bleTxPower Ble transmission power.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setBleTxPower(int bleTxPower) {
|
||||
mBuilderParcel.bleTxPower = bleTxPower;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set trigger distance.
|
||||
*
|
||||
* @param triggerDistance Fast Pair trigger distance.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTriggerDistance(float triggerDistance) {
|
||||
mBuilderParcel.triggerDistance = triggerDistance;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image.
|
||||
*
|
||||
* @param image Fast Pair device image, which is submitted at device registration time to
|
||||
* display on notification. It is a 32-bit PNG with dimensions of
|
||||
* 512px by 512px.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setImage(@Nullable byte[] image) {
|
||||
mBuilderParcel.image = image;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set device type.
|
||||
*
|
||||
* @param deviceType Fast Pair device type.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setDeviceType(int deviceType) {
|
||||
mBuilderParcel.deviceType = deviceType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set true wireless image url for left bud.
|
||||
*
|
||||
* @param trueWirelessImageUrlLeftBud True wireless image url for left bud.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTrueWirelessImageUrlLeftBud(
|
||||
@Nullable String trueWirelessImageUrlLeftBud) {
|
||||
mBuilderParcel.trueWirelessImageUrlLeftBud = trueWirelessImageUrlLeftBud;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set true wireless image url for right bud.
|
||||
*
|
||||
* @param trueWirelessImageUrlRightBud True wireless image url for right bud.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTrueWirelessImageUrlRightBud(
|
||||
@Nullable String trueWirelessImageUrlRightBud) {
|
||||
mBuilderParcel.trueWirelessImageUrlRightBud = trueWirelessImageUrlRightBud;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set true wireless image url for case.
|
||||
*
|
||||
* @param trueWirelessImageUrlCase True wireless image url for case.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTrueWirelessImageUrlCase(@Nullable String trueWirelessImageUrlCase) {
|
||||
mBuilderParcel.trueWirelessImageUrlCase = trueWirelessImageUrlCase;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set InitialNotificationDescription.
|
||||
*
|
||||
* @param initialNotificationDescription Initial notification description.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setInitialNotificationDescription(
|
||||
@Nullable String initialNotificationDescription) {
|
||||
mBuilderParcel.initialNotificationDescription = initialNotificationDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set InitialNotificationDescriptionNoAccount.
|
||||
*
|
||||
* @param initialNotificationDescriptionNoAccount Initial notification description when
|
||||
* account is not present.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setInitialNotificationDescriptionNoAccount(
|
||||
@Nullable String initialNotificationDescriptionNoAccount) {
|
||||
mBuilderParcel.initialNotificationDescriptionNoAccount =
|
||||
initialNotificationDescriptionNoAccount;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set OpenCompanionAppDescription.
|
||||
*
|
||||
* @param openCompanionAppDescription Description for opening companion app.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setOpenCompanionAppDescription(
|
||||
@Nullable String openCompanionAppDescription) {
|
||||
mBuilderParcel.openCompanionAppDescription = openCompanionAppDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set UpdateCompanionAppDescription.
|
||||
*
|
||||
* @param updateCompanionAppDescription Description for updating companion app.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setUpdateCompanionAppDescription(
|
||||
@Nullable String updateCompanionAppDescription) {
|
||||
mBuilderParcel.updateCompanionAppDescription = updateCompanionAppDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set DownloadCompanionAppDescription.
|
||||
*
|
||||
* @param downloadCompanionAppDescription Description for downloading companion app.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setDownloadCompanionAppDescription(
|
||||
@Nullable String downloadCompanionAppDescription) {
|
||||
mBuilderParcel.downloadCompanionAppDescription = downloadCompanionAppDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set UnableToConnectTitle.
|
||||
*
|
||||
* @param unableToConnectTitle Title when Fast Pair device is unable to be connected to.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setUnableToConnectTitle(@Nullable String unableToConnectTitle) {
|
||||
mBuilderParcel.unableToConnectTitle = unableToConnectTitle;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set UnableToConnectDescription.
|
||||
*
|
||||
* @param unableToConnectDescription Description when Fast Pair device is unable to be
|
||||
* connected to.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setUnableToConnectDescription(
|
||||
@Nullable String unableToConnectDescription) {
|
||||
mBuilderParcel.unableToConnectDescription = unableToConnectDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set InitialPairingDescription.
|
||||
*
|
||||
* @param initialPairingDescription Description for Fast Pair initial pairing.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setInitialPairingDescription(@Nullable String initialPairingDescription) {
|
||||
mBuilderParcel.initialPairingDescription = initialPairingDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ConnectSuccessCompanionAppInstalled.
|
||||
*
|
||||
* @param connectSuccessCompanionAppInstalled Description that let user open the companion
|
||||
* app.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setConnectSuccessCompanionAppInstalled(
|
||||
@Nullable String connectSuccessCompanionAppInstalled) {
|
||||
mBuilderParcel.connectSuccessCompanionAppInstalled =
|
||||
connectSuccessCompanionAppInstalled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ConnectSuccessCompanionAppNotInstalled.
|
||||
*
|
||||
* @param connectSuccessCompanionAppNotInstalled Description that let user download the
|
||||
* companion app.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setConnectSuccessCompanionAppNotInstalled(
|
||||
@Nullable String connectSuccessCompanionAppNotInstalled) {
|
||||
mBuilderParcel.connectSuccessCompanionAppNotInstalled =
|
||||
connectSuccessCompanionAppNotInstalled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set SubsequentPairingDescription.
|
||||
*
|
||||
* @param subsequentPairingDescription Description that reminds user there is a paired
|
||||
* device nearby.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setSubsequentPairingDescription(
|
||||
@Nullable String subsequentPairingDescription) {
|
||||
mBuilderParcel.subsequentPairingDescription = subsequentPairingDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set RetroactivePairingDescription.
|
||||
*
|
||||
* @param retroactivePairingDescription Description that reminds users opt in their device.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setRetroactivePairingDescription(
|
||||
@Nullable String retroactivePairingDescription) {
|
||||
mBuilderParcel.retroactivePairingDescription = retroactivePairingDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set WaitLaunchCompanionAppDescription.
|
||||
*
|
||||
* @param waitLaunchCompanionAppDescription Description that indicates companion app is
|
||||
* about to launch.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setWaitLaunchCompanionAppDescription(
|
||||
@Nullable String waitLaunchCompanionAppDescription) {
|
||||
mBuilderParcel.waitLaunchCompanionAppDescription =
|
||||
waitLaunchCompanionAppDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set FailConnectGoToSettingsDescription.
|
||||
*
|
||||
* @param failConnectGoToSettingsDescription Description that indicates go to bluetooth
|
||||
* settings when connection fail.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setFailConnectGoToSettingsDescription(
|
||||
@Nullable String failConnectGoToSettingsDescription) {
|
||||
mBuilderParcel.failConnectGoToSettingsDescription =
|
||||
failConnectGoToSettingsDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build {@link FastPairDeviceMetadata} with the currently set configuration.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public FastPairDeviceMetadata build() {
|
||||
return new FastPairDeviceMetadata(mBuilderParcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,529 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.nearby.aidl.FastPairDiscoveryItemParcel;
|
||||
|
||||
/**
|
||||
* Class for FastPairDiscoveryItem and its builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class FastPairDiscoveryItem {
|
||||
|
||||
FastPairDiscoveryItemParcel mMetadataParcel;
|
||||
|
||||
FastPairDiscoveryItem(
|
||||
FastPairDiscoveryItemParcel metadataParcel) {
|
||||
this.mMetadataParcel = metadataParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Id.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getId() {
|
||||
return mMetadataParcel.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MacAddress.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getMacAddress() {
|
||||
return mMetadataParcel.macAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ActionUrl.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getActionUrl() {
|
||||
return mMetadataParcel.actionUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DeviceName.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getDeviceName() {
|
||||
return mMetadataParcel.deviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Title.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getTitle() {
|
||||
return mMetadataParcel.title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Description.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getDescription() {
|
||||
return mMetadataParcel.description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DisplayUrl.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getDisplayUrl() {
|
||||
return mMetadataParcel.displayUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get LastObservationTimestampMillis.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public long getLastObservationTimestampMillis() {
|
||||
return mMetadataParcel.lastObservationTimestampMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get FirstObservationTimestampMillis.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public long getFirstObservationTimestampMillis() {
|
||||
return mMetadataParcel.firstObservationTimestampMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getState() {
|
||||
return mMetadataParcel.state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ActionUrlType.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getActionUrlType() {
|
||||
return mMetadataParcel.actionUrlType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Rssi.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getRssi() {
|
||||
return mMetadataParcel.rssi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PendingAppInstallTimestampMillis.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public long getPendingAppInstallTimestampMillis() {
|
||||
return mMetadataParcel.pendingAppInstallTimestampMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get TxPower.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getTxPower() {
|
||||
return mMetadataParcel.txPower;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AppName.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getAppName() {
|
||||
return mMetadataParcel.appName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PackageName.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getPackageName() {
|
||||
return mMetadataParcel.packageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get TriggerId.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getTriggerId() {
|
||||
return mMetadataParcel.triggerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IconPng, which is submitted at device registration time to display on notification. It is
|
||||
* a 32-bit PNG with dimensions of 512px by 512px.
|
||||
*
|
||||
* @return IconPng in 32-bit PNG with dimensions of 512px by 512px.
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public byte[] getIconPng() {
|
||||
return mMetadataParcel.iconPng;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IconFifeUrl.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public String getIconFfeUrl() {
|
||||
return mMetadataParcel.iconFifeUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>.
|
||||
*
|
||||
* @return 64-byte authenticationPublicKeySecp256r1.
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public byte[] getAuthenticationPublicKeySecp256r1() {
|
||||
return mMetadataParcel.authenticationPublicKeySecp256r1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder used to create FastPairDiscoveryItem.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
private final FastPairDiscoveryItemParcel mBuilderParcel;
|
||||
|
||||
/**
|
||||
* Default constructor of Builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public Builder() {
|
||||
mBuilderParcel = new FastPairDiscoveryItemParcel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Id.
|
||||
*
|
||||
* @param id Unique id.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setId(@Nullable String id) {
|
||||
mBuilderParcel.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set MacAddress.
|
||||
*
|
||||
* @param macAddress Fast Pair device rotating mac address.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setMacAddress(@Nullable String macAddress) {
|
||||
mBuilderParcel.macAddress = macAddress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ActionUrl.
|
||||
*
|
||||
* @param actionUrl Action Url of Fast Pair device.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setActionUrl(@Nullable String actionUrl) {
|
||||
mBuilderParcel.actionUrl = actionUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set DeviceName.
|
||||
* @param deviceName Fast Pair device name.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setDeviceName(@Nullable String deviceName) {
|
||||
mBuilderParcel.deviceName = deviceName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Title.
|
||||
*
|
||||
* @param title Title of Fast Pair device.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTitle(@Nullable String title) {
|
||||
mBuilderParcel.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Description.
|
||||
*
|
||||
* @param description Description of Fast Pair device.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setDescription(@Nullable String description) {
|
||||
mBuilderParcel.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set DisplayUrl.
|
||||
*
|
||||
* @param displayUrl Display Url of Fast Pair device.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setDisplayUrl(@Nullable String displayUrl) {
|
||||
mBuilderParcel.displayUrl = displayUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LastObservationTimestampMillis.
|
||||
*
|
||||
* @param lastObservationTimestampMillis Last observed timestamp of Fast Pair device, keyed
|
||||
* by a rotating id.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setLastObservationTimestampMillis(
|
||||
long lastObservationTimestampMillis) {
|
||||
mBuilderParcel.lastObservationTimestampMillis = lastObservationTimestampMillis;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set FirstObservationTimestampMillis.
|
||||
*
|
||||
* @param firstObservationTimestampMillis First observed timestamp of Fast Pair device,
|
||||
* keyed by a rotating id.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setFirstObservationTimestampMillis(
|
||||
long firstObservationTimestampMillis) {
|
||||
mBuilderParcel.firstObservationTimestampMillis = firstObservationTimestampMillis;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State.
|
||||
*
|
||||
* @param state Item's current state. e.g. if the item is blocked.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setState(int state) {
|
||||
mBuilderParcel.state = state;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ActionUrlType.
|
||||
*
|
||||
* @param actionUrlType The resolved url type for the action_url.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setActionUrlType(int actionUrlType) {
|
||||
mBuilderParcel.actionUrlType = actionUrlType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rssi.
|
||||
*
|
||||
* @param rssi Beacon's RSSI value.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setRssi(int rssi) {
|
||||
mBuilderParcel.rssi = rssi;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set PendingAppInstallTimestampMillis.
|
||||
*
|
||||
* @param pendingAppInstallTimestampMillis The timestamp when the user is redirected to App
|
||||
* Store after clicking on the item.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setPendingAppInstallTimestampMillis(long pendingAppInstallTimestampMillis) {
|
||||
mBuilderParcel.pendingAppInstallTimestampMillis = pendingAppInstallTimestampMillis;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set TxPower.
|
||||
*
|
||||
* @param txPower Beacon's tx power.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTxPower(int txPower) {
|
||||
mBuilderParcel.txPower = txPower;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AppName.
|
||||
*
|
||||
* @param appName Human readable name of the app designated to open the uri.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setAppName(@Nullable String appName) {
|
||||
mBuilderParcel.appName = appName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set PackageName.
|
||||
*
|
||||
* @param packageName Package name of the App that owns this item.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setPackageName(@Nullable String packageName) {
|
||||
mBuilderParcel.packageName = packageName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set TriggerId.
|
||||
*
|
||||
* @param triggerId TriggerId identifies the trigger/beacon that is attached with a message.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTriggerId(@Nullable String triggerId) {
|
||||
mBuilderParcel.triggerId = triggerId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set IconPng.
|
||||
*
|
||||
* @param iconPng Bytes of item icon in PNG format displayed in Discovery item list.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setIconPng(@Nullable byte[] iconPng) {
|
||||
mBuilderParcel.iconPng = iconPng;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set IconFifeUrl.
|
||||
*
|
||||
* @param iconFifeUrl A FIFE URL of the item icon displayed in Discovery item list.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setIconFfeUrl(@Nullable String iconFifeUrl) {
|
||||
mBuilderParcel.iconFifeUrl = iconFifeUrl;
|
||||
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>
|
||||
*
|
||||
* @param authenticationPublicKeySecp256r1 64-byte Fast Pair device public key.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setAuthenticationPublicKeySecp256r1(
|
||||
@Nullable byte[] authenticationPublicKeySecp256r1) {
|
||||
mBuilderParcel.authenticationPublicKeySecp256r1 = authenticationPublicKeySecp256r1;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build {@link FastPairDiscoveryItem} with the currently set configuration.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public FastPairDiscoveryItem build() {
|
||||
return new FastPairDiscoveryItem(mBuilderParcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.nearby.aidl.FastPairEligibleAccountParcel;
|
||||
|
||||
/**
|
||||
* Class for FastPairEligibleAccount and its builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class FastPairEligibleAccount {
|
||||
|
||||
FastPairEligibleAccountParcel mAccountParcel;
|
||||
|
||||
FastPairEligibleAccount(FastPairEligibleAccountParcel accountParcel) {
|
||||
this.mAccountParcel = accountParcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Account.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public Account getAccount() {
|
||||
return this.mAccountParcel.account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OptIn Status.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isOptIn() {
|
||||
return this.mAccountParcel.optIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder used to create FastPairEligibleAccount.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
private final FastPairEligibleAccountParcel mBuilderParcel;
|
||||
|
||||
/**
|
||||
* Default constructor of Builder.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public Builder() {
|
||||
mBuilderParcel = new FastPairEligibleAccountParcel();
|
||||
mBuilderParcel.account = null;
|
||||
mBuilderParcel.optIn = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Account.
|
||||
*
|
||||
* @param account Fast Pair eligible account.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setAccount(@Nullable Account account) {
|
||||
mBuilderParcel.account = account;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the account is opt into Fast Pair.
|
||||
*
|
||||
* @param optIn Whether the Fast Pair eligible account opts into Fast Pair.
|
||||
* @return The builder, to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setOptIn(boolean optIn) {
|
||||
mBuilderParcel.optIn = optIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build {@link FastPairEligibleAccount} with the currently set configuration.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public FastPairEligibleAccount build() {
|
||||
return new FastPairEligibleAccount(mBuilderParcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* 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 android.nearby;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Reports the pair status for an ongoing pair with a {@link FastPairDevice}.
|
||||
* @hide
|
||||
*/
|
||||
public interface FastPairStatusCallback {
|
||||
|
||||
/** Reports a pair status related metadata associated with a {@link FastPairDevice} */
|
||||
void onPairUpdate(@NonNull FastPairDevice fastPairDevice,
|
||||
PairStatusMetadata pairStatusMetadata);
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (C) 2021 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 android.nearby;
|
||||
|
||||
import android.content.Intent;
|
||||
/**
|
||||
* Provides callback interface for halfsheet to send FastPair call back.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
interface IFastPairHalfSheetCallback {
|
||||
void onHalfSheetConnectionConfirm(in Intent intent);
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* 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 android.nearby;
|
||||
|
||||
/**
|
||||
* Metadata about an ongoing paring. Wraps transient data like status and progress.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
parcelable PairStatusMetadata;
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
* 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 android.nearby;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Metadata about an ongoing paring. Wraps transient data like status and progress.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class PairStatusMetadata implements Parcelable {
|
||||
|
||||
@Status
|
||||
private final int mStatus;
|
||||
|
||||
/** The status of the pairing. */
|
||||
@IntDef({
|
||||
Status.UNKNOWN,
|
||||
Status.SUCCESS,
|
||||
Status.FAIL,
|
||||
Status.DISMISS
|
||||
})
|
||||
public @interface Status {
|
||||
int UNKNOWN = 1000;
|
||||
int SUCCESS = 1001;
|
||||
int FAIL = 1002;
|
||||
int DISMISS = 1003;
|
||||
}
|
||||
|
||||
/** Converts the status to readable string. */
|
||||
public static String statusToString(@Status int status) {
|
||||
switch (status) {
|
||||
case Status.SUCCESS:
|
||||
return "SUCCESS";
|
||||
case Status.FAIL:
|
||||
return "FAIL";
|
||||
case Status.DISMISS:
|
||||
return "DISMISS";
|
||||
case Status.UNKNOWN:
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return mStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PairStatusMetadata[ status=" + statusToString(mStatus) + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof PairStatusMetadata) {
|
||||
return mStatus == ((PairStatusMetadata) other).mStatus;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mStatus);
|
||||
}
|
||||
|
||||
public PairStatusMetadata(@Status int status) {
|
||||
mStatus = status;
|
||||
}
|
||||
|
||||
public static final Creator<PairStatusMetadata> CREATOR = new Creator<PairStatusMetadata>() {
|
||||
@Override
|
||||
public PairStatusMetadata createFromParcel(Parcel in) {
|
||||
return new PairStatusMetadata(in.readInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PairStatusMetadata[] newArray(int size) {
|
||||
return new PairStatusMetadata[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStability() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeInt(mStatus);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
/**
|
||||
* This is to support 2D byte arrays.
|
||||
* {@hide}
|
||||
*/
|
||||
parcelable ByteArrayParcel {
|
||||
byte[] byteArray;
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.nearby.aidl.ByteArrayParcel;
|
||||
|
||||
/**
|
||||
* Request details for Metadata of Fast Pair devices associated with an account.
|
||||
* {@hide}
|
||||
*/
|
||||
parcelable FastPairAccountDevicesMetadataRequestParcel {
|
||||
Account account;
|
||||
ByteArrayParcel[] deviceAccountKeys;
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
import android.nearby.aidl.FastPairDeviceMetadataParcel;
|
||||
import android.nearby.aidl.FastPairDiscoveryItemParcel;
|
||||
|
||||
/**
|
||||
* Metadata of a Fast Pair device associated with an account.
|
||||
* {@hide}
|
||||
*/
|
||||
// TODO(b/204780849): remove unnecessary fields and polish comments.
|
||||
parcelable FastPairAccountKeyDeviceMetadataParcel {
|
||||
// Key of the Fast Pair device associated with the account.
|
||||
byte[] deviceAccountKey;
|
||||
// Hash function of device account key and public bluetooth address.
|
||||
byte[] sha256DeviceAccountKeyPublicAddress;
|
||||
// Fast Pair device metadata for the Fast Pair device.
|
||||
FastPairDeviceMetadataParcel metadata;
|
||||
// Fast Pair discovery item tied to both the Fast Pair device and the
|
||||
// account.
|
||||
FastPairDiscoveryItemParcel discoveryItem;
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
import android.nearby.aidl.FastPairDeviceMetadataParcel;
|
||||
|
||||
/**
|
||||
* Metadata of a Fast Pair device keyed by AntispoofKey,
|
||||
* Used by initial pairing without account association.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
parcelable FastPairAntispoofKeyDeviceMetadataParcel {
|
||||
// Anti-spoof public key.
|
||||
byte[] antispoofPublicKey;
|
||||
|
||||
// Fast Pair device metadata for the Fast Pair device.
|
||||
FastPairDeviceMetadataParcel deviceMetadata;
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
/**
|
||||
* Request details for metadata of a Fast Pair device keyed by either
|
||||
* antispoofKey or modelId.
|
||||
* {@hide}
|
||||
*/
|
||||
parcelable FastPairAntispoofKeyDeviceMetadataRequestParcel {
|
||||
byte[] modelId;
|
||||
}
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
/**
|
||||
* Fast Pair Device Metadata for a given device model ID.
|
||||
* @hide
|
||||
*/
|
||||
// TODO(b/204780849): remove unnecessary fields and polish comments.
|
||||
parcelable FastPairDeviceMetadataParcel {
|
||||
// The image to show on the notification.
|
||||
String imageUrl;
|
||||
|
||||
// The intent that will be launched via the notification.
|
||||
String intentUri;
|
||||
|
||||
// The transmit power of the device's BLE chip.
|
||||
int bleTxPower;
|
||||
|
||||
// The distance that the device must be within to show a notification.
|
||||
// If no distance is set, we default to 0.6 meters. Only Nearby admins can
|
||||
// change this.
|
||||
float triggerDistance;
|
||||
|
||||
// The image icon that shows in the notification.
|
||||
byte[] image;
|
||||
|
||||
// The name of the device.
|
||||
String name;
|
||||
|
||||
int deviceType;
|
||||
|
||||
// The image urls for device with device type "true wireless".
|
||||
String trueWirelessImageUrlLeftBud;
|
||||
String trueWirelessImageUrlRightBud;
|
||||
String trueWirelessImageUrlCase;
|
||||
|
||||
// The notification description for when the device is initially discovered.
|
||||
String initialNotificationDescription;
|
||||
|
||||
// The notification description for when the device is initially discovered
|
||||
// and no account is logged in.
|
||||
String initialNotificationDescriptionNoAccount;
|
||||
|
||||
// The notification description for once we have finished pairing and the
|
||||
// companion app has been opened. For Bisto devices, this String will point
|
||||
// users to setting up the assistant.
|
||||
String openCompanionAppDescription;
|
||||
|
||||
// The notification description for once we have finished pairing and the
|
||||
// companion app needs to be updated before use.
|
||||
String updateCompanionAppDescription;
|
||||
|
||||
// The notification description for once we have finished pairing and the
|
||||
// companion app needs to be installed.
|
||||
String downloadCompanionAppDescription;
|
||||
|
||||
// The notification title when a pairing fails.
|
||||
String unableToConnectTitle;
|
||||
|
||||
// The notification summary when a pairing fails.
|
||||
String unableToConnectDescription;
|
||||
|
||||
// The description that helps user initially paired with device.
|
||||
String initialPairingDescription;
|
||||
|
||||
// The description that let user open the companion app.
|
||||
String connectSuccessCompanionAppInstalled;
|
||||
|
||||
// The description that let user download the companion app.
|
||||
String connectSuccessCompanionAppNotInstalled;
|
||||
|
||||
// The description that reminds user there is a paired device nearby.
|
||||
String subsequentPairingDescription;
|
||||
|
||||
// The description that reminds users opt in their device.
|
||||
String retroactivePairingDescription;
|
||||
|
||||
// The description that indicates companion app is about to launch.
|
||||
String waitLaunchCompanionAppDescription;
|
||||
|
||||
// The description that indicates go to bluetooth settings when connection
|
||||
// fail.
|
||||
String failConnectGoToSettingsDescription;
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
/**
|
||||
* Fast Pair Discovery Item.
|
||||
* @hide
|
||||
*/
|
||||
// TODO(b/204780849): remove unnecessary fields and polish comments.
|
||||
parcelable FastPairDiscoveryItemParcel {
|
||||
// Offline item: unique ID generated on client.
|
||||
// Online item: unique ID generated on server.
|
||||
String id;
|
||||
|
||||
// The most recent all upper case mac associated with this item.
|
||||
// (Mac-to-DiscoveryItem is a many-to-many relationship)
|
||||
String macAddress;
|
||||
|
||||
String actionUrl;
|
||||
|
||||
// The bluetooth device name from advertisement
|
||||
String deviceName;
|
||||
|
||||
// Item's title
|
||||
String title;
|
||||
|
||||
// Item's description.
|
||||
String description;
|
||||
|
||||
// The URL for display
|
||||
String displayUrl;
|
||||
|
||||
// Client timestamp when the beacon was last observed in BLE scan.
|
||||
long lastObservationTimestampMillis;
|
||||
|
||||
// Client timestamp when the beacon was first observed in BLE scan.
|
||||
long firstObservationTimestampMillis;
|
||||
|
||||
// Item's current state. e.g. if the item is blocked.
|
||||
int state;
|
||||
|
||||
// The resolved url type for the action_url.
|
||||
int actionUrlType;
|
||||
|
||||
// The timestamp when the user is redirected to Play Store after clicking on
|
||||
// the item.
|
||||
long pendingAppInstallTimestampMillis;
|
||||
|
||||
// Beacon's RSSI value
|
||||
int rssi;
|
||||
|
||||
// Beacon's tx power
|
||||
int txPower;
|
||||
|
||||
// Human readable name of the app designated to open the uri
|
||||
// Used in the second line of the notification, "Open in {} app"
|
||||
String appName;
|
||||
|
||||
// Package name of the App that owns this item.
|
||||
String packageName;
|
||||
|
||||
// TriggerId identifies the trigger/beacon that is attached with a message.
|
||||
// It's generated from server for online messages to synchronize formatting
|
||||
// across client versions.
|
||||
// Example:
|
||||
// * BLE_UID: 3||deadbeef
|
||||
// * BLE_URL: http://trigger.id
|
||||
// See go/discovery-store-message-and-trigger-id for more details.
|
||||
String triggerId;
|
||||
|
||||
// Bytes of item icon in PNG format displayed in Discovery item list.
|
||||
byte[] iconPng;
|
||||
|
||||
// A FIFE URL of the item icon displayed in Discovery item list.
|
||||
String iconFifeUrl;
|
||||
|
||||
// Fast Pair antispoof key.
|
||||
byte[] authenticationPublicKeySecp256r1;
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
import android.accounts.Account;
|
||||
|
||||
/**
|
||||
* Fast Pair Eligible Account.
|
||||
* {@hide}
|
||||
*/
|
||||
parcelable FastPairEligibleAccountParcel {
|
||||
Account account;
|
||||
// Whether the account opts in Fast Pair.
|
||||
boolean optIn;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 android.nearby.aidl;
|
||||
|
||||
/**
|
||||
* Request details for Fast Pair eligible accounts.
|
||||
* Empty place holder for future expansion.
|
||||
* {@hide}
|
||||
*/
|
||||
parcelable FastPairEligibleAccountsRequestParcel {
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue