From 95d9060a3063d8b428bca827d975bf65ddfdbc77 Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 3 Feb 2021 18:29:06 +0000 Subject: [PATCH] Suppress SwitchIntDef warning where it makes sense In both cases it's deliberate that all excluded constants should use the default branch. Furthermore, there are quite a lot of excluded constants missing, so it's probably better to suppress the warning than to include them all. #minor-release PiperOrigin-RevId: 355426749 --- .../ext/media2/PlayerCommandQueue.java | 18 +++++++++++++++++- .../source/hls/DefaultHlsExtractorFactory.java | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java b/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java index 4a96997a08..a1d4941f50 100644 --- a/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java +++ b/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java @@ -385,8 +385,24 @@ import java.util.concurrent.Callable; case COMMAND_CODE_PLAYER_PAUSE: case COMMAND_CODE_PLAYER_PREPARE: return true; + case COMMAND_CODE_PLAYER_ADD_PLAYLIST_ITEM: + case COMMAND_CODE_PLAYER_MOVE_PLAYLIST_ITEM: + case COMMAND_CODE_PLAYER_REMOVE_PLAYLIST_ITEM: + case COMMAND_CODE_PLAYER_REPLACE_PLAYLIST_ITEM: + case COMMAND_CODE_PLAYER_SEEK_TO: + case COMMAND_CODE_PLAYER_SET_AUDIO_ATTRIBUTES: + case COMMAND_CODE_PLAYER_SET_MEDIA_ITEM: + case COMMAND_CODE_PLAYER_SET_PLAYLIST: + case COMMAND_CODE_PLAYER_SET_REPEAT_MODE: + case COMMAND_CODE_PLAYER_SET_SHUFFLE_MODE: + case COMMAND_CODE_PLAYER_SET_SPEED: + case COMMAND_CODE_PLAYER_SKIP_TO_NEXT_PLAYLIST_ITEM: + case COMMAND_CODE_PLAYER_SKIP_TO_PLAYLIST_ITEM: + case COMMAND_CODE_PLAYER_SKIP_TO_PREVIOUS_PLAYLIST_ITEM: + case COMMAND_CODE_PLAYER_UPDATE_LIST_METADATA: + default: + return false; } - return false; } private static final class AsyncPlayerCommandResult { diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/DefaultHlsExtractorFactory.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/DefaultHlsExtractorFactory.java index cfef57f28c..a1251810ad 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/DefaultHlsExtractorFactory.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/DefaultHlsExtractorFactory.java @@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source.hls; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; +import android.annotation.SuppressLint; import android.net.Uri; import android.text.TextUtils; import androidx.annotation.Nullable; @@ -143,6 +144,7 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory { fileTypes.add(fileType); } + @SuppressLint("SwitchIntDef") // HLS only supports a small subset of the defined file types. @Nullable private Extractor createExtractorByFileType( @FileTypes.Type int fileType,