diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2010-03-09 15:31:24 -0800 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2010-03-09 16:51:09 -0800 |
commit | b7e029d03c115ed65cdea9b2bba307e882c308e2 (patch) | |
tree | b4651ba5b76333f2859fa975125a3fedaa375ccb /core/java/android/server | |
parent | 529b2854de028a79dff45583112723a9791430c9 (diff) | |
download | frameworks_base-b7e029d03c115ed65cdea9b2bba307e882c308e2.zip frameworks_base-b7e029d03c115ed65cdea9b2bba307e882c308e2.tar.gz frameworks_base-b7e029d03c115ed65cdea9b2bba307e882c308e2.tar.bz2 |
Add an API to set the link timeout.
This fixes the problem where the car dock is
powered on and off pretty quickly.
Change-Id: I8724641b8c337019f089b005cb236fc90549cf6f
Diffstat (limited to 'core/java/android/server')
-rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 5 | ||||
-rw-r--r-- | core/java/android/server/BluetoothService.java | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index f363828..c0e4600 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -374,6 +374,11 @@ class BluetoothEventLoop { Intent intent = null; if (propValues[1].equals("true")) { intent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED); + // Set the link timeout to 8000 slots (5 sec timeout) + // for bluetooth docks. + if (mBluetoothService.isBluetoothDock(address)) { + mBluetoothService.setLinkTimeout(address, 8000); + } } else { intent = new Intent(BluetoothDevice.ACTION_ACL_DISCONNECTED); } diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index e7d9d5b..2c73416 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -1910,6 +1910,13 @@ public class BluetoothService extends IBluetooth.Stub { return path; } + /*package */ void setLinkTimeout(String address, int num_slots) { + String path = getObjectPathFromAddress(address); + boolean result = setLinkTimeoutNative(path, num_slots); + + if (!result) log("Set Link Timeout to:" + num_slots + " slots failed"); + } + private static void log(String msg) { Log.d(TAG, msg); } @@ -1953,4 +1960,5 @@ public class BluetoothService extends IBluetooth.Stub { private native int addRfcommServiceRecordNative(String name, long uuidMsb, long uuidLsb, short channel); private native boolean removeServiceRecordNative(int handle); + private native boolean setLinkTimeoutNative(String path, int num_slots); } |