diff options
author | Guang Zhu <guangzhu@google.com> | 2014-05-20 09:26:18 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-20 09:26:18 +0000 |
commit | cd98ecc66b968c5d5d0d12522c4c8c9b848bf181 (patch) | |
tree | 278d9ff58761f2499cf220ad55ef0cf17ddbf57d | |
parent | 9d1c38144683f61a01c445ba4e8ce921a82f697f (diff) | |
parent | 6071e45a64ab764eb86603f2f4496cfd5c8de708 (diff) | |
download | frameworks_base-cd98ecc66b968c5d5d0d12522c4c8c9b848bf181.zip frameworks_base-cd98ecc66b968c5d5d0d12522c4c8c9b848bf181.tar.gz frameworks_base-cd98ecc66b968c5d5d0d12522c4c8c9b848bf181.tar.bz2 |
am 6071e45a: Merge "add a command to list all bonded devices" into klp-modular-dev
* commit '6071e45a64ab764eb86603f2f4496cfd5c8de708':
add a command to list all bonded devices
-rw-r--r-- | core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java index 67203b2..22dce39 100644 --- a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java +++ b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java @@ -20,6 +20,8 @@ import android.app.Instrumentation; import android.content.Context; import android.os.Bundle; +import java.util.Set; + public class BluetoothInstrumentation extends Instrumentation { private BluetoothTestUtils mUtils = null; @@ -66,6 +68,8 @@ public class BluetoothInstrumentation extends Instrumentation { getName(); } else if ("getAddress".equals(command)) { getAddress(); + } else if ("getBondedDevices".equals(command)) { + getBondedDevices(); } else { finish(null); } @@ -98,6 +102,16 @@ public class BluetoothInstrumentation extends Instrumentation { finish(mSuccessResult); } + public void getBondedDevices() { + Set<BluetoothDevice> devices = getBluetoothAdapter().getBondedDevices(); + int i = 0; + for (BluetoothDevice device : devices) { + mSuccessResult.putString(String.format("device-%02d", i), device.getAddress()); + i++; + } + finish(mSuccessResult); + } + public void finish(Bundle result) { if (result == null) { result = new Bundle(); |