diff options
author | Guang Zhu <guangzhu@google.com> | 2014-05-19 21:34:25 -0700 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2014-05-19 21:36:10 -0700 |
commit | d22b2413b9b79374a6a8e2176de577c8eac0d1b7 (patch) | |
tree | c966a50bd2ac40be1cfecb771d937a45d89e1e80 /core/tests | |
parent | 45734b4ae180ea3c34f92575b3ed362bbf4f20e5 (diff) | |
download | frameworks_base-d22b2413b9b79374a6a8e2176de577c8eac0d1b7.zip frameworks_base-d22b2413b9b79374a6a8e2176de577c8eac0d1b7.tar.gz frameworks_base-d22b2413b9b79374a6a8e2176de577c8eac0d1b7.tar.bz2 |
add a command to list all bonded devices
Bug: 14601515
Change-Id: I3cc5bb664485ef768bb81f1f8870ed9bf62f8329
Diffstat (limited to 'core/tests')
-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(); |