summaryrefslogtreecommitdiff
path: root/core/java/android/server/BluetoothEventLoop.java
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2011-08-01 19:11:18 -0700
committerJaikumar Ganesh <jaikumar@google.com>2011-08-02 10:31:26 -0700
commitbbd86750570ff75e428b3810dc2e65db558c14b2 (patch)
treec7ceea1075ae0c87cf01fc8e8b27878b6a9060cd /core/java/android/server/BluetoothEventLoop.java
parent9a6c7383b3d3000b33c5835851331edcacc47811 (diff)
Fix tethering using BT.
1. Since Input device runs in Bluetooth Service, avoid the proxy call. 2. Accept or reject incoming tethering connections. This broke because of incoming connection request change for phonebook, HID, A2DP. Change-Id: Ia8c537bb79e4dbc66cfb6b23dcad4f99dbf950b3
Diffstat (limited to 'core/java/android/server/BluetoothEventLoop.java')
-rw-r--r--core/java/android/server/BluetoothEventLoop.java33
1 files changed, 16 insertions, 17 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 9b9196a43fd4..afc96768c38d 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -54,7 +54,6 @@ class BluetoothEventLoop {
private final BluetoothAdapter mAdapter;
private final BluetoothAdapterStateMachine mBluetoothState;
private BluetoothA2dp mA2dp;
- private BluetoothInputDevice mInputDevice;
private final Context mContext;
// The WakeLock is used for bringing up the LCD during a pairing request
// from remote device when Android is in Suspend state.
@@ -134,15 +133,11 @@ class BluetoothEventLoop {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothProfile.A2DP) {
mA2dp = (BluetoothA2dp) proxy;
- } else if (profile == BluetoothProfile.INPUT_DEVICE) {
- mInputDevice = (BluetoothInputDevice) proxy;
}
}
public void onServiceDisconnected(int profile) {
if (profile == BluetoothProfile.A2DP) {
mA2dp = null;
- } else if (profile == BluetoothProfile.INPUT_DEVICE) {
- mInputDevice = null;
}
}
};
@@ -803,21 +798,25 @@ class BluetoothEventLoop {
"Incoming A2DP / AVRCP connection from " + address);
mA2dp.allowIncomingConnect(device, authorized);
}
- } else if (mInputDevice != null && BluetoothUuid.isInputDevice(uuid)) {
+ } else if (BluetoothUuid.isInputDevice(uuid)) {
// We can have more than 1 input device connected.
- authorized = mInputDevice.getPriority(device) > BluetoothInputDevice.PRIORITY_OFF;
- if (authorized) {
- Log.i(TAG, "First check pass for incoming HID connection from " + address);
- // notify profile state change
- mBluetoothService.notifyIncomingHidConnection(address);
- } else {
- Log.i(TAG, "Rejecting incoming HID connection from " + address);
- mBluetoothService.allowIncomingHidConnect(device, authorized);
- }
- } else if (BluetoothUuid.isBnep(uuid) && mBluetoothService.allowIncomingTethering()){
- authorized = true;
+ authorized = mBluetoothService.getInputDevicePriority(device) >
+ BluetoothInputDevice.PRIORITY_OFF;
+ if (authorized) {
+ Log.i(TAG, "First check pass for incoming HID connection from " + address);
+ // notify profile state change
+ mBluetoothService.notifyIncomingHidConnection(address);
+ } else {
+ Log.i(TAG, "Rejecting incoming HID connection from " + address);
+ mBluetoothService.allowIncomingProfileConnect(device, authorized);
+ }
+ } else if (BluetoothUuid.isBnep(uuid)) {
+ // PAN doesn't go to the state machine, accept or reject from here
+ authorized = mBluetoothService.allowIncomingTethering();
+ mBluetoothService.allowIncomingProfileConnect(device, authorized);
} else {
Log.i(TAG, "Rejecting incoming " + deviceUuid + " connection from " + address);
+ mBluetoothService.allowIncomingProfileConnect(device, authorized);
}
log("onAgentAuthorize(" + objectPath + ", " + deviceUuid + ") = " + authorized);
}