From 9306b24c6566c9dd5013aba1c310a88d0f3b2114 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Mon, 23 Oct 2017 01:23:24 -0700 Subject: [PATCH] Fix some Android Studio inspection warnings ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=173085316 --- .../main/java/com/google/android/exoplayer2/Renderer.java | 2 +- .../java/com/google/android/exoplayer2/RenderersFactory.java | 2 +- .../java/com/google/android/exoplayer2/audio/AudioSink.java | 3 +-- .../com/google/android/exoplayer2/drm/DefaultDrmSession.java | 3 +-- .../java/com/google/android/exoplayer2/drm/ExoMediaDrm.java | 2 +- .../android/exoplayer2/extractor/mkv/MatroskaExtractor.java | 4 ++-- .../android/exoplayer2/extractor/mp4/Mp4Extractor.java | 1 - .../android/exoplayer2/metadata/id3/ChapterTocFrame.java | 4 ++-- .../android/exoplayer2/source/ClippingMediaSource.java | 4 +--- .../android/exoplayer2/source/ConcatenatingMediaSource.java | 2 +- .../android/exoplayer2/source/ExtractorMediaSource.java | 5 +---- .../java/com/google/android/exoplayer2/text/cea/CeaUtil.java | 2 +- .../exoplayer2/trackselection/DefaultTrackSelector.java | 2 +- .../com/google/android/exoplayer2/upstream/cache/Cache.java | 2 +- .../source/smoothstreaming/manifest/SsManifestTest.java | 2 +- .../main/res/drawable-anydpi-v21/exo_controls_shuffle.xml | 2 +- .../exoplayer2/playbacktests/gts/DashDownloadTest.java | 2 +- .../android/exoplayer2/testutil/FakeSimpleExoPlayer.java | 4 ++-- 18 files changed, 20 insertions(+), 28 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java b/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java index e16caec980..6def1591da 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java @@ -226,7 +226,7 @@ public interface Renderer extends ExoPlayerComponent { /** * Whether the renderer is ready for the {@link ExoPlayer} instance to transition to - * {@link ExoPlayer#STATE_ENDED}. The player will make this transition as soon as {@code true} is + * {@link Player#STATE_ENDED}. The player will make this transition as soon as {@code true} is * returned by all of its {@link Renderer}s. *

* This method may be called when the renderer is in the following states: diff --git a/library/core/src/main/java/com/google/android/exoplayer2/RenderersFactory.java b/library/core/src/main/java/com/google/android/exoplayer2/RenderersFactory.java index a08ba448a4..944a6a9e5e 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/RenderersFactory.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/RenderersFactory.java @@ -31,7 +31,7 @@ public interface RenderersFactory { * * @param eventHandler A handler to use when invoking event listeners and outputs. * @param videoRendererEventListener An event listener for video renderers. - * @param videoRendererEventListener An event listener for audio renderers. + * @param audioRendererEventListener An event listener for audio renderers. * @param textRendererOutput An output for text renderers. * @param metadataRendererOutput An output for metadata renderers. * @return The {@link Renderer instances}. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioSink.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioSink.java index 8b39a28182..5408032907 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioSink.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/AudioSink.java @@ -202,8 +202,7 @@ public interface AudioSink { * @param trimStartSamples The number of audio samples to trim from the start of data written to * the sink after this call. * @param trimEndSamples The number of audio samples to trim from data written to the sink - * immediately preceding the next call to {@link #reset()} or - * {@link #configure(String, int, int, int, int, int[], int, int)}. + * immediately preceding the next call to {@link #reset()} or this method. * @throws ConfigurationException If an error occurs configuring the sink. */ void configure(String inputMimeType, int inputChannelCount, int inputSampleRate, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java b/library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java index 4e5696ef1f..290c1877de 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java @@ -86,6 +86,7 @@ import java.util.UUID; /* package */ final MediaDrmCallback callback; /* package */ final UUID uuid; + /* package */ final PostResponseHandler postResponseHandler; private @DrmSession.State int state; private int openCount; @@ -96,8 +97,6 @@ import java.util.UUID; private byte[] sessionId; private byte[] offlineLicenseKeySetId; - /* package */ PostResponseHandler postResponseHandler; - /** * Instantiates a new DRM session. * diff --git a/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java b/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java index 1930e11f06..e9ee1ce90b 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java @@ -205,7 +205,7 @@ public interface ExoMediaDrm { * * @param initData Opaque initialization data specific to the crypto scheme. * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data. - * @throws MediaCryptoException + * @throws MediaCryptoException If the instance can't be created. */ T createMediaCrypto(byte[] initData) throws MediaCryptoException; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java index a5fe6ae35b..5aefd041c4 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java @@ -242,7 +242,7 @@ public final class MatroskaExtractor implements Extractor { * The value by which to divide a time in microseconds to convert it to the unit of the last value * in a subrip timecode (milliseconds). */ - private static long SUBRIP_TIMECODE_LAST_VALUE_SCALING_FACTOR = 1000; + private static final long SUBRIP_TIMECODE_LAST_VALUE_SCALING_FACTOR = 1000; /** * The format of a subrip timecode. */ @@ -270,7 +270,7 @@ public final class MatroskaExtractor implements Extractor { * The value by which to divide a time in microseconds to convert it to the unit of the last value * in an SSA timecode (1/100ths of a second). */ - private static long SSA_TIMECODE_LAST_VALUE_SCALING_FACTOR = 10000; + private static final long SSA_TIMECODE_LAST_VALUE_SCALING_FACTOR = 10000; /** * A special end timecode indicating that an SSA subtitle should be displayed until the next * subtitle, or until the end of the media in the case of the last subtitle. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java index 473e17e3e0..f23af98e7f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java @@ -28,7 +28,6 @@ import com.google.android.exoplayer2.extractor.PositionHolder; import com.google.android.exoplayer2.extractor.SeekMap; import com.google.android.exoplayer2.extractor.TrackOutput; import com.google.android.exoplayer2.extractor.mp4.Atom.ContainerAtom; -import com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.Flags; import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.NalUnitUtil; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/metadata/id3/ChapterTocFrame.java b/library/core/src/main/java/com/google/android/exoplayer2/metadata/id3/ChapterTocFrame.java index d71d0863c7..939c00b9db 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/metadata/id3/ChapterTocFrame.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/metadata/id3/ChapterTocFrame.java @@ -101,8 +101,8 @@ public final class ChapterTocFrame extends Id3Frame { dest.writeByte((byte) (isOrdered ? 1 : 0)); dest.writeStringArray(children); dest.writeInt(subFrames.length); - for (int i = 0; i < subFrames.length; i++) { - dest.writeParcelable(subFrames[i], 0); + for (Id3Frame subFrame : subFrames) { + dest.writeParcelable(subFrame, 0); } } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ClippingMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ClippingMediaSource.java index 21de83524a..161fbb4871 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ClippingMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ClippingMediaSource.java @@ -37,7 +37,6 @@ public final class ClippingMediaSource implements MediaSource, MediaSource.Liste private final ArrayList mediaPeriods; private MediaSource.Listener sourceListener; - private ClippingTimeline clippingTimeline; /** * Creates a new clipping source that wraps the specified source. @@ -117,8 +116,7 @@ public final class ClippingMediaSource implements MediaSource, MediaSource.Liste @Override public void onSourceInfoRefreshed(Timeline timeline, Object manifest) { - clippingTimeline = new ClippingTimeline(timeline, startUs, endUs); - sourceListener.onSourceInfoRefreshed(clippingTimeline, manifest); + sourceListener.onSourceInfoRefreshed(new ClippingTimeline(timeline, startUs, endUs), manifest); int count = mediaPeriods.size(); for (int i = 0; i < count; i++) { mediaPeriods.get(i).setClipping(startUs, endUs); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java index 4cf3843ea1..bafdebf6cb 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java @@ -40,10 +40,10 @@ public final class ConcatenatingMediaSource implements MediaSource { private final Map sourceIndexByMediaPeriod; private final boolean[] duplicateFlags; private final boolean isAtomic; + private final ShuffleOrder shuffleOrder; private Listener listener; private ConcatenatedTimeline timeline; - private ShuffleOrder shuffleOrder; /** * @param mediaSources The {@link MediaSource}s to concatenate. It is valid for the same diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java index 51e9757165..be8b3595db 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java @@ -19,7 +19,6 @@ import android.net.Uri; import android.os.Handler; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlayer; -import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory; import com.google.android.exoplayer2.extractor.Extractor; import com.google.android.exoplayer2.extractor.ExtractorsFactory; @@ -84,7 +83,6 @@ public final class ExtractorMediaSource implements MediaSource, ExtractorMediaPe private final int minLoadableRetryCount; private final Handler eventHandler; private final EventListener eventListener; - private final Timeline.Period period; private final String customCacheKey; private final int continueLoadingCheckIntervalBytes; @@ -149,7 +147,6 @@ public final class ExtractorMediaSource implements MediaSource, ExtractorMediaPe this.eventListener = eventListener; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; - period = new Timeline.Period(); } @Override @@ -187,7 +184,7 @@ public final class ExtractorMediaSource implements MediaSource, ExtractorMediaPe public void onSourceInfoRefreshed(long durationUs, boolean isSeekable) { // If we already have the duration from a previous source info refresh, use it. durationUs = durationUs == C.TIME_UNSET ? timelineDurationUs : durationUs; - if (timelineDurationUs == durationUs && timelineIsSeekable == isSeekable + if ((timelineDurationUs == durationUs && timelineIsSeekable == isSeekable) || (timelineDurationUs != C.TIME_UNSET && durationUs == C.TIME_UNSET)) { // Suppress no-op source info changes. return; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/text/cea/CeaUtil.java b/library/core/src/main/java/com/google/android/exoplayer2/text/cea/CeaUtil.java index 130c7461f9..ddb3804c3e 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/text/cea/CeaUtil.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/text/cea/CeaUtil.java @@ -82,7 +82,7 @@ public final class CeaUtil { * number of 0xFF bytes and T is the value of the terminating byte. * * @param buffer The buffer from which to read the value. - * @returns The read value, or -1 if the end of the buffer is reached before a value is read. + * @return The read value, or -1 if the end of the buffer is reached before a value is read. */ private static int readNon255TerminatedValue(ParsableByteArray buffer) { int b; 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 42eeebde11..c789caded4 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 @@ -1094,7 +1094,7 @@ public class DefaultTrackSelector extends MappingTrackSelector { * * @param other The other score to compare to. * @return A positive integer if this score is better than the other. Zero if they are - * equal. A negative integer if this score is worse than the other. + * equal. A negative integer if this score is worse than the other. */ @Override public int compareTo(AudioTrackScore other) { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java index 0265ef83ea..57cbcafb53 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java @@ -140,7 +140,7 @@ public interface Cache { * @param key The key of the data being requested. * @param position The position of the data being requested. * @return The {@link CacheSpan}. - * @throws InterruptedException + * @throws InterruptedException If the thread was interrupted. */ CacheSpan startReadWrite(String key, long position) throws InterruptedException, CacheException; diff --git a/library/smoothstreaming/src/androidTest/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestTest.java b/library/smoothstreaming/src/androidTest/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestTest.java index 0a221b6932..f172293c22 100644 --- a/library/smoothstreaming/src/androidTest/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestTest.java +++ b/library/smoothstreaming/src/androidTest/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestTest.java @@ -32,7 +32,7 @@ import junit.framework.TestCase; */ public class SsManifestTest extends TestCase { - private static ProtectionElement DUMMY_PROTECTION_ELEMENT = + private static final ProtectionElement DUMMY_PROTECTION_ELEMENT = new ProtectionElement(C.WIDEVINE_UUID, new byte[] {0, 1, 2}); public void testCopy() throws Exception { diff --git a/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle.xml b/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle.xml index 28ac6a5786..123c06c43e 100644 --- a/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle.xml +++ b/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle.xml @@ -21,6 +21,6 @@ diff --git a/playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashDownloadTest.java b/playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashDownloadTest.java index 7818ddcf12..8e02204c26 100644 --- a/playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashDownloadTest.java +++ b/playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashDownloadTest.java @@ -170,7 +170,7 @@ public final class DashDownloadTest extends ActivityInstrumentationTestCase2