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

Commit 133a24e0 authored by Sungsoo Lim's avatar Sungsoo Lim
Browse files

Make RoutInfo.select() called in app's main thread

Bug: 66995486
Test: passed MediaRouter test
Test: Checked theat IllegalStateException doesn't happen
Change-Id: Idb75998cd7910a430e68ea928d28c9908260d5fc
parent 4de7ab5c
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -598,15 +598,21 @@ 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) {
                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() : a2dp=" + isBluetoothA2dpOn());
                        Log.v(TAG, "onRestoreRoute() : route=" + mSelectedRoute);
                        mSelectedRoute.select();
                    }
                });
            }
        }
    }