am 841c295f: resolved conflicts for merge of 5b048292 to master

* commit '841c295f3c99214f45924434d9c0bb5b4760578d':
  Rename ProductionFlag.IS_EXPERIMENTAL to USES_DEVELOPMENT_ONLY_DIAGNOSTICS
main
Tadashi G. Takaoka 2013-03-18 18:55:25 -07:00 committed by Android Git Automerger
commit 3b93f0e9a7
20 changed files with 111 additions and 93 deletions

View File

@ -287,10 +287,10 @@ public class KeyboardView extends View {
} }
} }
// ResearchLogging indicator. // Research Logging (Development Only Diagnostics) indicator.
// TODO: Reimplement using a keyboard background image specific to the ResearchLogger, // TODO: Reimplement using a keyboard background image specific to the ResearchLogger,
// and remove this call. // and remove this call.
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().paintIndicator(this, paint, canvas, width, height); ResearchLogger.getInstance().paintIndicator(this, paint, canvas, width, height);
} }

View File

@ -662,7 +662,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
? mSpaceKey.getIcon(keyboard.mIconsSet, Constants.Color.ALPHA_OPAQUE) : null; ? mSpaceKey.getIcon(keyboard.mIconsSet, Constants.Color.ALPHA_OPAQUE) : null;
final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap; final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
mSpacebarTextSize = keyHeight * mSpacebarTextRatio; mSpacebarTextSize = keyHeight * mSpacebarTextRatio;
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.mainKeyboardView_setKeyboard(keyboard); ResearchLogger.mainKeyboardView_setKeyboard(keyboard);
} }
@ -925,10 +925,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@Override @Override
protected void onAttachedToWindow() { protected void onAttachedToWindow() {
super.onAttachedToWindow(); super.onAttachedToWindow();
// Notify the research logger that the keyboard view has been attached. This is needed // Notify the ResearchLogger (development only diagnostics) that the keyboard view has
// to properly show the splash screen, which requires that the window token of the // been attached. This is needed to properly show the splash screen, which requires that
// KeyboardView be non-null. // the window token of the KeyboardView be non-null.
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().mainKeyboardView_onAttachedToWindow(this); ResearchLogger.getInstance().mainKeyboardView_onAttachedToWindow(this);
} }
} }
@ -937,9 +937,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
protected void onDetachedFromWindow() { protected void onDetachedFromWindow() {
super.onDetachedFromWindow(); super.onDetachedFromWindow();
mPreviewPlacerView.removeAllViews(); mPreviewPlacerView.removeAllViews();
// Notify the research logger that the keyboard view has been detached. This is needed // Notify the ResearchLogger (development only diagnostics) that the keyboard view has
// to invalidate the reference of {@link MainKeyboardView} to null. // been detached. This is needed to invalidate the reference of {@link MainKeyboardView}
if (ProductionFlag.IS_EXPERIMENTAL) { // to null.
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().mainKeyboardView_onDetachedFromWindow(); ResearchLogger.getInstance().mainKeyboardView_onDetachedFromWindow();
} }
} }
@ -977,7 +978,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
if (key == null) { if (key == null) {
return false; return false;
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.mainKeyboardView_onLongPress(); ResearchLogger.mainKeyboardView_onLongPress();
} }
final int code = key.mCode; final int code = key.mCode;
@ -1125,7 +1126,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
} }
// TODO: This should be moved to the tracker.processMotionEvent() call below. // TODO: This should be moved to the tracker.processMotionEvent() call below.
// Currently the same "move" event is being logged twice. // Currently the same "move" event is being logged twice.
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.mainKeyboardView_processMotionEvent( ResearchLogger.mainKeyboardView_processMotionEvent(
me, action, eventTime, index, id, x, y); me, action, eventTime, index, id, x, y);
} }
@ -1185,7 +1186,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
if (ENABLE_USABILITY_STUDY_LOG) { if (ENABLE_USABILITY_STUDY_LOG) {
writeUsabilityStudyLog(me, action, eventTime, i, pointerId, px, py); writeUsabilityStudyLog(me, action, eventTime, i, pointerId, px, py);
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.mainKeyboardView_processMotionEvent( ResearchLogger.mainKeyboardView_processMotionEvent(
me, action, eventTime, i, pointerId, px, py); me, action, eventTime, i, pointerId, px, py);
} }

View File

