summaryrefslogtreecommitdiffstats
path: root/core/java/android/bluetooth
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2009-09-25 15:00:29 -0700
committerNick Pelly <npelly@google.com>2009-09-25 15:00:29 -0700
commit12835478ee687a493d1b5882e67b6725bd539c26 (patch)
treea9875017a05d51c5bf70c9c8b57638cd17117c59 /core/java/android/bluetooth
parent57a2292bffedaa3fb8f5cd6b0867fdd5772ad3b5 (diff)
downloadframeworks_base-12835478ee687a493d1b5882e67b6725bd539c26.zip
frameworks_base-12835478ee687a493d1b5882e67b6725bd539c26.tar.gz
frameworks_base-12835478ee687a493d1b5882e67b6725bd539c26.tar.bz2
Handle expiration of discovery mode in system server.
Change-Id: I58fd199b40ffdf8168a5489be8eedb5d25d56722
Diffstat (limited to 'core/java/android/bluetooth')
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java19
-rw-r--r--core/java/android/bluetooth/IBluetooth.aidl2
2 files changed, 14 insertions, 7 deletions
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 776c923..3aaed38 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -412,10 +412,10 @@ public final class BluetoothAdapter {
* Set the Bluetooth scan mode of the local Bluetooth adapter.
* <p>The Bluetooth scan mode determines if the local adapter is
* connectable and/or discoverable from remote Bluetooth devices.
- * <p>For privacy reasons, it is recommended to limit the duration of time
- * that the local adapter remains in a discoverable scan mode. For example,
- * 2 minutes is a generous time to allow a remote Bluetooth device to
- * initiate and complete its discovery process.
+ * <p>For privacy reasons, discoverable mode is automatically turned off
+ * after <code>duration</code> seconds. For example, 120 seconds should be
+ * enough for a remote device to initiate and complete its discovery
+ * process.
* <p>Valid scan mode values are:
* {@link #SCAN_MODE_NONE},
* {@link #SCAN_MODE_CONNECTABLE},
@@ -427,17 +427,24 @@ public final class BluetoothAdapter {
* </code>instead.
*
* @param mode valid scan mode
+ * @param duration time in seconds to apply scan mode, only used for
+ * {@link #SCAN_MODE_CONNECTABLE_DISCOVERABLE}
* @return true if the scan mode was set, false otherwise
* @hide
*/
- public boolean setScanMode(int mode) {
+ public boolean setScanMode(int mode, int duration) {
try {
- return mService.setScanMode(mode);
+ return mService.setScanMode(mode, duration);
} catch (RemoteException e) {Log.e(TAG, "", e);}
return false;
}
/** @hide */
+ public boolean setScanMode(int mode) {
+ return setScanMode(mode, 120);
+ }
+
+ /** @hide */
public int getDiscoverableTimeout() {
try {
return mService.getDiscoverableTimeout();
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index 203a61d..1bc2f96 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -35,7 +35,7 @@ interface IBluetooth
boolean setName(in String name);
int getScanMode();
- boolean setScanMode(int mode);
+ boolean setScanMode(int mode, int duration);
int getDiscoverableTimeout();
boolean setDiscoverableTimeout(int timeout);