Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −1 Original line number Diff line number Diff line Loading @@ -2619,9 +2619,13 @@ public class AdapterService extends Service { * Obfuscate Bluetooth MAC address into a PII free ID string * * @param device Bluetooth device whose MAC address will be obfuscated * @return a byte array that is unique to this MAC address on this device * @return a byte array that is unique to this MAC address on this device, * or empty byte array when either device is null or obfuscateAddressNative fails */ public byte[] obfuscateAddress(BluetoothDevice device) { if (device == null) { return new byte[0]; } return obfuscateAddressNative(Utils.getByteAddress(device)); } Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -494,6 +494,17 @@ public class AdapterServiceTest { SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, snoopSetting); } /** * Test: Obfuscate a null Bluetooth * Check if returned value from {@link AdapterService#obfuscateAddress(BluetoothDevice)} is * an empty array when device address is null */ @Test public void testObfuscateBluetoothAddress_NullAddress() { Assert.assertArrayEquals(mAdapterService.obfuscateAddress(null), new byte[0]); } /** * Test: Obfuscate Bluetooth address when Bluetooth is disabled * Check whether the returned value meets expectation Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −1 Original line number Diff line number Diff line Loading @@ -2619,9 +2619,13 @@ public class AdapterService extends Service { * Obfuscate Bluetooth MAC address into a PII free ID string * * @param device Bluetooth device whose MAC address will be obfuscated * @return a byte array that is unique to this MAC address on this device * @return a byte array that is unique to this MAC address on this device, * or empty byte array when either device is null or obfuscateAddressNative fails */ public byte[] obfuscateAddress(BluetoothDevice device) { if (device == null) { return new byte[0]; } return obfuscateAddressNative(Utils.getByteAddress(device)); } Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -494,6 +494,17 @@ public class AdapterServiceTest { SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_ENABLE_PROPERTY, snoopSetting); } /** * Test: Obfuscate a null Bluetooth * Check if returned value from {@link AdapterService#obfuscateAddress(BluetoothDevice)} is * an empty array when device address is null */ @Test public void testObfuscateBluetoothAddress_NullAddress() { Assert.assertArrayEquals(mAdapterService.obfuscateAddress(null), new byte[0]); } /** * Test: Obfuscate Bluetooth address when Bluetooth is disabled * Check whether the returned value meets expectation Loading