Add keyboard support to bluetooth settings.

Change-Id: I8fe41056acd074374cd249bfd0be6034f2614d37
This commit is contained in:
Adam Powell
2010-06-07 17:13:10 -07:00
parent a8dddb0faa
commit 792d2132e4
5 changed files with 144 additions and 3 deletions

View File

@@ -540,6 +540,12 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
Log.v(TAG, "opp classbits != uuid");
printUuids = true;
}
if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_HID) !=
mProfiles.contains(Profile.HID)) {
Log.v(TAG, "hid classbits != uuid");
printUuids = true;
}
}
if (printUuids) {
@@ -629,7 +635,10 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
* @return A one-off summary that is applicable for the current state, or 0.
*/
private int getOneOffSummary() {
boolean isA2dpConnected = false, isHeadsetConnected = false, isConnecting = false;
boolean isA2dpConnected = false;
boolean isHeadsetConnected = false;
boolean isHidConnected = false;
boolean isConnecting = false;
if (mProfiles.contains(Profile.A2DP)) {
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
@@ -647,6 +656,14 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
isHeadsetConnected = profileManager.isConnected(mDevice);
}
if (mProfiles.contains(Profile.HID)) {
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
.getProfileManager(mLocalManager, Profile.HID);
isConnecting |= profileManager.getConnectionStatus(mDevice) ==
SettingsBtStatus.CONNECTION_STATUS_CONNECTING;
isHidConnected = profileManager.isConnected(mDevice);
}
if (isConnecting) {
// If any of these important profiles is connecting, prefer that
return SettingsBtStatus.getConnectionStatusSummary(
@@ -657,6 +674,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
return R.string.bluetooth_summary_connected_to_a2dp;
} else if (isHeadsetConnected) {
return R.string.bluetooth_summary_connected_to_headset;
} else if (isHidConnected) {
return R.string.bluetooth_summary_connected_to_hid;
} else {
return 0;
}
@@ -673,7 +692,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
}
private boolean isConnectableProfile(Profile profile) {
return profile.equals(Profile.HEADSET) || profile.equals(Profile.A2DP);
return profile.equals(Profile.HEADSET) || profile.equals(Profile.A2DP) ||
profile.equals(Profile.HID);
}
public void onCreateContextMenu(ContextMenu menu) {