@ -478,7 +478,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
output, ignoreModifierKey ? " ignoreModifier" : "", output, ignoreModifierKey ? " ignoreModifier" : "",
altersCode ? " altersCode" : "", key.isEnabled() ? "" : " disabled")); altersCode ? " altersCode" : "", key.isEnabled() ? "" : " disabled"));
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.pointerTracker_callListenerOnCodeInput(key, x, y, ignoreModifierKey, ResearchLogger.pointerTracker_callListenerOnCodeInput(key, x, y, ignoreModifierKey,
altersCode, code); altersCode, code);
} }
@ -510,7 +510,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
withSliding ? " sliding" : "", ignoreModifierKey ? " ignoreModifier" : "", withSliding ? " sliding" : "", ignoreModifierKey ? " ignoreModifier" : "",
key.isEnabled() ? "": " disabled")); key.isEnabled() ? "": " disabled"));
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.pointerTracker_callListenerOnRelease(key, primaryCode, withSliding, ResearchLogger.pointerTracker_callListenerOnRelease(key, primaryCode, withSliding,
ignoreModifierKey); ignoreModifierKey);
} }
@ -526,7 +526,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onCancelInput", mPointerId)); Log.d(TAG, String.format("[%d] onCancelInput", mPointerId));
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.pointerTracker_callListenerOnCancelInput(); ResearchLogger.pointerTracker_callListenerOnCancelInput();
} }
mListener.onCancelInput(); mListener.onCancelInput();
@ -843,7 +843,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
Log.w(TAG, String.format("[%d] onDownEvent:" Log.w(TAG, String.format("[%d] onDownEvent:"
+ " ignore potential noise: time=%d distance=%d", + " ignore potential noise: time=%d distance=%d",
mPointerId, deltaT, distance)); mPointerId, deltaT, distance));
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.pointerTracker_onDownEvent(deltaT, distance * distance); ResearchLogger.pointerTracker_onDownEvent(deltaT, distance * distance);
} }
cancelTracking(); cancelTracking();
@ -1000,7 +1000,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
x, y, Constants.printableCode(key.mCode))); x, y, Constants.printableCode(key.mCode)));
} }
// TODO: This should be moved to outside of this nested if-clause? // TODO: This should be moved to outside of this nested if-clause?
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.pointerTracker_onMoveEvent(x, y, lastX, lastY); ResearchLogger.pointerTracker_onMoveEvent(x, y, lastX, lastY);
} }
onUpEventInternal(x, y, eventTime); onUpEventInternal(x, y, eventTime);

View File

