From 044e0fe5c5de11c02725428fd09302216184537f Mon Sep 17 00:00:00 2001 From: Ruina Liu Date: Sat, 22 Jul 2017 18:41:48 +0800 Subject: [PATCH] Fix extracting 32-bit uuid error via calling method uuidToBytes A new defined method of uuidToBytes is used to convert Bluetooth uuid to bytes in the case of BLE advertising. But the most significant 16 bits of a 32-bit uuid will be cleared after the and operations with 0X0000FFFF00000000L in the function of getServiceIdentifierFromParcelUuid. 0XFFFFFFFF00000000L should be used as bit mask. Change-Id: I83e22ffbecd718540e644289fee12bf9c3b66305 Test: Advertise with payload contains 32-bit uuid --- core/java/android/bluetooth/BluetoothUuid.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java index 5bfc54d267caa..76cb3f5b548ed 100644 --- a/core/java/android/bluetooth/BluetoothUuid.java +++ b/core/java/android/bluetooth/BluetoothUuid.java @@ -232,7 +232,7 @@ public final class BluetoothUuid { */ public static int getServiceIdentifierFromParcelUuid(ParcelUuid parcelUuid) { UUID uuid = parcelUuid.getUuid(); - long value = (uuid.getMostSignificantBits() & 0x0000FFFF00000000L) >>> 32; + long value = (uuid.getMostSignificantBits() & 0xFFFFFFFF00000000L) >>> 32; return (int) value; }