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