re-apply formatter on java code
Bug: 311772251
Flag: EXEMPT refactor
Test: m .
Change-Id: Id934222428356efac78a6b91bfe5736d9d96af54
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
index ce91821..6204db9 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -1221,7 +1221,7 @@
switch (enabled) {
case BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED -> enableOptionalCodecs(device);
case BluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED -> disableOptionalCodecs(device);
- // OPTIONAL_CODECS_PREF_UNKNOWN Enable optional codec by default.
+ // OPTIONAL_CODECS_PREF_UNKNOWN Enable optional codec by default.
default -> {
setOptionalCodecsEnabled(device, BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
enableOptionalCodecs(device);
diff --git a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java
index 8518309..57229bc 100644
--- a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java
+++ b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java
@@ -140,23 +140,23 @@
requestAudioFocusIfNone();
}
}
- // Audio stream has stopped, maintain focus but stop avrcp updates.
+ // Audio stream has stopped, maintain focus but stop avrcp updates.
case SRC_STR_STOP -> {}
- // Local play command, gain focus and start avrcp updates.
+ // Local play command, gain focus and start avrcp updates.
case SNK_PLAY -> requestAudioFocusIfNone();
- // Local pause command, maintain focus but stop avrcp updates.
+ // Local pause command, maintain focus but stop avrcp updates.
case SNK_PAUSE -> mStreamAvailable = false;
- // Remote play command.
+ // Remote play command.
case SRC_PLAY -> {
mStreamAvailable = true;
if (isIotDevice() || isTvDevice() || shouldRequestFocus()) {
requestAudioFocusIfNone();
}
}
- // Remote pause command, stop avrcp updates.
+ // Remote pause command, stop avrcp updates.
case SRC_PAUSE -> mStreamAvailable = false;
case REQUEST_FOCUS -> requestAudioFocusIfNone();
- // Remote device has disconnected, restore everything to default state.
+ // Remote device has disconnected, restore everything to default state.
case DISCONNECT -> mStreamAvailable = false;
case AUDIO_FOCUS_CHANGE -> {
@@ -170,10 +170,10 @@
mAudioFocus = focusChangeCode;
// message.obj is the newly granted audio focus.
switch (mAudioFocus) {
- // Begin playing audio
+ // Begin playing audio
case AudioManager.AUDIOFOCUS_GAIN -> startFluorideStreaming();
- // Make the volume duck.
+ // Make the volume duck.
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> {
int duckPercent =
mContext.getResources()
@@ -187,9 +187,9 @@
setFluorideAudioTrackGain(duckRatio);
}
- // Temporary loss of focus. Set gain to zero.
+ // Temporary loss of focus. Set gain to zero.
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> setFluorideAudioTrackGain(0);
- // Permanent loss of focus probably due to another audio app, abandon focus
+ // Permanent loss of focus probably due to another audio app, abandon focus
case AudioManager.AUDIOFOCUS_LOSS -> abandonAudioFocus();
default -> {} // Nothing to do
}
diff --git a/android/app/src/com/android/bluetooth/audio_util/BrowsablePlayerConnector.java b/android/app/src/com/android/bluetooth/audio_util/BrowsablePlayerConnector.java
index fb010fd..7dea2ca 100644
--- a/android/app/src/com/android/bluetooth/audio_util/BrowsablePlayerConnector.java
+++ b/android/app/src/com/android/bluetooth/audio_util/BrowsablePlayerConnector.java
@@ -130,57 +130,52 @@
Log.d(TAG, "Received a message: msg.what=" + msg.what);
switch (msg.what) {
case MSG_GET_FOLDER_ITEMS_CB -> {
- int status = msg.arg1;
- int results_size = msg.arg2;
- BrowsedPlayerWrapper wrapper = (BrowsedPlayerWrapper) msg.obj;
+ int status = msg.arg1;
+ int results_size = msg.arg2;
+ BrowsedPlayerWrapper wrapper = (BrowsedPlayerWrapper) msg.obj;
+ // If we failed to remove the wrapper from the pending set, that
+ // means a timeout occurred and the callback was triggered afterwards
+ // or the connector was cleaned up.
+ if (!mPendingPlayers.remove(wrapper)) {
+ return;
+ }
+
+ if (status == BrowsedPlayerWrapper.STATUS_SUCCESS && results_size != 0) {
+ Log.i(
+ TAG,
+ "Successfully added package to results: " + wrapper.getPackageName());
+ mResults.add(wrapper);
+ }
+ }
+ case MSG_CONNECT_CB -> {
+ BrowsedPlayerWrapper wrapper = (BrowsedPlayerWrapper) msg.obj;
+
+ if (msg.arg1 != BrowsedPlayerWrapper.STATUS_SUCCESS) {
+ Log.i(TAG, wrapper.getPackageName() + " is not browsable");
// If we failed to remove the wrapper from the pending set, that
// means a timeout occurred and the callback was triggered afterwards
- // or the connector was cleaned up.
if (!mPendingPlayers.remove(wrapper)) {
return;
}
-
- if (status == BrowsedPlayerWrapper.STATUS_SUCCESS && results_size != 0) {
- Log.i(
- TAG,
- "Successfully added package to results: "
- + wrapper.getPackageName());
- mResults.add(wrapper);
- }
+ break;
}
- case MSG_CONNECT_CB -> {
- BrowsedPlayerWrapper wrapper = (BrowsedPlayerWrapper) msg.obj;
- if (msg.arg1 != BrowsedPlayerWrapper.STATUS_SUCCESS) {
- Log.i(TAG, wrapper.getPackageName() + " is not browsable");
- // If we failed to remove the wrapper from the pending set, that
- // means a timeout occurred and the callback was triggered afterwards
- if (!mPendingPlayers.remove(wrapper)) {
- return;
- }
- break;
- }
-
- // Check to see if the root folder has any items
- Log.i(TAG, "Checking root contents for " + wrapper.getPackageName());
- wrapper.getFolderItems(
- wrapper.getRootId(),
- (int status, String mediaId, List<ListItem> results) -> {
- // Send the response as a message so that it is properly
- // synchronized
- obtainMessage(
- MSG_GET_FOLDER_ITEMS_CB,
- status,
- results.size(),
- wrapper)
- .sendToTarget();
- });
- }
+ // Check to see if the root folder has any items
+ Log.i(TAG, "Checking root contents for " + wrapper.getPackageName());
+ wrapper.getFolderItems(
+ wrapper.getRootId(),
+ (int status, String mediaId, List<ListItem> results) -> {
+ // Send the response as a message so that it is properly
+ // synchronized
+ obtainMessage(MSG_GET_FOLDER_ITEMS_CB, status, results.size(), wrapper)
+ .sendToTarget();
+ });
+ }
case MSG_TIMEOUT -> {
- Log.v(TAG, "Timed out waiting for players");
- removePendingPlayers();
- }
+ Log.v(TAG, "Timed out waiting for players");
+ removePendingPlayers();
+ }
default -> {} // Nothing to do
}
diff --git a/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java b/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java
index e958313..ae24581 100644
--- a/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java
+++ b/android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java
@@ -190,9 +190,10 @@
// If there were any active players and we don't already have one due to the Media
// Framework Callbacks then set the highest priority one to active
if (mActivePlayerId == 0 && mMediaPlayers.size() > 0) {
- String packageName = (mMediaSessionManager != null)
- ? mMediaSessionManager.getMediaKeyEventSessionPackageName()
- : "";
+ String packageName =
+ (mMediaSessionManager != null)
+ ? mMediaSessionManager.getMediaKeyEventSessionPackageName()
+ : "";
if (!TextUtils.isEmpty(packageName) && haveMediaPlayer(packageName)) {
Log.i(TAG, "Set active player to MediaKeyEvent session = " + packageName);
setActivePlayer(mMediaPlayerIds.get(packageName));
@@ -1319,12 +1320,13 @@
AudioPlaybackConfiguration activeConfig = null;
for (AudioPlaybackConfiguration config : configs) {
if (config.isActive()
- && (((config.getAudioAttributes().getUsage()
- == AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE)
- && (config.getAudioAttributes().getContentType()
- == AudioAttributes.CONTENT_TYPE_SPEECH))
- || config.getAudioAttributes().getUsage()
- == AudioAttributes.USAGE_MEDIA)) {
+ && (((config.getAudioAttributes().getUsage()
+ == AudioAttributes
+ .USAGE_ASSISTANCE_NAVIGATION_GUIDANCE)
+ && (config.getAudioAttributes().getContentType()
+ == AudioAttributes.CONTENT_TYPE_SPEECH))
+ || config.getAudioAttributes().getUsage()
+ == AudioAttributes.USAGE_MEDIA)) {
activeConfig = config;
isActive = true;
}
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpVolumeManager.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpVolumeManager.java
index f21a35e..5daa0fd 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpVolumeManager.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpVolumeManager.java
@@ -18,7 +18,6 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.SharedPreferences;
diff --git a/android/app/src/com/android/bluetooth/avrcp/helpers/AvrcpPassthrough.java b/android/app/src/com/android/bluetooth/avrcp/helpers/AvrcpPassthrough.java
index 4fe5c89..a0d90d7 100644
--- a/android/app/src/com/android/bluetooth/avrcp/helpers/AvrcpPassthrough.java
+++ b/android/app/src/com/android/bluetooth/avrcp/helpers/AvrcpPassthrough.java
@@ -126,7 +126,7 @@
case BluetoothAvrcp.PASSTHROUGH_ID_ANGLE:
case BluetoothAvrcp.PASSTHROUGH_ID_SUBPICT:
case BluetoothAvrcp.PASSTHROUGH_ID_VENDOR:
- // Fallthrough for all unknown key mappings
+ // Fallthrough for all unknown key mappings
default:
return KeyEvent.KEYCODE_UNKNOWN;
}
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java
index 404c973..1b87222 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java
@@ -431,7 +431,7 @@
transitionTo(mConnecting);
}
case CLEANUP -> mService.removeStateMachine(AvrcpControllerStateMachine.this);
- // Wait until we're connected to process this
+ // Wait until we're connected to process this
case ACTIVE_DEVICE_CHANGE -> deferMessage(message);
default -> {} // Nothing to do
}
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java
index 5a64436..e1ee7f4 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java
@@ -365,10 +365,10 @@
}
BipImageDescriptor.Builder builder = new BipImageDescriptor.Builder();
switch (mDownloadScheme) {
- // BIP Specification says a blank/null descriptor signals to pull the native format
+ // BIP Specification says a blank/null descriptor signals to pull the native format
case SCHEME_NATIVE:
return null;
- // AVRCP 1.6.2 defined "thumbnail" size is guaranteed so we'll do that for now
+ // AVRCP 1.6.2 defined "thumbnail" size is guaranteed so we'll do that for now
case SCHEME_THUMBNAIL:
default:
builder.setEncoding(BipEncoding.JPEG);
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptor.java b/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptor.java
index 3dd74e7..7bb534d 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptor.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptor.java
@@ -185,18 +185,18 @@
int event = xpp.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
if (event == XmlPullParser.START_TAG) {
- String tag = xpp.getName();
+ String tag = xpp.getName();
if (!tag.equals("image")) {
Log.w(TAG, "Unrecognized tag in x-bt/img-Description object: " + tag);
} else {
- mEncoding = new BipEncoding(xpp.getAttributeValue(null, "encoding"));
- mPixel = new BipPixel(xpp.getAttributeValue(null, "pixel"));
- mSize = parseInt(xpp.getAttributeValue(null, "size"));
- mMaxSize = parseInt(xpp.getAttributeValue(null, "maxsize"));
- mTransformation =
- new BipTransformation(
- xpp.getAttributeValue(null, "transformation"));
- }
+ mEncoding = new BipEncoding(xpp.getAttributeValue(null, "encoding"));
+ mPixel = new BipPixel(xpp.getAttributeValue(null, "pixel"));
+ mSize = parseInt(xpp.getAttributeValue(null, "size"));
+ mMaxSize = parseInt(xpp.getAttributeValue(null, "maxsize"));
+ mTransformation =
+ new BipTransformation(
+ xpp.getAttributeValue(null, "transformation"));
+ }
}
event = xpp.next();
}
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 0ea9648..409cb18 100644
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageProperties.java
+++ b/android/app/src/com/android/bluetooth/avrcpcontroller/bip/BipImageProperties.java
@@ -168,36 +168,36 @@
int event = xpp.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
if (event == XmlPullParser.START_TAG) {
- String tag = xpp.getName();
- if (tag.equals("image-properties")) {
- mVersion = xpp.getAttributeValue(null, "version");
- mImageHandle = xpp.getAttributeValue(null, "handle");
- mFriendlyName = xpp.getAttributeValue(null, "friendly-name");
- } else if (tag.equals("native")) {
- String encoding = xpp.getAttributeValue(null, "encoding");
- String pixel = xpp.getAttributeValue(null, "pixel");
- String size = xpp.getAttributeValue(null, "size");
- addNativeFormat(BipImageFormat.parseNative(encoding, pixel, size));
- } else if (tag.equals("variant")) {
- String encoding = xpp.getAttributeValue(null, "encoding");
- String pixel = xpp.getAttributeValue(null, "pixel");
- String maxSize = xpp.getAttributeValue(null, "maxsize");
- String trans = xpp.getAttributeValue(null, "transformation");
- addVariantFormat(
- BipImageFormat.parseVariant(encoding, pixel, maxSize, trans));
- } else if (tag.equals("attachment")) {
- String contentType = xpp.getAttributeValue(null, "content-type");
- String name = xpp.getAttributeValue(null, "name");
- String charset = xpp.getAttributeValue(null, "charset");
- String size = xpp.getAttributeValue(null, "size");
- String created = xpp.getAttributeValue(null, "created");
- String modified = xpp.getAttributeValue(null, "modified");
- addAttachment(
- new BipAttachmentFormat(
- contentType, charset, name, size, created, modified));
- } else {
- Log.w(TAG, "Unrecognized tag in x-bt/img-properties object: " + tag);
- }
+ String tag = xpp.getName();
+ if (tag.equals("image-properties")) {
+ mVersion = xpp.getAttributeValue(null, "version");
+ mImageHandle = xpp.getAttributeValue(null, "handle");
+ mFriendlyName = xpp.getAttributeValue(null, "friendly-name");
+ } else if (tag.equals("native")) {
+ String encoding = xpp.getAttributeValue(null, "encoding");
+ String pixel = xpp.getAttributeValue(null, "pixel");
+ String size = xpp.getAttributeValue(null, "size");
+ addNativeFormat(BipImageFormat.parseNative(encoding, pixel, size));
+ } else if (tag.equals("variant")) {
+ String encoding = xpp.getAttributeValue(null, "encoding");
+ String pixel = xpp.getAttributeValue(null, "pixel");
+ String maxSize = xpp.getAttributeValue(null, "maxsize");
+ String trans = xpp.getAttributeValue(null, "transformation");
+ addVariantFormat(
+ BipImageFormat.parseVariant(encoding, pixel, maxSize, trans));
+ } else if (tag.equals("attachment")) {
+ String contentType = xpp.getAttributeValue(null, "content-type");
+ String name = xpp.getAttributeValue(null, "name");
+ String charset = xpp.getAttributeValue(null, "charset");
+ String size = xpp.getAttributeValue(null, "size");
+ String created = xpp.getAttributeValue(null, "created");
+ String modified = xpp.getAttributeValue(null, "modified");
+ addAttachment(
+ new BipAttachmentFormat(
+ contentType, charset, name, size, created, modified));
+ } else {
+ Log.w(TAG, "Unrecognized tag in x-bt/img-properties object: " + tag);
+ }
}
event = xpp.next();
}
diff --git a/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java b/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java
index 158ff76..e248216 100644
--- a/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java
+++ b/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java
@@ -831,8 +831,8 @@
private static boolean isWiredAudioHeadset(AudioDeviceInfo deviceInfo) {
return switch (deviceInfo.getType()) {
case AudioDeviceInfo.TYPE_WIRED_HEADSET,
- AudioDeviceInfo.TYPE_WIRED_HEADPHONES,
- AudioDeviceInfo.TYPE_USB_HEADSET ->
+ AudioDeviceInfo.TYPE_WIRED_HEADPHONES,
+ AudioDeviceInfo.TYPE_USB_HEADSET ->
true;
default -> false;
};
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
index 49cf9a3..b496903 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
@@ -609,7 +609,6 @@
return mDiscovering;
}
-
void updateOnProfileConnectionChanged(
BluetoothDevice device, int profile, int newState, int prevState) {
String logInfo =
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterState.java b/android/app/src/com/android/bluetooth/btservice/AdapterState.java
index 2f4d0e9..d00a55f 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterState.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterState.java
@@ -333,10 +333,10 @@
public void exit() {
removeMessages(BREDR_STOP_TIMEOUT);
if (Flags.disconnectAclsByBredrDisabled()) {
- if (mAdapterService != null) {
- Log.i(TAG, "Disconnecting all ACLs with BREDR Stopped");
- mAdapterService.disconnectAllAcls();
- }
+ if (mAdapterService != null) {
+ Log.i(TAG, "Disconnecting all ACLs with BREDR Stopped");
+ mAdapterService.disconnectAllAcls();
+ }
}
super.exit();
diff --git a/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java b/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java
index 613aaf5..f4c2523 100644
--- a/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java
+++ b/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java
@@ -1191,7 +1191,7 @@
// matches the type defined in BluetoothDevice.java
deviceProperties.setDeviceType(Utils.byteArrayToInt(val));
}
- // RSSI from hal is in one byte
+ // RSSI from hal is in one byte
case AbstractionLayer.BT_PROPERTY_REMOTE_RSSI ->
deviceProperties.setRssi(val[0]);
case AbstractionLayer.BT_PROPERTY_REMOTE_IS_COORDINATED_SET_MEMBER ->
diff --git a/android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java b/android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java
index e2f471f..02c1178 100644
--- a/android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java
+++ b/android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java
@@ -96,38 +96,38 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_LOAD_DATABASE -> {
- synchronized (mDatabaseLock) {
- List<Metadata> list;
- try {
- list = mDatabase.load();
- } catch (IllegalStateException e) {
- Log.e(TAG, "Unable to open database: " + e);
- mDatabase =
- MetadataDatabase.createDatabaseWithoutMigration(
- mAdapterService);
- list = mDatabase.load();
- }
- compactLastConnectionTime(list);
- cacheMetadata(list);
+ synchronized (mDatabaseLock) {
+ List<Metadata> list;
+ try {
+ list = mDatabase.load();
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "Unable to open database: " + e);
+ mDatabase =
+ MetadataDatabase.createDatabaseWithoutMigration(
+ mAdapterService);
+ list = mDatabase.load();
}
+ compactLastConnectionTime(list);
+ cacheMetadata(list);
}
+ }
case MSG_UPDATE_DATABASE -> {
- Metadata data = (Metadata) msg.obj;
- synchronized (mDatabaseLock) {
- mDatabase.insert(data);
- }
+ Metadata data = (Metadata) msg.obj;
+ synchronized (mDatabaseLock) {
+ mDatabase.insert(data);
}
+ }
case MSG_DELETE_DATABASE -> {
- String address = (String) msg.obj;
- synchronized (mDatabaseLock) {
- mDatabase.delete(address);
- }
+ String address = (String) msg.obj;
+ synchronized (mDatabaseLock) {
+ mDatabase.delete(address);
}
+ }
case MSG_CLEAR_DATABASE -> {
- synchronized (mDatabaseLock) {
- mDatabase.deleteAll();
- }
+ synchronized (mDatabaseLock) {
+ mDatabase.deleteAll();
}
+ }
default -> {} // Nothing to do
}
}
diff --git a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorStackEvent.java b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorStackEvent.java
index f117a8b..9401f72 100644
--- a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorStackEvent.java
+++ b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorStackEvent.java
@@ -112,8 +112,8 @@
return switch (evType) {
case EVENT_TYPE_CONNECTION_STATE_CHANGED -> connectionStateToString(value);
case EVENT_TYPE_DEVICE_AVAILABLE,
- EVENT_TYPE_GROUP_LOCK_CHANGED,
- EVENT_TYPE_SET_MEMBER_AVAILABLE ->
+ EVENT_TYPE_GROUP_LOCK_CHANGED,
+ EVENT_TYPE_SET_MEMBER_AVAILABLE ->
"group id: " + value;
default -> "<unused>";
};
diff --git a/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java b/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java
index c159477..0c4ae8f 100644
--- a/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java
+++ b/android/app/src/com/android/bluetooth/hap/HapClientStackEvent.java
@@ -153,8 +153,8 @@
private static String eventTypeValueInt3ToString(int type, int value) {
return switch (type) {
case EVENT_TYPE_ON_PRESET_INFO,
- EVENT_TYPE_ON_PRESET_INFO_ERROR,
- EVENT_TYPE_ON_PRESET_NAME_SET_ERROR ->
+ EVENT_TYPE_ON_PRESET_INFO_ERROR,
+ EVENT_TYPE_ON_PRESET_NAME_SET_ERROR ->
"{groupId: " + value + "}";
default -> "{unused: " + value + "}";
};
diff --git a/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java b/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java
index be6c114..2e63085 100644
--- a/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java
+++ b/android/app/src/com/android/bluetooth/hfp/AtPhonebook.java
@@ -319,7 +319,7 @@
mNativeInterface.atResponseString(remoteDevice, atCommandResponse);
mNativeInterface.atResponseCode(remoteDevice, atCommandResult, atCommandErrorCode);
break;
- // Read PhoneBook Entries
+ // Read PhoneBook Entries
case TYPE_READ:
case TYPE_SET: // Set & read
// Phone Book Read Request
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
index 0ec8ebe..3d87f75 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
@@ -380,20 +380,20 @@
switch (stackEvent.valueInt) {
case HeadsetHalConstants.CONNECTION_STATE_CONNECTED,
HeadsetHalConstants.CONNECTION_STATE_CONNECTING -> {
- // Create new state machine if none is found
- if (stateMachine == null) {
- stateMachine =
- HeadsetObjectsFactory.getInstance()
- .makeStateMachine(
- stackEvent.device,
- mStateMachinesLooper,
- this,
- mAdapterService,
- mNativeInterface,
- mSystemInterface);
- mStateMachines.put(stackEvent.device, stateMachine);
- }
+ // Create new state machine if none is found
+ if (stateMachine == null) {
+ stateMachine =
+ HeadsetObjectsFactory.getInstance()
+ .makeStateMachine(
+ stackEvent.device,
+ mStateMachinesLooper,
+ this,
+ mAdapterService,
+ mNativeInterface,
+ mSystemInterface);
+ mStateMachines.put(stackEvent.device, stateMachine);
}
+ }
default -> {} // Nothing to do
}
}
@@ -843,7 +843,6 @@
}
}
-
if (mSystemInterface.isScoManagedByAudioEnabled()) {
if (startScoViaAudioManager(device)) {
logScoSessionMetric(
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 852a8b4..c4dcd64 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -674,7 +674,7 @@
case HeadsetHalConstants.CONNECTION_STATE_DISCONNECTED:
stateLogW("ignore DISCONNECTED event");
break;
- // Both events result in Connecting state as SLC establishment is still required
+ // Both events result in Connecting state as SLC establishment is still required
case HeadsetHalConstants.CONNECTION_STATE_CONNECTED:
case HeadsetHalConstants.CONNECTION_STATE_CONNECTING:
if (mHeadsetService.okToAcceptConnection(mDevice, false)) {
@@ -821,7 +821,7 @@
case HeadsetStackEvent.EVENT_TYPE_BIND:
processAtBind(event.valueString, event.device);
break;
- // Unexpected AT commands, we only handle them for comparability reasons
+ // Unexpected AT commands, we only handle them for comparability reasons
case HeadsetStackEvent.EVENT_TYPE_VR_STATE_CHANGED:
stateLogW(
"Unexpected VR event, device="
diff --git a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
index d588550..1f1b8fc 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
@@ -1451,7 +1451,7 @@
break;
}
- // Called only for Mute/Un-mute - Mic volume change is not allowed.
+ // Called only for Mute/Un-mute - Mic volume change is not allowed.
case SET_MIC_VOLUME:
break;
case SET_SPEAKER_VOLUME:
@@ -1817,8 +1817,8 @@
switch (state) {
case HeadsetClientHalConstants.AUDIO_STATE_CONNECTED,
- HeadsetClientHalConstants.AUDIO_STATE_CONNECTED_LC3,
- HeadsetClientHalConstants.AUDIO_STATE_CONNECTED_MSBC:
+ HeadsetClientHalConstants.AUDIO_STATE_CONNECTED_LC3,
+ HeadsetClientHalConstants.AUDIO_STATE_CONNECTED_MSBC:
mAudioSWB = state == HeadsetClientHalConstants.AUDIO_STATE_CONNECTED_LC3;
mAudioWbs = state == HeadsetClientHalConstants.AUDIO_STATE_CONNECTED_MSBC;
debug("mAudioRouteAllowed=" + mAudioRouteAllowed);
@@ -1925,8 +1925,8 @@
debug("Disconnecting: Process message: " + message.what);
switch (message.what) {
- // Deferring messages as state machine objects are meant to be reused and after
- // disconnect is complete we want honor other message requests
+ // Deferring messages as state machine objects are meant to be reused and after
+ // disconnect is complete we want honor other message requests
case CONNECT:
case CONNECT_AUDIO:
case DISCONNECT:
@@ -2016,10 +2016,10 @@
break;
}
deferMessage(message);
- /*
- * fall through - disconnect audio first then expect
- * deferred DISCONNECT message in Connected state
- */
+ /*
+ * fall through - disconnect audio first then expect
+ * deferred DISCONNECT message in Connected state
+ */
case DISCONNECT_AUDIO:
/*
* just disconnect audio and wait for
diff --git a/android/app/src/com/android/bluetooth/hid/HidDeviceService.java b/android/app/src/com/android/bluetooth/hid/HidDeviceService.java
index bdab115..db5e51f 100644
--- a/android/app/src/com/android/bluetooth/hid/HidDeviceService.java
+++ b/android/app/src/com/android/bluetooth/hid/HidDeviceService.java
@@ -125,87 +125,82 @@
switch (msg.what) {
case MESSAGE_APPLICATION_STATE_CHANGED -> {
- BluetoothDevice device = msg.obj != null ? (BluetoothDevice) msg.obj : null;
- boolean success = (msg.arg1 != 0);
+ BluetoothDevice device = msg.obj != null ? (BluetoothDevice) msg.obj : null;
+ boolean success = (msg.arg1 != 0);
- if (success) {
- Log.d(TAG, "App registered, set device to: " + device);
- mHidDevice = device;
+ if (success) {
+ Log.d(TAG, "App registered, set device to: " + device);
+ mHidDevice = device;
+ } else {
+ mHidDevice = null;
+ }
+
+ try {
+ if (mCallback != null) {
+ mCallback.onAppStatusChanged(device, success);
} else {
- mHidDevice = null;
+ break;
}
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
+ }
- try {
- if (mCallback != null) {
- mCallback.onAppStatusChanged(device, success);
- } else {
- break;
- }
- } catch (RemoteException e) {
- Log.e(
- TAG,
- e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- }
-
- if (success) {
- mDeathRcpt =
- new BluetoothHidDeviceDeathRecipient(HidDeviceService.this);
- if (mCallback != null) {
- IBinder binder = mCallback.asBinder();
- try {
- binder.linkToDeath(mDeathRcpt, 0);
- Log.i(TAG, "IBinder.linkToDeath() ok");
- } catch (RemoteException e) {
- Log.e(
- TAG,
- e.toString()
- + "\n"
- + Log.getStackTraceString(new Throwable()));
- }
- }
- } else if (mDeathRcpt != null) {
- if (mCallback != null) {
- IBinder binder = mCallback.asBinder();
- try {
- binder.unlinkToDeath(mDeathRcpt, 0);
- Log.i(TAG, "IBinder.unlinkToDeath() ok");
- } catch (NoSuchElementException e) {
- Log.e(
- TAG,
- e.toString()
- + "\n"
- + Log.getStackTraceString(new Throwable()));
- }
- mDeathRcpt.cleanup();
- mDeathRcpt = null;
+ if (success) {
+ mDeathRcpt = new BluetoothHidDeviceDeathRecipient(HidDeviceService.this);
+ if (mCallback != null) {
+ IBinder binder = mCallback.asBinder();
+ try {
+ binder.linkToDeath(mDeathRcpt, 0);
+ Log.i(TAG, "IBinder.linkToDeath() ok");
+ } catch (RemoteException e) {
+ Log.e(
+ TAG,
+ e.toString()
+ + "\n"
+ + Log.getStackTraceString(new Throwable()));
}
}
-
- if (!success) {
- mCallback = null;
+ } else if (mDeathRcpt != null) {
+ if (mCallback != null) {
+ IBinder binder = mCallback.asBinder();
+ try {
+ binder.unlinkToDeath(mDeathRcpt, 0);
+ Log.i(TAG, "IBinder.unlinkToDeath() ok");
+ } catch (NoSuchElementException e) {
+ Log.e(
+ TAG,
+ e.toString()
+ + "\n"
+ + Log.getStackTraceString(new Throwable()));
+ }
+ mDeathRcpt.cleanup();
+ mDeathRcpt = null;
}
}
+
+ if (!success) {
+ mCallback = null;
+ }
+ }
case MESSAGE_CONNECT_STATE_CHANGED -> {
- BluetoothDevice device = (BluetoothDevice) msg.obj;
- int halState = msg.arg1;
- int state = convertHalState(halState);
+ BluetoothDevice device = (BluetoothDevice) msg.obj;
+ int halState = msg.arg1;
+ int state = convertHalState(halState);
- if (state != BluetoothHidDevice.STATE_DISCONNECTED) {
- mHidDevice = device;
- }
-
- setAndBroadcastConnectionState(device, state);
-
- try {
- if (mCallback != null) {
- mCallback.onConnectionStateChanged(device, state);
- }
- } catch (RemoteException e) {
- Log.e(
- TAG,
- e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
- }
+ if (state != BluetoothHidDevice.STATE_DISCONNECTED) {
+ mHidDevice = device;
}
+
+ setAndBroadcastConnectionState(device, state);
+
+ try {
+ if (mCallback != null) {
+ mCallback.onConnectionStateChanged(device, state);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
+ }
+ }
case MESSAGE_GET_REPORT -> {
byte type = (byte) msg.arg1;
byte id = (byte) msg.arg2;
@@ -220,20 +215,18 @@
}
}
case MESSAGE_SET_REPORT -> {
- byte reportType = (byte) msg.arg1;
- byte reportId = (byte) msg.arg2;
- byte[] data = ((ByteBuffer) msg.obj).array();
+ byte reportType = (byte) msg.arg1;
+ byte reportId = (byte) msg.arg2;
+ byte[] data = ((ByteBuffer) msg.obj).array();
- try {
- if (mCallback != null) {
- mCallback.onSetReport(mHidDevice, reportType, reportId, data);
- }
- } catch (RemoteException e) {
- Log.e(
- TAG,
- e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
+ try {
+ if (mCallback != null) {
+ mCallback.onSetReport(mHidDevice, reportType, reportId, data);
}
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
}
+ }
case MESSAGE_SET_PROTOCOL -> {
byte protocol = (byte) msg.arg1;
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioStackEvent.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioStackEvent.java
index 6f6b3b9..00b255f 100644
--- a/android/app/src/com/android/bluetooth/le_audio/LeAudioStackEvent.java
+++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioStackEvent.java
@@ -200,18 +200,18 @@
default -> "UNKNOWN";
};
case EVENT_TYPE_GROUP_NODE_STATUS_CHANGED,
- EVENT_TYPE_AUDIO_GROUP_CURRENT_CODEC_CONFIG_CHANGED,
- EVENT_TYPE_AUDIO_GROUP_SELECTABLE_CODEC_CONFIG_CHANGED,
- EVENT_TYPE_GROUP_STREAM_STATUS_CHANGED,
- EVENT_TYPE_GROUP_STATUS_CHANGED ->
+ EVENT_TYPE_AUDIO_GROUP_CURRENT_CODEC_CONFIG_CHANGED,
+ EVENT_TYPE_AUDIO_GROUP_SELECTABLE_CODEC_CONFIG_CHANGED,
+ EVENT_TYPE_GROUP_STREAM_STATUS_CHANGED,
+ EVENT_TYPE_GROUP_STATUS_CHANGED ->
"{group_id:" + Integer.toString(value) + "}";
- // FIXME: It should have proper direction names here
+ // FIXME: It should have proper direction names here
case EVENT_TYPE_AUDIO_CONF_CHANGED -> "{direction:" + value + "}";
case EVENT_TYPE_SINK_AUDIO_LOCATION_AVAILABLE -> "{sink_audio_location:" + value + "}";
case EVENT_TYPE_BROADCAST_CREATED,
- EVENT_TYPE_BROADCAST_DESTROYED,
- EVENT_TYPE_BROADCAST_METADATA_CHANGED,
- EVENT_TYPE_BROADCAST_STATE ->
+ EVENT_TYPE_BROADCAST_DESTROYED,
+ EVENT_TYPE_BROADCAST_METADATA_CHANGED,
+ EVENT_TYPE_BROADCAST_STATE ->
"{broadcastId:" + value + "}";
case EVENT_TYPE_HEALTH_BASED_GROUP_RECOMMENDATION -> "{group_id: " + value + "}";
case EVENT_TYPE_HEALTH_BASED_DEV_RECOMMENDATION ->
@@ -281,7 +281,7 @@
private static String eventTypeValue3ToString(int type, int value) {
return switch (type) {
- // FIXME: It should have proper location names here
+ // FIXME: It should have proper location names here
case EVENT_TYPE_AUDIO_CONF_CHANGED -> "{snk_audio_loc:" + value + "}";
default -> Integer.toString(value);
};
@@ -289,7 +289,7 @@
private static String eventTypeValue4ToString(int type, int value) {
return switch (type) {
- // FIXME: It should have proper location names here
+ // FIXME: It should have proper location names here
case EVENT_TYPE_AUDIO_CONF_CHANGED -> "{src_audio_loc:" + value + "}";
default -> Integer.toString(value);
};
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 f43c534..c251273 100644
--- a/android/app/src/com/android/bluetooth/le_scan/AppScanStats.java
+++ b/android/app/src/com/android/bluetooth/le_scan/AppScanStats.java
@@ -655,8 +655,8 @@
case ScanSettings.SCAN_MODE_LOW_POWER -> LOW_POWER_WEIGHT;
case ScanSettings.SCAN_MODE_LOW_LATENCY -> LOW_LATENCY_WEIGHT;
case ScanSettings.SCAN_MODE_BALANCED,
- ScanSettings.SCAN_MODE_AMBIENT_DISCOVERY,
- ScanSettings.SCAN_MODE_SCREEN_OFF_BALANCED ->
+ ScanSettings.SCAN_MODE_AMBIENT_DISCOVERY,
+ ScanSettings.SCAN_MODE_SCREEN_OFF_BALANCED ->
BALANCED_WEIGHT;
default -> LOW_POWER_WEIGHT;
};
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 88f408a..761f442 100644
--- a/android/app/src/com/android/bluetooth/le_scan/ScanManager.java
+++ b/android/app/src/com/android/bluetooth/le_scan/ScanManager.java
@@ -454,7 +454,7 @@
case MSG_IMPORTANCE_CHANGE -> handleImportanceChange((UidImportance) msg.obj);
case MSG_START_CONNECTING -> handleConnectingState();
case MSG_STOP_CONNECTING -> handleClearConnectingState();
- // Shouldn't happen.
+ // Shouldn't happen.
default -> Log.e(TAG, "received an unknown message : " + msg.what);
}
}
@@ -769,7 +769,7 @@
case ScanSettings.SCAN_MODE_LOW_POWER ->
updatedScanMode = ScanSettings.SCAN_MODE_SCREEN_OFF;
case ScanSettings.SCAN_MODE_BALANCED,
- ScanSettings.SCAN_MODE_AMBIENT_DISCOVERY ->
+ ScanSettings.SCAN_MODE_AMBIENT_DISCOVERY ->
updatedScanMode = ScanSettings.SCAN_MODE_SCREEN_OFF_BALANCED;
case ScanSettings.SCAN_MODE_LOW_LATENCY ->
updatedScanMode = ScanSettings.SCAN_MODE_LOW_LATENCY;
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java b/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java
index dfb0c9f..a5dced5 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMapContent.java
@@ -3540,7 +3540,7 @@
case 1 -> BluetoothMapContract.FOLDER_NAME_INBOX;
case 2 -> BluetoothMapContract.FOLDER_NAME_SENT;
case 3 -> BluetoothMapContract.FOLDER_NAME_DRAFT;
- // Just name outbox, failed and queued "outbox"
+ // Just name outbox, failed and queued "outbox"
case 4, 5, 6 -> BluetoothMapContract.FOLDER_NAME_OUTBOX;
default -> "";
};
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java b/android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java
index c67d292..25bb83e 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java
@@ -2884,7 +2884,7 @@
return switch (type) {
case TYPE.EMAIL ->
setEmailMessageStatusDelete(mCurrentFolder, uriStr, handle, statusValue);
- // TODO: to do when deleting IM message
+ // TODO: to do when deleting IM message
case TYPE.IM -> {
Log.d(TAG, "setMessageStatusDeleted: IM not handled");
yield false;
diff --git a/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java b/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java
index 811f533..3cbf565 100644
--- a/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java
+++ b/android/app/src/com/android/bluetooth/map/BluetoothMapSmsPdu.java
@@ -317,11 +317,11 @@
private int gsmSubmitGetTpUdlOffset() {
return switch (((mData[0] & 0xff) & (0x08 | 0x04)) >> 2) {
- // Not TP-VP present
+ // Not TP-VP present
case 0 -> gsmSubmitGetTpPidOffset() + 2;
- // TP-VP relative format
+ // TP-VP relative format
case 1 -> gsmSubmitGetTpPidOffset() + 2 + 1;
- // TP-VP enhanced format, TP-VP absolute format
+ // TP-VP enhanced format, TP-VP absolute format
default /* case 2, 3 */ -> gsmSubmitGetTpPidOffset() + 2 + 7;
};
}
@@ -688,12 +688,12 @@
} else {
encodingType =
switch ((dataCodingScheme >> 2) & 0x3) {
- // GSM 7 bit default alphabet
+ // GSM 7 bit default alphabet
case 0 -> SmsConstants.ENCODING_7BIT;
- // UCS 2 (16bit)
+ // UCS 2 (16bit)
case 2 -> SmsConstants.ENCODING_16BIT;
- // 8 bit data, reserved
+ // 8 bit data, reserved
default -> { // case 1,3
Log.w(
TAG,
diff --git a/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java b/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java
index e3bb270..8e19b1a 100644
--- a/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java
+++ b/android/app/src/com/android/bluetooth/mapclient/MapClientContent.java
@@ -671,16 +671,16 @@
switch (folder) {
case Folder.INBOX -> {
- smsUri = Sms.Inbox.CONTENT_URI;
- mmsUri = Mms.Inbox.CONTENT_URI;
+ smsUri = Sms.Inbox.CONTENT_URI;
+ mmsUri = Mms.Inbox.CONTENT_URI;
}
case Folder.SENT -> {
- smsUri = Sms.Sent.CONTENT_URI;
- mmsUri = Mms.Sent.CONTENT_URI;
+ smsUri = Sms.Sent.CONTENT_URI;
+ mmsUri = Mms.Sent.CONTENT_URI;
}
default -> { // Folder.UNKNOWN
- warn("getRecentMessagesFromFolder: Failed, unsupported folder=" + folder);
- return null;
+ warn("getRecentMessagesFromFolder: Failed, unsupported folder=" + folder);
+ return null;
}
}
diff --git a/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java b/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java
index 58b8d7e..4571aef 100644
--- a/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java
+++ b/android/app/src/com/android/bluetooth/mapclient/MceStateMachine.java
@@ -883,14 +883,14 @@
DOWNLOAD_ATTACHMENTS));
break;
case DELIVERY_FAILURE:
- // fall through
+ // fall through
case SENDING_FAILURE:
if (!Flags.handleDeliverySendingFailureEvents()) {
break;
}
- // fall through
+ // fall through
case DELIVERY_SUCCESS:
- // fall through
+ // fall through
case SENDING_SUCCESS:
notifySentMessageStatus(event.getHandle(), event.getType());
break;
@@ -1013,32 +1013,29 @@
RequestSetMessageStatus.StatusIndicator status = request.getStatusIndicator();
switch (status) {
case READ -> {
- Intent intent =
- new Intent(BluetoothMapClient.ACTION_MESSAGE_READ_STATUS_CHANGED);
- intent.putExtra(
- BluetoothMapClient.EXTRA_MESSAGE_READ_STATUS,
- request.getValue() == RequestSetMessageStatus.STATUS_YES
- ? true
- : false);
- intent.putExtra(
- BluetoothMapClient.EXTRA_MESSAGE_HANDLE, request.getHandle());
- intent.putExtra(BluetoothMapClient.EXTRA_RESULT_CODE, result);
- mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
- }
+ Intent intent =
+ new Intent(BluetoothMapClient.ACTION_MESSAGE_READ_STATUS_CHANGED);
+ intent.putExtra(
+ BluetoothMapClient.EXTRA_MESSAGE_READ_STATUS,
+ request.getValue() == RequestSetMessageStatus.STATUS_YES
+ ? true
+ : false);
+ intent.putExtra(BluetoothMapClient.EXTRA_MESSAGE_HANDLE, request.getHandle());
+ intent.putExtra(BluetoothMapClient.EXTRA_RESULT_CODE, result);
+ mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
+ }
case DELETED -> {
- Intent intent =
- new Intent(
- BluetoothMapClient.ACTION_MESSAGE_DELETED_STATUS_CHANGED);
- intent.putExtra(
- BluetoothMapClient.EXTRA_MESSAGE_DELETED_STATUS,
- request.getValue() == RequestSetMessageStatus.STATUS_YES
- ? true
- : false);
- intent.putExtra(
- BluetoothMapClient.EXTRA_MESSAGE_HANDLE, request.getHandle());
- intent.putExtra(BluetoothMapClient.EXTRA_RESULT_CODE, result);
- mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
- }
+ Intent intent =
+ new Intent(BluetoothMapClient.ACTION_MESSAGE_DELETED_STATUS_CHANGED);
+ intent.putExtra(
+ BluetoothMapClient.EXTRA_MESSAGE_DELETED_STATUS,
+ request.getValue() == RequestSetMessageStatus.STATUS_YES
+ ? true
+ : false);
+ intent.putExtra(BluetoothMapClient.EXTRA_MESSAGE_HANDLE, request.getHandle());
+ intent.putExtra(BluetoothMapClient.EXTRA_RESULT_CODE, result);
+ mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
+ }
}
}
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 75163c1..e4a8f07 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/EventReport.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/EventReport.java
@@ -98,18 +98,18 @@
int event = xpp.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
if (event == XmlPullParser.START_TAG) {
- if (xpp.getName().equals("event")) {
- HashMap<String, String> attrs = new HashMap<String, String>();
+ if (xpp.getName().equals("event")) {
+ HashMap<String, String> attrs = new HashMap<String, String>();
- for (int i = 0; i < xpp.getAttributeCount(); i++) {
- attrs.put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
- }
-
- ev = new EventReport(attrs);
-
- // return immediately, only one event should be here
- return ev;
+ for (int i = 0; i < xpp.getAttributeCount(); i++) {
+ attrs.put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
}
+
+ ev = new EventReport(attrs);
+
+ // return immediately, only one event should be here
+ return ev;
+ }
}
event = xpp.next();
diff --git a/android/app/src/com/android/bluetooth/mapclient/obex/FolderListing.java b/android/app/src/com/android/bluetooth/mapclient/obex/FolderListing.java
index 1d10128..23018f2 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/FolderListing.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/FolderListing.java
@@ -44,9 +44,9 @@
int event = xpp.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
if (event == XmlPullParser.START_TAG) {
- if (xpp.getName().equals("folder")) {
- mFolders.add(xpp.getAttributeValue(null, "name"));
- }
+ if (xpp.getName().equals("folder")) {
+ mFolders.add(xpp.getAttributeValue(null, "name"));
+ }
}
event = xpp.next();
diff --git a/android/app/src/com/android/bluetooth/mapclient/obex/MessagesListing.java b/android/app/src/com/android/bluetooth/mapclient/obex/MessagesListing.java
index 53cef2c..0c8dcb2 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/MessagesListing.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/MessagesListing.java
@@ -46,22 +46,22 @@
int event = xpp.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
if (event == XmlPullParser.START_TAG) {
- if (xpp.getName().equals("msg")) {
+ if (xpp.getName().equals("msg")) {
- Map<String, String> attrs = new HashMap<>();
+ Map<String, String> attrs = new HashMap<>();
- for (int i = 0; i < xpp.getAttributeCount(); i++) {
- attrs.put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
- }
-
- try {
- Message msg = new Message(attrs);
- mMessages.add(msg);
- } catch (IllegalArgumentException e) {
- /* TODO: provide something more useful here */
- Log.w(TAG, "Invalid <msg/>");
- }
+ for (int i = 0; i < xpp.getAttributeCount(); i++) {
+ attrs.put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
}
+
+ try {
+ Message msg = new Message(attrs);
+ mMessages.add(msg);
+ } catch (IllegalArgumentException e) {
+ /* TODO: provide something more useful here */
+ Log.w(TAG, "Invalid <msg/>");
+ }
+ }
}
event = xpp.next();
diff --git a/android/app/src/com/android/bluetooth/mapclient/obex/RequestSetMessageStatus.java b/android/app/src/com/android/bluetooth/mapclient/obex/RequestSetMessageStatus.java
index 01af11c..516ebdd 100644
--- a/android/app/src/com/android/bluetooth/mapclient/obex/RequestSetMessageStatus.java
+++ b/android/app/src/com/android/bluetooth/mapclient/obex/RequestSetMessageStatus.java
@@ -16,7 +16,6 @@
package com.android.bluetooth.mapclient;
-
import com.android.bluetooth.ObexAppParameters;
import com.android.obex.ClientSession;
import com.android.obex.HeaderSet;
diff --git a/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java b/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java
index 44565ab..8c0aef0 100644
--- a/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java
+++ b/android/app/src/com/android/bluetooth/mcp/MediaControlGattService.java
@@ -533,7 +533,7 @@
+ (charUuid != null ? mcsUuidToString(charUuid) : "UNKNOWN"));
switch (op.operation()) {
- /* Allow not yet authorized devices to subscribe for notifications */
+ /* Allow not yet authorized devices to subscribe for notifications */
case READ_DESCRIPTOR -> {
if (op.offset() > 1) {
mBluetoothGattServer.sendResponse(
@@ -581,19 +581,19 @@
onUnauthorizedCharRead(device, op);
}
case WRITE_CHARACTERISTIC -> {
- synchronized (mPendingGattOperations) {
- List<GattOpContext> operations = mPendingGattOperations.get(device);
- if (operations == null) {
- operations = new ArrayList<>();
- mPendingGattOperations.put(device, operations);
- }
+ synchronized (mPendingGattOperations) {
+ List<GattOpContext> operations = mPendingGattOperations.get(device);
+ if (operations == null) {
+ operations = new ArrayList<>();
+ mPendingGattOperations.put(device, operations);
+ }
- operations.add(op);
- // Send authorization request for each device only for it's first GATT request
- if (operations.size() == 1) {
- mMcpService.onDeviceUnauthorized(device);
- }
- }
+ operations.add(op);
+ // Send authorization request for each device only for it's first GATT request
+ if (operations.size() == 1) {
+ mMcpService.onDeviceUnauthorized(device);
+ }
+ }
}
}
}
@@ -1259,9 +1259,9 @@
private static int getMediaControlPointRequestPayloadLength(int opcode) {
return switch (opcode) {
case Request.Opcodes.MOVE_RELATIVE,
- Request.Opcodes.GOTO_SEGMENT,
- Request.Opcodes.GOTO_TRACK,
- Request.Opcodes.GOTO_GROUP ->
+ Request.Opcodes.GOTO_SEGMENT,
+ Request.Opcodes.GOTO_TRACK,
+ Request.Opcodes.GOTO_GROUP ->
4;
default -> 0;
};
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
index 666ed9b..3ead301 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
@@ -49,7 +49,6 @@
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothStatsLog;
-import com.android.bluetooth.btservice.MetricsLogger;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java
index e4d08c6..5215e4b 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java
@@ -50,7 +50,6 @@
import com.android.bluetooth.BluetoothObexTransport;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.btservice.MetricsLogger;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.obex.HeaderSet;
diff --git a/android/app/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java b/android/app/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java
index 02ac46a..022794f 100644
--- a/android/app/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java
+++ b/android/app/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java
@@ -91,7 +91,6 @@
private static final String VCARD_PROPERTY_CALLTYPE_OUTGOING = "DIALED";
private static final String VCARD_PROPERTY_CALLTYPE_MISSED = "MISSED";
-
private final Context mContext;
private Cursor mCursor;
diff --git a/android/app/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java b/android/app/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java
index 2ac3db8..b484c72 100644
--- a/android/app/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java
+++ b/android/app/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java
@@ -139,7 +139,7 @@
int size =
switch (type) {
case BluetoothPbapObexServer.ContentType.PHONEBOOK,
- BluetoothPbapObexServer.ContentType.FAVORITES ->
+ BluetoothPbapObexServer.ContentType.FAVORITES ->
getContactsSize(type);
case BluetoothPbapObexServer.ContentType.SIM_PHONEBOOK ->
vCardSimManager.getSIMContactsSize();
diff --git a/android/app/src/com/android/bluetooth/pbapclient/PbapClientStateMachine.java b/android/app/src/com/android/bluetooth/pbapclient/PbapClientStateMachine.java
index 9b778fc..7c52057 100644
--- a/android/app/src/com/android/bluetooth/pbapclient/PbapClientStateMachine.java
+++ b/android/app/src/com/android/bluetooth/pbapclient/PbapClientStateMachine.java
@@ -879,7 +879,7 @@
switch (mCurrentState) {
case STATE_CONNECTED:
onConnectionStateChanged(STATE_DISCONNECTING);
- // intentional fallthrough-- we want to broadcast both state changes
+ // intentional fallthrough-- we want to broadcast both state changes
case STATE_CONNECTING:
case STATE_DISCONNECTING:
onConnectionStateChanged(STATE_DISCONNECTED);
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 da9bf4c..e515ba7 100644
--- a/android/app/src/com/android/bluetooth/pbapclient/obex/PbapPhonebook.java
+++ b/android/app/src/com/android/bluetooth/pbapclient/obex/PbapPhonebook.java
@@ -82,11 +82,7 @@
mListStartOffset = 0;
}
- PbapPhonebook(
- String phonebook,
- byte format,
- int listStartOffset,
- InputStream inputStream)
+ PbapPhonebook(String phonebook, byte format, int listStartOffset, InputStream inputStream)
throws IOException {
if (format != FORMAT_VCARD_21 && format != FORMAT_VCARD_30) {
throw new IllegalArgumentException("Unsupported vCard version.");
diff --git a/android/app/src/com/android/bluetooth/sap/SapMessage.java b/android/app/src/com/android/bluetooth/sap/SapMessage.java
index c5bfe9c..98d95eb 100644
--- a/android/app/src/com/android/bluetooth/sap/SapMessage.java
+++ b/android/app/src/com/android/bluetooth/sap/SapMessage.java
@@ -872,11 +872,11 @@
private void createUnsolicited(MsgHeader msg)
throws IOException, InvalidProtocolBufferMicroException {
switch (msg.getId()) {
- // TODO:
- // Not sure when we use these? case RIL_UNSOL_RIL_CONNECTED:
- // if(VERBOSE) Log.i(TAG, "RIL_UNSOL_RIL_CONNECTED received, ignoring");
- // msgType = ID_RIL_UNSOL_CONNECTED;
- // break;
+ // TODO:
+ // Not sure when we use these? case RIL_UNSOL_RIL_CONNECTED:
+ // if(VERBOSE) Log.i(TAG, "RIL_UNSOL_RIL_CONNECTED received, ignoring");
+ // msgType = ID_RIL_UNSOL_CONNECTED;
+ // break;
case SapApi.RIL_SIM_SAP_STATUS:
{
Log.v(TAG, "RIL_SIM_SAP_STATUS_IND received");
diff --git a/android/app/src/com/android/bluetooth/sap/SapServer.java b/android/app/src/com/android/bluetooth/sap/SapServer.java
index 864e775..8b14c4f 100644
--- a/android/app/src/com/android/bluetooth/sap/SapServer.java
+++ b/android/app/src/com/android/bluetooth/sap/SapServer.java
@@ -443,7 +443,7 @@
sendClientMessage(errorReply);
msg = null;
}
- // Fall through
+ // Fall through
default:
/* Remaining cases just needs to be forwarded to the RIL unless
we are
diff --git a/android/app/src/com/android/bluetooth/tbs/TbsGatt.java b/android/app/src/com/android/bluetooth/tbs/TbsGatt.java
index 6dcdfaf..3ab27ec 100644
--- a/android/app/src/com/android/bluetooth/tbs/TbsGatt.java
+++ b/android/app/src/com/android/bluetooth/tbs/TbsGatt.java
@@ -76,6 +76,7 @@
@VisibleForTesting static final UUID UUID_TERMINATION_REASON = makeUuid("2BC0");
@VisibleForTesting static final UUID UUID_INCOMING_CALL = makeUuid("2BC1");
@VisibleForTesting static final UUID UUID_CALL_FRIENDLY_NAME = makeUuid("2BC2");
+
@VisibleForTesting
static final UUID UUID_CLIENT_CHARACTERISTIC_CONFIGURATION = makeUuid("2902");
@@ -1123,9 +1124,8 @@
+ ", characteristic= "
+ (charUuid != null ? tbsUuidToString(charUuid) : "UNKNOWN"));
-
switch (op.operation()) {
- /* Allow not yet authorized devices to subscribe for notifications */
+ /* Allow not yet authorized devices to subscribe for notifications */
case READ_DESCRIPTOR -> {
byte[] value = getCccBytes(device, op.descriptor().getCharacteristic().getUuid());
final int status;
@@ -1173,19 +1173,19 @@
onUnauthorizedCharRead(device, op);
}
case WRITE_CHARACTERISTIC -> {
- synchronized (mPendingGattOperationsLock) {
- List<GattOpContext> operations = mPendingGattOperations.get(device);
- if (operations == null) {
- operations = new ArrayList<>();
- mPendingGattOperations.put(device, operations);
- }
+ synchronized (mPendingGattOperationsLock) {
+ List<GattOpContext> operations = mPendingGattOperations.get(device);
+ if (operations == null) {
+ operations = new ArrayList<>();
+ mPendingGattOperations.put(device, operations);
+ }
- operations.add(op);
- // Send authorization request for each device only for it's first GATT request
- if (operations.size() == 1) {
- mTbsService.onDeviceUnauthorized(device);
- }
- }
+ operations.add(op);
+ // Send authorization request for each device only for it's first GATT request
+ if (operations.size() == 1) {
+ mTbsService.onDeviceUnauthorized(device);
+ }
+ }
}
}
}
diff --git a/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java b/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java
index 1d38489..563eea0 100644
--- a/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java
+++ b/android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java
@@ -16,7 +16,6 @@
package com.android.bluetooth.telephony;
-
import static java.util.Objects.requireNonNull;
import static java.util.Objects.requireNonNullElseGet;
@@ -397,9 +396,7 @@
@VisibleForTesting
BluetoothInCallService(
- Context context,
- CallInfo callInfo,
- BluetoothLeCallControlProxy leCallControl) {
+ Context context, CallInfo callInfo, BluetoothLeCallControlProxy leCallControl) {
this(callInfo);
mBluetoothLeCallControl = leCallControl;
attachBaseContext(context);
@@ -499,21 +496,21 @@
case TelephonyManager.NETWORK_TYPE_GPRS ->
BluetoothLeCallControlProxy.BEARER_TECHNOLOGY_2G;
case TelephonyManager.NETWORK_TYPE_EDGE,
- TelephonyManager.NETWORK_TYPE_EVDO_0,
- TelephonyManager.NETWORK_TYPE_EVDO_A,
- TelephonyManager.NETWORK_TYPE_HSDPA,
- TelephonyManager.NETWORK_TYPE_HSUPA,
- TelephonyManager.NETWORK_TYPE_HSPA,
- TelephonyManager.NETWORK_TYPE_IDEN,
- TelephonyManager.NETWORK_TYPE_EVDO_B ->
+ TelephonyManager.NETWORK_TYPE_EVDO_0,
+ TelephonyManager.NETWORK_TYPE_EVDO_A,
+ TelephonyManager.NETWORK_TYPE_HSDPA,
+ TelephonyManager.NETWORK_TYPE_HSUPA,
+ TelephonyManager.NETWORK_TYPE_HSPA,
+ TelephonyManager.NETWORK_TYPE_IDEN,
+ TelephonyManager.NETWORK_TYPE_EVDO_B ->
BluetoothLeCallControlProxy.BEARER_TECHNOLOGY_3G;
case TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_TD_SCDMA ->
BluetoothLeCallControlProxy.BEARER_TECHNOLOGY_WCDMA;
case TelephonyManager.NETWORK_TYPE_LTE ->
BluetoothLeCallControlProxy.BEARER_TECHNOLOGY_LTE;
case TelephonyManager.NETWORK_TYPE_EHRPD,
- TelephonyManager.NETWORK_TYPE_CDMA,
- TelephonyManager.NETWORK_TYPE_1xRTT ->
+ TelephonyManager.NETWORK_TYPE_CDMA,
+ TelephonyManager.NETWORK_TYPE_1xRTT ->
BluetoothLeCallControlProxy.BEARER_TECHNOLOGY_CDMA;
case TelephonyManager.NETWORK_TYPE_HSPAP ->
BluetoothLeCallControlProxy.BEARER_TECHNOLOGY_4G;
@@ -1380,9 +1377,9 @@
CallState.IDLE;
case Call.STATE_CONNECTING,
- Call.STATE_SELECT_PHONE_ACCOUNT,
- Call.STATE_DIALING,
- Call.STATE_PULLING_CALL ->
+ Call.STATE_SELECT_PHONE_ACCOUNT,
+ Call.STATE_DIALING,
+ Call.STATE_PULLING_CALL ->
// Yes, this is correctly returning ALERTING.
// "Dialing" for BT means that we have sent information to the service provider
// to place the BluetoothCall but there is no confirmation that the
diff --git a/android/app/src/com/android/bluetooth/vc/VolumeControlStackEvent.java b/android/app/src/com/android/bluetooth/vc/VolumeControlStackEvent.java
index 9528728..2127e9d 100644
--- a/android/app/src/com/android/bluetooth/vc/VolumeControlStackEvent.java
+++ b/android/app/src/com/android/bluetooth/vc/VolumeControlStackEvent.java
@@ -84,8 +84,8 @@
case EVENT_TYPE_VOLUME_STATE_CHANGED -> "{group_id:" + value + "}";
case EVENT_TYPE_DEVICE_AVAILABLE -> "{group_id:" + value + "}";
case EVENT_TYPE_EXT_AUDIO_OUT_VOL_OFFSET_CHANGED,
- EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED,
- EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED ->
+ EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED,
+ EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED ->
"{ext output id:" + value + "}";
default -> Integer.toString(value);
};
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 c07214e..1a3381a 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
@@ -240,12 +240,18 @@
BluetoothCodecConfig[] codecConfigs = mA2dpCodecConfig.codecConfigPriorities();
for (BluetoothCodecConfig config : codecConfigs) {
switch (config.getCodecType()) {
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC -> assertThat(config.getCodecPriority()).isEqualTo(SBC_PRIORITY_DEFAULT);
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC -> assertThat(config.getCodecPriority()).isEqualTo(AAC_PRIORITY_DEFAULT);
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX -> assertThat(config.getCodecPriority()).isEqualTo(APTX_PRIORITY_DEFAULT);
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD -> assertThat(config.getCodecPriority()).isEqualTo(APTX_HD_PRIORITY_DEFAULT);
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC -> assertThat(config.getCodecPriority()).isEqualTo(LDAC_PRIORITY_DEFAULT);
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS -> assertThat(config.getCodecPriority()).isEqualTo(OPUS_PRIORITY_DEFAULT);
+ case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC ->
+ assertThat(config.getCodecPriority()).isEqualTo(SBC_PRIORITY_DEFAULT);
+ case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC ->
+ assertThat(config.getCodecPriority()).isEqualTo(AAC_PRIORITY_DEFAULT);
+ case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX ->
+ assertThat(config.getCodecPriority()).isEqualTo(APTX_PRIORITY_DEFAULT);
+ case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD ->
+ assertThat(config.getCodecPriority()).isEqualTo(APTX_HD_PRIORITY_DEFAULT);
+ case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC ->
+ assertThat(config.getCodecPriority()).isEqualTo(LDAC_PRIORITY_DEFAULT);
+ case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS ->
+ assertThat(config.getCodecPriority()).isEqualTo(OPUS_PRIORITY_DEFAULT);
default -> {} // Nothing to do
}
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java
index 9a2854c..310e514 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java
@@ -670,17 +670,17 @@
Collections.shuffle(callbackOrder);
for (int j = 0; j < 3; j++) {
switch (callbackOrder.get(j)) {
- // Update Metadata
+ // Update Metadata
case 0 -> {
doReturn(m.build()).when(mMockController).getMetadata();
controllerCallbacks.onMetadataChanged(m.build());
}
- // Update PlaybackState
+ // Update PlaybackState
case 1 -> {
doReturn(s.build()).when(mMockController).getPlaybackState();
controllerCallbacks.onPlaybackStateChanged(s.build());
}
- // Update Queue
+ // Update Queue
case 2 -> {
doReturn(q).when(mMockController).getQueue();
controllerCallbacks.onQueueChanged(q);
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 87c5987..892c001 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
@@ -3050,12 +3050,10 @@
/**
* Test the group is activated once the available contexts are back.
*
- * Scenario:
- * 1. Have a group of 2 devices. The available contexts are non-zero.
- * The group shall be active at this point.
- * 2. All group devices are disconnected.
- * 3. Group devices are reconnected. The available contexts are zero.
- * 4. The available contexts are updated with non-zero value. Group becomes active.
+ * <p>Scenario: 1. Have a group of 2 devices. The available contexts are non-zero. The group
+ * shall be active at this point. 2. All group devices are disconnected. 3. Group devices are
+ * reconnected. The available contexts are zero. 4. The available contexts are updated with
+ * non-zero value. Group becomes active.
*/
@Test
public void testActivateDeviceWhenAvailableContextAreBack_Scenario3() {
@@ -3320,9 +3318,12 @@
int mask = 0;
for (int profile : profiles) {
switch (profile) {
- case BluetoothProfile.LE_CALL_CONTROL -> mask |= LeAudioTmapGattServer.TMAP_ROLE_FLAG_CG;
- case BluetoothProfile.MCP_SERVER -> mask |= LeAudioTmapGattServer.TMAP_ROLE_FLAG_UMS;
- case BluetoothProfile.LE_AUDIO_BROADCAST -> mask |= LeAudioTmapGattServer.TMAP_ROLE_FLAG_BMS;
+ case BluetoothProfile.LE_CALL_CONTROL ->
+ mask |= LeAudioTmapGattServer.TMAP_ROLE_FLAG_CG;
+ case BluetoothProfile.MCP_SERVER ->
+ mask |= LeAudioTmapGattServer.TMAP_ROLE_FLAG_UMS;
+ case BluetoothProfile.LE_AUDIO_BROADCAST ->
+ mask |= LeAudioTmapGattServer.TMAP_ROLE_FLAG_BMS;
default -> {} // Nothing to do
}
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java
index c6c4bd9..ed64a29 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java
@@ -34,10 +34,8 @@
import androidx.test.runner.AndroidJUnit4;
import com.android.bluetooth.BluetoothMethodProxy;
-import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
index 359f386..561647f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
@@ -52,7 +52,6 @@
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothObexTransport;
-import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.obex.ObexTransport;
diff --git a/android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/BluetoothProxy.java b/android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/BluetoothProxy.java
index 4dcb10d..618dae1 100644
--- a/android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/BluetoothProxy.java
+++ b/android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/BluetoothProxy.java
@@ -277,7 +277,7 @@
svc_data.hapStateMutable.postValue(toState);
break;
}
- // Hidden API
+ // Hidden API
case "android.bluetooth.action.HAP_DEVICE_AVAILABLE":
{
final int features =
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index a6c1595..cef4336 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -776,16 +776,14 @@
*
* @hide
*/
- @SystemApi
- public static final int AUTO_ON_STATE_DISABLED = 1;
+ @SystemApi public static final int AUTO_ON_STATE_DISABLED = 1;
/**
* Indicates the AutoOn feature is ON.
*
* @hide
*/
- @SystemApi
- public static final int AUTO_ON_STATE_ENABLED = 2;
+ @SystemApi public static final int AUTO_ON_STATE_ENABLED = 2;
/**
* Audio mode representing output only.
@@ -2328,6 +2326,7 @@
throw e.rethrowAsRuntimeException();
}
}
+
@RequiresNoPermission
@Override
public boolean shouldBypassCache(IBluetooth serviceQuery) {
@@ -2850,6 +2849,7 @@
throw e.rethrowAsRuntimeException();
}
}
+
@RequiresNoPermission
@Override
public boolean shouldBypassCache(IBluetooth serviceQuery) {
@@ -5548,8 +5548,8 @@
/**
* Invoked when an event is received.
*
- * @param code The vendor-specific event Code. The first octet of the event parameters
- * of a vendor-specific event (Bluetooth Core Specification Vol 4, Part E, 5.4.3).
+ * @param code The vendor-specific event Code. The first octet of the event parameters of a
+ * vendor-specific event (Bluetooth Core Specification Vol 4, Part E, 5.4.3).
* @param data from 0 to 254 Bytes.
*/
void onEvent(@IntRange(from = 0x00, to = 0xfe) int code, @NonNull byte[] data);
diff --git a/framework/java/android/bluetooth/BluetoothClass.java b/framework/java/android/bluetooth/BluetoothClass.java
index f79828d..f5514ea 100644
--- a/framework/java/android/bluetooth/BluetoothClass.java
+++ b/framework/java/android/bluetooth/BluetoothClass.java
@@ -321,9 +321,9 @@
// match on some other class bits.
return switch (getDeviceClass()) {
case Device.AUDIO_VIDEO_HIFI_AUDIO,
- Device.AUDIO_VIDEO_HEADPHONES,
- Device.AUDIO_VIDEO_LOUDSPEAKER,
- Device.AUDIO_VIDEO_CAR_AUDIO ->
+ Device.AUDIO_VIDEO_HEADPHONES,
+ Device.AUDIO_VIDEO_LOUDSPEAKER,
+ Device.AUDIO_VIDEO_CAR_AUDIO ->
true;
default -> false;
};
@@ -336,8 +336,8 @@
// match on some other class bits.
return switch (getDeviceClass()) {
case Device.AUDIO_VIDEO_HIFI_AUDIO,
- Device.AUDIO_VIDEO_SET_TOP_BOX,
- Device.AUDIO_VIDEO_VCR ->
+ Device.AUDIO_VIDEO_SET_TOP_BOX,
+ Device.AUDIO_VIDEO_VCR ->
true;
default -> false;
};
@@ -350,8 +350,8 @@
// Just in case they forgot the render service class
return switch (getDeviceClass()) {
case Device.AUDIO_VIDEO_HANDSFREE,
- Device.AUDIO_VIDEO_WEARABLE_HEADSET,
- Device.AUDIO_VIDEO_CAR_AUDIO ->
+ Device.AUDIO_VIDEO_WEARABLE_HEADSET,
+ Device.AUDIO_VIDEO_CAR_AUDIO ->
true;
default -> false;
};
@@ -362,18 +362,18 @@
return switch (getDeviceClass()) {
case Device.COMPUTER_UNCATEGORIZED,
- Device.COMPUTER_DESKTOP,
- Device.COMPUTER_SERVER,
- Device.COMPUTER_LAPTOP,
- Device.COMPUTER_HANDHELD_PC_PDA,
- Device.COMPUTER_PALM_SIZE_PC_PDA,
- Device.COMPUTER_WEARABLE,
- Device.PHONE_UNCATEGORIZED,
- Device.PHONE_CELLULAR,
- Device.PHONE_CORDLESS,
- Device.PHONE_SMART,
- Device.PHONE_MODEM_OR_GATEWAY,
- Device.PHONE_ISDN ->
+ Device.COMPUTER_DESKTOP,
+ Device.COMPUTER_SERVER,
+ Device.COMPUTER_LAPTOP,
+ Device.COMPUTER_HANDHELD_PC_PDA,
+ Device.COMPUTER_PALM_SIZE_PC_PDA,
+ Device.COMPUTER_WEARABLE,
+ Device.PHONE_UNCATEGORIZED,
+ Device.PHONE_CELLULAR,
+ Device.PHONE_CORDLESS,
+ Device.PHONE_SMART,
+ Device.PHONE_MODEM_OR_GATEWAY,
+ Device.PHONE_ISDN ->
true;
default -> false;
};
diff --git a/framework/java/android/bluetooth/BluetoothCodecConfig.java b/framework/java/android/bluetooth/BluetoothCodecConfig.java
index 4e3a909..731c548 100644
--- a/framework/java/android/bluetooth/BluetoothCodecConfig.java
+++ b/framework/java/android/bluetooth/BluetoothCodecConfig.java
@@ -811,7 +811,7 @@
if (mCodecSpecific1 != other.mCodecSpecific1) {
return false;
}
- // fall through
+ // fall through
default:
return true;
}
diff --git a/framework/java/android/bluetooth/BluetoothCodecType.java b/framework/java/android/bluetooth/BluetoothCodecType.java
index 54547fe..976dcf5 100644
--- a/framework/java/android/bluetooth/BluetoothCodecType.java
+++ b/framework/java/android/bluetooth/BluetoothCodecType.java
@@ -181,7 +181,7 @@
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC -> CODEC_ID_LDAC;
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS -> CODEC_ID_OPUS;
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3,
- BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID ->
+ BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID ->
-1;
default -> -1;
};
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java
index 784e452..42eb542 100644
--- a/framework/java/android/bluetooth/BluetoothDevice.java
+++ b/framework/java/android/bluetooth/BluetoothDevice.java
@@ -3796,7 +3796,6 @@
*
* @return number of times {@link ACTION_KEY_MISSING} intent is thrown for this device since
* last successful encrypted connection
- *
* @hide
*/
@RequiresPermission(BLUETOOTH_CONNECT)
diff --git a/framework/java/android/bluetooth/BluetoothGattCharacteristic.java b/framework/java/android/bluetooth/BluetoothGattCharacteristic.java
index fd8fe85..98e9871 100644
--- a/framework/java/android/bluetooth/BluetoothGattCharacteristic.java
+++ b/framework/java/android/bluetooth/BluetoothGattCharacteristic.java
@@ -591,14 +591,14 @@
switch (formatType) {
case FORMAT_SINT8:
value = intToSignedBits(value, 8);
- // Fall-through intended
+ // Fall-through intended
case FORMAT_UINT8:
mValue[offset] = (byte) (value & 0xFF);
break;
case FORMAT_SINT16:
value = intToSignedBits(value, 16);
- // Fall-through intended
+ // Fall-through intended
case FORMAT_UINT16:
mValue[offset++] = (byte) (value & 0xFF);
mValue[offset] = (byte) ((value >> 8) & 0xFF);
@@ -606,7 +606,7 @@
case FORMAT_SINT32:
value = intToSignedBits(value, 32);
- // Fall-through intended
+ // Fall-through intended
case FORMAT_UINT32:
mValue[offset++] = (byte) (value & 0xFF);
mValue[offset++] = (byte) ((value >> 8) & 0xFF);
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
index 3f59155..3d8160d 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
@@ -389,7 +389,7 @@
if (Flags.leaudioAddOpusHiResCodecType()) {
return "Opus Hi-Res";
}
- // Fall-through intended
+ // Fall-through intended
default:
if (Flags.leaudioAddOpusCodecType()) {
if (mCodecType == SOURCE_CODEC_TYPE_OPUS) {
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java
index 90285de..5b2390e 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfigMetadata.java
@@ -400,7 +400,7 @@
&& sampleRate != SAMPLE_RATE_176400
&& sampleRate != SAMPLE_RATE_192000
&& sampleRate != SAMPLE_RATE_384000) {
- throw new IllegalArgumentException("Invalid sample rate " + sampleRate);
+ throw new IllegalArgumentException("Invalid sample rate " + sampleRate);
}
mSampleRate = sampleRate;
return this;
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
index f40f4d7..27fafe3 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
@@ -358,8 +358,7 @@
*
* @hide
*/
- @SystemApi
- public static final int RSSI_UNKNOWN = 0x7F;
+ @SystemApi public static final int RSSI_UNKNOWN = 0x7F;
/**
* Get the Received Signal Strength Indication (RSSI) value of this Broadcast Source.
diff --git a/framework/java/android/bluetooth/BluetoothMap.java b/framework/java/android/bluetooth/BluetoothMap.java
index a91c5d0..f0f05fd 100644
--- a/framework/java/android/bluetooth/BluetoothMap.java
+++ b/framework/java/android/bluetooth/BluetoothMap.java
@@ -274,9 +274,9 @@
// TODO optimize the rule
return switch (btClass.getDeviceClass()) {
case BluetoothClass.Device.COMPUTER_DESKTOP,
- BluetoothClass.Device.COMPUTER_LAPTOP,
- BluetoothClass.Device.COMPUTER_SERVER,
- BluetoothClass.Device.COMPUTER_UNCATEGORIZED ->
+ BluetoothClass.Device.COMPUTER_LAPTOP,
+ BluetoothClass.Device.COMPUTER_SERVER,
+ BluetoothClass.Device.COMPUTER_UNCATEGORIZED ->
true;
default -> false;
};
diff --git a/framework/java/android/bluetooth/OobData.java b/framework/java/android/bluetooth/OobData.java
index 453230e..94cdcde 100644
--- a/framework/java/android/bluetooth/OobData.java
+++ b/framework/java/android/bluetooth/OobData.java
@@ -11,7 +11,6 @@
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package android.bluetooth;
import static java.util.Objects.requireNonNull;
diff --git a/framework/java/android/bluetooth/le/ChannelSoundingParams.java b/framework/java/android/bluetooth/le/ChannelSoundingParams.java
index 508db1b..16d2103 100644
--- a/framework/java/android/bluetooth/le/ChannelSoundingParams.java
+++ b/framework/java/android/bluetooth/le/ChannelSoundingParams.java
@@ -253,7 +253,7 @@
public @NonNull Builder setSightType(@SightType int sightType) {
if (!List.of(SIGHT_TYPE_UNKNOWN, SIGHT_TYPE_LINE_OF_SIGHT, SIGHT_TYPE_NON_LINE_OF_SIGHT)
.contains(sightType)) {
- throw new IllegalArgumentException("unknown sight type " + sightType);
+ throw new IllegalArgumentException("unknown sight type " + sightType);
}
mSightType = sightType;
return this;
@@ -270,7 +270,7 @@
public @NonNull Builder setLocationType(@LocationType int locationType) {
if (!List.of(LOCATION_TYPE_UNKNOWN, LOCATION_TYPE_INDOOR, LOCATION_TYPE_OUTDOOR)
.contains(locationType)) {
- throw new IllegalArgumentException("unknown location type " + locationType);
+ throw new IllegalArgumentException("unknown location type " + locationType);
}
mLocationType = locationType;
return this;
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java b/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java
index 1bba03f..8555698 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementMethod.java
@@ -74,8 +74,7 @@
*
* @hide
*/
- @SystemApi
- public static final int DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING = 2;
+ @SystemApi public static final int DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING = 2;
private DistanceMeasurementMethod(
int id, boolean isAzimuthAngleSupported, boolean isAltitudeAngleSupported) {
@@ -223,7 +222,7 @@
DISTANCE_MEASUREMENT_METHOD_RSSI,
DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING)
.contains(id)) {
- throw new IllegalArgumentException("unknown method id " + id);
+ throw new IllegalArgumentException("unknown method id " + id);
}
mId = id;
}
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementParams.java b/framework/java/android/bluetooth/le/DistanceMeasurementParams.java
index 492f159d..cb9a53f 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementParams.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementParams.java
@@ -276,7 +276,7 @@
public @NonNull Builder setFrequency(@ReportFrequency int frequency) {
if (!List.of(REPORT_FREQUENCY_LOW, REPORT_FREQUENCY_MEDIUM, REPORT_FREQUENCY_HIGH)
.contains(frequency)) {
- throw new IllegalArgumentException("unknown frequency " + frequency);
+ throw new IllegalArgumentException("unknown frequency " + frequency);
}
mFrequency = frequency;
return this;
@@ -296,7 +296,7 @@
DISTANCE_MEASUREMENT_METHOD_RSSI,
DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING)
.contains(methodId)) {
- throw new IllegalArgumentException("unknown method id " + methodId);
+ throw new IllegalArgumentException("unknown method id " + methodId);
}
mMethodId = methodId;
return this;
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementResult.java b/framework/java/android/bluetooth/le/DistanceMeasurementResult.java
index e385380..57c0047 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementResult.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementResult.java
@@ -64,64 +64,56 @@
*
* @hide
*/
- @SystemApi
- public static final int NADM_ATTACK_IS_EXTREMELY_UNLIKELY = 0;
+ @SystemApi public static final int NADM_ATTACK_IS_EXTREMELY_UNLIKELY = 0;
/**
* Attack is very unlikely.
*
* @hide
*/
- @SystemApi
- public static final int NADM_ATTACK_IS_VERY_UNLIKELY = 1;
+ @SystemApi public static final int NADM_ATTACK_IS_VERY_UNLIKELY = 1;
/**
* Attack is unlikely.
*
* @hide
*/
- @SystemApi
- public static final int NADM_ATTACK_IS_UNLIKELY = 2;
+ @SystemApi public static final int NADM_ATTACK_IS_UNLIKELY = 2;
/**
* Attack is possible.
*
* @hide
*/
- @SystemApi
- public static final int NADM_ATTACK_IS_POSSIBLE = 3;
+ @SystemApi public static final int NADM_ATTACK_IS_POSSIBLE = 3;
/**
* Attack is likely.
*
* @hide
*/
- @SystemApi
- public static final int NADM_ATTACK_IS_LIKELY = 4;
+ @SystemApi public static final int NADM_ATTACK_IS_LIKELY = 4;
/**
* Attack is very likely.
*
* @hide
*/
- @SystemApi
- public static final int NADM_ATTACK_IS_VERY_LIKELY = 5;
+ @SystemApi public static final int NADM_ATTACK_IS_VERY_LIKELY = 5;
/**
* Attack is extremely likely.
*
* @hide
*/
- @SystemApi
- public static final int NADM_ATTACK_IS_EXTREMELY_LIKELY = 6;
+ @SystemApi public static final int NADM_ATTACK_IS_EXTREMELY_LIKELY = 6;
/**
* Unknown NADM, if a device is unable to determine a NADM value, then it shall report this.
*
* @hide
*/
- @SystemApi
- public static final int NADM_UNKNOWN = 0xFF;
+ @SystemApi public static final int NADM_UNKNOWN = 0xFF;
private final double mMeters;
private final double mErrorMeters;
diff --git a/framework/tests/bumble/src/android/bluetooth/PandoraDevice.java b/framework/tests/bumble/src/android/bluetooth/PandoraDevice.java
index 7ce3260..0128e5b 100644
--- a/framework/tests/bumble/src/android/bluetooth/PandoraDevice.java
+++ b/framework/tests/bumble/src/android/bluetooth/PandoraDevice.java
@@ -33,8 +33,8 @@
import pandora.BumbleConfigGrpc;
import pandora.DckGrpc;
import pandora.GATTGrpc;
-import pandora.HIDGrpc;
import pandora.HFPGrpc;
+import pandora.HIDGrpc;
import pandora.HostGrpc;
import pandora.HostProto;
import pandora.HostProto.AdvertiseRequest;
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/EncryptionChangeTest.java b/framework/tests/bumble/src/android/bluetooth/pairing/EncryptionChangeTest.java
index d003e6e..126ae13 100644
--- a/framework/tests/bumble/src/android/bluetooth/pairing/EncryptionChangeTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/pairing/EncryptionChangeTest.java
@@ -125,10 +125,11 @@
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- mUtil = new TestUtil.Builder(sTargetContext)
- .setProfileServiceListener(mProfileServiceListener)
- .setBluetoothAdapter(sAdapter)
- .build();
+ mUtil =
+ new TestUtil.Builder(sTargetContext)
+ .setProfileServiceListener(mProfileServiceListener)
+ .setBluetoothAdapter(sAdapter)
+ .build();
mBumbleDevice = mBumble.getRemoteDevice();
Set<BluetoothDevice> bondedDevices = sAdapter.getBondedDevices();
@@ -157,18 +158,13 @@
/**
* Process of writing a test function
*
- * 1. Create an IntentReceiver object first with following way:
- * IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- * BluetoothDevice.ACTION_1,
- * BluetoothDevice.ACTION_2)
- * .setIntentListener(--) // optional
- * .setIntentTimeout(--) // optional
- * .build();
- * 2. Use the intentReceiver instance for all Intent related verification, and pass
- * the same instance to all the helper/testStep functions which has similar Intent
- * requirements.
- * 3. Once all the verification is done, call `intentReceiver.close()` before returning
- * from the function.
+ * <p>1. Create an IntentReceiver object first with following way: IntentReceiver intentReceiver
+ * = new IntentReceiver.Builder(sTargetContext, BluetoothDevice.ACTION_1,
+ * BluetoothDevice.ACTION_2) .setIntentListener(--) // optional .setIntentTimeout(--) //
+ * optional .build(); 2. Use the intentReceiver instance for all Intent related verification,
+ * and pass the same instance to all the helper/testStep functions which has similar Intent
+ * requirements. 3. Once all the verification is done, call `intentReceiver.close()` before
+ * returning from the function.
*/
/**
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/OobPairingTest.java b/framework/tests/bumble/src/android/bluetooth/pairing/OobPairingTest.java
index 933d3ef..c780ab1 100644
--- a/framework/tests/bumble/src/android/bluetooth/pairing/OobPairingTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/pairing/OobPairingTest.java
@@ -186,18 +186,13 @@
/**
* Process of writing a test function
*
- * 1. Create an IntentReceiver object first with following way:
- * IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- * BluetoothDevice.ACTION_1,
- * BluetoothDevice.ACTION_2)
- * .setIntentListener(--) // optional
- * .setIntentTimeout(--) // optional
- * .build();
- * 2. Use the intentReceiver instance for all Intent related verification, and pass
- * the same instance to all the helper/testStep functions which has similar Intent
- * requirements.
- * 3. Once all the verification is done, call `intentReceiver.close()` before returning
- * from the function.
+ * <p>1. Create an IntentReceiver object first with following way: IntentReceiver intentReceiver
+ * = new IntentReceiver.Builder(sTargetContext, BluetoothDevice.ACTION_1,
+ * BluetoothDevice.ACTION_2) .setIntentListener(--) // optional .setIntentTimeout(--) //
+ * optional .build(); 2. Use the intentReceiver instance for all Intent related verification,
+ * and pass the same instance to all the helper/testStep functions which has similar Intent
+ * requirements. 3. Once all the verification is done, call `intentReceiver.close()` before
+ * returning from the function.
*/
/**
@@ -329,8 +324,8 @@
/**
* Initiates pairing from Bumble
*
- * <p>Bumble starts scanning and selects first available device, then
- * connects to it and starts pairing.
+ * <p>Bumble starts scanning and selects first available device, then connects to it and starts
+ * pairing.
*/
private void testStep_initiatePairingFromRemote() {
ByteString deviceAddr;
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java b/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java
index 885474d..7a311f7 100644
--- a/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java
@@ -162,10 +162,11 @@
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- mUtil = new TestUtil.Builder(sTargetContext)
- .setProfileServiceListener(mProfileServiceListener)
- .setBluetoothAdapter(sAdapter)
- .build();
+ mUtil =
+ new TestUtil.Builder(sTargetContext)
+ .setProfileServiceListener(mProfileServiceListener)
+ .setBluetoothAdapter(sAdapter)
+ .build();
// Get profile proxies
mHidService = (BluetoothHidHost) mUtil.getProfileProxy(BluetoothProfile.HID_HOST);
@@ -210,18 +211,13 @@
/**
* Process of writing a test function
*
- * 1. Create an IntentReceiver object first with following way:
- * IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- * BluetoothDevice.ACTION_1,
- * BluetoothDevice.ACTION_2)
- * .setIntentListener(--) // optional
- * .setIntentTimeout(--) // optional
- * .build();
- * 2. Use the intentReceiver instance for all Intent related verification, and pass
- * the same instance to all the helper/testStep functions which has similar Intent
- * requirements.
- * 3. Once all the verification is done, call `intentReceiver.close()` before returning
- * from the function.
+ * <p>1. Create an IntentReceiver object first with following way: IntentReceiver intentReceiver
+ * = new IntentReceiver.Builder(sTargetContext, BluetoothDevice.ACTION_1,
+ * BluetoothDevice.ACTION_2) .setIntentListener(--) // optional .setIntentTimeout(--) //
+ * optional .build(); 2. Use the intentReceiver instance for all Intent related verification,
+ * and pass the same instance to all the helper/testStep functions which has similar Intent
+ * requirements. 3. Once all the verification is done, call `intentReceiver.close()` before
+ * returning from the function.
*/
/**
@@ -238,10 +234,12 @@
*/
@Test
public void testBrEdrPairing_phoneInitiatedBrEdrInquiryOnlyJustWorks() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED,
- BluetoothDevice.ACTION_PAIRING_REQUEST)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST)
+ .build();
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
@@ -292,10 +290,12 @@
@Test
@RequiresFlagsEnabled({Flags.FLAG_IGNORE_UNRELATED_CANCEL_BOND})
public void testBrEdrPairing_cancelBond_forUnrelatedDevice() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED,
- BluetoothDevice.ACTION_PAIRING_REQUEST)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST)
+ .build();
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
@@ -347,11 +347,13 @@
*/
@Test
public void testBrEdrPairing_phoneInitiatedBrEdrInquiryOnlyJustWorksWhileSdpConnected() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_ACL_CONNECTED,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED,
- BluetoothDevice.ACTION_PAIRING_REQUEST)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_ACL_CONNECTED,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST)
+ .build();
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
@@ -418,9 +420,10 @@
*/
@Test
public void testCancelBondLe_WithGattServiceDiscovery() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext, BluetoothDevice.ACTION_BOND_STATE_CHANGED)
+ .build();
// Outgoing GATT service discovery and incoming LE pairing in parallel
StreamObserverSpliterator<SecureRequest, SecureResponse> responseObserver =
@@ -468,9 +471,10 @@
*/
@Test
public void testBondLe_WithGattServiceDiscovery() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext, BluetoothDevice.ACTION_BOND_STATE_CHANGED)
+ .build();
// Outgoing GATT service discovery and incoming LE pairing in parallel
StreamObserverSpliterator<SecureRequest, SecureResponse> responseObserver =
@@ -514,9 +518,9 @@
*/
@Test
public void testBondLe_Reconnect() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_ACL_CONNECTED)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(sTargetContext, BluetoothDevice.ACTION_ACL_CONNECTED)
+ .build();
testStep_BondLe(intentReceiver, mBumbleDevice, OwnAddressType.PUBLIC);
assertThat(sAdapter.getBondedDevices()).contains(mBumbleDevice);
@@ -603,9 +607,9 @@
*/
@Test
public void testBondBredr_Reconnect() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_ACL_CONNECTED)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(sTargetContext, BluetoothDevice.ACTION_ACL_CONNECTED)
+ .build();
testStep_BondBredr(intentReceiver);
assertThat(sAdapter.getBondedDevices()).contains(mBumbleDevice);
@@ -650,10 +654,12 @@
*/
@Test
public void testRemoveBondLe_WhenConnected() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_ACL_DISCONNECTED,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_ACL_DISCONNECTED,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED)
+ .build();
testStep_BondLe(intentReceiver, mBumbleDevice, OwnAddressType.PUBLIC);
assertThat(sAdapter.getBondedDevices()).contains(mBumbleDevice);
@@ -751,10 +757,12 @@
*/
@Test
public void testRemoveBondBredr_WhenConnected() {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_ACL_DISCONNECTED,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_ACL_DISCONNECTED,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED)
+ .build();
testStep_BondBredr(intentReceiver);
assertThat(sAdapter.getBondedDevices()).contains(mBumbleDevice);
@@ -935,11 +943,13 @@
*/
@Test
public void testCreateLeSocket_BondLe() throws Exception {
- IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- BluetoothDevice.ACTION_ACL_CONNECTED,
- BluetoothDevice.ACTION_PAIRING_REQUEST,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED)
- .build();
+ IntentReceiver intentReceiver =
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_ACL_CONNECTED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED)
+ .build();
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
@@ -949,13 +959,15 @@
BluetoothSocket bluetoothSocket = mBumbleDevice.createL2capChannel(TEST_PSM);
ExecutorService executor = Executors.newSingleThreadExecutor();
- Future<?> futureSocketConnection = executor.submit(() -> {
- try {
- bluetoothSocket.connect();
- } catch (IOException e) {
- Log.e(TAG, "Exception during socket connection: " + e);
- }
- });
+ Future<?> futureSocketConnection =
+ executor.submit(
+ () -> {
+ try {
+ bluetoothSocket.connect();
+ } catch (IOException e) {
+ Log.e(TAG, "Exception during socket connection: " + e);
+ }
+ });
try {
futureSocketConnection.get(2, TimeUnit.SECONDS);
} catch (TimeoutException e) {
@@ -971,18 +983,19 @@
// Start LE advertisement from Bumble
AdvertiseRequest.Builder advRequestBuilder =
- AdvertiseRequest.newBuilder().setLegacy(true)
- .setConnectable(true)
- .setOwnAddressType(OwnAddressType.PUBLIC);
+ AdvertiseRequest.newBuilder()
+ .setLegacy(true)
+ .setConnectable(true)
+ .setOwnAddressType(OwnAddressType.PUBLIC);
StreamObserverSpliterator<SecureRequest, AdvertiseResponse> responseObserver =
new StreamObserverSpliterator<>();
mBumble.host().advertise(advRequestBuilder.build(), responseObserver);
intentReceiver.verifyReceivedOrdered(
- hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
- hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
- hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING));
+ hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
+ hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING));
intentReceiver.verifyReceivedOrdered(
hasAction(BluetoothDevice.ACTION_ACL_CONNECTED),
@@ -1539,33 +1552,29 @@
private void testStep_BondBredr(IntentReceiver parentIntentReceiver) {
IntentReceiver intentReceiver =
- IntentReceiver.update(
- parentIntentReceiver,
- new IntentReceiver.Builder(
- sTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED,
- BluetoothDevice.ACTION_ACL_CONNECTED,
- BluetoothDevice.ACTION_PAIRING_REQUEST));
+ IntentReceiver.update(
+ parentIntentReceiver,
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED,
+ BluetoothDevice.ACTION_ACL_CONNECTED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST));
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
- .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(),
- TimeUnit.MILLISECONDS)
+ .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS)
.onPairing(mPairingEventStreamObserver);
- assertThat(mBumbleDevice.createBond(BluetoothDevice.TRANSPORT_BREDR)).
- isTrue();
+ assertThat(mBumbleDevice.createBond(BluetoothDevice.TRANSPORT_BREDR)).isTrue();
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
- hasExtra(BluetoothDevice.EXTRA_BOND_STATE,
- BluetoothDevice.BOND_BONDING));
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING));
intentReceiver.verifyReceivedOrdered(
hasAction(BluetoothDevice.ACTION_ACL_CONNECTED),
hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
- hasExtra(BluetoothDevice.EXTRA_TRANSPORT,
- BluetoothDevice.TRANSPORT_BREDR));
+ hasExtra(BluetoothDevice.EXTRA_TRANSPORT, BluetoothDevice.TRANSPORT_BREDR));
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_PAIRING_REQUEST),
hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
@@ -1579,15 +1588,13 @@
PairingEvent pairingEvent = mPairingEventStreamObserver.iterator().next();
assertThat(pairingEvent.hasJustWorks()).isTrue();
pairingEventAnswerObserver.onNext(
- PairingEventAnswer.newBuilder().setEvent(pairingEvent)
- .setConfirm(true).build());
+ PairingEventAnswer.newBuilder().setEvent(pairingEvent).setConfirm(true).build());
// Ensure that pairing succeeds
intentReceiver.verifyReceivedOrdered(
hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
- hasExtra(BluetoothDevice.EXTRA_BOND_STATE,
- BluetoothDevice.BOND_BONDED));
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDED));
/* Unregisters all intent actions registered in this function */
intentReceiver.close();
@@ -1604,14 +1611,14 @@
IntentReceiver parentIntentReceiver) {
// Register new actions specific to this helper function
IntentReceiver intentReceiver =
- IntentReceiver.update(
- parentIntentReceiver,
- new IntentReceiver.Builder(
- sTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED,
- BluetoothDevice.ACTION_PAIRING_REQUEST,
- BluetoothDevice.ACTION_UUID,
- BluetoothDevice.ACTION_ACL_CONNECTED));
+ IntentReceiver.update(
+ parentIntentReceiver,
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST,
+ BluetoothDevice.ACTION_UUID,
+ BluetoothDevice.ACTION_ACL_CONNECTED));
// Register lots of interesting GATT services on Bumble
for (int i = 0; i < 40; i++) {
@@ -1626,8 +1633,7 @@
}
// Start GATT service discovery, this will establish LE ACL
- assertThat(mBumbleDevice.fetchUuidsWithSdp(BluetoothDevice.TRANSPORT_LE))
- .isTrue();
+ assertThat(mBumbleDevice.fetchUuidsWithSdp(BluetoothDevice.TRANSPORT_LE)).isTrue();
// Make Bumble connectable
AdvertiseResponse advertiseResponse =
@@ -1646,8 +1652,7 @@
// Wait for connection on Android
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_ACL_CONNECTED),
- hasExtra(BluetoothDevice.EXTRA_TRANSPORT,
- BluetoothDevice.TRANSPORT_LE));
+ hasExtra(BluetoothDevice.EXTRA_TRANSPORT, BluetoothDevice.TRANSPORT_LE));
// Start pairing from Bumble
StreamObserverSpliterator<SecureRequest, SecureResponse> responseObserver =
@@ -1665,8 +1670,7 @@
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
- hasExtra(BluetoothDevice.EXTRA_BOND_STATE,
- BluetoothDevice.BOND_BONDING));
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING));
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_PAIRING_REQUEST),
hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
@@ -1690,23 +1694,24 @@
// so that ACTION_UUID is received here.
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_UUID),
- hasExtra(BluetoothDevice.EXTRA_UUID,
- Matchers.hasItemInArray(BATTERY_UUID)));
+ hasExtra(BluetoothDevice.EXTRA_UUID, Matchers.hasItemInArray(BATTERY_UUID)));
intentReceiver.close();
return responseObserver;
}
- private void testStep_BondLe(IntentReceiver parentIntentReceiver,
- BluetoothDevice device, OwnAddressType ownAddressType) {
+ private void testStep_BondLe(
+ IntentReceiver parentIntentReceiver,
+ BluetoothDevice device,
+ OwnAddressType ownAddressType) {
IntentReceiver intentReceiver =
- IntentReceiver.update(
- parentIntentReceiver,
- new IntentReceiver.Builder(
- sTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED,
- BluetoothDevice.ACTION_ACL_CONNECTED,
- BluetoothDevice.ACTION_PAIRING_REQUEST));
+ IntentReceiver.update(
+ parentIntentReceiver,
+ new IntentReceiver.Builder(
+ sTargetContext,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED,
+ BluetoothDevice.ACTION_ACL_CONNECTED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST));
mBumble.gattBlocking()
.registerService(
@@ -1735,8 +1740,7 @@
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
- .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(),
- TimeUnit.MILLISECONDS)
+ .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS)
.onPairing(mPairingEventStreamObserver);
assertThat(device.createBond(BluetoothDevice.TRANSPORT_LE)).isTrue();
@@ -1744,13 +1748,11 @@
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
hasExtra(BluetoothDevice.EXTRA_DEVICE, device),
- hasExtra(BluetoothDevice.EXTRA_BOND_STATE,
- BluetoothDevice.BOND_BONDING));
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING));
intentReceiver.verifyReceivedOrdered(
hasAction(BluetoothDevice.ACTION_ACL_CONNECTED),
hasExtra(BluetoothDevice.EXTRA_DEVICE, device),
- hasExtra(BluetoothDevice.EXTRA_TRANSPORT,
- BluetoothDevice.TRANSPORT_LE));
+ hasExtra(BluetoothDevice.EXTRA_TRANSPORT, BluetoothDevice.TRANSPORT_LE));
intentReceiver.verifyReceived(
hasAction(BluetoothDevice.ACTION_PAIRING_REQUEST),
hasExtra(BluetoothDevice.EXTRA_DEVICE, device),
@@ -1764,15 +1766,13 @@
PairingEvent pairingEvent = mPairingEventStreamObserver.iterator().next();
assertThat(pairingEvent.hasJustWorks()).isTrue();
pairingEventAnswerObserver.onNext(
- PairingEventAnswer.newBuilder().setEvent(pairingEvent)
- .setConfirm(true).build());
+ PairingEventAnswer.newBuilder().setEvent(pairingEvent).setConfirm(true).build());
// Ensure that pairing succeeds
intentReceiver.verifyReceivedOrdered(
hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
hasExtra(BluetoothDevice.EXTRA_DEVICE, device),
- hasExtra(BluetoothDevice.EXTRA_BOND_STATE,
- BluetoothDevice.BOND_BONDED));
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDED));
intentReceiver.close();
}
@@ -1813,8 +1813,8 @@
intentReceiver.close();
}
- private void doTestIdentityAddressWithType(BluetoothDevice device,
- OwnAddressType ownAddressType) {
+ private void doTestIdentityAddressWithType(
+ BluetoothDevice device, OwnAddressType ownAddressType) {
BluetoothAddress identityAddress = device.getIdentityAddressWithType();
assertThat(identityAddress.getAddress()).isNull();
assertThat(identityAddress.getAddressType())
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/PairingWithDiscoveryTest.java b/framework/tests/bumble/src/android/bluetooth/pairing/PairingWithDiscoveryTest.java
index 6f30d5b..d536e04 100644
--- a/framework/tests/bumble/src/android/bluetooth/pairing/PairingWithDiscoveryTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/pairing/PairingWithDiscoveryTest.java
@@ -121,19 +121,13 @@
case BluetoothDevice.ACTION_FOUND:
BluetoothDevice device =
intent.getParcelableExtra(
- BluetoothDevice.EXTRA_DEVICE,
- BluetoothDevice.class);
+ BluetoothDevice.EXTRA_DEVICE, BluetoothDevice.class);
String deviceName =
- String.valueOf(
- intent.getStringExtra(BluetoothDevice.EXTRA_NAME));
- Log.i(
- TAG,
- "Discovered device: "
- + device
- + " with name: "
- + deviceName);
- if (deviceName != null && BUMBLE_DEVICE_NAME.equals(deviceName) &&
- mDeviceFound != null) {
+ String.valueOf(intent.getStringExtra(BluetoothDevice.EXTRA_NAME));
+ Log.i(TAG, "Discovered device: " + device + " with name: " + deviceName);
+ if (deviceName != null
+ && BUMBLE_DEVICE_NAME.equals(deviceName)
+ && mDeviceFound != null) {
mDeviceFound.complete(device);
}
break;
@@ -156,7 +150,7 @@
for (BluetoothDevice device : mAdapter.getBondedDevices()) {
removeBond(device);
}
- }
+ }
@After
public void tearDown() throws Exception {
@@ -202,8 +196,8 @@
mBumble.hostBlocking()
.setDiscoverabilityMode(
SetDiscoverabilityModeRequest.newBuilder()
- .setMode(DiscoverabilityMode.NOT_DISCOVERABLE)
- .build());
+ .setMode(DiscoverabilityMode.NOT_DISCOVERABLE)
+ .build());
// Make Bumble Non connectable over BR/EDR
SetConnectabilityModeRequest request =
@@ -214,14 +208,15 @@
// Start LE advertisement from Bumble
AdvertiseRequest.Builder requestBuilder =
- AdvertiseRequest.newBuilder().setLegacy(true)
- .setConnectable(true)
- .setOwnAddressType(OwnAddressType.PUBLIC);
+ AdvertiseRequest.newBuilder()
+ .setLegacy(true)
+ .setConnectable(true)
+ .setOwnAddressType(OwnAddressType.PUBLIC);
HostProto.DataTypes.Builder dataTypeBuilder = HostProto.DataTypes.newBuilder();
dataTypeBuilder.setCompleteLocalName(BUMBLE_DEVICE_NAME);
dataTypeBuilder.setIncludeCompleteLocalName(true);
- //Set LE AD Flags to be LE General discoverable, also supports dual mode
+ // Set LE AD Flags to be LE General discoverable, also supports dual mode
dataTypeBuilder.setLeDiscoverabilityModeValue(LE_GENERAL_DISCOVERABLE);
requestBuilder.setData(dataTypeBuilder.build());
@@ -234,8 +229,7 @@
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
- .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(),
- TimeUnit.MILLISECONDS)
+ .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS)
.onPairing(mPairingEventStreamObserver);
// Start pairing from Android with Auto transport
@@ -262,8 +256,7 @@
PairingEvent pairingEvent = mPairingEventStreamObserver.iterator().next();
assertThat(pairingEvent.hasJustWorks()).isTrue();
pairingEventAnswerObserver.onNext(
- PairingEventAnswer.newBuilder().setEvent(pairingEvent)
- .setConfirm(true).build());
+ PairingEventAnswer.newBuilder().setEvent(pairingEvent).setConfirm(true).build());
// Ensure that pairing succeeds
verifyIntentReceived(
@@ -308,8 +301,8 @@
mBumble.hostBlocking()
.setDiscoverabilityMode(
SetDiscoverabilityModeRequest.newBuilder()
- .setMode(DiscoverabilityMode.DISCOVERABLE_GENERAL)
- .build());
+ .setMode(DiscoverabilityMode.DISCOVERABLE_GENERAL)
+ .build());
SetConnectabilityModeRequest request =
SetConnectabilityModeRequest.newBuilder()
@@ -322,8 +315,7 @@
StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
mBumble.security()
- .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(),
- TimeUnit.MILLISECONDS)
+ .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS)
.onPairing(mPairingEventStreamObserver);
// Start pairing from Android with Auto transport
@@ -418,7 +410,7 @@
mContext.unregisterReceiver(mReceiver);
}
- /**
+ /**
* Helper function to add reference count to registered intent actions
*
* @param actions new intent actions to add. If the array is empty, it is a no-op.
@@ -497,4 +489,4 @@
private int getTotalActionRegistrationCounts() {
return mActionRegistrationCounts.values().stream().reduce(0, Integer::sum);
}
-}
\ No newline at end of file
+}
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/utils/IntentReceiver.java b/framework/tests/bumble/src/android/bluetooth/pairing/utils/IntentReceiver.java
index 6f8ba7c..23ba641 100644
--- a/framework/tests/bumble/src/android/bluetooth/pairing/utils/IntentReceiver.java
+++ b/framework/tests/bumble/src/android/bluetooth/pairing/utils/IntentReceiver.java
@@ -48,22 +48,17 @@
import java.util.Iterator;
/**
- * IntentReceiver helps in managing the Intents received through the Broadcast
- * receiver, with specific intent actions registered.
- * It uses Builder pattern for instance creation, and also allows setting up
- * a custom listener's onReceive().
+ * IntentReceiver helps in managing the Intents received through the Broadcast receiver, with
+ * specific intent actions registered. It uses Builder pattern for instance creation, and also
+ * allows setting up a custom listener's onReceive().
*
- * Use the following way to create an instance of the IntentReceiver.
- * IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
- * BluetoothDevice.ACTION_1,
- * BluetoothDevice.ACTION_2)
- * .setIntentListener(--) // optional
- * .setIntentTimeout(--) // optional
- * .build();
+ * <p>Use the following way to create an instance of the IntentReceiver. IntentReceiver
+ * intentReceiver = new IntentReceiver.Builder(sTargetContext, BluetoothDevice.ACTION_1,
+ * BluetoothDevice.ACTION_2) .setIntentListener(--) // optional .setIntentTimeout(--) // optional
+ * .build();
*
- * Ordered and unordered verification mechanisms are also provided through public methods.
+ * <p>Ordered and unordered verification mechanisms are also provided through public methods.
*/
-
public class IntentReceiver {
private static final String TAG = IntentReceiver.class.getSimpleName();
@@ -78,15 +73,16 @@
}
@Mock private BroadcastReceiver mReceiver;
+
/** To verify the received intents in-order */
private final InOrder mInOrder;
+
private final Deque<Builder> mDqBuilder;
private final Context mContext;
/**
- * Creates an Intent receiver from the builder instance
- * Note: This is a private constructor, so always prepare IntentReceiver's
- * instance through Builder().
+ * Creates an Intent receiver from the builder instance Note: This is a private constructor, so
+ * always prepare IntentReceiver's instance through Builder().
*
* @param builder Pre-built builder instance
*/
@@ -111,11 +107,9 @@
}
/**
- * Builder class which helps in avoiding overloading constructors (as the class grows)
- * Usage:
- * new IntentReceiver.Builder(ARGS)
- * .setterMethods() **Optional calls, as these are default params
- * .build();
+ * Builder class which helps in avoiding overloading constructors (as the class grows) Usage:
+ * new IntentReceiver.Builder(ARGS) .setterMethods() **Optional calls, as these are default
+ * params .build();
*/
public static class Builder {
private final Context mContext;
@@ -128,9 +122,8 @@
private IntentFilter mIntentFilter;
/**
- * Private default constructor to avoid creation of Builder default
- * instance directly as we need some instance variables to be initiated
- * with user defined values.
+ * Private default constructor to avoid creation of Builder default instance directly as we
+ * need some instance variables to be initiated with user defined values.
*/
private Builder() {
mContext = null;
@@ -144,8 +137,10 @@
*/
public Builder(@NonNull Context context, String... intentStrings) {
mContext = context;
- mIntentStrings = requireNonNull(intentStrings,
- "IntentReceiver.Builder(): Intent string cannot be null");
+ mIntentStrings =
+ requireNonNull(
+ intentStrings,
+ "IntentReceiver.Builder(): Intent string cannot be null");
if (mIntentStrings.length == 0) {
throw new RuntimeException("IntentReceiver.Builder(): No intents to register");
@@ -169,8 +164,8 @@
}
/**
- * Builds and returns the IntentReceiver object with all the passed,
- * and default params supplied to Builder().
+ * Builds and returns the IntentReceiver object with all the passed, and default params
+ * supplied to Builder().
*/
public IntentReceiver build() {
return new IntentReceiver(this);
@@ -217,19 +212,17 @@
}
/**
- * This function will make sure that the instance is properly cleared
- * based on the registered actions.
- * Note: This function MUST be called before returning from the caller function,
- * as this either unregisters the latest registered actions, or free resources.
+ * This function will make sure that the instance is properly cleared based on the registered
+ * actions. Note: This function MUST be called before returning from the caller function, as
+ * this either unregisters the latest registered actions, or free resources.
*/
public void close() {
Log.d(TAG, "close(): " + mDqBuilder.size());
/* More than 1 Builders are present in deque */
- if(mDqBuilder.size() > 1) {
+ if (mDqBuilder.size() > 1) {
rollbackBuilder();
- }
- else {
+ } else {
// Only 1 builder remaining, safely close this instance.
verifyNoMoreInteractions();
teardown();
@@ -241,14 +234,11 @@
*
* @param parentIntentReceiver Parent IntentReceiver instance
* @param builder New builder instance
- *
- * Note: This is a helper function to be used in testStep functions where properties
- * are updated in the new builder instance, and then pushed to the parent instance.
+ * <p>Note: This is a helper function to be used in testStep functions where properties are
+ * updated in the new builder instance, and then pushed to the parent instance.
*/
- public static IntentReceiver update(
- IntentReceiver parentIntentReceiver, Builder builder) {
- if(parentIntentReceiver == null)
- return builder.build();
+ public static IntentReceiver update(IntentReceiver parentIntentReceiver, Builder builder) {
+ if (parentIntentReceiver == null) return builder.build();
parentIntentReceiver.updateBuilder(builder);
return parentIntentReceiver;
@@ -259,45 +249,44 @@
/** Registers the listener for the received intents, and perform a custom logic as required */
private void setupListener() {
doAnswer(
- inv -> {
- Log.d(
- TAG,
- "onReceive(): intent=" +
- Arrays.toString(inv.getArguments()));
+ inv -> {
+ Log.d(
+ TAG,
+ "onReceive(): intent=" + Arrays.toString(inv.getArguments()));
- if (mDqBuilder.peekFirst().mIntentListener == null) return null;
+ if (mDqBuilder.peekFirst().mIntentListener == null) return null;
- Intent intent = inv.getArgument(1);
+ Intent intent = inv.getArgument(1);
- /* Custom `onReceive` will be provided by the caller */
- mDqBuilder.peekFirst().mIntentListener.onReceive(intent);
- return null;
- })
- .when(mReceiver)
- .onReceive(any(), any());
+ /* Custom `onReceive` will be provided by the caller */
+ mDqBuilder.peekFirst().mIntentListener.onReceive(intent);
+ return null;
+ })
+ .when(mReceiver)
+ .onReceive(any(), any());
}
/**
- * Registers the latest intent filter which is at the deque.peekFirst()
- * Note: The mDqBuilder must not be empty here.
+ * Registers the latest intent filter which is at the deque.peekFirst() Note: The mDqBuilder
+ * must not be empty here.
*/
private void registerReceiver() {
IntentFilter intentFilter;
/* ArrayDeque should not be empty at all while registering a receiver */
assertThat(mDqBuilder.isEmpty()).isFalse();
- intentFilter = (IntentFilter)mDqBuilder.peekFirst().mIntentFilter;
- Log.d(TAG, "registerReceiver(): Registering for intents: " +
- getActionsFromIntentFilter(intentFilter));
+ intentFilter = (IntentFilter) mDqBuilder.peekFirst().mIntentFilter;
+ Log.d(
+ TAG,
+ "registerReceiver(): Registering for intents: "
+ + getActionsFromIntentFilter(intentFilter));
mContext.registerReceiver(mReceiver, intentFilter);
}
/**
- * Unregisters the receiver from the list of active receivers.
- * Also, we can now re-use the same receiver, or register a new
- * receiver with the same or different intent filter, the old
- * registration is no longer valid.
- * Source: Intents and intent filters (Android Developers)
+ * Unregisters the receiver from the list of active receivers. Also, we can now re-use the same
+ * receiver, or register a new receiver with the same or different intent filter, the old
+ * registration is no longer valid. Source: Intents and intent filters (Android Developers)
*/
private void unregisterReceiver() {
Log.d(TAG, "unregisterReceiver()");
@@ -311,10 +300,8 @@
}
/**
- * Registers the new actions passed as argument.
- * 1. Unregister the Builder.
- * 2. Pops a new Builder to roll-back to the old one.
- * 3. Registers the old Builder.
+ * Registers the new actions passed as argument. 1. Unregister the Builder. 2. Pops a new
+ * Builder to roll-back to the old one. 3. Registers the old Builder.
*/
private void rollbackBuilder() {
assertThat(mDqBuilder.isEmpty()).isFalse();
@@ -346,8 +333,8 @@
/**
* Helper function to perform the setup for the IntentReceiver instance
*
- * This is a helper function to perform the setup for the IntentReceiver instance,
- * which includes setting up the listener, and registering the receiver, etc.
+ * <p>This is a helper function to perform the setup for the IntentReceiver instance, which
+ * includes setting up the listener, and registering the receiver, etc.
*/
private void setup() {
setupListener();
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/utils/TestUtil.java b/framework/tests/bumble/src/android/bluetooth/pairing/utils/TestUtil.java
index 7a9c206..e9501ac 100644
--- a/framework/tests/bumble/src/android/bluetooth/pairing/utils/TestUtil.java
+++ b/framework/tests/bumble/src/android/bluetooth/pairing/utils/TestUtil.java
@@ -36,94 +36,91 @@
import java.time.Duration;
public class TestUtil {
- private static final String TAG = TestUtil.class.getSimpleName();
+ private static final String TAG = TestUtil.class.getSimpleName();
- private static final Duration BOND_INTENT_TIMEOUT = Duration.ofSeconds(10);
+ private static final Duration BOND_INTENT_TIMEOUT = Duration.ofSeconds(10);
- private final Context mTargetContext;
- private final BluetoothProfile.ServiceListener mProfileServiceListener;
- private final BluetoothAdapter mAdapter;
-
- private TestUtil(Builder builder) {
- mTargetContext = builder.mTargetContext;
- mProfileServiceListener = builder.mProfileServiceListener;
- mAdapter = builder.mAdapter;
- }
-
- public static class Builder {
- /* Target context is required for all the test functions */
private final Context mTargetContext;
+ private final BluetoothProfile.ServiceListener mProfileServiceListener;
+ private final BluetoothAdapter mAdapter;
- private BluetoothProfile.ServiceListener mProfileServiceListener;
- private BluetoothAdapter mAdapter;
-
- public Builder(@NonNull Context context) {
- mTargetContext = context;
- mProfileServiceListener = null;
- mAdapter = null;
+ private TestUtil(Builder builder) {
+ mTargetContext = builder.mTargetContext;
+ mProfileServiceListener = builder.mProfileServiceListener;
+ mAdapter = builder.mAdapter;
}
- public Builder setProfileServiceListener(BluetoothProfile.ServiceListener
- profileServiceListener) {
- mProfileServiceListener = profileServiceListener;
- return this;
+ public static class Builder {
+ /* Target context is required for all the test functions */
+ private final Context mTargetContext;
+
+ private BluetoothProfile.ServiceListener mProfileServiceListener;
+ private BluetoothAdapter mAdapter;
+
+ public Builder(@NonNull Context context) {
+ mTargetContext = context;
+ mProfileServiceListener = null;
+ mAdapter = null;
+ }
+
+ public Builder setProfileServiceListener(
+ BluetoothProfile.ServiceListener profileServiceListener) {
+ mProfileServiceListener = profileServiceListener;
+ return this;
+ }
+
+ public Builder setBluetoothAdapter(BluetoothAdapter adapter) {
+ mAdapter = adapter;
+ return this;
+ }
+
+ public TestUtil build() {
+ return new TestUtil(this);
+ }
}
- public Builder setBluetoothAdapter(BluetoothAdapter adapter) {
- mAdapter = adapter;
- return this;
+ /**
+ * Helper function to remove the bond for the given device
+ *
+ * @param parentIntentReceiver IntentReceiver instance from the parent test caller This should
+ * be `null` if there is no parent IntentReceiver instance.
+ * @param device The device to remove the bond for
+ */
+ public void removeBond(IntentReceiver parentIntentReceiver, BluetoothDevice device) {
+ IntentReceiver intentReceiver =
+ IntentReceiver.update(
+ parentIntentReceiver,
+ new IntentReceiver.Builder(
+ mTargetContext, BluetoothDevice.ACTION_BOND_STATE_CHANGED));
+
+ assertThat(device.removeBond()).isTrue();
+ intentReceiver.verifyReceivedOrdered(
+ hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
+ hasExtra(BluetoothDevice.EXTRA_DEVICE, device),
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE));
+
+ intentReceiver.close();
}
- public TestUtil build() {
- return new TestUtil(this);
+ /**
+ * Get the profile proxy for the given profile
+ *
+ * @param profile The profile to get the proxy for
+ * @throws RuntimeException if mProfileServiceListener || mAdapter is null (passed during
+ * instance creation)
+ * @return The profile proxy
+ */
+ public BluetoothProfile getProfileProxy(int profile) {
+ if (mProfileServiceListener == null || mAdapter == null) {
+ throw new RuntimeException(
+ "TestUtil: ServiceListener or BluetoothAdapter in getProfileProxy() is NULL");
+ }
+
+ mAdapter.getProfileProxy(mTargetContext, mProfileServiceListener, profile);
+ ArgumentCaptor<BluetoothProfile> proxyCaptor =
+ ArgumentCaptor.forClass(BluetoothProfile.class);
+ verify(mProfileServiceListener, timeout(BOND_INTENT_TIMEOUT.toMillis()))
+ .onServiceConnected(eq(profile), proxyCaptor.capture());
+ return proxyCaptor.getValue();
}
- }
-
- /**
- * Helper function to remove the bond for the given device
- *
- * @param parentIntentReceiver IntentReceiver instance from the parent test caller
- * This should be `null` if there is no parent IntentReceiver instance.
- * @param device The device to remove the bond for
- */
- public void removeBond(IntentReceiver parentIntentReceiver,
- BluetoothDevice device) {
- IntentReceiver intentReceiver =
- IntentReceiver.update(parentIntentReceiver,
- new IntentReceiver.Builder(
- mTargetContext,
- BluetoothDevice.ACTION_BOND_STATE_CHANGED));
-
- assertThat(device.removeBond()).isTrue();
- intentReceiver.verifyReceivedOrdered(
- hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
- hasExtra(BluetoothDevice.EXTRA_DEVICE, device),
- hasExtra(BluetoothDevice.EXTRA_BOND_STATE,
- BluetoothDevice.BOND_NONE));
-
- intentReceiver.close();
- }
-
- /**
- * Get the profile proxy for the given profile
- *
- * @param profile The profile to get the proxy for
- * @throws RuntimeException if mProfileServiceListener || mAdapter is null
- * (passed during instance creation)
- * @return The profile proxy
- */
- public BluetoothProfile getProfileProxy(int profile) {
- if (mProfileServiceListener == null ||
- mAdapter == null) {
- throw new RuntimeException(
- "TestUtil: ServiceListener or BluetoothAdapter in getProfileProxy() is NULL");
- }
-
- mAdapter.getProfileProxy(mTargetContext, mProfileServiceListener, profile);
- ArgumentCaptor<BluetoothProfile> proxyCaptor =
- ArgumentCaptor.forClass(BluetoothProfile.class);
- verify(mProfileServiceListener, timeout(BOND_INTENT_TIMEOUT.toMillis()))
- .onServiceConnected(eq(profile), proxyCaptor.capture());
- return proxyCaptor.getValue();
- }
-}
\ No newline at end of file
+}
diff --git a/framework/tests/util/src/android/bluetooth/cts/TestUtils.java b/framework/tests/util/src/android/bluetooth/cts/TestUtils.java
index 9c0206e..28b9ff5 100644
--- a/framework/tests/util/src/android/bluetooth/cts/TestUtils.java
+++ b/framework/tests/util/src/android/bluetooth/cts/TestUtils.java
@@ -16,7 +16,6 @@
package android.bluetooth.cts;
-
import static com.google.common.truth.Truth.assertThat;
import android.bluetooth.BluetoothAdapter;
@@ -52,9 +51,9 @@
case BluetoothProfile.A2DP_SINK -> {
return BluetoothProperties.isProfileA2dpSinkEnabled().orElse(false);
}
- // Hidden profile
- // case BluetoothProfile.AVRCP:
- // return BluetoothProperties.isProfileAvrcpTargetEnabled().orElse(false);
+ // Hidden profile
+ // case BluetoothProfile.AVRCP:
+ // return BluetoothProperties.isProfileAvrcpTargetEnabled().orElse(false);
case BluetoothProfile.AVRCP_CONTROLLER -> {
return BluetoothProperties.isProfileAvrcpControllerEnabled().orElse(false);
}
@@ -99,18 +98,18 @@
case BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT -> {
return BluetoothProperties.isProfileBapBroadcastAssistEnabled().orElse(false);
}
- // Hidden profile
- // case BluetoothProfile.LE_CALL_CONTROL:
- // return BluetoothProperties.isProfileCcpServerEnabled().orElse(false);
+ // Hidden profile
+ // case BluetoothProfile.LE_CALL_CONTROL:
+ // return BluetoothProperties.isProfileCcpServerEnabled().orElse(false);
case BluetoothProfile.MAP -> {
return BluetoothProperties.isProfileMapServerEnabled().orElse(false);
}
case BluetoothProfile.MAP_CLIENT -> {
return BluetoothProperties.isProfileMapClientEnabled().orElse(false);
}
- // Hidden profile
- // case BluetoothProfile.MCP_SERVER:
- // return BluetoothProperties.isProfileMcpServerEnabled().orElse(false);
+ // Hidden profile
+ // case BluetoothProfile.MCP_SERVER:
+ // return BluetoothProperties.isProfileMcpServerEnabled().orElse(false);
case BluetoothProfile.OPP -> {
return BluetoothProperties.isProfileOppEnabled().orElse(false);
}
diff --git a/service/src/com/android/server/bluetooth/BluetoothManagerService.java b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
index 30e2028..97ed91c 100644
--- a/service/src/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
@@ -1584,8 +1584,8 @@
}
case MESSAGE_RESTART_BLUETOOTH_SERVICE -> handleRestartMessage();
- // TODO(b/286082382): Timeout should be more than a log. We should at least call
- // context.unbindService, eventually log a metric with it
+ // TODO(b/286082382): Timeout should be more than a log. We should at least call
+ // context.unbindService, eventually log a metric with it
case MESSAGE_TIMEOUT_BIND -> Log.e(TAG, "MESSAGE_TIMEOUT_BIND");
case MESSAGE_USER_SWITCHED -> {