diff options
author | Guang Zhu <guangzhu@google.com> | 2014-05-20 09:58:35 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-20 09:58:35 +0000 |
commit | 47c6514eaa5f1b0af101108b3c1b599cefa14b23 (patch) | |
tree | 4afddb00638ab183df462e1e88f14a7520888d9e /core/tests/bluetoothtests | |
parent | 05ee041453618bc42b4faa232eab39da13b058c8 (diff) | |
parent | cd98ecc66b968c5d5d0d12522c4c8c9b848bf181 (diff) | |
download | frameworks_base-47c6514eaa5f1b0af101108b3c1b599cefa14b23.zip frameworks_base-47c6514eaa5f1b0af101108b3c1b599cefa14b23.tar.gz frameworks_base-47c6514eaa5f1b0af101108b3c1b599cefa14b23.tar.bz2 |
am cd98ecc6: am 6071e45a: Merge "add a command to list all bonded devices" into klp-modular-dev
* commit 'cd98ecc66b968c5d5d0d12522c4c8c9b848bf181':
add a command to list all bonded devices
Diffstat (limited to 'core/tests/bluetoothtests')
-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(); |