Skip to content

Commit

Permalink
Add missing nullable annotations
Browse files Browse the repository at this point in the history
The MediaSessionConnector gets a Bundle passed to the MediaSession.Callback
from the framework which can be null. This needs to be properly annotated
with @nullable.

Issue: #7234
PiperOrigin-RevId: 307822764
  • Loading branch information
marcbaechinger authored and andrewlewis committed May 29, 2020
1 parent 9d6a46b commit 6805907
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
7 changes: 5 additions & 2 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
negligible increase in application size, compared to approximately 8MB when
embedding the library.
* OkHttp extension: Upgrade OkHttp dependency to 3.12.11.
* MediaSession extension: Set session playback state to `BUFFERING` only when
actually playing ([#7206](https://github.com/google/ExoPlayer/issues/7206)).
* MediaSession extension:
* One set the playback state to `BUFFERING` if `playWhenReady` is true
([#7206](https://github.com/google/ExoPlayer/issues/7206)).
* Add missing `@Nullable` annotations to `MediaSessionConnector`
([#7234](https://github.com/google/ExoPlayer/issues/7234)).
* AV1 extension: Add a heuristic to determine the default number of threads
used for AV1 playback using the extension.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,25 @@ public interface PlaybackPreparer extends CommandReceiver {
*
* @param mediaId The media id of the media item to be prepared.
* @param playWhenReady Whether playback should be started after preparation.
* @param extras A {@link Bundle} of extras passed by the media controller.
* @param extras A {@link Bundle} of extras passed by the media controller, may be null.
*/
void onPrepareFromMediaId(String mediaId, boolean playWhenReady, Bundle extras);
void onPrepareFromMediaId(String mediaId, boolean playWhenReady, @Nullable Bundle extras);
/**
* See {@link MediaSessionCompat.Callback#onPrepareFromSearch(String, Bundle)}.
*
* @param query The search query.
* @param playWhenReady Whether playback should be started after preparation.
* @param extras A {@link Bundle} of extras passed by the media controller.
* @param extras A {@link Bundle} of extras passed by the media controller, may be null.
*/
void onPrepareFromSearch(String query, boolean playWhenReady, Bundle extras);
void onPrepareFromSearch(String query, boolean playWhenReady, @Nullable Bundle extras);
/**
* See {@link MediaSessionCompat.Callback#onPrepareFromUri(Uri, Bundle)}.
*
* @param uri The {@link Uri} of the media item to be prepared.
* @param playWhenReady Whether playback should be started after preparation.
* @param extras A {@link Bundle} of extras passed by the media controller.
* @param extras A {@link Bundle} of extras passed by the media controller, may be null.
*/
void onPrepareFromUri(Uri uri, boolean playWhenReady, Bundle extras);
void onPrepareFromUri(Uri uri, boolean playWhenReady, @Nullable Bundle extras);
}

/**
Expand Down Expand Up @@ -336,7 +336,7 @@ public interface RatingCallback extends CommandReceiver {
void onSetRating(Player player, RatingCompat rating);

/** See {@link MediaSessionCompat.Callback#onSetRating(RatingCompat, Bundle)}. */
void onSetRating(Player player, RatingCompat rating, Bundle extras);
void onSetRating(Player player, RatingCompat rating, @Nullable Bundle extras);
}

/** Handles requests for enabling or disabling captions. */
Expand Down Expand Up @@ -381,7 +381,7 @@ public interface CustomActionProvider {
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
* changes to the player.
* @param action The name of the action which was sent by a media controller.
* @param extras Optional extras sent by a media controller.
* @param extras Optional extras sent by a media controller, may be null.
*/
void onCustomAction(
Player player, ControlDispatcher controlDispatcher, String action, @Nullable Bundle extras);
Expand Down Expand Up @@ -1321,42 +1321,42 @@ public void onPrepare() {
}

@Override
public void onPrepareFromMediaId(String mediaId, Bundle extras) {
public void onPrepareFromMediaId(String mediaId, @Nullable Bundle extras) {
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_MEDIA_ID)) {
playbackPreparer.onPrepareFromMediaId(mediaId, /* playWhenReady= */ false, extras);
}
}

@Override
public void onPrepareFromSearch(String query, Bundle extras) {
public void onPrepareFromSearch(String query, @Nullable Bundle extras) {
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_SEARCH)) {
playbackPreparer.onPrepareFromSearch(query, /* playWhenReady= */ false, extras);
}
}

@Override
public void onPrepareFromUri(Uri uri, Bundle extras) {
public void onPrepareFromUri(Uri uri, @Nullable Bundle extras) {
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_URI)) {
playbackPreparer.onPrepareFromUri(uri, /* playWhenReady= */ false, extras);
}
}

@Override
public void onPlayFromMediaId(String mediaId, Bundle extras) {
public void onPlayFromMediaId(String mediaId, @Nullable Bundle extras) {
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID)) {
playbackPreparer.onPrepareFromMediaId(mediaId, /* playWhenReady= */ true, extras);
}
}

@Override
public void onPlayFromSearch(String query, Bundle extras) {
public void onPlayFromSearch(String query, @Nullable Bundle extras) {
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH)) {
playbackPreparer.onPrepareFromSearch(query, /* playWhenReady= */ true, extras);
}
}

@Override
public void onPlayFromUri(Uri uri, Bundle extras) {
public void onPlayFromUri(Uri uri, @Nullable Bundle extras) {
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_URI)) {
playbackPreparer.onPrepareFromUri(uri, /* playWhenReady= */ true, extras);
}
Expand All @@ -1370,7 +1370,7 @@ public void onSetRating(RatingCompat rating) {
}

@Override
public void onSetRating(RatingCompat rating, Bundle extras) {
public void onSetRating(RatingCompat rating, @Nullable Bundle extras) {
if (canDispatchSetRating()) {
ratingCallback.onSetRating(player, rating, extras);
}
Expand Down

0 comments on commit 6805907

Please sign in to comment.