diff options
author | 2013-04-25 17:16:03 +0900 | |
---|---|---|
committer | 2013-04-25 18:52:39 +0900 | |
commit | 43590149a5c2073a9fc8e3ed6afbf21fb017193e (patch) | |
tree | 25b064ac21c12863a79dc05fc1f1834d0a271b56 /java/src/com/android/inputmethod/dictionarypack/ActionBatch.java | |
parent | 4dc77dcf4c1f704c2f6b32222a74d673afec8794 (diff) | |
download | latinime-43590149a5c2073a9fc8e3ed6afbf21fb017193e.tar.gz latinime-43590149a5c2073a9fc8e3ed6afbf21fb017193e.tar.xz latinime-43590149a5c2073a9fc8e3ed6afbf21fb017193e.zip |
Work around a bug in older DownloadManager versions.
This adds a number to the extension.
Note that for DownloadManager to keep this, the server
needs to send it a mime type it does not recognize. Right
now, it does not recognize application/json so it's okay,
but we'd do well to remove the content/type header from
the server to prevent problems.
Bug: 8467516
Change-Id: Ic484f66ac3f67c36f59f2c0bcb8c7fdeb6e8590d
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack/ActionBatch.java')
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/ActionBatch.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java b/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java index faf5d3c87..a9d799218 100644 --- a/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java +++ b/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java @@ -138,7 +138,12 @@ public final class ActionBatch { if (null == manager) return; // This is an upgraded word list: we should download it. - final Uri uri = Uri.parse(mWordList.mRemoteFilename); + // Adding a disambiguator to circumvent a bug in older versions of DownloadManager. + // DownloadManager also stupidly cuts the extension to replace with its own that it + // gets from the content-type. We need to circumvent this. + final String disambiguator = "#" + System.currentTimeMillis() + + com.android.inputmethod.latin.Utils.getVersionName(context) + ".dict"; + final Uri uri = Uri.parse(mWordList.mRemoteFilename + disambiguator); final Request request = new Request(uri); final Resources res = context.getResources(); |