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

Commit c129df80 authored by Chienyuan's avatar Chienyuan
Browse files

Remove connected device check logic in getConnectionState

From current code, it will check if the device connected before
getConnectionState. We can remove this check logic because
HidHostService will do it.

Bug: 111812003
Test: manual - connect/disconnect HID keyborad from Settings UI
Change-Id: Ib512b3f15109b6f4cacf1f1c517b69d17ddd5ac4
parent c96760f4
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import com.android.settingslib.R;
import java.util.List;

/**
 * HidProfile handles Bluetooth HID profile.
 * HidProfile handles Bluetooth HID Host role.
 */
public class HidProfile implements LocalBluetoothProfile {
    private static final String TAG = "HidProfile";
@@ -117,11 +117,7 @@ public class HidProfile implements LocalBluetoothProfile {
        if (mService == null) {
            return BluetoothProfile.STATE_DISCONNECTED;
        }
        List<BluetoothDevice> deviceList = mService.getConnectedDevices();

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

    public boolean isPreferred(BluetoothDevice device) {