diff options
author | Bryce Lee <brycelee@google.com> | 2015-11-17 16:08:44 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-11-17 16:08:44 +0000 |
commit | cb8749c903d29fd04944550b5f34cc6120b69232 (patch) | |
tree | c2c22bcc871f3e079b1f8d26ad7602d990d5dc82 /core | |
parent | d083b379174b6cdfdd40204f4d4f4207fa2f332e (diff) | |
parent | 0db53d90a028b138a68ebc5f7e30fe776e789b5d (diff) | |
download | frameworks_base-cb8749c903d29fd04944550b5f34cc6120b69232.zip frameworks_base-cb8749c903d29fd04944550b5f34cc6120b69232.tar.gz frameworks_base-cb8749c903d29fd04944550b5f34cc6120b69232.tar.bz2 |
Merge "Add Bluetooth headset API to allow disabling audio route." into cw-e-dev
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/bluetooth/BluetoothHeadset.java | 42 | ||||
-rwxr-xr-x | core/java/android/bluetooth/IBluetoothHeadset.aidl | 2 |
2 files changed, 44 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index 25d9aa9..09a15de 100644 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java @@ -685,6 +685,48 @@ public final class BluetoothHeadset implements BluetoothProfile { } /** + * Sets whether audio routing is allowed. When set to {@code false}, the AG will not route any + * audio to the HF unless explicitly told to. + * This method should be used in cases where the SCO channel is shared between multiple profiles + * and must be delegated by a source knowledgeable + * Note: This is an internal function and shouldn't be exposed + * + * @param allowed {@code true} if the profile can reroute audio, {@code false} otherwise. + * + * @hide + */ + public void setAudioRouteAllowed(boolean allowed) { + if (VDBG) log("setAudioRouteAllowed"); + if (mService != null && isEnabled()) { + try { + mService.setAudioRouteAllowed(allowed); + } 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())); + } + } + + /** + * Returns whether audio routing is allowed. see {@link #setAudioRouteAllowed(boolean)}. + * Note: This is an internal function and shouldn't be exposed + * + * @hide + */ + public boolean getAudioRouteAllowed() { + if (VDBG) log("getAudioRouteAllowed"); + if (mService != null && isEnabled()) { + try { + return mService.getAudioRouteAllowed(); + } 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; + } + + /** * Check if Bluetooth SCO audio is connected. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. diff --git a/core/java/android/bluetooth/IBluetoothHeadset.aidl b/core/java/android/bluetooth/IBluetoothHeadset.aidl index 0e23fad..0bb4088 100755 --- a/core/java/android/bluetooth/IBluetoothHeadset.aidl +++ b/core/java/android/bluetooth/IBluetoothHeadset.aidl @@ -50,6 +50,8 @@ interface IBluetoothHeadset { boolean isAudioOn(); boolean connectAudio(); boolean disconnectAudio(); + void setAudioRouteAllowed(boolean allowed); + boolean getAudioRouteAllowed(); boolean startScoUsingVirtualVoiceCall(in BluetoothDevice device); boolean stopScoUsingVirtualVoiceCall(in BluetoothDevice device); void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type); |