Environment
- ROM: iodeOS 5.25 (LineageOS 21 base), Android 14
-
- Device: Samsung Galaxy S20, iodeOS GSI (lineage_arm64_ab / tdgsi_arm64_ab)
-
- Build flavor: lineage_arm64_ab-userdebug
-
- Security patch: 2026-06-01
- Summary
- Pairing a Bluetooth device that does not advertise a name at bond time (e.g. Garmin fenix) crashes the com.android.bluetooth process. The bond never completes and I have to re-pair the device several times a day.
- Root cause
- BondStateMachine.isSkipConfirmationAccessory() calls .equals() on the remote device name without a null check. When getName() returns null, this throws an NPE and the Bluetooth stack dies. This method is LineageOS-specific (introduced in change 382143, “BondStateMachine: Allow skipping confirm for some remotes”), so it is not an AOSP bug.
- Stack trace (from device, Android 14 / LOS21)
- `java.lang.NullPointerException: ‘boolean java.lang.Object.equals(java.lang.Object)’ on a null object reference`
-
- at BondStateMachine.isSkipConfirmationAccessory(BondStateMachine.java:471)
-
- at BondStateMachine.sendDisplayPinIntent(BondStateMachine.java:483)
-
- at BondStateMachine$PendingCommandState.processMessage(BondStateMachine.java:344)
- Steps to reproduce
-
- Use a BT device that initially exposes no name during bonding (Garmin fenix).
-
- Initiate pairing.
-
- com.android.bluetooth crashes and the bond fails.
- Workaround (confirms the root cause)
- Scanning for the device in the Bluetooth settings first (so its name gets cached and getName() is no longer null) avoids the crash.
- Suggested fix
- Add a null guard before the name comparison in isSkipConfirmationAccessory() (e.g. if (name != null && name.equals(…))). This is already fixed in the lineage-22.x branch - please cherry-pick / backport the existing fix to lineage-21.0, since LOS21 devices are still widely used.