Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d1fbef81
authored
Jun 14, 2022
by
bachinger
Committed by
Marc Baechinger
Jun 15, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Suppress lint errors `RestrictedApis` in lib-media2
PiperOrigin-RevId: 454939082
parent
6dc4b39c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SessionCallback.java
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java
View file @
d1fbef81
...
...
@@ -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
;
...
...
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SessionCallback.java
View file @
d1fbef81
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment