From a0d9c82921022347e44d416bb57810331e35e446 Mon Sep 17 00:00:00 2001 From: Mohammadinamul Sheik Date: Mon, 4 May 2015 11:57:31 -0700 Subject: Make the DictionaryService stage the downloaded files Bug: 20641948 Change-Id: I6639c995b12c033bc30241cd219201dd483ee516 --- .../com/android/inputmethod/dictionarypack/ActionBatch.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (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 09f8032cc..ee5106b5a 100644 --- a/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java +++ b/java/src/com/android/inputmethod/dictionarypack/ActionBatch.java @@ -26,7 +26,9 @@ import android.text.TextUtils; import android.util.Log; import com.android.inputmethod.compat.DownloadManagerCompatUtils; +import com.android.inputmethod.latin.BinaryDictionaryFileDumper; import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.common.LocaleUtils; import com.android.inputmethod.latin.utils.ApplicationUtils; import com.android.inputmethod.latin.utils.DebugLogUtils; @@ -210,9 +212,17 @@ public final class ActionBatch { + " for an InstallAfterDownload action. Bailing out."); return; } + DebugLogUtils.l("Setting word list as installed"); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); MetadataDbHelper.markEntryAsFinishedDownloadingAndInstalled(db, mWordListValues); + + // Install the downloaded file by un-compressing and moving it to the staging + // directory. Ideally, we should do this before updating the DB, but the + // installDictToStagingFromContentProvider() relies on the db being updated. + final String localeString = mWordListValues.getAsString(MetadataDbHelper.LOCALE_COLUMN); + BinaryDictionaryFileDumper.installDictToStagingFromContentProvider( + LocaleUtils.constructLocaleFromString(localeString), context, false); } } -- cgit v1.2.3-83-g751a