Merge "Fix: NPE when initializing AOSP keyboard."

main
Keisuke Kuroyanagi 2014-06-17 02:48:21 +00:00 committed by Android (Google) Code Review
commit 4c45fff240
1 changed files with 12 additions and 3 deletions

View File

@ -23,11 +23,14 @@ import android.content.Context;
import com.android.inputmethod.latin.DictionaryFacilitator;
public class PersonalizationDictionaryUpdater {
final Context mContext;
final DictionaryFacilitator mDictionaryFacilitator;
boolean mDictCleared = false;
public PersonalizationDictionaryUpdater(final Context context,
final DictionaryFacilitator dictionaryFacilitator) {
// Clear and never update the personalization dictionary.
PersonalizationHelper.removeAllPersonalizationDictionaries(context);
dictionaryFacilitator.clearPersonalizationDictionary();
mContext = context;
mDictionaryFacilitator = dictionaryFacilitator;
}
public Locale getLocale() {
@ -36,6 +39,12 @@ public class PersonalizationDictionaryUpdater {
public void onLoadSettings(final boolean usePersonalizedDicts,
final boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes) {
if (!mDictCleared) {
// Clear and never update the personalization dictionary.
PersonalizationHelper.removeAllPersonalizationDictionaries(mContext);
mDictionaryFacilitator.clearPersonalizationDictionary();
mDictCleared = true;
}
}
public void onDestroy() {