From 6d76e11fd3904e095e3873eda2131d01f089e990 Mon Sep 17 00:00:00 2001 From: darken Date: Wed, 8 Apr 2026 15:21:16 +0200 Subject: [PATCH] =?UTF-8?q?android:=20Fix=20rename=20using=20wrong=20opcod?= =?UTF-8?q?e=20(0x1E=20=E2=86=92=200x1A)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit createRenamePacket was building a 0x1E variant with a trailing NUL. On-device testing (AirPods Pro 2 USB-C, firmware 81.2675000075000000.6082) shows the device silently ignores that format — no 0x001D echo, no persistence across reconnect. Switched to the format documented in AAP Definitions.md and already used by linux/airpods_packets.h: '04 00 04 00 1A 00 01 [size] 00 [name]'. With this format the device accepts the rename, echoes the new name in its next 0x001D INFORMATION message, and the name persists across disconnect/reconnect cycles. Related to #411: the Pro 3 symptom reported there (rename doesn't show on other devices) is consistent with the Android 0x1E variant being dropped by firmware. This fix addresses that root cause. Note: Android/Windows displays still depend on each device's own Bluetooth name cache, which is a separate layer from AAP. --- .../java/me/kavishdevar/librepods/utils/AACPManager.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt index f3afe9f56..655b718e8 100644 --- a/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt +++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt @@ -43,7 +43,7 @@ class AACPManager { const val EAR_DETECTION: Byte = 0x06 const val CONVERSATION_AWARENESS: Byte = 0x4B const val INFORMATION: Byte = 0x1D - const val RENAME: Byte = 0x1E + const val RENAME: Byte = 0x1A const val HEADTRACKING: Byte = 0x17 const val PROXIMITY_KEYS_REQ: Byte = 0x30 const val PROXIMITY_KEYS_RSP: Byte = 0x31 @@ -773,9 +773,10 @@ class AACPManager { val packet = ByteArray(5 + size) packet[0] = Opcodes.RENAME packet[1] = 0x00 - packet[2] = size.toByte() - packet[3] = 0x00 - System.arraycopy(nameBytes, 0, packet, 4, size) + packet[2] = 0x01 + packet[3] = size.toByte() + packet[4] = 0x00 + System.arraycopy(nameBytes, 0, packet, 5, size) return packet }