Merge "Make RoutInfo.select() called in app's main thread" into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-09-29 08:15:05 +00:00
committed by Android (Google) Code Review

View File

@@ -598,14 +598,20 @@ public class MediaRouter {
@Override
public void onRestoreRoute() {
// Skip restoring route if the selected route is not a system audio route, or
// MediaRouter is initializing.
if ((mSelectedRoute != mDefaultAudioVideo && mSelectedRoute != mBluetoothA2dpRoute)
|| mSelectedRoute == null) {
return;
}
Log.v(TAG, "onRestoreRoute() : a2dp=" + isBluetoothA2dpOn());
mSelectedRoute.select();
mHandler.post(new Runnable() {
@Override
public void run() {
// Skip restoring route if the selected route is not a system audio route,
// MediaRouter is initializing, or mClient was changed.
if (Client.this != mClient || mSelectedRoute == null
|| (mSelectedRoute != mDefaultAudioVideo
&& mSelectedRoute != mBluetoothA2dpRoute)) {
return;
}
Log.v(TAG, "onRestoreRoute() : route=" + mSelectedRoute);
mSelectedRoute.select();
}
});
}
}
}