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

Commit 14a79049 authored by William Escande's avatar William Escande
Browse files

Follow error prone recommendation

```
ObexServerSockets.java:228: warning:
BluetoothSocket is final and does not override Object.toString
            Log.d(mTag, "onConnect() socket: " + conSocket);
                                                 ^
BluetoothPbapService.java:767: warning:
 BluetoothSocket is final and does not override Object.toString
                    + " socket=" + socket);
                                   ^

AvrcpCoverArtService.java:256: warning:
 BluetoothSocket is final and does not override Object.toString
         debug("onConnect() - device=" + device + ", socket=" + socket);
                                                                   ^
PbapClientConnectionHandler.java:377: warning:
 BluetoothSocket is final and does not override Object.toString
                    Log.d(TAG, "Closing socket" + mSocket);
                                                  ^
 [...]
    (see https://errorprone.info/bugpattern/ObjectToString)
```

Bug: 236759221
Test: m RUN_ERROR_PRONE=true Bluetooth
Ignore-AOSP-First: Cherry-pick of aosp/2133706 to solve merge conflict
Merged-In: I6a49a8ef8c6b380547cbb817468fa33bf89347a3
Change-Id: I6a49a8ef8c6b380547cbb817468fa33bf89347a3
(cherry picked from commit 6134f7c0)
parent 6ef5f182
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -845,5 +845,8 @@ public final class BluetoothSocket implements Closeable {
        return ret;
    }


    @Override
    public String toString() {
        return BluetoothUtils.toAnonymizedAddress(mAddress);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -175,4 +175,16 @@ public final class BluetoothUtils {
        }
        return result;
    }

    /**
     * Convert an address to an obfuscate one for logging purpose
     * @param address Mac address to be log
     * @return Loggable mac address
     */
    public static String toAnonymizedAddress(String address) {
        if (address == null || address.length() != 17) {
            return null;
        }
        return "XX:XX:XX" + address.substring(8);
    }
}