Merge "Fix: NPE when initializing AOSP keyboard."
commit
4c45fff240
|
@ -23,11 +23,14 @@ import android.content.Context;
|
||||||
import com.android.inputmethod.latin.DictionaryFacilitator;
|
import com.android.inputmethod.latin.DictionaryFacilitator;
|
||||||
|
|
||||||
public class PersonalizationDictionaryUpdater {
|
public class PersonalizationDictionaryUpdater {
|
||||||
|
final Context mContext;
|
||||||
|
final DictionaryFacilitator mDictionaryFacilitator;
|
||||||
|
boolean mDictCleared = false;
|
||||||
|
|
||||||
public PersonalizationDictionaryUpdater(final Context context,
|
public PersonalizationDictionaryUpdater(final Context context,
|
||||||
final DictionaryFacilitator dictionaryFacilitator) {
|
final DictionaryFacilitator dictionaryFacilitator) {
|
||||||
// Clear and never update the personalization dictionary.
|
mContext = context;
|
||||||
PersonalizationHelper.removeAllPersonalizationDictionaries(context);
|
mDictionaryFacilitator = dictionaryFacilitator;
|
||||||
dictionaryFacilitator.clearPersonalizationDictionary();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Locale getLocale() {
|
public Locale getLocale() {
|
||||||
|
@ -36,6 +39,12 @@ public class PersonalizationDictionaryUpdater {
|
||||||
|
|
||||||
public void onLoadSettings(final boolean usePersonalizedDicts,
|
public void onLoadSettings(final boolean usePersonalizedDicts,
|
||||||
final boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes) {
|
final boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes) {
|
||||||
|
if (!mDictCleared) {
|
||||||
|
// Clear and never update the personalization dictionary.
|
||||||
|
PersonalizationHelper.removeAllPersonalizationDictionaries(mContext);
|
||||||
|
mDictionaryFacilitator.clearPersonalizationDictionary();
|
||||||
|
mDictCleared = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
|
Loading…
Reference in New Issue