Merge "Add TrieMap::remove()."
diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml
index e3f0aea..b25a208 100644
--- a/java/res/values/donottranslate.xml
+++ b/java/res/values/donottranslate.xml
@@ -22,10 +22,12 @@
          See {@link SettingsValues#needsToShowVoiceInputKey(SharedPreferences,Resources)} -->
     <string name="voice_mode_main">0</string>
 
-    <!-- Title for Latin keyboard debug settings activity / dialog -->
-    <string name="english_ime_debug_settings">Android keyboard Debug settings</string>
+    <!-- Title for Android keyboard debug settings activity / dialog -->
+    <string name="english_ime_debug_settings">Android Keyboard Debug settings</string>
     <string name="prefs_debug_mode">Debug Mode</string>
     <string name="prefs_force_non_distinct_multitouch">Force non-distinct multitouch</string>
+    <string name="prefs_force_physical_keyboard_special_key">Force physical keyboard special key</string>
+    <string name="prefs_show_ui_to_accept_typed_word">Show UI to accept typed word</string>
 
     <!-- Subtype locale display name exceptions.
          For each exception, there should be related string resources for display name that may have
diff --git a/java/res/xml/prefs_screen_debug.xml b/java/res/xml/prefs_screen_debug.xml
index ae29a8a..965369a 100644
--- a/java/res/xml/prefs_screen_debug.xml
+++ b/java/res/xml/prefs_screen_debug.xml
@@ -31,6 +31,16 @@
         android:defaultValue="false"
         android:persistent="true" />
     <CheckBoxPreference
+        android:key="force_physical_keyboard_special_key"
+        android:title="@string/prefs_force_physical_keyboard_special_key"
+        android:defaultValue="false"
+        android:persistent="true" />
+    <CheckBoxPreference
+        android:key="pref_show_ui_to_accept_typed_word"
+        android:title="@string/prefs_show_ui_to_accept_typed_word"
+        android:defaultValue="true"
+        android:persistent="true" />
+    <CheckBoxPreference
         android:key="pref_sliding_key_input_preview"
         android:title="@string/sliding_key_input_preview"
         android:summary="@string/sliding_key_input_preview_summary"
diff --git a/java/src/com/android/inputmethod/compat/BuildCompatUtils.java b/java/src/com/android/inputmethod/compat/BuildCompatUtils.java
new file mode 100644
index 0000000..7d1717b
--- /dev/null
+++ b/java/src/com/android/inputmethod/compat/BuildCompatUtils.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 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.compat;
+
+import android.os.Build;
+
+public final class BuildCompatUtils {
+    private BuildCompatUtils() {
+        // This utility class is not publicly instantiable.
+    }
+
+    private static final boolean IS_RELEASE_BUILD = Build.VERSION.CODENAME.equals("REL");
+
+    /**
+     * The "effective" API version.
+     * {@link android.os.Build.VERSION#SDK_INT} if the platform is a release build.
+     * {@link android.os.Build.VERSION#SDK_INT} plus 1 if the platform is a development build.
+     */
+    public static final int EFFECTIVE_SDK_INT = IS_RELEASE_BUILD
+            ? Build.VERSION.SDK_INT
+            : Build.VERSION.SDK_INT + 1;
+
+    /**
+     * API version for L-release.
+     */
+    // TODO: Substitute this constant reference with Build.VERSION_CODES.L* once the *next* version
+    // becomes available.
+    public static final int VERSION_CODES_LXX = 21;
+}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java
index 1354233..0cd606d 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java
@@ -17,11 +17,11 @@
 package com.android.inputmethod.keyboard;
 
 import android.content.SharedPreferences;
-import android.os.Build;
 import android.os.Build.VERSION_CODES;
 import android.util.Log;
 
 import com.android.inputmethod.annotations.UsedForTesting;
+import com.android.inputmethod.compat.BuildCompatUtils;
 import com.android.inputmethod.latin.R;
 
 import java.util.Arrays;
@@ -38,9 +38,6 @@
     public static final int THEME_ID_LXX_DARK = 4;
     public static final int DEFAULT_THEME_ID = THEME_ID_KLP;
 
-    // TODO: Update this constant once the *next* version becomes available.
-    public static final int VERSION_CODES_LXX = 21;
-
     private static final KeyboardTheme[] KEYBOARD_THEMES = {
         new KeyboardTheme(THEME_ID_ICS, R.style.KeyboardTheme_ICS,
                 // This has never been selected because we support ICS or later.
@@ -50,7 +47,7 @@
                 VERSION_CODES.ICE_CREAM_SANDWICH),
         new KeyboardTheme(THEME_ID_LXX_LIGHT, R.style.KeyboardTheme_LXX_Light,
                 // Default theme for LXX.
-                VERSION_CODES_LXX),
+                BuildCompatUtils.VERSION_CODES_LXX),
         new KeyboardTheme(THEME_ID_LXX_DARK, R.style.KeyboardTheme_LXX_Dark,
                 VERSION_CODES.BASE),
     };
