am 94ac7a38: Merge "Add ProductionFlag.IS_EXPERIMENTAL_DEBUG"

* commit '94ac7a38516635d552c54bdcb5785e7d60fe2188':
  Add ProductionFlag.IS_EXPERIMENTAL_DEBUG
main
Kurt Partridge 2012-12-19 09:03:52 -08:00 committed by Android Git Automerger
commit db7a36d251
5 changed files with 17 additions and 8 deletions

View File

@ -23,4 +23,9 @@ public final class ProductionFlag {
public static final boolean IS_EXPERIMENTAL = false; public static final boolean IS_EXPERIMENTAL = false;
public static final boolean IS_INTERNAL = false; public static final boolean IS_INTERNAL = false;
// When false, IS_EXPERIMENTAL_DEBUG suggests that all guarded class-private DEBUG flags should
// be false, and any privacy controls should be enforced. IS_EXPERIMENTAL_DEBUG should be false
// for any released build.
public static final boolean IS_EXPERIMENTAL_DEBUG = false;
} }

View File

@ -20,18 +20,19 @@ import android.util.Log;
import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.Suggest; import com.android.inputmethod.latin.Suggest;
import com.android.inputmethod.latin.define.ProductionFlag;
import java.util.Random; import java.util.Random;
public class MainLogBuffer extends LogBuffer { public class MainLogBuffer extends LogBuffer {
private static final String TAG = MainLogBuffer.class.getSimpleName(); private static final String TAG = MainLogBuffer.class.getSimpleName();
// For privacy reasons, be sure to set to "false" for production code. private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG;
private static final boolean DEBUG = false;
// The size of the n-grams logged. E.g. N_GRAM_SIZE = 2 means to sample bigrams. // The size of the n-grams logged. E.g. N_GRAM_SIZE = 2 means to sample bigrams.
private static final int N_GRAM_SIZE = 2; private static final int N_GRAM_SIZE = 2;
// The number of words between n-grams to omit from the log. // The number of words between n-grams to omit from the log.
private static final int DEFAULT_NUMBER_OF_WORDS_BETWEEN_SAMPLES = DEBUG ? 2 : 18; private static final int DEFAULT_NUMBER_OF_WORDS_BETWEEN_SAMPLES =
ProductionFlag.IS_EXPERIMENTAL_DEBUG ? 2 : 18;
private final ResearchLog mResearchLog; private final ResearchLog mResearchLog;
private Suggest mSuggest; private Suggest mSuggest;

View File

@ -52,7 +52,7 @@ import java.util.concurrent.TimeUnit;
*/ */
public class ResearchLog { public class ResearchLog {
private static final String TAG = ResearchLog.class.getSimpleName(); private static final String TAG = ResearchLog.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG;
private static final long FLUSH_DELAY_IN_MS = 1000 * 5; private static final long FLUSH_DELAY_IN_MS = 1000 * 5;
private static final int ABORT_TIMEOUT_IN_MS = 1000 * 4; private static final int ABORT_TIMEOUT_IN_MS = 1000 * 4;

View File

@ -83,7 +83,7 @@ import java.util.UUID;
*/ */
public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChangeListener { public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = ResearchLogger.class.getSimpleName(); private static final String TAG = ResearchLogger.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG;
private static final boolean LOG_EVERYTHING = false; // true will disclose private info private static final boolean LOG_EVERYTHING = false; // true will disclose private info
public static final boolean DEFAULT_USABILITY_STUDY_MODE = false; public static final boolean DEFAULT_USABILITY_STUDY_MODE = false;
/* package */ static boolean sIsLogging = false; /* package */ static boolean sIsLogging = false;
@ -804,7 +804,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private static final LogStatement LOGSTATEMENT_LATIN_IME_ON_START_INPUT_VIEW_INTERNAL = private static final LogStatement LOGSTATEMENT_LATIN_IME_ON_START_INPUT_VIEW_INTERNAL =
new LogStatement("LatinImeOnStartInputViewInternal", false, false, "uuid", new LogStatement("LatinImeOnStartInputViewInternal", false, false, "uuid",
"packageName", "inputType", "imeOptions", "fieldId", "display", "model", "packageName", "inputType", "imeOptions", "fieldId", "display", "model",
"prefs", "versionCode", "versionName", "outputFormatVersion", "logEverything"); "prefs", "versionCode", "versionName", "outputFormatVersion", "logEverything",
"isExperimentalDebug");
public static void latinIME_onStartInputViewInternal(final EditorInfo editorInfo, public static void latinIME_onStartInputViewInternal(final EditorInfo editorInfo,
final SharedPreferences prefs) { final SharedPreferences prefs) {
final ResearchLogger researchLogger = getInstance(); final ResearchLogger researchLogger = getInstance();
@ -825,7 +826,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
Integer.toHexString(editorInfo.inputType), Integer.toHexString(editorInfo.inputType),
Integer.toHexString(editorInfo.imeOptions), editorInfo.fieldId, Integer.toHexString(editorInfo.imeOptions), editorInfo.fieldId,
Build.DISPLAY, Build.MODEL, prefs, versionCode, versionName, Build.DISPLAY, Build.MODEL, prefs, versionCode, versionName,
OUTPUT_FORMAT_VERSION, LOG_EVERYTHING); OUTPUT_FORMAT_VERSION, LOG_EVERYTHING,
ProductionFlag.IS_EXPERIMENTAL_DEBUG);
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -19,10 +19,11 @@ package com.android.inputmethod.research;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.define.ProductionFlag;
public class Statistics { public class Statistics {
private static final String TAG = Statistics.class.getSimpleName(); private static final String TAG = Statistics.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG;
// Number of characters entered during a typing session // Number of characters entered during a typing session
int mCharCount; int mCharCount;