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

Commit d205de1b authored by Nitin Arora's avatar Nitin Arora Committed by Gerrit - the friendly Code Review server
Browse files

Bluetooth: Use correct previous state while moving to STATE_OFF

This change takes care of the previous state saved in the broadcast
intent while BT turns Off in absence of any BLE always ON app.
When bluetooth moved from STATE_BLE_TURNING_OFF to TURN_OFF
the previous state will be fed into the intent as TURNING_OFF
because the external apps such as CTS are not aware of the
LE_TURNING_OFF state

Change-Id: Ia1ee33ba22d6ccb5ac1a0297248f16d4c8d80c8c
CRs-Fixed: 1056256
parent b81e5ee8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1525,6 +1525,10 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                    // Show prevState of BLE_ON as OFF to standard users
                    prevState = BluetoothAdapter.STATE_OFF;
                }
                else if (prevState == BluetoothAdapter.STATE_BLE_TURNING_OFF) {
                    // show prevState to TURNING_OFF
                    prevState = BluetoothAdapter.STATE_TURNING_OFF;
                }
                Intent intent = new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
                intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, prevState);
                intent.putExtra(BluetoothAdapter.EXTRA_STATE, newState);