@@ -101,10 +98,6 @@
         return null;
     }
 
-    private static int getSdkVersion() {
-        return Build.VERSION.SDK_INT;
-    }
-
     @UsedForTesting
     static KeyboardTheme getDefaultKeyboardTheme(final SharedPreferences prefs,
             final int sdkVersion) {
@@ -137,7 +130,7 @@
 
     public static void saveKeyboardThemeId(final String themeIdString,
             final SharedPreferences prefs) {
-        saveKeyboardThemeId(themeIdString, prefs, getSdkVersion());
+        saveKeyboardThemeId(themeIdString, prefs, BuildCompatUtils.EFFECTIVE_SDK_INT);
     }
 
     @UsedForTesting
@@ -156,7 +149,7 @@
     }
 
     public static KeyboardTheme getKeyboardTheme(final SharedPreferences prefs) {
-        return getKeyboardTheme(prefs, getSdkVersion());
+        return getKeyboardTheme(prefs, BuildCompatUtils.EFFECTIVE_SDK_INT);
     }
 
     @UsedForTesting
diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
index 512d461..0f9dc85 100644
--- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
+++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
@@ -24,6 +24,7 @@
 import android.util.Log;
 import android.util.Pair;
 
+import com.android.inputmethod.compat.BuildCompatUtils;
 import com.android.inputmethod.keyboard.Key;
 import com.android.inputmethod.keyboard.Keyboard;
 import com.android.inputmethod.keyboard.KeyboardId;
@@ -121,9 +122,7 @@
                     sCategoryTabIconAttr[i], 0);
         }
         addShownCategoryId(EmojiCategory.ID_RECENTS);
-        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2
-                || android.os.Build.VERSION.CODENAME.equalsIgnoreCase("KeyLimePie")
-                || android.os.Build.VERSION.CODENAME.equalsIgnoreCase("KitKat")) {
+        if (BuildCompatUtils.EFFECTIVE_SDK_INT >= Build.VERSION_CODES.KITKAT) {
             addShownCategoryId(EmojiCategory.ID_PEOPLE);
             addShownCategoryId(EmojiCategory.ID_OBJECTS);
             addShownCategoryId(EmojiCategory.ID_NATURE);
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 9b629ca..2cf7a04 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -49,11 +49,13 @@
 import android.view.Window;
 import android.view.WindowManager;
 import android.view.inputmethod.CompletionInfo;
+import android.view.inputmethod.CursorAnchorInfo;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodSubtype;
 
 import com.android.inputmethod.accessibility.AccessibilityUtils;
 import com.android.inputmethod.annotations.UsedForTesting;
+import com.android.inputmethod.compat.CursorAnchorInfoCompatWrapper;
 import com.android.inputmethod.compat.InputConnectionCompatUtils;
 import com.android.inputmethod.compat.InputMethodServiceCompatUtils;
 import com.android.inputmethod.dictionarypack.DictionaryPackConstants;
@@ -155,7 +157,7 @@
     @UsedForTesting final KeyboardSwitcher mKeyboardSwitcher;
     private final SubtypeSwitcher mSubtypeSwitcher;
     private final SubtypeState mSubtypeState = new SubtypeState();
-    private final SpecialKeyDetector mSpecialKeyDetector = new SpecialKeyDetector();
+    private final SpecialKeyDetector mSpecialKeyDetector;
 
     // Object for reacting to adding/removing a dictionary pack.
     private final BroadcastReceiver mDictionaryPackInstallReceiver =
@@ -422,9 +424,12 @@
                                 latinIme.getCurrentInputConnection(), true /* enableMonitor */);
                     }
                     if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) {
-                        InputConnectionCompatUtils.requestCursorAnchorInfo(
-                                latinIme.getCurrentInputConnection(), true /* enableMonitor */,
-                                true /* requestImmediateCallback */);
+                        // AcceptTypedWord feature relies on CursorAnchorInfo.
+                        if (latinIme.mSettings.getCurrent().mShouldShowUiToAcceptTypedWord) {
+                            InputConnectionCompatUtils.requestCursorAnchorInfo(
+                                    latinIme.getCurrentInputConnection(), true /* enableMonitor */,
+                                    true /* requestImmediateCallback */);
+                        }
                     }
                 }
             }
