Fix minor issues and lint errors
PiperOrigin-RevId: 233428556
This commit is contained in:
parent
6a7157de11
commit
a21572f0dd
@ -44,8 +44,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
// The demo app does not have translations.
|
// The demo app isn't indexed and doesn't have translations.
|
||||||
disable 'MissingTranslation'
|
disable 'GoogleAppIndexingWarning','MissingTranslation'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,8 +150,11 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
new AlertDialog.Builder(this).setTitle(R.string.sample_list_dialog_title)
|
new AlertDialog.Builder(this)
|
||||||
.setView(buildSampleListView()).setPositiveButton(android.R.string.ok, null).create()
|
.setTitle(R.string.add_samples)
|
||||||
|
.setView(buildSampleListView())
|
||||||
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
|
.create()
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:padding="30dp"/>
|
android:padding="30dp"
|
||||||
|
android:contentDescription="@string/add_samples"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<com.google.android.exoplayer2.ui.PlayerControlView android:id="@+id/cast_control_view"
|
<com.google.android.exoplayer2.ui.PlayerControlView android:id="@+id/cast_control_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<string name="media_route_menu_title">Cast</string>
|
<string name="media_route_menu_title">Cast</string>
|
||||||
|
|
||||||
<string name="sample_list_dialog_title">Add samples</string>
|
<string name="add_samples">Add samples</string>
|
||||||
|
|
||||||
<string name="cast_context_error">Failed to get Cast context. Try updating Google Play Services and restart the app.</string>
|
<string name="cast_context_error">Failed to get Cast context. Try updating Google Play Services and restart the app.</string>
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
// The demo app does not have translations.
|
// The demo app isn't indexed and doesn't have translations.
|
||||||
disable 'MissingTranslation'
|
disable 'GoogleAppIndexingWarning','MissingTranslation'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,9 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
// The demo app does not have translations.
|
// The demo app isn't indexed, doesn't have translations, and has a
|
||||||
disable 'MissingTranslation'
|
// banner for AndroidTV that's only in xhdpi density.
|
||||||
|
disable 'GoogleAppIndexingWarning','MissingTranslation','IconDensities'
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "extensions"
|
flavorDimensions "extensions"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.google.android.exoplayer2.demo">
|
package="com.google.android.exoplayer2.demo">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
@ -33,7 +34,8 @@
|
|||||||
android:banner="@drawable/ic_banner"
|
android:banner="@drawable/ic_banner"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:name="com.google.android.exoplayer2.demo.DemoApplication">
|
android:name="com.google.android.exoplayer2.demo.DemoApplication"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
<activity android:name="com.google.android.exoplayer2.demo.SampleChooserActivity"
|
<activity android:name="com.google.android.exoplayer2.demo.SampleChooserActivity"
|
||||||
android:configChanges="keyboardHidden"
|
android:configChanges="keyboardHidden"
|
||||||
|
@ -29,7 +29,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api 'org.chromium.net:cronet-embedded:71.3578.98'
|
api 'org.chromium.net:cronet-embedded:72.3626.96'
|
||||||
implementation project(modulePrefix + 'library-core')
|
implementation project(modulePrefix + 'library-core')
|
||||||
implementation 'com.android.support:support-annotations:' + supportLibraryVersion
|
implementation 'com.android.support:support-annotations:' + supportLibraryVersion
|
||||||
testImplementation project(modulePrefix + 'library')
|
testImplementation project(modulePrefix + 'library')
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.android.exoplayer2.ext.gvr;
|
package com.google.android.exoplayer2.ext.gvr;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -13,13 +13,14 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<merge
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/video_ui_view"
|
android:id="@+id/video_ui_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#000"
|
android:background="@android:color/black"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
tools:ignore="Overdraw">
|
||||||
<com.google.android.exoplayer2.ui.PlayerControlView
|
<com.google.android.exoplayer2.ui.PlayerControlView
|
||||||
android:id="@+id/controller"
|
android:id="@+id/controller"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -32,11 +32,11 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api 'com.google.ads.interactivemedia.v3:interactivemedia:3.10.6'
|
api 'com.google.ads.interactivemedia.v3:interactivemedia:3.10.6'
|
||||||
implementation project(modulePrefix + 'library-core')
|
implementation project(modulePrefix + 'library-core')
|
||||||
implementation 'com.google.android.gms:play-services-ads:17.1.2'
|
implementation 'com.google.android.gms:play-services-ads:17.1.3'
|
||||||
// These dependencies are necessary to force the supportLibraryVersion of
|
// These dependencies are necessary to force the supportLibraryVersion of
|
||||||
// com.android.support:support-v4 and com.android.support:customtabs to be
|
// com.android.support:support-v4 and com.android.support:customtabs to be
|
||||||
// used. Else older versions are used, for example via:
|
// used. Else older versions are used, for example via:
|
||||||
// com.google.android.gms:play-services-ads:17.1.2
|
// com.google.android.gms:play-services-ads:17.1.3
|
||||||
// |-- com.android.support:customtabs:26.1.0
|
// |-- com.android.support:customtabs:26.1.0
|
||||||
implementation 'com.android.support:support-v4:' + supportLibraryVersion
|
implementation 'com.android.support:support-v4:' + supportLibraryVersion
|
||||||
implementation 'com.android.support:customtabs:' + supportLibraryVersion
|
implementation 'com.android.support:customtabs:' + supportLibraryVersion
|
||||||
|
@ -30,7 +30,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(modulePrefix + 'library-core')
|
implementation project(modulePrefix + 'library-core')
|
||||||
implementation('com.android.support:leanback-v17:' + supportLibraryVersion)
|
implementation 'com.android.support:leanback-v17:' + supportLibraryVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.extractor.ogg;
|
package com.google.android.exoplayer2.extractor.ogg;
|
||||||
|
|
||||||
import android.support.annotation.VisibleForTesting;
|
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.extractor.ExtractorInput;
|
import com.google.android.exoplayer2.extractor.ExtractorInput;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
@ -111,7 +110,6 @@ import java.util.Arrays;
|
|||||||
* @return the {@code PageHeader} of the last page read or an empty header if the packet has yet
|
* @return the {@code PageHeader} of the last page read or an empty header if the packet has yet
|
||||||
* to be populated.
|
* to be populated.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
|
||||||
public OggPageHeader getPageHeader() {
|
public OggPageHeader getPageHeader() {
|
||||||
return pageHeader;
|
return pageHeader;
|
||||||
}
|
}
|
||||||
|
@ -247,8 +247,11 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
|
|||||||
case Cue.ANCHOR_TYPE_MIDDLE:
|
case Cue.ANCHOR_TYPE_MIDDLE:
|
||||||
return SubripDecoder.MID_FRACTION;
|
return SubripDecoder.MID_FRACTION;
|
||||||
case Cue.ANCHOR_TYPE_END:
|
case Cue.ANCHOR_TYPE_END:
|
||||||
default:
|
|
||||||
return SubripDecoder.END_FRACTION;
|
return SubripDecoder.END_FRACTION;
|
||||||
|
case Cue.TYPE_UNSET:
|
||||||
|
default:
|
||||||
|
// Should never happen.
|
||||||
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.upstream.cache;
|
package com.google.android.exoplayer2.upstream.cache;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
@ -294,6 +295,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
return cachedContent;
|
return cachedContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("GetInstance") // Suppress warning about specifying "BC" as an explicit provider.
|
||||||
private static Cipher getCipher() throws NoSuchPaddingException, NoSuchAlgorithmException {
|
private static Cipher getCipher() throws NoSuchPaddingException, NoSuchAlgorithmException {
|
||||||
// Workaround for https://issuetracker.google.com/issues/36976726
|
// Workaround for https://issuetracker.google.com/issues/36976726
|
||||||
if (Util.SDK_INT == 18) {
|
if (Util.SDK_INT == 18) {
|
||||||
|
@ -597,10 +597,10 @@ public final class SimpleCache implements Cache {
|
|||||||
return createUid(directory);
|
return createUid(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("TrulyRandom")
|
||||||
private static long createUid(File directory) throws IOException {
|
private static long createUid(File directory) throws IOException {
|
||||||
SecureRandom random = new SecureRandom();
|
|
||||||
// Generate a non-negative UID.
|
// Generate a non-negative UID.
|
||||||
long uid = random.nextLong();
|
long uid = new SecureRandom().nextLong();
|
||||||
uid = uid == Long.MIN_VALUE ? 0 : Math.abs(uid);
|
uid = uid == Long.MIN_VALUE ? 0 : Math.abs(uid);
|
||||||
// Persist it as a file.
|
// Persist it as a file.
|
||||||
String hexUid = Long.toString(uid, /* radix= */ 16);
|
String hexUid = Long.toString(uid, /* radix= */ 16);
|
||||||
|
@ -18,12 +18,12 @@ package com.google.android.exoplayer2.upstream.cache;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
|
|
||||||
|
import android.util.LongSparseArray;
|
||||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@ -112,7 +112,7 @@ public class SimpleCacheSpanTest {
|
|||||||
TreeSet<SimpleCacheSpan> spans = index.get(key).getSpans();
|
TreeSet<SimpleCacheSpan> spans = index.get(key).getSpans();
|
||||||
assertWithMessage("upgradeOldFiles() shouldn't add any spans.").that(spans.isEmpty()).isTrue();
|
assertWithMessage("upgradeOldFiles() shouldn't add any spans.").that(spans.isEmpty()).isTrue();
|
||||||
|
|
||||||
HashMap<Long, Long> cachedPositions = new HashMap<>();
|
LongSparseArray<Long> cachedPositions = new LongSparseArray<>();
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
SimpleCacheSpan cacheSpan = SimpleCacheSpan.createCacheEntry(file, file.length(), index);
|
SimpleCacheSpan cacheSpan = SimpleCacheSpan.createCacheEntry(file, file.length(), index);
|
||||||
if (cacheSpan != null) {
|
if (cacheSpan != null) {
|
||||||
@ -121,9 +121,9 @@ public class SimpleCacheSpanTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assertThat(cachedPositions.get((long) 0)).isEqualTo(1);
|
assertThat(cachedPositions.get(0)).isEqualTo(1);
|
||||||
assertThat(cachedPositions.get((long) 1)).isEqualTo(2);
|
assertThat(cachedPositions.get(1)).isEqualTo(2);
|
||||||
assertThat(cachedPositions.get((long) 5)).isEqualTo(6);
|
assertThat(cachedPositions.get(5)).isEqualTo(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createTestFile(File file, long length) throws IOException {
|
private static void createTestFile(File file, long length) throws IOException {
|
||||||
|
@ -403,7 +403,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
|
|||||||
surfaceView = new TextureView(context);
|
surfaceView = new TextureView(context);
|
||||||
break;
|
break;
|
||||||
case SURFACE_TYPE_MONO360_VIEW:
|
case SURFACE_TYPE_MONO360_VIEW:
|
||||||
Assertions.checkState(Util.SDK_INT >= 15);
|
|
||||||
SphericalSurfaceView sphericalSurfaceView = new SphericalSurfaceView(context);
|
SphericalSurfaceView sphericalSurfaceView = new SphericalSurfaceView(context);
|
||||||
sphericalSurfaceView.setSurfaceListener(componentListener);
|
sphericalSurfaceView.setSurfaceListener(componentListener);
|
||||||
sphericalSurfaceView.setSingleTapListener(componentListener);
|
sphericalSurfaceView.setSingleTapListener(componentListener);
|
||||||
|
@ -80,6 +80,7 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final String TAG = "HostActivity";
|
private static final String TAG = "HostActivity";
|
||||||
|
private static final String LOCK_TAG = "ExoPlayerTestUtil:" + TAG;
|
||||||
private static final long START_TIMEOUT_MS = 5000;
|
private static final long START_TIMEOUT_MS = 5000;
|
||||||
|
|
||||||
private WakeLock wakeLock;
|
private WakeLock wakeLock;
|
||||||
@ -175,10 +176,10 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
Context appContext = getApplicationContext();
|
Context appContext = getApplicationContext();
|
||||||
WifiManager wifiManager = (WifiManager) appContext.getSystemService(Context.WIFI_SERVICE);
|
WifiManager wifiManager = (WifiManager) appContext.getSystemService(Context.WIFI_SERVICE);
|
||||||
wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, TAG);
|
wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, LOCK_TAG);
|
||||||
wifiLock.acquire();
|
wifiLock.acquire();
|
||||||
PowerManager powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE);
|
||||||
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
|
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOCK_TAG);
|
||||||
wakeLock.acquire();
|
wakeLock.acquire();
|
||||||
super.onStart();
|
super.onStart();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user