summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-04-06 20:45:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-04-06 20:45:21 +0000
commit43470a309a0fe51d62d16acce400ee73db698126 (patch)
treeb9067fb4b7286362ae2982262abd3b4d1bf3d0e0 /core/java/android
parent8d23a78b4036a22a3e29565b1e442c581382bdee (diff)
parent3b8f09b3c56fc81148a06af68dde58022bc042fe (diff)
Merge "Hearing Aid: change get/set active device (3/3)" into pi-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/bluetooth/BluetoothHearingAid.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/java/android/bluetooth/BluetoothHearingAid.java b/core/java/android/bluetooth/BluetoothHearingAid.java
index 8f8083ed73e2..159e165d594f 100644
--- a/core/java/android/bluetooth/BluetoothHearingAid.java
+++ b/core/java/android/bluetooth/BluetoothHearingAid.java
@@ -421,29 +421,29 @@ public final class BluetoothHearingAid implements BluetoothProfile {
}
/**
- * Check whether the device is active.
+ * Get the connected physical Hearing Aid devices that are active
*
* <p>Requires {@link android.Manifest.permission#BLUETOOTH}
* permission.
*
- * @return the connected device that is active or null if no device
- * is active
+ * @return the list of active devices. The first element is the left active
+ * device; the second element is the right active device. If either or both side
+ * is not active, it will be null on that position. Returns empty list on error.
* @hide
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
- public boolean isActiveDevice(@Nullable BluetoothDevice device) {
- if (VDBG) log("isActiveDevice()");
+ public List<BluetoothDevice> getActiveDevices() {
+ if (VDBG) log("getActiveDevices()");
try {
mServiceLock.readLock().lock();
- if (mService != null && isEnabled()
- && ((device == null) || isValidDevice(device))) {
- return mService.isActiveDevice(device);
+ if (mService != null && isEnabled()) {
+ return mService.getActiveDevices();
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
- return false;
+ return new ArrayList<>();
} catch (RemoteException e) {
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
- return false;
+ return new ArrayList<>();
} finally {
mServiceLock.readLock().unlock();
}