Fix some lint warnings

PiperOrigin-RevId: 424383900
This commit is contained in:
olly 2022-01-26 18:26:53 +00:00 committed by Andrew Lewis
parent e58ffc0682
commit 5d7641c6f1
14 changed files with 27 additions and 23 deletions

View File

@ -22,12 +22,14 @@
<uses-sdk/> <uses-sdk/>
<application <application
android:allowBackup="false" android:allowBackup="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/application_name" android:label="@string/application_name"
android:exported="true"> android:exported="true">
<activity android:name=".MainActivity"> <activity
android:name=".MainActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>

View File

@ -14,7 +14,7 @@
apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle" apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
dependencies { dependencies {
api 'com.google.android.gms:play-services-cast-framework:20.1.0' api 'com.google.android.gms:play-services-cast-framework:21.0.1'
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
implementation project(modulePrefix + 'library-common') implementation project(modulePrefix + 'library-common')
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion

View File

@ -20,7 +20,7 @@ android {
} }
dependencies { dependencies {
api "com.google.android.gms:play-services-cronet:17.0.1" api "com.google.android.gms:play-services-cronet:18.0.1"
implementation project(modulePrefix + 'library-common') implementation project(modulePrefix + 'library-common')
implementation project(modulePrefix + 'library-datasource') implementation project(modulePrefix + 'library-datasource')
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion

View File

@ -25,7 +25,7 @@ android {
} }
dependencies { dependencies {
api 'com.google.ads.interactivemedia.v3:interactivemedia:3.25.1' api 'com.google.ads.interactivemedia.v3:interactivemedia:3.26.0'
implementation project(modulePrefix + 'library-core') implementation project(modulePrefix + 'library-core')
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion

View File

@ -924,8 +924,7 @@ public class SessionPlayerConnectorTest {
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1); assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
} }
// TODO(b/168860979): De-flake and re-enable. @Ignore("Internal ref: b/168860979")
@Ignore
@Test @Test
@LargeTest @LargeTest
public void replacePlaylistItem_calledOnlyOnce_notifiesPlaylistChangeOnlyOnce() throws Exception { public void replacePlaylistItem_calledOnlyOnce_notifiesPlaylistChangeOnlyOnce() throws Exception {

View File

@ -100,7 +100,7 @@ public final class HeartRating extends Rating {
private static HeartRating fromBundle(Bundle bundle) { private static HeartRating fromBundle(Bundle bundle) {
checkArgument( checkArgument(
bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_DEFAULT) bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_UNSET)
== TYPE); == TYPE);
boolean isRated = bundle.getBoolean(keyForField(FIELD_RATED), /* defaultValue= */ false); boolean isRated = bundle.getBoolean(keyForField(FIELD_RATED), /* defaultValue= */ false);
return isRated return isRated

View File

@ -96,7 +96,7 @@ public final class PercentageRating extends Rating {
private static PercentageRating fromBundle(Bundle bundle) { private static PercentageRating fromBundle(Bundle bundle) {
checkArgument( checkArgument(
bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_DEFAULT) bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_UNSET)
== TYPE); == TYPE);
float percent = bundle.getFloat(keyForField(FIELD_PERCENT), /* defaultValue= */ RATING_UNSET); float percent = bundle.getFloat(keyForField(FIELD_PERCENT), /* defaultValue= */ RATING_UNSET);
return percent == RATING_UNSET ? new PercentageRating() : new PercentageRating(percent); return percent == RATING_UNSET ? new PercentageRating() : new PercentageRating(percent);

View File

@ -41,7 +41,7 @@ public abstract class Rating implements Bundleable {
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({ @IntDef({
RATING_TYPE_DEFAULT, RATING_TYPE_UNSET,
RATING_TYPE_HEART, RATING_TYPE_HEART,
RATING_TYPE_PERCENTAGE, RATING_TYPE_PERCENTAGE,
RATING_TYPE_STAR, RATING_TYPE_STAR,
@ -49,7 +49,7 @@ public abstract class Rating implements Bundleable {
}) })
/* package */ @interface RatingType {} /* package */ @interface RatingType {}
/* package */ static final int RATING_TYPE_DEFAULT = -1; /* package */ static final int RATING_TYPE_UNSET = -1;
/* package */ static final int RATING_TYPE_HEART = 0; /* package */ static final int RATING_TYPE_HEART = 0;
/* package */ static final int RATING_TYPE_PERCENTAGE = 1; /* package */ static final int RATING_TYPE_PERCENTAGE = 1;
/* package */ static final int RATING_TYPE_STAR = 2; /* package */ static final int RATING_TYPE_STAR = 2;
@ -68,7 +68,7 @@ public abstract class Rating implements Bundleable {
private static Rating fromBundle(Bundle bundle) { private static Rating fromBundle(Bundle bundle) {
@RatingType @RatingType
int ratingType = int ratingType =
bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_DEFAULT); bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_UNSET);
switch (ratingType) { switch (ratingType) {
case RATING_TYPE_HEART: case RATING_TYPE_HEART:
return HeartRating.CREATOR.fromBundle(bundle); return HeartRating.CREATOR.fromBundle(bundle);
@ -78,8 +78,9 @@ public abstract class Rating implements Bundleable {
return StarRating.CREATOR.fromBundle(bundle); return StarRating.CREATOR.fromBundle(bundle);
case RATING_TYPE_THUMB: case RATING_TYPE_THUMB:
return ThumbRating.CREATOR.fromBundle(bundle); return ThumbRating.CREATOR.fromBundle(bundle);
case RATING_TYPE_UNSET:
default: default:
throw new IllegalArgumentException("Encountered unknown rating type: " + ratingType); throw new IllegalArgumentException("Unknown RatingType: " + ratingType);
} }
} }

View File

@ -125,7 +125,7 @@ public final class StarRating extends Rating {
private static StarRating fromBundle(Bundle bundle) { private static StarRating fromBundle(Bundle bundle) {
checkArgument( checkArgument(
bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_DEFAULT) bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_UNSET)
== TYPE); == TYPE);
int maxStars = int maxStars =
bundle.getInt(keyForField(FIELD_MAX_STARS), /* defaultValue= */ MAX_STARS_DEFAULT); bundle.getInt(keyForField(FIELD_MAX_STARS), /* defaultValue= */ MAX_STARS_DEFAULT);

View File

@ -97,7 +97,7 @@ public final class ThumbRating extends Rating {
private static ThumbRating fromBundle(Bundle bundle) { private static ThumbRating fromBundle(Bundle bundle) {
checkArgument( checkArgument(
bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_DEFAULT) bundle.getInt(keyForField(FIELD_RATING_TYPE), /* defaultValue= */ RATING_TYPE_UNSET)
== TYPE); == TYPE);
boolean rated = bundle.getBoolean(keyForField(FIELD_RATED), /* defaultValue= */ false); boolean rated = bundle.getBoolean(keyForField(FIELD_RATED), /* defaultValue= */ false);
return rated return rated

View File

@ -2405,6 +2405,8 @@ public final class Util {
return "camera motion"; return "camera motion";
case C.TRACK_TYPE_NONE: case C.TRACK_TYPE_NONE:
return "none"; return "none";
case C.TRACK_TYPE_UNKNOWN:
return "unknown";
default: default:
return trackType >= C.TRACK_TYPE_CUSTOM_BASE ? "custom (" + trackType + ")" : "?"; return trackType >= C.TRACK_TYPE_CUSTOM_BASE ? "custom (" + trackType + ")" : "?";
} }

View File

@ -109,8 +109,7 @@ public class DownloadManagerDashTest {
testThread.release(); testThread.release();
} }
// Disabled due to flakiness. @Ignore("Disabled due to flakiness")
@Ignore
@Test @Test
public void saveAndLoadActionFile() throws Throwable { public void saveAndLoadActionFile() throws Throwable {
// Configure fakeDataSet to block until interrupted when TEST_MPD is read. // Configure fakeDataSet to block until interrupted when TEST_MPD is read.

View File

@ -157,7 +157,7 @@ public class DownloadServiceDashTest {
testThread.release(); testThread.release();
} }
@Ignore // b/78877092 @Ignore("Internal ref: b/78877092")
@Test @Test
public void multipleDownloadRequest() throws Throwable { public void multipleDownloadRequest() throws Throwable {
downloadKeys(fakeStreamKey1); downloadKeys(fakeStreamKey1);
@ -168,7 +168,7 @@ public class DownloadServiceDashTest {
assertCachedData(cache, fakeDataSet); assertCachedData(cache, fakeDataSet);
} }
@Ignore // b/78877092 @Ignore("Internal ref: b/78877092")
@Test @Test
public void removeAction() throws Throwable { public void removeAction() throws Throwable {
downloadKeys(fakeStreamKey1, fakeStreamKey2); downloadKeys(fakeStreamKey1, fakeStreamKey2);
@ -182,7 +182,7 @@ public class DownloadServiceDashTest {
assertCacheEmpty(cache); assertCacheEmpty(cache);
} }
@Ignore // b/78877092 @Ignore("Internal ref: b/78877092")
@Test @Test
public void removeBeforeDownloadComplete() throws Throwable { public void removeBeforeDownloadComplete() throws Throwable {
pauseDownloadCondition = new ConditionVariable(); pauseDownloadCondition = new ConditionVariable();

View File

@ -1478,6 +1478,7 @@ public class PlayerNotificationManager {
return actions; return actions;
} }
@SuppressWarnings("UnspecifiedImmutableFlag") // Warning is spurious.
private static PendingIntent createBroadcastIntent( private static PendingIntent createBroadcastIntent(
String action, Context context, int instanceId) { String action, Context context, int instanceId) {
Intent intent = new Intent(action).setPackage(context.getPackageName()); Intent intent = new Intent(action).setPackage(context.getPackageName());