diff options
author | 2015-05-01 20:10:16 +0000 | |
---|---|---|
committer | 2015-05-01 20:10:16 +0000 | |
commit | bdddc0463596aa6a5e63021bd7a02117506116ce (patch) | |
tree | 80a51f47c1d30e7ac992ef12742687984ec31a9e /java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java | |
parent | 3bb36aab1a4366bf24374a6fa27e11743eecaebc (diff) | |
parent | f22571e2d9756294fa2fa332a395c06010f54d92 (diff) | |
download | latinime-bdddc0463596aa6a5e63021bd7a02117506116ce.tar.gz latinime-bdddc0463596aa6a5e63021bd7a02117506116ce.tar.xz latinime-bdddc0463596aa6a5e63021bd7a02117506116ce.zip |
am f22571e2: Delete history on upgrade in LatinIME.
* commit 'f22571e2d9756294fa2fa332a395c06010f54d92':
Delete history on upgrade in LatinIME.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java b/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java index a093ec6db..26c5e0034 100644 --- a/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java +++ b/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java @@ -29,13 +29,14 @@ import android.util.Log; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; -import com.android.inputmethod.dictionarypack.CommonPreferences; import com.android.inputmethod.dictionarypack.DictionaryPackConstants; import com.android.inputmethod.keyboard.KeyboardLayoutSet; import com.android.inputmethod.latin.settings.Settings; import com.android.inputmethod.latin.setup.SetupActivity; import com.android.inputmethod.latin.utils.UncachedInputMethodManagerUtils; +import java.util.Locale; + /** * This class detects the {@link Intent#ACTION_MY_PACKAGE_REPLACED} broadcast intent when this IME * package has been replaced by a newer version of the same package. This class also detects @@ -76,6 +77,22 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver { richImm.setAdditionalInputMethodSubtypes(additionalSubtypes); toggleAppIcon(context); downloadLatestDictionaries(context); + // TODO: This is only for dogfood builds. Remove this from the final release. + DictionaryFacilitator keyboardFacilitator = + DictionaryFacilitatorProvider.getDictionaryFacilitator(false); + boolean historyCleared = keyboardFacilitator.clearUserHistoryDictionary(context); + Locale keyboardLocale = keyboardFacilitator.getLocale(); + if (historyCleared && keyboardLocale != null) { + keyboardFacilitator.resetDictionaries( + context, + keyboardLocale, + keyboardFacilitator.usesContacts(), + true /* history */, + true /* force */, + keyboardFacilitator.getAccount(), + "" /* prefix */, + null /* listener */); + } } else if (Intent.ACTION_BOOT_COMPLETED.equals(intentAction)) { Log.i(TAG, "Boot has been completed"); toggleAppIcon(context); |