diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java b/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java index 0d081e0d2..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); @@ -109,7 +126,7 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver { context.sendBroadcast(updateIntent); } - private static void toggleAppIcon(final Context context) { + public static void toggleAppIcon(final Context context) { final int appInfoFlags = context.getApplicationInfo().flags; final boolean isSystemApp = (appInfoFlags & ApplicationInfo.FLAG_SYSTEM) > 0; if (Log.isLoggable(TAG, Log.INFO)) { |