diff options
Diffstat (limited to 'core/java/android/net/DownloadManager.java')
-rw-r--r-- | core/java/android/net/DownloadManager.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/net/DownloadManager.java b/core/java/android/net/DownloadManager.java index 02b6210..00b6864 100644 --- a/core/java/android/net/DownloadManager.java +++ b/core/java/android/net/DownloadManager.java @@ -350,8 +350,7 @@ public class DownloadManager { } if (!mRequestHeaders.isEmpty()) { - // TODO request headers support - throw new UnsupportedOperationException(); + encodeHttpHeaders(values); } putIfNonNull(values, Downloads.COLUMN_TITLE, mTitle); @@ -367,6 +366,15 @@ public class DownloadManager { return values; } + private void encodeHttpHeaders(ContentValues values) { + int index = 0; + for (Map.Entry<String, String> entry : mRequestHeaders.entrySet()) { + String headerString = entry.getKey() + ": " + entry.getValue(); + values.put(Downloads.Impl.RequestHeaders.INSERT_KEY_PREFIX + index, headerString); + index++; + } + } + private void putIfNonNull(ContentValues contentValues, String key, String value) { if (value != null) { contentValues.put(key, value); |