Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d67ce9f8 authored by William Escande's avatar William Escande
Browse files

BondStateMachine: Fix BluetoothClass being null

Bug: 298149530
Test: atest BondStateMachineTest | This happen as a race condition
      during stack shutdown and cannot be easily test. Fix is trivial
Change-Id: I41e82064a5cca1639fdf57696745ad4e53d50877
parent 0387ae9d
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -273,8 +273,9 @@ final class BondStateMachine extends StateMachine {
                    }

                    BluetoothClass btClass = dev.getBluetoothClass();
                    int btDeviceClass = btClass.getDeviceClass();
                    if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD || btDeviceClass
                    int btDeviceClass = btClass == null ? 0 : btClass.getDeviceClass();
                    if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD
                            || btDeviceClass
                                    == BluetoothClass.Device.PERIPHERAL_KEYBOARD_POINTING) {
                        // Its a keyboard. Follow the HID spec recommendation of creating the
                        // passkey and displaying it to the user. If the keyboard doesn't follow