diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2015-08-03 17:26:01 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2015-08-03 17:26:01 -0700 |
commit | 6d00e41145a577de114f93985bf05d7eca99ccc3 (patch) | |
tree | ff411a6e887b7c2dbb2fea79b5d5b84b4f9f3b1e /media/java | |
parent | d0694da4fb85bb01e7c0ea7989a78a0e635453ac (diff) | |
download | frameworks_base-6d00e41145a577de114f93985bf05d7eca99ccc3.zip frameworks_base-6d00e41145a577de114f93985bf05d7eca99ccc3.tar.gz frameworks_base-6d00e41145a577de114f93985bf05d7eca99ccc3.tar.bz2 |
AudioService: check for audio device connection success
When connecting/disconnecting and audio device, AudioService
was assuming that the call was always successful through
AudioSystem.setDeviceConnectionState(). In the case of the
connection of a wired headset (mic + headphones), this also
causes A2DP to not be used for media playback.
The connection can fail if the audio device being connected
is not supported by the platform. But if this failure is
not taken into account for DEVICE_OUT_WIRED_HEADSET or
HEADPHONES, A2DP would still be avoided even when an A2DP
device reconnects at boot.
The fix consists in executing the connection logic only when
the connection was deemed successful. Nothing is altered
on the disconnection code path, or the direct connection
of A2DP.
The javadoc is updated in AudioSystem to indicate the return
codes to take into account in setDeviceConnectionState().
Bug 22511833
Change-Id: I22f0d2c7d4ab4fb9ee1be2f248907f721596a16f
Diffstat (limited to 'media/java')
-rw-r--r-- | media/java/android/media/AudioSystem.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index acdadd7..e99a37a 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -604,6 +604,10 @@ public class AudioSystem public static final int SYNC_EVENT_NONE = 0; public static final int SYNC_EVENT_PRESENTATION_COMPLETE = 1; + /** + * @return command completion status, one of {@link #AUDIO_STATUS_OK}, + * {@link #AUDIO_STATUS_ERROR} or {@link #AUDIO_STATUS_SERVER_DIED} + */ public static native int setDeviceConnectionState(int device, int state, String device_address, String device_name); public static native int getDeviceConnectionState(int device, String device_address); |