diff options
Diffstat (limited to 'java/src/com/android/inputmethod/research/ResearchLogger.java')
-rw-r--r-- | java/src/com/android/inputmethod/research/ResearchLogger.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index ecf809242..ed047e13a 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -37,7 +37,6 @@ import android.os.IBinder; import android.os.SystemClock; import android.preference.PreferenceManager; import android.text.TextUtils; -import android.text.format.DateUtils; import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; @@ -57,11 +56,11 @@ import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.RichInputConnection; -import com.android.inputmethod.latin.RichInputConnection.Range; import com.android.inputmethod.latin.Suggest; import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.utils.InputTypeUtils; +import com.android.inputmethod.latin.utils.TextRange; import com.android.inputmethod.research.MotionEventReader.ReplayData; import com.android.inputmethod.research.ui.SplashScreen; @@ -75,6 +74,7 @@ import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import java.util.Random; +import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; // TODO: Add a unit test for every "logging" method (i.e. that is called from the IME and calls @@ -137,10 +137,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang private static final int MAX_INPUTVIEW_LENGTH_TO_CAPTURE = 8192; // must be >=1 private static final String PREF_RESEARCH_SAVED_CHANNEL = "pref_research_saved_channel"; - private static final long RESEARCHLOG_CLOSE_TIMEOUT_IN_MS = 5 * 1000; - private static final long RESEARCHLOG_ABORT_TIMEOUT_IN_MS = 5 * 1000; - private static final long DURATION_BETWEEN_DIR_CLEANUP_IN_MS = DateUtils.DAY_IN_MILLIS; - private static final long MAX_LOGFILE_AGE_IN_MS = 4 * DateUtils.DAY_IN_MILLIS; + private static final long RESEARCHLOG_CLOSE_TIMEOUT_IN_MS = TimeUnit.SECONDS.toMillis(5); + private static final long RESEARCHLOG_ABORT_TIMEOUT_IN_MS = TimeUnit.SECONDS.toMillis(5); + private static final long DURATION_BETWEEN_DIR_CLEANUP_IN_MS = TimeUnit.DAYS.toMillis(1); + private static final long MAX_LOGFILE_AGE_IN_MS = TimeUnit.DAYS.toMillis(4); private static final ResearchLogger sInstance = new ResearchLogger(); private static String sAccountType = null; @@ -195,7 +195,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang // not performed on text that the user types into the feedback dialog. private boolean mInFeedbackDialog = false; private Handler mUserRecordingTimeoutHandler; - private static final long USER_RECORDING_TIMEOUT_MS = 30L * DateUtils.SECOND_IN_MILLIS; + private static final long USER_RECORDING_TIMEOUT_MS = TimeUnit.SECONDS.toMillis(30); // Stores a temporary LogUnit while generating a phantom space. Needed because phantom spaces // are issued out-of-order, immediately before the characters generated by other operations that @@ -542,8 +542,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang toast.show(); boolean isLogDeleted = abort(); final long currentTime = System.currentTimeMillis(); - final long resumeTime = currentTime + 1000 * 60 * - SUSPEND_DURATION_IN_MINUTES; + final long resumeTime = currentTime + + TimeUnit.MINUTES.toMillis(SUSPEND_DURATION_IN_MINUTES); suspendLoggingUntil(resumeTime); toast.cancel(); Toast.makeText(latinIME, R.string.research_notify_logging_suspended, @@ -635,7 +635,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang mMotionEventReader.readMotionEventData(mUserRecordingFile); mReplayer.replay(replayData, null); } - }, 1000); + }, TimeUnit.SECONDS.toMillis(1)); } if (FEEDBACK_DIALOG_SHOULD_PRESERVE_TEXT_FIELD) { @@ -1220,7 +1220,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang final RichInputConnection connection) { String word = ""; if (connection != null) { - Range range = connection.getWordRangeAtCursor(WHITESPACE_SEPARATORS, 1); + TextRange range = connection.getWordRangeAtCursor(WHITESPACE_SEPARATORS, 1); if (range != null) { word = range.mWord.toString(); } |