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

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

Pandora: Listen of BLE_STATE_CHANGED

STATE_CHANGED consider all ble state to be STATE_OFF. When trying to
reset the bluetooth, this can lead to race condition as it is not
entirely of

Bug: 234892968
Test: None
Flag: TEST_ONLY
Change-Id: I016be84254dba749afba1c31129a7df424ef1227
parent 453f1575
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ class Host(

        // Add all intent actions to be listened.
        val intentFilter = IntentFilter()
        intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED)
        intentFilter.addAction(BluetoothAdapter.ACTION_BLE_STATE_CHANGED)
        intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED)
        intentFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)
        intentFilter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST)
@@ -147,7 +147,7 @@ class Host(

        val stateFlow =
            flow
                .filter { it.getAction() == BluetoothAdapter.ACTION_STATE_CHANGED }
                .filter { it.getAction() == BluetoothAdapter.ACTION_BLE_STATE_CHANGED }
                .map { it.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR) }

        if (bluetoothAdapter.isEnabled) {
@@ -173,7 +173,7 @@ class Host(

            val stateFlow =
                flow
                    .filter { it.getAction() == BluetoothAdapter.ACTION_STATE_CHANGED }
                    .filter { it.getAction() == BluetoothAdapter.ACTION_BLE_STATE_CHANGED }
                    .map { it.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR) }

            initiatedConnection.clear()