aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java14
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFactory.java25
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java162
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java18
-rw-r--r--java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java53
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java16
6 files changed, 164 insertions, 124 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index ab9edb110..18a9e3ab1 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -61,16 +61,26 @@ public class BinaryDictionary extends Dictionary {
public static final Flag FLAG_REQUIRES_GERMAN_UMLAUT_PROCESSING =
new Flag(R.bool.config_require_umlaut_processing, 0x1);
+ // FULL_EDIT_DISTANCE is a flag that forces the dictionary to use full words
+ // when computing edit distance, instead of the default behavior of stopping
+ // the evaluation at the size the user typed.
public static final Flag FLAG_USE_FULL_EDIT_DISTANCE = new Flag(0x2);
// Can create a new flag from extravalue :
// public static final Flag FLAG_MYFLAG =
// new Flag("my_flag", 0x02);
- private static final Flag[] ALL_FLAGS = {
+ // ALL_CONFIG_FLAGS is a collection of flags that enable reading all flags from configuration.
+ // This is but a mask - it does not mean the flags will be on, only that the configuration
+ // will be read for this particular flag.
+ public static final Flag[] ALL_CONFIG_FLAGS = {
// Here should reside all flags that trigger some special processing
// These *must* match the definition in UnigramDictionary enum in
// unigram_dictionary.h so please update both at the same time.
+ // Please note that flags created with a resource are of type CONFIG while flags
+ // created with a string are of type EXTRAVALUE. These behave like masks, and the
+ // actual value will be read from the configuration/extra value at run time for
+ // the configuration at dictionary creation time.
FLAG_REQUIRES_GERMAN_UMLAUT_PROCESSING,
};
@@ -93,7 +103,7 @@ public class BinaryDictionary extends Dictionary {
// the Suggest class knows everything about every single dictionary.
mDicTypeId = Suggest.DIC_MAIN;
// TODO: Stop relying on the state of SubtypeSwitcher, get it as a parameter
- mFlags = Flag.initFlags(null == flagArray ? ALL_FLAGS : flagArray, context,
+ mFlags = Flag.initFlags(null == flagArray ? ALL_CONFIG_FLAGS : flagArray, context,
SubtypeSwitcher.getInstance());
loadDictionary(filename, offset, length);
}
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
index dfaad26bc..1607f86a8 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
@@ -34,7 +34,7 @@ public class DictionaryFactory {
private static String TAG = DictionaryFactory.class.getSimpleName();
/**
- * Initializes a dictionary from a dictionary pack.
+ * Initializes a dictionary from a dictionary pack, with explicit flags.
*
* This searches for a content provider providing a dictionary pack for the specified
* locale. If none is found, it falls back to using the resource passed as fallBackResId
@@ -42,10 +42,11 @@ public class DictionaryFactory {
* @param context application context for reading resources
* @param locale the locale for which to create the dictionary
* @param fallbackResId the id of the resource to use as a fallback if no pack is found
+ * @param flagArray an array of flags to use
* @return an initialized instance of DictionaryCollection
*/
- public static DictionaryCollection createDictionaryFromManager(Context context, Locale locale,
- int fallbackResId) {
+ public static DictionaryCollection createDictionaryFromManager(final Context context,
+ final Locale locale, final int fallbackResId, final Flag[] flagArray) {
if (null == locale) {
Log.e(TAG, "No locale defined for dictionary");
return new DictionaryCollection(createBinaryDictionary(context, fallbackResId, locale));
@@ -57,7 +58,7 @@ public class DictionaryFactory {
if (null != assetFileList) {
for (final AssetFileAddress f : assetFileList) {
final BinaryDictionary binaryDictionary =
- new BinaryDictionary(context, f.mFilename, f.mOffset, f.mLength, null);
+ new BinaryDictionary(context, f.mFilename, f.mOffset, f.mLength, flagArray);
if (binaryDictionary.isValidDictionary()) {
dictList.add(binaryDictionary);
}
@@ -71,6 +72,22 @@ public class DictionaryFactory {
}
/**
+ * Initializes a dictionary from a dictionary pack, with default flags.
+ *
+ * This searches for a content provider providing a dictionary pack for the specified
+ * locale. If none is found, it falls back to using the resource passed as fallBackResId
+ * as a dictionary.
+ * @param context application context for reading resources
+ * @param locale the locale for which to create the dictionary
+ * @param fallbackResId the id of the resource to use as a fallback if no pack is found
+ * @return an initialized instance of DictionaryCollection
+ */
+ public static DictionaryCollection createDictionaryFromManager(final Context context,
+ final Locale locale, final int fallbackResId) {
+ return createDictionaryFromManager(context, locale, fallbackResId, null);
+ }
+
+ /**
* Initializes a dictionary from a raw resource file
* @param context application context for reading resources
* @param resId the resource containing the raw binary dictionary
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index cf1cb8f25..dfb4d0622 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -65,7 +65,6 @@ import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
-import com.android.inputmethod.keyboard.KeyboardSwitcher.KeyboardLayoutState;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboard;
import com.android.inputmethod.keyboard.LatinKeyboardView;
@@ -132,9 +131,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Key events coming any faster than this are long-presses.
private static final int QUICK_PRESS = 200;
- private static final int START_INPUT_VIEW_DELAY_WHEN_SCREEN_ORIENTATION_STARTED = 10;
- private static final int ACCUMULATE_START_INPUT_VIEW_DELAY = 20;
- private static final int RESTORE_KEYBOARD_STATE_DELAY = 500;
+ private static final int PENDING_IMS_CALLBACK_DURATION = 800;
/**
* The name of the scheme used by the Package Manager to warn of a new package installation,
@@ -239,10 +236,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private static final int MSG_DISMISS_LANGUAGE_ON_SPACEBAR = 5;
private static final int MSG_SPACE_TYPED = 6;
private static final int MSG_SET_BIGRAM_PREDICTIONS = 7;
- private static final int MSG_START_ORIENTATION_CHANGE = 8;
- private static final int MSG_START_INPUT_VIEW = 9;
- private static final int MSG_DISPLAY_COMPLETIONS = 10;
- private static final int MSG_RESTORE_KEYBOARD_LAYOUT = 11;
+ private static final int MSG_PENDING_IMS_CALLBACK = 8;
public UIHandler(LatinIME outerInstance) {
super(outerInstance);
@@ -291,16 +285,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
(LatinKeyboard)msg.obj);
}
break;
- case MSG_START_INPUT_VIEW:
- latinIme.onStartInputView((EditorInfo)msg.obj, false);
- break;
- case MSG_DISPLAY_COMPLETIONS:
- latinIme.onDisplayCompletions((CompletionInfo[])msg.obj);
- break;
- case MSG_RESTORE_KEYBOARD_LAYOUT:
- removeMessages(MSG_UPDATE_SHIFT_STATE);
- ((KeyboardLayoutState)msg.obj).restore();
- break;
}
}
@@ -391,47 +375,89 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return hasMessages(MSG_SPACE_TYPED);
}
- public void postRestoreKeyboardLayout() {
- final LatinIME latinIme = getOuterInstance();
- final KeyboardLayoutState state = latinIme.mKeyboardSwitcher.getKeyboardState();
- if (state.isValid()) {
- removeMessages(MSG_RESTORE_KEYBOARD_LAYOUT);
- sendMessageDelayed(
- obtainMessage(MSG_RESTORE_KEYBOARD_LAYOUT, state),
- RESTORE_KEYBOARD_STATE_DELAY);
- }
- }
+ // Working variables for the following methods.
+ private boolean mIsOrientationChanging;
+ private boolean mPendingSuccesiveImsCallback;
+ private boolean mHasPendingStartInput;
+ private boolean mHasPendingFinishInputView;
+ private boolean mHasPendingFinishInput;
public void startOrientationChanging() {
- sendMessageDelayed(obtainMessage(MSG_START_ORIENTATION_CHANGE),
- START_INPUT_VIEW_DELAY_WHEN_SCREEN_ORIENTATION_STARTED);
+ mIsOrientationChanging = true;
final LatinIME latinIme = getOuterInstance();
- latinIme.mKeyboardSwitcher.getKeyboardState().save();
- postRestoreKeyboardLayout();
+ latinIme.mKeyboardSwitcher.saveKeyboardState();
}
- public boolean postStartInputView(EditorInfo attribute) {
- if (hasMessages(MSG_START_ORIENTATION_CHANGE) || hasMessages(MSG_START_INPUT_VIEW)) {
- removeMessages(MSG_START_INPUT_VIEW);
- // Postpone onStartInputView by ACCUMULATE_START_INPUT_VIEW_DELAY and see if
- // orientation change has finished.
- sendMessageDelayed(obtainMessage(MSG_START_INPUT_VIEW, attribute),
- ACCUMULATE_START_INPUT_VIEW_DELAY);
- return true;
+ private void resetPendingImsCallback() {
+ mHasPendingFinishInputView = false;
+ mHasPendingFinishInput = false;
+ mHasPendingStartInput = false;
+ }
+
+ private void executePendingImsCallback(LatinIME latinIme, EditorInfo attribute,
+ boolean restarting) {
+ if (mHasPendingFinishInputView)
+ latinIme.onFinishInputViewInternal(mHasPendingFinishInput);
+ if (mHasPendingFinishInput)
+ latinIme.onFinishInputInternal();
+ if (mHasPendingStartInput)
+ latinIme.onStartInputInternal(attribute, restarting);
+ resetPendingImsCallback();
+ }
+
+ public void onStartInput(EditorInfo attribute, boolean restarting) {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the second onStartInput after orientation changed.
+ mHasPendingStartInput = true;
+ } else {
+ if (mIsOrientationChanging && restarting) {
+ // This is the first onStartInput after orientation changed.
+ mIsOrientationChanging = false;
+ mPendingSuccesiveImsCallback = true;
+ }
+ final LatinIME latinIme = getOuterInstance();
+ executePendingImsCallback(latinIme, attribute, restarting);
+ latinIme.onStartInputInternal(attribute, restarting);
}
- return false;
}
- public boolean postDisplayCompletions(CompletionInfo[] applicationSpecifiedCompletions) {
- if (hasMessages(MSG_START_INPUT_VIEW) || hasMessages(MSG_DISPLAY_COMPLETIONS)) {
- removeMessages(MSG_DISPLAY_COMPLETIONS);
- // Postpone onDisplayCompletions by ACCUMULATE_START_INPUT_VIEW_DELAY.
- sendMessageDelayed(
- obtainMessage(MSG_DISPLAY_COMPLETIONS, applicationSpecifiedCompletions),
- ACCUMULATE_START_INPUT_VIEW_DELAY);
- return true;
+ public void onStartInputView(EditorInfo attribute, boolean restarting) {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the second onStartInputView after orientation changed.
+ resetPendingImsCallback();
+ } else {
+ if (mPendingSuccesiveImsCallback) {
+ // This is the first onStartInputView after orientation changed.
+ mPendingSuccesiveImsCallback = false;
+ resetPendingImsCallback();
+ sendMessageDelayed(obtainMessage(MSG_PENDING_IMS_CALLBACK),
+ PENDING_IMS_CALLBACK_DURATION);
+ }
+ final LatinIME latinIme = getOuterInstance();
+ executePendingImsCallback(latinIme, attribute, restarting);
+ latinIme.onStartInputViewInternal(attribute, restarting);
+ }
+ }
+
+ public void onFinishInputView(boolean finishingInput) {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the first onFinishInputView after orientation changed.
+ mHasPendingFinishInputView = true;
+ } else {
+ final LatinIME latinIme = getOuterInstance();
+ latinIme.onFinishInputViewInternal(finishingInput);
+ }
+ }
+
+ public void onFinishInput() {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the first onFinishInput after orientation changed.
+ mHasPendingFinishInput = true;
+ } else {
+ final LatinIME latinIme = getOuterInstance();
+ executePendingImsCallback(latinIme, null, false);
+ latinIme.onFinishInputInternal();
}
- return false;
}
}
@@ -646,12 +672,31 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
@Override
+ public void onStartInput(EditorInfo attribute, boolean restarting) {
+ mHandler.onStartInput(attribute, restarting);
+ }
+
+ @Override
public void onStartInputView(EditorInfo attribute, boolean restarting) {
- mHandler.postRestoreKeyboardLayout();
- if (mHandler.postStartInputView(attribute)) {
- return;
- }
+ mHandler.onStartInputView(attribute, restarting);
+ }
+ @Override
+ public void onFinishInputView(boolean finishingInput) {
+ mHandler.onFinishInputView(finishingInput);
+ }
+
+ @Override
+ public void onFinishInput() {
+ mHandler.onFinishInput();
+ }
+
+ private void onStartInputInternal(EditorInfo attribute, boolean restarting) {
+ super.onStartInput(attribute, restarting);
+ }
+
+ private void onStartInputViewInternal(EditorInfo attribute, boolean restarting) {
+ super.onStartInputView(attribute, restarting);
final KeyboardSwitcher switcher = mKeyboardSwitcher;
LatinKeyboardView inputView = switcher.getKeyboardView();
@@ -785,8 +830,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (inputView != null) inputView.closing();
}
- @Override
- public void onFinishInput() {
+ private void onFinishInputInternal() {
super.onFinishInput();
LatinImeLogger.commit();
@@ -799,8 +843,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mUserBigramDictionary != null) mUserBigramDictionary.flushPendingWrites();
}
- @Override
- public void onFinishInputView(boolean finishingInput) {
+ private void onFinishInputViewInternal(boolean finishingInput) {
super.onFinishInputView(finishingInput);
mKeyboardSwitcher.onFinishInputView();
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
@@ -939,9 +982,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void onDisplayCompletions(CompletionInfo[] applicationSpecifiedCompletions) {
- if (mHandler.postDisplayCompletions(applicationSpecifiedCompletions)) {
- return;
- }
if (DEBUG) {
Log.i(TAG, "Received completions:");
if (applicationSpecifiedCompletions != null) {
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index a2e896619..bd94bab34 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -328,6 +328,7 @@ public class Settings extends InputMethodSettingsActivity
}
private PreferenceScreen mInputLanguageSelection;
+ private PreferenceScreen mVibrationDurationSettingsPref;
private ListPreference mVoicePreference;
private CheckBoxPreference mShowSettingsKeyPreference;
private ListPreference mShowCorrectionSuggestionsPreference;
@@ -483,10 +484,10 @@ public class Settings extends InputMethodSettingsActivity
}
}
- final PreferenceScreen vibrationSettingsPref =
+ mVibrationDurationSettingsPref =
(PreferenceScreen) findPreference(PREF_VIBRATION_DURATION_SETTINGS);
- if (vibrationSettingsPref != null) {
- vibrationSettingsPref.setOnPreferenceClickListener(
+ if (mVibrationDurationSettingsPref != null) {
+ mVibrationDurationSettingsPref.setOnPreferenceClickListener(
new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
@@ -494,6 +495,7 @@ public class Settings extends InputMethodSettingsActivity
return true;
}
});
+ updateVibrationDurationSettingsSummary(prefs, res);
}
}
@@ -642,9 +644,18 @@ public class Settings extends InputMethodSettingsActivity
}
}
+ private void updateVibrationDurationSettingsSummary(SharedPreferences sp, Resources res) {
+ if (mVibrationDurationSettingsPref != null) {
+ mVibrationDurationSettingsPref.setSummary(
+ Utils.getCurrentVibrationDuration(sp, res)
+ + res.getString(R.string.settings_ms));
+ }
+ }
+
private void showVibrationSettingsDialog() {
final SharedPreferences sp = getPreferenceManager().getSharedPreferences();
final Activity context = getActivityInternal();
+ final Resources res = context.getResources();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.prefs_vibration_duration_settings);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@@ -652,6 +663,7 @@ public class Settings extends InputMethodSettingsActivity
public void onClick(DialogInterface dialog, int whichButton) {
final int ms = Integer.valueOf(mVibrationSettingsTextView.getText().toString());
sp.edit().putInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, ms).apply();
+ updateVibrationDurationSettingsSummary(sp, res);
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
diff --git a/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java b/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java
deleted file mode 100644
index 1d36c0b98..000000000
--- a/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.latin;
-
-import android.content.SharedPreferences;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Reflection utils to call SharedPreferences$Editor.apply when possible,
- * falling back to commit when apply isn't available.
- */
-public class SharedPreferencesCompat {
- private static final Method sApplyMethod = findApplyMethod();
-
- private static Method findApplyMethod() {
- try {
- return SharedPreferences.Editor.class.getMethod("apply");
- } catch (NoSuchMethodException unused) {
- // fall through
- }
- return null;
- }
-
- public static void apply(SharedPreferences.Editor editor) {
- if (sApplyMethod != null) {
- try {
- sApplyMethod.invoke(editor);
- return;
- } catch (InvocationTargetException unused) {
- // fall through
- } catch (IllegalAccessException unused) {
- // fall through
- }
- }
- editor.commit();
- }
-}
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 1d5986ef9..9e030eb90 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -28,11 +28,13 @@ import android.text.TextUtils;
import com.android.inputmethod.compat.ArraysCompatUtils;
import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.ProximityInfo;
+import com.android.inputmethod.latin.BinaryDictionary;
import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.Dictionary.DataType;
import com.android.inputmethod.latin.Dictionary.WordCallback;
import com.android.inputmethod.latin.DictionaryCollection;
import com.android.inputmethod.latin.DictionaryFactory;
+import com.android.inputmethod.latin.Flag;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SynchronouslyLoadedUserDictionary;
@@ -65,6 +67,17 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
private final static SuggestionsInfo IN_DICT_EMPTY_SUGGESTIONS =
new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY,
EMPTY_STRING_ARRAY);
+ private final static Flag[] USE_FULL_EDIT_DISTANCE_FLAG_ARRAY;
+ static {
+ // See BinaryDictionary.java for an explanation of these flags
+ // Specifially, ALL_CONFIG_FLAGS means that we want to consider all flags with the
+ // current dictionary configuration - for example, consider the UMLAUT flag
+ // so that it will be turned on for German dictionaries and off for others.
+ USE_FULL_EDIT_DISTANCE_FLAG_ARRAY = Arrays.copyOf(BinaryDictionary.ALL_CONFIG_FLAGS,
+ BinaryDictionary.ALL_CONFIG_FLAGS.length + 1);
+ USE_FULL_EDIT_DISTANCE_FLAG_ARRAY[BinaryDictionary.ALL_CONFIG_FLAGS.length] =
+ BinaryDictionary.FLAG_USE_FULL_EDIT_DISTANCE;
+ }
private Map<String, DictionaryPool> mDictionaryPools =
Collections.synchronizedMap(new TreeMap<String, DictionaryPool>());
private Map<String, Dictionary> mUserDictionaries =
@@ -263,7 +276,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
final Resources resources = getResources();
final int fallbackResourceId = Utils.getMainDictionaryResourceId(resources);
final DictionaryCollection dictionaryCollection =
- DictionaryFactory.createDictionaryFromManager(this, locale, fallbackResourceId);
+ DictionaryFactory.createDictionaryFromManager(this, locale, fallbackResourceId,
+ USE_FULL_EDIT_DISTANCE_FLAG_ARRAY);
final String localeStr = locale.toString();
Dictionary userDict = mUserDictionaries.get(localeStr);
if (null == userDict) {