aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-06-08 02:23:39 +0900
committersatok <satok@google.com>2012-06-08 02:55:23 +0900
commitec2981a487b91a682caade486700d8b2377a5c52 (patch)
tree0eb6739a2033c7d9e58c6d397c14512b02d10c03 /java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java
parent65b72435237f9dbc0eca0038ebc666331aff079f (diff)
downloadlatinime-ec2981a487b91a682caade486700d8b2377a5c52.tar.gz
latinime-ec2981a487b91a682caade486700d8b2377a5c52.tar.xz
latinime-ec2981a487b91a682caade486700d8b2377a5c52.zip
Fix a bug on upgrading user history scheme
Bug: 6626700 Change-Id: I3190d7404e45e704be79ee2031e79b18475feb8c
Diffstat (limited to 'java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java')
-rw-r--r--java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java b/java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java
index 9cd8c6778..e5516dc62 100644
--- a/java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java
+++ b/java/src/com/android/inputmethod/latin/UserHistoryForgettingCurveUtils.java
@@ -30,6 +30,7 @@ public class UserHistoryForgettingCurveUtils {
private static final long ELAPSED_TIME_INTERVAL_MILLIS = ELAPSED_TIME_INTERVAL_HOURS
* DateUtils.HOUR_IN_MILLIS;
private static final int HALF_LIFE_HOURS = 48;
+ private static final int MAX_PUSH_ELAPSED = (FC_LEVEL_MAX + 1) * (ELAPSED_TIME_MAX + 1);
private UserHistoryForgettingCurveUtils() {
// This utility class is not publicly instantiable.
@@ -94,6 +95,11 @@ public class UserHistoryForgettingCurveUtils {
if (elapsedTimeCount <= 0) {
return;
}
+ if (elapsedTimeCount >= MAX_PUSH_ELAPSED) {
+ mLastTouchedTime = now;
+ mFc = 0;
+ return;
+ }
for (int i = 0; i < elapsedTimeCount; ++i) {
mLastTouchedTime += ELAPSED_TIME_INTERVAL_MILLIS;
mFc = pushElapsedTime(mFc);