Add ProductionFlag.IS_EXPERIMENTAL_DEBUG
The IS_EXPERIMENTAL_DEBUG flag gives a single place to turn off all debugging flags that might be set and to also enforce privacy controls. Currently only used in the research package. multi-project commit with I9275a7c8e40bf56106447a02d3056655329074b3 Change-Id: If769fe3a633f33963ca49e8ddf01ab24a30b6fd2main
parent
606058f777
commit
0aafbcf879
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -796,7 +796,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();
|
||||||
|
@ -817,7 +818,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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue