From ec2981a487b91a682caade486700d8b2377a5c52 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 8 Jun 2012 02:23:39 +0900 Subject: Fix a bug on upgrading user history scheme Bug: 6626700 Change-Id: I3190d7404e45e704be79ee2031e79b18475feb8c --- java/src/com/android/inputmethod/latin/UserHistoryDictionary.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/latin/UserHistoryDictionary.java') diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java index a73e71bb2..61b012f2d 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java @@ -229,6 +229,7 @@ public class UserHistoryDictionary extends ExpandableDictionary { public void loadDictionaryAsync() { synchronized(mBigramList) { final long last = SettingsValues.getLastUserHistoryWriteTime(mPrefs, mLocale); + final boolean initializing = last == 0; final long now = System.currentTimeMillis(); // Load the words that correspond to the current input locale final Cursor cursor = query(MAIN_COLUMN_LOCALE + "=?", new String[] { mLocale }); @@ -253,7 +254,8 @@ public class UserHistoryDictionary extends ExpandableDictionary { } else if (word1.length() < BinaryDictionary.MAX_WORD_LENGTH && word2.length() < BinaryDictionary.MAX_WORD_LENGTH) { super.setBigramAndGetFrequency( - word1, word2, new ForgettingCurveParams(fc, now, last)); + word1, word2, initializing ? new ForgettingCurveParams(true) + : new ForgettingCurveParams(fc, now, last)); } mBigramList.addBigram(word1, word2, (byte)fc); cursor.moveToNext(); -- cgit v1.2.3-83-g751a