Clean up some lint warnings

PiperOrigin-RevId: 331162350
This commit is contained in:
olly 2020-09-11 17:27:56 +01:00 committed by Oliver Woodman
parent 99cdf2ca4d
commit bff7ac0dbe
6 changed files with 53 additions and 51 deletions

View File

@ -60,7 +60,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:' + androidxAppCompatVersion
implementation 'androidx.multidex:multidex:' + androidxMultidexVersion
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.material:material:1.2.1'
}
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'

View File

@ -69,7 +69,7 @@ dependencies {
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
implementation 'androidx.appcompat:appcompat:' + androidxAppCompatVersion
implementation 'androidx.multidex:multidex:' + androidxMultidexVersion
implementation 'com.google.android.material:material:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation ('com.google.guava:guava:' + guavaVersion) {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'org.checkerframework', module: 'checker-compat-qual'

View File

@ -222,7 +222,11 @@ public class DownloadTracker {
}
widevineOfflineLicenseFetchTask =
new WidevineOfflineLicenseFetchTask(
format, mediaItem.playbackProperties.drmConfiguration.licenseUri, this, helper);
format,
mediaItem.playbackProperties.drmConfiguration.licenseUri,
httpDataSourceFactory,
/* dialogHelper= */ this,
helper);
widevineOfflineLicenseFetchTask.execute();
}
@ -271,6 +275,32 @@ public class DownloadTracker {
// Internal methods.
/**
* Returns the first {@link Format} with a non-null {@link Format#drmInitData} found in the
* content's tracks, or null if none is found.
*/
@Nullable
private Format getFirstFormatWithDrmInitData(DownloadHelper helper) {
for (int periodIndex = 0; periodIndex < helper.getPeriodCount(); periodIndex++) {
MappedTrackInfo mappedTrackInfo = helper.getMappedTrackInfo(periodIndex);
for (int rendererIndex = 0;
rendererIndex < mappedTrackInfo.getRendererCount();
rendererIndex++) {
TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(rendererIndex);
for (int trackGroupIndex = 0; trackGroupIndex < trackGroups.length; trackGroupIndex++) {
TrackGroup trackGroup = trackGroups.get(trackGroupIndex);
for (int formatIndex = 0; formatIndex < trackGroup.length; formatIndex++) {
Format format = trackGroup.getFormat(formatIndex);
if (format.drmInitData != null) {
return format;
}
}
}
}
}
return null;
}
private void onOfflineLicenseFetched(DownloadHelper helper, byte[] keySetId) {
this.keySetId = keySetId;
onDownloadPrepared(helper);
@ -309,6 +339,19 @@ public class DownloadTracker {
trackSelectionDialog.show(fragmentManager, /* tag= */ null);
}
/**
* Returns whether any the {@link DrmInitData.SchemeData} contained in {@code drmInitData} has
* non-null {@link DrmInitData.SchemeData#data}.
*/
private boolean hasSchemaData(DrmInitData drmInitData) {
for (int i = 0; i < drmInitData.schemeDataCount; i++) {
if (drmInitData.get(i).hasData()) {
return true;
}
}
return false;
}
private void startDownload() {
startDownload(buildDownloadRequest());
}
@ -327,9 +370,11 @@ public class DownloadTracker {
/** Downloads a Widevine offline license in a background thread. */
@RequiresApi(18)
private final class WidevineOfflineLicenseFetchTask extends AsyncTask<Void, Void, Void> {
private static final class WidevineOfflineLicenseFetchTask extends AsyncTask<Void, Void, Void> {
private final Format format;
private final Uri licenseUri;
private final HttpDataSource.Factory httpDataSourceFactory;
private final StartDownloadDialogHelper dialogHelper;
private final DownloadHelper downloadHelper;
@ -339,10 +384,12 @@ public class DownloadTracker {
public WidevineOfflineLicenseFetchTask(
Format format,
Uri licenseUri,
HttpDataSource.Factory httpDataSourceFactory,
StartDownloadDialogHelper dialogHelper,
DownloadHelper downloadHelper) {
this.format = format;
this.licenseUri = licenseUri;
this.httpDataSourceFactory = httpDataSourceFactory;
this.dialogHelper = dialogHelper;
this.downloadHelper = downloadHelper;
}
@ -373,43 +420,4 @@ public class DownloadTracker {
}
}
}
/**
* Returns whether any the {@link DrmInitData.SchemeData} contained in {@code drmInitData} has
* non-null {@link DrmInitData.SchemeData#data}.
*/
private static boolean hasSchemaData(DrmInitData drmInitData) {
for (int i = 0; i < drmInitData.schemeDataCount; i++) {
if (drmInitData.get(i).hasData()) {
return true;
}
}
return false;
}
/**
* Returns the first {@link Format} with a non-null {@link Format#drmInitData} found in the
* content's tracks, or null if none is found.
*/
@Nullable
private Format getFirstFormatWithDrmInitData(DownloadHelper helper) {
for (int periodIndex = 0; periodIndex < helper.getPeriodCount(); periodIndex++) {
MappedTrackInfo mappedTrackInfo = helper.getMappedTrackInfo(periodIndex);
for (int rendererIndex = 0;
rendererIndex < mappedTrackInfo.getRendererCount();
rendererIndex++) {
TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(rendererIndex);
for (int trackGroupIndex = 0; trackGroupIndex < trackGroups.length; trackGroupIndex++) {
TrackGroup trackGroup = trackGroups.get(trackGroupIndex);
for (int formatIndex = 0; formatIndex < trackGroup.length; formatIndex++) {
Format format = trackGroup.getFormat(formatIndex);
if (format.drmInitData != null) {
return format;
}
}
}
}
}
return null;
}
}

View File

@ -25,16 +25,10 @@
<string name="error_generic">Playback failed</string>
<string name="error_unrecognized_abr_algorithm">Unrecognized ABR algorithm</string>
<string name="error_unrecognized_stereo_mode">Unrecognized stereo mode</string>
<string name="error_drm_unsupported_before_api_18">DRM content not supported on API levels below 18</string>
<string name="error_drm_unsupported_scheme">This device does not support the required DRM scheme</string>
<string name="error_drm_unknown">An unknown DRM error occurred</string>
<string name="error_no_decoder">This device does not provide a decoder for <xliff:g id="mime_type">%1$s</xliff:g></string>
<string name="error_no_secure_decoder">This device does not provide a secure decoder for <xliff:g id="mime_type">%1$s</xliff:g></string>

View File

@ -18,7 +18,7 @@ android.defaultConfig.minSdkVersion 19
dependencies {
implementation project(modulePrefix + 'library-core')
implementation 'androidx.collection:collection:' + androidxCollectionVersion
implementation 'androidx.concurrent:concurrent-futures:1.0.0'
implementation 'androidx.concurrent:concurrent-futures:1.1.0'
implementation ('com.google.guava:guava:' + guavaVersion) {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'org.checkerframework', module: 'checker-compat-qual'

View File

@ -17,7 +17,7 @@ apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
dependencies {
implementation project(modulePrefix + 'library-core')
implementation 'androidx.work:work-runtime:2.3.4'
implementation 'androidx.work:work-runtime:2.4.0'
// Guava & Gradle interact badly, and this prevents
// "cannot access ListenableFuture" errors [internal b/157225611].
// More info: https://blog.gradle.org/guava