summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-05-01 15:42:19 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-05-01 15:42:19 +0000
commit5ec6248cc699c99773dbe6995a46d9f84078a9a5 (patch)
tree997ae2859bd0d52430e297cc0f80376b0ec501ea
parent0bb2bb29b21449fb2b4670e805df55e4094193e3 (diff)
parente49fbffdc6f80677a00d7ebd7f4277f1a01c8d93 (diff)
Merge "Log class of device more robustly" into main
-rw-r--r--android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp3
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterProperties.java18
-rw-r--r--android/app/src/com/android/bluetooth/btservice/RemoteDevices.java16
3 files changed, 28 insertions, 9 deletions
diff --git a/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp b/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp
index 98bc4d4f4f..45572a946d 100644
--- a/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp
+++ b/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp
@@ -219,7 +219,8 @@ static void remote_device_properties_callback(bt_status_t status,
CallbackEnv sCallbackEnv(__func__);
if (!sCallbackEnv.valid()) return;
- log::verbose("Status is: {}, Properties: {}", bt_status_text(status),
+ log::verbose("Device: {}, Status: {}, Properties: {}",
+ ADDRESS_TO_LOGGABLE_STR(*bd_addr), bt_status_text(status),
num_properties);
if (status != BT_STATUS_SUCCESS) {
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
index ba67584be2..4783a5b271 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
@@ -1282,14 +1282,22 @@ class AdapterProperties {
StringBuilder sb = new StringBuilder();
for (BluetoothDevice device : mBondedDevices) {
String address = device.getAddress();
+ BluetoothClass cod = device.getBluetoothClass();
+ int codInt = cod != null ? cod.getClassOfDevice() : 0;
String brEdrAddress =
Flags.identityAddressNullIfUnknown()
? Utils.getBrEdrAddress(device)
: mService.getIdentityAddress(address);
if (brEdrAddress.equals(address)) {
- writer.println(" " + address
- + " [" + dumpDeviceType(device.getType()) + "] "
- + Utils.getName(device));
+ writer.println(
+ " "
+ + address
+ + " ["
+ + dumpDeviceType(device.getType())
+ + "][ 0x"
+ + String.format("%06X", codInt)
+ + " ] "
+ + Utils.getName(device));
} else {
sb.append(
" "
@@ -1298,7 +1306,9 @@ class AdapterProperties {
+ brEdrAddress
+ " ["
+ dumpDeviceType(device.getType())
- + "] "
+ + "][ 0x"
+ + String.format("%06X", codInt)
+ + " ] "
+ Utils.getName(device)
+ "\n");
}
diff --git a/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java b/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java
index fd94f967ae..21736e6220 100644
--- a/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java
+++ b/android/app/src/com/android/bluetooth/btservice/RemoteDevices.java
@@ -862,7 +862,7 @@ public class RemoteDevices {
BluetoothDevice bdDevice = getDevice(address);
DeviceProperties deviceProperties;
if (bdDevice == null) {
- debugLog("Added new device property");
+ debugLog("Added new device property, device=" + bdDevice);
deviceProperties = addDeviceProperties(address);
bdDevice = getDevice(address);
} else {
@@ -879,7 +879,7 @@ public class RemoteDevices {
val = values[j];
if (val.length > 0) {
synchronized (mObject) {
- debugLog("Property type: " + type);
+ debugLog("Update property, device=" + bdDevice + ", type: " + type);
switch (type) {
case AbstractionLayer.BT_PROPERTY_BDNAME:
final String newName = new String(val);
@@ -911,7 +911,11 @@ public class RemoteDevices {
case AbstractionLayer.BT_PROPERTY_CLASS_OF_DEVICE:
final int newBluetoothClass = Utils.byteArrayToInt(val);
if (newBluetoothClass == deviceProperties.getBluetoothClass()) {
- debugLog("Skip class update for " + bdDevice);
+ debugLog(
+ "Skip class update, device="
+ + bdDevice
+ + ", cod=0x"
+ + Integer.toHexString(newBluetoothClass));
break;
}
deviceProperties.setBluetoothClass(newBluetoothClass);
@@ -924,7 +928,11 @@ public class RemoteDevices {
intent,
BLUETOOTH_CONNECT,
Utils.getTempBroadcastOptions().toBundle());
- debugLog("Remote class is:" + newBluetoothClass);
+ debugLog(
+ "Remote class update, device="
+ + bdDevice
+ + ", cod=0x"
+ + Integer.toHexString(newBluetoothClass));
break;
case AbstractionLayer.BT_PROPERTY_UUIDS:
final ParcelUuid[] newUuids = Utils.byteArrayToUuid(val);