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

Commit 4d43ee33 authored by Steve Kondik's avatar Steve Kondik
Browse files

Revert "BT: Multi HF support in Settings App."

This reverts commit 7bbd9052.
parent 6c8e4cec
Loading
Loading
Loading
Loading
+12 −21
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ final class HeadsetProfile implements LocalBluetoothProfile {
        List<BluetoothDevice> sinks = mService.getConnectedDevices();
        if (sinks != null) {
            for (BluetoothDevice sink : sinks) {
                Log.d(TAG,"Not disconnecting device = " + sink);
                mService.disconnect(sink);
            }
        }
        return mService.connect(device);
@@ -124,33 +124,24 @@ final class HeadsetProfile implements LocalBluetoothProfile {
    public boolean disconnect(BluetoothDevice device) {
        if (mService == null) return false;
        List<BluetoothDevice> deviceList = mService.getConnectedDevices();
        if (!deviceList.isEmpty()) {
            for (BluetoothDevice dev : deviceList) {
                if (dev.equals(device)) {
                    if (V) Log.d(TAG,"Downgrade priority as user" +
                                        "is disconnecting the headset");
        if (!deviceList.isEmpty() && deviceList.get(0).equals(device)) {
            // Downgrade priority as user is disconnecting the headset.
            if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON) {
                mService.setPriority(device, BluetoothProfile.PRIORITY_ON);
            }
            return mService.disconnect(device);
                }
            }
        }
        } else {
            return false;
        }
    }

    public int getConnectionStatus(BluetoothDevice device) {
        if (mService == null) return BluetoothProfile.STATE_DISCONNECTED;
        List<BluetoothDevice> deviceList = mService.getConnectedDevices();
        if (!deviceList.isEmpty()){
            for (BluetoothDevice dev : deviceList) {
                if (dev.equals(device)) {
                    return mService.getConnectionState(device);
                }
            }
        }
        return BluetoothProfile.STATE_DISCONNECTED;

        return !deviceList.isEmpty() && deviceList.get(0).equals(device)
                ? mService.getConnectionState(device)
                : BluetoothProfile.STATE_DISCONNECTED;
    }

    public boolean isPreferred(BluetoothDevice device) {