Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8e38e2d authored by Sungsoo Lim's avatar Sungsoo Lim
Browse files

Select a system audio route only when needed

When system audio routes are changd, updateAudioRoutes is called, and
it selects a system audio route even when a none system route was
seleted.
That makes the selected route be unselected and this CL fixes it.

Bug: 65403568
Test: manual tested that the issue is fixed
Change-Id: I5df9d3e5f68cfd40fdb625937f9a8e16f4308e16
parent c3f81bae
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -202,7 +202,6 @@ public class MediaRouter {
                audioRoutesChanged = true;
            }

            final int mainType = mCurAudioRoutesInfo.mainType;
            if (!TextUtils.equals(newRoutes.bluetoothName, mCurAudioRoutesInfo.bluetoothName)) {
                mCurAudioRoutesInfo.bluetoothName = newRoutes.bluetoothName;
                if (mCurAudioRoutesInfo.bluetoothName != null) {
@@ -229,8 +228,11 @@ public class MediaRouter {
            }

            if (audioRoutesChanged) {
                selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, getDefaultSystemAudioRoute(), false);
                Log.v(TAG, "Audio routes updated: " + newRoutes + ", a2dp=" + isBluetoothA2dpOn());
                if (mSelectedRoute == null || mSelectedRoute == mDefaultAudioVideo
                        || mSelectedRoute == mBluetoothA2dpRoute) {
                    selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, getDefaultSystemAudioRoute(), false);
                }
            }
        }