mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove all references to @NonNull
Our package-info.java files are annotated with @NonNullApi which results in everything being non-null by default, so this annotation is never needed. #minor-release PiperOrigin-RevId: 405864737
This commit is contained in:
parent
39639f8df0
commit
9c9671a0af
@ -27,7 +27,6 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@ -199,7 +198,6 @@ public class MainActivity extends AppCompatActivity
|
||||
private class MediaQueueListAdapter extends RecyclerView.Adapter<QueueItemViewHolder> {
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public QueueItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
TextView v =
|
||||
(TextView)
|
||||
@ -240,9 +238,7 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
@Override
|
||||
public boolean onMove(
|
||||
@NonNull RecyclerView list,
|
||||
RecyclerView.ViewHolder origin,
|
||||
RecyclerView.ViewHolder target) {
|
||||
RecyclerView list, RecyclerView.ViewHolder origin, RecyclerView.ViewHolder target) {
|
||||
int fromPosition = origin.getAdapterPosition();
|
||||
int toPosition = target.getAdapterPosition();
|
||||
if (draggingFromPosition == C.INDEX_UNSET) {
|
||||
@ -266,7 +262,7 @@ public class MainActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearView(@NonNull RecyclerView recyclerView, @NonNull ViewHolder viewHolder) {
|
||||
public void clearView(RecyclerView recyclerView, ViewHolder viewHolder) {
|
||||
super.clearView(recyclerView, viewHolder);
|
||||
if (draggingFromPosition != C.INDEX_UNSET) {
|
||||
QueueItemViewHolder queueItemHolder = (QueueItemViewHolder) viewHolder;
|
||||
@ -306,8 +302,7 @@ public class MainActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||
public View getView(int position, @Nullable View convertView, ViewGroup parent) {
|
||||
View view = super.getView(position, convertView, parent);
|
||||
((TextView) view).setText(Util.castNonNull(getItem(position)).mediaMetadata.title);
|
||||
return view;
|
||||
|
@ -18,7 +18,6 @@ package com.google.android.exoplayer2.castdemo;
|
||||
import android.content.Context;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
@ -226,7 +225,7 @@ import java.util.ArrayList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimelineChanged(@NonNull Timeline timeline, @TimelineChangeReason int reason) {
|
||||
public void onTimelineChanged(Timeline timeline, @TimelineChangeReason int reason) {
|
||||
updateCurrentItemIndex();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ import android.opengl.GLES20;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Handler;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
@ -290,7 +289,7 @@ public final class VideoProcessingGLSurfaceView extends GLSurfaceView {
|
||||
public void onVideoFrameAboutToBeRendered(
|
||||
long presentationTimeUs,
|
||||
long releaseTimeNs,
|
||||
@NonNull Format format,
|
||||
Format format,
|
||||
@Nullable MediaFormat mediaFormat) {
|
||||
sampleTimestampQueue.add(releaseTimeNs, presentationTimeUs);
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import static com.google.android.exoplayer2.demo.DemoUtil.DOWNLOAD_NOTIFICATION_
|
||||
|
||||
import android.app.Notification;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.offline.Download;
|
||||
import com.google.android.exoplayer2.offline.DownloadManager;
|
||||
@ -48,7 +47,6 @@ public class DemoDownloadService extends DownloadService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected DownloadManager getDownloadManager() {
|
||||
// This will only happen once, because getDownloadManager is guaranteed to be called only once
|
||||
// in the life cycle of the process.
|
||||
@ -67,9 +65,8 @@ public class DemoDownloadService extends DownloadService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected Notification getForegroundNotification(
|
||||
@NonNull List<Download> downloads, @Requirements.RequirementFlags int notMetRequirements) {
|
||||
List<Download> downloads, @Requirements.RequirementFlags int notMetRequirements) {
|
||||
return DemoUtil.getDownloadNotificationHelper(/* context= */ this)
|
||||
.buildProgressNotification(
|
||||
/* context= */ this,
|
||||
|
@ -23,7 +23,6 @@ import android.content.DialogInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@ -142,9 +141,7 @@ public class DownloadTracker {
|
||||
|
||||
@Override
|
||||
public void onDownloadChanged(
|
||||
@NonNull DownloadManager downloadManager,
|
||||
@NonNull Download download,
|
||||
@Nullable Exception finalException) {
|
||||
DownloadManager downloadManager, Download download, @Nullable Exception finalException) {
|
||||
downloads.put(download.request.uri, download);
|
||||
for (Listener listener : listeners) {
|
||||
listener.onDownloadsChanged();
|
||||
@ -152,8 +149,7 @@ public class DownloadTracker {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadRemoved(
|
||||
@NonNull DownloadManager downloadManager, @NonNull Download download) {
|
||||
public void onDownloadRemoved(DownloadManager downloadManager, Download download) {
|
||||
downloads.remove(download.request.uri);
|
||||
for (Listener listener : listeners) {
|
||||
listener.onDownloadsChanged();
|
||||
@ -196,7 +192,7 @@ public class DownloadTracker {
|
||||
// DownloadHelper.Callback implementation.
|
||||
|
||||
@Override
|
||||
public void onPrepared(@NonNull DownloadHelper helper) {
|
||||
public void onPrepared(DownloadHelper helper) {
|
||||
@Nullable Format format = getFirstFormatWithDrmInitData(helper);
|
||||
if (format == null) {
|
||||
onDownloadPrepared(helper);
|
||||
@ -231,7 +227,7 @@ public class DownloadTracker {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareError(@NonNull DownloadHelper helper, @NonNull IOException e) {
|
||||
public void onPrepareError(DownloadHelper helper, IOException e) {
|
||||
boolean isLiveContent = e instanceof LiveContentUnsupportedException;
|
||||
int toastStringId =
|
||||
isLiveContent ? R.string.download_live_unsupported : R.string.download_start_error;
|
||||
|
@ -28,7 +28,6 @@ import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.google.android.exoplayer2.C;
|
||||
@ -185,7 +184,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(
|
||||
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (grantResults.length == 0) {
|
||||
// Empty results are triggered if a permission is requested while another request was already
|
||||
@ -201,7 +200,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
updateTrackSelectorParameters();
|
||||
updateStartPosition();
|
||||
@ -424,7 +423,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerError(@NonNull PlaybackException error) {
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
if (error.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
|
||||
player.seekToDefaultPosition();
|
||||
player.prepare();
|
||||
@ -454,8 +453,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||
private class PlayerErrorMessageProvider implements ErrorMessageProvider<PlaybackException> {
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Pair<Integer, String> getErrorMessage(@NonNull PlaybackException e) {
|
||||
public Pair<Integer, String> getErrorMessage(PlaybackException e) {
|
||||
String errorString = getString(R.string.error_generic);
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof DecoderInitializationException) {
|
||||
|
@ -40,7 +40,6 @@ import android.widget.ExpandableListView.OnChildClickListener;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
@ -163,7 +162,7 @@ public class SampleChooserActivity extends AppCompatActivity
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(
|
||||
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (grantResults.length == 0) {
|
||||
// Empty results are triggered if a permission is requested while another request was already
|
||||
|
@ -24,7 +24,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
@ -213,7 +212,6 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
// We need to own the view to let tab layout work correctly on all API levels. We can't use
|
||||
// AlertDialog because it owns the view itself, so we use AppCompatDialog instead, themed using
|
||||
@ -225,7 +223,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
onDismissListener.onDismiss(dialog);
|
||||
}
|
||||
@ -290,7 +288,6 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Fragment getItem(int position) {
|
||||
return tabFragments.valueAt(position);
|
||||
}
|
||||
@ -364,8 +361,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackSelectionChanged(
|
||||
boolean isDisabled, @NonNull List<SelectionOverride> overrides) {
|
||||
public void onTrackSelectionChanged(boolean isDisabled, List<SelectionOverride> overrides) {
|
||||
this.isDisabled = isDisabled;
|
||||
this.overrides = overrides;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ package com.google.android.exoplayer2.ext.media2;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media2.common.MediaItem;
|
||||
import androidx.media2.common.MediaMetadata;
|
||||
@ -106,8 +105,7 @@ import java.util.concurrent.TimeoutException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostConnect(
|
||||
@NonNull MediaSession session, @NonNull MediaSession.ControllerInfo controller) {
|
||||
public void onPostConnect(MediaSession session, MediaSession.ControllerInfo controller) {
|
||||
if (postConnectCallback != null) {
|
||||
postConnectCallback.onPostConnect(session, controller);
|
||||
}
|
||||
@ -175,8 +173,7 @@ import java.util.concurrent.TimeoutException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onSkipBackward(
|
||||
@NonNull MediaSession session, @NonNull MediaSession.ControllerInfo controller) {
|
||||
public int onSkipBackward(MediaSession session, MediaSession.ControllerInfo controller) {
|
||||
if (skipCallback != null) {
|
||||
return skipCallback.onSkipBackward(session, controller);
|
||||
}
|
||||
@ -184,8 +181,7 @@ import java.util.concurrent.TimeoutException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onSkipForward(
|
||||
@NonNull MediaSession session, @NonNull MediaSession.ControllerInfo controller) {
|
||||
public int onSkipForward(MediaSession session, MediaSession.ControllerInfo controller) {
|
||||
if (skipCallback != null) {
|
||||
return skipCallback.onSkipForward(session, controller);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* A set of listeners.
|
||||
@ -35,7 +35,7 @@ import javax.annotation.Nonnull;
|
||||
*
|
||||
* @param <T> The listener type.
|
||||
*/
|
||||
public final class ListenerSet<T> {
|
||||
public final class ListenerSet<T extends @NonNull Object> {
|
||||
|
||||
/**
|
||||
* An event sent to a listener.
|
||||
@ -232,15 +232,15 @@ public final class ListenerSet<T> {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static final class ListenerHolder<T> {
|
||||
private static final class ListenerHolder<T extends @NonNull Object> {
|
||||
|
||||
@Nonnull public final T listener;
|
||||
public final T listener;
|
||||
|
||||
private FlagSet.Builder flagsBuilder;
|
||||
private boolean needsIterationFinishedEvent;
|
||||
private boolean released;
|
||||
|
||||
public ListenerHolder(@Nonnull T listener) {
|
||||
public ListenerHolder(T listener) {
|
||||
this.listener = listener;
|
||||
this.flagsBuilder = new FlagSet.Builder();
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Pair;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import com.google.android.exoplayer2.C;
|
||||
@ -1829,7 +1828,7 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTearDown(@NonNull AudioTrack track) {
|
||||
public void onTearDown(AudioTrack track) {
|
||||
Assertions.checkState(track == audioTrack);
|
||||
if (listener != null && playing) {
|
||||
// The audio track was destroyed while in use. Thus a new AudioTrack needs to be
|
||||
|
@ -24,7 +24,6 @@ import android.media.MediaFormat;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import androidx.annotation.GuardedBy;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
@ -207,15 +206,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
// Called from the callback thread.
|
||||
|
||||
@Override
|
||||
public void onInputBufferAvailable(@NonNull MediaCodec codec, int index) {
|
||||
public void onInputBufferAvailable(MediaCodec codec, int index) {
|
||||
synchronized (lock) {
|
||||
availableInputBuffers.add(index);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOutputBufferAvailable(
|
||||
@NonNull MediaCodec codec, int index, @NonNull MediaCodec.BufferInfo info) {
|
||||
public void onOutputBufferAvailable(MediaCodec codec, int index, MediaCodec.BufferInfo info) {
|
||||
synchronized (lock) {
|
||||
if (pendingOutputFormat != null) {
|
||||
addOutputFormat(pendingOutputFormat);
|
||||
@ -227,14 +225,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull MediaCodec codec, @NonNull MediaCodec.CodecException e) {
|
||||
public void onError(MediaCodec codec, MediaCodec.CodecException e) {
|
||||
synchronized (lock) {
|
||||
mediaCodecException = e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOutputFormatChanged(@NonNull MediaCodec codec, @NonNull MediaFormat format) {
|
||||
public void onOutputFormatChanged(MediaCodec codec, MediaFormat format) {
|
||||
synchronized (lock) {
|
||||
addOutputFormat(format);
|
||||
pendingOutputFormat = null;
|
||||
|
@ -31,7 +31,6 @@ import android.media.MediaParser;
|
||||
import android.media.MediaParser.OutputConsumer;
|
||||
import android.media.MediaParser.SeekPoint;
|
||||
import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
@ -262,7 +261,7 @@ public final class MediaParserHlsMediaChunkExtractor implements HlsMediaChunkExt
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(@NonNull byte[] buffer, int offset, int readLength) throws IOException {
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
int peekedBytes = extractorInput.peek(buffer, offset, readLength);
|
||||
totalPeekedBytes += peekedBytes;
|
||||
return peekedBytes;
|
||||
|
@ -22,7 +22,6 @@ import android.os.ConditionVariable;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Message;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.util.HandlerWrapper;
|
||||
@ -398,7 +397,7 @@ public final class FakeClockTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
public boolean handleMessage(Message msg) {
|
||||
messages.add(new MessageData(msg.what, msg.arg1, msg.arg2, msg.obj));
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user