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

Commit 1063a65b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Bluetooth: GAP: Update bondstatemachine to handle pairing scenarios"

parents b0c8a6fc c34564d5
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ final class BondStateMachine extends StateMachine {
    private PendingCommandState mPendingCommandState = new PendingCommandState();
    private StableState mStableState = new StableState();

    private final ArrayList<BluetoothDevice> mDevices =
        new ArrayList<BluetoothDevice>();

    private BondStateMachine(AdapterService service,
            AdapterProperties prop, RemoteDevices remoteDevices) {
        super("BondStateMachine:");
@@ -118,6 +121,9 @@ final class BondStateMachine extends StateMachine {
                /* if incoming pairing, transition to pending state */
                if (newState == BluetoothDevice.BOND_BONDING)
                {
                    if(!mDevices.contains(dev)) {
                        mDevices.add(dev);
                    }
                    sendIntent(dev, newState, 0);
                    transitionTo(mPendingCommandState);
                }
@@ -138,8 +144,6 @@ final class BondStateMachine extends StateMachine {


    private class PendingCommandState extends State {
        private final ArrayList<BluetoothDevice> mDevices =
            new ArrayList<BluetoothDevice>();

        @Override
        public void enter() {
@@ -177,7 +181,9 @@ final class BondStateMachine extends StateMachine {
                        // check if bond none is received from device which
                        // was in pairing state otherwise don't transition to
                        // stable state.
                        if (newState == BluetoothDevice.BOND_NONE && !mDevices.contains(dev)) {
                        if (newState == BluetoothDevice.BOND_NONE &&
                            !mDevices.contains(dev) && mDevices.size() != 0) {
                            infoLog("not transitioning to stable state");
                            break;
                        }
                        /* this is either none/bonded, remove and transition */