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

Commit b1f04642 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

CRs-Fixed: 921438
Change-Id: I5f561d5b68768790f30cdbc605f378aeace9ad46
parent 9611ba2c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1732,6 +1732,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);