From c129df807f1a5a2e2747b99fc224bbd41e93faf2 Mon Sep 17 00:00:00 2001 From: Chienyuan Date: Wed, 29 Aug 2018 23:14:55 +0800 Subject: [PATCH] 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 --- .../src/com/android/settingslib/bluetooth/HidProfile.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java index 93e5621793996..dc17e44cb08d9 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java @@ -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 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) {