@Test @SmallTest public void testSessionCallbackAfterSetMediaSessionCompat() throws Exception { getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mSession.setCallback(mSessionCallback); mRouter.setMediaSessionCompat(mSession); } }); MediaControllerCompat controller = mSession.getController(); MediaControllerCompat.TransportControls controls = controller.getTransportControls(); synchronized (mWaitLock) { mSessionCallback.reset(); controls.play(); mWaitLock.wait(TIME_OUT_MS); assertTrue(mSessionCallback.mOnPlayCalled); mSessionCallback.reset(); controls.pause(); mWaitLock.wait(TIME_OUT_MS); assertTrue(mSessionCallback.mOnPauseCalled); } }
public void setMediaSessionCompat(MediaSessionCompat mediaSession) { if (DEBUG) { Log.d(TAG, "addMediaSessionCompat: " + mediaSession); } sGlobal.setMediaSessionCompat(mediaSession); }
MediaRouter { public void setMediaSessionCompat(MediaSessionCompat mediaSession) { if (DEBUG) { Log.d(TAG, "addMediaSessionCompat: " + mediaSession); } sGlobal.setMediaSessionCompat(mediaSession); } }
MediaRouter { public void setMediaSessionCompat(MediaSessionCompat mediaSession) { if (DEBUG) { Log.d(TAG, "addMediaSessionCompat: " + mediaSession); } sGlobal.setMediaSessionCompat(mediaSession); } private  MediaRouter(Context context); }
MediaRouter { public void setMediaSessionCompat(MediaSessionCompat mediaSession) { if (DEBUG) { Log.d(TAG, "addMediaSessionCompat: " + mediaSession); } sGlobal.setMediaSessionCompat(mediaSession); } private  MediaRouter(Context context); static MediaRouter getInstance(@NonNull Context context); List<RouteInfo> getRoutes(); List<ProviderInfo> getProviders(); @NonNull RouteInfo getDefaultRoute(); RouteInfo getBluetoothRoute(); @NonNull RouteInfo getSelectedRoute(); @NonNull RouteInfo updateSelectedRoute(@NonNull MediaRouteSelector selector); void selectRoute(@NonNull RouteInfo route); void unselect(int reason); boolean isRouteAvailable(@NonNull MediaRouteSelector selector, int flags); void addCallback(MediaRouteSelector selector, Callback callback); void addCallback(@NonNull MediaRouteSelector selector, @NonNull Callback callback,
            @CallbackFlags int flags); void removeCallback(@NonNull Callback callback); void addProvider(@NonNull MediaRouteProvider providerInstance); void removeProvider(@NonNull MediaRouteProvider providerInstance); void addRemoteControlClient(@NonNull Object remoteControlClient); void removeRemoteControlClient(@NonNull Object remoteControlClient); void setMediaSession(Object mediaSession); void setMediaSessionCompat(MediaSessionCompat mediaSession); MediaSessionCompat.Token getMediaSessionToken(); }
MediaRouter { public void setMediaSessionCompat(MediaSessionCompat mediaSession) { if (DEBUG) { Log.d(TAG, "addMediaSessionCompat: " + mediaSession); } sGlobal.setMediaSessionCompat(mediaSession); } private  MediaRouter(Context context); static MediaRouter getInstance(@NonNull Context context); List<RouteInfo> getRoutes(); List<ProviderInfo> getProviders(); @NonNull RouteInfo getDefaultRoute(); RouteInfo getBluetoothRoute(); @NonNull RouteInfo getSelectedRoute(); @NonNull RouteInfo updateSelectedRoute(@NonNull MediaRouteSelector selector); void selectRoute(@NonNull RouteInfo route); void unselect(int reason); boolean isRouteAvailable(@NonNull MediaRouteSelector selector, int flags); void addCallback(MediaRouteSelector selector, Callback callback); void addCallback(@NonNull MediaRouteSelector selector, @NonNull Callback callback,
            @CallbackFlags int flags); void removeCallback(@NonNull Callback callback); void addProvider(@NonNull MediaRouteProvider providerInstance); void removeProvider(@NonNull MediaRouteProvider providerInstance); void addRemoteControlClient(@NonNull Object remoteControlClient); void removeRemoteControlClient(@NonNull Object remoteControlClient); void setMediaSession(Object mediaSession); void setMediaSessionCompat(MediaSessionCompat mediaSession); MediaSessionCompat.Token getMediaSessionToken(); static final int UNSELECT_REASON_UNKNOWN; static final int UNSELECT_REASON_DISCONNECTED; static final int UNSELECT_REASON_STOPPED; static final int UNSELECT_REASON_ROUTE_CHANGED; static final int CALLBACK_FLAG_PERFORM_ACTIVE_SCAN; static final int CALLBACK_FLAG_UNFILTERED_EVENTS; static final int CALLBACK_FLAG_REQUEST_DISCOVERY; static final int CALLBACK_FLAG_FORCE_DISCOVERY; static final int AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE; static final int AVAILABILITY_FLAG_REQUIRE_MATCH; }