summaryrefslogtreecommitdiff
path: root/framework/java
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-04 20:05:33 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-03-04 20:05:33 -0800
commitbf4baf6cbe7c0ec6b612af9dd9c2fc85d230a644 (patch)
tree095cfa52139a21dc30754ca8e4f6a0866ef4ab3b /framework/java
parent1fcc93d264382db502ed541c7e749eb7256682c3 (diff)
parentf314439954e6f319b2c528c5da51514d966baaef (diff)
Merge changes Iaaf88404,Icb83cee8,Iea773640,I0870dce2 into main am: 512d83351a am: f314439954
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3503911 Change-Id: I40d8db119959dd232f22e97fcfabde6c9065c45d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'framework/java')
-rw-r--r--framework/java/android/bluetooth/BluetoothActivityEnergyInfo.java10
-rw-r--r--framework/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java4
-rw-r--r--framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothGatt.java12
-rw-r--r--framework/java/android/bluetooth/BluetoothGattServer.java4
-rw-r--r--framework/java/android/bluetooth/BluetoothHapClient.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothHapPresetInfo.java8
-rw-r--r--framework/java/android/bluetooth/BluetoothInputStream.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudio.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcast.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeCall.java10
-rw-r--r--framework/java/android/bluetooth/BluetoothLeCallControl.java176
-rw-r--r--framework/java/android/bluetooth/BluetoothMap.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothOutputStream.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothPbap.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothQualityReport.java182
-rw-r--r--framework/java/android/bluetooth/BluetoothSap.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothServerSocket.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothSocketSettings.java22
-rw-r--r--framework/java/android/bluetooth/BluetoothVolumeControl.java4
-rw-r--r--framework/java/android/bluetooth/BufferConstraint.java6
-rw-r--r--framework/java/android/bluetooth/BufferConstraints.java4
-rw-r--r--framework/java/android/bluetooth/OobData.java2
-rw-r--r--framework/java/android/bluetooth/le/AdvertiseData.java11
-rw-r--r--framework/java/android/bluetooth/le/AdvertisingSet.java2
-rw-r--r--framework/java/android/bluetooth/le/ChannelSoundingParams.java6
-rw-r--r--framework/java/android/bluetooth/le/DistanceMeasurementMethod.java2
-rw-r--r--framework/java/android/bluetooth/le/ScanSettings.java16
31 files changed, 168 insertions, 339 deletions
diff --git a/framework/java/android/bluetooth/BluetoothActivityEnergyInfo.java b/framework/java/android/bluetooth/BluetoothActivityEnergyInfo.java
index 06336e5b31..1dc5c3bf92 100644
--- a/framework/java/android/bluetooth/BluetoothActivityEnergyInfo.java
+++ b/framework/java/android/bluetooth/BluetoothActivityEnergyInfo.java
@@ -37,11 +37,11 @@ import java.util.List;
@SystemApi(client = SystemApi.Client.PRIVILEGED_APPS)
public final class BluetoothActivityEnergyInfo implements Parcelable {
private final long mTimestamp;
- private int mBluetoothStackState;
- private long mControllerTxTimeMs;
- private long mControllerRxTimeMs;
- private long mControllerIdleTimeMs;
- private long mControllerEnergyUsed;
+ private final int mBluetoothStackState;
+ private final long mControllerTxTimeMs;
+ private final long mControllerRxTimeMs;
+ private final long mControllerIdleTimeMs;
+ private final long mControllerEnergyUsed;
private List<UidTraffic> mUidTraffic;
/** @hide */
diff --git a/framework/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java b/framework/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
index ef220e5918..0b031dfd66 100644
--- a/framework/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
+++ b/framework/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
@@ -87,10 +87,10 @@ public final class BluetoothAvrcpPlayerSettings implements Parcelable {
public static final int STATE_GROUP = 0x04;
/** List of supported settings ORed. */
- private int mSettings;
+ private final int mSettings;
/** Hash map of current capability values. */
- private Map<Integer, Integer> mSettingsValue = new HashMap<Integer, Integer>();
+ private final Map<Integer, Integer> mSettingsValue = new HashMap<Integer, Integer>();
@Override
public int describeContents() {
diff --git a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
index abec916a24..9ec499d002 100644
--- a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
+++ b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
@@ -67,7 +67,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
private static final boolean DBG = false;
private static final boolean VDBG = false;
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
/** @hide */
@SystemApi
diff --git a/framework/java/android/bluetooth/BluetoothGatt.java b/framework/java/android/bluetooth/BluetoothGatt.java
index 1ef8d2add6..7ba4aa2993 100644
--- a/framework/java/android/bluetooth/BluetoothGatt.java
+++ b/framework/java/android/bluetooth/BluetoothGatt.java
@@ -64,11 +64,11 @@ public final class BluetoothGatt implements BluetoothProfile {
private static final boolean DBG = true;
private static final boolean VDBG = false;
- @UnsupportedAppUsage private IBluetoothGatt mService;
+ @UnsupportedAppUsage private final IBluetoothGatt mService;
@UnsupportedAppUsage private volatile BluetoothGattCallback mCallback;
private Handler mHandler;
@UnsupportedAppUsage private int mClientIf;
- private BluetoothDevice mDevice;
+ private final BluetoothDevice mDevice;
@UnsupportedAppUsage private boolean mAutoConnect;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
@@ -82,10 +82,10 @@ public final class BluetoothGatt implements BluetoothProfile {
private Boolean mDeviceBusy = false;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- private int mTransport;
+ private final int mTransport;
- private int mPhy;
- private boolean mOpportunistic;
+ private final int mPhy;
+ private final boolean mOpportunistic;
private final AttributionSource mAttributionSource;
private static final int AUTH_RETRY_STATE_IDLE = 0;
@@ -101,7 +101,7 @@ public final class BluetoothGatt implements BluetoothProfile {
// Max length of an attribute value, defined in gatt_api.h
private static final int GATT_MAX_ATTR_LEN = 512;
- private CopyOnWriteArrayList<BluetoothGattService> mServices;
+ private final CopyOnWriteArrayList<BluetoothGattService> mServices;
/** A GATT operation completed successfully */
public static final int GATT_SUCCESS = 0;
diff --git a/framework/java/android/bluetooth/BluetoothGattServer.java b/framework/java/android/bluetooth/BluetoothGattServer.java
index 3a86c1d7b3..4c180a30fb 100644
--- a/framework/java/android/bluetooth/BluetoothGattServer.java
+++ b/framework/java/android/bluetooth/BluetoothGattServer.java
@@ -62,9 +62,9 @@ public final class BluetoothGattServer implements BluetoothProfile {
private final Object mServerIfLock = new Object();
private int mServerIf;
- private int mTransport;
+ private final int mTransport;
private BluetoothGattService mPendingService;
- private List<BluetoothGattService> mServices;
+ private final List<BluetoothGattService> mServices;
private static final int CALLBACK_REG_TIMEOUT = 10000;
// Max length of an attribute value, defined in gatt_api.h
diff --git a/framework/java/android/bluetooth/BluetoothHapClient.java b/framework/java/android/bluetooth/BluetoothHapClient.java
index e551cca8f5..bcbf278260 100644
--- a/framework/java/android/bluetooth/BluetoothHapClient.java
+++ b/framework/java/android/bluetooth/BluetoothHapClient.java
@@ -63,7 +63,7 @@ import java.util.function.Consumer;
public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable {
private static final String TAG = BluetoothHapClient.class.getSimpleName();
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
/**
* This class provides callbacks mechanism for the BluetoothHapClient profile.
diff --git a/framework/java/android/bluetooth/BluetoothHapPresetInfo.java b/framework/java/android/bluetooth/BluetoothHapPresetInfo.java
index cdc69d171b..0744257be0 100644
--- a/framework/java/android/bluetooth/BluetoothHapPresetInfo.java
+++ b/framework/java/android/bluetooth/BluetoothHapPresetInfo.java
@@ -30,10 +30,10 @@ import android.text.TextUtils;
*/
@SystemApi
public final class BluetoothHapPresetInfo implements Parcelable {
- private int mPresetIndex;
- private String mPresetName = "";
- private boolean mIsWritable;
- private boolean mIsAvailable;
+ private final int mPresetIndex;
+ private final String mPresetName;
+ private final boolean mIsWritable;
+ private final boolean mIsAvailable;
/**
* HapPresetInfo constructor
diff --git a/framework/java/android/bluetooth/BluetoothInputStream.java b/framework/java/android/bluetooth/BluetoothInputStream.java
index 98c3491477..657f6944f3 100644
--- a/framework/java/android/bluetooth/BluetoothInputStream.java
+++ b/framework/java/android/bluetooth/BluetoothInputStream.java
@@ -30,7 +30,7 @@ import java.io.InputStream;
*/
@SuppressLint("AndroidFrameworkBluetoothPermission")
/*package*/ final class BluetoothInputStream extends InputStream {
- private BluetoothSocket mSocket;
+ private final BluetoothSocket mSocket;
/*package*/ BluetoothInputStream(BluetoothSocket s) {
mSocket = s;
diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java
index 4cc3b604fb..d42670fe9c 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudio.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudio.java
@@ -74,7 +74,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);
private static final boolean VDBG = false;
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
/**
* This class provides a callback that is invoked when audio codec config changes on the remote
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcast.java b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
index 4023184fee..85c895fa54 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcast.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
@@ -61,7 +61,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
private static final boolean DBG = true;
private static final boolean VDBG = false;
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
private final BluetoothAdapter mAdapter;
private final AttributionSource mAttributionSource;
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
index 63ddb8a03a..d72fc1a50f 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
@@ -495,7 +495,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
public static final String ACTION_CONNECTION_STATE_CHANGED =
"android.bluetooth.action.CONNECTION_STATE_CHANGED";
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
private final BluetoothAdapter mBluetoothAdapter;
private final AttributionSource mAttributionSource;
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
index ea77d2684c..562e0b7835 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
@@ -518,7 +518,7 @@ public final class BluetoothLeBroadcastMetadata implements Parcelable {
private @AudioConfigQuality int mAudioConfigQuality = AUDIO_CONFIG_QUALITY_NONE;
private int mRssi = RSSI_UNKNOWN;
private BluetoothLeAudioContentMetadata mPublicBroadcastMetadata = null;
- private List<BluetoothLeBroadcastSubgroup> mSubgroups = new ArrayList<>();
+ private final List<BluetoothLeBroadcastSubgroup> mSubgroups = new ArrayList<>();
/**
* Create an empty builder.
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java b/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java
index 86580d5fe5..5d150ed78c 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java
@@ -210,7 +210,7 @@ public final class BluetoothLeBroadcastSubgroup implements Parcelable {
private long mCodecId = UNKNOWN_VALUE_PLACEHOLDER;
private BluetoothLeAudioCodecConfigMetadata mCodecSpecificConfig = null;
private BluetoothLeAudioContentMetadata mContentMetadata = null;
- private List<BluetoothLeBroadcastChannel> mChannels = new ArrayList<>();
+ private final List<BluetoothLeBroadcastChannel> mChannels = new ArrayList<>();
/**
* Create an empty constructor.
diff --git a/framework/java/android/bluetooth/BluetoothLeCall.java b/framework/java/android/bluetooth/BluetoothLeCall.java
index 355e31161e..9dc6bb03e3 100644
--- a/framework/java/android/bluetooth/BluetoothLeCall.java
+++ b/framework/java/android/bluetooth/BluetoothLeCall.java
@@ -124,19 +124,19 @@ public final class BluetoothLeCall implements Parcelable {
public static final int FLAG_WITHHELD_BY_NETWORK = 0x00000004;
/** Unique UUID that identifies this call */
- private UUID mUuid;
+ private final UUID mUuid;
/** Remote Caller URI */
- private String mUri;
+ private final String mUri;
/** Caller friendly name */
- private String mFriendlyName;
+ private final String mFriendlyName;
/** Call state */
- private @State int mState;
+ private final @State int mState;
/** Call flags */
- private int mCallFlags;
+ private final int mCallFlags;
/** @hide */
public BluetoothLeCall(@NonNull BluetoothLeCall that) {
diff --git a/framework/java/android/bluetooth/BluetoothLeCallControl.java b/framework/java/android/bluetooth/BluetoothLeCallControl.java
index 8d54d56160..e4b2e4fc32 100644
--- a/framework/java/android/bluetooth/BluetoothLeCallControl.java
+++ b/framework/java/android/bluetooth/BluetoothLeCallControl.java
@@ -21,7 +21,6 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static android.bluetooth.BluetoothUtils.executeFromBinder;
-import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresNoPermission;
@@ -35,8 +34,6 @@ import android.os.ParcelUuid;
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.List;
import java.util.UUID;
@@ -58,140 +55,6 @@ import java.util.concurrent.Executor;
public final class BluetoothLeCallControl implements BluetoothProfile {
private static final String TAG = BluetoothLeCallControl.class.getSimpleName();
- /** @hide */
- @IntDef(
- prefix = "RESULT_",
- value = {
- RESULT_SUCCESS,
- RESULT_ERROR_UNKNOWN_CALL_ID,
- RESULT_ERROR_INVALID_URI,
- RESULT_ERROR_APPLICATION
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface Result {}
-
- /**
- * Opcode write was successful.
- *
- * @hide
- */
- public static final int RESULT_SUCCESS = 0;
-
- /**
- * Unknown call Id has been used in the operation.
- *
- * @hide
- */
- public static final int RESULT_ERROR_UNKNOWN_CALL_ID = 1;
-
- /**
- * The URI provided in {@link Callback#onPlaceCallRequest} is invalid.
- *
- * @hide
- */
- public static final int RESULT_ERROR_INVALID_URI = 2;
-
- /**
- * Application internal error.
- *
- * @hide
- */
- public static final int RESULT_ERROR_APPLICATION = 3;
-
- /** @hide */
- @IntDef(
- prefix = "TERMINATION_REASON_",
- value = {
- TERMINATION_REASON_INVALID_URI,
- TERMINATION_REASON_FAIL,
- TERMINATION_REASON_REMOTE_HANGUP,
- TERMINATION_REASON_SERVER_HANGUP,
- TERMINATION_REASON_LINE_BUSY,
- TERMINATION_REASON_NETWORK_CONGESTION,
- TERMINATION_REASON_CLIENT_HANGUP,
- TERMINATION_REASON_NO_SERVICE,
- TERMINATION_REASON_NO_ANSWER
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface TerminationReason {}
-
- /**
- * Remote Caller ID value used to place a call was formed improperly.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_INVALID_URI = 0x00;
-
- /**
- * Call fail.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_FAIL = 0x01;
-
- /**
- * Remote party ended call.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_REMOTE_HANGUP = 0x02;
-
- /**
- * Call ended from the server.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_SERVER_HANGUP = 0x03;
-
- /**
- * Line busy.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_LINE_BUSY = 0x04;
-
- /**
- * Network congestion.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_NETWORK_CONGESTION = 0x05;
-
- /**
- * Client terminated.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_CLIENT_HANGUP = 0x06;
-
- /**
- * No service.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_NO_SERVICE = 0x07;
-
- /**
- * No answer.
- *
- * @hide
- */
- public static final int TERMINATION_REASON_NO_ANSWER = 0x08;
-
- /**
- * Flag indicating support for hold/unhold call feature.
- *
- * @hide
- */
- public static final int CAPABILITY_HOLD_CALL = 0x00000001;
-
- /**
- * Flag indicating support for joining calls feature.
- *
- * @hide
- */
- public static final int CAPABILITY_JOIN_CALLS = 0x00000002;
-
/**
* The template class is used to call callback functions on events from the TBS server. Callback
* functions are wrapped in this class and registered to the Android system during app
@@ -343,7 +206,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile {
}
;
- private BluetoothAdapter mAdapter;
+ private final BluetoothAdapter mAdapter;
private final AttributionSource mAttributionSource;
private int mCcid = 0;
private String mToken;
@@ -589,7 +452,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile {
*/
@RequiresBluetoothConnectPermission
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
- public void onCallRemoved(@NonNull UUID callId, @TerminationReason int reason) {
+ public void onCallRemoved(@NonNull UUID callId, int reason) {
Log.d(TAG, "callRemoved: callId=" + callId);
if (mCcid == 0) {
return;
@@ -664,39 +527,6 @@ public final class BluetoothLeCallControl implements BluetoothProfile {
}
/**
- * Provide the network current status
- *
- * <p>This function must be invoked on change of network state.
- * <!-- The Technology is an integer value. The possible values are defined at
- * https://www.bluetooth.com/specifications/assigned-numbers (login required).
- * -->
- *
- * @param provider Network provider name
- * @param technology Network technology
- * @hide
- */
- @RequiresBluetoothConnectPermission
- @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
- public void networkStateChanged(@NonNull String provider, int technology) {
- Log.d(TAG, "networkStateChanged: provider=" + provider + ", technology=" + technology);
- if (mCcid == 0) {
- return;
- }
-
- final IBluetoothLeCallControl service = getService();
- if (service == null) {
- Log.w(TAG, "Proxy not attached to service");
- return;
- }
-
- try {
- service.networkStateChanged(mCcid, provider, technology, mAttributionSource);
- } catch (RemoteException e) {
- Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- }
- }
-
- /**
* Send a response to a call control request to a remote device.
*
* <p>This function must be invoked in when a request is received by one of these callback
@@ -716,7 +546,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile {
*/
@RequiresBluetoothConnectPermission
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
- public void requestResult(int requestId, @Result int result) {
+ public void requestResult(int requestId, int result) {
Log.d(TAG, "requestResult: requestId=" + requestId + " result=" + result);
if (mCcid == 0) {
return;
diff --git a/framework/java/android/bluetooth/BluetoothMap.java b/framework/java/android/bluetooth/BluetoothMap.java
index 4c44995921..811856666b 100644
--- a/framework/java/android/bluetooth/BluetoothMap.java
+++ b/framework/java/android/bluetooth/BluetoothMap.java
@@ -57,7 +57,7 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable {
private static final boolean DBG = true;
private static final boolean VDBG = false;
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
/** @hide */
@SuppressLint("ActionValue")
diff --git a/framework/java/android/bluetooth/BluetoothOutputStream.java b/framework/java/android/bluetooth/BluetoothOutputStream.java
index 4d579ca00d..5fd6681494 100644
--- a/framework/java/android/bluetooth/BluetoothOutputStream.java
+++ b/framework/java/android/bluetooth/BluetoothOutputStream.java
@@ -30,7 +30,7 @@ import java.io.OutputStream;
*/
@SuppressLint("AndroidFrameworkBluetoothPermission")
/*package*/ final class BluetoothOutputStream extends OutputStream {
- private BluetoothSocket mSocket;
+ private final BluetoothSocket mSocket;
/*package*/ BluetoothOutputStream(BluetoothSocket s) {
mSocket = s;
diff --git a/framework/java/android/bluetooth/BluetoothPbap.java b/framework/java/android/bluetooth/BluetoothPbap.java
index 8da64ddb96..52e6fd7c17 100644
--- a/framework/java/android/bluetooth/BluetoothPbap.java
+++ b/framework/java/android/bluetooth/BluetoothPbap.java
@@ -110,7 +110,7 @@ public class BluetoothPbap implements BluetoothProfile {
*/
public static final int RESULT_CANCELED = 2;
- private BluetoothAdapter mAdapter;
+ private final BluetoothAdapter mAdapter;
private IBluetoothPbap mService;
diff --git a/framework/java/android/bluetooth/BluetoothQualityReport.java b/framework/java/android/bluetooth/BluetoothQualityReport.java
index 28b2f998af..5cb2625a4d 100644
--- a/framework/java/android/bluetooth/BluetoothQualityReport.java
+++ b/framework/java/android/bluetooth/BluetoothQualityReport.java
@@ -146,14 +146,14 @@ public final class BluetoothQualityReport implements Parcelable {
})
public @interface QualityReportId {}
- private String mAddr;
- private int mLmpVer;
- private int mLmpSubVer;
- private int mManufacturerId;
- private String mName;
- private BluetoothClass mBluetoothClass;
-
- private BqrCommon mBqrCommon;
+ private final String mAddr;
+ private final int mLmpVer;
+ private final int mLmpSubVer;
+ private final int mManufacturerId;
+ private final String mName;
+ private final BluetoothClass mBluetoothClass;
+
+ private final BqrCommon mBqrCommon;
private BqrVsLsto mBqrVsLsto;
private BqrVsA2dpChoppy mBqrVsA2dpChoppy;
private BqrVsScoChoppy mBqrVsScoChoppy;
@@ -192,7 +192,7 @@ public final class BluetoothQualityReport implements Parcelable {
TYPE_3DH3,
TYPE_3DH5;
- private static PacketType[] sAllValues = values();
+ private static final PacketType[] sAllValues = values();
static PacketType fromOrdinal(int n) {
if (n < sAllValues.length) {
@@ -224,7 +224,7 @@ public final class BluetoothQualityReport implements Parcelable {
CONN_SEMI_CONN(0x12);
private final int mValue;
- private static ConnState[] sAllStates = values();
+ private static final ConnState[] sAllStates = values();
ConnState(int val) {
mValue = val;
@@ -248,7 +248,7 @@ public final class BluetoothQualityReport implements Parcelable {
LOW,
INVALID;
- private static LinkQuality[] sAllValues = values();
+ private static final LinkQuality[] sAllValues = values();
static LinkQuality fromOrdinal(int n) {
if (n < sAllValues.length - 1) {
@@ -265,7 +265,7 @@ public final class BluetoothQualityReport implements Parcelable {
transparent_msbc,
INVALID;
- private static AirMode[] sAllValues = values();
+ private static final AirMode[] sAllValues = values();
static AirMode fromOrdinal(int n) {
if (n < sAllValues.length - 1) {
@@ -603,7 +603,7 @@ public final class BluetoothQualityReport implements Parcelable {
private int manufacturerId;
private String remoteName = "";
private BluetoothClass bluetoothClass = new BluetoothClass(0);
- private byte[] rawData;
+ private final byte[] rawData;
/**
* Creates a new instance of {@link Builder}.
@@ -746,7 +746,7 @@ public final class BluetoothQualityReport implements Parcelable {
static final int BQR_COMMON_LEN = 85;
- private @QualityReportId int mQualityReportId;
+ private final @QualityReportId int mQualityReportId;
private int mPacketType;
private int mConnectionHandle;
private int mConnectionRole;
@@ -1416,14 +1416,14 @@ public final class BluetoothQualityReport implements Parcelable {
private static final String TAG =
BluetoothQualityReport.TAG + "." + BqrVsLsto.class.getSimpleName();
- private int mConnState;
- private long mBasebandStats;
- private long mSlotsUsed;
- private int mCxmDenials;
- private int mTxSkipped;
- private int mRfLoss;
- private long mNativeClock;
- private long mLastTxAckTimestamp;
+ private final int mConnState;
+ private final long mBasebandStats;
+ private final long mSlotsUsed;
+ private final int mCxmDenials;
+ private final int mTxSkipped;
+ private final int mRfLoss;
+ private final long mNativeClock;
+ private final long mLastTxAckTimestamp;
private BqrVsLsto(byte[] rawData, int offset) {
if (rawData == null || rawData.length <= offset) {
@@ -1633,13 +1633,13 @@ public final class BluetoothQualityReport implements Parcelable {
private static final String TAG =
BluetoothQualityReport.TAG + "." + BqrVsA2dpChoppy.class.getSimpleName();
- private long mArrivalTime;
- private long mScheduleTime;
- private int mGlitchCount;
- private int mTxCxmDenials;
- private int mRxCxmDenials;
- private int mAclTxQueueLength;
- private int mLinkQuality;
+ private final long mArrivalTime;
+ private final long mScheduleTime;
+ private final int mGlitchCount;
+ private final int mTxCxmDenials;
+ private final int mRxCxmDenials;
+ private final int mAclTxQueueLength;
+ private final int mLinkQuality;
private BqrVsA2dpChoppy(byte[] rawData, int offset) {
if (rawData == null || rawData.length <= offset) {
@@ -1834,24 +1834,24 @@ public final class BluetoothQualityReport implements Parcelable {
private static final String TAG =
BluetoothQualityReport.TAG + "." + BqrVsScoChoppy.class.getSimpleName();
- private int mGlitchCount;
- private int mIntervalEsco;
- private int mWindowEsco;
- private int mAirFormat;
- private int mInstanceCount;
- private int mTxCxmDenials;
- private int mRxCxmDenials;
- private int mTxAbortCount;
- private int mLateDispatch;
- private int mMicIntrMiss;
- private int mLpaIntrMiss;
- private int mSprIntrMiss;
- private int mPlcFillCount;
- private int mPlcDiscardCount;
- private int mMissedInstanceCount;
- private int mTxRetransmitSlotCount;
- private int mRxRetransmitSlotCount;
- private int mGoodRxFrameCount;
+ private final int mGlitchCount;
+ private final int mIntervalEsco;
+ private final int mWindowEsco;
+ private final int mAirFormat;
+ private final int mInstanceCount;
+ private final int mTxCxmDenials;
+ private final int mRxCxmDenials;
+ private final int mTxAbortCount;
+ private final int mLateDispatch;
+ private final int mMicIntrMiss;
+ private final int mLpaIntrMiss;
+ private final int mSprIntrMiss;
+ private final int mPlcFillCount;
+ private final int mPlcDiscardCount;
+ private final int mMissedInstanceCount;
+ private final int mTxRetransmitSlotCount;
+ private final int mRxRetransmitSlotCount;
+ private final int mGoodRxFrameCount;
private BqrVsScoChoppy(byte[] rawData, int offset) {
if (rawData == null || rawData.length <= offset) {
@@ -2275,7 +2275,7 @@ public final class BluetoothQualityReport implements Parcelable {
})
public @interface ConnectFailId {}
- private int mFailReason;
+ private final int mFailReason;
private BqrConnectFail(byte[] rawData, int offset) {
if (rawData == null || rawData.length <= offset) {
@@ -2391,28 +2391,28 @@ public final class BluetoothQualityReport implements Parcelable {
private static final String TAG =
BluetoothQualityReport.TAG + "." + BqrEnergyMonitor.class.getSimpleName();
- private int mAvgCurrentConsume;
- private long mIdleTotalTime;
- private long mIdleStateEnterCount;
- private long mActiveTotalTime;
- private long mActiveStateEnterCount;
- private long mBredrTxTotalTime;
- private long mBredrTxStateEnterCount;
- private int mBredrTxAvgPowerLevel;
- private long mBredrRxTotalTime;
- private long mBredrRxStateEnterCount;
- private long mLeTxTotalTime;
- private long mLeTxStateEnterCount;
- private int mLeTxAvgPowerLevel;
- private long mLeRxTotalTime;
- private long mLeRxStateEnterCount;
- private long mReportTotalTime;
- private long mRxActiveOneChainTime;
- private long mRxActiveTwoChainTime;
- private long mTxiPaActiveOneChainTime;
- private long mTxiPaActiveTwoChainTime;
- private long mTxePaActiveOneChainTime;
- private long mTxePaActiveTwoChainTime;
+ private final int mAvgCurrentConsume;
+ private final long mIdleTotalTime;
+ private final long mIdleStateEnterCount;
+ private final long mActiveTotalTime;
+ private final long mActiveStateEnterCount;
+ private final long mBredrTxTotalTime;
+ private final long mBredrTxStateEnterCount;
+ private final int mBredrTxAvgPowerLevel;
+ private final long mBredrRxTotalTime;
+ private final long mBredrRxStateEnterCount;
+ private final long mLeTxTotalTime;
+ private final long mLeTxStateEnterCount;
+ private final int mLeTxAvgPowerLevel;
+ private final long mLeRxTotalTime;
+ private final long mLeRxStateEnterCount;
+ private final long mReportTotalTime;
+ private final long mRxActiveOneChainTime;
+ private final long mRxActiveTwoChainTime;
+ private final long mTxiPaActiveOneChainTime;
+ private final long mTxiPaActiveTwoChainTime;
+ private final long mTxePaActiveOneChainTime;
+ private final long mTxePaActiveTwoChainTime;
private BqrEnergyMonitor(byte[] rawData, int offset) {
if (rawData == null || rawData.length <= offset) {
@@ -2861,27 +2861,27 @@ public final class BluetoothQualityReport implements Parcelable {
private static final String TAG =
BluetoothQualityReport.TAG + "." + BqrRfStats.class.getSimpleName();
- private int mExtensionInfo;
- private long mReportTimePeriod;
- private long mTxPoweriPaBf;
- private long mTxPowerePaBf;
- private long mTxPoweriPaDiv;
- private long mTxPowerePaDiv;
- private long mRssiChainOver50;
- private long mRssiChain50To55;
- private long mRssiChain55To60;
- private long mRssiChain60To65;
- private long mRssiChain65To70;
- private long mRssiChain70To75;
- private long mRssiChain75To80;
- private long mRssiChain80To85;
- private long mRssiChain85To90;
- private long mRssiChainUnder90;
- private long mRssiDeltaUnder2;
- private long mRssiDelta2To5;
- private long mRssiDelta5To8;
- private long mRssiDelta8To11;
- private long mRssiDeltaOver11;
+ private final int mExtensionInfo;
+ private final long mReportTimePeriod;
+ private final long mTxPoweriPaBf;
+ private final long mTxPowerePaBf;
+ private final long mTxPoweriPaDiv;
+ private final long mTxPowerePaDiv;
+ private final long mRssiChainOver50;
+ private final long mRssiChain50To55;
+ private final long mRssiChain55To60;
+ private final long mRssiChain60To65;
+ private final long mRssiChain65To70;
+ private final long mRssiChain70To75;
+ private final long mRssiChain75To80;
+ private final long mRssiChain80To85;
+ private final long mRssiChain85To90;
+ private final long mRssiChainUnder90;
+ private final long mRssiDeltaUnder2;
+ private final long mRssiDelta2To5;
+ private final long mRssiDelta5To8;
+ private final long mRssiDelta8To11;
+ private final long mRssiDeltaOver11;
private BqrRfStats(byte[] rawData, int offset) {
if (rawData == null || rawData.length <= offset) {
diff --git a/framework/java/android/bluetooth/BluetoothSap.java b/framework/java/android/bluetooth/BluetoothSap.java
index 5ec412cb39..5894c4f197 100644
--- a/framework/java/android/bluetooth/BluetoothSap.java
+++ b/framework/java/android/bluetooth/BluetoothSap.java
@@ -65,7 +65,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable {
private static final boolean DBG = true;
private static final boolean VDBG = false;
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
/**
* Intent used to broadcast the change in connection state of the profile.
diff --git a/framework/java/android/bluetooth/BluetoothServerSocket.java b/framework/java/android/bluetooth/BluetoothServerSocket.java
index e25805437a..832e48aa3b 100644
--- a/framework/java/android/bluetooth/BluetoothServerSocket.java
+++ b/framework/java/android/bluetooth/BluetoothServerSocket.java
@@ -85,7 +85,7 @@ public final class BluetoothServerSocket implements Closeable {
// BluetoothSocket.getConnectionType() will hide L2CAP_LE.
// Therefore a new variable need to be maintained here.
- private int mType;
+ private final int mType;
/**
* Construct a socket for incoming connections.
diff --git a/framework/java/android/bluetooth/BluetoothSocketSettings.java b/framework/java/android/bluetooth/BluetoothSocketSettings.java
index b7706d50fe..3f222d4717 100644
--- a/framework/java/android/bluetooth/BluetoothSocketSettings.java
+++ b/framework/java/android/bluetooth/BluetoothSocketSettings.java
@@ -108,22 +108,22 @@ public final class BluetoothSocketSettings {
private static final long INVALID_ENDPOINT_ID = 0;
/** Type of the Bluetooth socket */
- @SocketType private int mSocketType;
+ @SocketType private final int mSocketType;
/** Encryption requirement for the Bluetooth socket. */
- private boolean mEncryptionRequired;
+ private final boolean mEncryptionRequired;
/** Authentication requirement for the Bluetooth socket. */
- private boolean mAuthenticationRequired;
+ private final boolean mAuthenticationRequired;
/** L2CAP Protocol/Service Multiplexer (PSM) for the Bluetooth Socket. */
- private int mL2capPsm;
+ private final int mL2capPsm;
/** RFCOMM service name associated with the Bluetooth socket. */
- private String mRfcommServiceName;
+ private final String mRfcommServiceName;
/** RFCOMM service UUID associated with the Bluetooth socket. */
- private UUID mRfcommUuid;
+ private final UUID mRfcommUuid;
/**
* Specifies the data path used for this socket, influencing how data is transmitted and
@@ -137,7 +137,7 @@ public final class BluetoothSocketSettings {
* an offloaded application running on a dedicated low-power processor.
* </ul>
*/
- @SocketDataPath private int mDataPath;
+ private final @SocketDataPath int mDataPath;
/**
* A user-friendly name for this socket, primarily for debugging and logging. This name should
@@ -147,7 +147,7 @@ public final class BluetoothSocketSettings {
* application running on the low-power processor. This allows the offloaded application to
* identify and manage the socket.
*/
- private String mSocketName;
+ private final String mSocketName;
/**
* When using {@link #DATA_PATH_HARDWARE_OFFLOAD}, this identifies the hub hosting the endpoint.
@@ -155,19 +155,19 @@ public final class BluetoothSocketSettings {
* <p>Hub represents a logical/physical representation of multiple endpoints. A pair of {@code
* mHubId} and {@code mEndpointId} uniquely identifies the endpoint globally.
*/
- private long mHubId;
+ private final long mHubId;
/**
* When using {@link #DATA_PATH_HARDWARE_OFFLOAD}, this identifies the specific endpoint within
* the hub that is associated with this socket.
*/
- private long mEndpointId;
+ private final long mEndpointId;
/**
* The maximum size (in bytes) of a single data packet that can be received from the endpoint
* when using {@link #DATA_PATH_HARDWARE_OFFLOAD}.
*/
- private int mMaximumPacketSize;
+ private final int mMaximumPacketSize;
/**
* Returns the type of the Bluetooth socket.
diff --git a/framework/java/android/bluetooth/BluetoothVolumeControl.java b/framework/java/android/bluetooth/BluetoothVolumeControl.java
index 1cf3cedeba..e8c8446e69 100644
--- a/framework/java/android/bluetooth/BluetoothVolumeControl.java
+++ b/framework/java/android/bluetooth/BluetoothVolumeControl.java
@@ -69,7 +69,7 @@ import java.util.function.Consumer;
public final class BluetoothVolumeControl implements BluetoothProfile, AutoCloseable {
private static final String TAG = BluetoothVolumeControl.class.getSimpleName();
- private CloseGuard mCloseGuard;
+ private final CloseGuard mCloseGuard;
@GuardedBy("mCallbackExecutorMap")
private final Map<Callback, Executor> mCallbackExecutorMap = new HashMap<>();
@@ -246,7 +246,7 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose
public static final String ACTION_CONNECTION_STATE_CHANGED =
"android.bluetooth.volume-control.profile.action.CONNECTION_STATE_CHANGED";
- private BluetoothAdapter mAdapter;
+ private final BluetoothAdapter mAdapter;
private final AttributionSource mAttributionSource;
private IBluetoothVolumeControl mService;
diff --git a/framework/java/android/bluetooth/BufferConstraint.java b/framework/java/android/bluetooth/BufferConstraint.java
index 936b17dd6c..bd4eb739ae 100644
--- a/framework/java/android/bluetooth/BufferConstraint.java
+++ b/framework/java/android/bluetooth/BufferConstraint.java
@@ -30,9 +30,9 @@ import android.os.Parcelable;
public final class BufferConstraint implements Parcelable {
private static final String TAG = BufferConstraint.class.getSimpleName();
- private int mDefaultMillis;
- private int mMaxMillis;
- private int mMinMillis;
+ private final int mDefaultMillis;
+ private final int mMaxMillis;
+ private final int mMinMillis;
public BufferConstraint(int defaultMillis, int maxMillis, int minMillis) {
mDefaultMillis = defaultMillis;
diff --git a/framework/java/android/bluetooth/BufferConstraints.java b/framework/java/android/bluetooth/BufferConstraints.java
index c8a1157849..152976a0e3 100644
--- a/framework/java/android/bluetooth/BufferConstraints.java
+++ b/framework/java/android/bluetooth/BufferConstraints.java
@@ -38,8 +38,8 @@ public final class BufferConstraints implements Parcelable {
public static final int BUFFER_CODEC_MAX_NUM = 32;
- private Map<Integer, BufferConstraint> mBufferConstraints;
- private List<BufferConstraint> mBufferConstraintList;
+ private final Map<Integer, BufferConstraint> mBufferConstraints;
+ private final List<BufferConstraint> mBufferConstraintList;
public BufferConstraints(@NonNull List<BufferConstraint> bufferConstraintList) {
diff --git a/framework/java/android/bluetooth/OobData.java b/framework/java/android/bluetooth/OobData.java
index 48b107c7c0..94cdcdeb9f 100644
--- a/framework/java/android/bluetooth/OobData.java
+++ b/framework/java/android/bluetooth/OobData.java
@@ -231,7 +231,7 @@ public final class OobData implements Parcelable {
*
* <p>Used for visual on discovering device to represent icon/string/etc...
*/
- private byte[] mLeAppearance = null;
+ private final byte[] mLeAppearance = null;
/**
* Contains which discoverable mode to use, BR/EDR support and capability.
diff --git a/framework/java/android/bluetooth/le/AdvertiseData.java b/framework/java/android/bluetooth/le/AdvertiseData.java
index 99335d35d7..6c313d8a71 100644
--- a/framework/java/android/bluetooth/le/AdvertiseData.java
+++ b/framework/java/android/bluetooth/le/AdvertiseData.java
@@ -247,15 +247,14 @@ public final class AdvertiseData implements Parcelable {
/** Builder for {@link AdvertiseData}. */
public static final class Builder {
- @Nullable private List<ParcelUuid> mServiceUuids = new ArrayList<ParcelUuid>();
- @NonNull private List<ParcelUuid> mServiceSolicitationUuids = new ArrayList<ParcelUuid>();
+ private final List<ParcelUuid> mServiceUuids = new ArrayList<ParcelUuid>();
+ private final List<ParcelUuid> mServiceSolicitationUuids = new ArrayList<ParcelUuid>();
- @Nullable
- private List<TransportDiscoveryData> mTransportDiscoveryData =
+ private final List<TransportDiscoveryData> mTransportDiscoveryData =
new ArrayList<TransportDiscoveryData>();
- private SparseArray<byte[]> mManufacturerSpecificData = new SparseArray<byte[]>();
- private Map<ParcelUuid, byte[]> mServiceData = new ArrayMap<ParcelUuid, byte[]>();
+ private final SparseArray<byte[]> mManufacturerSpecificData = new SparseArray<byte[]>();
+ private final Map<ParcelUuid, byte[]> mServiceData = new ArrayMap<ParcelUuid, byte[]>();
private boolean mIncludeTxPowerLevel;
private boolean mIncludeDeviceName;
diff --git a/framework/java/android/bluetooth/le/AdvertisingSet.java b/framework/java/android/bluetooth/le/AdvertisingSet.java
index 2c2fce52e3..dcb5c29740 100644
--- a/framework/java/android/bluetooth/le/AdvertisingSet.java
+++ b/framework/java/android/bluetooth/le/AdvertisingSet.java
@@ -45,7 +45,7 @@ public final class AdvertisingSet {
private final IBluetoothAdvertise mAdvertise;
private int mAdvertiserId;
- private AttributionSource mAttributionSource;
+ private final AttributionSource mAttributionSource;
AdvertisingSet(
IBluetoothAdvertise advertise,
diff --git a/framework/java/android/bluetooth/le/ChannelSoundingParams.java b/framework/java/android/bluetooth/le/ChannelSoundingParams.java
index b6c9529562..cbaa01d0fb 100644
--- a/framework/java/android/bluetooth/le/ChannelSoundingParams.java
+++ b/framework/java/android/bluetooth/le/ChannelSoundingParams.java
@@ -146,9 +146,9 @@ public final class ChannelSoundingParams implements Parcelable {
*/
@SystemApi public static final int CS_SECURITY_LEVEL_FOUR = 4;
- private int mSightType;
- private int mLocationType;
- private int mCsSecurityLevel;
+ private final int mSightType;
+ private final int mLocationType;
+ private final int mCsSecurityLevel;
/** @hide */
public ChannelSoundingParams(int sightType, int locationType, int csSecurityLevel) {
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java b/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java
index eb4032057d..0d9f187889 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java
@@ -207,7 +207,7 @@ public final class DistanceMeasurementMethod implements Parcelable {
*/
@SystemApi
public static final class Builder {
- private int mId;
+ private final int mId;
private boolean mIsAzimuthAngleSupported = false;
private boolean mIsAltitudeAngleSupported = false;
diff --git a/framework/java/android/bluetooth/le/ScanSettings.java b/framework/java/android/bluetooth/le/ScanSettings.java
index e78f46c8d4..9d7f7f2b73 100644
--- a/framework/java/android/bluetooth/le/ScanSettings.java
+++ b/framework/java/android/bluetooth/le/ScanSettings.java
@@ -177,25 +177,25 @@ public final class ScanSettings implements Parcelable {
static final long CHANGE_DEFAULT_TRACKABLE_ADV_NUMBER = 386727721L;
// Bluetooth LE scan mode.
- private int mScanMode;
+ private final int mScanMode;
// Bluetooth LE scan callback type.
- private int mCallbackType;
+ private final int mCallbackType;
// Bluetooth LE scan result type.
- private int mScanResultType;
+ private final int mScanResultType;
// Time of delay for reporting the scan result.
- private long mReportDelayMillis;
+ private final long mReportDelayMillis;
- private int mMatchMode;
+ private final int mMatchMode;
- private int mNumOfMatchesPerFilter;
+ private final int mNumOfMatchesPerFilter;
// Include only legacy advertising results.
- private boolean mLegacy;
+ private final boolean mLegacy;
- private int mPhy;
+ private final int mPhy;
public int getScanMode() {
return mScanMode;