@ -145,7 +145,7 @@ public final class TouchScreenRegulator {
if (handleSuddenJumping(me)) { if (handleSuddenJumping(me)) {
if (DEBUG_MODE) if (DEBUG_MODE)
Log.w(TAG, "onTouchEvent: ignore sudden jump " + me); Log.w(TAG, "onTouchEvent: ignore sudden jump " + me);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.suddenJumpingTouchEventHandler_onTouchEvent(me); ResearchLogger.suddenJumpingTouchEventHandler_onTouchEvent(me);
} }
return true; return true;

View File

@ -289,8 +289,9 @@ final class BinaryDictionaryGetter {
// cacheWordListsFromContentProvider returns the list of files it copied to local // cacheWordListsFromContentProvider returns the list of files it copied to local
// storage, but we don't really care about what was copied NOW: what we want is the // storage, but we don't really care about what was copied NOW: what we want is the
// list of everything we ever cached, so we ignore the return value. // list of everything we ever cached, so we ignore the return value.
// TODO: The experimental version is not supported by the Dictionary Pack Service yet // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack
if (!ProductionFlag.IS_EXPERIMENTAL) { // Service yet
if (!ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
// We need internet access to do the following. Only do this if the package actually // We need internet access to do the following. Only do this if the package actually
// has the permission. // has the permission.
if (context.checkCallingOrSelfPermission(android.Manifest.permission.INTERNET) if (context.checkCallingOrSelfPermission(android.Manifest.permission.INTERNET)

View File

@ -173,9 +173,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private int mDisplayOrientation; private int mDisplayOrientation;
// Object for reacting to adding/removing a dictionary pack. // Object for reacting to adding/removing a dictionary pack.
// TODO: The experimental version is not supported by the Dictionary Pack Service yet. // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack
// Service yet.
private BroadcastReceiver mDictionaryPackInstallReceiver = private BroadcastReceiver mDictionaryPackInstallReceiver =
ProductionFlag.IS_EXPERIMENTAL ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS
? null : new DictionaryPackInstallBroadcastReceiver(this); ? null : new DictionaryPackInstallBroadcastReceiver(this);
// Keeps track of most recently inserted text (multi-character key) for reverting // Keeps track of most recently inserted text (multi-character key) for reverting
@ -427,7 +428,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
loadSettings(); loadSettings();
initSuggest(); initSuggest();
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().init(this, mKeyboardSwitcher, mSuggest); ResearchLogger.getInstance().init(this, mKeyboardSwitcher, mSuggest);
} }
mDisplayOrientation = getResources().getConfiguration().orientation; mDisplayOrientation = getResources().getConfiguration().orientation;
@ -439,8 +440,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
registerReceiver(mReceiver, filter); registerReceiver(mReceiver, filter);
// TODO: The experimental version is not supported by the Dictionary Pack Service yet. // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack
if (!ProductionFlag.IS_EXPERIMENTAL) { // Service yet.
if (!ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
final IntentFilter packageFilter = new IntentFilter(); final IntentFilter packageFilter = new IntentFilter();
packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
@ -492,7 +494,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
} }
mIsMainDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(this, subtypeLocale); mIsMainDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(this, subtypeLocale);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().initSuggest(mSuggest); ResearchLogger.getInstance().initSuggest(mSuggest);
} }
@ -563,11 +565,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
} }
mSettings.onDestroy(); mSettings.onDestroy();
unregisterReceiver(mReceiver); unregisterReceiver(mReceiver);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().onDestroy(); ResearchLogger.getInstance().onDestroy();
} }
// TODO: The experimental version is not supported by the Dictionary Pack Service yet. // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack
if (!ProductionFlag.IS_EXPERIMENTAL) { // Service yet.
if (!ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
unregisterReceiver(mDictionaryPackInstallReceiver); unregisterReceiver(mDictionaryPackInstallReceiver);
} }
LatinImeLogger.commit(); LatinImeLogger.commit();
@ -675,7 +678,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
+ ", word caps = " + ", word caps = "
+ ((editorInfo.inputType & InputType.TYPE_TEXT_FLAG_CAP_WORDS) != 0)); + ((editorInfo.inputType & InputType.TYPE_TEXT_FLAG_CAP_WORDS) != 0));
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
ResearchLogger.latinIME_onStartInputViewInternal(editorInfo, prefs); ResearchLogger.latinIME_onStartInputViewInternal(editorInfo, prefs);
} }
@ -800,7 +803,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
@Override @Override
public void onWindowHidden() { public void onWindowHidden() {
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onWindowHidden(mLastSelectionStart, mLastSelectionEnd, ResearchLogger.latinIME_onWindowHidden(mLastSelectionStart, mLastSelectionEnd,
getCurrentInputConnection()); getCurrentInputConnection());
} }
@ -831,7 +834,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// Remove pending messages related to update suggestions // Remove pending messages related to update suggestions
mHandler.cancelUpdateSuggestionStrip(); mHandler.cancelUpdateSuggestionStrip();
resetComposingState(true /* alsoResetLastComposedWord */); resetComposingState(true /* alsoResetLastComposedWord */);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().latinIME_onFinishInputViewInternal(); ResearchLogger.getInstance().latinIME_onFinishInputViewInternal();
} }
} }
@ -852,7 +855,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
+ ", cs=" + composingSpanStart + ", cs=" + composingSpanStart
+ ", ce=" + composingSpanEnd); + ", ce=" + composingSpanEnd);
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
final boolean expectingUpdateSelectionFromLogger = final boolean expectingUpdateSelectionFromLogger =
ResearchLogger.getAndClearLatinIMEExpectingUpdateSelection(); ResearchLogger.getAndClearLatinIMEExpectingUpdateSelection();
ResearchLogger.latinIME_onUpdateSelection(mLastSelectionStart, mLastSelectionEnd, ResearchLogger.latinIME_onUpdateSelection(mLastSelectionStart, mLastSelectionEnd,
@ -984,7 +987,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mApplicationSpecifiedCompletions = applicationSpecifiedCompletions; mApplicationSpecifiedCompletions = applicationSpecifiedCompletions;
if (applicationSpecifiedCompletions == null) { if (applicationSpecifiedCompletions == null) {
clearSuggestionStrip(); clearSuggestionStrip();
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onDisplayCompletions(null); ResearchLogger.latinIME_onDisplayCompletions(null);
} }
return; return;
@ -1005,7 +1008,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
setSuggestedWords(suggestedWords, isAutoCorrection); setSuggestedWords(suggestedWords, isAutoCorrection);
setAutoCorrectionIndicator(isAutoCorrection); setAutoCorrectionIndicator(isAutoCorrection);
setSuggestionStripShown(true); setSuggestionStripShown(true);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions); ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions);
} }
} }
@ -1144,7 +1147,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
if (typedWord.length() > 0) { if (typedWord.length() > 0) {
commitChosenWord(typedWord, LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, commitChosenWord(typedWord, LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD,
separatorString); separatorString);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().onWordFinished(typedWord, mWordComposer.isBatchMode()); ResearchLogger.getInstance().onWordFinished(typedWord, mWordComposer.isBatchMode());
} }
} }
@ -1184,7 +1187,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mConnection.deleteSurroundingText(2, 0); mConnection.deleteSurroundingText(2, 0);
final String text = lastTwo.charAt(1) + " "; final String text = lastTwo.charAt(1) + " ";
mConnection.commitText(text, 1); mConnection.commitText(text, 1);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_swapSwapperAndSpace(lastTwo, text); ResearchLogger.latinIME_swapSwapperAndSpace(lastTwo, text);
} }
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.updateShiftState();
@ -1204,7 +1207,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mConnection.deleteSurroundingText(2, 0); mConnection.deleteSurroundingText(2, 0);
final String textToInsert = ". "; final String textToInsert = ". ";
mConnection.commitText(textToInsert, 1); mConnection.commitText(textToInsert, 1);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_maybeDoubleSpacePeriod(textToInsert, ResearchLogger.latinIME_maybeDoubleSpacePeriod(textToInsert,
false /* isBatchMode */); false /* isBatchMode */);
} }
@ -1319,7 +1322,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
} }
private void sendKeyCodePoint(final int code) { private void sendKeyCodePoint(final int code) {
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_sendKeyCodePoint(code); ResearchLogger.latinIME_sendKeyCodePoint(code);
} }
// TODO: Remove this special handling of digit letters. // TODO: Remove this special handling of digit letters.
@ -1345,7 +1348,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// Implementation of {@link KeyboardActionListener}. // Implementation of {@link KeyboardActionListener}.
@Override @Override
public void onCodeInput(final int primaryCode, final int x, final int y) { public void onCodeInput(final int primaryCode, final int x, final int y) {
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onCodeInput(primaryCode, x, y); ResearchLogger.latinIME_onCodeInput(primaryCode, x, y);
} }
final long when = SystemClock.uptimeMillis(); final long when = SystemClock.uptimeMillis();
@ -1397,7 +1400,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
handleLanguageSwitchKey(); handleLanguageSwitchKey();
break; break;
case Constants.CODE_RESEARCH: case Constants.CODE_RESEARCH:
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().onResearchKeySelected(this); ResearchLogger.getInstance().onResearchKeySelected(this);
} }
break; break;
@ -1489,7 +1492,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
promotePhantomSpace(); promotePhantomSpace();
} }
mConnection.commitText(text, 1); mConnection.commitText(text, 1);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onTextInput(text, false /* isBatchMode */); ResearchLogger.latinIME_onTextInput(text, false /* isBatchMode */);
} }
mConnection.endBatchEdit(); mConnection.endBatchEdit();
@ -1670,7 +1673,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mConnection.setComposingText(batchInputText, 1); mConnection.setComposingText(batchInputText, 1);
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
mConnection.endBatchEdit(); mConnection.endBatchEdit();
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onEndBatchInput(batchInputText, 0, suggestedWords); ResearchLogger.latinIME_onEndBatchInput(batchInputText, 0, suggestedWords);
} }
// Space state must be updated before calling updateShiftState // Space state must be updated before calling updateShiftState
@ -1719,7 +1722,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
final int length = mWordComposer.size(); final int length = mWordComposer.size();
if (length > 0) { if (length > 0) {
if (mWordComposer.isBatchMode()) { if (mWordComposer.isBatchMode()) {
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
final String word = mWordComposer.getTypedWord(); final String word = mWordComposer.getTypedWord();
ResearchLogger.latinIME_handleBackspace_batch(word, 1); ResearchLogger.latinIME_handleBackspace_batch(word, 1);
ResearchLogger.getInstance().uncommitCurrentLogUnit( ResearchLogger.getInstance().uncommitCurrentLogUnit(
@ -1780,7 +1783,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// later (typically, in a subsequent press on backspace). // later (typically, in a subsequent press on backspace).
mLastSelectionEnd = mLastSelectionStart; mLastSelectionEnd = mLastSelectionStart;
mConnection.deleteSurroundingText(numCharsDeleted, 0); mConnection.deleteSurroundingText(numCharsDeleted, 0);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_handleBackspace(numCharsDeleted); ResearchLogger.latinIME_handleBackspace(numCharsDeleted);
} }
} else { } else {
@ -1799,12 +1802,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
} else { } else {
mConnection.deleteSurroundingText(1, 0); mConnection.deleteSurroundingText(1, 0);
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_handleBackspace(1); ResearchLogger.latinIME_handleBackspace(1);
} }
if (mDeleteCount > DELETE_ACCELERATE_AT) { if (mDeleteCount > DELETE_ACCELERATE_AT) {
mConnection.deleteSurroundingText(1, 0); mConnection.deleteSurroundingText(1, 0);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_handleBackspace(1); ResearchLogger.latinIME_handleBackspace(1);
} }
} }
@ -1903,7 +1906,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// Returns true if we did an autocorrection, false otherwise. // Returns true if we did an autocorrection, false otherwise.
private boolean handleSeparator(final int primaryCode, final int x, final int y, private boolean handleSeparator(final int primaryCode, final int x, final int y,
final int spaceState) { final int spaceState) {
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.recordTimeForLogUnitSplit(); ResearchLogger.recordTimeForLogUnitSplit();
ResearchLogger.latinIME_handleSeparator(primaryCode, mWordComposer.isComposingWord()); ResearchLogger.latinIME_handleSeparator(primaryCode, mWordComposer.isComposingWord());
} }
@ -2148,7 +2151,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
if (mSettings.isInternal()) { if (mSettings.isInternal()) {
Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer); Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer);
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
final SuggestedWords suggestedWords = mSuggestedWords; final SuggestedWords suggestedWords = mSuggestedWords;
ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, autoCorrection, ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, autoCorrection,
separatorString, mWordComposer.isBatchMode(), suggestedWords); separatorString, mWordComposer.isBatchMode(), suggestedWords);
@ -2184,7 +2187,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
final int primaryCode = suggestion.charAt(0); final int primaryCode = suggestion.charAt(0);
onCodeInput(primaryCode, onCodeInput(primaryCode,
Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE); Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, ResearchLogger.latinIME_punctuationSuggestion(index, suggestion,
false /* isBatchMode */, suggestedWords.mIsPrediction); false /* isBatchMode */, suggestedWords.mIsPrediction);
} }
@ -2225,7 +2228,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK, commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK,
LastComposedWord.NOT_A_SEPARATOR); LastComposedWord.NOT_A_SEPARATOR);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion, ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion,
mWordComposer.isBatchMode()); mWordComposer.isBatchMode());
} }
@ -2326,7 +2329,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
restartSuggestionsOnWordBeforeCursor(word); restartSuggestionsOnWordBeforeCursor(word);
// TODO: Handle the case where the user manually moves the cursor and then backs up over // TODO: Handle the case where the user manually moves the cursor and then backs up over
// a separator. In that case, the current log unit should not be uncommitted. // a separator. In that case, the current log unit should not be uncommitted.
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().uncommitCurrentLogUnit(word.toString(), ResearchLogger.getInstance().uncommitCurrentLogUnit(word.toString(),
true /* dumpCurrentLogUnit */); true /* dumpCurrentLogUnit */);
} }
@ -2372,7 +2375,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
Stats.onSeparator(mLastComposedWord.mSeparatorString, Stats.onSeparator(mLastComposedWord.mSeparatorString,
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE); Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
} }
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_revertCommit(committedWord, originallyTypedWord, ResearchLogger.latinIME_revertCommit(committedWord, originallyTypedWord,
mWordComposer.isBatchMode(), mLastComposedWord.mSeparatorString); mWordComposer.isBatchMode(), mLastComposedWord.mSeparatorString);
ResearchLogger.getInstance().uncommitCurrentLogUnit(committedWord, ResearchLogger.getInstance().uncommitCurrentLogUnit(committedWord,
@ -2389,7 +2392,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
public void promotePhantomSpace() { public void promotePhantomSpace() {
if (mSettings.getCurrent().shouldInsertSpacesAutomatically()) { if (mSettings.getCurrent().shouldInsertSpacesAutomatically()) {
sendKeyCodePoint(Constants.CODE_SPACE); sendKeyCodePoint(Constants.CODE_SPACE);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_promotePhantomSpace(); ResearchLogger.latinIME_promotePhantomSpace();
} }
} }

View File

@ -142,7 +142,7 @@ public final class RichInputConnection {
if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor); if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor);
if (null != mIC) { if (null != mIC) {
mIC.finishComposingText(); mIC.finishComposingText();
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_finishComposingText(); ResearchLogger.richInputConnection_finishComposingText();
} }
} }
@ -164,7 +164,7 @@ public final class RichInputConnection {
mComposingText.setLength(0); mComposingText.setLength(0);
if (null != mIC) { if (null != mIC) {
mIC.finishComposingText(); mIC.finishComposingText();
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_finishComposingText(); ResearchLogger.richInputConnection_finishComposingText();
} }
} }
@ -263,7 +263,7 @@ public final class RichInputConnection {
} }
if (null != mIC) { if (null != mIC) {
mIC.deleteSurroundingText(i, j); mIC.deleteSurroundingText(i, j);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_deleteSurroundingText(i, j); ResearchLogger.richInputConnection_deleteSurroundingText(i, j);
} }
} }
@ -274,7 +274,7 @@ public final class RichInputConnection {
mIC = mParent.getCurrentInputConnection(); mIC = mParent.getCurrentInputConnection();
if (null != mIC) { if (null != mIC) {
mIC.performEditorAction(actionId); mIC.performEditorAction(actionId);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_performEditorAction(actionId); ResearchLogger.richInputConnection_performEditorAction(actionId);
} }
} }
@ -322,7 +322,7 @@ public final class RichInputConnection {
} }
if (null != mIC) { if (null != mIC) {
mIC.sendKeyEvent(keyEvent); mIC.sendKeyEvent(keyEvent);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_sendKeyEvent(keyEvent); ResearchLogger.richInputConnection_sendKeyEvent(keyEvent);
} }
} }
@ -355,7 +355,7 @@ public final class RichInputConnection {
// TODO: support values of i != 1. At this time, this is never called with i != 1. // TODO: support values of i != 1. At this time, this is never called with i != 1.
if (null != mIC) { if (null != mIC) {
mIC.setComposingText(text, i); mIC.setComposingText(text, i);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_setComposingText(text, i); ResearchLogger.richInputConnection_setComposingText(text, i);
} }
} }
@ -367,7 +367,7 @@ public final class RichInputConnection {
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
if (null != mIC) { if (null != mIC) {
mIC.setSelection(from, to); mIC.setSelection(from, to);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_setSelection(from, to); ResearchLogger.richInputConnection_setSelection(from, to);
} }
} }
@ -396,7 +396,7 @@ public final class RichInputConnection {
mComposingText.setLength(0); mComposingText.setLength(0);
if (null != mIC) { if (null != mIC) {
mIC.commitCompletion(completionInfo); mIC.commitCompletion(completionInfo);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_commitCompletion(completionInfo); ResearchLogger.richInputConnection_commitCompletion(completionInfo);
} }
} }
@ -657,7 +657,7 @@ public final class RichInputConnection {
deleteSurroundingText(2, 0); deleteSurroundingText(2, 0);
final String doubleSpace = " "; final String doubleSpace = " ";
commitText(doubleSpace, 1); commitText(doubleSpace, 1);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_revertDoubleSpacePeriod(); ResearchLogger.richInputConnection_revertDoubleSpacePeriod();
} }
return true; return true;
@ -682,7 +682,7 @@ public final class RichInputConnection {
deleteSurroundingText(2, 0); deleteSurroundingText(2, 0);
final String text = " " + textBeforeCursor.subSequence(0, 1); final String text = " " + textBeforeCursor.subSequence(0, 1);
commitText(text, 1); commitText(text, 1);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_revertSwapPunctuation(); ResearchLogger.richInputConnection_revertSwapPunctuation();
} }
return true; return true;

