Merge "Revert "Add temporary hack for keyboards not following spec."" into honeycomb

This commit is contained in:
Jaikumar Ganesh
2011-01-12 12:22:50 -08:00
committed by Android (Google) Code Review

View File

@@ -548,26 +548,15 @@ class BluetoothEventLoop {
} }
} }
// STOPSHIP: Hack for MOT keyboards if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD ||
boolean motKeyboard = false; btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD_POINTING) {
String name = mBluetoothService.getRemoteName(address); // Its a keyboard. Follow the HID spec recommendation of creating the
if (name == null && address.startsWith("00:0F:F6") || // passkey and displaying it to the user.
(name != null && name.startsWith("Motorola"))) { // Generate a variable PIN. This is not truly random but good enough.
motKeyboard = true; int pin = (int) Math.floor(Math.random() * 10000);
sendDisplayPinIntent(address, pin);
return;
} }
if (!motKeyboard) {
if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD ||
btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD_POINTING) {
// Its a keyboard. Follow the HID spec recommendation of creating the
// passkey and displaying it to the user.
// Generate a variable PIN. This is not truly random but good enough.
int pin = (int) Math.floor(Math.random() * 10000);
sendDisplayPinIntent(address, pin);
return;
}
}
// Acquire wakelock during PIN code request to bring up LCD display // Acquire wakelock during PIN code request to bring up LCD display
mWakeLock.acquire(); mWakeLock.acquire();
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST); Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);