summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorYunsik Bae <yunsik.bae@samsung.com>2021-07-20 06:56:50 +0000
committerYunsik Bae <yunsik.bae@samsung.com>2021-07-20 10:53:09 +0000
commit4d990467b23fe289f41744d3402f86a2a2570608 (patch)
tree98cb88952b0538829ae2c4ecdcbac5e524dbe5ae /core/java/android
parent67e10842b292d66aee3c1619054cbefaff6aad55 (diff)
Unify the mismatch in the byte order of the address.
Bluetooth address should check MSB for AddrType based on Spec. (BT Core Spec v 5.2 | Vol 6, Part B, 1.3 DEVICE ADDRESS) Bluetooth address meaning is not unified in the current Android framework layer. Because of this, cannot register scanfilter with the intended address format. Bug: 180466950 Test: manual Tag: #compatibility Change-Id: I59a1b5538e4f3fea77a98cba2aa46649fc32ac6b
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index ce384868d446..d487025631c7 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -3289,22 +3289,22 @@ public final class BluetoothAdapter {
}
/**
- * Determines whether a String Bluetooth address, such as "00:43:A8:23:10:F0"
+ * Determines whether a String Bluetooth address, such as "F0:43:A8:23:10:00"
* is a RANDOM STATIC address.
*
- * RANDOM STATIC: (addr & 0b11) == 0b11
- * RANDOM RESOLVABLE: (addr & 0b11) == 0b10
- * RANDOM non-RESOLVABLE: (addr & 0b11) == 0b00
+ * RANDOM STATIC: (addr & 0xC0) == 0xC0
+ * RANDOM RESOLVABLE: (addr & 0xC0) == 0x40
+ * RANDOM non-RESOLVABLE: (addr & 0xC0) == 0x00
*
* @param address Bluetooth address as string
- * @return true if the 2 Least Significant Bits of the address equals 0b11.
+ * @return true if the 2 Most Significant Bits of the address equals 0xC0.
*
* @hide
*/
public static boolean isAddressRandomStatic(@NonNull String address) {
requireNonNull(address);
return checkBluetoothAddress(address)
- && (Integer.parseInt(address.split(":")[5], 16) & 0b11) == 0b11;
+ && (Integer.parseInt(address.split(":")[0], 16) & 0xC0) == 0xC0;
}
@UnsupportedAppUsage