From dfd2b75720746e697231a2364f9176c5570dcf55 Mon Sep 17 00:00:00 2001 From: tonihei Date: Fri, 14 Feb 2025 01:22:56 -0800 Subject: [PATCH] Stablize command button icons These are the preferred replacement for custom icon res ids. PiperOrigin-RevId: 726821168 --- api.txt | 84 ++++++++- .../DemoMediaLibrarySessionCallback.kt | 1 - .../media3/session/CommandButton.java | 173 +++++++++--------- .../media3/session/CommandButtonTest.java | 54 +++--- .../DefaultMediaNotificationProviderTest.java | 56 +++--- .../session/MediaSessionServiceTest.java | 20 +- ...enerWithMediaBrowserServiceCompatTest.java | 6 +- ...lerCompatCallbackWithMediaSessionTest.java | 4 +- .../session/MediaControllerListenerTest.java | 4 +- ...lerListenerWithMediaSessionCompatTest.java | 8 +- .../media3/session/MediaControllerTest.java | 137 +++++++------- .../session/MediaSessionServiceTest.java | 12 +- 12 files changed, 316 insertions(+), 243 deletions(-) diff --git a/api.txt b/api.txt index e0d778c575..5b21cb5cde 100644 --- a/api.txt +++ b/api.txt @@ -1488,7 +1488,82 @@ package androidx.media3.exoplayer.util { package androidx.media3.session { public final class CommandButton { + field public static final int ICON_ALBUM = 57369; // 0xe019 + field public static final int ICON_ARTIST = 57370; // 0xe01a + field public static final int ICON_BLOCK = 57675; // 0xe14b + field public static final int ICON_BOOKMARK_FILLED = 1042534; // 0xfe866 + field public static final int ICON_BOOKMARK_UNFILLED = 59494; // 0xe866 + field public static final int ICON_CHECK_CIRCLE_FILLED = 1042540; // 0xfe86c + field public static final int ICON_CHECK_CIRCLE_UNFILLED = 59500; // 0xe86c + field public static final int ICON_CLOSED_CAPTIONS = 57372; // 0xe01c + field public static final int ICON_CLOSED_CAPTIONS_OFF = 61916; // 0xf1dc + field public static final int ICON_FAST_FORWARD = 57375; // 0xe01f + field public static final int ICON_FEED = 57573; // 0xe0e5 + field public static final int ICON_FLAG_FILLED = 1040723; // 0xfe153 + field public static final int ICON_FLAG_UNFILLED = 57683; // 0xe153 + field public static final int ICON_HEART_FILLED = 1042557; // 0xfe87d + field public static final int ICON_HEART_UNFILLED = 59517; // 0xe87d + field public static final int ICON_MINUS = 57691; // 0xe15b + field public static final int ICON_MINUS_CIRCLE_FILLED = 1040712; // 0xfe148 + field public static final int ICON_MINUS_CIRCLE_UNFILLED = 1040713; // 0xfe149 + field public static final int ICON_NEXT = 57412; // 0xe044 + field public static final int ICON_PAUSE = 57396; // 0xe034 + field public static final int ICON_PLAY = 57399; // 0xe037 + field public static final int ICON_PLAYBACK_SPEED = 57448; // 0xe068 + field public static final int ICON_PLAYBACK_SPEED_0_5 = 62690; // 0xf4e2 + field public static final int ICON_PLAYBACK_SPEED_0_8 = 1045730; // 0xff4e2 + field public static final int ICON_PLAYBACK_SPEED_1_0 = 61389; // 0xefcd + field public static final int ICON_PLAYBACK_SPEED_1_2 = 62689; // 0xf4e1 + field public static final int ICON_PLAYBACK_SPEED_1_5 = 62688; // 0xf4e0 + field public static final int ICON_PLAYBACK_SPEED_1_8 = 1045728; // 0xff4e0 + field public static final int ICON_PLAYBACK_SPEED_2_0 = 62699; // 0xf4eb + field public static final int ICON_PLAYLIST_ADD = 57403; // 0xe03b + field public static final int ICON_PLAYLIST_REMOVE = 60288; // 0xeb80 + field public static final int ICON_PLUS = 57669; // 0xe145 + field public static final int ICON_PLUS_CIRCLE_FILLED = 1040711; // 0xfe147 + field public static final int ICON_PLUS_CIRCLE_UNFILLED = 57671; // 0xe147 + field public static final int ICON_PREVIOUS = 57413; // 0xe045 + field public static final int ICON_QUALITY = 58409; // 0xe429 + field public static final int ICON_QUEUE_ADD = 57436; // 0xe05c + field public static final int ICON_QUEUE_NEXT = 57446; // 0xe066 + field public static final int ICON_QUEUE_REMOVE = 57447; // 0xe067 + field public static final int ICON_RADIO = 58654; // 0xe51e + field public static final int ICON_REPEAT_ALL = 57408; // 0xe040 + field public static final int ICON_REPEAT_OFF = 1040448; // 0xfe040 + field public static final int ICON_REPEAT_ONE = 57409; // 0xe041 + field public static final int ICON_REWIND = 57376; // 0xe020 + field public static final int ICON_SETTINGS = 59576; // 0xe8b8 + field public static final int ICON_SHARE = 59405; // 0xe80d + field public static final int ICON_SHUFFLE_OFF = 1040452; // 0xfe044 + field public static final int ICON_SHUFFLE_ON = 57411; // 0xe043 + field public static final int ICON_SHUFFLE_STAR = 1040451; // 0xfe043 + field public static final int ICON_SIGNAL = 61512; // 0xf048 + field public static final int ICON_SKIP_BACK = 57410; // 0xe042 + field public static final int ICON_SKIP_BACK_10 = 57433; // 0xe059 + field public static final int ICON_SKIP_BACK_15 = 1040473; // 0xfe059 + field public static final int ICON_SKIP_BACK_30 = 57434; // 0xe05a + field public static final int ICON_SKIP_BACK_5 = 57435; // 0xe05b + field public static final int ICON_SKIP_FORWARD = 63220; // 0xf6f4 + field public static final int ICON_SKIP_FORWARD_10 = 57430; // 0xe056 + field public static final int ICON_SKIP_FORWARD_15 = 1040470; // 0xfe056 + field public static final int ICON_SKIP_FORWARD_30 = 57431; // 0xe057 + field public static final int ICON_SKIP_FORWARD_5 = 57432; // 0xe058 + field public static final int ICON_STAR_FILLED = 1042488; // 0xfe838 + field public static final int ICON_STAR_UNFILLED = 59448; // 0xe838 + field public static final int ICON_STOP = 57415; // 0xe047 + field public static final int ICON_SUBTITLES = 57416; // 0xe048 + field public static final int ICON_SUBTITLES_OFF = 61298; // 0xef72 + field public static final int ICON_SYNC = 58919; // 0xe627 + field public static final int ICON_THUMB_DOWN_FILLED = 1042651; // 0xfe8db + field public static final int ICON_THUMB_DOWN_UNFILLED = 59611; // 0xe8db + field public static final int ICON_THUMB_UP_FILLED = 1042652; // 0xfe8dc + field public static final int ICON_THUMB_UP_UNFILLED = 59612; // 0xe8dc + field public static final int ICON_UNDEFINED = 0; // 0x0 + field public static final int ICON_VOLUME_DOWN = 57421; // 0xe04d + field public static final int ICON_VOLUME_OFF = 57423; // 0xe04f + field public static final int ICON_VOLUME_UP = 57424; // 0xe050 field public final CharSequence displayName; + field @androidx.media3.session.CommandButton.Icon public final int icon; field @DrawableRes public final int iconResId; field public final boolean isEnabled; field @androidx.media3.common.Player.Command public final int playerCommand; @@ -1496,16 +1571,21 @@ package androidx.media3.session { } public static final class CommandButton.Builder { - ctor public CommandButton.Builder(); + ctor @Deprecated public CommandButton.Builder(); + ctor public CommandButton.Builder(@androidx.media3.session.CommandButton.Icon int); method public androidx.media3.session.CommandButton build(); + method public androidx.media3.session.CommandButton.Builder setCustomIconResId(@DrawableRes int); method public androidx.media3.session.CommandButton.Builder setDisplayName(CharSequence); method public androidx.media3.session.CommandButton.Builder setEnabled(boolean); method public androidx.media3.session.CommandButton.Builder setExtras(android.os.Bundle); - method public androidx.media3.session.CommandButton.Builder setIconResId(@DrawableRes int); + method @Deprecated public androidx.media3.session.CommandButton.Builder setIconResId(@DrawableRes int); method public androidx.media3.session.CommandButton.Builder setPlayerCommand(@androidx.media3.common.Player.Command int); method public androidx.media3.session.CommandButton.Builder setSessionCommand(androidx.media3.session.SessionCommand); } + @IntDef({androidx.media3.session.CommandButton.ICON_UNDEFINED, androidx.media3.session.CommandButton.ICON_PLAY, androidx.media3.session.CommandButton.ICON_PAUSE, androidx.media3.session.CommandButton.ICON_STOP, androidx.media3.session.CommandButton.ICON_NEXT, androidx.media3.session.CommandButton.ICON_PREVIOUS, androidx.media3.session.CommandButton.ICON_SKIP_FORWARD, androidx.media3.session.CommandButton.ICON_SKIP_FORWARD_5, androidx.media3.session.CommandButton.ICON_SKIP_FORWARD_10, androidx.media3.session.CommandButton.ICON_SKIP_FORWARD_15, androidx.media3.session.CommandButton.ICON_SKIP_FORWARD_30, androidx.media3.session.CommandButton.ICON_SKIP_BACK, androidx.media3.session.CommandButton.ICON_SKIP_BACK_5, androidx.media3.session.CommandButton.ICON_SKIP_BACK_10, androidx.media3.session.CommandButton.ICON_SKIP_BACK_15, androidx.media3.session.CommandButton.ICON_SKIP_BACK_30, androidx.media3.session.CommandButton.ICON_FAST_FORWARD, androidx.media3.session.CommandButton.ICON_REWIND, androidx.media3.session.CommandButton.ICON_REPEAT_ALL, androidx.media3.session.CommandButton.ICON_REPEAT_ONE, androidx.media3.session.CommandButton.ICON_REPEAT_OFF, androidx.media3.session.CommandButton.ICON_SHUFFLE_ON, androidx.media3.session.CommandButton.ICON_SHUFFLE_OFF, androidx.media3.session.CommandButton.ICON_SHUFFLE_STAR, androidx.media3.session.CommandButton.ICON_HEART_FILLED, androidx.media3.session.CommandButton.ICON_HEART_UNFILLED, androidx.media3.session.CommandButton.ICON_STAR_FILLED, androidx.media3.session.CommandButton.ICON_STAR_UNFILLED, androidx.media3.session.CommandButton.ICON_BOOKMARK_FILLED, androidx.media3.session.CommandButton.ICON_BOOKMARK_UNFILLED, androidx.media3.session.CommandButton.ICON_THUMB_UP_FILLED, androidx.media3.session.CommandButton.ICON_THUMB_UP_UNFILLED, androidx.media3.session.CommandButton.ICON_THUMB_DOWN_FILLED, androidx.media3.session.CommandButton.ICON_THUMB_DOWN_UNFILLED, androidx.media3.session.CommandButton.ICON_FLAG_FILLED, androidx.media3.session.CommandButton.ICON_FLAG_UNFILLED, androidx.media3.session.CommandButton.ICON_PLUS, androidx.media3.session.CommandButton.ICON_MINUS, androidx.media3.session.CommandButton.ICON_PLAYLIST_ADD, androidx.media3.session.CommandButton.ICON_PLAYLIST_REMOVE, androidx.media3.session.CommandButton.ICON_QUEUE_ADD, androidx.media3.session.CommandButton.ICON_QUEUE_NEXT, androidx.media3.session.CommandButton.ICON_QUEUE_REMOVE, androidx.media3.session.CommandButton.ICON_BLOCK, androidx.media3.session.CommandButton.ICON_PLUS_CIRCLE_FILLED, androidx.media3.session.CommandButton.ICON_PLUS_CIRCLE_UNFILLED, androidx.media3.session.CommandButton.ICON_MINUS_CIRCLE_FILLED, androidx.media3.session.CommandButton.ICON_MINUS_CIRCLE_UNFILLED, androidx.media3.session.CommandButton.ICON_CHECK_CIRCLE_FILLED, androidx.media3.session.CommandButton.ICON_CHECK_CIRCLE_UNFILLED, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED_0_5, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED_0_8, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED_1_0, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED_1_2, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED_1_5, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED_1_8, androidx.media3.session.CommandButton.ICON_PLAYBACK_SPEED_2_0, androidx.media3.session.CommandButton.ICON_SETTINGS, androidx.media3.session.CommandButton.ICON_QUALITY, androidx.media3.session.CommandButton.ICON_SUBTITLES, androidx.media3.session.CommandButton.ICON_SUBTITLES_OFF, androidx.media3.session.CommandButton.ICON_CLOSED_CAPTIONS, androidx.media3.session.CommandButton.ICON_CLOSED_CAPTIONS_OFF, androidx.media3.session.CommandButton.ICON_SYNC, androidx.media3.session.CommandButton.ICON_SHARE, androidx.media3.session.CommandButton.ICON_VOLUME_UP, androidx.media3.session.CommandButton.ICON_VOLUME_DOWN, androidx.media3.session.CommandButton.ICON_VOLUME_OFF, androidx.media3.session.CommandButton.ICON_ARTIST, androidx.media3.session.CommandButton.ICON_ALBUM, androidx.media3.session.CommandButton.ICON_RADIO, androidx.media3.session.CommandButton.ICON_SIGNAL, androidx.media3.session.CommandButton.ICON_FEED}) @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE) public static @interface CommandButton.Icon { + } + public final class LibraryResult { method public static androidx.media3.session.LibraryResult ofError(@androidx.media3.session.LibraryResult.Code int); method public static androidx.media3.session.LibraryResult ofError(@androidx.media3.session.LibraryResult.Code int, @Nullable androidx.media3.session.MediaLibraryService.LibraryParams); diff --git a/demos/session_service/src/main/java/androidx/media3/demo/session/DemoMediaLibrarySessionCallback.kt b/demos/session_service/src/main/java/androidx/media3/demo/session/DemoMediaLibrarySessionCallback.kt index 5a4ce667db..db86eed049 100644 --- a/demos/session_service/src/main/java/androidx/media3/demo/session/DemoMediaLibrarySessionCallback.kt +++ b/demos/session_service/src/main/java/androidx/media3/demo/session/DemoMediaLibrarySessionCallback.kt @@ -41,7 +41,6 @@ open class DemoMediaLibrarySessionCallback(context: Context) : MediaItemTree.initialize(context.assets) } - @OptIn(UnstableApi::class) // TODO: b/328238954 - Remove once new CommandButton icons are stable. private val commandButtons: List = listOf( CommandButton.Builder(CommandButton.ICON_SHUFFLE_OFF) diff --git a/libraries/session/src/main/java/androidx/media3/session/CommandButton.java b/libraries/session/src/main/java/androidx/media3/session/CommandButton.java index 14a946eed7..210bd99275 100644 --- a/libraries/session/src/main/java/androidx/media3/session/CommandButton.java +++ b/libraries/session/src/main/java/androidx/media3/session/CommandButton.java @@ -56,10 +56,7 @@ import java.util.List; */ public final class CommandButton { - // TODO: b/328238954 - Stabilize these constants and the corresponding methods, and deprecate the - // methods that do not use these constants. /** An icon constant for a button. Must be one of the {@code CommandButton.ICON_} constants. */ - @UnstableApi @Documented @Retention(RetentionPolicy.SOURCE) @Target(TYPE_USE) @@ -147,276 +144,276 @@ public final class CommandButton { * An icon constant representing an undefined icon, for example a custom icon not covered by the * existing constants. */ - @UnstableApi public static final int ICON_UNDEFINED = 0; + public static final int ICON_UNDEFINED = 0; /** An icon showing a play symbol (a right facing triangle). */ - @UnstableApi public static final int ICON_PLAY = 0xe037; + public static final int ICON_PLAY = 0xe037; /** An icon showing a pause symbol (two vertical bars). */ - @UnstableApi public static final int ICON_PAUSE = 0xe034; + public static final int ICON_PAUSE = 0xe034; /** An icon showing a stop symbol (a square). */ - @UnstableApi public static final int ICON_STOP = 0xe047; + public static final int ICON_STOP = 0xe047; /** An icon showing a next symbol (a right facing triangle with a vertical bar). */ - @UnstableApi public static final int ICON_NEXT = 0xe044; + public static final int ICON_NEXT = 0xe044; /** An icon showing a previous symbol (a left facing triangle with a vertical bar). */ - @UnstableApi public static final int ICON_PREVIOUS = 0xe045; + public static final int ICON_PREVIOUS = 0xe045; /** An icon showing a skip forward symbol (an open clock-wise arrow). */ - @UnstableApi public static final int ICON_SKIP_FORWARD = 0xf6f4; + public static final int ICON_SKIP_FORWARD = 0xf6f4; /** * An icon showing a skip forward 5 seconds symbol (an open clockwise arrow with the number 5). */ - @UnstableApi public static final int ICON_SKIP_FORWARD_5 = 0xe058; + public static final int ICON_SKIP_FORWARD_5 = 0xe058; /** * An icon showing a skip forward 10 seconds symbol (an open clockwise arrow with the number 10). */ - @UnstableApi public static final int ICON_SKIP_FORWARD_10 = 0xe056; + public static final int ICON_SKIP_FORWARD_10 = 0xe056; /** * An icon showing a skip forward 15 seconds symbol (an open clockwise arrow with the number 15). */ - @UnstableApi public static final int ICON_SKIP_FORWARD_15 = 0xfe056; + public static final int ICON_SKIP_FORWARD_15 = 0xfe056; /** * An icon showing a skip forward 30 seconds symbol (an open clockwise arrow with the number 30). */ - @UnstableApi public static final int ICON_SKIP_FORWARD_30 = 0xe057; + public static final int ICON_SKIP_FORWARD_30 = 0xe057; /** An icon showing a skip back symbol (an open anti-clockwise arrow). */ - @UnstableApi public static final int ICON_SKIP_BACK = 0xe042; + public static final int ICON_SKIP_BACK = 0xe042; /** * An icon showing a skip back 5 seconds symbol (an open anti-clockwise arrow with the number 5). */ - @UnstableApi public static final int ICON_SKIP_BACK_5 = 0xe05b; + public static final int ICON_SKIP_BACK_5 = 0xe05b; /** * An icon showing a skip back 10 seconds symbol (an open anti-clockwise arrow with the number * 10). */ - @UnstableApi public static final int ICON_SKIP_BACK_10 = 0xe059; + public static final int ICON_SKIP_BACK_10 = 0xe059; /** * An icon showing a skip back 15 seconds symbol (an open anti-clockwise arrow with the number * 15). */ - @UnstableApi public static final int ICON_SKIP_BACK_15 = 0xfe059; + public static final int ICON_SKIP_BACK_15 = 0xfe059; /** * An icon showing a skip back 30 seconds symbol (an open anti-clockwise arrow with the number * 30). */ - @UnstableApi public static final int ICON_SKIP_BACK_30 = 0xe05a; + public static final int ICON_SKIP_BACK_30 = 0xe05a; /** An icon showing a fast forward symbol (two right facing triangles). */ - @UnstableApi public static final int ICON_FAST_FORWARD = 0xe01f; + public static final int ICON_FAST_FORWARD = 0xe01f; /** An icon showing a rewind symbol (two left facing triangles). */ - @UnstableApi public static final int ICON_REWIND = 0xe020; + public static final int ICON_REWIND = 0xe020; /** An icon showing a repeat all symbol (two open clockwise arrows). */ - @UnstableApi public static final int ICON_REPEAT_ALL = 0xe040; + public static final int ICON_REPEAT_ALL = 0xe040; /** An icon showing a repeat one symbol (two open clockwise arrows with an overlaid number 1). */ - @UnstableApi public static final int ICON_REPEAT_ONE = 0xe041; + public static final int ICON_REPEAT_ONE = 0xe041; /** * An icon showing a disabled repeat symbol (two open clockwise arrows, in a color representing a * disabled state). */ - @UnstableApi public static final int ICON_REPEAT_OFF = 0xfe040; + public static final int ICON_REPEAT_OFF = 0xfe040; /** An icon showing a shuffle symbol (two diagonal upward and downward facing arrows). */ - @UnstableApi public static final int ICON_SHUFFLE_ON = 0xe043; + public static final int ICON_SHUFFLE_ON = 0xe043; /** * An icon showing a disabled shuffle symbol (two diagonal upward and downward facing arrows, in a * color representing a disabled state). */ - @UnstableApi public static final int ICON_SHUFFLE_OFF = 0xfe044; + public static final int ICON_SHUFFLE_OFF = 0xfe044; /** * An icon showing a shuffle symbol with a start (two diagonal upward and downward facing arrows * with an overlaid star). */ - @UnstableApi public static final int ICON_SHUFFLE_STAR = 0xfe043; + public static final int ICON_SHUFFLE_STAR = 0xfe043; /** An icon showing a filled heart symbol. */ - @UnstableApi public static final int ICON_HEART_FILLED = 0xfe87d; + public static final int ICON_HEART_FILLED = 0xfe87d; /** An icon showing an unfilled heart symbol. */ - @UnstableApi public static final int ICON_HEART_UNFILLED = 0xe87d; + public static final int ICON_HEART_UNFILLED = 0xe87d; /** An icon showing a filled star symbol. */ - @UnstableApi public static final int ICON_STAR_FILLED = 0xfe838; + public static final int ICON_STAR_FILLED = 0xfe838; /** An icon showing an unfilled star symbol. */ - @UnstableApi public static final int ICON_STAR_UNFILLED = 0xe838; + public static final int ICON_STAR_UNFILLED = 0xe838; /** An icon showing a filled bookmark symbol. */ - @UnstableApi public static final int ICON_BOOKMARK_FILLED = 0xfe866; + public static final int ICON_BOOKMARK_FILLED = 0xfe866; /** An icon showing an unfilled bookmark symbol. */ - @UnstableApi public static final int ICON_BOOKMARK_UNFILLED = 0xe866; + public static final int ICON_BOOKMARK_UNFILLED = 0xe866; /** An icon showing a filled thumb-up symbol. */ - @UnstableApi public static final int ICON_THUMB_UP_FILLED = 0xfe8dc; + public static final int ICON_THUMB_UP_FILLED = 0xfe8dc; /** An icon showing an unfilled thumb-up symbol. */ - @UnstableApi public static final int ICON_THUMB_UP_UNFILLED = 0xe8dc; + public static final int ICON_THUMB_UP_UNFILLED = 0xe8dc; /** An icon showing a filled thumb-down symbol. */ - @UnstableApi public static final int ICON_THUMB_DOWN_FILLED = 0xfe8db; + public static final int ICON_THUMB_DOWN_FILLED = 0xfe8db; /** An icon showing an unfilled thumb-down symbol. */ - @UnstableApi public static final int ICON_THUMB_DOWN_UNFILLED = 0xe8db; + public static final int ICON_THUMB_DOWN_UNFILLED = 0xe8db; /** An icon showing a filled flag symbol. */ - @UnstableApi public static final int ICON_FLAG_FILLED = 0xfe153; + public static final int ICON_FLAG_FILLED = 0xfe153; /** An icon showing an unfilled flag symbol. */ - @UnstableApi public static final int ICON_FLAG_UNFILLED = 0xe153; + public static final int ICON_FLAG_UNFILLED = 0xe153; /** An icon showing a plus symbol. */ - @UnstableApi public static final int ICON_PLUS = 0xe145; + public static final int ICON_PLUS = 0xe145; /** An icon showing a minus symbol. */ - @UnstableApi public static final int ICON_MINUS = 0xe15b; + public static final int ICON_MINUS = 0xe15b; /** An icon showing an add to playlist symbol (multiple horizontal bars with a small plus). */ - @UnstableApi public static final int ICON_PLAYLIST_ADD = 0xe03b; + public static final int ICON_PLAYLIST_ADD = 0xe03b; /** * An icon showing an remove from playlist symbol (multiple horizontal bars with a small minus). */ - @UnstableApi public static final int ICON_PLAYLIST_REMOVE = 0xeb80; + public static final int ICON_PLAYLIST_REMOVE = 0xeb80; /** An icon showing an add to queue symbol (a stylized TV with a plus). */ - @UnstableApi public static final int ICON_QUEUE_ADD = 0xe05c; + public static final int ICON_QUEUE_ADD = 0xe05c; /** * An icon showing a play next queue item symbol (a stylized TV with a plus and a right-facing * arrow). */ - @UnstableApi public static final int ICON_QUEUE_NEXT = 0xe066; + public static final int ICON_QUEUE_NEXT = 0xe066; /** An icon showing a remove from queue symbol (a stylized TV with a minus). */ - @UnstableApi public static final int ICON_QUEUE_REMOVE = 0xe067; + public static final int ICON_QUEUE_REMOVE = 0xe067; /** An icon showing a block symbol (a circle with a diagonal line). */ - @UnstableApi public static final int ICON_BLOCK = 0xe14b; + public static final int ICON_BLOCK = 0xe14b; /** An icon showing a filled circle with a plus. */ - @UnstableApi public static final int ICON_PLUS_CIRCLE_FILLED = 0xfe147; + public static final int ICON_PLUS_CIRCLE_FILLED = 0xfe147; /** An icon showing an unfilled circle with a plus. */ - @UnstableApi public static final int ICON_PLUS_CIRCLE_UNFILLED = 0xe147; + public static final int ICON_PLUS_CIRCLE_UNFILLED = 0xe147; /** An icon showing a filled circle with a minus. */ - @UnstableApi public static final int ICON_MINUS_CIRCLE_FILLED = 0xfe148; + public static final int ICON_MINUS_CIRCLE_FILLED = 0xfe148; /** An icon showing an unfilled circle with a minus. */ - @UnstableApi public static final int ICON_MINUS_CIRCLE_UNFILLED = 0xfe149; + public static final int ICON_MINUS_CIRCLE_UNFILLED = 0xfe149; /** An icon showing a filled circle with a check mark. */ - @UnstableApi public static final int ICON_CHECK_CIRCLE_FILLED = 0xfe86c; + public static final int ICON_CHECK_CIRCLE_FILLED = 0xfe86c; /** An icon showing a unfilled circle with a check mark. */ - @UnstableApi public static final int ICON_CHECK_CIRCLE_UNFILLED = 0xe86c; + public static final int ICON_CHECK_CIRCLE_UNFILLED = 0xe86c; /** * An icon showing a playback speed symbol (a right facing triangle in a circle with half-dashed, * half-solid contour). */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED = 0xe068; + public static final int ICON_PLAYBACK_SPEED = 0xe068; /** An icon showing a 0.5x speed symbol. */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED_0_5 = 0xf4e2; + public static final int ICON_PLAYBACK_SPEED_0_5 = 0xf4e2; /** An icon showing a 0.8x speed symbol. */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED_0_8 = 0xff4e2; + public static final int ICON_PLAYBACK_SPEED_0_8 = 0xff4e2; /** An icon showing a 1.0x speed symbol. */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED_1_0 = 0xefcd; + public static final int ICON_PLAYBACK_SPEED_1_0 = 0xefcd; /** An icon showing a 1.2x speed symbol. */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED_1_2 = 0xf4e1; + public static final int ICON_PLAYBACK_SPEED_1_2 = 0xf4e1; /** An icon showing a 1.5x speed symbol. */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED_1_5 = 0xf4e0; + public static final int ICON_PLAYBACK_SPEED_1_5 = 0xf4e0; /** An icon showing a 1.8x speed symbol. */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED_1_8 = 0xff4e0; + public static final int ICON_PLAYBACK_SPEED_1_8 = 0xff4e0; /** An icon showing a 2.0x speed symbol. */ - @UnstableApi public static final int ICON_PLAYBACK_SPEED_2_0 = 0xf4eb; + public static final int ICON_PLAYBACK_SPEED_2_0 = 0xf4eb; /** An icon showing a settings symbol (a stylized cog). */ - @UnstableApi public static final int ICON_SETTINGS = 0xe8b8; + public static final int ICON_SETTINGS = 0xe8b8; /** An icon showing a quality selection symbol (multiple horizontal bars with sliders). */ - @UnstableApi public static final int ICON_QUALITY = 0xe429; + public static final int ICON_QUALITY = 0xe429; /** An icon showing a subtitles symbol (a rectangle filled with dots and horizontal lines). */ - @UnstableApi public static final int ICON_SUBTITLES = 0xe048; + public static final int ICON_SUBTITLES = 0xe048; /** * An icon showing a subtitles off symbol (a rectangle filled with dots and horizontal lines, with * a large diagonal line across). */ - @UnstableApi public static final int ICON_SUBTITLES_OFF = 0xef72; + public static final int ICON_SUBTITLES_OFF = 0xef72; /** An icon showing a closed caption symbol (a rectangle with the letters CC). */ - @UnstableApi public static final int ICON_CLOSED_CAPTIONS = 0xe01c; + public static final int ICON_CLOSED_CAPTIONS = 0xe01c; /** * An icon showing a closed caption off symbol (a rectangle with the letters CC, with a large * diagonal line across). */ - @UnstableApi public static final int ICON_CLOSED_CAPTIONS_OFF = 0xf1dc; + public static final int ICON_CLOSED_CAPTIONS_OFF = 0xf1dc; /** An icon showing a sync symbol (two open anti-clockwise arrows). */ - @UnstableApi public static final int ICON_SYNC = 0xe627; + public static final int ICON_SYNC = 0xe627; /** * An icon showing a share symbol (three dots connected by two diagonal lines, open on the right). */ - @UnstableApi public static final int ICON_SHARE = 0xe80d; + public static final int ICON_SHARE = 0xe80d; /** An icon showing a volume up symbol (a stylized speaker with multiple sound waves). */ - @UnstableApi public static final int ICON_VOLUME_UP = 0xe050; + public static final int ICON_VOLUME_UP = 0xe050; /** An icon showing a volume down symbol (a stylized speaker with a single small sound wave). */ - @UnstableApi public static final int ICON_VOLUME_DOWN = 0xe04d; + public static final int ICON_VOLUME_DOWN = 0xe04d; /** * An icon showing a volume off symbol (a stylized speaker with multiple sound waves, with a large * diagonal line across). */ - @UnstableApi public static final int ICON_VOLUME_OFF = 0xe04f; + public static final int ICON_VOLUME_OFF = 0xe04f; /** An icon showing an artist symbol (a stylized person with a musical note). */ - @UnstableApi public static final int ICON_ARTIST = 0xe01a; + public static final int ICON_ARTIST = 0xe01a; /** An icon showing an album symbol (a stylized LP record). */ - @UnstableApi public static final int ICON_ALBUM = 0xe019; + public static final int ICON_ALBUM = 0xe019; /** An icon showing a radio symbol (left and right facing sound waves). */ - @UnstableApi public static final int ICON_RADIO = 0xe51e; + public static final int ICON_RADIO = 0xe51e; /** An icon showing an signal symbol (a vertical mast with circular sounds waves). */ - @UnstableApi public static final int ICON_SIGNAL = 0xf048; + public static final int ICON_SIGNAL = 0xf048; /** * An icon showing an feed symbol (a dot in the bottom-left with multiple concentric quarter * circles). */ - @UnstableApi public static final int ICON_FEED = 0xe0e5; + public static final int ICON_FEED = 0xe0e5; // TODO: b/332877990 - Stabilize these constants and other slot APIs /** @@ -482,10 +479,11 @@ public final class CommandButton { @Nullable private ImmutableIntArray slots; /** - * [will be deprecated] Use {@link #Builder(int)} instead to define the {@link Icon} for this - * button. A separate resource id via {@link #setIconResId(int)} is no longer required unless - * for {@link #ICON_UNDEFINED}. + * @deprecated Use {@link #Builder(int)} instead to define the {@link Icon} for this button. A + * separate resource id via {@link #setIconResId(int)} is no longer required unless for + * {@link #ICON_UNDEFINED}. */ + @Deprecated public Builder() { this(ICON_UNDEFINED); } @@ -495,7 +493,6 @@ public final class CommandButton { * * @param icon The {@link Icon} that should be shown for this button. */ - @UnstableApi public Builder(@Icon int icon) { this(icon, getIconResIdForIconConstant(icon)); } @@ -553,13 +550,12 @@ public final class CommandButton { } /** - * [will be deprecated] The icon should be defined with the constructor {@link Icon} parameter - * in {@link #Builder(int)} instead. - * - *

If the existing list of icons is not sufficient, use {@link #ICON_UNDEFINED} for the - * constructor {@link Icon} parameter, and set a separate resource id with {@link - * #setCustomIconResId}. + * @deprecated The icon should be defined with the constructor {@link Icon} parameter in {@link + * #Builder(int)} instead. If the existing list of icons is not sufficient, use {@link + * #ICON_UNDEFINED} for the constructor {@link Icon} parameter, and set a separate resource + * id with {@link #setCustomIconResId}. */ + @Deprecated @CanIgnoreReturnValue public Builder setIconResId(@DrawableRes int resId) { return setCustomIconResId(resId); @@ -574,7 +570,6 @@ public final class CommandButton { * @param resId The resource id of a custom icon. * @return This builder for chaining. */ - @UnstableApi @CanIgnoreReturnValue public Builder setCustomIconResId(@DrawableRes int resId) { iconResId = resId; @@ -1098,7 +1093,7 @@ public final class CommandButton { public final @Player.Command int playerCommand; /** The {@link Icon} of the button. */ - @UnstableApi public final @Icon int icon; + public final @Icon int icon; /** * The fallback icon resource ID of the button. diff --git a/libraries/session/src/test/java/androidx/media3/session/CommandButtonTest.java b/libraries/session/src/test/java/androidx/media3/session/CommandButtonTest.java index 094b8358e5..865865d2dd 100644 --- a/libraries/session/src/test/java/androidx/media3/session/CommandButtonTest.java +++ b/libraries/session/src/test/java/androidx/media3/session/CommandButtonTest.java @@ -39,7 +39,7 @@ public class CommandButtonTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .build(); Player.Commands availablePlayerCommands = @@ -61,7 +61,7 @@ public class CommandButtonTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command1) .build(); SessionCommands availableSessionCommands = @@ -82,14 +82,14 @@ public class CommandButtonTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .build(); SessionCommand command2 = new SessionCommand("command2", Bundle.EMPTY); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command2) .build(); SessionCommands availableSessionCommands = @@ -115,7 +115,7 @@ public class CommandButtonTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setIconUri(uri) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .build(); @@ -128,7 +128,7 @@ public class CommandButtonTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .build(); @@ -141,7 +141,7 @@ public class CommandButtonTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setIconUri(uri) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .build(); @@ -157,7 +157,7 @@ public class CommandButtonTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .build(); @@ -172,7 +172,7 @@ public class CommandButtonTest { assertThat( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setIconUri(Uri.parse("content://test")) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_FORWARD, CommandButton.SLOT_CENTRAL) @@ -180,7 +180,7 @@ public class CommandButtonTest { .isEqualTo( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setIconUri(Uri.parse("content://test")) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_FORWARD, CommandButton.SLOT_CENTRAL) @@ -192,7 +192,7 @@ public class CommandButtonTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_BACK) .build(); @@ -203,7 +203,7 @@ public class CommandButtonTest { .isNotEqualTo( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_BACK) .build()); @@ -212,13 +212,13 @@ public class CommandButtonTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSlots(CommandButton.SLOT_BACK) .build()); assertThat(button) .isNotEqualTo( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) - .setIconResId(R.drawable.media3_icon_play) + .setCustomIconResId(R.drawable.media3_icon_play) .setDisplayName("button") .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_BACK) @@ -228,7 +228,7 @@ public class CommandButtonTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setEnabled(false) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_BACK) .build()); @@ -237,14 +237,14 @@ public class CommandButtonTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSessionCommand(new SessionCommand(SessionCommand.COMMAND_CODE_LIBRARY_GET_ITEM)) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSlots(CommandButton.SLOT_BACK) .build()); assertThat(button) .isNotEqualTo( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setIconUri(Uri.parse("content://test")) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_BACK) @@ -253,7 +253,7 @@ public class CommandButtonTest { .isNotEqualTo( new CommandButton.Builder(CommandButton.ICON_NEXT) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_BACK) .build()); @@ -261,7 +261,7 @@ public class CommandButtonTest { .isNotEqualTo( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setSlots(CommandButton.SLOT_FORWARD) .build()); @@ -273,7 +273,7 @@ public class CommandButtonTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) - .setIconResId(R.drawable.media3_notification_small_icon); + .setCustomIconResId(R.drawable.media3_notification_small_icon); CommandButton button1 = builder.build(); Bundle extras2 = new Bundle(); extras2.putInt("something", 0); @@ -341,27 +341,27 @@ public class CommandButtonTest { assertThat( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .build() .hashCode()) .isEqualTo( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .build() .hashCode()); assertThat( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .build() .hashCode()) .isNotEqualTo( new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .build() .hashCode()); @@ -372,7 +372,7 @@ public class CommandButtonTest { CommandButton.Builder builder = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon); + .setCustomIconResId(R.drawable.media3_notification_small_icon); assertThrows(IllegalStateException.class, builder::build); } @@ -496,7 +496,7 @@ public class CommandButtonTest { new CommandButton.Builder(CommandButton.ICON_CLOSED_CAPTIONS) .setDisplayName("name") .setEnabled(true) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setIconUri(Uri.parse("content://test")) .setExtras(extras) .setSessionCommand(new SessionCommand(SessionCommand.COMMAND_CODE_SESSION_SET_RATING)) @@ -506,7 +506,7 @@ public class CommandButtonTest { new CommandButton.Builder(CommandButton.ICON_CLOSED_CAPTIONS) .setDisplayName("name") .setEnabled(true) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setIconUri(Uri.parse("content://test")) .setExtras(extras) .setPlayerCommand(Player.COMMAND_GET_METADATA) diff --git a/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java b/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java index a39d097cb6..d674e239c4 100644 --- a/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java +++ b/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java @@ -145,7 +145,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton customCommandButton = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(customSessionCommand) .build(); Player player = new TestExoPlayerBuilder(context).build(); @@ -178,7 +178,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton customCommandButton = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(customSessionCommand) .build(); Player player = new TestExoPlayerBuilder(context).build(); @@ -206,28 +206,28 @@ public class DefaultMediaNotificationProviderTest { CommandButton customCommandButton = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(customSessionCommand) .build(); CommandButton customBackButton = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSlots(CommandButton.SLOT_BACK) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(customSessionCommand) .build(); CommandButton customForwardButton = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSlots(CommandButton.SLOT_FORWARD) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(customSessionCommand) .build(); CommandButton customCentralButton = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSlots(CommandButton.SLOT_CENTRAL) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(customSessionCommand) .build(); Player player = new TestExoPlayerBuilder(context).build(); @@ -262,14 +262,14 @@ public class DefaultMediaNotificationProviderTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .build(); Bundle commandButton2Bundle = new Bundle(); commandButton2Bundle.putInt(DefaultMediaNotificationProvider.COMMAND_KEY_COMPACT_VIEW_INDEX, 0); CommandButton commandButton2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action2", Bundle.EMPTY)) .setExtras(commandButton2Bundle) .build(); @@ -278,7 +278,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action3", Bundle.EMPTY)) .setExtras(commandButton3Bundle) .build(); @@ -287,7 +287,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action4", Bundle.EMPTY)) .setExtras(commandButton4Bundle) .build(); @@ -334,26 +334,26 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .build(); CommandButton commandButton2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .build(); CommandButton commandButton3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .build(); CommandButton commandButton4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .build(); Player player = new TestExoPlayerBuilder(context).build(); MediaSession mediaSession = new MediaSession.Builder(context, player).build(); @@ -400,20 +400,20 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .build(); CommandButton commandButton2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .build(); CommandButton commandButton3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .build(); Player player = new TestExoPlayerBuilder(context).build(); MediaSession mediaSession = new MediaSession.Builder(context, player).build(); @@ -456,7 +456,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .build(); Player player = new TestExoPlayerBuilder(context).build(); @@ -488,28 +488,28 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSlots(CommandButton.SLOT_BACK_SECONDARY) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .build(); CommandButton commandButton2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSlots(CommandButton.SLOT_CENTRAL) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .build(); CommandButton commandButton3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSlots(CommandButton.SLOT_BACK) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .build(); CommandButton commandButton4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSlots(CommandButton.SLOT_FORWARD) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .build(); @@ -556,7 +556,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .setExtras(commandButtonBundle1) .build(); @@ -566,7 +566,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName2") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .setExtras(commandButtonBundle2) .build(); @@ -606,7 +606,7 @@ public class DefaultMediaNotificationProviderTest { CommandButton commandButton1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("displayName") - .setIconResId(R.drawable.media3_icon_circular_play) + .setCustomIconResId(R.drawable.media3_icon_circular_play) .setSessionCommand(new SessionCommand("action1", Bundle.EMPTY)) .setExtras(commandButtonBundle) .build(); @@ -748,20 +748,20 @@ public class DefaultMediaNotificationProviderTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build() .copyWithIsEnabled(true); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build() .copyWithIsEnabled(true); diff --git a/libraries/session/src/test/java/androidx/media3/session/MediaSessionServiceTest.java b/libraries/session/src/test/java/androidx/media3/session/MediaSessionServiceTest.java index 9eaaa94ecd..aeb6908a00 100644 --- a/libraries/session/src/test/java/androidx/media3/session/MediaSessionServiceTest.java +++ b/libraries/session/src/test/java/androidx/media3/session/MediaSessionServiceTest.java @@ -163,26 +163,26 @@ public class MediaSessionServiceTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command1) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command2) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction3") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command3) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command4) .build(); ExoPlayer player = new TestExoPlayerBuilder(context).build(); @@ -269,26 +269,26 @@ public class MediaSessionServiceTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command1) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command2) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction3") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command3) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command4) .build(); ExoPlayer player = new TestExoPlayerBuilder(context).build(); @@ -373,13 +373,13 @@ public class MediaSessionServiceTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command1) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("customAction2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command2) .build(); Context context = ApplicationProvider.getApplicationContext(); diff --git a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaBrowserListenerWithMediaBrowserServiceCompatTest.java b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaBrowserListenerWithMediaBrowserServiceCompatTest.java index 748d23a514..88baaa301c 100644 --- a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaBrowserListenerWithMediaBrowserServiceCompatTest.java +++ b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaBrowserListenerWithMediaBrowserServiceCompatTest.java @@ -172,14 +172,14 @@ public class MediaBrowserListenerWithMediaBrowserServiceCompatTest { public void getLibraryRoot_browseActionsAvailable() throws Exception { remoteService.setProxyForTest(TEST_MEDIA_ITEMS_WITH_BROWSE_ACTIONS); CommandButton playlistAddButton = - new CommandButton.Builder() + new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("Add to playlist") .setIconUri(Uri.parse("content://playlist_add")) .setSessionCommand( new SessionCommand(MediaBrowserConstants.COMMAND_PLAYLIST_ADD, Bundle.EMPTY)) .build(); CommandButton radioButton = - new CommandButton.Builder() + new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("Radio station") .setIconUri(Uri.parse("content://radio")) .setSessionCommand( @@ -222,7 +222,7 @@ public class MediaBrowserListenerWithMediaBrowserServiceCompatTest { MediaBrowser mediaBrowser = createBrowser(Bundle.EMPTY, /* maxCommandsForMediaItems= */ 1, /* listener= */ null); CommandButton playlistAddButton = - new CommandButton.Builder() + new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("Add to playlist") .setIconUri(Uri.parse("content://playlist_add")) .setSessionCommand( diff --git a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerCompatCallbackWithMediaSessionTest.java b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerCompatCallbackWithMediaSessionTest.java index 72998dc4be..906b4f1206 100644 --- a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerCompatCallbackWithMediaSessionTest.java +++ b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerCompatCallbackWithMediaSessionTest.java @@ -1070,13 +1070,13 @@ public class MediaControllerCompatCallbackWithMediaSessionTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSessionCommand(command1) .setDisplayName("command1") - .setIconResId(1) + .setCustomIconResId(1) .build() .copyWithIsEnabled(true), new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSessionCommand(command2) .setDisplayName("command2") - .setIconResId(2) + .setCustomIconResId(2) .build() .copyWithIsEnabled(true)); List reportedPlaybackStates = new ArrayList<>(); diff --git a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerTest.java b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerTest.java index 16ffbf15f4..af606963e8 100644 --- a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerTest.java +++ b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerTest.java @@ -2454,7 +2454,7 @@ public class MediaControllerListenerTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSessionCommand(new SessionCommand("action1", extras1)) .setDisplayName("actionName1") - .setIconResId(1) + .setCustomIconResId(1) .build(); Bundle extras2 = new Bundle(); extras2.putString("key", "value-2"); @@ -2462,7 +2462,7 @@ public class MediaControllerListenerTest { new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setSessionCommand(new SessionCommand("action2", extras2)) .setDisplayName("actionName2") - .setIconResId(2) + .setCustomIconResId(2) .build(); buttons.add(button1); buttons.add(button2); diff --git a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerWithMediaSessionCompatTest.java b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerWithMediaSessionCompatTest.java index 2fdc8254ff..c31d3e26ea 100644 --- a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerWithMediaSessionCompatTest.java +++ b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerListenerWithMediaSessionCompatTest.java @@ -475,7 +475,7 @@ public class MediaControllerListenerWithMediaSessionCompatTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .setEnabled(true) .setSlots( @@ -562,7 +562,7 @@ public class MediaControllerListenerWithMediaSessionCompatTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .setEnabled(true) .setSlots( @@ -634,7 +634,7 @@ public class MediaControllerListenerWithMediaSessionCompatTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = @@ -721,7 +721,7 @@ public class MediaControllerListenerWithMediaSessionCompatTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = diff --git a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerTest.java b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerTest.java index b7c21b656f..168d725f86 100644 --- a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerTest.java +++ b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaControllerTest.java @@ -183,32 +183,32 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button5 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button5") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupCustomLayout(session, ImmutableList.of(button1, button2, button3, button4, button5)); @@ -233,38 +233,38 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command4", Bundle.EMPTY)) .build(); CommandButton button5 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button5") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button6 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button6") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupCustomLayout(session, ImmutableList.of(button1, button3)); @@ -324,26 +324,26 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupCustomLayout(session, ImmutableList.of(button1, button2, button3, button4)); @@ -420,7 +420,7 @@ public class MediaControllerTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); setupCustomLayout(session, ImmutableList.of(button)); @@ -469,26 +469,26 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command4", Bundle.EMPTY)) .build(); setupCustomLayout(session, ImmutableList.of(button1, button2)); @@ -565,32 +565,32 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button5 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button5") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupCustomLayout(session, ImmutableList.of(button1, button2, button3, button4, button5)); @@ -616,38 +616,38 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command4", Bundle.EMPTY)) .build(); CommandButton button5 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button5") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button6 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button6") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupCustomLayout(session, ImmutableList.of(button1, button3)); @@ -702,26 +702,26 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupCustomLayout(session, ImmutableList.of(button1, button2, button3, button4)); @@ -799,7 +799,7 @@ public class MediaControllerTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); setupCustomLayout(session, ImmutableList.of(button)); @@ -1003,33 +1003,33 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .setSlots(CommandButton.SLOT_OVERFLOW) .build(); CommandButton button5 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button5") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupMediaButtonPreferences( @@ -1050,13 +1050,13 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); setupMediaButtonPreferences(session, ImmutableList.of(button1, button2)); @@ -1106,13 +1106,13 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); setupMediaButtonPreferences(session, ImmutableList.of(button1, button2)); @@ -1161,19 +1161,19 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton buttonIgnored = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); setupMediaButtonPreferences(session, ImmutableList.of(button1, button2)); @@ -1367,32 +1367,32 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button5 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button5") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupMediaButtonPreferences( @@ -1420,38 +1420,38 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command4", Bundle.EMPTY)) .build(); CommandButton button5 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button5") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button6 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button6") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupMediaButtonPreferences(session, ImmutableList.of(button1, button3)); @@ -1505,26 +1505,26 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_GET_TRACKS) .build(); setupMediaButtonPreferences(session, ImmutableList.of(button1, button2, button3, button4)); @@ -1602,7 +1602,7 @@ public class MediaControllerTest { CommandButton button = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setPlayerCommand(Player.COMMAND_PLAY_PAUSE) .build(); setupMediaButtonPreferences(session, ImmutableList.of(button)); @@ -1655,26 +1655,26 @@ public class MediaControllerTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command1", Bundle.EMPTY)) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") .setEnabled(false) - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command2", Bundle.EMPTY)) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command3", Bundle.EMPTY)) .build(); CommandButton button4 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button4") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(new SessionCommand("command4", Bundle.EMPTY)) .build(); setupMediaButtonPreferences(session, ImmutableList.of(button1, button2)); @@ -2175,7 +2175,6 @@ public class MediaControllerTest { } @Test - @SuppressWarnings("deprecation") // Testing propagation of deprecated unappliedRotationDegrees. public void getVideoSize_returnsVideoSizeOfPlayerInSession() throws Exception { VideoSize testVideoSize = new VideoSize(/* width= */ 100, /* height= */ 42, /* pixelWidthHeightRatio= */ 1.2f); diff --git a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaSessionServiceTest.java b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaSessionServiceTest.java index db0b6c52f1..fb7af3c86d 100644 --- a/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaSessionServiceTest.java +++ b/libraries/test_session_current/src/androidTest/java/androidx/media3/session/MediaSessionServiceTest.java @@ -244,19 +244,19 @@ public class MediaSessionServiceTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command1) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command2) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command3) .build(); Bundle testHints = new Bundle(); @@ -359,19 +359,19 @@ public class MediaSessionServiceTest { CommandButton button1 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button1") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command1) .build(); CommandButton button2 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button2") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command2) .build(); CommandButton button3 = new CommandButton.Builder(CommandButton.ICON_UNDEFINED) .setDisplayName("button3") - .setIconResId(R.drawable.media3_notification_small_icon) + .setCustomIconResId(R.drawable.media3_notification_small_icon) .setSessionCommand(command3) .build(); Bundle testHints = new Bundle();