Use shifting for flag constants

Lint likes flags to be declared in this way, for safety, apparently

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207545382
This commit is contained in:
olly 2018-08-06 08:02:27 -07:00 committed by Oliver Woodman
parent dbaf6e15f7
commit 44101fc00b
5 changed files with 21 additions and 33 deletions

View File

@ -380,14 +380,10 @@ public final class C {
* Flag for empty buffers that signal that the end of the stream was reached. * Flag for empty buffers that signal that the end of the stream was reached.
*/ */
public static final int BUFFER_FLAG_END_OF_STREAM = MediaCodec.BUFFER_FLAG_END_OF_STREAM; public static final int BUFFER_FLAG_END_OF_STREAM = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
/** /** Indicates that a buffer is (at least partially) encrypted. */
* 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. */
public static final int BUFFER_FLAG_ENCRYPTED = 0x40000000; public static final int BUFFER_FLAG_DECODE_ONLY = 1 << 31; // 0x80000000
/**
* Indicates that a buffer should be decoded but not rendered.
*/
public static final int BUFFER_FLAG_DECODE_ONLY = 0x80000000;
/** /**
* Video scaling modes for {@link MediaCodec}-based {@link Renderer}s. * Video scaling modes for {@link MediaCodec}-based {@link Renderer}s.
@ -421,15 +417,13 @@ public final class C {
* Indicates that the track should be selected if user preferences do not state otherwise. * Indicates that the track should be selected if user preferences do not state otherwise.
*/ */
public static final int SELECTION_FLAG_DEFAULT = 1; public static final int SELECTION_FLAG_DEFAULT = 1;
/** /** Indicates that the track must be displayed. Only applies to text tracks. */
* Indicates that the track must be displayed. Only applies to text tracks. public static final int SELECTION_FLAG_FORCED = 1 << 1; // 2
*/
public static final int SELECTION_FLAG_FORCED = 2;
/** /**
* Indicates that the player may choose to play the track in absence of an explicit user * Indicates that the player may choose to play the track in absence of an explicit user
* preference. * preference.
*/ */
public static final int SELECTION_FLAG_AUTOSELECT = 4; public static final int SELECTION_FLAG_AUTOSELECT = 1 << 2; // 4
/** /**
* Represents an undetermined language as an ISO 639 alpha-3 language code. * Represents an undetermined language as an ISO 639 alpha-3 language code.

View File

@ -77,24 +77,20 @@ public final class FragmentedMp4Extractor implements Extractor {
* This flag does nothing if the stream is not a video stream. * This flag does nothing if the stream is not a video stream.
*/ */
public static final int FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME = 1; public static final int FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME = 1;
/** /** Flag to ignore any tfdt boxes in the stream. */
* Flag to ignore any tfdt boxes in the stream. public static final int FLAG_WORKAROUND_IGNORE_TFDT_BOX = 1 << 1; // 2
*/
public static final int FLAG_WORKAROUND_IGNORE_TFDT_BOX = 2;
/** /**
* Flag to indicate that the extractor should output an event message metadata track. Any event * Flag to indicate that the extractor should output an event message metadata track. Any event
* messages in the stream will be delivered as samples to this track. * messages in the stream will be delivered as samples to this track.
*/ */
public static final int FLAG_ENABLE_EMSG_TRACK = 4; public static final int FLAG_ENABLE_EMSG_TRACK = 1 << 2; // 4
/** /**
* Flag to indicate that the {@link Track} was sideloaded, instead of being declared by the MP4 * Flag to indicate that the {@link Track} was sideloaded, instead of being declared by the MP4
* container. * container.
*/ */
private static final int FLAG_SIDELOADED = 8; private static final int FLAG_SIDELOADED = 1 << 3; // 8
/** /** Flag to ignore any edit lists in the stream. */
* Flag to ignore any edit lists in the stream. public static final int FLAG_WORKAROUND_IGNORE_EDIT_LISTS = 1 << 4; // 16
*/
public static final int FLAG_WORKAROUND_IGNORE_EDIT_LISTS = 16;
private static final String TAG = "FragmentedMp4Extractor"; private static final String TAG = "FragmentedMp4Extractor";
private static final int SAMPLE_GROUP_TYPE_seig = Util.getIntegerCodeForString("seig"); private static final int SAMPLE_GROUP_TYPE_seig = Util.getIntegerCodeForString("seig");

View File

@ -46,13 +46,13 @@ public final class DataSpec {
* {@link DataSource#open(DataSpec)} will typically be {@link C#LENGTH_UNSET}. The data read from * {@link DataSource#open(DataSpec)} will typically be {@link C#LENGTH_UNSET}. The data read from
* {@link DataSource#read(byte[], int, int)} will be the decompressed data. * {@link DataSource#read(byte[], int, int)} will be the decompressed data.
*/ */
public static final int FLAG_ALLOW_GZIP = 1 << 0; public static final int FLAG_ALLOW_GZIP = 1;
/** /**
* Permits content to be cached even if its length can not be resolved. Typically this's the case * Permits content to be cached even if its length can not be resolved. Typically this's the case
* for progressive live streams and when {@link #FLAG_ALLOW_GZIP} is used. * for progressive live streams and when {@link #FLAG_ALLOW_GZIP} is used.
*/ */
public static final int FLAG_ALLOW_CACHING_UNKNOWN_LENGTH = 1 << 1; public static final int FLAG_ALLOW_CACHING_UNKNOWN_LENGTH = 1 << 1; // 2
/** /**
* The source from which data should be read. * The source from which data should be read.

View File

@ -65,20 +65,20 @@ public final class CacheDataSource implements DataSource {
* A flag indicating whether we will block reads if the cache key is locked. If unset then data is * A flag indicating whether we will block reads if the cache key is locked. If unset then data is
* read from upstream if the cache key is locked, regardless of whether the data is cached. * read from upstream if the cache key is locked, regardless of whether the data is cached.
*/ */
public static final int FLAG_BLOCK_ON_CACHE = 1 << 0; public static final int FLAG_BLOCK_ON_CACHE = 1;
/** /**
* A flag indicating whether the cache is bypassed following any cache related error. If set * A flag indicating whether the cache is bypassed following any cache related error. If set
* then cache related exceptions may be thrown for one cycle of open, read and close calls. * then cache related exceptions may be thrown for one cycle of open, read and close calls.
* Subsequent cycles of these calls will then bypass the cache. * Subsequent cycles of these calls will then bypass the cache.
*/ */
public static final int FLAG_IGNORE_CACHE_ON_ERROR = 1 << 1; public static final int FLAG_IGNORE_CACHE_ON_ERROR = 1 << 1; // 2
/** /**
* A flag indicating that the cache should be bypassed for requests whose lengths are unset. This * A flag indicating that the cache should be bypassed for requests whose lengths are unset. This
* flag is provided for legacy reasons only. * flag is provided for legacy reasons only.
*/ */
public static final int FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS = 1 << 2; public static final int FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS = 1 << 2; // 4
/** Reasons the cache may be ignored. */ /** Reasons the cache may be ignored. */
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017 The Android Open Source Project * Copyright (C) 2017 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -40,10 +40,8 @@ public final class RepeatModeUtil {
* "Repeat One" button enabled. * "Repeat One" button enabled.
*/ */
public static final int REPEAT_TOGGLE_MODE_ONE = 1; public static final int REPEAT_TOGGLE_MODE_ONE = 1;
/** /** "Repeat All" button enabled. */
* "Repeat All" button enabled. public static final int REPEAT_TOGGLE_MODE_ALL = 1 << 1; // 2
*/
public static final int REPEAT_TOGGLE_MODE_ALL = 2;
private RepeatModeUtil() { private RepeatModeUtil() {
// Prevent instantiation. // Prevent instantiation.