@Test public void testPrepareFromUri() throws InterruptedException { prepareLooper(); final Uri request = Uri.parse("foo: final Bundle bundle = new Bundle(); bundle.putString("key", "value"); final CountDownLatch latch = new CountDownLatch(1); final SessionCallback callback = new SessionCallback() { @Override public void onPrepareFromUri(MediaSession2 session, ControllerInfo controller, Uri uri, Bundle extras) { assertEquals(mContext.getPackageName(), controller.getPackageName()); assertEquals(request, uri); assertTrue(TestUtils.equals(bundle, extras)); latch.countDown(); } }; try (MediaSession2 session = new MediaSession2.Builder(mContext) .setPlayer(mPlayer) .setSessionCallback(sHandlerExecutor, callback) .setId("testPrepareFromUri").build()) { MediaController2 controller = createController(session.getToken()); controller.prepareFromUri(request, bundle); assertTrue(latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); } }
public void prepareFromUri(@NonNull Uri uri, @Nullable Bundle extras) { mImpl.prepareFromUri(uri, extras); }
MediaController2 implements AutoCloseable { public void prepareFromUri(@NonNull Uri uri, @Nullable Bundle extras) { mImpl.prepareFromUri(uri, extras); } }
MediaController2 implements AutoCloseable { public void prepareFromUri(@NonNull Uri uri, @Nullable Bundle extras) { mImpl.prepareFromUri(uri, extras); } MediaController2(@NonNull Context context, @NonNull SessionToken2 token,
            @NonNull Executor executor, @NonNull ControllerCallback callback); }
MediaController2 implements AutoCloseable { public void prepareFromUri(@NonNull Uri uri, @Nullable Bundle extras) { mImpl.prepareFromUri(uri, extras); } MediaController2(@NonNull Context context, @NonNull SessionToken2 token,
            @NonNull Executor executor, @NonNull ControllerCallback callback); @Override void close(); @NonNull SessionToken2 getSessionToken(); boolean isConnected(); void play(); void pause(); void reset(); void prepare(); void fastForward(); void rewind(); void seekTo(long pos); @RestrictTo(LIBRARY_GROUP) void skipForward(); @RestrictTo(LIBRARY_GROUP) void skipBackward(); void playFromMediaId(@NonNull String mediaId, @Nullable Bundle extras); void playFromSearch(@NonNull String query, @Nullable Bundle extras); void playFromUri(@NonNull Uri uri, @Nullable Bundle extras); void prepareFromMediaId(@NonNull String mediaId, @Nullable Bundle extras); void prepareFromSearch(@NonNull String query, @Nullable Bundle extras); void prepareFromUri(@NonNull Uri uri, @Nullable Bundle extras); void setVolumeTo(int value, @VolumeFlags int flags); void adjustVolume(@VolumeDirection int direction, @VolumeFlags int flags); @Nullable PendingIntent getSessionActivity(); int getPlayerState(); long getDuration(); long getCurrentPosition(); float getPlaybackSpeed(); void setPlaybackSpeed(float speed); @MediaPlayerInterface.BuffState int getBufferingState(); long getBufferedPosition(); @Nullable PlaybackInfo getPlaybackInfo(); void setRating(@NonNull String mediaId, @NonNull Rating2 rating); void sendCustomCommand(@NonNull SessionCommand2 command, @Nullable Bundle args,
            @Nullable ResultReceiver cb); @Nullable List<MediaItem2> getPlaylist(); void setPlaylist(@NonNull List<MediaItem2> list, @Nullable MediaMetadata2 metadata); void updatePlaylistMetadata(@Nullable MediaMetadata2 metadata); @Nullable MediaMetadata2 getPlaylistMetadata(); void addPlaylistItem(int index, @NonNull MediaItem2 item); void removePlaylistItem(@NonNull MediaItem2 item); void replacePlaylistItem(int index, @NonNull MediaItem2 item); MediaItem2 getCurrentMediaItem(); void skipToPreviousItem(); void skipToNextItem(); void skipToPlaylistItem(@NonNull MediaItem2 item); @RepeatMode int getRepeatMode(); void setRepeatMode(@RepeatMode int repeatMode); @ShuffleMode int getShuffleMode(); void setShuffleMode(@ShuffleMode int shuffleMode); void subscribeRoutesInfo(); void unsubscribeRoutesInfo(); void selectRoute(@NonNull Bundle route); }
MediaController2 implements AutoCloseable { public void prepareFromUri(@NonNull Uri uri, @Nullable Bundle extras) { mImpl.prepareFromUri(uri, extras); } MediaController2(@NonNull Context context, @NonNull SessionToken2 token,
            @NonNull Executor executor, @NonNull ControllerCallback callback); @Override void close(); @NonNull SessionToken2 getSessionToken(); boolean isConnected(); void play(); void pause(); void reset(); void prepare(); void fastForward(); void rewind(); void seekTo(long pos); @RestrictTo(LIBRARY_GROUP) void skipForward(); @RestrictTo(LIBRARY_GROUP) void skipBackward(); void playFromMediaId(@NonNull String mediaId, @Nullable Bundle extras); void playFromSearch(@NonNull String query, @Nullable Bundle extras); void playFromUri(@NonNull Uri uri, @Nullable Bundle extras); void prepareFromMediaId(@NonNull String mediaId, @Nullable Bundle extras); void prepareFromSearch(@NonNull String query, @Nullable Bundle extras); void prepareFromUri(@NonNull Uri uri, @Nullable Bundle extras); void setVolumeTo(int value, @VolumeFlags int flags); void adjustVolume(@VolumeDirection int direction, @VolumeFlags int flags); @Nullable PendingIntent getSessionActivity(); int getPlayerState(); long getDuration(); long getCurrentPosition(); float getPlaybackSpeed(); void setPlaybackSpeed(float speed); @MediaPlayerInterface.BuffState int getBufferingState(); long getBufferedPosition(); @Nullable PlaybackInfo getPlaybackInfo(); void setRating(@NonNull String mediaId, @NonNull Rating2 rating); void sendCustomCommand(@NonNull SessionCommand2 command, @Nullable Bundle args,
            @Nullable ResultReceiver cb); @Nullable List<MediaItem2> getPlaylist(); void setPlaylist(@NonNull List<MediaItem2> list, @Nullable MediaMetadata2 metadata); void updatePlaylistMetadata(@Nullable MediaMetadata2 metadata); @Nullable MediaMetadata2 getPlaylistMetadata(); void addPlaylistItem(int index, @NonNull MediaItem2 item); void removePlaylistItem(@NonNull MediaItem2 item); void replacePlaylistItem(int index, @NonNull MediaItem2 item); MediaItem2 getCurrentMediaItem(); void skipToPreviousItem(); void skipToNextItem(); void skipToPlaylistItem(@NonNull MediaItem2 item); @RepeatMode int getRepeatMode(); void setRepeatMode(@RepeatMode int repeatMode); @ShuffleMode int getShuffleMode(); void setShuffleMode(@ShuffleMode int shuffleMode); void subscribeRoutesInfo(); void unsubscribeRoutesInfo(); void selectRoute(@NonNull Bundle route);  }