diff options
| author | 2025-02-26 09:19:40 -0800 | |
|---|---|---|
| committer | 2025-02-26 09:19:40 -0800 | |
| commit | 5ffe4ffa20d53c01da9ff2f9d4a9759a0375cd1d (patch) | |
| tree | b269ad1d27054a96b6e9ffc5a89ec7086bcdbfc1 /framework/java | |
| parent | f17fbf0863977b2452bbf4ae8e51035769a19ae7 (diff) | |
| parent | 4656c8ee7c1a25f1b49576dac9dd78d1a3ee070c (diff) | |
Merge "Unify reference to BluetoothProfiles.STATE_foo" into main am: b1a953a44a am: 4656c8ee7c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3507643
Change-Id: I5b0400acfa4a36eb2317cd0d3734f211653892a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'framework/java')
21 files changed, 61 insertions, 31 deletions
diff --git a/framework/java/android/bluetooth/BluetoothA2dp.java b/framework/java/android/bluetooth/BluetoothA2dp.java index 06e98105cd..b2f5e3777c 100644 --- a/framework/java/android/bluetooth/BluetoothA2dp.java +++ b/framework/java/android/bluetooth/BluetoothA2dp.java @@ -18,6 +18,10 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTING; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTING; import android.annotation.IntDef; import android.annotation.NonNull; @@ -446,7 +450,7 @@ public final class BluetoothA2dp implements BluetoothProfile { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothA2dpSink.java b/framework/java/android/bluetooth/BluetoothA2dpSink.java index 1cd9c6a5cb..3d07687294 100644 --- a/framework/java/android/bluetooth/BluetoothA2dpSink.java +++ b/framework/java/android/bluetooth/BluetoothA2dpSink.java @@ -18,6 +18,10 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTING; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTING; import android.annotation.NonNull; import android.annotation.RequiresNoPermission; @@ -266,7 +270,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothAvrcpController.java b/framework/java/android/bluetooth/BluetoothAvrcpController.java index 8ced189723..bb8390f559 100644 --- a/framework/java/android/bluetooth/BluetoothAvrcpController.java +++ b/framework/java/android/bluetooth/BluetoothAvrcpController.java @@ -17,6 +17,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import android.annotation.RequiresNoPermission; import android.annotation.RequiresPermission; @@ -194,7 +195,7 @@ public final class BluetoothAvrcpController implements BluetoothProfile { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java index 059e791bea..c80e5ab8e0 100644 --- a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java +++ b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java @@ -19,6 +19,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static android.bluetooth.BluetoothUtils.executeFromBinder; import static java.util.Objects.requireNonNull; @@ -444,7 +445,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothGatt.java b/framework/java/android/bluetooth/BluetoothGatt.java index 3e3f3a207c..1ef8d2add6 100644 --- a/framework/java/android/bluetooth/BluetoothGatt.java +++ b/framework/java/android/bluetooth/BluetoothGatt.java @@ -18,6 +18,8 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static android.bluetooth.BluetoothUtils.logRemoteException; import android.annotation.IntDef; @@ -268,7 +270,7 @@ public final class BluetoothGatt implements BluetoothProfile { callback.onConnectionStateChange( BluetoothGatt.this, GATT_FAILURE, - BluetoothProfile.STATE_DISCONNECTED); + STATE_DISCONNECTED); } } }); @@ -385,10 +387,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (!address.equals(mDevice.getAddress())) { return; } - int profileState = - connected - ? BluetoothProfile.STATE_CONNECTED - : BluetoothProfile.STATE_DISCONNECTED; + int profileState = connected ? STATE_CONNECTED : STATE_DISCONNECTED; if (Flags.unregisterGattClientDisconnected() && !connected && !mAutoConnect) { unregisterApp(); diff --git a/framework/java/android/bluetooth/BluetoothGattServer.java b/framework/java/android/bluetooth/BluetoothGattServer.java index 34002052b4..3a86c1d7b3 100644 --- a/framework/java/android/bluetooth/BluetoothGattServer.java +++ b/framework/java/android/bluetooth/BluetoothGattServer.java @@ -17,6 +17,8 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import android.annotation.IntDef; import android.annotation.NonNull; @@ -122,9 +124,7 @@ public final class BluetoothGattServer implements BluetoothProfile { mCallback.onConnectionStateChange( mAdapter.getRemoteDevice(address), status, - connected - ? BluetoothProfile.STATE_CONNECTED - : BluetoothProfile.STATE_DISCONNECTED); + connected ? STATE_CONNECTED : STATE_DISCONNECTED); } catch (Exception ex) { Log.w(TAG, "Unhandled exception in callback", ex); } diff --git a/framework/java/android/bluetooth/BluetoothHapClient.java b/framework/java/android/bluetooth/BluetoothHapClient.java index 08642c3800..9a9d36f285 100644 --- a/framework/java/android/bluetooth/BluetoothHapClient.java +++ b/framework/java/android/bluetooth/BluetoothHapClient.java @@ -19,6 +19,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static android.bluetooth.BluetoothUtils.callServiceIfEnabled; import static java.util.Objects.requireNonNull; @@ -661,7 +662,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable @Override @BluetoothProfile.BtProfileState public int getConnectionState(@NonNull BluetoothDevice device) { - int defaultValue = BluetoothProfile.STATE_DISCONNECTED; + int defaultValue = STATE_DISCONNECTED; if (!isValidDevice(device)) { return defaultValue; } diff --git a/framework/java/android/bluetooth/BluetoothHeadset.java b/framework/java/android/bluetooth/BluetoothHeadset.java index dc99736bbf..5604acfab8 100644 --- a/framework/java/android/bluetooth/BluetoothHeadset.java +++ b/framework/java/android/bluetooth/BluetoothHeadset.java @@ -19,6 +19,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; import static android.Manifest.permission.MODIFY_PHONE_STATE; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static java.util.Objects.requireNonNull; @@ -547,7 +548,7 @@ public final class BluetoothHeadset implements BluetoothProfile { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothHeadsetClient.java b/framework/java/android/bluetooth/BluetoothHeadsetClient.java index 3ef33cb845..75fb320dcf 100644 --- a/framework/java/android/bluetooth/BluetoothHeadsetClient.java +++ b/framework/java/android/bluetooth/BluetoothHeadsetClient.java @@ -17,6 +17,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static java.util.Objects.requireNonNull; @@ -795,7 +796,7 @@ public final class BluetoothHeadsetClient implements BluetoothProfile, AutoClose Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothHearingAid.java b/framework/java/android/bluetooth/BluetoothHearingAid.java index 0a4e829216..fec476b4f5 100644 --- a/framework/java/android/bluetooth/BluetoothHearingAid.java +++ b/framework/java/android/bluetooth/BluetoothHearingAid.java @@ -19,6 +19,10 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; import static android.Manifest.permission.BLUETOOTH_SCAN; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTING; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTING; import android.annotation.IntDef; import android.annotation.NonNull; @@ -470,7 +474,7 @@ public final class BluetoothHearingAid implements BluetoothProfile { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothHidHost.java b/framework/java/android/bluetooth/BluetoothHidHost.java index 6e9759b1e5..12f871fe1a 100644 --- a/framework/java/android/bluetooth/BluetoothHidHost.java +++ b/framework/java/android/bluetooth/BluetoothHidHost.java @@ -18,6 +18,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static java.util.Objects.requireNonNull; @@ -386,7 +387,7 @@ public final class BluetoothHidHost implements BluetoothProfile { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java index 09683a912a..d1af1b8fc9 100644 --- a/framework/java/android/bluetooth/BluetoothLeAudio.java +++ b/framework/java/android/bluetooth/BluetoothLeAudio.java @@ -19,6 +19,10 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTING; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTING; import static java.util.Objects.requireNonNull; @@ -972,7 +976,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java index a0ce14ade0..3b333b8514 100644 --- a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java +++ b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java @@ -19,6 +19,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; import static android.Manifest.permission.BLUETOOTH_SCAN; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static java.util.Objects.requireNonNull; @@ -582,7 +583,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au log("getConnectionState(" + sink + ")"); requireNonNull(sink); final IBluetoothLeBroadcastAssistant service = getService(); - final int defaultValue = BluetoothProfile.STATE_DISCONNECTED; + final int defaultValue = STATE_DISCONNECTED; if (service == null) { Log.w(TAG, "Proxy not attached to service"); if (DBG) log(Log.getStackTraceString(new Throwable())); diff --git a/framework/java/android/bluetooth/BluetoothManager.java b/framework/java/android/bluetooth/BluetoothManager.java index 00522d4f89..4dce4c790b 100644 --- a/framework/java/android/bluetooth/BluetoothManager.java +++ b/framework/java/android/bluetooth/BluetoothManager.java @@ -17,6 +17,8 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; +import static android.bluetooth.BluetoothProfile.STATE_CONNECTED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static com.android.modules.utils.build.SdkLevel.isAtLeastU; @@ -100,11 +102,11 @@ public final class BluetoothManager { List<BluetoothDevice> connectedDevices = getConnectedDevices(profile); for (BluetoothDevice connectedDevice : connectedDevices) { if (device.equals(connectedDevice)) { - return BluetoothProfile.STATE_CONNECTED; + return STATE_CONNECTED; } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** @@ -123,8 +125,7 @@ public final class BluetoothManager { @RequiresBluetoothConnectPermission @RequiresPermission(BLUETOOTH_CONNECT) public List<BluetoothDevice> getConnectedDevices(int profile) { - return getDevicesMatchingConnectionStates( - profile, new int[] {BluetoothProfile.STATE_CONNECTED}); + return getDevicesMatchingConnectionStates(profile, new int[] {STATE_CONNECTED}); } /** diff --git a/framework/java/android/bluetooth/BluetoothMap.java b/framework/java/android/bluetooth/BluetoothMap.java index 2f079d1a90..78d608761f 100644 --- a/framework/java/android/bluetooth/BluetoothMap.java +++ b/framework/java/android/bluetooth/BluetoothMap.java @@ -18,6 +18,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import android.annotation.NonNull; import android.annotation.RequiresNoPermission; @@ -426,7 +427,7 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothMapClient.java b/framework/java/android/bluetooth/BluetoothMapClient.java index 0f6700df80..b9d1690ebf 100644 --- a/framework/java/android/bluetooth/BluetoothMapClient.java +++ b/framework/java/android/bluetooth/BluetoothMapClient.java @@ -20,6 +20,7 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; import static android.Manifest.permission.RECEIVE_SMS; import static android.Manifest.permission.SEND_SMS; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import android.annotation.NonNull; import android.annotation.Nullable; @@ -395,7 +396,7 @@ public final class BluetoothMapClient implements BluetoothProfile, AutoCloseable Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothPan.java b/framework/java/android/bluetooth/BluetoothPan.java index 6ecdc6fa2a..c361ff5f0b 100644 --- a/framework/java/android/bluetooth/BluetoothPan.java +++ b/framework/java/android/bluetooth/BluetoothPan.java @@ -20,6 +20,7 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; import static android.Manifest.permission.TETHER_PRIVILEGED; import static android.annotation.SystemApi.Client.MODULE_LIBRARIES; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static android.bluetooth.BluetoothUtils.executeFromBinder; import static java.util.Objects.requireNonNull; @@ -478,7 +479,7 @@ public final class BluetoothPan implements BluetoothProfile { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothPbap.java b/framework/java/android/bluetooth/BluetoothPbap.java index afa796b85e..80a16de9a3 100644 --- a/framework/java/android/bluetooth/BluetoothPbap.java +++ b/framework/java/android/bluetooth/BluetoothPbap.java @@ -18,6 +18,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import android.annotation.NonNull; import android.annotation.RequiresNoPermission; @@ -193,11 +194,11 @@ public class BluetoothPbap implements BluetoothProfile { if (service == null) { Log.w(TAG, "Proxy not attached to service"); } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } catch (RemoteException e) { Log.e(TAG, e.toString()); } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothPbapClient.java b/framework/java/android/bluetooth/BluetoothPbapClient.java index 0969c688f7..44065a424f 100644 --- a/framework/java/android/bluetooth/BluetoothPbapClient.java +++ b/framework/java/android/bluetooth/BluetoothPbapClient.java @@ -18,6 +18,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import android.annotation.NonNull; import android.annotation.RequiresNoPermission; @@ -298,7 +299,7 @@ public final class BluetoothPbapClient implements BluetoothProfile, AutoCloseabl Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } private static void log(String msg) { diff --git a/framework/java/android/bluetooth/BluetoothSap.java b/framework/java/android/bluetooth/BluetoothSap.java index 843b369be0..b4ba87a36f 100644 --- a/framework/java/android/bluetooth/BluetoothSap.java +++ b/framework/java/android/bluetooth/BluetoothSap.java @@ -18,6 +18,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static java.util.Objects.requireNonNull; @@ -424,7 +425,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } - return BluetoothProfile.STATE_DISCONNECTED; + return STATE_DISCONNECTED; } /** diff --git a/framework/java/android/bluetooth/BluetoothVolumeControl.java b/framework/java/android/bluetooth/BluetoothVolumeControl.java index c5e89749e7..819796b6b6 100644 --- a/framework/java/android/bluetooth/BluetoothVolumeControl.java +++ b/framework/java/android/bluetooth/BluetoothVolumeControl.java @@ -19,6 +19,7 @@ package android.bluetooth; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_PRIVILEGED; +import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; import static android.bluetooth.BluetoothUtils.callServiceIfEnabled; import static android.bluetooth.BluetoothUtils.executeFromBinder; @@ -376,7 +377,7 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose @RequiresPermission(BLUETOOTH_CONNECT) public int getConnectionState(BluetoothDevice device) { Log.d(TAG, "getConnectionState(" + device + ")"); - int defaultValue = BluetoothProfile.STATE_DISCONNECTED; + int defaultValue = STATE_DISCONNECTED; if (!isValidDevice(device)) { return defaultValue; |