Suppress lint errors RestrictedApis
in lib-media2
PiperOrigin-RevId: 454939082 (cherry picked from commit d1fbef810699688fdfb832ba0bde7282df3d3260)
This commit is contained in:
parent
fd1fb96aa0
commit
ff582ec2a1
@ -19,6 +19,7 @@ import static com.google.android.exoplayer2.util.Util.postOrRun;
|
||||
import static java.lang.annotation.ElementType.TYPE_USE;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Handler;
|
||||
import androidx.annotation.GuardedBy;
|
||||
import androidx.annotation.IntDef;
|
||||
@ -155,6 +156,7 @@ import java.util.concurrent.Callable;
|
||||
pendingPlayerCommandQueue = new ArrayDeque<>();
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void reset() {
|
||||
handler.removeCallbacksAndMessages(/* token= */ null);
|
||||
List<PlayerCommand> queue;
|
||||
@ -173,6 +175,7 @@ import java.util.concurrent.Callable;
|
||||
return addCommand(commandCode, command, /* tag= */ null);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public ListenableFuture<PlayerResult> addCommand(
|
||||
@CommandCode int commandCode, Callable<Boolean> command, @Nullable Object tag) {
|
||||
SettableFuture<PlayerResult> result = SettableFuture.create();
|
||||
@ -210,6 +213,7 @@ import java.util.concurrent.Callable;
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void notifyCommandError() {
|
||||
postOrRun(
|
||||
handler,
|
||||
@ -231,6 +235,7 @@ import java.util.concurrent.Callable;
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void notifyCommandCompleted(@AsyncCommandCode int completedCommandCode) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "notifyCommandCompleted, completedCommandCode=" + completedCommandCode);
|
||||
@ -263,6 +268,7 @@ import java.util.concurrent.Callable;
|
||||
postOrRun(handler, this::processPendingCommandOnHandler);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
private void processPendingCommandOnHandler() {
|
||||
while (pendingAsyncPlayerCommandResult == null) {
|
||||
@Nullable PlayerCommand playerCommand;
|
||||
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.ext.media2;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media2.common.MediaItem;
|
||||
@ -135,6 +136,7 @@ import java.util.concurrent.TimeoutException;
|
||||
return mediaItemProvider.onCreateMediaItem(session, controller, mediaId);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public int onSetRating(
|
||||
MediaSession session, MediaSession.ControllerInfo controller, String mediaId, Rating rating) {
|
||||
@ -144,6 +146,7 @@ import java.util.concurrent.TimeoutException;
|
||||
return SessionResult.RESULT_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public SessionResult onCustomCommand(
|
||||
MediaSession session,
|
||||
@ -156,6 +159,7 @@ import java.util.concurrent.TimeoutException;
|
||||
return new SessionResult(SessionResult.RESULT_ERROR_NOT_SUPPORTED, null);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public int onFastForward(MediaSession session, MediaSession.ControllerInfo controller) {
|
||||
if (fastForwardMs > 0) {
|
||||
@ -164,6 +168,7 @@ import java.util.concurrent.TimeoutException;
|
||||
return SessionResult.RESULT_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public int onRewind(MediaSession session, MediaSession.ControllerInfo controller) {
|
||||
if (rewindMs > 0) {
|
||||
@ -172,6 +177,7 @@ import java.util.concurrent.TimeoutException;
|
||||
return SessionResult.RESULT_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public int onSkipBackward(MediaSession session, MediaSession.ControllerInfo controller) {
|
||||
if (skipCallback != null) {
|
||||
@ -180,6 +186,7 @@ import java.util.concurrent.TimeoutException;
|
||||
return SessionResult.RESULT_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public int onSkipForward(MediaSession session, MediaSession.ControllerInfo controller) {
|
||||
if (skipCallback != null) {
|
||||
@ -188,6 +195,7 @@ import java.util.concurrent.TimeoutException;
|
||||
return SessionResult.RESULT_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
private int seekToOffset(long offsetMs) {
|
||||
long positionMs = sessionPlayer.getCurrentPosition() + offsetMs;
|
||||
long durationMs = sessionPlayer.getDuration();
|
||||
|
Loading…
x
Reference in New Issue
Block a user