diff options
Diffstat (limited to 'java/src/com/android/inputmethod/research')
-rw-r--r-- | java/src/com/android/inputmethod/research/ResearchLogger.java | 27 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/research/UploaderService.java | 7 |
2 files changed, 26 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index 81c3fcac2..67626d470 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -94,8 +94,12 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang private static final String FILENAME_SUFFIX = ".txt"; private static final SimpleDateFormat TIMESTAMP_DATEFORMAT = new SimpleDateFormat("yyyyMMddHHmmssS", Locale.US); + // Whether to show an indicator on the screen that logging is on. Currently a very small red + // dot in the lower right hand corner. Most users should not notice it. private static final boolean IS_SHOWING_INDICATOR = true; - private static final boolean IS_SHOWING_INDICATOR_CLEARLY = false; + // Change the default indicator to something very visible. Currently two red vertical bars on + // either side of they keyboard. + private static final boolean IS_SHOWING_INDICATOR_CLEARLY = false || LOG_EVERYTHING; public static final int FEEDBACK_WORD_BUFFER_SIZE = 5; // constants related to specific log points @@ -136,7 +140,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang // used to check whether words are not unique private Suggest mSuggest; - private Dictionary mDictionary; private MainKeyboardView mMainKeyboardView; private InputMethodService mInputMethodService; private final Statistics mStatistics; @@ -597,6 +600,13 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } } + private Dictionary getDictionary() { + if (mSuggest == null) { + return null; + } + return mSuggest.getMainDictionary(); + } + private void setIsPasswordView(boolean isPasswordView) { mIsPasswordView = isPasswordView; } @@ -637,7 +647,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang final float savedStrokeWidth = paint.getStrokeWidth(); if (IS_SHOWING_INDICATOR_CLEARLY) { paint.setStrokeWidth(5); - canvas.drawRect(0, 0, width, height, paint); + canvas.drawLine(0, 0, 0, height, paint); + canvas.drawLine(width, 0, width, height, paint); } else { // Put a tiny red dot on the screen so a knowledgeable user can check whether // it is enabled. The dot is actually a zero-width, zero-height rectangle, @@ -726,10 +737,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang private static final LogStatement LOGSTATEMENT_COMMIT_RECORD_SPLIT_WORDS = new LogStatement("recordSplitWords", true, false); private void onWordComplete(final String word, final long maxTime, final boolean isSplitWords) { + final Dictionary dictionary = getDictionary(); if (word != null && word.length() > 0 && hasLetters(word)) { mCurrentLogUnit.setWord(word); - final boolean isDictionaryWord = mDictionary != null - && mDictionary.isValidWord(word); + final boolean isDictionaryWord = dictionary != null + && dictionary.isValidWord(word); mStatistics.recordWordEntered(isDictionaryWord); } final LogUnit newLogUnit = mCurrentLogUnit.splitByTime(maxTime); @@ -784,10 +796,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } private String scrubWord(String word) { - if (mDictionary == null) { + final Dictionary dictionary = getDictionary(); + if (dictionary == null) { return WORD_REPLACEMENT_STRING; } - if (mDictionary.isValidWord(word)) { + if (dictionary.isValidWord(word)) { return word; } return WORD_REPLACEMENT_STRING; diff --git a/java/src/com/android/inputmethod/research/UploaderService.java b/java/src/com/android/inputmethod/research/UploaderService.java index 7a5749096..26a0fab38 100644 --- a/java/src/com/android/inputmethod/research/UploaderService.java +++ b/java/src/com/android/inputmethod/research/UploaderService.java @@ -30,6 +30,7 @@ import android.os.Bundle; import android.util.Log; import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.define.ProductionFlag; import java.io.BufferedReader; import java.io.File; @@ -45,6 +46,9 @@ import java.net.URL; public final class UploaderService extends IntentService { private static final String TAG = UploaderService.class.getSimpleName(); + // Set IS_INHIBITING_AUTO_UPLOAD to true for local testing + private static final boolean IS_INHIBITING_AUTO_UPLOAD = + false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; // Force false in production public static final long RUN_INTERVAL = AlarmManager.INTERVAL_HOUR; private static final String EXTRA_UPLOAD_UNCONDITIONALLY = UploaderService.class.getName() + ".extra.UPLOAD_UNCONDITIONALLY"; @@ -116,7 +120,8 @@ public final class UploaderService extends IntentService { } private void doUpload(final boolean isUploadingUnconditionally) { - if (!isUploadingUnconditionally && (!isExternallyPowered() || !hasWifiConnection())) { + if (!isUploadingUnconditionally && (!isExternallyPowered() || !hasWifiConnection() + || IS_INHIBITING_AUTO_UPLOAD)) { return; } if (mFilesDir == null) { |