@@ -517,6 +522,7 @@
         mSettings = Settings.getInstance();
         mSubtypeSwitcher = SubtypeSwitcher.getInstance();
         mKeyboardSwitcher = KeyboardSwitcher.getInstance();
+        mSpecialKeyDetector = new SpecialKeyDetector(this);
         mIsHardwareAcceleratedDrawingEnabled =
                 InputMethodServiceCompatUtils.enableHardwareAcceleration(this);
         Log.i(TAG, "Hardware accelerated drawing: " + mIsHardwareAcceleratedDrawingEnabled);
@@ -971,6 +977,16 @@
         super.onUpdateCursor(rect);
     }
 
+    // We cannot mark this method as @Override until new SDK becomes publicly available.
+    // @Override
+    public void onUpdateCursorAnchorInfo(final CursorAnchorInfo info) {
+        if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) {
+            final CursorAnchorInfoCompatWrapper wrapper =
+                    CursorAnchorInfoCompatWrapper.fromObject(info);
+            // TODO: Implement here
+        }
+    }
+
     /**
      * This is called when the user has clicked on the extracted text view,
      * when running in fullscreen mode.  The default implementation hides
diff --git a/java/src/com/android/inputmethod/latin/SpecialKeyDetector.java b/java/src/com/android/inputmethod/latin/SpecialKeyDetector.java
index 9d6c69a..27b2f50 100644
--- a/java/src/com/android/inputmethod/latin/SpecialKeyDetector.java
+++ b/java/src/com/android/inputmethod/latin/SpecialKeyDetector.java
@@ -16,10 +16,18 @@
 
 package com.android.inputmethod.latin;
 
+import android.content.Context;
 import android.view.KeyEvent;
 
 final class SpecialKeyDetector {
     /**
+     * Special physical key detector
+     * @param context a context of this detector.
+     */
+    public SpecialKeyDetector(final Context context) {
+    }
+
+    /**
      * Record a down key event.
      * @param keyEvent a down key event.
      */
diff --git a/java/src/com/android/inputmethod/latin/define/ProductionFlags.java b/java/src/com/android/inputmethod/latin/define/ProductionFlags.java
index d385cf8..461c226 100644
--- a/java/src/com/android/inputmethod/latin/define/ProductionFlags.java
+++ b/java/src/com/android/inputmethod/latin/define/ProductionFlags.java
@@ -29,7 +29,7 @@
      *  and prior. In general, this callback provides more detailed positional information,
      *  even though an explicit support is required by the editor.
      */
