diff options
author | Eric Laurent <elaurent@google.com> | 2012-06-15 14:01:49 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-15 14:01:49 -0700 |
commit | c4f4b0f0a4905180314d1a681ddf5767ed1070ed (patch) | |
tree | 3e09612bde54a8c78e85eb07840b607f6e73f3ee /media/java/android | |
parent | 2075f2d3e486b565c9abd2556d81dfb1449f6efb (diff) | |
parent | 242b33870b51ea962a1d5c077d71c648eccc2b7a (diff) | |
download | frameworks_base-c4f4b0f0a4905180314d1a681ddf5767ed1070ed.zip frameworks_base-c4f4b0f0a4905180314d1a681ddf5767ed1070ed.tar.gz frameworks_base-c4f4b0f0a4905180314d1a681ddf5767ed1070ed.tar.bz2 |
Merge "AudioManager: back to old setBluetoothA2dpOn()" into jb-dev
Diffstat (limited to 'media/java/android')
-rw-r--r-- | media/java/android/media/AudioManager.java | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 6b9522b..e88c535 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -1271,42 +1271,25 @@ public class AudioManager { } /** - * Allow or disallow use of Bluetooth A2DP for media. - * <p>The default behavior of the system is to use A2DP for media playback whenever an A2DP sink - * is connected. Applications can use this method to override this behavior. - * Note that the request will not persist after a wired headset or an A2DP sink is connected or - * disconnected: - * - Connection of an A2DP sink automatically enables use of A2DP. - * - Connection of a wired headset automatically disables use of A2DP. - * - Disconnection of a wired headset automatically enables use of A2DP if an A2DP sink is - * connected. - * <p>Requires Permission: - * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}. - * @param on set <var>true</var> to allow use of A2DP for media (default). - * <var>false</var> to disallow use of A2DP for media. + * @param on set <var>true</var> to route A2DP audio to/from Bluetooth + * headset; <var>false</var> disable A2DP audio * @deprecated Do not use. */ @Deprecated public void setBluetoothA2dpOn(boolean on){ - IAudioService service = getService(); - try { - service.setBluetoothA2dpOn(on); - } catch (RemoteException e) { - Log.e(TAG, "Dead object in setBluetoothA2dpOn", e); - } } /** - * Checks whether use of A2DP sinks is enabled for media. + * Checks whether A2DP audio routing to the Bluetooth headset is on or off. * - * @return true if use of A2DP is enabled for media, false otherwise. + * @return true if A2DP audio is being routed to/from Bluetooth headset; + * false if otherwise */ public boolean isBluetoothA2dpOn() { - IAudioService service = getService(); - try { - return service.isBluetoothA2dpOn(); - } catch (RemoteException e) { - Log.e(TAG, "Dead object in isBluetoothA2dpOn", e); + if (AudioSystem.getDeviceConnectionState(DEVICE_OUT_BLUETOOTH_A2DP,"") + == AudioSystem.DEVICE_STATE_UNAVAILABLE) { return false; + } else { + return true; } } |