diff options
author | Sanket Agarwal <sanketa@google.com> | 2017-01-20 14:55:15 -0800 |
---|---|---|
committer | Sanket Agarwal <sanketa@google.com> | 2017-01-20 14:55:15 -0800 |
commit | 245f21bf8ade5e37407d0f16a546300a9fc546b8 (patch) | |
tree | df053075c9a2ccf6f9db5b2bcbb70e9d84da7f36 /framework/java/android/bluetooth/BluetoothHeadsetClient.java | |
parent | 7d67c73acd672dd2baa2a8531fec1b09a012fb8a (diff) |
Change HFP Client API to support multi device
- Adds BluetoothDevice as a parameter where required
- Gets rid of device management APIs that can be done via
BluetoothProfiles instead
Test: Manual sanity tests
Bug: b/33554547
Bug: b/30984220
Change-Id: I3485ac5bfe1fcb29c774ad040fdd608e1cacb8df
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHeadsetClient.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothHeadsetClient.java | 55 |
1 files changed, 14 insertions, 41 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHeadsetClient.java b/framework/java/android/bluetooth/BluetoothHeadsetClient.java index c7c64c4391..544b3b95db 100644 --- a/framework/java/android/bluetooth/BluetoothHeadsetClient.java +++ b/framework/java/android/bluetooth/BluetoothHeadsetClient.java @@ -965,38 +965,6 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { } /** - * Accept the incoming connection. - */ - public boolean acceptIncomingConnect(BluetoothDevice device) { - if (DBG) log("acceptIncomingConnect"); - if (mService != null && isEnabled()) { - try { - return mService.acceptIncomingConnect(device); - } catch (RemoteException e) {Log.e(TAG, e.toString());} - } else { - Log.w(TAG, "Proxy not attached to service"); - if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); - } - return false; - } - - /** - * Reject the incoming connection. - */ - public boolean rejectIncomingConnect(BluetoothDevice device) { - if (DBG) log("rejectIncomingConnect"); - if (mService != null) { - try { - return mService.rejectIncomingConnect(device); - } catch (RemoteException e) {Log.e(TAG, e.toString());} - } else { - Log.w(TAG, "Proxy not attached to service"); - if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); - } - return false; - } - - /** * Returns current audio state of Audio Gateway. * * Note: This is an internal function and shouldn't be exposed @@ -1017,13 +985,15 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { /** * Sets whether audio routing is allowed. * + * @param device remote device + * @param allowed if routing is allowed to the device * Note: This is an internal function and shouldn't be exposed */ - public void setAudioRouteAllowed(boolean allowed) { + public void setAudioRouteAllowed(BluetoothDevice device, boolean allowed) { if (VDBG) log("setAudioRouteAllowed"); if (mService != null && isEnabled()) { try { - mService.setAudioRouteAllowed(allowed); + mService.setAudioRouteAllowed(device, allowed); } catch (RemoteException e) {Log.e(TAG, e.toString());} } else { Log.w(TAG, "Proxy not attached to service"); @@ -1033,14 +1003,15 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { /** * Returns whether audio routing is allowed. - * + * @param device remote device + * @return whether the command succeeded * Note: This is an internal function and shouldn't be exposed */ - public boolean getAudioRouteAllowed() { + public boolean getAudioRouteAllowed(BluetoothDevice device) { if (VDBG) log("getAudioRouteAllowed"); if (mService != null && isEnabled()) { try { - return mService.getAudioRouteAllowed(); + return mService.getAudioRouteAllowed(device); } catch (RemoteException e) {Log.e(TAG, e.toString());} } else { Log.w(TAG, "Proxy not attached to service"); @@ -1054,15 +1025,16 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { * * It setup SCO channel with remote connected Handsfree AG device. * + * @param device remote device * @return <code>true</code> if command has been issued successfully; * <code>false</code> otherwise; * upon completion HFP sends {@link #ACTION_AUDIO_STATE_CHANGED} * intent; */ - public boolean connectAudio() { + public boolean connectAudio(BluetoothDevice device) { if (mService != null && isEnabled()) { try { - return mService.connectAudio(); + return mService.connectAudio(device); } catch (RemoteException e) { Log.e(TAG, e.toString()); } @@ -1078,15 +1050,16 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { * * It tears down the SCO channel from remote AG device. * + * @param device remote device * @return <code>true</code> if command has been issued successfully; * <code>false</code> otherwise; * upon completion HFP sends {@link #ACTION_AUDIO_STATE_CHANGED} * intent; */ - public boolean disconnectAudio() { + public boolean disconnectAudio(BluetoothDevice device) { if (mService != null && isEnabled()) { try { - return mService.disconnectAudio(); + return mService.disconnectAudio(device); } catch (RemoteException e) { Log.e(TAG, e.toString()); } |