From dcb8417a3c6a18e636be07c44d21eddf98208639 Mon Sep 17 00:00:00 2001 From: eguven Date: Wed, 17 Apr 2019 09:30:25 +0100 Subject: [PATCH] Assert customCacheKey is null for DASH, HLS and SmoothStreaming downloads PiperOrigin-RevId: 243954989 --- .../exoplayer2/offline/DownloadRequest.java | 9 ++++++++- .../action_file_for_download_index_upgrade.exi | Bin 161 -> 161 bytes .../offline/ActionFileUpgradeUtilTest.java | 12 ++++++------ .../exoplayer2/offline/DownloadRequestTest.java | 5 +++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadRequest.java b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadRequest.java index 5acefd6f93..7ff43ceacd 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadRequest.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadRequest.java @@ -52,7 +52,10 @@ public final class DownloadRequest implements Parcelable { public final Uri uri; /** Stream keys to be downloaded. If empty, all streams will be downloaded. */ public final List streamKeys; - /** Custom key for cache indexing, or null. */ + /** + * Custom key for cache indexing, or null. Must be null for DASH, HLS and SmoothStreaming + * downloads. + */ @Nullable public final String customCacheKey; /** Application defined data associated with the download. May be empty. */ public final byte[] data; @@ -72,6 +75,10 @@ public final class DownloadRequest implements Parcelable { List streamKeys, @Nullable String customCacheKey, @Nullable byte[] data) { + if (TYPE_DASH.equals(type) || TYPE_HLS.equals(type) || TYPE_SS.equals(type)) { + Assertions.checkArgument( + customCacheKey == null, "customCacheKey must be null for type: " + type); + } this.id = id; this.type = type; this.uri = uri; diff --git a/library/core/src/test/assets/offline/action_file_for_download_index_upgrade.exi b/library/core/src/test/assets/offline/action_file_for_download_index_upgrade.exi index 888ba4af4467a3d7a0077afad8ea24bbd48f8be0..0bf49b133a1c91e9542671bad37539141a8f953d 100644 GIT binary patch delta 33 ecmZ3;xR8;L0Ros9SV~fhOD6JpKxyTPwJHE