summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Pirozzo <pirozzoj@google.com>2018-09-18 11:07:42 -0700
committerJoseph Pirozzo <pirozzoj@google.com>2018-09-18 13:33:19 -0700
commitc5509f69ad7b4dda4efa2ad4d10e2b5aa6848c2e (patch)
tree4be68f0050bba92a927fee8090335334def3c07c
parent701580a4d0e431e8bb0123ab279f1bec5c7bb0e4 (diff)
downloadBluetooth-c5509f69ad7b4dda4efa2ad4d10e2b5aa6848c2e.tar.gz
AVRCP Controller audio focus while browsing.
Upon receiving a request to play a media item via browsing, request focus before sending the play request. Bug: 110111397 Test: select browsable item, verify focus request. Change-Id: I69b4843cb536ea0967cd65c0afa8fc97e9ba25d8
-rw-r--r--src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java b/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java
index ccd888846..323dbfb82 100644
--- a/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java
+++ b/src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java
@@ -289,6 +289,9 @@ public class BluetoothMediaBrowserService extends MediaBrowserService {
@Override
public void onSkipToQueueItem(long id) {
if (DBG) Log.d(TAG, "onSkipToQueueItem" + id);
+ if (mA2dpSinkService != null) {
+ mA2dpSinkService.requestAudioFocus(mA2dpDevice, true);
+ }
MediaSession.QueueItem queueItem = mMediaQueue.get((int) id);
if (queueItem != null) {
String mediaId = queueItem.getDescription().getMediaId();
@@ -331,6 +334,9 @@ public class BluetoothMediaBrowserService extends MediaBrowserService {
public void onPlayFromMediaId(String mediaId, Bundle extras) {
synchronized (BluetoothMediaBrowserService.this) {
// Play the item if possible.
+ if (mA2dpSinkService != null) {
+ mA2dpSinkService.requestAudioFocus(mA2dpDevice, true);
+ }
mAvrcpCtrlSrvc.fetchAttrAndPlayItem(mA2dpDevice, mediaId);
}