From 43590149a5c2073a9fc8e3ed6afbf21fb017193e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 25 Apr 2013 17:16:03 +0900 Subject: 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 --- java/src/com/android/inputmethod/dictionarypack/ActionBatch.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/dictionarypack/ActionBatch.java') 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(); -- cgit v1.2.3-83-g751a