diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-17 01:09:15 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-17 01:09:15 +0000 |
commit | ad221bf0c86a98f68d69e06ad79e025a38563881 (patch) | |
tree | 592c23b8ee42946d534813f2a5a419197db2ba9d /framework/java | |
parent | 2d0b6d82820b623c317d4b6c08f604e521123b15 (diff) | |
parent | b25cc6990ec081ebccbd0fb62ced8073cd1a7e3d (diff) |
Snap for 8310722 from b25cc6990ec081ebccbd0fb62ced8073cd1a7e3d to tm-release
Change-Id: Ib2298a055a80baf0309b3f178c541872d709fd2e
Diffstat (limited to 'framework/java')
3 files changed, 24 insertions, 34 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java index 01bc1bade2..de3f570d96 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -190,6 +190,16 @@ public final class BluetoothAdapter { STATE_BLE_TURNING_OFF }) @Retention(RetentionPolicy.SOURCE) + public @interface InternalAdapterState {} + + /** @hide */ + @IntDef(prefix = { "STATE_" }, value = { + STATE_OFF, + STATE_TURNING_ON, + STATE_ON, + STATE_TURNING_OFF, + }) + @Retention(RetentionPolicy.SOURCE) public @interface AdapterState {} /** @@ -270,14 +280,14 @@ public final class BluetoothAdapter { public @interface RfcommListenerResult {} /** - * Human-readable string helper for AdapterState + * Human-readable string helper for AdapterState and InternalAdapterState * * @hide */ @SystemApi @RequiresNoPermission @NonNull - public static String nameForState(@AdapterState int state) { + public static String nameForState(@InternalAdapterState int state) { switch (state) { case STATE_OFF: return "OFF"; @@ -1151,9 +1161,8 @@ public final class BluetoothAdapter { new IpcDataCache.QueryHandler<>() { @RequiresLegacyBluetoothPermission @RequiresNoPermission - @AdapterState @Override - public Integer apply(Void query) { + public @InternalAdapterState Integer apply(Void query) { int state = BluetoothAdapter.STATE_OFF; mServiceLock.readLock().lock(); try { @@ -1189,8 +1198,7 @@ public final class BluetoothAdapter { * Fetch the current bluetooth state. If the service is down, return * OFF. */ - @AdapterState - private int getStateInternal() { + private @InternalAdapterState int getStateInternal() { return mBluetoothGetStateCache.query(null); } @@ -1206,8 +1214,7 @@ public final class BluetoothAdapter { */ @RequiresLegacyBluetoothPermission @RequiresNoPermission - @AdapterState - public int getState() { + public @AdapterState int getState() { int state = getStateInternal(); // Consider all internal states as OFF @@ -1243,10 +1250,9 @@ public final class BluetoothAdapter { */ @RequiresLegacyBluetoothPermission @RequiresNoPermission - @AdapterState @UnsupportedAppUsage(publicAlternatives = "Use {@link #getState()} instead to determine " + "whether you can use BLE & BT classic.") - public int getLeState() { + public @InternalAdapterState int getLeState() { int state = getStateInternal(); if (VDBG) { diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java index 90aa3000e6..978c8ed4ac 100644 --- a/framework/java/android/bluetooth/BluetoothDevice.java +++ b/framework/java/android/bluetooth/BluetoothDevice.java @@ -1323,7 +1323,14 @@ public final class BluetoothDevice implements Parcelable, Attributable { mAttributionSource = attributionSource; } - /** {@hide} */ + /** + * Method should never be used anywhere. Only exception is from {@link Intent} + * Used to set the device current attribution source + * + * @param attributionSource The associated {@link AttributionSource} for this device in this + * process + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public void prepareToEnterProcess(@NonNull AttributionSource attributionSource) { diff --git a/framework/java/android/bluetooth/BluetoothHapClient.java b/framework/java/android/bluetooth/BluetoothHapClient.java index 4d1bd6ac1a..986c4adf14 100644 --- a/framework/java/android/bluetooth/BluetoothHapClient.java +++ b/framework/java/android/bluetooth/BluetoothHapClient.java @@ -141,17 +141,6 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable @Status int statusCode); /** - * Invoked to inform about HA device's feature set. - * - * @param device remote device - * @param hapFeatures the feature set integer with feature bits set. The inidividual bits - * are defined by Bluetooth SIG in Hearing Access Service specification. - * - * @hide - */ - void onHapFeaturesAvailable(@NonNull BluetoothDevice device, @Feature int hapFeatures); - - /** * Invoked to inform about the failed preset rename attempt. * * @param device remote device @@ -224,18 +213,6 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable } @Override - public void onHapFeaturesAvailable(@NonNull BluetoothDevice device, - @Feature int hapFeatures) { - Attributable.setAttributionSource(device, mAttributionSource); - for (Map.Entry<BluetoothHapClient.Callback, Executor> callbackExecutorEntry: - mCallbackExecutorMap.entrySet()) { - BluetoothHapClient.Callback callback = callbackExecutorEntry.getKey(); - Executor executor = callbackExecutorEntry.getValue(); - executor.execute(() -> callback.onHapFeaturesAvailable(device, hapFeatures)); - } - } - - @Override public void onSetPresetNameFailed(@NonNull BluetoothDevice device, int status) { Attributable.setAttributionSource(device, mAttributionSource); for (Map.Entry<BluetoothHapClient.Callback, Executor> callbackExecutorEntry: |