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
651985b0ac
commit
9a49a9ccda
@ -27,7 +27,6 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
@ -199,7 +198,6 @@ public class MainActivity extends AppCompatActivity
|
|||||||
private class MediaQueueListAdapter extends RecyclerView.Adapter<QueueItemViewHolder> {
|
private class MediaQueueListAdapter extends RecyclerView.Adapter<QueueItemViewHolder> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
|
||||||
public QueueItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public QueueItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
TextView v =
|
TextView v =
|
||||||
(TextView)
|
(TextView)
|
||||||
@ -240,9 +238,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMove(
|
public boolean onMove(
|
||||||
@NonNull RecyclerView list,
|
RecyclerView list, RecyclerView.ViewHolder origin, RecyclerView.ViewHolder target) {
|
||||||
RecyclerView.ViewHolder origin,
|
|
||||||
RecyclerView.ViewHolder target) {
|
|
||||||
int fromPosition = origin.getAdapterPosition();
|
int fromPosition = origin.getAdapterPosition();
|
||||||
int toPosition = target.getAdapterPosition();
|
int toPosition = target.getAdapterPosition();
|
||||||
if (draggingFromPosition == C.INDEX_UNSET) {
|
if (draggingFromPosition == C.INDEX_UNSET) {
|
||||||
@ -266,7 +262,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearView(@NonNull RecyclerView recyclerView, @NonNull ViewHolder viewHolder) {
|
public void clearView(RecyclerView recyclerView, ViewHolder viewHolder) {
|
||||||
super.clearView(recyclerView, viewHolder);
|
super.clearView(recyclerView, viewHolder);
|
||||||
if (draggingFromPosition != C.INDEX_UNSET) {
|
if (draggingFromPosition != C.INDEX_UNSET) {
|
||||||
QueueItemViewHolder queueItemHolder = (QueueItemViewHolder) viewHolder;
|
QueueItemViewHolder queueItemHolder = (QueueItemViewHolder) viewHolder;
|
||||||
@ -306,8 +302,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
public View getView(int position, @Nullable View convertView, ViewGroup parent) {
|
||||||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
|
||||||
View view = super.getView(position, convertView, parent);
|
View view = super.getView(position, convertView, parent);
|
||||||
((TextView) view).setText(Util.castNonNull(getItem(position)).mediaMetadata.title);
|
((TextView) view).setText(Util.castNonNull(getItem(position)).mediaMetadata.title);
|
||||||
return view;
|
return view;
|
||||||
|
@ -18,7 +18,6 @@ package androidx.media3.demo.cast;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.media3.cast.CastPlayer;
|
import androidx.media3.cast.CastPlayer;
|
||||||
import androidx.media3.cast.SessionAvailabilityListener;
|
import androidx.media3.cast.SessionAvailabilityListener;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
@ -226,7 +225,7 @@ import java.util.ArrayList;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTimelineChanged(@NonNull Timeline timeline, @TimelineChangeReason int reason) {
|
public void onTimelineChanged(Timeline timeline, @TimelineChangeReason int reason) {
|
||||||
updateCurrentItemIndex();
|
updateCurrentItemIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import android.opengl.GLES20;
|
|||||||
import android.opengl.GLSurfaceView;
|
import android.opengl.GLSurfaceView;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
@ -290,7 +289,7 @@ public final class VideoProcessingGLSurfaceView extends GLSurfaceView {
|
|||||||
public void onVideoFrameAboutToBeRendered(
|
public void onVideoFrameAboutToBeRendered(
|
||||||
long presentationTimeUs,
|
long presentationTimeUs,
|
||||||
long releaseTimeNs,
|
long releaseTimeNs,
|
||||||
@NonNull Format format,
|
Format format,
|
||||||
@Nullable MediaFormat mediaFormat) {
|
@Nullable MediaFormat mediaFormat) {
|
||||||
sampleTimestampQueue.add(releaseTimeNs, presentationTimeUs);
|
sampleTimestampQueue.add(releaseTimeNs, presentationTimeUs);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ import static androidx.media3.demo.main.DemoUtil.DOWNLOAD_NOTIFICATION_CHANNEL_I
|
|||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.NotificationUtil;
|
import androidx.media3.common.util.NotificationUtil;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -48,7 +47,6 @@ public class DemoDownloadService extends DownloadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
|
||||||
protected DownloadManager getDownloadManager() {
|
protected DownloadManager getDownloadManager() {
|
||||||
// This will only happen once, because getDownloadManager is guaranteed to be called only once
|
// This will only happen once, because getDownloadManager is guaranteed to be called only once
|
||||||
// in the life cycle of the process.
|
// in the life cycle of the process.
|
||||||
@ -67,9 +65,8 @@ public class DemoDownloadService extends DownloadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
|
||||||
protected Notification getForegroundNotification(
|
protected Notification getForegroundNotification(
|
||||||
@NonNull List<Download> downloads, @Requirements.RequirementFlags int notMetRequirements) {
|
List<Download> downloads, @Requirements.RequirementFlags int notMetRequirements) {
|
||||||
return DemoUtil.getDownloadNotificationHelper(/* context= */ this)
|
return DemoUtil.getDownloadNotificationHelper(/* context= */ this)
|
||||||
.buildProgressNotification(
|
.buildProgressNotification(
|
||||||
/* context= */ this,
|
/* context= */ this,
|
||||||
|
@ -23,7 +23,6 @@ import android.content.DialogInterface;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
@ -142,9 +141,7 @@ public class DownloadTracker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDownloadChanged(
|
public void onDownloadChanged(
|
||||||
@NonNull DownloadManager downloadManager,
|
DownloadManager downloadManager, Download download, @Nullable Exception finalException) {
|
||||||
@NonNull Download download,
|
|
||||||
@Nullable Exception finalException) {
|
|
||||||
downloads.put(download.request.uri, download);
|
downloads.put(download.request.uri, download);
|
||||||
for (Listener listener : listeners) {
|
for (Listener listener : listeners) {
|
||||||
listener.onDownloadsChanged();
|
listener.onDownloadsChanged();
|
||||||
@ -152,8 +149,7 @@ public class DownloadTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDownloadRemoved(
|
public void onDownloadRemoved(DownloadManager downloadManager, Download download) {
|
||||||
@NonNull DownloadManager downloadManager, @NonNull Download download) {
|
|
||||||
downloads.remove(download.request.uri);
|
downloads.remove(download.request.uri);
|
||||||
for (Listener listener : listeners) {
|
for (Listener listener : listeners) {
|
||||||
listener.onDownloadsChanged();
|
listener.onDownloadsChanged();
|
||||||
@ -196,7 +192,7 @@ public class DownloadTracker {
|
|||||||
// DownloadHelper.Callback implementation.
|
// DownloadHelper.Callback implementation.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepared(@NonNull DownloadHelper helper) {
|
public void onPrepared(DownloadHelper helper) {
|
||||||
@Nullable Format format = getFirstFormatWithDrmInitData(helper);
|
@Nullable Format format = getFirstFormatWithDrmInitData(helper);
|
||||||
if (format == null) {
|
if (format == null) {
|
||||||
onDownloadPrepared(helper);
|
onDownloadPrepared(helper);
|
||||||
@ -231,7 +227,7 @@ public class DownloadTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareError(@NonNull DownloadHelper helper, @NonNull IOException e) {
|
public void onPrepareError(DownloadHelper helper, IOException e) {
|
||||||
boolean isLiveContent = e instanceof LiveContentUnsupportedException;
|
boolean isLiveContent = e instanceof LiveContentUnsupportedException;
|
||||||
int toastStringId =
|
int toastStringId =
|
||||||
isLiveContent ? R.string.download_live_unsupported : R.string.download_start_error;
|
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.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.media3.common.AudioAttributes;
|
import androidx.media3.common.AudioAttributes;
|
||||||
@ -185,7 +184,7 @@ public class PlayerActivity extends AppCompatActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(
|
public void onRequestPermissionsResult(
|
||||||
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
int requestCode, String[] permissions, int[] grantResults) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
if (grantResults.length == 0) {
|
if (grantResults.length == 0) {
|
||||||
// Empty results are triggered if a permission is requested while another request was already
|
// Empty results are triggered if a permission is requested while another request was already
|
||||||
@ -201,7 +200,7 @@ public class PlayerActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
updateTrackSelectorParameters();
|
updateTrackSelectorParameters();
|
||||||
updateStartPosition();
|
updateStartPosition();
|
||||||
@ -424,7 +423,7 @@ public class PlayerActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerError(@NonNull PlaybackException error) {
|
public void onPlayerError(PlaybackException error) {
|
||||||
if (error.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
|
if (error.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
|
||||||
player.seekToDefaultPosition();
|
player.seekToDefaultPosition();
|
||||||
player.prepare();
|
player.prepare();
|
||||||
@ -454,8 +453,7 @@ public class PlayerActivity extends AppCompatActivity
|
|||||||
private class PlayerErrorMessageProvider implements ErrorMessageProvider<PlaybackException> {
|
private class PlayerErrorMessageProvider implements ErrorMessageProvider<PlaybackException> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
public Pair<Integer, String> getErrorMessage(PlaybackException e) {
|
||||||
public Pair<Integer, String> getErrorMessage(@NonNull PlaybackException e) {
|
|
||||||
String errorString = getString(R.string.error_generic);
|
String errorString = getString(R.string.error_generic);
|
||||||
Throwable cause = e.getCause();
|
Throwable cause = e.getCause();
|
||||||
if (cause instanceof DecoderInitializationException) {
|
if (cause instanceof DecoderInitializationException) {
|
||||||
|
@ -40,7 +40,6 @@ import android.widget.ExpandableListView.OnChildClickListener;
|
|||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
@ -163,7 +162,7 @@ public class SampleChooserActivity extends AppCompatActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(
|
public void onRequestPermissionsResult(
|
||||||
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
int requestCode, String[] permissions, int[] grantResults) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
if (grantResults.length == 0) {
|
if (grantResults.length == 0) {
|
||||||
// Empty results are triggered if a permission is requested while another request was already
|
// 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.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatDialog;
|
import androidx.appcompat.app.AppCompatDialog;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
@ -213,7 +212,6 @@ public final class TrackSelectionDialog extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
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
|
// 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
|
// 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
|
@Override
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
super.onDismiss(dialog);
|
super.onDismiss(dialog);
|
||||||
onDismissListener.onDismiss(dialog);
|
onDismissListener.onDismiss(dialog);
|
||||||
}
|
}
|
||||||
@ -290,7 +288,6 @@ public final class TrackSelectionDialog extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
return tabFragments.valueAt(position);
|
return tabFragments.valueAt(position);
|
||||||
}
|
}
|
||||||
@ -364,8 +361,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrackSelectionChanged(
|
public void onTrackSelectionChanged(boolean isDisabled, List<SelectionOverride> overrides) {
|
||||||
boolean isDisabled, @NonNull List<SelectionOverride> overrides) {
|
|
||||||
this.isDisabled = isDisabled;
|
this.isDisabled = isDisabled;
|
||||||
this.overrides = overrides;
|
this.overrides = overrides;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import androidx.media3.common.C;
|
|||||||
import androidx.media3.common.FlagSet;
|
import androidx.media3.common.FlagSet;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
import javax.annotation.Nonnull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A set of listeners.
|
* A set of listeners.
|
||||||
@ -37,7 +37,7 @@ import javax.annotation.Nonnull;
|
|||||||
* @param <T> The listener type.
|
* @param <T> The listener type.
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class ListenerSet<T> {
|
public final class ListenerSet<T extends @NonNull Object> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event sent to a listener.
|
* An event sent to a listener.
|
||||||
@ -234,15 +234,15 @@ public final class ListenerSet<T> {
|
|||||||
return true;
|
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 FlagSet.Builder flagsBuilder;
|
||||||
private boolean needsIterationFinishedEvent;
|
private boolean needsIterationFinishedEvent;
|
||||||
private boolean released;
|
private boolean released;
|
||||||
|
|
||||||
public ListenerHolder(@Nonnull T listener) {
|
public ListenerHolder(T listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.flagsBuilder = new FlagSet.Builder();
|
this.flagsBuilder = new FlagSet.Builder();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import android.os.Handler;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.media3.common.AudioAttributes;
|
import androidx.media3.common.AudioAttributes;
|
||||||
@ -1838,7 +1837,7 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTearDown(@NonNull AudioTrack track) {
|
public void onTearDown(AudioTrack track) {
|
||||||
Assertions.checkState(track == audioTrack);
|
Assertions.checkState(track == audioTrack);
|
||||||
if (listener != null && playing) {
|
if (listener != null && playing) {
|
||||||
// The audio track was destroyed while in use. Thus a new AudioTrack needs to be
|
// 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.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import androidx.annotation.GuardedBy;
|
import androidx.annotation.GuardedBy;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -207,15 +206,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
// Called from the callback thread.
|
// Called from the callback thread.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInputBufferAvailable(@NonNull MediaCodec codec, int index) {
|
public void onInputBufferAvailable(MediaCodec codec, int index) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
availableInputBuffers.add(index);
|
availableInputBuffers.add(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOutputBufferAvailable(
|
public void onOutputBufferAvailable(MediaCodec codec, int index, MediaCodec.BufferInfo info) {
|
||||||
@NonNull MediaCodec codec, int index, @NonNull MediaCodec.BufferInfo info) {
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (pendingOutputFormat != null) {
|
if (pendingOutputFormat != null) {
|
||||||
addOutputFormat(pendingOutputFormat);
|
addOutputFormat(pendingOutputFormat);
|
||||||
@ -227,14 +225,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull MediaCodec codec, @NonNull MediaCodec.CodecException e) {
|
public void onError(MediaCodec codec, MediaCodec.CodecException e) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
mediaCodecException = e;
|
mediaCodecException = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOutputFormatChanged(@NonNull MediaCodec codec, @NonNull MediaFormat format) {
|
public void onOutputFormatChanged(MediaCodec codec, MediaFormat format) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
addOutputFormat(format);
|
addOutputFormat(format);
|
||||||
pendingOutputFormat = null;
|
pendingOutputFormat = null;
|
||||||
|
@ -31,7 +31,6 @@ import android.media.MediaParser;
|
|||||||
import android.media.MediaParser.OutputConsumer;
|
import android.media.MediaParser.OutputConsumer;
|
||||||
import android.media.MediaParser.SeekPoint;
|
import android.media.MediaParser.SeekPoint;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.media3.common.FileTypes;
|
import androidx.media3.common.FileTypes;
|
||||||
@ -264,7 +263,7 @@ public final class MediaParserHlsMediaChunkExtractor implements HlsMediaChunkExt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
int peekedBytes = extractorInput.peek(buffer, offset, readLength);
|
||||||
totalPeekedBytes += peekedBytes;
|
totalPeekedBytes += peekedBytes;
|
||||||
return peekedBytes;
|
return peekedBytes;
|
||||||
|
@ -19,7 +19,6 @@ import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
|||||||
import static androidx.media3.common.util.Util.postOrRun;
|
import static androidx.media3.common.util.Util.postOrRun;
|
||||||
|
|
||||||
import androidx.annotation.GuardedBy;
|
import androidx.annotation.GuardedBy;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.collection.ArrayMap;
|
import androidx.collection.ArrayMap;
|
||||||
import androidx.media3.common.Player;
|
import androidx.media3.common.Player;
|
||||||
@ -27,6 +26,7 @@ import androidx.media3.session.MediaSession.ControllerInfo;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager that holds {@link ControllerInfo} of connected {@link MediaController controllers}.
|
* Manager that holds {@link ControllerInfo} of connected {@link MediaController controllers}.
|
||||||
@ -37,7 +37,7 @@ import java.util.Deque;
|
|||||||
*
|
*
|
||||||
* <p>This class is thread-safe.
|
* <p>This class is thread-safe.
|
||||||
*/
|
*/
|
||||||
/* package */ final class ConnectedControllersManager<T> {
|
/* package */ final class ConnectedControllersManager<T extends @NonNull Object> {
|
||||||
|
|
||||||
private final Object lock;
|
private final Object lock;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ import java.util.Deque;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addController(
|
public void addController(
|
||||||
@NonNull T controllerKey,
|
T controllerKey,
|
||||||
ControllerInfo controllerInfo,
|
ControllerInfo controllerInfo,
|
||||||
SessionCommands sessionCommands,
|
SessionCommands sessionCommands,
|
||||||
Player.Commands playerCommands) {
|
Player.Commands playerCommands) {
|
||||||
@ -104,7 +104,7 @@ import java.util.Deque;
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeController(@NonNull T controllerKey) {
|
public void removeController(T controllerKey) {
|
||||||
@Nullable ControllerInfo controllerInfo = getController(controllerKey);
|
@Nullable ControllerInfo controllerInfo = getController(controllerKey);
|
||||||
if (controllerInfo != null) {
|
if (controllerInfo != null) {
|
||||||
removeController(controllerInfo);
|
removeController(controllerInfo);
|
||||||
@ -112,7 +112,7 @@ import java.util.Deque;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeController(ControllerInfo controllerInfo) {
|
public void removeController(ControllerInfo controllerInfo) {
|
||||||
@Nullable ConnectedControllerRecord<T> record;
|
@Nullable /*Type*/ ConnectedControllerRecord<T> record;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
record = controllerRecords.remove(controllerInfo);
|
record = controllerRecords.remove(controllerInfo);
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
@ -168,7 +168,7 @@ import java.util.Deque;
|
|||||||
* disconnected.
|
* disconnected.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public SequencedFutureManager getSequencedFutureManager(@NonNull T controllerKey) {
|
public SequencedFutureManager getSequencedFutureManager(T controllerKey) {
|
||||||
@Nullable ConnectedControllerRecord<T> info;
|
@Nullable ConnectedControllerRecord<T> info;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
@Nullable ControllerInfo controllerInfo = getController(controllerKey);
|
@Nullable ControllerInfo controllerInfo = getController(controllerKey);
|
||||||
@ -206,7 +206,7 @@ import java.util.Deque;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ControllerInfo getController(@NonNull T controllerKey) {
|
public ControllerInfo getController(T controllerKey) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
return controllerInfoMap.get(controllerKey);
|
return controllerInfoMap.get(controllerKey);
|
||||||
}
|
}
|
||||||
@ -236,14 +236,14 @@ import java.util.Deque;
|
|||||||
|
|
||||||
private static final class ConnectedControllerRecord<T> {
|
private static final class ConnectedControllerRecord<T> {
|
||||||
|
|
||||||
@NonNull public final T controllerKey;
|
public final T controllerKey;
|
||||||
public final SequencedFutureManager sequencedFutureManager;
|
public final SequencedFutureManager sequencedFutureManager;
|
||||||
public SessionCommands sessionCommands;
|
public SessionCommands sessionCommands;
|
||||||
public Player.Commands playerCommands;
|
public Player.Commands playerCommands;
|
||||||
public Deque<Runnable> commandQueue;
|
public Deque<Runnable> commandQueue;
|
||||||
|
|
||||||
public ConnectedControllerRecord(
|
public ConnectedControllerRecord(
|
||||||
@NonNull T controllerKey,
|
T controllerKey,
|
||||||
SequencedFutureManager sequencedFutureManager,
|
SequencedFutureManager sequencedFutureManager,
|
||||||
SessionCommands sessionCommands,
|
SessionCommands sessionCommands,
|
||||||
Player.Commands playerCommands) {
|
Player.Commands playerCommands) {
|
||||||
|
@ -22,7 +22,6 @@ import android.os.ConditionVariable;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.HandlerWrapper;
|
import androidx.media3.common.util.HandlerWrapper;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
@ -398,7 +397,7 @@ public final class FakeClockTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(@NonNull Message msg) {
|
public boolean handleMessage(Message msg) {
|
||||||
messages.add(new MessageData(msg.what, msg.arg1, msg.arg2, msg.obj));
|
messages.add(new MessageData(msg.what, msg.arg1, msg.arg2, msg.obj));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user