summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author William Escande <wescande@google.com> 2025-02-20 18:21:32 -0800
committer William Escande <wescande@google.com> 2025-02-24 14:19:48 -0800
commit0f45ca0eec3bfef25bcee3fc2b1555a06fa67849 (patch)
tree50e354cf75092216f6ebd641c0dadc7f2d53b25a
parente130ea7295c14fb40cca59c1d99fa8d1e32e2745 (diff)
Errorprone fix & enforce MethodCanBeStatic
Bug: 344658662 Test: m BluetoothInstrumentationTests Test: m . Flag: Exempt refactor Change-Id: Ibde1dabbb1ba64cd278e9607e29dec04e70b1bb9
-rw-r--r--Android.bp2
-rw-r--r--android/app/jni/com_android_bluetooth_le_audio.cpp10
-rw-r--r--android/app/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java2
-rw-r--r--android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java2
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/AvrcpBipObexServer.java8
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtService.java4
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorage.java4
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java2
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/helpers/CoverArt.java8
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java6
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java6
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProvider.java4
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorage.java2
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java2
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageProperties.java2
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformation.java2
-rw-r--r--android/app/src/com/android/bluetooth/bass_client/BassClientService.java25
-rw-r--r--android/app/src/com/android/bluetooth/bass_client/BassClientStateMachine.java6
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterProperties.java8
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterService.java18
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterState.java4
-rw-r--r--android/app/src/com/android/bluetooth/btservice/BluetoothQualityReportNativeInterface.java19
-rw-r--r--android/app/src/com/android/bluetooth/btservice/BondStateMachine.java10
-rw-r--r--android/app/src/com/android/bluetooth/btservice/MetricsLogger.java6
-rw-r--r--android/app/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java6
-rw-r--r--android/app/src/com/android/bluetooth/btservice/storage/AudioPolicyEntity.java2
-rw-r--r--android/app/src/com/android/bluetooth/btservice/storage/CustomizedMetadataEntity.java2
-rw-r--r--android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorNativeInterface.java4
-rw-r--r--android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java2
-rw-r--r--android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java2
-rw-r--r--android/app/src/com/android/bluetooth/gatt/AppAdvertiseStats.java6
-rw-r--r--android/app/src/com/android/bluetooth/gatt/DistanceMeasurementManager.java6
-rw-r--r--android/app/src/com/android/bluetooth/gatt/DistanceMeasurementNativeInterface.java2
-rw-r--r--android/app/src/com/android/bluetooth/gatt/GattService.java14
-rw-r--r--android/app/src/com/android/bluetooth/hap/HapClientNativeInterface.java2
-rw-r--r--android/app/src/com/android/bluetooth/hap/HapClientService.java4
-rw-r--r--android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java14
-rw-r--r--android/app/src/com/android/bluetooth/hfp/AtPhonebook.java2
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java4
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetService.java2
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetSystemInterface.java2
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java2
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/HeadsetClientServiceInterface.java2
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java6
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/HfpClientConnectionService.java2
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/HfpClientDeviceBlock.java2
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessor.java2
-rw-r--r--android/app/src/com/android/bluetooth/hid/HidHostService.java2
-rw-r--r--android/app/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface.java2
-rw-r--r--android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java6
-rw-r--r--android/app/src/com/android/bluetooth/le_audio/LeAudioService.java5
-rw-r--r--android/app/src/com/android/bluetooth/le_scan/AppScanStats.java4
-rw-r--r--android/app/src/com/android/bluetooth/le_scan/MsftAdvMonitor.java2
-rw-r--r--android/app/src/com/android/bluetooth/le_scan/ScanController.java8
-rw-r--r--android/app/src/com/android/bluetooth/le_scan/ScanFilterQueue.java3
-rw-r--r--android/app/src/com/android/bluetooth/le_scan/ScanManager.java36
-rw-r--r--android/app/src/com/android/bluetooth/map/BluetoothMapContent.java61
-rw-r--r--android/app/src/com/android/bluetooth/map/BluetoothMapObexServer.java6
-rw-r--r--android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java2
-rw-r--r--android/app/src/com/android/bluetooth/map/BluetoothMapbMessageMime.java2
-rw-r--r--android/app/src/com/android/bluetooth/map/BluetoothMnsObexClient.java8
-rw-r--r--android/app/src/com/android/bluetooth/mapclient/MapClientContent.java8
-rw-r--r--android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java8
-rw-r--r--android/app/src/com/android/bluetooth/mapclient/obex/BmessageBuilder.java2
-rw-r--r--android/app/src/com/android/bluetooth/mapclient/obex/EventReport.java4
-rw-r--r--android/app/src/com/android/bluetooth/mapclient/obex/Message.java6
-rw-r--r--android/app/src/com/android/bluetooth/mapclient/obex/RequestGetMessagesListingForOwnNumber.java2
-rw-r--r--android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java4
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java4
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java2
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java2
-rw-r--r--android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java2
-rw-r--r--android/app/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java6
-rw-r--r--android/app/src/com/android/bluetooth/pbapclient/PbapClientContactsStorage.java4
-rw-r--r--android/app/src/com/android/bluetooth/pbapclient/obex/PbapPhonebook.java4
-rw-r--r--android/app/src/com/android/bluetooth/sap/SapRilReceiverHidl.java2
-rw-r--r--android/app/src/com/android/bluetooth/tbs/TbsGeneric.java2
-rw-r--r--android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java4
-rw-r--r--android/app/src/com/android/bluetooth/vc/VolumeControlNativeInterface.java2
-rw-r--r--android/app/src/com/android/bluetooth/vc/VolumeControlService.java4
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java4
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java4
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java8
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java6
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java5
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java4
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java16
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java20
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java5
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java8
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java9
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java13
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java4
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java9
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java6
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java11
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java4
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java4
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/BatchScanThrottlerTest.java9
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanFilterQueueTest.java5
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanManagerTest.java17
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java7
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/CallLogPullRequestTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java6
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java4
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sdp/DipTest.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothA2dp.java3
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java7
-rw-r--r--framework/java/android/bluetooth/BluetoothGattCharacteristic.java16
-rw-r--r--framework/java/android/bluetooth/BluetoothHapClient.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothHearingAid.java4
-rw-r--r--framework/java/android/bluetooth/BluetoothHidDevice.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudio.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java4
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudioCodecStatus.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcast.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothPbap.java2
-rw-r--r--framework/java/android/bluetooth/BluetoothSocket.java6
-rw-r--r--framework/java/android/bluetooth/OobData.java9
-rw-r--r--framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java4
-rw-r--r--framework/java/android/bluetooth/le/BluetoothLeScanner.java2
-rw-r--r--framework/java/android/bluetooth/le/ScanSettings.java2
-rw-r--r--service/src/com/android/server/bluetooth/BluetoothManagerService.java12
-rw-r--r--service/tests/src/com/android/server/bluetooth/BluetoothServiceBinderTest.java2
144 files changed, 403 insertions, 385 deletions
diff --git a/Android.bp b/Android.bp
index 3ea90eb91b..e1e9a5041d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -137,6 +137,7 @@ java_defaults {
"-Xep:EqualsIncompatibleType:ERROR",
"-Xep:FallThrough:ERROR",
"-Xep:Finalize:ERROR",
+ "-Xep:ForEachIterable:ERROR",
"-Xep:FutureReturnValueIgnored:ERROR",
"-Xep:GuardedBy:ERROR",
"-Xep:HidingField:ERROR",
@@ -151,6 +152,7 @@ java_defaults {
"-Xep:LockOnNonEnclosingClassLiteral:ERROR",
"-Xep:LongFloatConversion:ERROR",
"-Xep:LoopOverCharArray:ERROR",
+ "-Xep:MethodCanBeStatic:ERROR",
"-Xep:MissingCasesInEnumSwitch:ERROR",
"-Xep:MixedMutabilityReturnType:ERROR",
"-Xep:MockNotUsedInProduction:ERROR",
diff --git a/android/app/jni/com_android_bluetooth_le_audio.cpp b/android/app/jni/com_android_bluetooth_le_audio.cpp
index 3a3d8ceed6..3b0411135c 100644
--- a/android/app/jni/com_android_bluetooth_le_audio.cpp
+++ b/android/app/jni/com_android_bluetooth_le_audio.cpp
@@ -130,6 +130,8 @@ static std::shared_timed_mutex interface_mutex;
static jobject mCallbacksObj = nullptr;
static std::shared_timed_mutex callbacks_mutex;
+static jclass class_LeAudioNativeInterface;
+
jobject prepareCodecConfigObj(JNIEnv* env, btle_audio_codec_config_t codecConfig) {
log::info(
"ct: {}, codec_priority: {}, sample_rate: {}, bits_per_sample: {}, "
@@ -174,7 +176,7 @@ public:
if (!sCallbackEnv.valid() || mCallbacksObj == nullptr) {
return;
}
- sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onInitialized);
+ sCallbackEnv->CallStaticVoidMethod(class_LeAudioNativeInterface, method_onInitialized);
}
void OnConnectionState(ConnectionState state, const RawAddress& bd_addr) override {
@@ -430,6 +432,10 @@ static void initNative(JNIEnv* env, jobject object, jobjectArray codecOffloading
return;
}
+ jclass tmpControllerInterface =
+ env->FindClass("com/android/bluetooth/le_audio/LeAudioNativeInterface");
+ class_LeAudioNativeInterface = (jclass)env->NewGlobalRef(tmpControllerInterface);
+
if (mCallbacksObj != nullptr) {
log::info("Cleaning up LeAudio callback object");
env->DeleteGlobalRef(mCallbacksObj);
@@ -1573,7 +1579,7 @@ int register_com_android_bluetooth_le_audio(JNIEnv* env) {
{"onGroupNodeStatus", "([BII)V", &method_onGroupNodeStatus},
{"onAudioConf", "(IIIII)V", &method_onAudioConf},
{"onSinkAudioLocationAvailable", "([BI)V", &method_onSinkAudioLocationAvailable},
- {"onInitialized", "()V", &method_onInitialized},
+ {"onInitialized", "()V", &method_onInitialized, true},
{"onConnectionStateChanged", "(I[B)V", &method_onConnectionStateChanged},
{"onAudioLocalCodecCapabilities",
"([Landroid/bluetooth/BluetoothLeAudioCodecConfig;"
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java b/android/app/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java
index 6c7d53c8e6..31549ea3fd 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java
@@ -168,7 +168,7 @@ class A2dpCodecConfig {
}
// Get the codec type of the highest priority of selectableCodecs and codecConfig.
- private int getPrioitizedCodecType(
+ private static int getPrioitizedCodecType(
BluetoothCodecConfig codecConfig, List<BluetoothCodecConfig> selectableCodecs) {
BluetoothCodecConfig prioritizedCodecConfig = codecConfig;
for (BluetoothCodecConfig config : selectableCodecs) {
diff --git a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
index 75350f949b..e26624b614 100644
--- a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
@@ -138,7 +138,7 @@ public class A2dpSinkNativeInterface {
}
/** Send a stack event up to the A2DP Sink Service */
- private void sendMessageToService(StackEvent event) {
+ private static void sendMessageToService(StackEvent event) {
A2dpSinkService service = A2dpSinkService.getA2dpSinkService();
if (service != null) {
service.messageFromNative(event);
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpBipObexServer.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpBipObexServer.java
index 9e76df75c3..3ab495fdb0 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpBipObexServer.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpBipObexServer.java
@@ -178,7 +178,7 @@ public class AvrcpBipObexServer extends ServerRequestHandler {
*
* @return True if the image handle is valid, false otherwise.
*/
- private boolean isImageHandleValid(String handle) {
+ private static boolean isImageHandleValid(String handle) {
if (handle == null || handle.length() != 7) return false;
for (int i = 0; i < 7; i++) {
char c = handle.charAt(i);
@@ -305,7 +305,7 @@ public class AvrcpBipObexServer extends ServerRequestHandler {
}
/** Send a response to the given operation using the given headers and bytes. */
- private int sendResponse(Operation op, HeaderSet replyHeaders, byte[] bytes) {
+ private static int sendResponse(Operation op, HeaderSet replyHeaders, byte[] bytes) {
if (op != null && bytes != null && replyHeaders != null) {
OutputStream outStream = null;
int maxChunkSize = 0;
@@ -344,11 +344,11 @@ public class AvrcpBipObexServer extends ServerRequestHandler {
return ResponseCodes.OBEX_HTTP_NOT_FOUND;
}
- private void warn(String msg) {
+ private static void warn(String msg) {
Log.w(TAG, msg);
}
- private void debug(String msg) {
+ private static void debug(String msg) {
Log.d(TAG, msg);
}
}
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtService.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtService.java
index 46805f404c..232bdfa56a 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtService.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtService.java
@@ -273,12 +273,12 @@ public class AvrcpCoverArtService {
}
/** Print a message to DEBUG if debug output is enabled */
- private void debug(String msg) {
+ private static void debug(String msg) {
Log.d(TAG, msg);
}
/** Print a message to ERROR */
- private void error(String msg) {
+ private static void error(String msg) {
Log.e(TAG, msg);
}
}
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorage.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorage.java
index 1ad024ab80..cd97e9970c 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorage.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorage.java
@@ -182,12 +182,12 @@ final class AvrcpCoverArtStorage {
}
/** Print a message to DEBUG if debug output is enabled */
- private void debug(String msg) {
+ private static void debug(String msg) {
Log.d(TAG, msg);
}
/** Print a message to ERROR */
- private void error(String msg) {
+ private static void error(String msg) {
Log.e(TAG, msg);
}
}
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java
index 2436bc6bb4..559578dc71 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java
@@ -294,7 +294,7 @@ public class AvrcpTargetService extends ProfileService {
* <p>This will be called by the native stack when a play event is received from a remote
* device. See packages/modules/Bluetooth/system/profile/avrcp/device.cc.
*/
- private void setA2dpActiveDevice(@NonNull BluetoothDevice device) {
+ private static void setA2dpActiveDevice(@NonNull BluetoothDevice device) {
A2dpService service = A2dpService.getA2dpService();
if (service == null) {
Log.d(TAG, "setA2dpActiveDevice: A2dp service not found");
diff --git a/android/app/src/com/android/bluetooth/avrcp/helpers/CoverArt.java b/android/app/src/com/android/bluetooth/avrcp/helpers/CoverArt.java
index dd720077a0..d2e34c64ac 100644
--- a/android/app/src/com/android/bluetooth/avrcp/helpers/CoverArt.java
+++ b/android/app/src/com/android/bluetooth/avrcp/helpers/CoverArt.java
@@ -77,7 +77,7 @@ public class CoverArt {
}
/** Covert a Bitmap to a byte array with an image format without lossy compression */
- private byte[] toByteArray(Bitmap bitmap) {
+ private static byte[] toByteArray(Bitmap bitmap) {
if (bitmap == null) return null;
ByteArrayOutputStream buffer =
new ByteArrayOutputStream(bitmap.getWidth() * bitmap.getHeight());
@@ -131,7 +131,7 @@ public class CoverArt {
}
/** Determine if a given image descriptor is valid */
- private boolean isDescriptorValid(BipImageDescriptor descriptor) {
+ private static boolean isDescriptorValid(BipImageDescriptor descriptor) {
debug("isDescriptorValid(descriptor=" + descriptor + ")");
if (descriptor == null) return false;
@@ -196,12 +196,12 @@ public class CoverArt {
}
/** Print a message to DEBUG if debug output is enabled */
- private void debug(String msg) {
+ private static void debug(String msg) {
Log.d(TAG, msg);
}
/** Print a message to ERROR */
- private void error(String msg) {
+ private static void error(String msg) {
Log.e(TAG, msg);
}
}
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java
index 5679c916d7..8d8690a4bb 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java
@@ -802,7 +802,7 @@ class AvrcpControllerStateMachine extends StateMachine {
}
}
- private boolean isHoldableKey(int cmd) {
+ private static boolean isHoldableKey(int cmd) {
return (cmd == AvrcpControllerService.PASS_THRU_CMD_ID_REWIND)
|| (cmd == AvrcpControllerService.PASS_THRU_CMD_ID_FF);
}
@@ -1051,7 +1051,7 @@ class AvrcpControllerStateMachine extends StateMachine {
* @return true: a new folder in the same scope a new player while fetching contents of a
* folder false: other cases, specifically Now Playing while fetching a folder
*/
- private boolean shouldAbort(int currentScope, int fetchScope) {
+ private static boolean shouldAbort(int currentScope, int fetchScope) {
if ((currentScope == fetchScope)
|| (currentScope == AvrcpControllerService.BROWSE_SCOPE_VFS
&& fetchScope == AvrcpControllerService.BROWSE_SCOPE_PLAYER_LIST)) {
@@ -1276,7 +1276,7 @@ class AvrcpControllerStateMachine extends StateMachine {
}
}
- private int getFocusState() {
+ private static int getFocusState() {
int focusState = AudioManager.ERROR;
A2dpSinkService a2dpSinkService = A2dpSinkService.getA2dpSinkService();
if (a2dpSinkService != null) {
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java
index a48b2d5ea2..eac5f2644b 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java
@@ -501,17 +501,17 @@ public class AvrcpCoverArtManager {
}
/** Print to debug if debug is enabled for this class */
- private void debug(String msg) {
+ private static void debug(String msg) {
Log.d(TAG, msg);
}
/** Print to warn */
- private void warn(String msg) {
+ private static void warn(String msg) {
Log.w(TAG, msg);
}
/** Print to error */
- private void error(String msg) {
+ private static void error(String msg) {
Log.e(TAG, msg);
}
}
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProvider.java b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProvider.java
index 71728e29db..d3c97b8cb1 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProvider.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProvider.java
@@ -74,7 +74,7 @@ public class AvrcpCoverArtProvider extends ContentProvider {
return uri;
}
- private Bitmap getImage(BluetoothDevice device, String imageUuid) {
+ private static Bitmap getImage(BluetoothDevice device, String imageUuid) {
AvrcpControllerService service = AvrcpControllerService.getAvrcpControllerService();
if (service == null) {
debug("Failed to get service, cover art not available");
@@ -89,7 +89,7 @@ public class AvrcpCoverArtProvider extends ContentProvider {
return manager.getImage(device, imageUuid);
}
- private ParcelFileDescriptor getImageDescriptor(BluetoothDevice device, String imageUuid)
+ private static ParcelFileDescriptor getImageDescriptor(BluetoothDevice device, String imageUuid)
throws FileNotFoundException, IOException {
debug("getImageDescriptor(" + device + ", " + imageUuid + ")");
Bitmap image = getImage(device, imageUuid);
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorage.java b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorage.java
index ff9e69cc4d..a188eb5494 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorage.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorage.java
@@ -157,7 +157,7 @@ public class AvrcpCoverArtStorage {
return sb.toString();
}
- private void debug(String msg) {
+ private static void debug(String msg) {
Log.d(TAG, msg);
}
}
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java b/android/app/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java
index 5fa4852246..8c498f6a7b 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java
@@ -262,7 +262,7 @@ public class BluetoothMediaBrowserService extends MediaBrowserServiceCompat {
mSession.setPlaybackState(errorState);
}
- private Bundle getDefaultStyle() {
+ private static Bundle getDefaultStyle() {
Bundle style = new Bundle();
style.putBoolean(CONTENT_STYLE_SUPPORTED, true);
style.putInt(CONTENT_STYLE_BROWSABLE_HINT, CONTENT_STYLE_GRID_ITEM_HINT_VALUE);
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageProperties.java b/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageProperties.java
index 801dcc99d8..7e389ff45f 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageProperties.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageProperties.java
@@ -278,7 +278,7 @@ public class BipImageProperties {
}
}
- private boolean isThumbnailFormat(BipImageFormat format) {
+ private static boolean isThumbnailFormat(BipImageFormat format) {
if (format == null) return false;
BipEncoding encoding = format.getEncoding();
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformation.java b/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformation.java
index 44cae25780..2e2818d97b 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformation.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformation.java
@@ -122,7 +122,7 @@ public class BipTransformation {
* BipTransformation.* constants, but doesn't *have* to be
* @return True if the transformation constant is valid, False otherwise
*/
- private boolean isValid(int transformation) {
+ private static boolean isValid(int transformation) {
return transformation >= STRETCH && transformation <= CROP;
}
diff --git a/android/app/src/com/android/bluetooth/bass_client/BassClientService.java b/android/app/src/com/android/bluetooth/bass_client/BassClientService.java
index 7120aad9f0..c84ec49689 100644
--- a/android/app/src/com/android/bluetooth/bass_client/BassClientService.java
+++ b/android/app/src/com/android/bluetooth/bass_client/BassClientService.java
@@ -494,7 +494,7 @@ public class BassClientService extends ProfileService {
}
@SuppressLint("NewApi") // Api is protected by flag check and the lint is wrong
- private boolean hasAnyMessagesOrCallbacks(Handler handler) {
+ private static boolean hasAnyMessagesOrCallbacks(Handler handler) {
if (android.os.Flags.mainlineVcnPlatformApi()) {
return handler.hasMessagesOrCallbacks();
} else {
@@ -885,7 +885,7 @@ public class BassClientService extends ProfileService {
});
}
- private boolean isSuccess(int status) {
+ private static boolean isSuccess(int status) {
boolean ret = false;
switch (status) {
case BluetoothStatusCodes.REASON_LOCAL_APP_REQUEST:
@@ -979,13 +979,13 @@ public class BassClientService extends ProfileService {
}
}
- private boolean removeMatchingOperation(
+ private static boolean removeMatchingOperation(
List<Pair<Integer, Object>> operations, int reqMsg, Object obj) {
return operations.removeIf(
m -> m.first.equals(reqMsg) && isMatchingOperation(m.second, obj));
}
- private boolean isMatchingOperation(Object operationData, Object obj) {
+ private static boolean isMatchingOperation(Object operationData, Object obj) {
if (obj instanceof BluetoothLeBroadcastReceiveState) {
return ((BluetoothLeBroadcastMetadata) operationData).getBroadcastId()
== ((BluetoothLeBroadcastReceiveState) obj).getBroadcastId();
@@ -1008,7 +1008,7 @@ public class BassClientService extends ProfileService {
&& (leAudioService.getActiveDevices().contains(device));
}
- private boolean isEmptyBluetoothDevice(BluetoothDevice device) {
+ private static boolean isEmptyBluetoothDevice(BluetoothDevice device) {
if (device == null) {
Log.e(TAG, "Device is null!");
return true;
@@ -4390,7 +4390,7 @@ public class BassClientService extends ProfileService {
return false;
}
- private boolean isReceiverActive(BluetoothLeBroadcastReceiveState receiveState) {
+ private static boolean isReceiverActive(BluetoothLeBroadcastReceiveState receiveState) {
if (receiveState.getPaSyncState()
== BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_SYNCHRONIZED) {
return true;
@@ -4446,7 +4446,9 @@ public class BassClientService extends ProfileService {
.anyMatch(
receiveState ->
(receiveState.getBisSyncState().stream()
- .anyMatch(this::isSyncedToBroadcastStream)))) {
+ .anyMatch(
+ BassClientService
+ ::isSyncedToBroadcastStream)))) {
activeSinks.add(device);
}
}
@@ -4464,7 +4466,7 @@ public class BassClientService extends ProfileService {
.collect(Collectors.toUnmodifiableList());
}
- private boolean isSyncedToBroadcastStream(Long syncState) {
+ private static boolean isSyncedToBroadcastStream(Long syncState) {
return syncState != BassConstants.BCAST_RCVR_STATE_BIS_SYNC_NOT_SYNC_TO_BIS
&& syncState != BassConstants.BCAST_RCVR_STATE_BIS_SYNC_FAILED_SYNC_TO_BIG;
}
@@ -4576,7 +4578,7 @@ public class BassClientService extends ProfileService {
}
}
- private void checkForPendingGroupOpRequest(Message msg) {
+ private static void checkForPendingGroupOpRequest(Message msg) {
if (sService == null) {
Log.e(TAG, "Service is null");
return;
@@ -4607,7 +4609,7 @@ public class BassClientService extends ProfileService {
}
}
- private boolean handleServiceInternalMessage(Message msg) {
+ private static boolean handleServiceInternalMessage(Message msg) {
boolean isMsgHandled = false;
if (sService == null) {
Log.e(TAG, "Service is null");
@@ -4666,7 +4668,8 @@ public class BassClientService extends ProfileService {
}
}
- private void invokeCallback(IBluetoothLeBroadcastAssistantCallback callback, Message msg)
+ private static void invokeCallback(
+ IBluetoothLeBroadcastAssistantCallback callback, Message msg)
throws RemoteException {
final int reason = msg.arg1;
final int sourceId = msg.arg2;
diff --git a/android/app/src/com/android/bluetooth/bass_client/BassClientStateMachine.java b/android/app/src/com/android/bluetooth/bass_client/BassClientStateMachine.java
index 67f8b6afc2..24af973437 100644
--- a/android/app/src/com/android/bluetooth/bass_client/BassClientStateMachine.java
+++ b/android/app/src/com/android/bluetooth/bass_client/BassClientStateMachine.java
@@ -610,13 +610,13 @@ class BassClientStateMachine extends StateMachine {
mBroadcastSyncStats.clear();
}
- private boolean isSourceAbsent(BluetoothLeBroadcastReceiveState recvState) {
+ private static boolean isSourceAbsent(BluetoothLeBroadcastReceiveState recvState) {
return recvState == null
|| recvState.getSourceDevice() == null
|| recvState.getSourceDevice().getAddress().equals("00:00:00:00:00:00");
}
- private boolean isSourcePresent(BluetoothLeBroadcastReceiveState recvState) {
+ private static boolean isSourcePresent(BluetoothLeBroadcastReceiveState recvState) {
return !isSourceAbsent(recvState);
}
@@ -2050,7 +2050,7 @@ class BassClientStateMachine extends StateMachine {
}
}
- private boolean isSuccess(int status) {
+ private static boolean isSuccess(int status) {
boolean ret = false;
switch (status) {
case BluetoothStatusCodes.REASON_LOCAL_APP_REQUEST:
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
index b99debdede..963ff62337 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
@@ -667,9 +667,7 @@ class AdapterProperties {
}
}
-
-
- private boolean validateProfileConnectionState(int state) {
+ private static boolean validateProfileConnectionState(int state) {
return (state == BluetoothProfile.STATE_DISCONNECTED
|| state == BluetoothProfile.STATE_CONNECTING
|| state == BluetoothProfile.STATE_CONNECTED
@@ -1159,7 +1157,7 @@ class AdapterProperties {
writer.println(sb.toString());
}
- private String dumpDeviceType(int deviceType) {
+ private static String dumpDeviceType(int deviceType) {
switch (deviceType) {
case BluetoothDevice.DEVICE_TYPE_UNKNOWN:
return " ???? ";
@@ -1174,7 +1172,7 @@ class AdapterProperties {
}
}
- private String dumpConnectionState(int state) {
+ private static String dumpConnectionState(int state) {
switch (state) {
case BluetoothAdapter.STATE_DISCONNECTED:
return "STATE_DISCONNECTED";
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterService.java b/android/app/src/com/android/bluetooth/btservice/AdapterService.java
index 075b2aee3b..e180e8ba87 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterService.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterService.java
@@ -1125,7 +1125,7 @@ public class AdapterService extends Service {
}
}
- private void invalidateBluetoothGetStateCache() {
+ private static void invalidateBluetoothGetStateCache() {
if (Flags.getStateFromSystemServer()) {
// State is managed by the system server
return;
@@ -1509,7 +1509,7 @@ public class AdapterService extends Service {
mMetadataListeners.values().forEach(v -> v.kill());
}
- private void invalidateBluetoothCaches() {
+ private static void invalidateBluetoothCaches() {
BluetoothAdapter.invalidateGetProfileConnectionStateCache();
BluetoothAdapter.invalidateIsOffloadedFilteringSupportedCache();
BluetoothDevice.invalidateBluetoothGetBondStateCache();
@@ -2139,7 +2139,7 @@ public class AdapterService extends Service {
}
}
- private void pendingSocketTimeoutRunnable(
+ private static void pendingSocketTimeoutRunnable(
RfcommListenerData listenerData, BluetoothSocket socket) {
boolean socketFound = listenerData.mPendingSockets.remove(socket);
if (socketFound) {
@@ -6707,19 +6707,19 @@ public class AdapterService extends Service {
list.finishBroadcast();
}
- private int getIdleCurrentMa() {
+ private static int getIdleCurrentMa() {
return BluetoothProperties.getHardwareIdleCurrentMa().orElse(0);
}
- private int getTxCurrentMa() {
+ private static int getTxCurrentMa() {
return BluetoothProperties.getHardwareTxCurrentMa().orElse(0);
}
- private int getRxCurrentMa() {
+ private static int getRxCurrentMa() {
return BluetoothProperties.getHardwareRxCurrentMa().orElse(0);
}
- private double getOperatingVolt() {
+ private static double getOperatingVolt() {
return BluetoothProperties.getHardwareOperatingVoltageMv().orElse(0) / 1000.0;
}
@@ -6727,7 +6727,7 @@ public class AdapterService extends Service {
return mRemoteDevices;
}
- private String dumpScanMode(int scanMode) {
+ private static String dumpScanMode(int scanMode) {
switch (scanMode) {
case SCAN_MODE_NONE:
return "SCAN_MODE_NONE";
@@ -7391,7 +7391,7 @@ public class AdapterService extends Service {
deleteDirectoryContents("/data/misc/bluetooth/");
}
- private void deleteDirectoryContents(String dirPath) {
+ private static void deleteDirectoryContents(String dirPath) {
Path directoryPath = Paths.get(dirPath);
try {
Files.walkFileTree(
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterState.java b/android/app/src/com/android/bluetooth/btservice/AdapterState.java
index d6f0646aef..b5ff730b5a 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterState.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterState.java
@@ -17,12 +17,12 @@
package com.android.bluetooth.btservice;
import android.bluetooth.BluetoothAdapter;
-import com.android.bluetooth.flags.Flags;
import android.os.Looper;
import android.os.Message;
import android.os.SystemProperties;
import android.util.Log;
+import com.android.bluetooth.flags.Flags;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
@@ -91,7 +91,7 @@ final class AdapterState extends StateMachine {
start();
}
- private String messageString(int message) {
+ private static String messageString(int message) {
switch (message) {
case BLE_TURN_ON:
return "BLE_TURN_ON";
diff --git a/android/app/src/com/android/bluetooth/btservice/BluetoothQualityReportNativeInterface.java b/android/app/src/com/android/bluetooth/btservice/BluetoothQualityReportNativeInterface.java
index efda7a5385..2f4c03c17c 100644
--- a/android/app/src/com/android/bluetooth/btservice/BluetoothQualityReportNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/btservice/BluetoothQualityReportNativeInterface.java
@@ -16,6 +16,8 @@
package com.android.bluetooth.btservice;
+import static java.util.Objects.requireNonNull;
+
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
@@ -36,7 +38,11 @@ public class BluetoothQualityReportNativeInterface {
private static final Object INSTANCE_LOCK = new Object();
- private BluetoothQualityReportNativeInterface() {}
+ private final AdapterService mAdapterService;
+
+ private BluetoothQualityReportNativeInterface() {
+ mAdapterService = requireNonNull(AdapterService.getAdapterService());
+ }
/** Get singleton instance. */
public static BluetoothQualityReportNativeInterface getInstance() {
@@ -84,14 +90,9 @@ public class BluetoothQualityReportNativeInterface {
Log.e(TAG, "bqrDeliver failed: adapter is null");
return;
}
- AdapterService adapterService = AdapterService.getAdapterService();
- if (adapterService == null) {
- Log.e(TAG, "bqrDeliver failed: adapterService is null");
- return;
- }
BluetoothDevice device = adapter.getRemoteDevice(remoteAddress);
- BluetoothClass remoteClass = new BluetoothClass(adapterService.getRemoteClass(device));
+ BluetoothClass remoteClass = new BluetoothClass(mAdapterService.getRemoteClass(device));
BluetoothQualityReport bqr;
try {
bqr =
@@ -100,7 +101,7 @@ public class BluetoothQualityReportNativeInterface {
.setLmpVersion(lmpVer)
.setLmpSubVersion(lmpSubVer)
.setManufacturerId(manufacturerId)
- .setRemoteName(adapterService.getRemoteName(device))
+ .setRemoteName(mAdapterService.getRemoteName(device))
.setBluetoothClass(remoteClass)
.build();
Log.i(TAG, bqr.toString());
@@ -110,7 +111,7 @@ public class BluetoothQualityReportNativeInterface {
}
try {
- int status = adapterService.bluetoothQualityReportReadyCallback(device, bqr);
+ int status = mAdapterService.bluetoothQualityReportReadyCallback(device, bqr);
if (status != BluetoothStatusCodes.SUCCESS) {
Log.e(TAG, "bluetoothQualityReportReadyCallback failed, status: " + status);
}
diff --git a/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java b/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java
index d2813b827b..1411961bee 100644
--- a/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java
+++ b/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java
@@ -765,7 +765,7 @@ final class BondStateMachine extends StateMachine {
removeMessages(what);
}
- private void clearProfilePriority(BluetoothDevice device) {
+ private static void clearProfilePriority(BluetoothDevice device) {
HidHostService hidService = HidHostService.getHidHostService();
A2dpService a2dpService = A2dpService.getA2dpService();
HeadsetService headsetService = HeadsetService.getHeadsetService();
@@ -825,19 +825,19 @@ final class BondStateMachine extends StateMachine {
} else return "UNKNOWN(" + state + ")";
}
- private void infoLog(String msg) {
+ private static void infoLog(String msg) {
Log.i(TAG, msg);
}
- private void errorLog(String msg) {
+ private static void errorLog(String msg) {
Log.e(TAG, msg);
}
- private void warnLog(String msg) {
+ private static void warnLog(String msg) {
Log.w(TAG, msg);
}
- private int getUnbondReasonFromHALCode(int reason) {
+ private static int getUnbondReasonFromHALCode(int reason) {
if (reason == AbstractionLayer.BT_STATUS_SUCCESS) {
return BluetoothDevice.BOND_SUCCESS;
} else if (reason == AbstractionLayer.BT_STATUS_RMT_DEV_DOWN) {
diff --git a/android/app/src/com/android/bluetooth/btservice/MetricsLogger.java b/android/app/src/com/android/bluetooth/btservice/MetricsLogger.java
index fb925b7e00..ce55d94619 100644
--- a/android/app/src/com/android/bluetooth/btservice/MetricsLogger.java
+++ b/android/app/src/com/android/bluetooth/btservice/MetricsLogger.java
@@ -472,7 +472,7 @@ public class MetricsLogger {
mAlarmManager.cancel(mOnAlarmListener);
}
- private void writeFieldIfNotNull(
+ private static void writeFieldIfNotNull(
ProtoOutputStream proto,
long fieldType,
long fieldCount,
@@ -594,7 +594,7 @@ public class MetricsLogger {
}
}
- private int getOui(BluetoothDevice device) {
+ private static int getOui(BluetoothDevice device) {
return Integer.parseInt(device.getAddress().replace(":", "").substring(0, 6), 16);
}
@@ -807,7 +807,7 @@ public class MetricsLogger {
return digest.digest(name.getBytes(StandardCharsets.UTF_8));
}
- private int getProfileEnumFromProfileId(int profile) {
+ private static int getProfileEnumFromProfileId(int profile) {
return switch (profile) {
case BluetoothProfile.A2DP ->
BLUETOOTH_CROSS_LAYER_EVENT_REPORTED__EVENT_TYPE__PROFILE_CONNECTION_A2DP;
diff --git a/android/app/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java b/android/app/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java
index 6c7d69a723..9812509ea0 100644
--- a/android/app/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java
+++ b/android/app/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java
@@ -246,7 +246,7 @@ public class BluetoothKeystoreService {
}
}
- private boolean isFactoryReset() {
+ private static boolean isFactoryReset() {
return SystemProperties.getBoolean("persist.bluetooth.factoryreset", false);
}
@@ -310,7 +310,7 @@ public class BluetoothKeystoreService {
cleanupMemory();
}
- private void cleanupFile() throws IOException {
+ private static void cleanupFile() throws IOException {
Files.deleteIfExists(Paths.get(CONFIG_CHECKSUM_ENCRYPTION_PATH));
Files.deleteIfExists(Paths.get(CONFIG_FILE_ENCRYPTION_PATH));
}
@@ -676,7 +676,7 @@ public class BluetoothKeystoreService {
return output;
}
- private KeyStore getKeyStore() {
+ private static KeyStore getKeyStore() {
KeyStore keyStore = null;
int counter = 0;
diff --git a/android/app/src/com/android/bluetooth/btservice/storage/AudioPolicyEntity.java b/android/app/src/com/android/bluetooth/btservice/storage/AudioPolicyEntity.java
index b790e92c73..76ba89e0a4 100644
--- a/android/app/src/com/android/bluetooth/btservice/storage/AudioPolicyEntity.java
+++ b/android/app/src/com/android/bluetooth/btservice/storage/AudioPolicyEntity.java
@@ -50,7 +50,7 @@ class AudioPolicyEntity {
return builder.toString();
}
- private String metadataToString(int metadata) {
+ private static String metadataToString(int metadata) {
return String.valueOf(metadata);
}
}
diff --git a/android/app/src/com/android/bluetooth/btservice/storage/CustomizedMetadataEntity.java b/android/app/src/com/android/bluetooth/btservice/storage/CustomizedMetadataEntity.java
index c100a45495..4b224c24d0 100644
--- a/android/app/src/com/android/bluetooth/btservice/storage/CustomizedMetadataEntity.java
+++ b/android/app/src/com/android/bluetooth/btservice/storage/CustomizedMetadataEntity.java
@@ -117,7 +117,7 @@ class CustomizedMetadataEntity {
return builder.toString();
}
- private String metadataToString(byte[] metadata) {
+ private static String metadataToString(byte[] metadata) {
if (metadata == null) {
return null;
}
diff --git a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorNativeInterface.java b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorNativeInterface.java
index a4ebffcb74..5480a61463 100644
--- a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorNativeInterface.java
@@ -58,14 +58,14 @@ public class CsipSetCoordinatorNativeInterface {
return mAdapter.getRemoteDevice(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
return Utils.getBytesFromAddress(device.getAddress());
}
- private void sendMessageToService(CsipSetCoordinatorStackEvent event) {
+ private static void sendMessageToService(CsipSetCoordinatorStackEvent event) {
CsipSetCoordinatorService service =
CsipSetCoordinatorService.getCsipSetCoordinatorService();
if (service != null) {
diff --git a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java
index 0e06d831b7..684d08c59d 100644
--- a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java
+++ b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java
@@ -689,7 +689,7 @@ public class CsipSetCoordinatorService extends ProfileService {
}
}
- private void executeCallback(
+ private static void executeCallback(
Executor exec,
IBluetoothCsipSetCoordinatorCallback callback,
BluetoothDevice device,
diff --git a/android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java b/android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java
index 4a1ec59a2a..0f28f6742c 100644
--- a/android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java
+++ b/android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java
@@ -671,7 +671,7 @@ public class AdvertiseManager {
}
}
- private void sendToCallback(int advertiserId, CallbackWrapper wrapper) {
+ private static void sendToCallback(int advertiserId, CallbackWrapper wrapper) {
try {
wrapper.call();
} catch (RemoteException e) {
diff --git a/android/app/src/com/android/bluetooth/gatt/AppAdvertiseStats.java b/android/app/src/com/android/bluetooth/gatt/AppAdvertiseStats.java
index 1746194f17..4656976850 100644
--- a/android/app/src/com/android/bluetooth/gatt/AppAdvertiseStats.java
+++ b/android/app/src/com/android/bluetooth/gatt/AppAdvertiseStats.java
@@ -224,7 +224,7 @@ class AppAdvertiseStats {
MetricsLogger.getInstance().cacheCount(BluetoothProtoEnums.LE_ADV_ERROR_ON_START_COUNT, 1);
}
- private int convertStatusCode(int status) {
+ private static int convertStatusCode(int status) {
switch (status) {
case AdvertisingSetCallback.ADVERTISE_SUCCESS:
return BluetoothStatsLog.LE_ADV_ERROR_REPORTED__STATUS_CODE__ADV_STATUS_SUCCESS;
@@ -444,7 +444,7 @@ class AppAdvertiseStats {
}
}
- private int convertAdvInterval(int interval) {
+ private static int convertAdvInterval(int interval) {
switch (interval) {
case AdvertisingSetParameters.INTERVAL_HIGH:
return BluetoothStatsLog.LE_ADV_STATE_CHANGED__ADV_INTERVAL__INTERVAL_HIGH;
@@ -457,7 +457,7 @@ class AppAdvertiseStats {
}
}
- private int convertTxPowerLevel(int level) {
+ private static int convertTxPowerLevel(int level) {
switch (level) {
case AdvertisingSetParameters.TX_POWER_ULTRA_LOW:
return BluetoothStatsLog.LE_ADV_STATE_CHANGED__ADV_TX_POWER__TX_POWER_ULTRA_LOW;
diff --git a/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementManager.java b/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementManager.java
index abadff3ad7..04c6f7fff8 100644
--- a/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementManager.java
+++ b/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementManager.java
@@ -337,7 +337,7 @@ public class DistanceMeasurementManager {
return BluetoothStatusCodes.SUCCESS;
}
- private void invokeStartFail(
+ private static void invokeStartFail(
IDistanceMeasurementCallback callback, BluetoothDevice device, int reason) {
try {
callback.onStartFail(device, reason);
@@ -346,7 +346,7 @@ public class DistanceMeasurementManager {
}
}
- private void invokeOnStopped(
+ private static void invokeOnStopped(
IDistanceMeasurementCallback callback, BluetoothDevice device, int reason) {
try {
callback.onStopped(device, reason);
@@ -356,7 +356,7 @@ public class DistanceMeasurementManager {
}
/** Convert frequency into interval in ms */
- private int getIntervalValue(int frequency, int method) {
+ private static int getIntervalValue(int frequency, int method) {
switch (method) {
case DistanceMeasurementMethod.DISTANCE_MEASUREMENT_METHOD_AUTO:
case DistanceMeasurementMethod.DISTANCE_MEASUREMENT_METHOD_RSSI:
diff --git a/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementNativeInterface.java b/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementNativeInterface.java
index ad8a7f9bd4..5992a7b9ce 100644
--- a/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/gatt/DistanceMeasurementNativeInterface.java
@@ -127,7 +127,7 @@ public class DistanceMeasurementNativeInterface {
method);
}
- private int convertErrorCode(int errorCode) {
+ private static int convertErrorCode(int errorCode) {
switch (errorCode) {
case REASON_FEATURE_NOT_SUPPORTED_LOCAL:
return BluetoothStatusCodes.FEATURE_NOT_SUPPORTED;
diff --git a/android/app/src/com/android/bluetooth/gatt/GattService.java b/android/app/src/com/android/bluetooth/gatt/GattService.java
index fe7aaecfdb..ab3b63fc0a 100644
--- a/android/app/src/com/android/bluetooth/gatt/GattService.java
+++ b/android/app/src/com/android/bluetooth/gatt/GattService.java
@@ -2982,11 +2982,11 @@ public class GattService extends ProfileService {
* Private functions
*************************************************************************/
- private boolean isHidSrvcUuid(final UUID uuid) {
+ private static boolean isHidSrvcUuid(final UUID uuid) {
return HID_SERVICE_UUID.equals(uuid);
}
- private boolean isHidCharUuid(final UUID uuid) {
+ private static boolean isHidCharUuid(final UUID uuid) {
for (UUID hidUuid : HID_UUIDS) {
if (hidUuid.equals(uuid)) {
return true;
@@ -2995,15 +2995,15 @@ public class GattService extends ProfileService {
return false;
}
- private boolean isAndroidTvRemoteSrvcUuid(final UUID uuid) {
+ private static boolean isAndroidTvRemoteSrvcUuid(final UUID uuid) {
return ANDROID_TV_REMOTE_SERVICE_UUID.equals(uuid);
}
- private boolean isFidoSrvcUuid(final UUID uuid) {
+ private static boolean isFidoSrvcUuid(final UUID uuid) {
return FIDO_SERVICE_UUID.equals(uuid);
}
- private boolean isLeAudioSrvcUuid(final UUID uuid) {
+ private static boolean isLeAudioSrvcUuid(final UUID uuid) {
for (UUID leAudioUuid : LE_AUDIO_SERVICE_UUIDS) {
if (leAudioUuid.equals(uuid)) {
return true;
@@ -3012,11 +3012,11 @@ public class GattService extends ProfileService {
return false;
}
- private boolean isAndroidHeadtrackerSrvcUuid(final UUID uuid) {
+ private static boolean isAndroidHeadtrackerSrvcUuid(final UUID uuid) {
return HidHostService.ANDROID_HEADTRACKER_UUID.getUuid().equals(uuid);
}
- private boolean isRestrictedSrvcUuid(final UUID uuid) {
+ private static boolean isRestrictedSrvcUuid(final UUID uuid) {
return isFidoSrvcUuid(uuid)
|| isAndroidTvRemoteSrvcUuid(uuid)
|| isLeAudioSrvcUuid(uuid)
diff --git a/android/app/src/com/android/bluetooth/hap/HapClientNativeInterface.java b/android/app/src/com/android/bluetooth/hap/HapClientNativeInterface.java
index 6160e4efa9..42d234c346 100644
--- a/android/app/src/com/android/bluetooth/hap/HapClientNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hap/HapClientNativeInterface.java
@@ -43,7 +43,7 @@ public class HapClientNativeInterface {
return disconnectHapClientNative(getByteAddress(device));
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
diff --git a/android/app/src/com/android/bluetooth/hap/HapClientService.java b/android/app/src/com/android/bluetooth/hap/HapClientService.java
index e4c020f61b..9e9c224d52 100644
--- a/android/app/src/com/android/bluetooth/hap/HapClientService.java
+++ b/android/app/src/com/android/bluetooth/hap/HapClientService.java
@@ -620,7 +620,7 @@ public class HapClientService extends ProfileService {
return 0x00;
}
- private int stackEventPresetInfoReasonToProfileStatus(int statusCode) {
+ private static int stackEventPresetInfoReasonToProfileStatus(int statusCode) {
return switch (statusCode) {
case HapClientStackEvent.PRESET_INFO_REASON_ALL_PRESET_INFO ->
BluetoothStatusCodes.REASON_LOCAL_STACK_REQUEST;
@@ -648,7 +648,7 @@ public class HapClientService extends ProfileService {
stackEventPresetInfoReasonToProfileStatus(infoReason)));
}
- private int stackEventStatusToProfileStatus(int statusCode) {
+ private static int stackEventStatusToProfileStatus(int statusCode) {
return switch (statusCode) {
case HapClientStackEvent.STATUS_SET_NAME_NOT_ALLOWED ->
BluetoothStatusCodes.ERROR_REMOTE_OPERATION_REJECTED;
diff --git a/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java b/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java
index a0e978ef1d..02e03f88c9 100644
--- a/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java
+++ b/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java
@@ -101,7 +101,7 @@ public class HapClientStackEvent {
return result.toString();
}
- private String eventTypeValueListToString(int type, List value) {
+ private static String eventTypeValueListToString(int type, List value) {
switch (type) {
case EVENT_TYPE_ON_PRESET_INFO:
return "{presets count: " + (value == null ? 0 : value.size()) + "}";
@@ -110,7 +110,7 @@ public class HapClientStackEvent {
}
}
- private String eventTypeValueInt1ToString(int type, int value) {
+ private static String eventTypeValueInt1ToString(int type, int value) {
switch (type) {
case EVENT_TYPE_CONNECTION_STATE_CHANGED:
return "{state: " + getConnectionStateName(value) + "}";
@@ -132,7 +132,7 @@ public class HapClientStackEvent {
}
}
- private String infoReasonToString(int value) {
+ private static String infoReasonToString(int value) {
switch (value) {
case PRESET_INFO_REASON_ALL_PRESET_INFO:
return "PRESET_INFO_REASON_ALL_PRESET_INFO";
@@ -149,7 +149,7 @@ public class HapClientStackEvent {
}
}
- private String eventTypeValueInt2ToString(int type, int value) {
+ private static String eventTypeValueInt2ToString(int type, int value) {
switch (type) {
case EVENT_TYPE_ON_PRESET_NAME_SET_ERROR:
return "{presetIndex: " + value + "}";
@@ -166,7 +166,7 @@ public class HapClientStackEvent {
}
}
- private String eventTypeValueInt3ToString(int type, int value) {
+ private static String eventTypeValueInt3ToString(int type, int value) {
switch (type) {
case EVENT_TYPE_ON_PRESET_INFO:
case EVENT_TYPE_ON_PRESET_INFO_ERROR:
@@ -177,7 +177,7 @@ public class HapClientStackEvent {
}
}
- private String statusCodeValueToString(int value) {
+ private static String statusCodeValueToString(int value) {
switch (value) {
case STATUS_NO_ERROR:
return "STATUS_NO_ERROR";
@@ -200,7 +200,7 @@ public class HapClientStackEvent {
}
}
- private String featuresToString(int value) {
+ private static String featuresToString(int value) {
StringBuilder features_sb = new StringBuilder();
if (BigInteger.valueOf(value).testBit(FEATURE_BIT_NUM_TYPE_MONAURAL)) {
features_sb.append("TYPE_MONAURAL");
diff --git a/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java b/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java
index 1d58cdb3a2..8e2d0bd09f 100644
--- a/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java
+++ b/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java
@@ -506,7 +506,7 @@ public class AtPhonebook {
return roundUpToPowerOfTwo(maxSize);
}
- private int roundUpToPowerOfTwo(int x) {
+ private static int roundUpToPowerOfTwo(int x) {
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java b/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
index cde10203fd..9dbcd6d4e8 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
@@ -71,12 +71,12 @@ public class HeadsetNativeInterface {
}
}
- private void sendMessageToService(HeadsetStackEvent event) {
+ private static void sendMessageToService(HeadsetStackEvent event) {
HeadsetService service = HeadsetService.getHeadsetService();
if (service != null) {
service.messageFromNative(event);
} else {
- // Service must call cleanup() when quiting and native stack shouldn't send any event
+ // Service must call cleanup() when quitting and native stack shouldn't send any event
// after cleanup() -> cleanupNative() is called.
Log.w(TAG, "Stack sent event while service is not available: " + event);
}
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
index 5155efbbcf..4c20b42c90 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
@@ -2140,7 +2140,7 @@ public class HeadsetService extends ProfileService {
&& !isHeadsetClientConnected();
}
- private boolean isHeadsetClientConnected() {
+ private static boolean isHeadsetClientConnected() {
HeadsetClientService headsetClientService = HeadsetClientService.getHeadsetClientService();
if (headsetClientService == null) {
return false;
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetSystemInterface.java b/android/app/src/com/android/bluetooth/hfp/HeadsetSystemInterface.java
index 6bbb32d105..78e350fc37 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetSystemInterface.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetSystemInterface.java
@@ -68,7 +68,7 @@ class HeadsetSystemInterface {
mTelecomManager = mHeadsetService.getSystemService(TelecomManager.class);
}
- private BluetoothInCallService getBluetoothInCallServiceInstance() {
+ private static BluetoothInCallService getBluetoothInCallServiceInstance() {
return BluetoothInCallService.getInstance();
}
diff --git a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
index 83c0d90f7a..4e0dae8c13 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
@@ -1200,7 +1200,7 @@ public class HeadsetClientService extends ProfileService {
sm.sendMessage(StackEvent.STACK_EVENT, stackEvent);
}
- private boolean isConnectionEvent(StackEvent stackEvent) {
+ private static boolean isConnectionEvent(StackEvent stackEvent) {
if (stackEvent.type == StackEvent.EVENT_TYPE_CONNECTION_STATE_CHANGED) {
if ((stackEvent.valueInt == HeadsetClientHalConstants.CONNECTION_STATE_CONNECTING)
|| (stackEvent.valueInt
diff --git a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientServiceInterface.java b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientServiceInterface.java
index 553628da1e..9cf8237e09 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientServiceInterface.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientServiceInterface.java
@@ -38,7 +38,7 @@ public class HeadsetClientServiceInterface {
public HeadsetClientServiceInterface() {}
- private boolean isServiceAvailable(HeadsetClientService service) {
+ private static boolean isServiceAvailable(HeadsetClientService service) {
if (service == null) {
Log.w(TAG, "HeadsetClientService is not available");
return false;
diff --git a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
index 123cf5eb7a..8bb8a4700b 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
@@ -881,7 +881,7 @@ public class HeadsetClientStateMachine extends StateMachine {
return features;
}
- private boolean isSupported(int bitfield, int mask) {
+ private static boolean isSupported(int bitfield, int mask) {
return (bitfield & mask) == mask;
}
@@ -2517,7 +2517,7 @@ public class HeadsetClientStateMachine extends StateMachine {
return mAudioRouteAllowed;
}
- private String createMaskString(BluetoothSinkAudioPolicy policies) {
+ private static String createMaskString(BluetoothSinkAudioPolicy policies) {
StringBuilder mask = new StringBuilder();
mask.append(BluetoothSinkAudioPolicy.HFP_SET_SINK_AUDIO_POLICY_ID);
mask.append(",").append(policies.getCallEstablishPolicy());
@@ -2582,7 +2582,7 @@ public class HeadsetClientStateMachine extends StateMachine {
}
/** handles the value of {@link BluetoothSinkAudioPolicy} from system property */
- private int getAudioPolicySystemProp(String propKey) {
+ private static int getAudioPolicySystemProp(String propKey) {
int mProp = SystemProperties.getInt(propKey, BluetoothSinkAudioPolicy.POLICY_UNCONFIGURED);
if (mProp < BluetoothSinkAudioPolicy.POLICY_UNCONFIGURED
|| mProp > BluetoothSinkAudioPolicy.POLICY_NOT_ALLOWED) {
diff --git a/android/app/src/com/android/bluetooth/hfpclient/HfpClientConnectionService.java b/android/app/src/com/android/bluetooth/hfpclient/HfpClientConnectionService.java
index 4b2dae00b0..2dc7bbaa6b 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/HfpClientConnectionService.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/HfpClientConnectionService.java
@@ -59,7 +59,7 @@ public class HfpClientConnectionService extends ConnectionService {
private static final Object INSTANCE_LOCK = new Object();
private static HfpClientConnectionService sHfpClientConnectionService;
- private void setInstance(HfpClientConnectionService instance) {
+ private static void setInstance(HfpClientConnectionService instance) {
synchronized (INSTANCE_LOCK) {
sHfpClientConnectionService = instance;
}
diff --git a/android/app/src/com/android/bluetooth/hfpclient/HfpClientDeviceBlock.java b/android/app/src/com/android/bluetooth/hfpclient/HfpClientDeviceBlock.java
index aa259bebb3..f33acb586d 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/HfpClientDeviceBlock.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/HfpClientDeviceBlock.java
@@ -320,7 +320,7 @@ public class HfpClientDeviceBlock {
}
}
- private Bundle getScoStateFromDevice(BluetoothDevice device) {
+ private static Bundle getScoStateFromDevice(BluetoothDevice device) {
Bundle bundle = new Bundle();
HeadsetClientService headsetClientService = HeadsetClientService.getHeadsetClientService();
diff --git a/android/app/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessor.java b/android/app/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessor.java
index 31703caeec..603beae96b 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessor.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessor.java
@@ -113,7 +113,7 @@ class VendorCommandResponseProcessor {
return true;
}
- private String getVendorIdFromAtCommand(String atString) {
+ private static String getVendorIdFromAtCommand(String atString) {
// Get event code
int indexOfEqual = atString.indexOf('=');
int indexOfColon = atString.indexOf(':');
diff --git a/android/app/src/com/android/bluetooth/hid/HidHostService.java b/android/app/src/com/android/bluetooth/hid/HidHostService.java
index 0e3df36b69..a1eb100dd7 100644
--- a/android/app/src/com/android/bluetooth/hid/HidHostService.java
+++ b/android/app/src/com/android/bluetooth/hid/HidHostService.java
@@ -210,7 +210,7 @@ public class HidHostService extends ProfileService {
* @param device remote device
* @return address type
*/
- private int getAddressType(BluetoothDevice device) {
+ private static int getAddressType(BluetoothDevice device) {
return device.getAddressType();
}
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface.java
index a2cefdd648..b34f2a989d 100644
--- a/android/app/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface.java
@@ -67,7 +67,7 @@ public class LeAudioBroadcasterNativeInterface {
}
}
- private void sendMessageToService(LeAudioStackEvent event) {
+ private static void sendMessageToService(LeAudioStackEvent event) {
LeAudioService service = LeAudioService.getLeAudioService();
if (service != null) {
service.messageFromNative(event);
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java
index a501c6d8a7..e2d1490c9f 100644
--- a/android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java
@@ -69,14 +69,14 @@ public class LeAudioNativeInterface {
}
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
return Utils.getBytesFromAddress(device.getAddress());
}
- private void sendMessageToService(LeAudioStackEvent event) {
+ private static void sendMessageToService(LeAudioStackEvent event) {
LeAudioService service = LeAudioService.getLeAudioService();
if (service != null) {
service.messageFromNative(event);
@@ -92,7 +92,7 @@ public class LeAudioNativeInterface {
// Callbacks from the native stack back into the Java framework.
// All callbacks are routed via the Service which will disambiguate which
// state machine the message should be routed to.
- private void onInitialized() {
+ private static void onInitialized() {
LeAudioStackEvent event =
new LeAudioStackEvent(LeAudioStackEvent.EVENT_TYPE_NATIVE_INITIALIZED);
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
index 234f435c42..d535f0b1c9 100644
--- a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
+++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
@@ -529,7 +529,7 @@ public class LeAudioService extends ProfileService {
mSessionStatus);
}
- private int convertToStatsAudioQuality(int audioQuality) {
+ private static int convertToStatsAudioQuality(int audioQuality) {
switch (audioQuality) {
case BluetoothLeBroadcastSubgroupSettings.QUALITY_STANDARD:
return BluetoothStatsLog
@@ -5288,7 +5288,8 @@ public class LeAudioService extends ProfileService {
}
}
- private boolean isAudioModeChangedFromCommunicationToNormal(int previousMode, int currentMode) {
+ private static boolean isAudioModeChangedFromCommunicationToNormal(
+ int previousMode, int currentMode) {
switch (previousMode) {
case AudioManager.MODE_RINGTONE:
case AudioManager.MODE_IN_CALL:
diff --git a/android/app/src/com/android/bluetooth/le_scan/AppScanStats.java b/android/app/src/com/android/bluetooth/le_scan/AppScanStats.java
index 4d3bcc8a74..f519edb0a1 100644
--- a/android/app/src/com/android/bluetooth/le_scan/AppScanStats.java
+++ b/android/app/src/com/android/bluetooth/le_scan/AppScanStats.java
@@ -470,7 +470,7 @@ class AppScanStats {
}
}
- private int convertScanCallbackType(int type) {
+ private static int convertScanCallbackType(int type) {
switch (type) {
case ScanSettings.CALLBACK_TYPE_ALL_MATCHES:
return BluetoothStatsLog
@@ -851,7 +851,7 @@ class AppScanStats {
// or less package names names are untouched.
// Examples: one.two.three.four => one.two.three
// one.two.three => one.two
- private String truncateAppName(String name) {
+ private static String truncateAppName(String name) {
String initiator = name;
String[] nameSplit = initiator.split("\\.");
if (nameSplit.length > 3) {
diff --git a/android/app/src/com/android/bluetooth/le_scan/MsftAdvMonitor.java b/android/app/src/com/android/bluetooth/le_scan/MsftAdvMonitor.java
index feb30fd9c9..57729351c6 100644
--- a/android/app/src/com/android/bluetooth/le_scan/MsftAdvMonitor.java
+++ b/android/app/src/com/android/bluetooth/le_scan/MsftAdvMonitor.java
@@ -135,7 +135,7 @@ class MsftAdvMonitor {
return mAddress;
}
- private boolean dataMaskIsEmpty(byte[] mask) {
+ private static boolean dataMaskIsEmpty(byte[] mask) {
if (mask == null || mask.length == 0) return true;
if (mask.length == 1 && mask[0] == 0) return true;
return false;
diff --git a/android/app/src/com/android/bluetooth/le_scan/ScanController.java b/android/app/src/com/android/bluetooth/le_scan/ScanController.java
index 2c641500cb..35f38d90d6 100644
--- a/android/app/src/com/android/bluetooth/le_scan/ScanController.java
+++ b/android/app/src/com/android/bluetooth/le_scan/ScanController.java
@@ -316,7 +316,7 @@ public class ScanController {
return true;
}
- private ScanResult getSanitizedExposureNotification(ScanResult result) {
+ private static ScanResult getSanitizedExposureNotification(ScanResult result) {
ScanRecord record = result.getScanRecord();
// Remove the flags part of the payload, if present
if (record.getBytes().length > EXPOSURE_NOTIFICATION_FLAGS_LENGTH
@@ -605,12 +605,12 @@ public class ScanController {
}
// Check if a scan record matches a specific filters.
- private boolean matchesFilters(ScanClient client, ScanResult scanResult) {
+ private static boolean matchesFilters(ScanClient client, ScanResult scanResult) {
return matchesFilters(client, scanResult, null);
}
// Check if a scan record matches a specific filters or original address
- private boolean matchesFilters(
+ private static boolean matchesFilters(
ScanClient client, ScanResult scanResult, String originalAddress) {
if (client.filters == null || client.filters.isEmpty()) {
// TODO: Do we really wanna return true here?
@@ -943,7 +943,7 @@ public class ScanController {
}
// Reverse byte array.
- private void reverse(byte[] address) {
+ private static void reverse(byte[] address) {
int len = address.length;
for (int i = 0; i < len / 2; ++i) {
byte b = address[i];
diff --git a/android/app/src/com/android/bluetooth/le_scan/ScanFilterQueue.java b/android/app/src/com/android/bluetooth/le_scan/ScanFilterQueue.java
index b2b0b7eec0..b5614ea927 100644
--- a/android/app/src/com/android/bluetooth/le_scan/ScanFilterQueue.java
+++ b/android/app/src/com/android/bluetooth/le_scan/ScanFilterQueue.java
@@ -293,7 +293,8 @@ import java.util.UUID;
}
}
- private byte[] concatenate(ParcelUuid serviceDataUuid, byte[] serviceData, boolean isMask) {
+ private static byte[] concatenate(
+ ParcelUuid serviceDataUuid, byte[] serviceData, boolean isMask) {
byte[] uuid = BluetoothUuid.uuidToBytes(serviceDataUuid);
int dataLen = uuid.length + serviceData.length;
diff --git a/android/app/src/com/android/bluetooth/le_scan/ScanManager.java b/android/app/src/com/android/bluetooth/le_scan/ScanManager.java
index 211b0174c0..b5e8a047e0 100644
--- a/android/app/src/com/android/bluetooth/le_scan/ScanManager.java
+++ b/android/app/src/com/android/bluetooth/le_scan/ScanManager.java
@@ -463,12 +463,12 @@ public class ScanManager {
return !mScanNative.isOpportunisticScanClient(client) && !isFiltered;
}
- private boolean requiresLocationOn(ScanClient client) {
+ private static boolean requiresLocationOn(ScanClient client) {
boolean isFiltered = isFilteredScan(client);
return !client.hasDisavowedLocation && !isFiltered;
}
- private boolean isFilteredScan(ScanClient client) {
+ private static boolean isFilteredScan(ScanClient client) {
if ((client.filters == null) || client.filters.isEmpty()) {
return false;
}
@@ -522,7 +522,7 @@ public class ScanManager {
mScanNative.flushBatchResults(client.scannerId);
}
- private boolean isBatchClient(ScanClient client) {
+ private static boolean isBatchClient(ScanClient client) {
if (client == null || client.settings == null) {
return false;
}
@@ -791,7 +791,7 @@ public class ScanManager {
return false;
}
- private boolean upgradeScanModeByOneLevel(ScanClient client) {
+ private static boolean upgradeScanModeByOneLevel(ScanClient client) {
switch (client.scanModeApp) {
case ScanSettings.SCAN_MODE_LOW_POWER:
return client.updateScanMode(ScanSettings.SCAN_MODE_BALANCED);
@@ -1288,40 +1288,40 @@ public class ScanManager {
}
}
- private boolean isExemptFromScanTimeout(ScanClient client) {
+ private static boolean isExemptFromScanTimeout(ScanClient client) {
return isOpportunisticScanClient(client) || isFirstMatchScanClient(client);
}
- private boolean isExemptFromAutoBatchScanUpdate(ScanClient client) {
+ private static boolean isExemptFromAutoBatchScanUpdate(ScanClient client) {
return isOpportunisticScanClient(client) || !isAllMatchesAutoBatchScanClient(client);
}
- private boolean isAutoBatchScanClientEnabled(ScanClient client) {
+ private static boolean isAutoBatchScanClientEnabled(ScanClient client) {
return client.stats != null && client.stats.isAutoBatchScan(client.scannerId);
}
- private boolean isAllMatchesAutoBatchScanClient(ScanClient client) {
+ private static boolean isAllMatchesAutoBatchScanClient(ScanClient client) {
return client.settings.getCallbackType()
== ScanSettings.CALLBACK_TYPE_ALL_MATCHES_AUTO_BATCH;
}
- private boolean isOpportunisticScanClient(ScanClient client) {
+ private static boolean isOpportunisticScanClient(ScanClient client) {
return client.settings.getScanMode() == ScanSettings.SCAN_MODE_OPPORTUNISTIC;
}
- private boolean isTimeoutScanClient(ScanClient client) {
+ private static boolean isTimeoutScanClient(ScanClient client) {
return (client.stats != null) && client.stats.isScanTimeout(client.scannerId);
}
- private boolean isDowngradedScanClient(ScanClient client) {
+ private static boolean isDowngradedScanClient(ScanClient client) {
return (client.stats != null) && client.stats.isScanDowngraded(client.scannerId);
}
- private boolean isForceDowngradedScanClient(ScanClient client) {
+ private static boolean isForceDowngradedScanClient(ScanClient client) {
return isTimeoutScanClient(client) || isDowngradedScanClient(client);
}
- private boolean isFirstMatchScanClient(ScanClient client) {
+ private static boolean isFirstMatchScanClient(ScanClient client) {
return (client.settings.getCallbackType() & ScanSettings.CALLBACK_TYPE_FIRST_MATCH)
!= 0;
}
@@ -1368,7 +1368,7 @@ public class ScanManager {
setBatchAlarm();
}
- private int getFullScanStoragePercent(int resultType) {
+ private static int getFullScanStoragePercent(int resultType) {
switch (resultType) {
case SCAN_RESULT_TYPE_FULL:
return 100;
@@ -1753,7 +1753,7 @@ public class ScanManager {
}
/** Return batch scan result type value defined in bt stack. */
- private int getResultType(BatchScanParams params) {
+ private static int getResultType(BatchScanParams params) {
if (params.mFullScanScannerId != -1 && params.mTruncatedScanScannerId != -1) {
return SCAN_RESULT_TYPE_BOTH;
}
@@ -1843,7 +1843,7 @@ public class ScanManager {
}
// Get delivery mode based on scan settings.
- private int getDeliveryMode(ScanClient client) {
+ private static int getDeliveryMode(ScanClient client) {
if (client == null) {
return DELIVERY_MODE_IMMEDIATE;
}
@@ -1951,7 +1951,7 @@ public class ScanManager {
return phy;
}
- private int getOnFoundOnLostTimeoutMillis(ScanSettings settings, boolean onFound) {
+ private static int getOnFoundOnLostTimeoutMillis(ScanSettings settings, boolean onFound) {
int factor;
int timeout = ONLOST_ONFOUND_BASE_TIMEOUT_MS;
@@ -1966,7 +1966,7 @@ public class ScanManager {
return (timeout * factor);
}
- private int getOnFoundOnLostSightings(ScanSettings settings) {
+ private static int getOnFoundOnLostSightings(ScanSettings settings) {
if (settings == null) {
return ONFOUND_SIGHTINGS_AGGRESSIVE;
}
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java b/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java
index 01590dba0f..d3d87e660a 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java
@@ -467,7 +467,7 @@ public class BluetoothMapContent {
}
}
- private void setProtected(
+ private static void setProtected(
BluetoothMapMessageListingElement e,
Cursor c,
FilterInfo fi,
@@ -485,7 +485,7 @@ public class BluetoothMapContent {
}
}
- private void setThreadId(
+ private static void setThreadId(
BluetoothMapMessageListingElement e,
Cursor c,
FilterInfo fi,
@@ -507,7 +507,7 @@ public class BluetoothMapContent {
}
}
- private void setThreadName(
+ private static void setThreadName(
BluetoothMapMessageListingElement e,
Cursor c,
FilterInfo fi,
@@ -522,7 +522,7 @@ public class BluetoothMapContent {
}
}
- private void setSent(
+ private static void setSent(
BluetoothMapMessageListingElement e,
Cursor c,
FilterInfo fi,
@@ -547,7 +547,7 @@ public class BluetoothMapContent {
}
}
- private void setRead(
+ private static void setRead(
BluetoothMapMessageListingElement e,
Cursor c,
FilterInfo fi,
@@ -566,7 +566,7 @@ public class BluetoothMapContent {
e.setRead((read == 1), ((ap.getParameterMask() & MASK_READ) != 0));
}
- private void setPriority(
+ private static void setPriority(
BluetoothMapMessageListingElement e,
Cursor c,
FilterInfo fi,
@@ -691,7 +691,8 @@ public class BluetoothMapContent {
}
}
- private void setReceptionStatus(BluetoothMapMessageListingElement e, BluetoothMapAppParams ap) {
+ private static void setReceptionStatus(
+ BluetoothMapMessageListingElement e, BluetoothMapAppParams ap) {
if ((ap.getParameterMask() & MASK_RECEPTION_STATUS) != 0) {
String status = "complete";
Log.v(TAG, "setReceptionStatus: " + status);
@@ -756,7 +757,7 @@ public class BluetoothMapContent {
}
}
- private TYPE getType(FilterInfo fi) {
+ private static TYPE getType(FilterInfo fi) {
TYPE type = null;
Log.d(TAG, "getType: for filterMsgType" + fi.mMsgType);
if (fi.mMsgType == FilterInfo.TYPE_SMS) {
@@ -1286,7 +1287,7 @@ public class BluetoothMapContent {
}
}
- private void setHandle(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi) {
+ private static void setHandle(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi) {
long handle = -1;
if (fi.mMsgType == FilterInfo.TYPE_SMS) {
handle = c.getLong(fi.mSmsColId);
@@ -1640,10 +1641,8 @@ public class BluetoothMapContent {
return matchOriginator(c, fi, ap) && matchRecipient(c, fi, ap);
}
- /*
- * Where filter functions
- */
- private String setWhereFilterFolderTypeSms(String folder) {
+ /* Where filter functions */
+ private static String setWhereFilterFolderTypeSms(String folder) {
String where = "";
if (BluetoothMapContract.FOLDER_NAME_INBOX.equalsIgnoreCase(folder)) {
where = Sms.TYPE + " = 1 AND " + Sms.THREAD_ID + " <> -1";
@@ -1676,7 +1675,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterFolderTypeMms(String folder) {
+ private static String setWhereFilterFolderTypeMms(String folder) {
String where = "";
if (BluetoothMapContract.FOLDER_NAME_INBOX.equalsIgnoreCase(folder)) {
where = Mms.MESSAGE_BOX + " = 1 AND " + Mms.THREAD_ID + " <> -1";
@@ -1700,7 +1699,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterFolderTypeEmail(long folderId) {
+ private static String setWhereFilterFolderTypeEmail(long folderId) {
String where = "";
if (folderId >= 0) {
where = BluetoothMapContract.MessageColumns.FOLDER_ID + " = " + folderId;
@@ -1716,7 +1715,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterFolderTypeIm(long folderId) {
+ private static String setWhereFilterFolderTypeIm(long folderId) {
String where = "";
if (folderId > BluetoothMapContract.FOLDER_ID_OTHER) {
where = BluetoothMapContract.MessageColumns.FOLDER_ID + " = " + folderId;
@@ -1732,7 +1731,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterFolderType(
+ private static String setWhereFilterFolderType(
BluetoothMapFolderElement folderElement, FilterInfo fi) {
String where = "1=1";
if (!folderElement.shouldIgnore()) {
@@ -1750,7 +1749,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterReadStatus(BluetoothMapAppParams ap, FilterInfo fi) {
+ private static String setWhereFilterReadStatus(BluetoothMapAppParams ap, FilterInfo fi) {
String where = "";
if (ap.getFilterReadStatus() != -1) {
if (fi.mMsgType == FilterInfo.TYPE_SMS) {
@@ -1781,7 +1780,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterPeriod(BluetoothMapAppParams ap, FilterInfo fi) {
+ private static String setWhereFilterPeriod(BluetoothMapAppParams ap, FilterInfo fi) {
String where = "";
if ((ap.getFilterPeriodBegin() != -1)) {
@@ -1815,7 +1814,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterOriginatorEmail(BluetoothMapAppParams ap) {
+ private static String setWhereFilterOriginatorEmail(BluetoothMapAppParams ap) {
String where = "";
String orig = ap.getFilterOriginator();
@@ -1832,7 +1831,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterOriginatorIM(BluetoothMapAppParams ap) {
+ private static String setWhereFilterOriginatorIM(BluetoothMapAppParams ap) {
String where = "";
String orig = ap.getFilterOriginator();
@@ -1849,7 +1848,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterPriority(BluetoothMapAppParams ap, FilterInfo fi) {
+ private static String setWhereFilterPriority(BluetoothMapAppParams ap, FilterInfo fi) {
String where = "";
int pri = ap.getFilterPriority();
/*only MMS have priority info */
@@ -1875,7 +1874,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterRecipientEmail(BluetoothMapAppParams ap) {
+ private static String setWhereFilterRecipientEmail(BluetoothMapAppParams ap) {
String where = "";
String recip = ap.getFilterRecipient();
@@ -1900,7 +1899,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterMessageHandle(BluetoothMapAppParams ap, FilterInfo fi) {
+ private static String setWhereFilterMessageHandle(BluetoothMapAppParams ap, FilterInfo fi) {
String where = "";
long id = -1;
String msgHandle = ap.getFilterMsgHandleString();
@@ -1920,7 +1919,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilterThreadId(BluetoothMapAppParams ap, FilterInfo fi) {
+ private static String setWhereFilterThreadId(BluetoothMapAppParams ap, FilterInfo fi) {
String where = "";
long id = -1;
String msgHandle = ap.getFilterConvoIdString();
@@ -1941,7 +1940,7 @@ public class BluetoothMapContent {
return where;
}
- private String setWhereFilter(
+ private static String setWhereFilter(
BluetoothMapFolderElement folderElement, FilterInfo fi, BluetoothMapAppParams ap) {
StringBuilder where = new StringBuilder(setWhereFilterFolderType(folderElement, fi));
@@ -2083,7 +2082,7 @@ public class BluetoothMapContent {
*
* @return boolean true if email is selected, false if not
*/
- private boolean emailSelected(BluetoothMapAppParams ap) {
+ private static boolean emailSelected(BluetoothMapAppParams ap) {
int msgType = ap.getFilterMessageType();
Log.d(TAG, "emailSelected msgType: " + msgType);
@@ -2105,7 +2104,7 @@ public class BluetoothMapContent {
*
* @return boolean true if im is selected, false if not
*/
- private boolean imSelected(BluetoothMapAppParams ap) {
+ private static boolean imSelected(BluetoothMapAppParams ap) {
int msgType = ap.getFilterMessageType();
Log.d(TAG, "imSelected msgType: " + msgType);
@@ -3381,7 +3380,7 @@ public class BluetoothMapContent {
* @param contentUri the URI to append parameters to
* @return the new URI with the appended parameters (if any)
*/
- private Uri appendConvoListQueryParameters(BluetoothMapAppParams ap, Uri contentUri) {
+ private static Uri appendConvoListQueryParameters(BluetoothMapAppParams ap, Uri contentUri) {
Uri.Builder newUri = contentUri.buildUpon();
String str = ap.getFilterRecipient();
if (str != null) {
@@ -3531,7 +3530,7 @@ public class BluetoothMapContent {
*
* @return the folder name.
*/
- private String getFolderName(int type, int threadId) {
+ private static String getFolderName(int type, int threadId) {
if (threadId == -1) {
return BluetoothMapContract.FOLDER_NAME_DELETED;
@@ -3563,7 +3562,7 @@ public class BluetoothMapContent {
long id = BluetoothMapUtils.getCpHandle(handle);
if (appParams.getFractionRequest() == BluetoothMapAppParams.FRACTION_REQUEST_NEXT) {
throw new IllegalArgumentException(
- "FRACTION_REQUEST_NEXT does not make sence as"
+ "FRACTION_REQUEST_NEXT does not make sense as"
+ " we always return the full message.");
}
switch (type) {
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMapObexServer.java b/android/app/src/com/android/bluetooth/map/BluetoothMapObexServer.java
index 4e06253415..77430eb319 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMapObexServer.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMapObexServer.java
@@ -221,7 +221,7 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
}
/** Add base (Inbox/Outbox/Sent/Deleted) */
- private void addBaseFolders(BluetoothMapFolderElement root) {
+ private static void addBaseFolders(BluetoothMapFolderElement root) {
root.addFolder(BluetoothMapContract.FOLDER_NAME_INBOX); // root/telecom/msg/inbox
root.addFolder(BluetoothMapContract.FOLDER_NAME_OUTBOX);
root.addFolder(BluetoothMapContract.FOLDER_NAME_SENT);
@@ -229,7 +229,7 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
}
/** Add SMS / MMS Base folders */
- private void addSmsMmsFolders(BluetoothMapFolderElement root) {
+ private static void addSmsMmsFolders(BluetoothMapFolderElement root) {
root.addSmsMmsFolder(BluetoothMapContract.FOLDER_NAME_INBOX); // root/telecom/msg/inbox
root.addSmsMmsFolder(BluetoothMapContract.FOLDER_NAME_OUTBOX);
root.addSmsMmsFolder(BluetoothMapContract.FOLDER_NAME_SENT);
@@ -237,7 +237,7 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
root.addSmsMmsFolder(BluetoothMapContract.FOLDER_NAME_DRAFT);
}
- private void addImFolders(BluetoothMapFolderElement root) throws RemoteException {
+ private static void addImFolders(BluetoothMapFolderElement root) throws RemoteException {
// Select all parent folders
root.addImFolder(
BluetoothMapContract.FOLDER_NAME_INBOX,
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java b/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java
index e7049b86f3..b22065ac28 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java
@@ -381,7 +381,7 @@ public class BluetoothMapSmsPdu {
}
@SuppressWarnings("JavaUtilDate") // TODO: b/365629730 -- prefer Instant or LocalDate
- private void gsmWriteDate(ByteArrayOutputStream header, long time) {
+ private static void gsmWriteDate(ByteArrayOutputStream header, long time) {
SimpleDateFormat format = new SimpleDateFormat("yyMMddHHmmss");
Date date = new Date(time);
String timeStr = format.format(date); // Format to YYMMDDTHHMMSS UTC time
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMapbMessageMime.java b/android/app/src/com/android/bluetooth/map/BluetoothMapbMessageMime.java
index 6e5204576a..a93f85dd3b 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMapbMessageMime.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMapbMessageMime.java
@@ -742,7 +742,7 @@ public class BluetoothMapbMessageMime extends BluetoothMapbMessage {
newPart.mData = decodeBody(body, mMyEncoding, mCharset);
}
- private byte[] decodeBody(String body, String encoding, String charset) {
+ private static byte[] decodeBody(String body, String encoding, String charset) {
if (encoding != null && Ascii.toUpperCase(encoding).contains("BASE64")) {
return Base64.decode(body, Base64.DEFAULT);
} else if (encoding != null && Ascii.toUpperCase(encoding).contains("QUOTED-PRINTABLE")) {
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMnsObexClient.java b/android/app/src/com/android/bluetooth/map/BluetoothMnsObexClient.java
index 741290dea5..8f37895bfc 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMnsObexClient.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMnsObexClient.java
@@ -522,7 +522,7 @@ public class BluetoothMnsObexClient {
BluetoothProtoEnums.BLUETOOTH_MNS_OBEX_CLIENT,
BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
12);
- handleSendException(e.toString());
+ Log.e(TAG, "Error when sending event", e);
error = true;
} catch (IndexOutOfBoundsException e) {
ContentProfileErrorReportUtils.report(
@@ -530,7 +530,7 @@ public class BluetoothMnsObexClient {
BluetoothProtoEnums.BLUETOOTH_MNS_OBEX_CLIENT,
BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
13);
- handleSendException(e.toString());
+ Log.e(TAG, "Error when sending event", e);
error = true;
} finally {
try {
@@ -571,10 +571,6 @@ public class BluetoothMnsObexClient {
return responseCode;
}
- private void handleSendException(String exception) {
- Log.e(TAG, "Error when sending event: " + exception);
- }
-
private void notifyUpdateWakeLock() {
if (mCallback != null) {
Message msg = Message.obtain(mCallback);
diff --git a/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java b/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java
index 109bc1411a..eee34a4aa3 100644
--- a/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java
+++ b/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java
@@ -524,7 +524,7 @@ class MapClientContent {
return Telephony.Threads.getOrCreateThreadId(mContext, messageContacts);
}
- private void getRecipientsFromMessage(Bmessage message, Set<String> messageContacts) {
+ private static void getRecipientsFromMessage(Bmessage message, Set<String> messageContacts) {
List<VCardEntry> recipients = message.getRecipients();
for (VCardEntry recipient : recipients) {
List<VCardEntry.PhoneData> phoneData = recipient.getPhoneList();
@@ -535,7 +535,7 @@ class MapClientContent {
}
}
- private String getOriginatorNumber(Bmessage message) {
+ private static String getOriginatorNumber(Bmessage message) {
VCardEntry originator = message.getOriginator();
if (originator == null) {
return null;
@@ -549,7 +549,7 @@ class MapClientContent {
return PhoneNumberUtils.extractNetworkPortion(phoneData.get(0).getNumber());
}
- private String getFirstRecipientNumber(Bmessage message) {
+ private static String getFirstRecipientNumber(Bmessage message) {
List<VCardEntry> recipients = message.getRecipients();
if (recipients == null || recipients.isEmpty()) {
return null;
@@ -794,7 +794,7 @@ class MapClientContent {
return messages;
}
- private Type getMessageTypeFromUri(Uri uri) {
+ private static Type getMessageTypeFromUri(Uri uri) {
if (Sms.CONTENT_URI.equals(uri)
|| Sms.Inbox.CONTENT_URI.equals(uri)
|| Sms.Sent.CONTENT_URI.equals(uri)) {
diff --git a/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java b/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java
index 2c3420af84..057823fa5c 100644
--- a/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java
+++ b/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java
@@ -478,11 +478,11 @@ class MceStateMachine extends StateMachine {
return false;
}
- private String getContactURIFromPhone(String number) {
+ private static String getContactURIFromPhone(String number) {
return PhoneAccount.SCHEME_TEL + ":" + number;
}
- private String getContactURIFromEmail(String email) {
+ private static String getContactURIFromEmail(String email) {
return SCHEME_MAILTO + "://" + email;
}
@@ -1195,7 +1195,7 @@ class MceStateMachine extends StateMachine {
* Retrieves the URIs of all the participants of a group conversation, besides the sender of
* the message.
*/
- private String[] getRecipientsUri(List<VCardEntry> recipients) {
+ private static String[] getRecipientsUri(List<VCardEntry> recipients) {
Set<String> uris = new HashSet<>();
for (VCardEntry recipient : recipients) {
@@ -1326,7 +1326,7 @@ class MceStateMachine extends StateMachine {
sendMessage(MSG_NOTIFICATION, ev);
}
- private String getMessageName(int what) {
+ private static String getMessageName(int what) {
switch (what) {
case MSG_MAS_CONNECTED:
return "MSG_MAS_CONNECTED";
diff --git a/android/app/src/com/android/bluetooth/mapclient/obex/BmessageBuilder.java b/android/app/src/com/android/bluetooth/mapclient/obex/BmessageBuilder.java
index a5d0c2e996..7550b90850 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/BmessageBuilder.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/BmessageBuilder.java
@@ -148,7 +148,7 @@ class BmessageBuilder {
mBmsg.append(VCARD_END).append(CRLF);
}
- private String buildVcardN(VCardEntry vcard) {
+ private static String buildVcardN(VCardEntry vcard) {
NameData nd = vcard.getNameData();
StringBuilder sb = new StringBuilder();
diff --git a/android/app/src/com/android/bluetooth/mapclient/obex/EventReport.java b/android/app/src/com/android/bluetooth/mapclient/obex/EventReport.java
index a1e3be04eb..8dbd8d349d 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/EventReport.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/EventReport.java
@@ -128,7 +128,7 @@ public class EventReport {
return ev;
}
- private Type parseType(String type) throws IllegalArgumentException {
+ private static Type parseType(String type) throws IllegalArgumentException {
for (Type t : Type.values()) {
if (t.toString().equals(type)) {
return t;
@@ -138,7 +138,7 @@ public class EventReport {
throw new IllegalArgumentException("Invalid value for type: " + type);
}
- private Bmessage.Type parseMsgType(String msgType) throws IllegalArgumentException {
+ private static Bmessage.Type parseMsgType(String msgType) throws IllegalArgumentException {
for (Bmessage.Type t : Bmessage.Type.values()) {
if (t.name().equals(msgType)) {
return t;
diff --git a/android/app/src/com/android/bluetooth/mapclient/obex/Message.java b/android/app/src/com/android/bluetooth/mapclient/obex/Message.java
index 0cfaf74660..8a2e9d3370 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/Message.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/Message.java
@@ -130,11 +130,11 @@ public class Message {
mProtected = yesnoToBoolean(attrs.get("protected"));
}
- private boolean yesnoToBoolean(String yesno) {
+ private static boolean yesnoToBoolean(String yesno) {
return "yes".equals(yesno);
}
- private Type strToType(String s) {
+ private static Type strToType(String s) {
if ("EMAIL".equals(s)) {
return Type.EMAIL;
} else if ("SMS_GSM".equals(s)) {
@@ -148,7 +148,7 @@ public class Message {
return Type.UNKNOWN;
}
- private ReceptionStatus strToReceptionStatus(String s) {
+ private static ReceptionStatus strToReceptionStatus(String s) {
if ("complete".equals(s)) {
return ReceptionStatus.COMPLETE;
} else if ("fractioned".equals(s)) {
diff --git a/android/app/src/com/android/bluetooth/mapclient/obex/RequestGetMessagesListingForOwnNumber.java b/android/app/src/com/android/bluetooth/mapclient/obex/RequestGetMessagesListingForOwnNumber.java
index 71b178cce8..afca4d5de8 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/RequestGetMessagesListingForOwnNumber.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/RequestGetMessagesListingForOwnNumber.java
@@ -243,7 +243,7 @@ class RequestGetMessagesListingForOwnNumber extends Request {
+ (" maxCount=" + maxCount));
}
- private byte messageTypeBasedOnFolder(String folderName) {
+ private static byte messageTypeBasedOnFolder(String folderName) {
byte messageType =
(byte)
(MessagesFilter.MESSAGE_TYPE_SMS_GSM
diff --git a/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java b/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java
index 8c0f093b27..0be28709f0 100644
--- a/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java
+++ b/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java
@@ -438,12 +438,12 @@ public class MediaControlGattService implements MediaControlGattServiceInterface
}
});
- private long millisecondsToMcsInterval(long interval) {
+ private static long millisecondsToMcsInterval(long interval) {
/* MCS presents time in 0.01s intervals */
return interval / 10;
}
- private long mcsIntervalToMilliseconds(long interval) {
+ private static long mcsIntervalToMilliseconds(long interval) {
/* MCS presents time in 0.01s intervals */
return interval * 10L;
}
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
index 49b6e9ad66..13dc28f2a2 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
@@ -86,7 +86,7 @@ public class BluetoothOppPreference {
mChannels = (HashMap<String, Integer>) mChannelPreference.getAll();
}
- private String getChannelKey(BluetoothDevice remoteDevice, int uuid) {
+ private static String getChannelKey(BluetoothDevice remoteDevice, int uuid) {
return getBrEdrAddress(remoteDevice) + "_" + Integer.toHexString(uuid);
}
@@ -177,7 +177,7 @@ public class BluetoothOppPreference {
}
@SuppressLint("AndroidFrameworkRequiresPermission")
- private String getBrEdrAddress(BluetoothDevice device) {
+ private static String getBrEdrAddress(BluetoothDevice device) {
if (Flags.identityAddressNullIfNotKnown()) {
return Utils.getBrEdrAddress(device);
}
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
index 5113d4b9e0..eb9b7f91c4 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
@@ -285,7 +285,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
}
}
- private void cancelNotification(Context context, int id) {
+ private static void cancelNotification(Context context, int id) {
NotificationManager notMgr = context.getSystemService(NotificationManager.class);
if (notMgr == null) {
return;
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
index 7b7f1087d3..7ce5ef6bb2 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
@@ -1019,7 +1019,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
}
}
- private String getBrEdrAddress(BluetoothDevice device) {
+ private static String getBrEdrAddress(BluetoothDevice device) {
if (Flags.identityAddressNullIfNotKnown()) {
return Utils.getBrEdrAddress(device);
}
diff --git a/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java b/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java
index a586f5d1a9..5143392d03 100644
--- a/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java
+++ b/android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java
@@ -267,7 +267,7 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory {
terminate();
}
- private NetworkCapabilities initNetworkCapabilities() {
+ private static NetworkCapabilities initNetworkCapabilities() {
final NetworkCapabilities.Builder builder =
new NetworkCapabilities.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_BLUETOOTH)
diff --git a/android/app/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java b/android/app/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
index b79bd5b1f1..c755e1b67c 100644
--- a/android/app/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
+++ b/android/app/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
@@ -620,7 +620,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
}
}
- private boolean isNameMatchTarget(String name, String target) {
+ private static boolean isNameMatchTarget(String name, String target) {
if (name == null) {
return false;
}
@@ -642,7 +642,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
}
/** check whether path is legal */
- private boolean isLegalPath(final String str) {
+ private static boolean isLegalPath(final String str) {
if (str.length() == 0) {
return true;
}
@@ -1070,7 +1070,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
}
/** Function to send vcard data to client */
- private int pushBytes(Operation op, final String vcardString) {
+ private static int pushBytes(Operation op, final String vcardString) {
if (vcardString == null) {
Log.w(TAG, "vcardString is null!");
return ResponseCodes.OBEX_HTTP_OK;
diff --git a/android/app/src/com/android/bluetooth/pbapclient/PbapClientContactsStorage.java b/android/app/src/com/android/bluetooth/pbapclient/PbapClientContactsStorage.java
index a7c5a36011..9d064c7598 100644
--- a/android/app/src/com/android/bluetooth/pbapclient/PbapClientContactsStorage.java
+++ b/android/app/src/com/android/bluetooth/pbapclient/PbapClientContactsStorage.java
@@ -315,7 +315,7 @@ class PbapClientContactsStorage {
}
@SuppressWarnings("NonApiType") // For convenience, as applyBatch above takes an ArrayList above
- private ArrayList<ContentProviderOperation> constructInsertOperationsForContact(
+ private static ArrayList<ContentProviderOperation> constructInsertOperationsForContact(
VCardEntry contact,
ArrayList<ContentProviderOperation> operations,
ContentResolver contactsProvider) {
@@ -481,7 +481,7 @@ class PbapClientContactsStorage {
// TODO: b/365629730 -- JavaUtilDate: prefer Instant or LocalDate
// NonApiType: For convenience, as the applyBatch API actually takes an ArrayList above
@SuppressWarnings({"JavaUtilDate", "NonApiType"})
- private ArrayList<ContentProviderOperation> constructInsertOperationsForCallLog(
+ private static ArrayList<ContentProviderOperation> constructInsertOperationsForCallLog(
Account account,
int type,
VCardEntry call,
diff --git a/android/app/src/com/android/bluetooth/pbapclient/obex/PbapPhonebook.java b/android/app/src/com/android/bluetooth/pbapclient/obex/PbapPhonebook.java
index b3e6cb21fc..81582c462b 100644
--- a/android/app/src/com/android/bluetooth/pbapclient/obex/PbapPhonebook.java
+++ b/android/app/src/com/android/bluetooth/pbapclient/obex/PbapPhonebook.java
@@ -145,7 +145,7 @@ public class PbapPhonebook {
* any other {@link VCardException} or succeeds (i.e., no {@link VCardException}).
* @throws IOException if there's an issue reading the {@link InputStream}.
*/
- private boolean parsedWithVcardVersionException(VCardParser parser, InputStream in)
+ private static boolean parsedWithVcardVersionException(VCardParser parser, InputStream in)
throws IOException {
try {
parser.parse(in);
@@ -170,7 +170,7 @@ public class PbapPhonebook {
/**
* Get the offset associated with this PbapPhonebook object
*
- * <p>The offset respresents the start index of the remote contacts pull
+ * <p>The offset represents the start index of the remote contacts pull
*
* @return an int representing the offset index where this pull started from
*/
diff --git a/android/app/src/com/android/bluetooth/sap/SapRilReceiverHidl.java b/android/app/src/com/android/bluetooth/sap/SapRilReceiverHidl.java
index d8f0feb047..b97d860bc6 100644
--- a/android/app/src/com/android/bluetooth/sap/SapRilReceiverHidl.java
+++ b/android/app/src/com/android/bluetooth/sap/SapRilReceiverHidl.java
@@ -48,7 +48,7 @@ public class SapRilReceiverHidl implements ISapRilReceiver {
public static final int RIL_MAX_COMMAND_BYTES = (8 * 1024);
public byte[] buffer = new byte[RIL_MAX_COMMAND_BYTES];
- private ArrayList<Byte> primitiveArrayToContainerArrayList(byte[] arr) {
+ private static ArrayList<Byte> primitiveArrayToContainerArrayList(byte[] arr) {
ArrayList<Byte> arrayList = new ArrayList<>(arr.length);
for (byte b : arr) {
arrayList.add(b);
diff --git a/android/app/src/com/android/bluetooth/tbs/TbsGeneric.java b/android/app/src/com/android/bluetooth/tbs/TbsGeneric.java
index b49eee0a03..b88f6e7d9c 100644
--- a/android/app/src/com/android/bluetooth/tbs/TbsGeneric.java
+++ b/android/app/src/com/android/bluetooth/tbs/TbsGeneric.java
@@ -1021,7 +1021,7 @@ public class TbsGeneric {
}
};
- private String callControlRequestOpcodeStr(int opcode) {
+ private static String callControlRequestOpcodeStr(int opcode) {
switch (opcode) {
case TbsGatt.CALL_CONTROL_POINT_OPCODE_ACCEPT:
return "ACCEPT";
diff --git a/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java b/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java
index 076ea0cf4e..99b0efc2a3 100644
--- a/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java
+++ b/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java
@@ -1395,7 +1395,7 @@ public class BluetoothInCallService extends InCallService {
return bluetoothCallState;
}
- private int getBtCallState(BluetoothCall call, boolean isForeground) {
+ private static int getBtCallState(BluetoothCall call, boolean isForeground) {
switch (call.getState()) {
case Call.STATE_NEW:
case Call.STATE_DISCONNECTED:
@@ -1611,7 +1611,7 @@ public class BluetoothInCallService extends InCallService {
}
}
- private Integer getTbsCallState(BluetoothCall call) {
+ private static Integer getTbsCallState(BluetoothCall call) {
switch (call.getState()) {
case Call.STATE_ACTIVE:
return BluetoothLeCall.STATE_ACTIVE;
diff --git a/android/app/src/com/android/bluetooth/vc/VolumeControlNativeInterface.java b/android/app/src/com/android/bluetooth/vc/VolumeControlNativeInterface.java
index 90add03ed7..68e368fd2a 100644
--- a/android/app/src/com/android/bluetooth/vc/VolumeControlNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/vc/VolumeControlNativeInterface.java
@@ -43,7 +43,7 @@ public class VolumeControlNativeInterface {
cleanupNative();
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
diff --git a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
index 8b65e0d332..8924f3219b 100644
--- a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
+++ b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
@@ -1925,7 +1925,7 @@ public class VolumeControlService extends ProfileService {
service.unmuteGroup(groupId);
}
- private void postAndWait(Handler handler, Runnable runnable) {
+ private static void postAndWait(Handler handler, Runnable runnable) {
FutureTask<Void> task = new FutureTask(Executors.callable(runnable));
handler.post(task);
@@ -1980,7 +1980,7 @@ public class VolumeControlService extends ProfileService {
postAndWait(service.mHandler, () -> service.notifyNewRegisteredCallback(callback));
}
- private void validateBluetoothDevice(BluetoothDevice device) {
+ private static void validateBluetoothDevice(BluetoothDevice device) {
requireNonNull(device);
String address = device.getAddress();
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java
index 201d380a12..d31d579e47 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java
@@ -159,8 +159,8 @@ public class BluetoothOppBtEnablingActivityTest {
assertThat(finishCalled.get()).isTrue();
}
- private void assertActivityState(ActivityScenario activityScenario, Lifecycle.State state)
- throws Exception {
+ private static void assertActivityState(
+ ActivityScenario activityScenario, Lifecycle.State state) throws Exception {
// TODO: Change this into an event driven systems
Thread.sleep(3_000);
assertThat(activityScenario.getState()).isEqualTo(state);
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
index c64ea81912..3396591ef1 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
@@ -208,8 +208,8 @@ public class BluetoothOppLauncherActivityTest {
assertActivityState(scenario, Lifecycle.State.DESTROYED);
}
- private void assertActivityState(ActivityScenario activityScenario, Lifecycle.State state)
- throws Exception {
+ private static void assertActivityState(
+ ActivityScenario activityScenario, Lifecycle.State state) throws Exception {
Thread.sleep(2_000);
assertThat(activityScenario.getState()).isEqualTo(state);
}
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java b/android/app/tests/instrumentation/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java
index 515d0d4cf5..a9eea3da60 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java
@@ -1928,7 +1928,7 @@ public class BluetoothInCallServiceTest {
verify(firstCall).conference(any(BluetoothCall.class));
}
- private void addCallCapability(BluetoothCall call, int capability) {
+ private static void addCallCapability(BluetoothCall call, int capability) {
doReturn(true).when(call).can(eq(capability));
}
@@ -1979,11 +1979,11 @@ public class BluetoothInCallServiceTest {
makeQuickConnectionServiceComponentName(), id, Binder.getCallingUserHandle());
}
- private PhoneAccount.Builder makeQuickAccountBuilder(String id, int idx) {
+ private static PhoneAccount.Builder makeQuickAccountBuilder(String id, int idx) {
return new PhoneAccount.Builder(makeQuickAccountHandle(id), "label" + idx);
}
- private PhoneAccount makeQuickAccount(String id, int idx) {
+ private static PhoneAccount makeQuickAccount(String id, int idx) {
return makeQuickAccountBuilder(id, idx)
.setAddress(Uri.parse(TEST_ACCOUNT_ADDRESS + idx))
.setSubscriptionAddress(Uri.parse("tel:555-000" + idx))
@@ -1992,7 +1992,7 @@ public class BluetoothInCallServiceTest {
.build();
}
- private BluetoothCall getMockCall(UUID uuid) {
+ private static BluetoothCall getMockCall(UUID uuid) {
BluetoothCall call = mock(com.android.bluetooth.telephony.BluetoothCall.class);
Integer integerUuid = uuid.hashCode();
doReturn(integerUuid).when(call).getId();
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java b/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java
index 9223d82c5d..79ebced7de 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java
@@ -297,11 +297,11 @@ public class CallInfoTest {
makeQuickConnectionServiceComponentName(), id, Process.myUserHandle());
}
- private PhoneAccount.Builder makeQuickAccountBuilder(String id, int idx) {
+ private static PhoneAccount.Builder makeQuickAccountBuilder(String id, int idx) {
return new PhoneAccount.Builder(makeQuickAccountHandle(id), "label" + idx);
}
- private PhoneAccount makeQuickAccount(String id, int idx) {
+ private static PhoneAccount makeQuickAccount(String id, int idx) {
return makeQuickAccountBuilder(id, idx)
.setAddress(Uri.parse(TEST_ACCOUNT_ADDRESS + idx))
.setSubscriptionAddress(Uri.parse("tel:555-000" + idx))
@@ -310,7 +310,7 @@ public class CallInfoTest {
.build();
}
- private BluetoothCall getMockCall() {
+ private static BluetoothCall getMockCall() {
return mock(BluetoothCall.class);
}
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java
index a6bf4950ca..d0c253523a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java
@@ -767,7 +767,8 @@ public class A2dpCodecConfigTest {
}
}
- private BluetoothCodecConfig getDefaultCodecConfigByType(int codecType, int codecPriority) {
+ private static BluetoothCodecConfig getDefaultCodecConfigByType(
+ int codecType, int codecPriority) {
for (BluetoothCodecConfig codecConfig : sDefaultCodecConfigs) {
if (codecConfig.getCodecType() != codecType) {
continue;
@@ -794,7 +795,7 @@ public class A2dpCodecConfigTest {
return null;
}
- private BluetoothCodecConfig getCodecCapabilitiesByType(int codecType) {
+ private static BluetoothCodecConfig getCodecCapabilitiesByType(int codecType) {
for (BluetoothCodecConfig codecCapabilities : sCodecCapabilities) {
if (codecCapabilities.getCodecType() != codecType) {
continue;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java
index d6e88738f2..5b17d2805f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java
@@ -1287,7 +1287,7 @@ public class A2dpServiceTest {
.setA2dpOptionalCodecsEnabled(mDevice, BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
}
- private BluetoothCodecConfig buildBluetoothCodecConfig(
+ private static BluetoothCodecConfig buildBluetoothCodecConfig(
int sourceCodecType,
int codecPriority,
int sampleRate,
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java
index 94c59c7424..dfa391c909 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java
@@ -143,7 +143,7 @@ public class BrowserPlayerWrapperTest {
return BitmapFactory.decodeStream(imageInputStream);
}
- private MediaDescription getMediaDescription(
+ private static MediaDescription getMediaDescription(
String id,
String title,
String artist,
@@ -169,7 +169,7 @@ public class BrowserPlayerWrapperTest {
return builder.build();
}
- private MediaItem getMediaItem(MediaDescription description, int flags) {
+ private static MediaItem getMediaItem(MediaDescription description, int flags) {
return new MediaItem(description, flags);
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java
index cfb35313b8..d74b4ecd5b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java
@@ -124,7 +124,7 @@ public class ImageTest {
return BitmapFactory.decodeStream(imageInputStream);
}
- private MediaMetadata getMediaMetadataWithoutArt() {
+ private static MediaMetadata getMediaMetadataWithoutArt() {
MediaMetadata.Builder builder =
new MediaMetadata.Builder()
.putString(MediaMetadata.METADATA_KEY_TITLE, "BT Test Song")
@@ -134,7 +134,7 @@ public class ImageTest {
return builder.build();
}
- private MediaMetadata getMediaMetadataWithBitmap(String field, Bitmap image) {
+ private static MediaMetadata getMediaMetadataWithBitmap(String field, Bitmap image) {
MediaMetadata.Builder builder =
new MediaMetadata.Builder()
.putString(MediaMetadata.METADATA_KEY_TITLE, "BT Test Song")
@@ -145,7 +145,7 @@ public class ImageTest {
return builder.build();
}
- private MediaMetadata getMediaMetadataWithUri(String field, String uri) {
+ private static MediaMetadata getMediaMetadataWithUri(String field, String uri) {
MediaMetadata.Builder builder =
new MediaMetadata.Builder()
.putString(MediaMetadata.METADATA_KEY_TITLE, "BT Test Song")
@@ -156,7 +156,7 @@ public class ImageTest {
return builder.build();
}
- private MediaDescription getMediaDescriptionWithoutArt() {
+ private static MediaDescription getMediaDescriptionWithoutArt() {
MediaDescription.Builder builder =
new MediaDescription.Builder()
.setTitle("BT Test Song")
@@ -164,7 +164,7 @@ public class ImageTest {
return builder.build();
}
- private MediaDescription getMediaDescriptionWithBitmap(Bitmap image) {
+ private static MediaDescription getMediaDescriptionWithBitmap(Bitmap image) {
MediaDescription.Builder builder =
new MediaDescription.Builder()
.setTitle("BT Test Song")
@@ -173,7 +173,7 @@ public class ImageTest {
return builder.build();
}
- private MediaDescription getMediaDescriptionWithUri(Uri uri) {
+ private static MediaDescription getMediaDescriptionWithUri(Uri uri) {
MediaDescription.Builder builder =
new MediaDescription.Builder()
.setTitle("BT Test Song")
@@ -182,13 +182,13 @@ public class ImageTest {
return builder.build();
}
- private Bundle getBundleWithBitmap(String field, Bitmap image) {
+ private static Bundle getBundleWithBitmap(String field, Bitmap image) {
Bundle bundle = new Bundle();
bundle.putParcelable(field, image);
return bundle;
}
- private Bundle getBundleWithUri(String field, String uri) {
+ private static Bundle getBundleWithUri(String field, String uri) {
Bundle bundle = new Bundle();
bundle.putString(field, uri);
return bundle;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java
index b7a7baede7..7a084783fb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java
@@ -131,7 +131,7 @@ public class MediaPlayerListTest {
.dropShellPermissionIdentity();
}
- private MediaData prepareMediaData(int playbackState) {
+ private static MediaData prepareMediaData(int playbackState) {
PlaybackState.Builder builder = new PlaybackState.Builder();
builder.setState(playbackState, 0, 1);
ArrayList<Metadata> list = new ArrayList<Metadata>();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java
index d7f7cb56cc..0ad8530e75 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java
@@ -130,7 +130,7 @@ public class MetadataTest {
return BitmapFactory.decodeStream(imageInputStream);
}
- private MediaMetadata getMediaMetadata() {
+ private static MediaMetadata getMediaMetadata() {
MediaMetadata.Builder builder =
new MediaMetadata.Builder()
.putString(MediaMetadata.METADATA_KEY_MEDIA_ID, SONG_MEDIA_ID)
@@ -149,7 +149,7 @@ public class MetadataTest {
return builder.build();
}
- private MediaMetadata getMediaMetadataWithBitmap(String field, Bitmap image) {
+ private static MediaMetadata getMediaMetadataWithBitmap(String field, Bitmap image) {
MediaMetadata.Builder builder =
new MediaMetadata.Builder()
.putString(MediaMetadata.METADATA_KEY_MEDIA_ID, SONG_MEDIA_ID)
@@ -168,7 +168,7 @@ public class MetadataTest {
return builder.build();
}
- private MediaMetadata getMediaMetadataWithUri(String field, Uri uri) {
+ private static MediaMetadata getMediaMetadataWithUri(String field, Uri uri) {
MediaMetadata.Builder builder =
new MediaMetadata.Builder()
.putString(MediaMetadata.METADATA_KEY_MEDIA_ID, SONG_MEDIA_ID)
@@ -187,7 +187,7 @@ public class MetadataTest {
return builder.build();
}
- private MediaDescription getMediaDescription(Bitmap bitmap, Uri uri, Bundle extras) {
+ private static MediaDescription getMediaDescription(Bitmap bitmap, Uri uri, Bundle extras) {
MediaDescription.Builder builder =
new MediaDescription.Builder()
.setMediaId(SONG_MEDIA_ID)
@@ -206,15 +206,15 @@ public class MetadataTest {
return builder.build();
}
- private MediaItem getMediaItem(MediaDescription description) {
+ private static MediaItem getMediaItem(MediaDescription description) {
return new MediaItem(description, 0 /* not browsable/playable */);
}
- private QueueItem getQueueItem(MediaDescription description) {
+ private static QueueItem getQueueItem(MediaDescription description) {
return new QueueItem(description, 1 /* queue ID */);
}
- private Bundle getBundle() {
+ private static Bundle getBundle() {
Bundle bundle = new Bundle();
bundle.putString(MediaMetadata.METADATA_KEY_MEDIA_ID, SONG_MEDIA_ID);
bundle.putString(MediaMetadata.METADATA_KEY_TITLE, SONG_TITLE);
@@ -227,19 +227,19 @@ public class MetadataTest {
return bundle;
}
- private Bundle getBundleWithBitmap(String field, Bitmap image) {
+ private static Bundle getBundleWithBitmap(String field, Bitmap image) {
Bundle bundle = getBundle();
bundle.putParcelable(field, image);
return bundle;
}
- private Bundle getBundleWithUri(String field, Uri uri) {
+ private static Bundle getBundleWithUri(String field, Uri uri) {
Bundle bundle = getBundle();
bundle.putString(field, uri.toString());
return bundle;
}
- private void assertMetadata(
+ private static void assertMetadata(
String mediaId,
String title,
String artist,
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java
index da529d669b..93c2fe0678 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java
@@ -161,7 +161,8 @@ public class AvrcpBipObexServerTest {
* <p>Our server will use: - getReceivedHeader - sendHeaders - getMaxPacketSize -
* openOutputStream
*/
- private Operation makeOperation(HeaderSet requestHeaders, OutputStream os) throws Exception {
+ private static Operation makeOperation(HeaderSet requestHeaders, OutputStream os)
+ throws Exception {
Operation op = mock(Operation.class);
when(op.getReceivedHeader()).thenReturn(requestHeaders);
when(op.getMaxPacketSize()).thenReturn(256);
@@ -169,7 +170,7 @@ public class AvrcpBipObexServerTest {
return op;
}
- private byte[] makeDescriptor(int encoding, int width, int height) {
+ private static byte[] makeDescriptor(int encoding, int width, int height) {
return new BipImageDescriptor.Builder()
.setEncoding(encoding)
.setFixedDimensions(width, height)
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java
index 27bca93454..172692a4e9 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java
@@ -151,7 +151,7 @@ public class AvrcpTargetServiceTest {
assertThat(AvrcpTargetService.isQueueUpdated(firstQueue, secondQueue)).isTrue();
}
- private Metadata createEmptyMetadata() {
+ private static Metadata createEmptyMetadata() {
Metadata.Builder builder = new Metadata.Builder();
return builder.useDefaults().build();
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java
index f9585fe54e..bcf90f4066 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java
@@ -81,19 +81,19 @@ public class CoverArtTest {
return BitmapFactory.decodeStream(imageInputStream);
}
- private Bitmap toBitmap(byte[] imageBytes) {
+ private static Bitmap toBitmap(byte[] imageBytes) {
ByteArrayInputStream inputStream = new ByteArrayInputStream(imageBytes);
return BitmapFactory.decodeStream(inputStream);
}
- private BipImageDescriptor getDescriptor(int encoding, int width, int height) {
+ private static BipImageDescriptor getDescriptor(int encoding, int width, int height) {
return new BipImageDescriptor.Builder()
.setEncoding(encoding)
.setFixedDimensions(width, height)
.build();
}
- private boolean containsThumbnailFormat(BipImageProperties properties) {
+ private static boolean containsThumbnailFormat(BipImageProperties properties) {
if (properties == null) return false;
for (BipImageFormat format : properties.getNativeFormats()) {
@@ -117,7 +117,7 @@ public class CoverArtTest {
return false;
}
- private boolean isThumbnailFormat(Bitmap image) {
+ private static boolean isThumbnailFormat(Bitmap image) {
if (image == null) return false;
return (200 == image.getHeight() && 200 == image.getWidth());
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java
index 7898edcd63..66ad64ddea 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java
@@ -239,7 +239,7 @@ public class AvrcpControllerStateMachineTest {
return builder.build();
}
- private AvrcpPlayer makePlayer(
+ private static AvrcpPlayer makePlayer(
BluetoothDevice device,
int playerId,
String playerName,
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java
index 580de97ba5..c1b0f52616 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java
@@ -178,7 +178,7 @@ public class AvrcpPlayerTest {
assertThat(avrcpPlayer.notifyImageDownload(uuid, uri)).isTrue();
}
- private void setSupportedFeature(byte[] supportedFeatures, int feature) {
+ private static void setSupportedFeature(byte[] supportedFeatures, int feature) {
int byteNumber = feature / 8;
byte bitMask = (byte) (1 << (feature % 8));
supportedFeatures[byteNumber] = (byte) (supportedFeatures[byteNumber] | bitMask);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java
index 3500d0e0c7..02a63b298b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java
@@ -33,7 +33,8 @@ import java.util.TimeZone;
@RunWith(AndroidJUnit4.class)
public class BipAttachmentFormatTest {
- private Date makeDate(int month, int day, int year, int hours, int min, int sec, TimeZone tz) {
+ private static Date makeDate(
+ int month, int day, int year, int hours, int min, int sec, TimeZone tz) {
Calendar.Builder builder = new Calendar.Builder();
/* Note that Calendar months are zero-based in Java framework */
@@ -43,12 +44,12 @@ public class BipAttachmentFormatTest {
return builder.build().getTime();
}
- private Date makeDate(int month, int day, int year, int hours, int min, int sec) {
+ private static Date makeDate(int month, int day, int year, int hours, int min, int sec) {
return makeDate(month, day, year, hours, min, sec, null);
}
@SuppressLint("UndefinedEquals")
- private void testParse(
+ private static void testParse(
String contentType,
String charset,
String name,
@@ -83,7 +84,7 @@ public class BipAttachmentFormatTest {
}
@SuppressLint("UndefinedEquals")
- private void testCreate(
+ private static void testCreate(
String contentType,
String charset,
String name,
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java
index 9b3032c657..bf3b29a00d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java
@@ -34,7 +34,8 @@ import java.util.TimeZone;
@RunWith(AndroidJUnit4.class)
public class BipDatetimeTest {
- private Date makeDate(int month, int day, int year, int hours, int min, int sec, TimeZone tz) {
+ private static Date makeDate(
+ int month, int day, int year, int hours, int min, int sec, TimeZone tz) {
Calendar.Builder builder = new Calendar.Builder();
/* Note that Calendar months are zero-based in Java framework */
@@ -44,11 +45,12 @@ public class BipDatetimeTest {
return builder.build().getTime();
}
- private Date makeDate(int month, int day, int year, int hours, int min, int sec) {
+ private static Date makeDate(int month, int day, int year, int hours, int min, int sec) {
return makeDate(month, day, year, hours, min, sec, null);
}
- private String makeTzAdjustedString(int month, int day, int year, int hours, int min, int sec) {
+ private static String makeTzAdjustedString(
+ int month, int day, int year, int hours, int min, int sec) {
Calendar cal = Calendar.getInstance();
cal.setTime(makeDate(month, day, year, hours, min, sec));
cal.setTimeZone(TimeZone.getDefault());
@@ -64,7 +66,8 @@ public class BipDatetimeTest {
}
@SuppressLint("UndefinedEquals")
- private void testParse(String date, Date expectedDate, boolean isUtc, String expectedStr) {
+ private static void testParse(
+ String date, Date expectedDate, boolean isUtc, String expectedStr) {
BipDateTime bipDateTime = new BipDateTime(date);
assertThat(bipDateTime.getTime()).isEqualTo(expectedDate);
assertThat(bipDateTime.isUtc()).isEqualTo(isUtc);
@@ -72,7 +75,7 @@ public class BipDatetimeTest {
}
@SuppressLint("UndefinedEquals")
- private void testCreate(Date date, String dateStr) {
+ private static void testCreate(Date date, String dateStr) {
BipDateTime bipDate = new BipDateTime(date);
assertThat(bipDate.getTime()).isEqualTo(date);
assertThat(bipDate.isUtc()).isTrue();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java
index 99f4a5281a..712c304c33 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java
@@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class BipEncodingTest {
- private void testParse(
+ private static void testParse(
String input,
int encodingType,
String encodingStr,
@@ -40,7 +40,7 @@ public class BipEncodingTest {
assertThat(encoding.isAndroidSupported()).isEqualTo(isAndroidSupported);
}
- private void testParseMany(
+ private static void testParseMany(
String[] inputs,
int encodingType,
String encodingStr,
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java
index 6e767249e9..8f11f9218f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java
@@ -108,7 +108,7 @@ public class BipImagePropertiesTest {
private static final String IMAGE_PROPERTIES_END = "</image-properties>";
- private InputStream toUtf8Stream(String s) {
+ private static InputStream toUtf8Stream(String s) {
return new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java
index 88f093966a..8d2146218a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java
@@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class BipPixelTest {
- private void testParse(
+ private static void testParse(
String input,
int pixelType,
int minWidth,
@@ -44,7 +44,7 @@ public class BipPixelTest {
assertThat(pixel.toString()).isEqualTo(pixelStr);
}
- private void testFixed(int width, int height, String pixelStr) {
+ private static void testFixed(int width, int height, String pixelStr) {
BipPixel pixel = BipPixel.createFixed(width, height);
assertThat(pixel.getType()).isEqualTo(BipPixel.TYPE_FIXED);
assertThat(pixel.getMinWidth()).isEqualTo(width);
@@ -54,7 +54,7 @@ public class BipPixelTest {
assertThat(pixel.toString()).isEqualTo(pixelStr);
}
- private void testResizableModified(
+ private static void testResizableModified(
int minWidth, int minHeight, int maxWidth, int maxHeight, String pixelStr) {
BipPixel pixel = BipPixel.createResizableModified(minWidth, minHeight, maxWidth, maxHeight);
assertThat(pixel.getType()).isEqualTo(BipPixel.TYPE_RESIZE_MODIFIED_ASPECT_RATIO);
@@ -65,7 +65,8 @@ public class BipPixelTest {
assertThat(pixel.toString()).isEqualTo(pixelStr);
}
- private void testResizableFixed(int minWidth, int maxWidth, int maxHeight, String pixelStr) {
+ private static void testResizableFixed(
+ int minWidth, int maxWidth, int maxHeight, String pixelStr) {
int minHeight = (minWidth * maxHeight) / maxWidth; // spec defined
BipPixel pixel = BipPixel.createResizableFixed(minWidth, maxWidth, maxHeight);
assertThat(pixel.getType()).isEqualTo(BipPixel.TYPE_RESIZE_FIXED_ASPECT_RATIO);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java
index 3c6cd7c5b5..5aef26da78 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java
@@ -1233,7 +1233,7 @@ public class BassClientServiceTest {
.isEqualTo(TEST_BROADCAST_ID);
}
- private byte[] getScanRecord(int broadcastId) {
+ private static byte[] getScanRecord(int broadcastId) {
return new byte[] {
0x02,
0x01,
@@ -1318,7 +1318,7 @@ public class BassClientServiceTest {
generateScanResult(scanResult);
}
- private byte[] getPAScanRecord() {
+ private static byte[] getPAScanRecord() {
return new byte[] {
(byte) 0x02,
(byte) 0x01,
@@ -1442,7 +1442,7 @@ public class BassClientServiceTest {
}
}
- private BluetoothLeBroadcastReceiveState injectRemoteSourceState(
+ private static BluetoothLeBroadcastReceiveState injectRemoteSourceState(
BassClientStateMachine sm,
BluetoothLeBroadcastMetadata meta,
int sourceId,
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java
index 0862f73ee5..393081d6d6 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java
@@ -190,7 +190,7 @@ public class BassClientStateMachineTest {
mBassClientStateMachine.start();
}
- private int classTypeToConnectionState(Class type) {
+ private static int classTypeToConnectionState(Class type) {
if (type == BassClientStateMachine.Disconnected.class) {
return BluetoothProfile.STATE_DISCONNECTED;
} else if (type == BassClientStateMachine.Connecting.class) {
@@ -2656,7 +2656,7 @@ public class BassClientStateMachineTest {
Mockito.clearInvocations(mBassClientService);
}
- private boolean isConnectionIntentExpected(Class currentType, Class nextType) {
+ private static boolean isConnectionIntentExpected(Class currentType, Class nextType) {
if (currentType == nextType) {
return false; // Same state, no intent expected
}
@@ -2725,7 +2725,8 @@ public class BassClientStateMachineTest {
return builder.build();
}
- private byte[] convertMetadataToUpdateSourceByteArray(BluetoothLeBroadcastMetadata metaData) {
+ private static byte[] convertMetadataToUpdateSourceByteArray(
+ BluetoothLeBroadcastMetadata metaData) {
int numSubGroups = metaData.getSubgroups().size();
byte[] res = new byte[UPDATE_SOURCE_FIXED_LENGTH + numSubGroups * 5];
@@ -2764,7 +2765,7 @@ public class BassClientStateMachineTest {
return res;
}
- private BluetoothLeBroadcastMetadata getMetadataToPauseStream(
+ private static BluetoothLeBroadcastMetadata getMetadataToPauseStream(
BluetoothLeBroadcastMetadata metadata) {
BluetoothLeBroadcastMetadata.Builder metadataToUpdateBuilder =
new BluetoothLeBroadcastMetadata.Builder(metadata);
@@ -2921,7 +2922,7 @@ public class BassClientStateMachineTest {
.isEqualTo(Bytes.concat(metadataHeader, metadataPayload));
}
- private BluetoothLeBroadcastSubgroup createBroadcastSubgroup() {
+ private static BluetoothLeBroadcastSubgroup createBroadcastSubgroup() {
final long testAudioLocationFrontLeft = 0x01;
final long testAudioLocationFrontRight = 0x02;
// For BluetoothLeAudioContentMetadata
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java
index ff5324e4b0..e86952a165 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java
@@ -138,7 +138,7 @@ public class PeriodicAdvertisementResultTest {
}
/** Helper to generate test data for public broadcast. */
- private PublicBroadcastData generatePublicBroadcastData() {
+ private static PublicBroadcastData generatePublicBroadcastData() {
PublicBroadcastData.PublicBroadcastInfo info =
new PublicBroadcastData.PublicBroadcastInfo();
info.isEncrypted = true;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java
index b436231bbb..30374d57ae 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java
@@ -127,11 +127,11 @@ public final class BluetoothKeystoreServiceTest {
mBluetoothKeystoreService = null;
}
- private boolean isPrimaryUser() {
+ private static boolean isPrimaryUser() {
return Binder.getCallingUid() == Process.BLUETOOTH_UID;
}
- private void overwriteConfigFile(List<String> data) {
+ private static void overwriteConfigFile(List<String> data) {
try {
Files.write(Paths.get(CONFIG_FILE_PATH), data);
} catch (IOException e) {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java
index ba9de2c181..ac64b097ae 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java
@@ -443,7 +443,7 @@ public class CsipSetCoordinatorServiceTest {
}
/** Helper function to get byte array for a device address */
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
return Utils.getBytesFromAddress(device.getAddress());
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java
index 86923a6ca6..272e2e0b45 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java
@@ -710,7 +710,7 @@ public class HapClientServiceTest {
}
/** Helper function to get byte array for a device address */
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
index 43659c2422..cf9aaecf49 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
@@ -946,7 +946,7 @@ public class HeadsetClientStateMachineTest {
assertThat(currentCalls.get(0)).isEqualTo(call);
}
- private void assertName(int message, String message_name) {
+ private static void assertName(int message, String message_name) {
assertThat(HeadsetClientStateMachine.getMessageName(message)).isEqualTo(message_name);
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java
index 6bd0681322..d622a00666 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java
@@ -36,7 +36,7 @@ public class HfpClientCallTest {
private final BluetoothDevice mDevice = getTestDevice(32);
- private void assertCall(
+ private static void assertCall(
BluetoothDevice device,
int id,
int state,
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBinderTest.java
index 923a9cb7bc..26a10f68f1 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBinderTest.java
@@ -339,7 +339,7 @@ public class LeAudioBinderTest {
verify(mService).setCodecConfigPreference(groupId, inputConfig, outputConfig);
}
- private BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata() {
+ private static BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata() {
BluetoothLeAudioContentMetadata metadata =
new BluetoothLeAudioContentMetadata.Builder().build();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java
index b0acd9f706..8732e2ab19 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java
@@ -642,7 +642,7 @@ public class LeAudioBroadcastServiceTest {
verify(mCallbacks).onBroadcastUpdateFailed(anyInt(), anyInt());
}
- private BluetoothLeBroadcastSubgroup createBroadcastSubgroup() {
+ private static BluetoothLeBroadcastSubgroup createBroadcastSubgroup() {
BluetoothLeAudioCodecConfigMetadata codecMetadata =
new BluetoothLeAudioCodecConfigMetadata.Builder()
.setAudioLocation(TEST_AUDIO_LOCATION_FRONT_LEFT)
@@ -1689,7 +1689,7 @@ public class LeAudioBroadcastServiceTest {
}
}
- private BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata(
+ private static BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata(
BluetoothLeAudioContentMetadata contentMetadata,
@Nullable byte[] broadcastCode,
int numOfGroups) {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
index d805f2ca3b..9f608b8708 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
@@ -1286,7 +1286,7 @@ public class LeAudioServiceTest {
verify(mTbsService, times(0)).clearInbandRingtoneSupport(mSingleDevice);
}
- private BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata(
+ private static BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata(
BluetoothLeAudioContentMetadata contentMetadata,
@Nullable byte[] broadcastCode,
int numOfGroups) {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/BatchScanThrottlerTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_scan/BatchScanThrottlerTest.java
index 5e8f59fef5..2beee25a7e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_scan/BatchScanThrottlerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/BatchScanThrottlerTest.java
@@ -164,7 +164,8 @@ public class BatchScanThrottlerTest {
.isEqualTo(backoffIntervals[backoffIntervals.length - 1]);
}
- private long adjustExpectedInterval(long interval, boolean isFiltered, boolean isScreenOn) {
+ private static long adjustExpectedInterval(
+ long interval, boolean isFiltered, boolean isScreenOn) {
if (isFiltered) {
return interval;
}
@@ -175,13 +176,13 @@ public class BatchScanThrottlerTest {
return Math.max(interval, threshold);
}
- private long[] getBackoffIntervals(long baseInterval) {
+ private static long[] getBackoffIntervals(long baseInterval) {
return LongStream.range(0, BatchScanThrottler.BACKOFF_MULTIPLIERS.length)
.map(x -> BatchScanThrottler.BACKOFF_MULTIPLIERS[(int) x] * baseInterval)
.toArray();
}
- private ScanClient createBatchScanClient(long reportDelayMillis, boolean isFiltered) {
+ private static ScanClient createBatchScanClient(long reportDelayMillis, boolean isFiltered) {
ScanSettings scanSettings =
new ScanSettings.Builder()
.setScanMode(SCAN_MODE_BALANCED)
@@ -191,7 +192,7 @@ public class BatchScanThrottlerTest {
return new ScanClient(1, scanSettings, createScanFilterList(isFiltered), 1);
}
- private List<ScanFilter> createScanFilterList(boolean isFiltered) {
+ private static List<ScanFilter> createScanFilterList(boolean isFiltered) {
List<ScanFilter> scanFilterList = null;
if (isFiltered) {
scanFilterList = List.of(new ScanFilter.Builder().setDeviceName("TestName").build());
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java
index b7bbf9e2a7..6e396df67e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java
@@ -44,7 +44,7 @@ public final class MsftAdvMonitorTest {
private static final byte[] FAST_PAIR_SERVICE_DATA =
new byte[] {(byte) 0xfc, (byte) 0x12, (byte) 0x8e};
- private void assertMonitorConstants(MsftAdvMonitor monitor) {
+ private static void assertMonitorConstants(MsftAdvMonitor monitor) {
MsftAdvMonitor.Monitor mMonitor = monitor.getMonitor();
assertThat(mMonitor.rssi_threshold_high).isEqualTo(RSSI_THRESHOLD_HIGH);
assertThat(mMonitor.rssi_threshold_low).isEqualTo(RSSI_THRESHOLD_LOW);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanFilterQueueTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanFilterQueueTest.java
index 08952664e7..3359c2b48a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanFilterQueueTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanFilterQueueTest.java
@@ -240,7 +240,8 @@ public class ScanFilterQueueTest {
testServiceDataFilter(filter, true);
}
- private void testServiceDataFilter(ScanFilter filter, boolean partialServiceDataMatchResult) {
+ private static void testServiceDataFilter(
+ ScanFilter filter, boolean partialServiceDataMatchResult) {
ScanFilterQueue queue = new ScanFilterQueue();
queue.addScanFilter(filter);
ScanFilterQueue.Entry entry = queue.pop();
@@ -288,7 +289,7 @@ public class ScanFilterQueueTest {
.isEqualTo(partialServiceDataMatchResult);
}
- private boolean serviceDataMatches(byte[] filterData, byte[] resultData, byte[] mask) {
+ private static boolean serviceDataMatches(byte[] filterData, byte[] resultData, byte[] mask) {
if (filterData.length > resultData.length || filterData.length != mask.length) {
return false;
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanManagerTest.java
index 78e0475a0c..2312d11787 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanManagerTest.java
@@ -362,7 +362,8 @@ public class ScanManagerTest {
mMockAppScanStats);
}
- private List<ScanFilter> createScanFilterList(boolean isFiltered, boolean isEmptyFilter) {
+ private static List<ScanFilter> createScanFilterList(
+ boolean isFiltered, boolean isEmptyFilter) {
List<ScanFilter> scanFilterList = null;
if (isFiltered) {
scanFilterList = new ArrayList<>();
@@ -398,7 +399,7 @@ public class ScanManagerTest {
return scanSettings;
}
- private ScanSettings createScanSettingsWithPhy(int scanMode, int phy) {
+ private static ScanSettings createScanSettingsWithPhy(int scanMode, int phy) {
ScanSettings scanSettings;
scanSettings = new ScanSettings.Builder().setScanMode(scanMode).setPhy(phy).build();
@@ -416,32 +417,32 @@ public class ScanManagerTest {
return client;
}
- private Message createStartStopScanMessage(boolean isStartScan, Object obj) {
+ private static Message createStartStopScanMessage(boolean isStartScan, Object obj) {
Message message = new Message();
message.what = isStartScan ? ScanManager.MSG_START_BLE_SCAN : ScanManager.MSG_STOP_BLE_SCAN;
message.obj = obj;
return message;
}
- private Message createScreenOnOffMessage(boolean isScreenOn) {
+ private static Message createScreenOnOffMessage(boolean isScreenOn) {
Message message = new Message();
message.what = isScreenOn ? ScanManager.MSG_SCREEN_ON : ScanManager.MSG_SCREEN_OFF;
message.obj = null;
return message;
}
- private Message createLocationOnOffMessage(boolean isLocationOn) {
+ private static Message createLocationOnOffMessage(boolean isLocationOn) {
Message message = new Message();
message.what = isLocationOn ? ScanManager.MSG_RESUME_SCANS : ScanManager.MSG_SUSPEND_SCANS;
message.obj = null;
return message;
}
- private Message createImportanceMessage(boolean isForeground) {
+ private static Message createImportanceMessage(boolean isForeground) {
return createImportanceMessage(isForeground, Binder.getCallingUid());
}
- private Message createImportanceMessage(boolean isForeground, int uid) {
+ private static Message createImportanceMessage(boolean isForeground, int uid) {
final int importance =
isForeground
? ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE
@@ -452,7 +453,7 @@ public class ScanManagerTest {
return message;
}
- private Message createConnectingMessage(boolean isConnectingOn) {
+ private static Message createConnectingMessage(boolean isConnectingOn) {
Message message = new Message();
message.what =
isConnectingOn ? ScanManager.MSG_START_CONNECTING : ScanManager.MSG_STOP_CONNECTING;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java
index 221e8ad214..a336954afe 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java
@@ -2413,15 +2413,16 @@ public class BluetoothMapContentObserverTest {
verify(mProviderClient, never()).query(any(), any(), any(), any(), any(), any());
}
- private BluetoothMapContentObserver.Msg createSimpleMsg() {
+ private static BluetoothMapContentObserver.Msg createSimpleMsg() {
return new BluetoothMapContentObserver.Msg(1, 1L, 1);
}
- private BluetoothMapContentObserver.Msg createMsgWithTypeAndThreadId(int type, int threadId) {
+ private static BluetoothMapContentObserver.Msg createMsgWithTypeAndThreadId(
+ int type, int threadId) {
return new BluetoothMapContentObserver.Msg(1, type, threadId, 1);
}
- private void setFolderStructureWithTelecomAndMsg(
+ private static void setFolderStructureWithTelecomAndMsg(
BluetoothMapFolderElement folderElement, String folderName, long folderId) {
folderElement.addFolder("telecom");
folderElement.getSubFolder("telecom").addFolder("msg");
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java
index b2c3d00c54..4d53d787b6 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java
@@ -290,7 +290,7 @@ public class BluetoothMapObexServerTest {
assertThat(mParams.getFilterMessageType()).isEqualTo(expectedMask);
}
- private void setUpBluetoothMapAppParams(BluetoothMapAppParams params) {
+ private static void setUpBluetoothMapAppParams(BluetoothMapAppParams params) {
params.setPresenceAvailability(1);
params.setPresenceStatus("test_presence_status");
params.setLastActivity(0);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java
index 1302bb4c08..b696cef960 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java
@@ -235,7 +235,7 @@ public class BluetoothPbapVcardManagerNestedClassesTest {
assertThat(getContactsIdFromCursor(resultCursor, 2)).isEqualTo(1004);
}
- private long getContactsIdFromCursor(Cursor cursor, int position) {
+ private static long getContactsIdFromCursor(Cursor cursor, int position) {
int index = cursor.getColumnIndex(ContactsContract.Data.CONTACT_ID);
cursor.moveToPosition(position);
return cursor.getLong(index);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/CallLogPullRequestTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/CallLogPullRequestTest.java
index fdadac66b8..b3669a14f6 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/CallLogPullRequestTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/CallLogPullRequestTest.java
@@ -198,7 +198,7 @@ public class CallLogPullRequestTest {
assertThat(contact.getTimesContacted()).isEqualTo(1);
}
- private VCardProperty createProperty(String name, String value) {
+ private static VCardProperty createProperty(String name, String value) {
VCardProperty property = new VCardProperty();
property.setName(name);
property.setValues(value);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java
index 5126cd500e..4fc428ebbe 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java
@@ -402,7 +402,7 @@ public class PbapClientAccountManagerTest {
mBroadcastReceiver.onReceive(mMockContext, intent);
}
- private Account getAccountForDevice(BluetoothDevice device) {
+ private static Account getAccountForDevice(BluetoothDevice device) {
return new Account(device.getAddress(), "com.android.bluetooth.pbabclient.account");
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java
index 168f9b782c..66070377ed 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java
@@ -552,11 +552,11 @@ public class PbapClientContactsStorageTest {
assertThat(mStorage.isStorageReady()).isTrue();
}
- private Account getAccountForDevice(BluetoothDevice device) {
+ private static Account getAccountForDevice(BluetoothDevice device) {
return new Account(device.getAddress(), ACCOUNT_TYPE);
}
- private List<VCardEntry> getMockContacts(int numContacts) {
+ private static List<VCardEntry> getMockContacts(int numContacts) {
List<VCardEntry> contacts = new ArrayList<VCardEntry>();
for (int i = 0; i < numContacts; i++) {
VCardEntry card = new VCardEntry(VCardConfig.VCARD_TYPE_V21_GENERIC);
@@ -570,7 +570,7 @@ public class PbapClientContactsStorageTest {
return contacts;
}
- private List<VCardEntry> getMockCallHistory(int type, int numEntries) {
+ private static List<VCardEntry> getMockCallHistory(int type, int numEntries) {
String typeIndicator = "";
if (type == CallLog.Calls.INCOMING_TYPE) {
typeIndicator = "RECEIVED";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java
index d8dc5d4e4b..b48329a9c3 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java
@@ -829,7 +829,7 @@ public class PbapClientStateMachineTest {
return new PbapSdpRecord(mTestDevice, sdpRecord);
}
- private Account getAccountForDevice(BluetoothDevice device) {
+ private static Account getAccountForDevice(BluetoothDevice device) {
return new Account(device.getAddress(), "com.android.bluetooth.pbabclient.account");
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java
index 214a08bf27..6537f475b5 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java
@@ -548,7 +548,7 @@ public class PbapPhonebookTest {
// * Utilities
// *********************************************************************************************
- private InputStream toUtf8Stream(String s) {
+ private static InputStream toUtf8Stream(String s) {
return new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
}
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java
index 77a5453bdf..d0e462ca66 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java
@@ -71,14 +71,14 @@ public class PhonebookPullRequestTest {
assertThat(mRequest.complete).isTrue();
}
- private VCardProperty createProperty(String name, String value) {
+ private static VCardProperty createProperty(String name, String value) {
VCardProperty property = new VCardProperty();
property.setName(name);
property.setValues(value);
return property;
}
- private VCardEntry createEntry(int propertyCount) {
+ private static VCardEntry createEntry(int propertyCount) {
VCardEntry entry = new VCardEntry();
for (int i = 0; i < propertyCount; i++) {
entry.addProperty(createProperty(VCardConstants.PROPERTY_TEL, Integer.toString(i)));
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java
index 5f50e76ca2..44744c837a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java
@@ -168,7 +168,7 @@ public class RequestPullPhonebookMetadataTest {
return sendResponse(op, replyHeaders, null);
}
- public byte[] shortToByteArray(short s) {
+ public static byte[] shortToByteArray(short s) {
ByteBuffer ret = ByteBuffer.allocate(2);
ret.putShort(s);
return ret.array();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sdp/DipTest.java b/android/app/tests/unit/src/com/android/bluetooth/sdp/DipTest.java
index ce797f2d30..c9c3c238e2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/sdp/DipTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/sdp/DipTest.java
@@ -82,7 +82,7 @@ public class DipTest {
SdpManagerNativeInterface.setInstance(null);
}
- private void verifyDipSdpRecordIntent(
+ private static void verifyDipSdpRecordIntent(
ArgumentCaptor<Intent> intentArgument,
int status,
BluetoothDevice device,
diff --git a/framework/java/android/bluetooth/BluetoothA2dp.java b/framework/java/android/bluetooth/BluetoothA2dp.java
index da949d94d3..06e98105cd 100644
--- a/framework/java/android/bluetooth/BluetoothA2dp.java
+++ b/framework/java/android/bluetooth/BluetoothA2dp.java
@@ -1125,6 +1125,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
return false;
}
+ @SuppressWarnings("MethodCanBeStatic")
private void verifyDeviceNotNull(BluetoothDevice device, String methodName) {
if (device == null) {
Log.e(TAG, methodName + ": device param is null");
@@ -1132,7 +1133,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
}
}
- private boolean isValidDevice(BluetoothDevice device) {
+ private static boolean isValidDevice(BluetoothDevice device) {
if (device == null) return false;
if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index 1d8bc20493..bf5ec5ae21 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -3337,7 +3337,7 @@ public final class BluetoothAdapter {
@RequiresBluetoothConnectPermission
@RequiresPermission(BLUETOOTH_CONNECT)
- private BluetoothServerSocket createNewRfcommSocketAndRecord(
+ private static BluetoothServerSocket createNewRfcommSocketAndRecord(
String name, UUID uuid, boolean auth, boolean encrypt) throws IOException {
BluetoothServerSocket socket;
socket =
@@ -4048,7 +4048,7 @@ public final class BluetoothAdapter {
}
}
- private Set<BluetoothDevice> toDeviceSet(List<BluetoothDevice> devices) {
+ private static Set<BluetoothDevice> toDeviceSet(List<BluetoothDevice> devices) {
Set<BluetoothDevice> deviceSet = new HashSet<BluetoothDevice>(devices);
return Collections.unmodifiableSet(deviceSet);
}
@@ -5807,7 +5807,8 @@ public final class BluetoothAdapter {
}
@RequiresPermission(BLUETOOTH_PRIVILEGED)
- void unregisterFromService(IBluetooth service, IBluetoothHciVendorSpecificCallback stub) {
+ static void unregisterFromService(
+ IBluetooth service, IBluetoothHciVendorSpecificCallback stub) {
if (service == null) {
return;
}
diff --git a/framework/java/android/bluetooth/BluetoothGattCharacteristic.java b/framework/java/android/bluetooth/BluetoothGattCharacteristic.java
index 9d7a95236b..15aebc083d 100644
--- a/framework/java/android/bluetooth/BluetoothGattCharacteristic.java
+++ b/framework/java/android/bluetooth/BluetoothGattCharacteristic.java
@@ -681,29 +681,29 @@ public class BluetoothGattCharacteristic implements Parcelable {
}
/** Returns the size of a give value type. */
- private int getTypeLen(int formatType) {
+ private static int getTypeLen(int formatType) {
return formatType & 0xF;
}
/** Convert a signed byte to an unsigned int. */
- private int unsignedByteToInt(byte b) {
+ private static int unsignedByteToInt(byte b) {
return b & 0xFF;
}
/** Convert signed bytes to a 16-bit unsigned int. */
- private int unsignedBytesToInt(byte b0, byte b1) {
+ private static int unsignedBytesToInt(byte b0, byte b1) {
return (unsignedByteToInt(b0) + (unsignedByteToInt(b1) << 8));
}
/** Convert signed bytes to a 32-bit unsigned int. */
- private int unsignedBytesToInt(byte b0, byte b1, byte b2, byte b3) {
+ private static int unsignedBytesToInt(byte b0, byte b1, byte b2, byte b3) {
return (unsignedByteToInt(b0) + (unsignedByteToInt(b1) << 8))
+ (unsignedByteToInt(b2) << 16)
+ (unsignedByteToInt(b3) << 24);
}
/** Convert signed bytes to a 16-bit short float value. */
- private float bytesToFloat(byte b0, byte b1) {
+ private static float bytesToFloat(byte b0, byte b1) {
int mantissa =
unsignedToSigned(unsignedByteToInt(b0) + ((unsignedByteToInt(b1) & 0x0F) << 8), 12);
int exponent = unsignedToSigned(unsignedByteToInt(b1) >> 4, 4);
@@ -711,7 +711,7 @@ public class BluetoothGattCharacteristic implements Parcelable {
}
/** Convert signed bytes to a 32-bit short float value. */
- private float bytesToFloat(byte b0, byte b1, byte b2, byte b3) {
+ private static float bytesToFloat(byte b0, byte b1, byte b2, byte b3) {
int mantissa =
unsignedToSigned(
unsignedByteToInt(b0)
@@ -722,7 +722,7 @@ public class BluetoothGattCharacteristic implements Parcelable {
}
/** Convert an unsigned integer value to a two's-complement encoded signed value. */
- private int unsignedToSigned(int unsigned, int size) {
+ private static int unsignedToSigned(int unsigned, int size) {
if ((unsigned & (1 << (size - 1))) != 0) {
unsigned = -1 * ((1 << (size - 1)) - (unsigned & ((1 << (size - 1)) - 1)));
}
@@ -730,7 +730,7 @@ public class BluetoothGattCharacteristic implements Parcelable {
}
/** Convert an integer into the signed bits of a given length. */
- private int intToSignedBits(int i, int size) {
+ private static int intToSignedBits(int i, int size) {
if (i < 0) {
i = (1 << (size - 1)) + (i & ((1 << (size - 1)) - 1));
}
diff --git a/framework/java/android/bluetooth/BluetoothHapClient.java b/framework/java/android/bluetooth/BluetoothHapClient.java
index c11249bc9e..08642c3800 100644
--- a/framework/java/android/bluetooth/BluetoothHapClient.java
+++ b/framework/java/android/bluetooth/BluetoothHapClient.java
@@ -1085,7 +1085,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
s -> s.setPresetNameForGroup(groupId, presetIndex, name, mAttributionSource));
}
- private boolean isValidDevice(BluetoothDevice device) {
+ private static boolean isValidDevice(BluetoothDevice device) {
if (device == null) return false;
if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
diff --git a/framework/java/android/bluetooth/BluetoothHearingAid.java b/framework/java/android/bluetooth/BluetoothHearingAid.java
index 29b00611d2..0a4e829216 100644
--- a/framework/java/android/bluetooth/BluetoothHearingAid.java
+++ b/framework/java/android/bluetooth/BluetoothHearingAid.java
@@ -775,14 +775,14 @@ public final class BluetoothHearingAid implements BluetoothProfile {
return false;
}
- private void verifyDeviceNotNull(BluetoothDevice device, String methodName) {
+ private static void verifyDeviceNotNull(BluetoothDevice device, String methodName) {
if (device == null) {
Log.e(TAG, methodName + ": device param is null");
throw new IllegalArgumentException("Device cannot be null");
}
}
- private boolean isValidDevice(BluetoothDevice device) {
+ private static boolean isValidDevice(BluetoothDevice device) {
if (device == null) return false;
if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
diff --git a/framework/java/android/bluetooth/BluetoothHidDevice.java b/framework/java/android/bluetooth/BluetoothHidDevice.java
index 230b5dfaaa..8fd7dee6f7 100644
--- a/framework/java/android/bluetooth/BluetoothHidDevice.java
+++ b/framework/java/android/bluetooth/BluetoothHidDevice.java
@@ -786,7 +786,7 @@ public final class BluetoothHidDevice implements BluetoothProfile {
return false;
}
- private boolean isValidDevice(BluetoothDevice device) {
+ private static boolean isValidDevice(BluetoothDevice device) {
if (device == null) return false;
if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java
index d71068308f..09683a912a 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudio.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudio.java
@@ -1353,7 +1353,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
}
}
- private boolean isValidDevice(@Nullable BluetoothDevice device) {
+ private static boolean isValidDevice(@Nullable BluetoothDevice device) {
if (device == null) return false;
if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
index 0541d4898c..22453839cd 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
@@ -304,7 +304,7 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
out.writeInt(mMaxOctetsPerFrame);
}
- private String sampleRateToString(@SampleRate int sampleRateBit) {
+ private static String sampleRateToString(@SampleRate int sampleRateBit) {
switch (sampleRateBit) {
case SAMPLE_RATE_NONE:
return "None";
@@ -339,7 +339,7 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
}
}
- private String frameDurationToString(@FrameDuration int frameDurationBit) {
+ private static String frameDurationToString(@FrameDuration int frameDurationBit) {
switch (frameDurationBit) {
case FRAME_DURATION_NONE:
return "None";
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecStatus.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecStatus.java
index 2997cba518..7089529638 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecStatus.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecStatus.java
@@ -128,7 +128,7 @@ public final class BluetoothLeAudioCodecStatus implements Parcelable {
return c1.containsAll(c2);
}
- private boolean isCodecConfigSelectable(
+ private static boolean isCodecConfigSelectable(
BluetoothLeAudioCodecConfig codecConfig, BluetoothLeAudioCodecConfig selectableConfig) {
if (codecConfig.getCodecType() != selectableConfig.getCodecType()) {
return false;
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcast.java b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
index eb65dd0841..4023184fee 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcast.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
@@ -778,7 +778,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
mAdapter.closeProfileProxy(this);
}
- private BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata(
+ private static BluetoothLeBroadcastSettings buildBroadcastSettingsFromMetadata(
BluetoothLeAudioContentMetadata contentMetadata, @Nullable byte[] broadcastCode) {
BluetoothLeBroadcastSubgroupSettings.Builder subgroupBuilder =
new BluetoothLeBroadcastSubgroupSettings.Builder()
diff --git a/framework/java/android/bluetooth/BluetoothPbap.java b/framework/java/android/bluetooth/BluetoothPbap.java
index d4c1dfcc7a..afa796b85e 100644
--- a/framework/java/android/bluetooth/BluetoothPbap.java
+++ b/framework/java/android/bluetooth/BluetoothPbap.java
@@ -297,7 +297,7 @@ public class BluetoothPbap implements BluetoothProfile {
return false;
}
- private boolean isValidDevice(BluetoothDevice device) {
+ private static boolean isValidDevice(BluetoothDevice device) {
if (device == null) return false;
if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
diff --git a/framework/java/android/bluetooth/BluetoothSocket.java b/framework/java/android/bluetooth/BluetoothSocket.java
index c151a483ef..7c2f524fa0 100644
--- a/framework/java/android/bluetooth/BluetoothSocket.java
+++ b/framework/java/android/bluetooth/BluetoothSocket.java
@@ -1283,7 +1283,7 @@ public final class BluetoothSocket implements Closeable {
return mPfd;
}
- private String convertAddr(final byte[] addr) {
+ private static String convertAddr(final byte[] addr) {
return String.format(
Locale.US,
"%02X:%02X:%02X:%02X:%02X:%02X",
@@ -1394,7 +1394,7 @@ public final class BluetoothSocket implements Closeable {
}
}
- private int readAll(InputStream is, byte[] b) throws IOException {
+ private static int readAll(InputStream is, byte[] b) throws IOException {
int left = b.length;
while (left > 0) {
int ret = is.read(b, b.length - left, left);
@@ -1415,7 +1415,7 @@ public final class BluetoothSocket implements Closeable {
return b.length;
}
- private int readInt(InputStream is) throws IOException {
+ private static int readInt(InputStream is) throws IOException {
byte[] ibytes = new byte[4];
int ret = readAll(is, ibytes);
if (VDBG) Log.d(TAG, "inputStream.read ret: " + ret);
diff --git a/framework/java/android/bluetooth/OobData.java b/framework/java/android/bluetooth/OobData.java
index e699ec541c..48b107c7c0 100644
--- a/framework/java/android/bluetooth/OobData.java
+++ b/framework/java/android/bluetooth/OobData.java
@@ -862,8 +862,7 @@ public final class OobData implements Parcelable {
* @hide
*/
@Override
- @NonNull
- public String toString() {
+ public @NonNull String toString() {
return "OobData: \n\t"
// Both
+ "Device Address With Type: "
@@ -900,13 +899,11 @@ public final class OobData implements Parcelable {
+ "\n\t";
}
- @NonNull
- private String toHexString(int b) {
+ private static @NonNull String toHexString(int b) {
return toHexString(new byte[] {(byte) b});
}
- @NonNull
- private String toHexString(byte[] array) {
+ private static @NonNull String toHexString(byte[] array) {
if (array == null) return "null";
StringBuilder builder = new StringBuilder(array.length * 2);
for (byte b : array) {
diff --git a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
index d5c5f64df3..f4fee92e69 100644
--- a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
+++ b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
@@ -780,7 +780,7 @@ public final class BluetoothLeAdvertiser {
return size;
}
- private int byteLength(byte[] array) {
+ private static int byteLength(byte[] array) {
return array == null ? 0 : array.length;
}
@@ -896,7 +896,7 @@ public final class BluetoothLeAdvertiser {
}
@SuppressLint("AndroidFrameworkBluetoothPermission")
- private void postStartSetFailure(
+ private static void postStartSetFailure(
Handler handler, final AdvertisingSetCallback callback, final int error) {
handler.post(
new Runnable() {
diff --git a/framework/java/android/bluetooth/le/BluetoothLeScanner.java b/framework/java/android/bluetooth/le/BluetoothLeScanner.java
index 02f48fb8d8..cd94688f2b 100644
--- a/framework/java/android/bluetooth/le/BluetoothLeScanner.java
+++ b/framework/java/android/bluetooth/le/BluetoothLeScanner.java
@@ -636,7 +636,7 @@ public final class BluetoothLeScanner {
return false;
}
- private boolean isSettingsAndFilterComboAllowed(
+ private static boolean isSettingsAndFilterComboAllowed(
ScanSettings settings, List<ScanFilter> filterList) {
final int callbackType = settings.getCallbackType();
// If onlost/onfound is requested, a non-empty filter is expected
diff --git a/framework/java/android/bluetooth/le/ScanSettings.java b/framework/java/android/bluetooth/le/ScanSettings.java
index 014df2f4f0..e78f46c8d4 100644
--- a/framework/java/android/bluetooth/le/ScanSettings.java
+++ b/framework/java/android/bluetooth/le/ScanSettings.java
@@ -357,7 +357,7 @@ public final class ScanSettings implements Parcelable {
}
// Returns true if the callbackType is valid.
- private boolean isValidCallbackType(int callbackType) {
+ private static boolean isValidCallbackType(int callbackType) {
if (callbackType == CALLBACK_TYPE_ALL_MATCHES
|| callbackType == CALLBACK_TYPE_ALL_MATCHES_AUTO_BATCH
|| callbackType == CALLBACK_TYPE_FIRST_MATCH
diff --git a/service/src/com/android/server/bluetooth/BluetoothManagerService.java b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
index 20d8dbf073..6cd63181da 100644
--- a/service/src/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
@@ -692,7 +692,7 @@ class BluetoothManagerService {
}
/** Returns true if satellite mode is turned on. */
- private boolean isSatelliteModeOn() {
+ private static boolean isSatelliteModeOn() {
return SatelliteModeListener.isOn();
}
@@ -750,7 +750,7 @@ class BluetoothManagerService {
Log.d(TAG, "loadStoredNameAndAddress: Name=" + mName + ", Address=" + logAddress(mAddress));
}
- private String logAddress(String address) {
+ private static String logAddress(String address) {
if (address == null) {
return "[address is null]";
}
@@ -1918,7 +1918,7 @@ class BluetoothManagerService {
intent, UserHandle.ALL, null, getTempAllowlistBroadcastOptions());
}
- private boolean isBleState(int state) {
+ private static boolean isBleState(int state) {
switch (state) {
case STATE_BLE_ON:
case STATE_BLE_TURNING_ON:
@@ -2233,7 +2233,7 @@ class BluetoothManagerService {
}
}
- private void dumpBluetoothFlags(PrintWriter writer) {
+ private static void dumpBluetoothFlags(PrintWriter writer) {
writer.println("🚩Flag dump:");
Arrays.stream(Flags.class.getDeclaredMethods())
.forEach(
@@ -2500,8 +2500,8 @@ class BluetoothManagerService {
disableComponents(pm, packageInfo.providers, packageName, null);
}
- private <T extends android.content.pm.ComponentInfo> void disableComponents(
- PackageManager pm, T[] components, String packageName, List<String> componentsToKeep) {
+ private static <T extends android.content.pm.ComponentInfo> void disableComponents(
+ PackageManager pm, T[] components, String packageName, List<String> componentsToKeep) {
if (components == null) {
return;
}
diff --git a/service/tests/src/com/android/server/bluetooth/BluetoothServiceBinderTest.java b/service/tests/src/com/android/server/bluetooth/BluetoothServiceBinderTest.java
index 40e6f4b4b7..07466e59c4 100644
--- a/service/tests/src/com/android/server/bluetooth/BluetoothServiceBinderTest.java
+++ b/service/tests/src/com/android/server/bluetooth/BluetoothServiceBinderTest.java
@@ -383,7 +383,7 @@ public class BluetoothServiceBinderTest {
// *********************************************************************************************
// Utility method used in tests
- private void verifyAndClearMock(Object o) {
+ private static void verifyAndClearMock(Object o) {
assertThat(mockingDetails(o).isMock() || mockingDetails(o).isSpy()).isTrue();
verifyNoMoreInteractions(o);
clearInvocations(o);