diff options
Diffstat (limited to 'src/com/android/bluetooth/hid/HidService.java')
-rwxr-xr-x | src/com/android/bluetooth/hid/HidService.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/hid/HidService.java b/src/com/android/bluetooth/hid/HidService.java index 77a3065fe..893054a8e 100755 --- a/src/com/android/bluetooth/hid/HidService.java +++ b/src/com/android/bluetooth/hid/HidService.java @@ -67,6 +67,7 @@ public class HidService extends ProfileService { private static final int MESSAGE_SET_REPORT = 10; private static final int MESSAGE_SEND_DATA = 11; private static final int MESSAGE_ON_VIRTUAL_UNPLUG = 12; + private static final int MESSAGE_ON_HANDSHAKE = 13; static { classInitNative(); @@ -249,6 +250,13 @@ public class HidService extends ProfileService { broadcastReport(device, report, bufferSize); } break; + case MESSAGE_ON_HANDSHAKE: + { + BluetoothDevice device = getDevice((byte[])msg.obj); + int status = msg.arg1; + broadcastHandshake(device, status); + } + break; case MESSAGE_SET_REPORT: { BluetoothDevice device = (BluetoothDevice) msg.obj; @@ -564,6 +572,13 @@ public class HidService extends ProfileService { mHandler.sendMessage(msg); } + private void onHandshake(byte[] address, int status) { + Message msg = mHandler.obtainMessage(MESSAGE_ON_HANDSHAKE); + msg.obj = address; + msg.arg1 = status; + mHandler.sendMessage(msg); + } + private void onVirtualUnplug(byte[] address, int status) { Message msg = mHandler.obtainMessage(MESSAGE_ON_VIRTUAL_UNPLUG); msg.obj = address; @@ -603,6 +618,14 @@ public class HidService extends ProfileService { sendBroadcast(intent, BLUETOOTH_PERM); } + private void broadcastHandshake(BluetoothDevice device, int status) { + Intent intent = new Intent(BluetoothInputDevice.ACTION_HANDSHAKE); + intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); + intent.putExtra(BluetoothInputDevice.EXTRA_STATUS, status); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + sendBroadcast(intent, BLUETOOTH_PERM); + } + private void broadcastProtocolMode(BluetoothDevice device, int protocolMode) { Intent intent = new Intent(BluetoothInputDevice.ACTION_PROTOCOL_MODE_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); |