From 3f369684e13dfea0ba8ea134f3e95930b0dd7df0 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Wed, 10 Oct 2012 15:37:47 -0700 Subject: Fix MediaRouter prioritization around a2dp devices Most recently connected audio output gets priority. Wifi display will dominate over everything. Bug 7324334 Change-Id: I29b59570a2e9b5352be436dc5b7a0a6861dfae6b --- media/java/android/media/MediaRouter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'media/java') diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java index 16ad74f..8e9384ee 100644 --- a/media/java/android/media/MediaRouter.java +++ b/media/java/android/media/MediaRouter.java @@ -152,6 +152,8 @@ public class MediaRouter { dispatchRouteChanged(sStatic.mDefaultAudioVideo); } + final int mainType = mCurAudioRoutesInfo.mMainType; + boolean a2dpEnabled; try { a2dpEnabled = mAudioService.isBluetoothA2dpOn(); @@ -180,11 +182,10 @@ public class MediaRouter { } if (mBluetoothA2dpRoute != null) { - if (mCurAudioRoutesInfo.mMainType != AudioRoutesInfo.MAIN_SPEAKER && - mSelectedRoute == mBluetoothA2dpRoute) { + if (mainType != AudioRoutesInfo.MAIN_SPEAKER && + mSelectedRoute == mBluetoothA2dpRoute && !a2dpEnabled) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mDefaultAudioVideo); - } else if (mCurAudioRoutesInfo.mMainType == AudioRoutesInfo.MAIN_SPEAKER && - (mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == null) && + } else if ((mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == null) && a2dpEnabled) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mBluetoothA2dpRoute); } -- cgit v1.1