-    public static final boolean ENABLE_CURSOR_ANCHOR_INFO_CALLBACK = false;
+    public static final boolean ENABLE_CURSOR_ANCHOR_INFO_CALLBACK = true;
 
     /**
      * When true, enable {@link InputMethodService#onUpdateCursor} callback via
diff --git a/java/src/com/android/inputmethod/latin/settings/DebugSettings.java b/java/src/com/android/inputmethod/latin/settings/DebugSettings.java
index dce11b4..63d848e 100644
--- a/java/src/com/android/inputmethod/latin/settings/DebugSettings.java
+++ b/java/src/com/android/inputmethod/latin/settings/DebugSettings.java
@@ -19,6 +19,10 @@
 public final class DebugSettings {
     public static final String PREF_DEBUG_MODE = "debug_mode";
     public static final String PREF_FORCE_NON_DISTINCT_MULTITOUCH = "force_non_distinct_multitouch";
+    public static final String PREF_FORCE_PHYSICAL_KEYBOARD_SPECIAL_KEY =
+            "force_physical_keyboard_special_key";
+    public static final String PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD =
+            "pref_show_ui_to_accept_typed_word";
     public static final String PREF_KEY_PREVIEW_SHOW_UP_START_SCALE =
             "pref_key_preview_show_up_start_scale";
     public static final String PREF_KEY_PREVIEW_DISMISS_END_SCALE =
diff --git a/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java
index 4e41d52..dc2f88a 100644
--- a/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java
@@ -56,6 +56,10 @@
         super.onCreate(icicle);
         addPreferencesFromResource(R.xml.prefs_screen_debug);
 
+        if (!Settings.HAS_UI_TO_ACCEPT_TYPED_WORD) {
+            removePreference(DebugSettings.PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD);
+        }
+
         mReadExternalDictionaryPref = findPreference(PREF_READ_EXTERNAL_DICTIONARY);
         if (mReadExternalDictionaryPref != null) {
             mReadExternalDictionaryPref.setOnPreferenceClickListener(this);
@@ -133,7 +137,8 @@
             mServiceNeedsRestart = true;
             return;
         }
-        if (key.equals(DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH)) {
+        if (key.equals(DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH)
+                || key.equals(DebugSettings.PREF_FORCE_PHYSICAL_KEYBOARD_SPECIAL_KEY)) {
             mServiceNeedsRestart = true;
             return;
         }
diff --git a/java/src/com/android/inputmethod/latin/settings/Settings.java b/java/src/com/android/inputmethod/latin/settings/Settings.java
index 90174e4..9d3c27b 100644
--- a/java/src/com/android/inputmethod/latin/settings/Settings.java
+++ b/java/src/com/android/inputmethod/latin/settings/Settings.java
@@ -24,6 +24,7 @@
 import android.preference.PreferenceManager;
 import android.util.Log;
 
+import com.android.inputmethod.compat.BuildCompatUtils;
 import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
 import com.android.inputmethod.latin.InputAttributes;
 import com.android.inputmethod.latin.R;
@@ -68,9 +69,9 @@
     public static final String PREF_BLOCK_POTENTIALLY_OFFENSIVE =
             "pref_key_block_potentially_offensive";
     public static final boolean ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS =
-            (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
-            || (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT
-                    && Build.VERSION.CODENAME.equals("REL"));
+            BuildCompatUtils.EFFECTIVE_SDK_INT <= Build.VERSION_CODES.KITKAT;
+    public static final boolean HAS_UI_TO_ACCEPT_TYPED_WORD =
+            BuildCompatUtils.EFFECTIVE_SDK_INT >= BuildCompatUtils.VERSION_CODES_LXX;
     public static final String PREF_SHOW_LANGUAGE_SWITCH_KEY =
             "pref_show_language_switch_key";
     public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST =
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
index 4a47fbb..c12474b 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
@@ -76,6 +76,7 @@
     public final int mKeyLongpressTimeout;
     public final Locale mLocale;
     public final boolean mEnableMetricsLogging;
+    public final boolean mShouldShowUiToAcceptTypedWord;
 
     // From the input box
     public final InputAttributes mInputAttributes;
@@ -143,6 +144,8 @@
         mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
         mDoubleSpacePeriodTimeout = res.getInteger(R.integer.config_double_space_period_timeout);
         mEnableMetricsLogging = prefs.getBoolean(Settings.PREF_ENABLE_METRICS_LOGGING, true);
+        mShouldShowUiToAcceptTypedWord = Settings.HAS_UI_TO_ACCEPT_TYPED_WORD
+                && prefs.getBoolean(DebugSettings.PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD, true);
         // Compute other readable settings
         mKeyLongpressTimeout = Settings.readKeyLongpressTimeout(prefs, res);
         mKeypressVibrationDuration = Settings.readKeypressVibrationDuration(prefs, res);
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
index 45e1558..c20954f 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
@@ -16,11 +16,11 @@
 
 package com.android.inputmethod.keyboard;
 
+import static com.android.inputmethod.compat.BuildCompatUtils.VERSION_CODES_LXX;
 import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_ICS;
 import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_KLP;
 import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_DARK;
 import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_LIGHT;
-import static com.android.inputmethod.keyboard.KeyboardTheme.VERSION_CODES_LXX;
 
 import android.content.SharedPreferences;
 import android.os.Build.VERSION_CODES;
diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
index 8755e57..14c9da0 100644
--- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
@@ -28,6 +28,7 @@
 import com.android.inputmethod.latin.utils.FileUtils;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -42,6 +43,7 @@
 public class UserHistoryDictionaryTests extends AndroidTestCase {
     private static final String TAG = UserHistoryDictionaryTests.class.getSimpleName();
     private static final int WAIT_FOR_WRITING_FILE_IN_MILLISECONDS = 3000;
+    private static final String TEST_LOCALE_PREFIX = "test_";
 
     private static final String[] CHARACTERS = {
         "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
@@ -50,14 +52,38 @@
 
     private int mCurrentTime = 0;
 
+    private void removeAllTestDictFiles() {
+        final Locale dummyLocale = new Locale(TEST_LOCALE_PREFIX);
+        final String dictName = ExpandableBinaryDictionary.getDictName(
+                UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */);
+        final File dictFile = ExpandableBinaryDictionary.getDictFile(
+                mContext, dictName, null /* dictFile */);
+        final FilenameFilter filenameFilter = new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String filename) {
+                return filename.startsWith(UserHistoryDictionary.NAME + "." + TEST_LOCALE_PREFIX);
+            }
+        };
+        FileUtils.deleteFilteredFiles(dictFile.getParentFile(), filenameFilter);
+    }
+
+    private void printAllFiles(final File dir) {
+        Log.d(TAG, dir.getAbsolutePath());
+        for (final File file : dir.listFiles()) {
+            Log.d(TAG, "  " + file.getName());
+        }
+    }
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
         resetCurrentTimeForTestMode();
