From de07503a382e81ba82f4cd4dee81ff2fbf3295bc Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Mon, 19 Jul 2010 16:28:27 -0700 Subject: Add HID to the state machine and add native call backs. Change-Id: Ib9f3e476d4176bc04e23e7674dc54aa5a6417308 --- core/java/android/server/BluetoothEventLoop.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'core/java/android/server/BluetoothEventLoop.java') diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index 9b7a73dc1b4e..eb9b62be2676 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -693,6 +693,26 @@ class BluetoothEventLoop { } } + private void onInputDeviceConnectionResult(String path, boolean result) { + // Success case gets handled by Property Change signal + if (!result) { + String address = mBluetoothService.getAddressFromObjectPath(path); + if (address == null) return; + + boolean connected = false; + BluetoothDevice device = mAdapter.getRemoteDevice(address); + int state = mBluetoothService.getInputDeviceState(device); + if (state == BluetoothInputDevice.STATE_CONNECTING) { + connected = false; + } else if (state == BluetoothInputDevice.STATE_DISCONNECTING) { + connected = true; + } else { + Log.e(TAG, "Error onInputDeviceConnectionResult. State is:" + state); + } + mBluetoothService.handleInputDevicePropertyChange(address, connected); + } + } + private void onRestartRequired() { if (mBluetoothService.isEnabled()) { Log.e(TAG, "*** A serious error occured (did bluetoothd crash?) - " + -- cgit v1.2.3