Skip to content

Commit fb90107

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Fix MediaRouter prioritization around a2dp devices" into jb-mr1-dev
2 parents 6b17799 + 3f36968 commit fb90107

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

media/java/android/media/MediaRouter.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ void updateAudioRoutes(AudioRoutesInfo newRoutes) {
152152
dispatchRouteChanged(sStatic.mDefaultAudioVideo);
153153
}
154154

155+
final int mainType = mCurAudioRoutesInfo.mMainType;
156+
155157
boolean a2dpEnabled;
156158
try {
157159
a2dpEnabled = mAudioService.isBluetoothA2dpOn();
@@ -180,11 +182,10 @@ void updateAudioRoutes(AudioRoutesInfo newRoutes) {
180182
}
181183

182184
if (mBluetoothA2dpRoute != null) {
183-
if (mCurAudioRoutesInfo.mMainType != AudioRoutesInfo.MAIN_SPEAKER &&
184-
mSelectedRoute == mBluetoothA2dpRoute) {
185+
if (mainType != AudioRoutesInfo.MAIN_SPEAKER &&
186+
mSelectedRoute == mBluetoothA2dpRoute && !a2dpEnabled) {
185187
selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mDefaultAudioVideo);
186-
} else if (mCurAudioRoutesInfo.mMainType == AudioRoutesInfo.MAIN_SPEAKER &&
187-
(mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == null) &&
188+
} else if ((mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == null) &&
188189
a2dpEnabled) {
189190
selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mBluetoothA2dpRoute);
190191
}

0 commit comments

Comments
 (0)