View File

@ -147,8 +147,9 @@ public final class SettingsFragment extends InputMethodSettingsFragment
(PreferenceScreen) findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); (PreferenceScreen) findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY);
final Intent intent = dictionaryLink.getIntent(); final Intent intent = dictionaryLink.getIntent();
final int number = context.getPackageManager().queryIntentActivities(intent, 0).size(); final int number = context.getPackageManager().queryIntentActivities(intent, 0).size();
// TODO: The experimental version is not supported by the Dictionary Pack Service yet // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack
if (ProductionFlag.IS_EXPERIMENTAL || 0 >= number) { // Service yet
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS || 0 >= number) {
textCorrectionGroup.removePreference(dictionaryLink); textCorrectionGroup.removePreference(dictionaryLink);
} }

View File

@ -21,12 +21,12 @@ public final class ProductionFlag {
// This class is not publicly instantiable. // This class is not publicly instantiable.
} }
public static final boolean IS_EXPERIMENTAL = false; public static final boolean USES_DEVELOPMENT_ONLY_DIAGNOSTICS = false;
// When false, IS_EXPERIMENTAL_DEBUG suggests that all guarded class-private DEBUG flags should // When false, USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG suggests that all guarded
// be false, and any privacy controls should be enforced. IS_EXPERIMENTAL_DEBUG should be false // class-private DEBUG flags should be false, and any privacy controls should be enforced.
// for any released build. // USES_DEVELOPMENT_ONLY_DIAGNOSTICS must be false for any production build.
public static final boolean IS_EXPERIMENTAL_DEBUG = false; public static final boolean USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG = false;
public static final boolean IS_HARDWARE_KEYBOARD_SUPPORTED = true; public static final boolean IS_HARDWARE_KEYBOARD_SUPPORTED = true;
} }

