Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ec6248c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Log class of device more robustly" into main

parents 0bb2bb29 e49fbffd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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) {
+14 −4
Original line number Diff line number Diff line
@@ -1282,13 +1282,21 @@ 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()) + "] "
                writer.println(
                        "    "
                                + address
                                + " ["
                                + dumpDeviceType(device.getType())
                                + "][ 0x"
                                + String.format("%06X", codInt)
                                + " ] "
                                + Utils.getName(device));
            } else {
                sb.append(
@@ -1298,6 +1306,8 @@ class AdapterProperties {
                                + brEdrAddress
                                + " ["
                                + dumpDeviceType(device.getType())
                                + "][ 0x"
                                + String.format("%06X", codInt)
                                + " ] "
                                + Utils.getName(device)
                                + "\n");
+12 −4
Original line number Diff line number Diff line
@@ -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);