diff options
author | William Escande <wescande@google.com> | 2022-03-16 16:01:30 +0100 |
---|---|---|
committer | William Escande <wescande@google.com> | 2022-03-16 16:03:09 +0100 |
commit | cadf64a64f71d4a733bbe173d2c06222f0f3718a (patch) | |
tree | 2fa15310e91aeee16b72e74913a54b750cc9a364 /framework/java/android/bluetooth/BluetoothAdapter.java | |
parent | 0bb2460bd5772317757f561dbfa6b186e586acf8 (diff) |
API Review: Add ConnectionState Intdef
> getConnectionState Please add @intdef for the return value.
Bug: 222434921
Test: TH
Tag: #refactor
Ignore-AOSP-First: merge conflict
Change-Id: Idab42db60cff7a1bc346f29685acffee1764a3d3
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothAdapter.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java index a1726307d9..7f3e0dc416 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -739,6 +739,16 @@ public final class BluetoothAdapter { 3; //BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTING; /** @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = { "STATE_" }, value = { + STATE_DISCONNECTED, + STATE_CONNECTING, + STATE_CONNECTED, + STATE_DISCONNECTING, + }) + public @interface ConnectionState {} + + /** @hide */ public static final String BLUETOOTH_MANAGER_SERVICE = "bluetooth_manager"; private final IBinder mToken; @@ -2856,13 +2866,12 @@ public final class BluetoothAdapter { * <p> Use this function along with {@link #ACTION_CONNECTION_STATE_CHANGED} * intent to get the connection state of the adapter. * - * @return One of {@link #STATE_CONNECTED}, {@link #STATE_DISCONNECTED}, {@link - * #STATE_CONNECTING} or {@link #STATE_DISCONNECTED} + * @return the connection state * @hide */ @SystemApi @RequiresNoPermission - public int getConnectionState() { + public @ConnectionState int getConnectionState() { if (getState() != STATE_ON) { return BluetoothAdapter.STATE_DISCONNECTED; } @@ -2918,17 +2927,13 @@ public final class BluetoothAdapter { * is connected to any remote device for a specific profile. * Profile can be one of {@link BluetoothProfile#HEADSET}, {@link BluetoothProfile#A2DP}. * - * <p> Return value can be one of - * {@link BluetoothProfile#STATE_DISCONNECTED}, - * {@link BluetoothProfile#STATE_CONNECTING}, - * {@link BluetoothProfile#STATE_CONNECTED}, - * {@link BluetoothProfile#STATE_DISCONNECTING} + * <p> Return the profile connection state */ @RequiresLegacyBluetoothPermission @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @SuppressLint("AndroidFrameworkRequiresPermission") - public int getProfileConnectionState(int profile) { + public @ConnectionState int getProfileConnectionState(int profile) { if (getState() != STATE_ON) { return BluetoothProfile.STATE_DISCONNECTED; } |