From 479e8ea36e7760ed74a6574ad87d9753408dce08 Mon Sep 17 00:00:00 2001 From: ibaker Date: Tue, 29 Mar 2022 10:07:23 +0100 Subject: [PATCH] Remove IntDef warning suppression from DefaultTrackSelector The problem is not the IntDef array, it's the fact the lint tool is unable to correctly infer the annotations on the lambda parameters without them being explicitly annotated. It seems explicitly annotating is better than suppressing all IntDef warnings in the whole method. PiperOrigin-RevId: 437969271 --- .../exoplayer2/trackselection/DefaultTrackSelector.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java index 5896ba579a..43a3998d50 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java @@ -1729,7 +1729,6 @@ public class DefaultTrackSelector extends MappingTrackSelector { * renderer index, or null if no selection was made. * @throws ExoPlaybackException If an error occurs while selecting the tracks. */ - @SuppressLint("WrongConstant") // Lint doesn't understand arrays of IntDefs. @Nullable protected Pair selectVideoTrack( MappedTrackInfo mappedTrackInfo, @@ -1741,7 +1740,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { C.TRACK_TYPE_VIDEO, mappedTrackInfo, rendererFormatSupports, - (rendererIndex, group, support) -> + (int rendererIndex, TrackGroup group, @Capabilities int[] support) -> VideoTrackInfo.createForTrackGroup( rendererIndex, group, params, support, mixedMimeTypeSupports[rendererIndex]), VideoTrackInfo::compareSelections); @@ -1763,7 +1762,6 @@ public class DefaultTrackSelector extends MappingTrackSelector { * renderer index, or null if no selection was made. * @throws ExoPlaybackException If an error occurs while selecting the tracks. */ - @SuppressLint("WrongConstant") // Lint doesn't understand arrays of IntDefs. @Nullable protected Pair selectAudioTrack( MappedTrackInfo mappedTrackInfo, @@ -1784,7 +1782,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { C.TRACK_TYPE_AUDIO, mappedTrackInfo, rendererFormatSupports, - (rendererIndex, group, support) -> + (int rendererIndex, TrackGroup group, @Capabilities int[] support) -> AudioTrackInfo.createForTrackGroup( rendererIndex, group, params, support, hasVideoRendererWithMappedTracksFinal), AudioTrackInfo::compareSelections); @@ -1806,7 +1804,6 @@ public class DefaultTrackSelector extends MappingTrackSelector { * renderer index, or null if no selection was made. * @throws ExoPlaybackException If an error occurs while selecting the tracks. */ - @SuppressLint("WrongConstant") // Lint doesn't understand arrays of IntDefs. @Nullable protected Pair selectTextTrack( MappedTrackInfo mappedTrackInfo, @@ -1818,7 +1815,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { C.TRACK_TYPE_TEXT, mappedTrackInfo, rendererFormatSupports, - (rendererIndex, group, support) -> + (int rendererIndex, TrackGroup group, @Capabilities int[] support) -> TextTrackInfo.createForTrackGroup( rendererIndex, group, params, support, selectedAudioLanguage), TextTrackInfo::compareSelections);