Fix minor issues and lint errors

PiperOrigin-RevId: 233428556
This commit is contained in:
olly 2019-02-11 18:04:02 +00:00 committed by Andrew Lewis
parent 6a7157de11
commit a21572f0dd
19 changed files with 43 additions and 33 deletions

View File

@ -44,8 +44,8 @@ android {
}
lintOptions {
// The demo app does not have translations.
disable 'MissingTranslation'
// The demo app isn't indexed and doesn't have translations.
disable 'GoogleAppIndexingWarning','MissingTranslation'
}
}

View File

@ -150,8 +150,11 @@ public class MainActivity extends AppCompatActivity
@Override
public void onClick(View view) {
new AlertDialog.Builder(this).setTitle(R.string.sample_list_dialog_title)
.setView(buildSampleListView()).setPositiveButton(android.R.string.ok, null).create()
new AlertDialog.Builder(this)
.setTitle(R.string.add_samples)
.setView(buildSampleListView())
.setPositiveButton(android.R.string.ok, null)
.create()
.show();
}

View File

@ -40,7 +40,8 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:padding="30dp"/>
android:padding="30dp"
android:contentDescription="@string/add_samples"/>
</RelativeLayout>
<com.google.android.exoplayer2.ui.PlayerControlView android:id="@+id/cast_control_view"
android:layout_width="match_parent"

View File

@ -20,7 +20,7 @@
<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>

View File

@ -41,8 +41,8 @@ android {
}
lintOptions {
// The demo app does not have translations.
disable 'MissingTranslation'
// The demo app isn't indexed and doesn't have translations.
disable 'GoogleAppIndexingWarning','MissingTranslation'
}
}

View File

@ -44,8 +44,9 @@ android {
}
lintOptions {
// The demo app does not have translations.
disable 'MissingTranslation'
// The demo app isn't indexed, doesn't have translations, and has a
// banner for AndroidTV that's only in xhdpi density.
disable 'GoogleAppIndexingWarning','MissingTranslation','IconDensities'
}
flavorDimensions "extensions"

View File

@ -15,6 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.google.android.exoplayer2.demo">
<uses-permission android:name="android.permission.INTERNET"/>
@ -33,7 +34,8 @@
android:banner="@drawable/ic_banner"
android:largeHeap="true"
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"
android:configChanges="keyboardHidden"

View File

@ -29,7 +29,7 @@ android {
}
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 'com.android.support:support-annotations:' + supportLibraryVersion
testImplementation project(modulePrefix + 'library')

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.ext.gvr;
import android.content.Context;

View File

@ -13,13 +13,14 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_ui_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000"
android:orientation="horizontal">
android:background="@android:color/black"
android:orientation="horizontal"
tools:ignore="Overdraw">
<com.google.android.exoplayer2.ui.PlayerControlView
android:id="@+id/controller"
android:layout_width="match_parent"

View File

@ -32,11 +32,11 @@ android {
dependencies {
api 'com.google.ads.interactivemedia.v3:interactivemedia:3.10.6'
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
// com.android.support:support-v4 and com.android.support:customtabs to be
// 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
implementation 'com.android.support:support-v4:' + supportLibraryVersion
implementation 'com.android.support:customtabs:' + supportLibraryVersion

View File

@ -30,7 +30,7 @@ android {
dependencies {
implementation project(modulePrefix + 'library-core')
implementation('com.android.support:leanback-v17:' + supportLibraryVersion)
implementation 'com.android.support:leanback-v17:' + supportLibraryVersion
}
ext {

View File

@ -15,7 +15,6 @@
*/
package com.google.android.exoplayer2.extractor.ogg;
import android.support.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.extractor.ExtractorInput;
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
* to be populated.
*/
@VisibleForTesting
public OggPageHeader getPageHeader() {
return pageHeader;
}

View File

@ -247,8 +247,11 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
case Cue.ANCHOR_TYPE_MIDDLE:
return SubripDecoder.MID_FRACTION;
case Cue.ANCHOR_TYPE_END:
default:
return SubripDecoder.END_FRACTION;
case Cue.TYPE_UNSET:
default:
// Should never happen.
throw new IllegalArgumentException();
}
}
}

View File

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.upstream.cache;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@ -294,6 +295,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
return cachedContent;
}
@SuppressLint("GetInstance") // Suppress warning about specifying "BC" as an explicit provider.
private static Cipher getCipher() throws NoSuchPaddingException, NoSuchAlgorithmException {
// Workaround for https://issuetracker.google.com/issues/36976726
if (Util.SDK_INT == 18) {

View File

@ -597,10 +597,10 @@ public final class SimpleCache implements Cache {
return createUid(directory);
}
@SuppressWarnings("TrulyRandom")
private static long createUid(File directory) throws IOException {
SecureRandom random = new SecureRandom();
// Generate a non-negative UID.
long uid = random.nextLong();
long uid = new SecureRandom().nextLong();
uid = uid == Long.MIN_VALUE ? 0 : Math.abs(uid);
// Persist it as a file.
String hexUid = Long.toString(uid, /* radix= */ 16);

View File

@ -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.assertWithMessage;
import android.util.LongSparseArray;
import com.google.android.exoplayer2.testutil.TestUtil;
import com.google.android.exoplayer2.util.Util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Set;
import java.util.TreeSet;
import org.junit.After;
@ -112,7 +112,7 @@ public class SimpleCacheSpanTest {
TreeSet<SimpleCacheSpan> spans = index.get(key).getSpans();
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) {
SimpleCacheSpan cacheSpan = SimpleCacheSpan.createCacheEntry(file, file.length(), index);
if (cacheSpan != null) {
@ -121,9 +121,9 @@ public class SimpleCacheSpanTest {
}
}
assertThat(cachedPositions.get((long) 0)).isEqualTo(1);
assertThat(cachedPositions.get((long) 1)).isEqualTo(2);
assertThat(cachedPositions.get((long) 5)).isEqualTo(6);
assertThat(cachedPositions.get(0)).isEqualTo(1);
assertThat(cachedPositions.get(1)).isEqualTo(2);
assertThat(cachedPositions.get(5)).isEqualTo(6);
}
private static void createTestFile(File file, long length) throws IOException {

View File

@ -403,7 +403,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
surfaceView = new TextureView(context);
break;
case SURFACE_TYPE_MONO360_VIEW:
Assertions.checkState(Util.SDK_INT >= 15);
SphericalSurfaceView sphericalSurfaceView = new SphericalSurfaceView(context);
sphericalSurfaceView.setSurfaceListener(componentListener);
sphericalSurfaceView.setSingleTapListener(componentListener);

View File

@ -80,6 +80,7 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
}
private static final String TAG = "HostActivity";
private static final String LOCK_TAG = "ExoPlayerTestUtil:" + TAG;
private static final long START_TIMEOUT_MS = 5000;
private WakeLock wakeLock;
@ -175,10 +176,10 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
public void onStart() {
Context appContext = getApplicationContext();
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();
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();
super.onStart();
}