mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix lint errors
- Add required mutability flag to `ConnectionStateTest` to fix `Missing PendingIntent mutability flag`. - Suppress `WrongConstant` lint error caused by Kotlin's spread operator not propagating the `@IntDef` annotation. #cherrypick PiperOrigin-RevId: 707061163
This commit is contained in:
parent
601b025b3c
commit
4b26eb2800
@ -23,6 +23,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.media3.common.MediaLibraryInfo;
|
||||
import androidx.media3.common.Player;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.test.utils.TestExoPlayerBuilder;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
@ -49,7 +50,10 @@ public class ConnectionStateTest {
|
||||
MediaSessionStub.VERSION_INT,
|
||||
new MediaSessionStub(session.getImpl()),
|
||||
/* sessionActivity= */ PendingIntent.getActivity(
|
||||
context, /* requestCode= */ 0, new Intent(), /* flags= */ 0),
|
||||
context,
|
||||
/* requestCode= */ 0,
|
||||
new Intent(),
|
||||
/* flags= */ Util.SDK_INT >= 23 ? PendingIntent.FLAG_IMMUTABLE : 0),
|
||||
/* customLayout= */ ImmutableList.of(
|
||||
new CommandButton.Builder(CommandButton.ICON_ARTIST)
|
||||
.setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT)
|
||||
|
@ -116,6 +116,9 @@ internal class TestPlayer : SimpleBasePlayer(Looper.myLooper()!!) {
|
||||
}
|
||||
|
||||
fun addCommands(vararg commands: @Player.Command Int) {
|
||||
// It doesn't seem possible to propagate the @IntDef annotation through Kotlin's spread operator
|
||||
// in a way that lint understands.
|
||||
@SuppressWarnings("WrongConstant")
|
||||
state =
|
||||
state
|
||||
.buildUpon()
|
||||
|
Loading…
x
Reference in New Issue
Block a user