From 3bc3bc7971f15438732933cfac0db6e766e6a3e9 Mon Sep 17 00:00:00 2001 From: Mohammadinamul Sheik Date: Tue, 24 Mar 2015 14:56:54 -0700 Subject: Force download the dictionaries after the apk package is updated. - Also display the notification when the dictionaries are auto updated Bug: 19808828 Change-Id: If5c4efb73d8bb554d812afcf7deafec3ac40a462 --- .../com/android/inputmethod/latin/SystemBroadcastReceiver.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java') diff --git a/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java b/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java index 5c3abd2db..2a69d3650 100644 --- a/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java +++ b/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java @@ -27,6 +27,8 @@ 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.setup.SetupActivity; import com.android.inputmethod.latin.utils.UncachedInputMethodManagerUtils; @@ -70,6 +72,7 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver { final InputMethodSubtype[] additionalSubtypes = richImm.getAdditionalSubtypes(); richImm.setAdditionalInputMethodSubtypes(additionalSubtypes); toggleAppIcon(context); + downloadLatestDictionaries(context); } else if (Intent.ACTION_BOOT_COMPLETED.equals(intentAction)) { Log.i(TAG, "Boot has been completed"); toggleAppIcon(context); @@ -97,6 +100,12 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver { } } + private void downloadLatestDictionaries(Context context) { + final Intent updateIntent = new Intent( + DictionaryPackConstants.INIT_AND_UPDATE_NOW_INTENT_ACTION); + context.sendBroadcast(updateIntent); + } + private static void toggleAppIcon(final Context context) { final int appInfoFlags = context.getApplicationInfo().flags; final boolean isSystemApp = (appInfoFlags & ApplicationInfo.FLAG_SYSTEM) > 0; -- cgit v1.2.3-83-g751a