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 497f55a4bb
commit d2cc14a98b
15 changed files with 36 additions and 47 deletions

View File

@ -21,15 +21,14 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Media3Demo">
<activity
android:name=".MainActivity"
android:exported="true">
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -37,18 +36,16 @@
</activity>
<activity
android:name=".PlayerActivity"
android:exported="true">
</activity>
android:name=".PlayerActivity"
android:exported="true"/>
<activity
android:name=".PlayableFolderActivity"
android:exported="true">
</activity>
android:name=".PlayableFolderActivity"
android:exported="true"/>
<service
android:name=".PlaybackService"
android:exported="true">
android:name=".PlaybackService"
android:exported="true">
<intent-filter>
<action android:name="androidx.media3.session.MediaSessionService"/>
<action android:name="android.media.browse.MediaBrowserService"/>

View File

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

View File

@ -14,7 +14,7 @@
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
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 project(modulePrefix + 'lib-common')
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion

View File

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

View File

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

View File

@ -42,7 +42,7 @@ public abstract class Rating implements Bundleable {
@Documented
@Retention(RetentionPolicy.SOURCE)
@IntDef({
RATING_TYPE_DEFAULT,
RATING_TYPE_UNSET,
RATING_TYPE_HEART,
RATING_TYPE_PERCENTAGE,
RATING_TYPE_STAR,
@ -50,7 +50,7 @@ public abstract class Rating implements Bundleable {
})
/* 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_PERCENTAGE = 1;
/* package */ static final int RATING_TYPE_STAR = 2;
@ -69,7 +69,7 @@ public abstract class Rating implements Bundleable {
private static Rating fromBundle(Bundle bundle) {
@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) {
case RATING_TYPE_HEART:
return HeartRating.CREATOR.fromBundle(bundle);
@ -79,8 +79,9 @@ public abstract class Rating implements Bundleable {
return StarRating.CREATOR.fromBundle(bundle);
case RATING_TYPE_THUMB:
return ThumbRating.CREATOR.fromBundle(bundle);
case RATING_TYPE_UNSET:
default:
throw new IllegalArgumentException("Encountered unknown rating type: " + ratingType);
throw new IllegalArgumentException("Unknown RatingType: " + ratingType);
}
}

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ android {
}
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 + 'lib-common')
implementation project(modulePrefix + 'lib-datasource')
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion

View File

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

View File

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

View File

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

View File

@ -251,9 +251,7 @@ public class MediaStyleNotificationHelper {
if (!tombstone) {
button.setOnClickPendingIntent(androidx.media.R.id.action0, action.getActionIntent());
}
if (Build.VERSION.SDK_INT >= 15) {
Api15Impl.setContentDescription(button, androidx.media.R.id.action0, action.getTitle());
}
button.setContentDescription(androidx.media.R.id.action0, action.getTitle());
return button;
}
@ -474,17 +472,6 @@ public class MediaStyleNotificationHelper {
}
}
@RequiresApi(15)
private static class Api15Impl {
private Api15Impl() {}
@DoNotInline
public static void setContentDescription(
RemoteViews remoteViews, int viewId, @Nullable CharSequence contentDescription) {
remoteViews.setContentDescription(viewId, contentDescription);
}
}
@RequiresApi(21)
private static class Api21Impl {
private Api21Impl() {}

View File

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