Add missing nullable annotations
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
This commit is contained in:
parent
cd828e5c10
commit
1699ab0d18
@ -148,6 +148,8 @@
|
|||||||
* Change the order of extractors for sniffing to reduce start-up latency in
|
* Change the order of extractors for sniffing to reduce start-up latency in
|
||||||
`DefaultExtractorsFactory` and `DefaultHlsExtractorsFactory`
|
`DefaultExtractorsFactory` and `DefaultHlsExtractorsFactory`
|
||||||
([#6410](https://github.com/google/ExoPlayer/issues/6410)).
|
([#6410](https://github.com/google/ExoPlayer/issues/6410)).
|
||||||
|
* Add missing `@Nullable` annotations to `MediaSessionConnector`
|
||||||
|
([#7234](https://github.com/google/ExoPlayer/issues/7234)).
|
||||||
|
|
||||||
### 2.11.4 (2020-04-08)
|
### 2.11.4 (2020-04-08)
|
||||||
|
|
||||||
|
@ -207,25 +207,25 @@ public final class MediaSessionConnector {
|
|||||||
*
|
*
|
||||||
* @param mediaId The media id of the media item to be prepared.
|
* @param mediaId The media id of the media item to be prepared.
|
||||||
* @param playWhenReady Whether playback should be started after preparation.
|
* @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)}.
|
* See {@link MediaSessionCompat.Callback#onPrepareFromSearch(String, Bundle)}.
|
||||||
*
|
*
|
||||||
* @param query The search query.
|
* @param query The search query.
|
||||||
* @param playWhenReady Whether playback should be started after preparation.
|
* @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)}.
|
* See {@link MediaSessionCompat.Callback#onPrepareFromUri(Uri, Bundle)}.
|
||||||
*
|
*
|
||||||
* @param uri The {@link Uri} of the media item to be prepared.
|
* @param uri The {@link Uri} of the media item to be prepared.
|
||||||
* @param playWhenReady Whether playback should be started after preparation.
|
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -325,7 +325,7 @@ public final class MediaSessionConnector {
|
|||||||
void onSetRating(Player player, RatingCompat rating);
|
void onSetRating(Player player, RatingCompat rating);
|
||||||
|
|
||||||
/** See {@link MediaSessionCompat.Callback#onSetRating(RatingCompat, Bundle)}. */
|
/** 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. */
|
/** Handles requests for enabling or disabling captions. */
|
||||||
@ -370,7 +370,7 @@ public final class MediaSessionConnector {
|
|||||||
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
|
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
|
||||||
* changes to the player.
|
* changes to the player.
|
||||||
* @param action The name of the action which was sent by a media controller.
|
* @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(
|
void onCustomAction(
|
||||||
Player player, ControlDispatcher controlDispatcher, String action, @Nullable Bundle extras);
|
Player player, ControlDispatcher controlDispatcher, String action, @Nullable Bundle extras);
|
||||||
@ -1284,42 +1284,42 @@ public final class MediaSessionConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareFromMediaId(String mediaId, Bundle extras) {
|
public void onPrepareFromMediaId(String mediaId, @Nullable Bundle extras) {
|
||||||
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_MEDIA_ID)) {
|
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_MEDIA_ID)) {
|
||||||
playbackPreparer.onPrepareFromMediaId(mediaId, /* playWhenReady= */ false, extras);
|
playbackPreparer.onPrepareFromMediaId(mediaId, /* playWhenReady= */ false, extras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareFromSearch(String query, Bundle extras) {
|
public void onPrepareFromSearch(String query, @Nullable Bundle extras) {
|
||||||
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_SEARCH)) {
|
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_SEARCH)) {
|
||||||
playbackPreparer.onPrepareFromSearch(query, /* playWhenReady= */ false, extras);
|
playbackPreparer.onPrepareFromSearch(query, /* playWhenReady= */ false, extras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareFromUri(Uri uri, Bundle extras) {
|
public void onPrepareFromUri(Uri uri, @Nullable Bundle extras) {
|
||||||
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_URI)) {
|
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PREPARE_FROM_URI)) {
|
||||||
playbackPreparer.onPrepareFromUri(uri, /* playWhenReady= */ false, extras);
|
playbackPreparer.onPrepareFromUri(uri, /* playWhenReady= */ false, extras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayFromMediaId(String mediaId, Bundle extras) {
|
public void onPlayFromMediaId(String mediaId, @Nullable Bundle extras) {
|
||||||
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID)) {
|
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID)) {
|
||||||
playbackPreparer.onPrepareFromMediaId(mediaId, /* playWhenReady= */ true, extras);
|
playbackPreparer.onPrepareFromMediaId(mediaId, /* playWhenReady= */ true, extras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayFromSearch(String query, Bundle extras) {
|
public void onPlayFromSearch(String query, @Nullable Bundle extras) {
|
||||||
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH)) {
|
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH)) {
|
||||||
playbackPreparer.onPrepareFromSearch(query, /* playWhenReady= */ true, extras);
|
playbackPreparer.onPrepareFromSearch(query, /* playWhenReady= */ true, extras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayFromUri(Uri uri, Bundle extras) {
|
public void onPlayFromUri(Uri uri, @Nullable Bundle extras) {
|
||||||
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_URI)) {
|
if (canDispatchToPlaybackPreparer(PlaybackStateCompat.ACTION_PLAY_FROM_URI)) {
|
||||||
playbackPreparer.onPrepareFromUri(uri, /* playWhenReady= */ true, extras);
|
playbackPreparer.onPrepareFromUri(uri, /* playWhenReady= */ true, extras);
|
||||||
}
|
}
|
||||||
@ -1333,7 +1333,7 @@ public final class MediaSessionConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSetRating(RatingCompat rating, Bundle extras) {
|
public void onSetRating(RatingCompat rating, @Nullable Bundle extras) {
|
||||||
if (canDispatchSetRating()) {
|
if (canDispatchSetRating()) {
|
||||||
ratingCallback.onSetRating(player, rating, extras);
|
ratingCallback.onSetRating(player, rating, extras);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user