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

Commit 649ef294 authored by Nitin Shivpure's avatar Nitin Shivpure
Browse files

Bluetooth: Fix to update mTetherOn with proper value.

As the mTetherOn indicates, whether bluetooth tethering
is on/off. So incoming pan(DUT as NAP Role) connection
is only accepted, if mTetherOn is set true. So mTetherOn
should be updated with proper value.

Change-Id: I31cfe4e3f3b7fd2ed1f970418f28286100d29514
CRs-fixed: 506194
parent 736751d4
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -320,23 +320,20 @@ public class PanService extends ProfileService {
    }
     boolean isTetheringOn() {
        // TODO(BT) have a variable marking the on/off state
        if (SystemProperties.getBoolean("bluetooth.mTetherOn", false) == true) {
             if(DBG) Log.d(TAG, "isTetheringOn : " + SystemProperties.getBoolean("bluetooth.mTetherOn", false));
             return true;
        }
        return false;
        mTetherOn = SystemProperties.getBoolean("bluetooth.mTetherOn", false);
        if(DBG) Log.d(TAG, "isTetheringOn : " + mTetherOn);
        return mTetherOn;
    }

    void setBluetoothTethering(boolean value) {

        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission");
        mTetherOn = SystemProperties.getBoolean("bluetooth.mTetherOn", false) ;
        if (DBG) Log.d(TAG, "setBluetoothTethering: " + value +", mTetherOn: " + mTetherOn);

        if (SystemProperties.getBoolean("bluetooth.mTetherOn", false) != value){
        if (mTetherOn != value) {
            //drop any existing panu or pan-nap connection when changing the tethering state
            SystemProperties.set("bluetooth.mTetherOn", value?"true":"false");

            mTetherOn = value;
            SystemProperties.set("bluetooth.mTetherOn", mTetherOn?"true":"false");
            List<BluetoothDevice> DevList = getConnectedDevices();
            for (BluetoothDevice dev : DevList)
                disconnect(dev);