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

Commit c73dd732 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Fix crash while device is pairing / unpairing.

When there are no paired devices, pairing a new device
will cause a crash since the profile proxies will be null.

Change-Id: Ie1a9fd198e46d7e9cc2ba1b2f3a806b3c709f568
parent 7cec1423
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -89,7 +89,12 @@ class BluetoothBondState {
        return mPendingOutgoingBonding;
    }

    public synchronized void loadBondState() {
    public synchronized void initBondState() {
        getProfileProxy();
        loadBondState();
    }

    private void loadBondState() {
        if (mService.getBluetoothStateInternal() !=
                BluetoothAdapter.STATE_TURNING_ON) {
            return;
@@ -108,7 +113,6 @@ class BluetoothBondState {
            mState.put(mService.getAddressFromObjectPath(device).toUpperCase(),
                    BluetoothDevice.BOND_BONDED);
        }
        getProfileProxy();
    }

    public synchronized void setBondState(String address, int state) {
+1 −1
Original line number Diff line number Diff line
@@ -570,7 +570,7 @@ public class BluetoothService extends IBluetooth.Stub {

                mIsDiscovering = false;
                mBondState.readAutoPairingData();
                mBondState.loadBondState();
                mBondState.initBondState();
                initProfileState();

                // This should be the last step of the the enable thread.