View File

@ -617,7 +617,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
clear(); clear();
mSuggestedWords = suggestedWords; mSuggestedWords = suggestedWords;
mParams.layout(mSuggestedWords, mSuggestionsStrip, this, getWidth()); mParams.layout(mSuggestedWords, mSuggestionsStrip, this, getWidth());
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.suggestionStripView_setSuggestions(mSuggestedWords); ResearchLogger.suggestionStripView_setSuggestions(mSuggestedWords);
} }
} }

View File

@ -37,7 +37,8 @@ import java.io.IOException;
*/ */
public class LogStatement { public class LogStatement {
private static final String TAG = LogStatement.class.getSimpleName(); private static final String TAG = LogStatement.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// Constants for particular statements // Constants for particular statements
public static final String TYPE_POINTER_TRACKER_CALL_LISTENER_ON_CODE_INPUT = public static final String TYPE_POINTER_TRACKER_CALL_LISTENER_ON_CODE_INPUT =

View File

@ -46,7 +46,8 @@ import java.util.List;
*/ */
public class LogUnit { public class LogUnit {
private static final String TAG = LogUnit.class.getSimpleName(); private static final String TAG = LogUnit.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
private final ArrayList<LogStatement> mLogStatementList; private final ArrayList<LogStatement> mLogStatementList;
private final ArrayList<Object[]> mValuesList; private final ArrayList<Object[]> mValuesList;

View File

@ -60,7 +60,8 @@ import java.util.Random;
*/ */
public abstract class MainLogBuffer extends FixedLogBuffer { public abstract class MainLogBuffer extends FixedLogBuffer {
private static final String TAG = MainLogBuffer.class.getSimpleName(); private static final String TAG = MainLogBuffer.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// 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.
public static final int N_GRAM_SIZE = 2; public static final int N_GRAM_SIZE = 2;

View File

@ -34,7 +34,8 @@ import java.util.ArrayList;
public class MotionEventReader { public class MotionEventReader {
private static final String TAG = MotionEventReader.class.getSimpleName(); private static final String TAG = MotionEventReader.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// Assumes that MotionEvent.ACTION_MASK does not have all bits set.` // Assumes that MotionEvent.ACTION_MASK does not have all bits set.`
private static final int UNINITIALIZED_ACTION = ~MotionEvent.ACTION_MASK; private static final int UNINITIALIZED_ACTION = ~MotionEvent.ACTION_MASK;
// No legitimate int is negative // No legitimate int is negative

View File

@ -37,7 +37,8 @@ import com.android.inputmethod.research.MotionEventReader.ReplayData;
*/ */
public class Replayer { public class Replayer {
private static final String TAG = Replayer.class.getSimpleName(); private static final String TAG = Replayer.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
private static final long START_TIME_DELAY_MS = 500; private static final long START_TIME_DELAY_MS = 500;
private boolean mIsReplaying = false; private boolean mIsReplaying = false;

View File

@ -47,12 +47,14 @@ import java.util.concurrent.TimeUnit;
* tries to avoid creating unnecessary files if there is nothing to write. It also handles * tries to avoid creating unnecessary files if there is nothing to write. It also handles
* flushing, making sure it happens, but not too frequently. * flushing, making sure it happens, but not too frequently.
* *
* This functionality is off by default. See {@link ProductionFlag#IS_EXPERIMENTAL}. * This functionality is off by default. See
* {@link ProductionFlag#USES_DEVELOPMENT_ONLY_DIAGNOSTICS}.
*/ */
public class ResearchLog { public class ResearchLog {
// TODO: Automatically initialize the JsonWriter rather than requiring the caller to manage it. // TODO: Automatically initialize the JsonWriter rather than requiring the caller to manage it.
private static final String TAG = ResearchLog.class.getSimpleName(); private static final String TAG = ResearchLog.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
private static final long FLUSH_DELAY_IN_MS = 1000 * 5; private static final long FLUSH_DELAY_IN_MS = 1000 * 5;
/* package */ final ScheduledExecutorService mExecutor; /* package */ final ScheduledExecutorService mExecutor;

View File

@ -97,7 +97,8 @@ import java.util.UUID;
* This class logs operations on the IME keyboard, including what the user has typed. * This class logs operations on the IME keyboard, including what the user has typed.
* Data is stored locally in a file in app-specific storage. * Data is stored locally in a file in app-specific storage.
* *
* This functionality is off by default. See {@link ProductionFlag#IS_EXPERIMENTAL}. * This functionality is off by default. See
* {@link ProductionFlag#USES_DEVELOPMENT_ONLY_DIAGNOSTICS}.
*/ */
public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChangeListener { public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChangeListener {
// TODO: This class has grown quite large and combines several concerns that should be // TODO: This class has grown quite large and combines several concerns that should be
@ -109,13 +110,14 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// TODO: Refactor. Move logging invocations into their own class. // TODO: Refactor. Move logging invocations into their own class.
// TODO: Refactor. Move currentLogUnit management into separate class. // TODO: Refactor. Move currentLogUnit management into separate class.
private static final String TAG = ResearchLogger.class.getSimpleName(); private static final String TAG = ResearchLogger.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
private static final boolean DEBUG_REPLAY_AFTER_FEEDBACK = false private static final boolean DEBUG_REPLAY_AFTER_FEEDBACK = false
&& ProductionFlag.IS_EXPERIMENTAL_DEBUG; && ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// Whether the TextView contents are logged at the end of the session. true will disclose // Whether the TextView contents are logged at the end of the session. true will disclose
// private info. // private info.
private static final boolean LOG_FULL_TEXTVIEW_CONTENTS = false private static final boolean LOG_FULL_TEXTVIEW_CONTENTS = false
&& ProductionFlag.IS_EXPERIMENTAL_DEBUG; && ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// Whether the feedback dialog preserves the editable text across invocations. Should be false // Whether the feedback dialog preserves the editable text across invocations. Should be false
// for normal research builds so users do not have to delete the same feedback string they // for normal research builds so users do not have to delete the same feedback string they
// entered earlier. Should be true for builds internal to a development team so when the text // entered earlier. Should be true for builds internal to a development team so when the text
@ -128,7 +130,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// Whether all words should be recorded, leaving unsampled word between bigrams. Useful for // Whether all words should be recorded, leaving unsampled word between bigrams. Useful for
// testing. // testing.
/* package for test */ static final boolean IS_LOGGING_EVERYTHING = false /* package for test */ static final boolean IS_LOGGING_EVERYTHING = false
&& ProductionFlag.IS_EXPERIMENTAL_DEBUG; && ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// 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 NUMBER_OF_WORDS_BETWEEN_SAMPLES = private static final int NUMBER_OF_WORDS_BETWEEN_SAMPLES =
IS_LOGGING_EVERYTHING ? 0 : (DEBUG ? 2 : 18); IS_LOGGING_EVERYTHING ? 0 : (DEBUG ? 2 : 18);
@ -139,7 +141,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// Change the default indicator to something very visible. Currently two red vertical bars on // Change the default indicator to something very visible. Currently two red vertical bars on
// either side of they keyboard. // either side of they keyboard.
private static final boolean IS_SHOWING_INDICATOR_CLEARLY = false || private static final boolean IS_SHOWING_INDICATOR_CLEARLY = false ||
(IS_LOGGING_EVERYTHING && ProductionFlag.IS_EXPERIMENTAL_DEBUG); (IS_LOGGING_EVERYTHING && ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG);
// FEEDBACK_WORD_BUFFER_SIZE should add 1 because it must also hold the feedback LogUnit itself. // FEEDBACK_WORD_BUFFER_SIZE should add 1 because it must also hold the feedback LogUnit itself.
public static final int FEEDBACK_WORD_BUFFER_SIZE = (Integer.MAX_VALUE - 1) + 1; public static final int FEEDBACK_WORD_BUFFER_SIZE = (Integer.MAX_VALUE - 1) + 1;
@ -251,7 +253,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
mUploadIntent = new Intent(mLatinIME, UploaderService.class); mUploadIntent = new Intent(mLatinIME, UploaderService.class);
mUploadNowIntent = new Intent(mLatinIME, UploaderService.class); mUploadNowIntent = new Intent(mLatinIME, UploaderService.class);
mUploadNowIntent.putExtra(UploaderService.EXTRA_UPLOAD_UNCONDITIONALLY, true); mUploadNowIntent.putExtra(UploaderService.EXTRA_UPLOAD_UNCONDITIONALLY, true);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
scheduleUploadingService(mLatinIME); scheduleUploadingService(mLatinIME);
} }
mReplayer.setKeyboardSwitcher(keyboardSwitcher); mReplayer.setKeyboardSwitcher(keyboardSwitcher);
@ -1091,7 +1093,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
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"); "isUsingDevelopmentOnlyDiagnosticsDebug");
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();
@ -1113,7 +1115,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
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, IS_LOGGING_EVERYTHING, OUTPUT_FORMAT_VERSION, IS_LOGGING_EVERYTHING,
ProductionFlag.IS_EXPERIMENTAL_DEBUG); ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG);
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -23,7 +23,8 @@ 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 && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// TODO: Cleanup comments to only including those giving meaningful information. // TODO: Cleanup comments to only including those giving meaningful information.
// Number of characters entered during a typing session // Number of characters entered during a typing session

View File

@ -46,10 +46,11 @@ import java.net.URL;
*/ */
public final class Uploader { public final class Uploader {
private static final String TAG = Uploader.class.getSimpleName(); private static final String TAG = Uploader.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
// Set IS_INHIBITING_AUTO_UPLOAD to true for local testing // Set IS_INHIBITING_AUTO_UPLOAD to true for local testing
private static final boolean IS_INHIBITING_AUTO_UPLOAD = false private static final boolean IS_INHIBITING_AUTO_UPLOAD = false
&& ProductionFlag.IS_EXPERIMENTAL_DEBUG; // Force false for non-debug builds && ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
private static final int BUF_SIZE = 1024 * 8; private static final int BUF_SIZE = 1024 * 8;
private final Context mContext; private final Context mContext;

View File

@ -30,7 +30,8 @@ import com.android.inputmethod.latin.define.ProductionFlag;
*/ */
public final class UploaderService extends IntentService { public final class UploaderService extends IntentService {
private static final String TAG = UploaderService.class.getSimpleName(); private static final String TAG = UploaderService.class.getSimpleName();
private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; private static final boolean DEBUG = false
&& ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG;
public static final long RUN_INTERVAL = AlarmManager.INTERVAL_HOUR; public static final long RUN_INTERVAL = AlarmManager.INTERVAL_HOUR;
public static final String EXTRA_UPLOAD_UNCONDITIONALLY = UploaderService.class.getName() public static final String EXTRA_UPLOAD_UNCONDITIONALLY = UploaderService.class.getName()
+ ".extra.UPLOAD_UNCONDITIONALLY"; + ".extra.UPLOAD_UNCONDITIONALLY";