Skip to content

Commit

Permalink
Fix a bunch of misc analysis warnings
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209758330
  • Loading branch information
ojw28 committed Aug 24, 2018
1 parent 9ccbb5b commit 9f0303b
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 40 deletions.
4 changes: 2 additions & 2 deletions javadoc_combined.gradle
Expand Up @@ -39,7 +39,7 @@ class CombinedJavadocPlugin implements Plugin<Project> {
libraryModules.each { libraryModule ->
libraryModule.android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals("release")) {
if (name == "release") {
classpath +=
libraryModule.project.files(
variant.javaCompile.classpath.files,
Expand All @@ -63,7 +63,7 @@ class CombinedJavadocPlugin implements Plugin<Project> {
}

// Returns Android library modules that declare a generateJavadoc task.
private Set<Project> getLibraryModules(Project project) {
private static Set<Project> getLibraryModules(Project project) {
project.subprojects.findAll {
it.plugins.findPlugin("com.android.library") &&
it.tasks.findByName("generateJavadoc")
Expand Down
Expand Up @@ -418,6 +418,7 @@ private C() {}
/** Indicates that a buffer is (at least partially) encrypted. */
public static final int BUFFER_FLAG_ENCRYPTED = 1 << 30; // 0x40000000
/** Indicates that a buffer should be decoded but not rendered. */
@SuppressWarnings("NumericOverflow")
public static final int BUFFER_FLAG_DECODE_ONLY = 1 << 31; // 0x80000000

/**
Expand Down
Expand Up @@ -424,12 +424,10 @@ public void onTimelineChanged(Timeline timeline, @Nullable Object manifest) {
*/
int STATE_ENDED = 4;

/**
* Repeat modes for playback.
*/
/** Repeat modes for playback. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({REPEAT_MODE_OFF, REPEAT_MODE_ONE, REPEAT_MODE_ALL})
public @interface RepeatMode {}
@interface RepeatMode {}
/**
* Normal playback without repetition.
*/
Expand All @@ -452,7 +450,7 @@ public void onTimelineChanged(Timeline timeline, @Nullable Object manifest) {
DISCONTINUITY_REASON_AD_INSERTION,
DISCONTINUITY_REASON_INTERNAL
})
public @interface DiscontinuityReason {}
@interface DiscontinuityReason {}
/**
* Automatic playback transition from one period in the timeline to the next. The period index may
* be the same as it was before the discontinuity in case the current period is repeated.
Expand All @@ -470,13 +468,14 @@ public void onTimelineChanged(Timeline timeline, @Nullable Object manifest) {
/** Discontinuity introduced internally by the source. */
int DISCONTINUITY_REASON_INTERNAL = 4;

/**
* Reasons for timeline and/or manifest changes.
*/
/** Reasons for timeline and/or manifest changes. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({TIMELINE_CHANGE_REASON_PREPARED, TIMELINE_CHANGE_REASON_RESET,
TIMELINE_CHANGE_REASON_DYNAMIC})
public @interface TimelineChangeReason {}
@IntDef({
TIMELINE_CHANGE_REASON_PREPARED,
TIMELINE_CHANGE_REASON_RESET,
TIMELINE_CHANGE_REASON_DYNAMIC
})
@interface TimelineChangeReason {}
/**
* Timeline and manifest changed as a result of a player initialization with new media.
*/
Expand Down
Expand Up @@ -231,7 +231,7 @@ public boolean getDeleteAfterDelivery() {
* Player.EventListener#onPlayerError(ExoPlaybackException)}.
*
* @return This message.
* @throws IllegalStateException If {@link #send()} has already been called.
* @throws IllegalStateException If this message has already been sent.
*/
public PlayerMessage send() {
Assertions.checkState(!isSent);
Expand Down
Expand Up @@ -202,7 +202,7 @@ void replaceStream(Format[] formats, SampleStream stream, long offsetUs)
* @param operatingRate The operating rate.
* @throws ExoPlaybackException If an error occurs handling the operating rate.
*/
default void setOperatingRate(float operatingRate) throws ExoPlaybackException {};
default void setOperatingRate(float operatingRate) throws ExoPlaybackException {}

/**
* Incrementally renders the {@link SampleStream}.
Expand Down
Expand Up @@ -39,12 +39,10 @@ public DrmSessionException(Throwable cause) {

}

/**
* The state of the DRM session.
*/
/** The state of the DRM session. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({STATE_RELEASED, STATE_ERROR, STATE_OPENING, STATE_OPENED, STATE_OPENED_WITH_KEYS})
public @interface State {}
@interface State {}
/**
* The session has been released.
*/
Expand Down
Expand Up @@ -81,7 +81,6 @@ public final class AdtsReader implements ElementaryStreamReader {
private int firstFrameSampleRateIndex;

private int currentFrameVersion;
private int currentFrameSampleRateIndex;

// Used when parsing the header.
private boolean hasOutputFormat;
Expand Down Expand Up @@ -327,7 +326,7 @@ private void checkAdtsHeader(ParsableByteArray buffer) {
adtsScratch.data[0] = buffer.data[buffer.getPosition()];

adtsScratch.setPosition(2);
currentFrameSampleRateIndex = adtsScratch.readBits(4);
int currentFrameSampleRateIndex = adtsScratch.readBits(4);
if (firstFrameSampleRateIndex != C.INDEX_UNSET
&& currentFrameSampleRateIndex != firstFrameSampleRateIndex) {
// Invalid header.
Expand Down
Expand Up @@ -56,8 +56,8 @@ public final class Tx3gDecoder extends SimpleSubtitleDecoder {
private static final int FONT_FACE_ITALIC = 0x0002;
private static final int FONT_FACE_UNDERLINE = 0x0004;

private static final int SPAN_PRIORITY_LOW = (0xFF << Spanned.SPAN_PRIORITY_SHIFT);
private static final int SPAN_PRIORITY_HIGH = (0x00 << Spanned.SPAN_PRIORITY_SHIFT);
private static final int SPAN_PRIORITY_LOW = 0xFF << Spanned.SPAN_PRIORITY_SHIFT;
private static final int SPAN_PRIORITY_HIGH = 0;

private static final int DEFAULT_FONT_FACE = 0;
private static final int DEFAULT_COLOR = Color.WHITE;
Expand Down
Expand Up @@ -191,7 +191,7 @@ public synchronized NavigableSet<CacheSpan> getCachedSpans(String key) {
Assertions.checkState(!released);
CachedContent cachedContent = index.get(key);
return cachedContent == null || cachedContent.isEmpty()
? new TreeSet<CacheSpan>()
? new TreeSet<>()
: new TreeSet<CacheSpan>(cachedContent.getSpans());
}

Expand Down
Expand Up @@ -401,8 +401,8 @@ public Pcm16BitAudioBuilder(int channelCount, int frameCount) {
public void appendFrames(int count, short... channelLevels) {
Assertions.checkState(!built);
for (int i = 0; i < count; i += channelCount) {
for (int j = 0; j < channelLevels.length; j++) {
buffer.put(channelLevels[j]);
for (short channelLevel : channelLevels) {
buffer.put(channelLevel);
}
}
}
Expand Down
Expand Up @@ -95,15 +95,15 @@ private static void testMergingMediaSourcePrepare(Timeline... timelines) throws
for (int i = 0; i < timelines.length; i++) {
mediaSources[i] = new FakeMediaSource(timelines[i], null);
}
MergingMediaSource mediaSource = new MergingMediaSource(mediaSources);
MediaSourceTestRunner testRunner = new MediaSourceTestRunner(mediaSource, null);
MergingMediaSource mergingMediaSource = new MergingMediaSource(mediaSources);
MediaSourceTestRunner testRunner = new MediaSourceTestRunner(mergingMediaSource, null);
try {
Timeline timeline = testRunner.prepareSource();
// The merged timeline should always be the one from the first child.
assertThat(timeline).isEqualTo(timelines[0]);
testRunner.releaseSource();
for (int i = 0; i < mediaSources.length; i++) {
mediaSources[i].assertReleased();
for (FakeMediaSource mediaSource : mediaSources) {
mediaSource.assertReleased();
}
} finally {
testRunner.release();
Expand Down
Expand Up @@ -61,8 +61,7 @@ public final class CachedRegionTrackerTest {
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(cache.addListener(anyString(), any(Cache.Listener.class)))
.thenReturn(new TreeSet<CacheSpan>());
when(cache.addListener(anyString(), any(Cache.Listener.class))).thenReturn(new TreeSet<>());
tracker = new CachedRegionTracker(cache, CACHE_KEY, CHUNK_INDEX);
cacheDir = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
index = new CachedContentIndex(cacheDir);
Expand Down
Expand Up @@ -191,8 +191,7 @@ private HlsDownloader getHlsDownloader(String mediaPlaylistUri, List<StreamKey>
private static ArrayList<StreamKey> getKeys(int... variantIndices) {
ArrayList<StreamKey> streamKeys = new ArrayList<>();
for (int variantIndex : variantIndices) {
final int trackIndex = variantIndex;
streamKeys.add(new StreamKey(HlsMasterPlaylist.GROUP_INDEX_VARIANT, trackIndex));
streamKeys.add(new StreamKey(HlsMasterPlaylist.GROUP_INDEX_VARIANT, variantIndex));
}
return streamKeys;
}
Expand Down
Expand Up @@ -213,7 +213,7 @@ protected boolean handleChildInline(String tagName) {

/**
* @param xmlParser The underlying {@link XmlPullParser}
* @throws ParserException
* @throws ParserException If a parsing error occurs.
*/
protected void parseStartTag(XmlPullParser xmlParser) throws ParserException {
// Do nothing.
Expand Down
Expand Up @@ -64,9 +64,7 @@ public void testCopyRemoveStreamElement() throws Exception {
SsManifest sourceManifest =
newSsManifest(newStreamElement("1", formats[0]), newStreamElement("2", formats[1]));

List<StreamKey> keys = Arrays.asList(new StreamKey(1, 0));
// Keys don't need to be in any particular order
Collections.shuffle(keys, new Random(0));
List<StreamKey> keys = Collections.singletonList(new StreamKey(1, 0));

SsManifest copyManifest = sourceManifest.copy(keys);

Expand Down
4 changes: 3 additions & 1 deletion library/ui/src/main/res/layout/exo_playback_control_view.xml
Expand Up @@ -14,12 +14,14 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layoutDirection="ltr"
android:background="#CC000000"
android:orientation="vertical">
android:orientation="vertical"
tools:targetApi="28">

<LinearLayout
android:layout_width="match_parent"
Expand Down
Expand Up @@ -95,7 +95,7 @@ public void blockUntilTasksCompleteAndThrowAnyDownloadError() throws Throwable {
private ArrayBlockingQueue<Integer> getStateQueue(DownloadAction action) {
synchronized (actionStates) {
if (!actionStates.containsKey(action)) {
actionStates.put(action, new ArrayBlockingQueue<Integer>(10));
actionStates.put(action, new ArrayBlockingQueue<>(10));
}
return actionStates.get(action);
}
Expand Down

0 comments on commit 9f0303b

Please sign in to comment.