+        removeAllTestDictFiles();
     }
 
     @Override
     protected void tearDown() throws Exception {
+        removeAllTestDictFiles();
         stopTestModeInNativeCode();
         super.tearDown();
     }
@@ -169,7 +195,8 @@
     public void testRandomWords() {
         Log.d(TAG, "This test can be used for profiling.");
         Log.d(TAG, "Usage: please set UserHistoryDictionary.PROFILE_SAVE_RESTORE to true.");
-        final Locale dummyLocale = new Locale("test_random_words" + System.currentTimeMillis());
+        final Locale dummyLocale =
+                new Locale(TEST_LOCALE_PREFIX + "random_words" + System.currentTimeMillis());
         final String dictName = ExpandableBinaryDictionary.getDictName(
                 UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */);
         final File dictFile = ExpandableBinaryDictionary.getDictFile(
@@ -202,7 +229,7 @@
 
             // Create filename suffixes for this test.
             for (int i = 0; i < numberOfLanguages; i++) {
-                dummyLocales[i] = new Locale("test_switching_languages" + i);
+                dummyLocales[i] = new Locale(TEST_LOCALE_PREFIX + "switching_languages" + i);
                 final String dictName = ExpandableBinaryDictionary.getDictName(
                         UserHistoryDictionary.NAME, dummyLocales[i], null /* dictFile */);
                 dictFiles[i] = ExpandableBinaryDictionary.getDictFile(
@@ -236,7 +263,8 @@
     }
 
     public void testAddManyWords() {
-        final Locale dummyLocale = new Locale("test_random_words" + System.currentTimeMillis());
+        final Locale dummyLocale =
+                new Locale(TEST_LOCALE_PREFIX + "random_words" + System.currentTimeMillis());
         final String dictName = ExpandableBinaryDictionary.getDictName(
                 UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */);
         final File dictFile = ExpandableBinaryDictionary.getDictFile(
@@ -253,6 +281,7 @@
                 try {
                     Log.d(TAG, dictFile +" is not existing. Wait "
                             + WAIT_FOR_WRITING_FILE_IN_MILLISECONDS + " ms for writing.");
+                    printAllFiles(dictFile.getParentFile());
                     Thread.sleep(WAIT_FOR_WRITING_FILE_IN_MILLISECONDS);
                 } catch (final InterruptedException e) {
                     Log.e(TAG, "Interrupted during waiting for writing the dict file.");
@@ -264,7 +293,8 @@
     }
 
     public void testDecaying() {
-        final Locale dummyLocale = new Locale("test_decaying" + System.currentTimeMillis());
+        final Locale dummyLocale =
+                new Locale(TEST_LOCALE_PREFIX + "decaying" + System.currentTimeMillis());
         final int numberOfWords = 5000;
         final Random random = new Random(123456);
         resetCurrentTimeForTestMode();