diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 350dc69b2..43d28be5d 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -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, // and remove this call. - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().paintIndicator(this, paint, canvas, width, height); } diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index d37b69b00..f0ca9c1ec 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -662,7 +662,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack ? mSpaceKey.getIcon(keyboard.mIconsSet, Constants.Color.ALPHA_OPAQUE) : null; final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap; mSpacebarTextSize = keyHeight * mSpacebarTextRatio; - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.mainKeyboardView_setKeyboard(keyboard); } @@ -925,10 +925,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - // Notify the research logger that the keyboard view has been attached. This is needed - // to properly show the splash screen, which requires that the window token of the - // KeyboardView be non-null. - if (ProductionFlag.IS_EXPERIMENTAL) { + // Notify the ResearchLogger (development only diagnostics) that the keyboard view has + // been attached. This is needed to properly show the splash screen, which requires that + // the window token of the KeyboardView be non-null. + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().mainKeyboardView_onAttachedToWindow(this); } } @@ -937,9 +937,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mPreviewPlacerView.removeAllViews(); - // Notify the research logger that the keyboard view has been detached. This is needed - // to invalidate the reference of {@link MainKeyboardView} to null. - if (ProductionFlag.IS_EXPERIMENTAL) { + // Notify the ResearchLogger (development only diagnostics) that the keyboard view has + // been detached. This is needed to invalidate the reference of {@link MainKeyboardView} + // to null. + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().mainKeyboardView_onDetachedFromWindow(); } } @@ -977,7 +978,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack if (key == null) { return false; } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.mainKeyboardView_onLongPress(); } 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. // Currently the same "move" event is being logged twice. - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.mainKeyboardView_processMotionEvent( me, action, eventTime, index, id, x, y); } @@ -1185,7 +1186,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack if (ENABLE_USABILITY_STUDY_LOG) { writeUsabilityStudyLog(me, action, eventTime, i, pointerId, px, py); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.mainKeyboardView_processMotionEvent( me, action, eventTime, i, pointerId, px, py); } diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index d54b98ccc..dcfae739e 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -478,7 +478,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { output, ignoreModifierKey ? " ignoreModifier" : "", altersCode ? " altersCode" : "", key.isEnabled() ? "" : " disabled")); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.pointerTracker_callListenerOnCodeInput(key, x, y, ignoreModifierKey, altersCode, code); } @@ -510,7 +510,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { withSliding ? " sliding" : "", ignoreModifierKey ? " ignoreModifier" : "", key.isEnabled() ? "": " disabled")); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.pointerTracker_callListenerOnRelease(key, primaryCode, withSliding, ignoreModifierKey); } @@ -526,7 +526,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { if (DEBUG_LISTENER) { Log.d(TAG, String.format("[%d] onCancelInput", mPointerId)); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.pointerTracker_callListenerOnCancelInput(); } mListener.onCancelInput(); @@ -843,7 +843,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { Log.w(TAG, String.format("[%d] onDownEvent:" + " ignore potential noise: time=%d distance=%d", mPointerId, deltaT, distance)); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.pointerTracker_onDownEvent(deltaT, distance * distance); } cancelTracking(); @@ -1000,7 +1000,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element { x, y, Constants.printableCode(key.mCode))); } // 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); } onUpEventInternal(x, y, eventTime); diff --git a/java/src/com/android/inputmethod/keyboard/internal/TouchScreenRegulator.java b/java/src/com/android/inputmethod/keyboard/internal/TouchScreenRegulator.java index ac83ff873..d6b1cc6fc 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/TouchScreenRegulator.java +++ b/java/src/com/android/inputmethod/keyboard/internal/TouchScreenRegulator.java @@ -145,7 +145,7 @@ public final class TouchScreenRegulator { if (handleSuddenJumping(me)) { if (DEBUG_MODE) Log.w(TAG, "onTouchEvent: ignore sudden jump " + me); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.suddenJumpingTouchEventHandler_onTouchEvent(me); } return true; diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java index 94598c810..f68e9f90b 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java @@ -289,8 +289,9 @@ final class BinaryDictionaryGetter { // 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 // 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 - if (!ProductionFlag.IS_EXPERIMENTAL) { + // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack + // Service yet + if (!ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { // We need internet access to do the following. Only do this if the package actually // has the permission. if (context.checkCallingOrSelfPermission(android.Manifest.permission.INTERNET) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index e7c64c695..8d4dd3c32 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -173,9 +173,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private int mDisplayOrientation; // 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 = - ProductionFlag.IS_EXPERIMENTAL + ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS ? null : new DictionaryPackInstallBroadcastReceiver(this); // 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(); initSuggest(); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().init(this, mKeyboardSwitcher, mSuggest); } mDisplayOrientation = getResources().getConfiguration().orientation; @@ -439,8 +440,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); registerReceiver(mReceiver, filter); - // TODO: The experimental version is not supported by the Dictionary Pack Service yet. - if (!ProductionFlag.IS_EXPERIMENTAL) { + // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack + // Service yet. + if (!ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); @@ -492,7 +494,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } mIsMainDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(this, subtypeLocale); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().initSuggest(mSuggest); } @@ -563,11 +565,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } mSettings.onDestroy(); unregisterReceiver(mReceiver); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().onDestroy(); } - // TODO: The experimental version is not supported by the Dictionary Pack Service yet. - if (!ProductionFlag.IS_EXPERIMENTAL) { + // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack + // Service yet. + if (!ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { unregisterReceiver(mDictionaryPackInstallReceiver); } LatinImeLogger.commit(); @@ -675,7 +678,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction + ", word caps = " + ((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); ResearchLogger.latinIME_onStartInputViewInternal(editorInfo, prefs); } @@ -800,7 +803,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction @Override public void onWindowHidden() { - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_onWindowHidden(mLastSelectionStart, mLastSelectionEnd, getCurrentInputConnection()); } @@ -831,7 +834,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Remove pending messages related to update suggestions mHandler.cancelUpdateSuggestionStrip(); resetComposingState(true /* alsoResetLastComposedWord */); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().latinIME_onFinishInputViewInternal(); } } @@ -852,7 +855,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction + ", cs=" + composingSpanStart + ", ce=" + composingSpanEnd); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { final boolean expectingUpdateSelectionFromLogger = ResearchLogger.getAndClearLatinIMEExpectingUpdateSelection(); ResearchLogger.latinIME_onUpdateSelection(mLastSelectionStart, mLastSelectionEnd, @@ -984,7 +987,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mApplicationSpecifiedCompletions = applicationSpecifiedCompletions; if (applicationSpecifiedCompletions == null) { clearSuggestionStrip(); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_onDisplayCompletions(null); } return; @@ -1005,7 +1008,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction setSuggestedWords(suggestedWords, isAutoCorrection); setAutoCorrectionIndicator(isAutoCorrection); setSuggestionStripShown(true); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions); } } @@ -1144,7 +1147,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (typedWord.length() > 0) { commitChosenWord(typedWord, LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, separatorString); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().onWordFinished(typedWord, mWordComposer.isBatchMode()); } } @@ -1184,7 +1187,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mConnection.deleteSurroundingText(2, 0); final String text = lastTwo.charAt(1) + " "; mConnection.commitText(text, 1); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_swapSwapperAndSpace(lastTwo, text); } mKeyboardSwitcher.updateShiftState(); @@ -1204,7 +1207,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mConnection.deleteSurroundingText(2, 0); final String textToInsert = ". "; mConnection.commitText(textToInsert, 1); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_maybeDoubleSpacePeriod(textToInsert, false /* isBatchMode */); } @@ -1319,7 +1322,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } private void sendKeyCodePoint(final int code) { - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_sendKeyCodePoint(code); } // TODO: Remove this special handling of digit letters. @@ -1345,7 +1348,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Implementation of {@link KeyboardActionListener}. @Override 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); } final long when = SystemClock.uptimeMillis(); @@ -1397,7 +1400,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction handleLanguageSwitchKey(); break; case Constants.CODE_RESEARCH: - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().onResearchKeySelected(this); } break; @@ -1489,7 +1492,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction promotePhantomSpace(); } mConnection.commitText(text, 1); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_onTextInput(text, false /* isBatchMode */); } mConnection.endBatchEdit(); @@ -1670,7 +1673,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mConnection.setComposingText(batchInputText, 1); mExpectingUpdateSelection = true; mConnection.endBatchEdit(); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_onEndBatchInput(batchInputText, 0, suggestedWords); } // 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(); if (length > 0) { if (mWordComposer.isBatchMode()) { - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { final String word = mWordComposer.getTypedWord(); ResearchLogger.latinIME_handleBackspace_batch(word, 1); ResearchLogger.getInstance().uncommitCurrentLogUnit( @@ -1780,7 +1783,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // later (typically, in a subsequent press on backspace). mLastSelectionEnd = mLastSelectionStart; mConnection.deleteSurroundingText(numCharsDeleted, 0); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_handleBackspace(numCharsDeleted); } } else { @@ -1799,12 +1802,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } else { mConnection.deleteSurroundingText(1, 0); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_handleBackspace(1); } if (mDeleteCount > DELETE_ACCELERATE_AT) { mConnection.deleteSurroundingText(1, 0); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { 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. private boolean handleSeparator(final int primaryCode, final int x, final int y, final int spaceState) { - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.recordTimeForLogUnitSplit(); ResearchLogger.latinIME_handleSeparator(primaryCode, mWordComposer.isComposingWord()); } @@ -2148,7 +2151,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (mSettings.isInternal()) { Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { final SuggestedWords suggestedWords = mSuggestedWords; ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer.isBatchMode(), suggestedWords); @@ -2184,7 +2187,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction final int primaryCode = suggestion.charAt(0); onCodeInput(primaryCode, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, false /* isBatchMode */, suggestedWords.mIsPrediction); } @@ -2225,7 +2228,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mExpectingUpdateSelection = true; commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK, LastComposedWord.NOT_A_SEPARATOR); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion, mWordComposer.isBatchMode()); } @@ -2326,7 +2329,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction restartSuggestionsOnWordBeforeCursor(word); // 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. - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().uncommitCurrentLogUnit(word.toString(), true /* dumpCurrentLogUnit */); } @@ -2372,7 +2375,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction Stats.onSeparator(mLastComposedWord.mSeparatorString, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE); } - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_revertCommit(committedWord, originallyTypedWord, mWordComposer.isBatchMode(), mLastComposedWord.mSeparatorString); ResearchLogger.getInstance().uncommitCurrentLogUnit(committedWord, @@ -2389,7 +2392,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction public void promotePhantomSpace() { if (mSettings.getCurrent().shouldInsertSpacesAutomatically()) { sendKeyCodePoint(Constants.CODE_SPACE); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_promotePhantomSpace(); } } diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 7300dbd23..8a7ade49e 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -142,7 +142,7 @@ public final class RichInputConnection { if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor); if (null != mIC) { mIC.finishComposingText(); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_finishComposingText(); } } @@ -164,7 +164,7 @@ public final class RichInputConnection { mComposingText.setLength(0); if (null != mIC) { mIC.finishComposingText(); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_finishComposingText(); } } @@ -263,7 +263,7 @@ public final class RichInputConnection { } if (null != mIC) { mIC.deleteSurroundingText(i, j); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_deleteSurroundingText(i, j); } } @@ -274,7 +274,7 @@ public final class RichInputConnection { mIC = mParent.getCurrentInputConnection(); if (null != mIC) { mIC.performEditorAction(actionId); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_performEditorAction(actionId); } } @@ -322,7 +322,7 @@ public final class RichInputConnection { } if (null != mIC) { mIC.sendKeyEvent(keyEvent); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { 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. if (null != mIC) { mIC.setComposingText(text, i); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_setComposingText(text, i); } } @@ -367,7 +367,7 @@ public final class RichInputConnection { if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); if (null != mIC) { mIC.setSelection(from, to); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_setSelection(from, to); } } @@ -396,7 +396,7 @@ public final class RichInputConnection { mComposingText.setLength(0); if (null != mIC) { mIC.commitCompletion(completionInfo); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_commitCompletion(completionInfo); } } @@ -657,7 +657,7 @@ public final class RichInputConnection { deleteSurroundingText(2, 0); final String doubleSpace = " "; commitText(doubleSpace, 1); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_revertDoubleSpacePeriod(); } return true; @@ -682,7 +682,7 @@ public final class RichInputConnection { deleteSurroundingText(2, 0); final String text = " " + textBeforeCursor.subSequence(0, 1); commitText(text, 1); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_revertSwapPunctuation(); } return true; diff --git a/java/src/com/android/inputmethod/latin/SettingsFragment.java b/java/src/com/android/inputmethod/latin/SettingsFragment.java index cc9f168d0..840829c24 100644 --- a/java/src/com/android/inputmethod/latin/SettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/SettingsFragment.java @@ -147,8 +147,9 @@ public final class SettingsFragment extends InputMethodSettingsFragment (PreferenceScreen) findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); final Intent intent = dictionaryLink.getIntent(); final int number = context.getPackageManager().queryIntentActivities(intent, 0).size(); - // TODO: The experimental version is not supported by the Dictionary Pack Service yet - if (ProductionFlag.IS_EXPERIMENTAL || 0 >= number) { + // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack + // Service yet + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS || 0 >= number) { textCorrectionGroup.removePreference(dictionaryLink); } diff --git a/java/src/com/android/inputmethod/latin/define/ProductionFlag.java b/java/src/com/android/inputmethod/latin/define/ProductionFlag.java index 3df0d044e..699e47b6a 100644 --- a/java/src/com/android/inputmethod/latin/define/ProductionFlag.java +++ b/java/src/com/android/inputmethod/latin/define/ProductionFlag.java @@ -21,12 +21,12 @@ public final class ProductionFlag { // 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 - // 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; + // When false, USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG suggests that all guarded + // class-private DEBUG flags should be false, and any privacy controls should be enforced. + // USES_DEVELOPMENT_ONLY_DIAGNOSTICS must be false for any production build. + public static final boolean USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG = false; public static final boolean IS_HARDWARE_KEYBOARD_SUPPORTED = true; } diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java index 5a29eee4e..8c3d3b08c 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java @@ -617,7 +617,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick clear(); mSuggestedWords = suggestedWords; mParams.layout(mSuggestedWords, mSuggestionsStrip, this, getWidth()); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.suggestionStripView_setSuggestions(mSuggestedWords); } } diff --git a/java/src/com/android/inputmethod/research/LogStatement.java b/java/src/com/android/inputmethod/research/LogStatement.java index 09b12fcfa..06b918af5 100644 --- a/java/src/com/android/inputmethod/research/LogStatement.java +++ b/java/src/com/android/inputmethod/research/LogStatement.java @@ -37,7 +37,8 @@ import java.io.IOException; */ public class LogStatement { 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 public static final String TYPE_POINTER_TRACKER_CALL_LISTENER_ON_CODE_INPUT = diff --git a/java/src/com/android/inputmethod/research/LogUnit.java b/java/src/com/android/inputmethod/research/LogUnit.java index 61b6df0f4..1c01675bd 100644 --- a/java/src/com/android/inputmethod/research/LogUnit.java +++ b/java/src/com/android/inputmethod/research/LogUnit.java @@ -46,7 +46,8 @@ import java.util.List; */ public class LogUnit { 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 mLogStatementList; private final ArrayList mValuesList; diff --git a/java/src/com/android/inputmethod/research/MainLogBuffer.java b/java/src/com/android/inputmethod/research/MainLogBuffer.java index 9aa60f859..3303d2bdb 100644 --- a/java/src/com/android/inputmethod/research/MainLogBuffer.java +++ b/java/src/com/android/inputmethod/research/MainLogBuffer.java @@ -60,7 +60,8 @@ import java.util.Random; */ public abstract class MainLogBuffer extends FixedLogBuffer { 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. public static final int N_GRAM_SIZE = 2; diff --git a/java/src/com/android/inputmethod/research/MotionEventReader.java b/java/src/com/android/inputmethod/research/MotionEventReader.java index e59adfa19..e1cc2da73 100644 --- a/java/src/com/android/inputmethod/research/MotionEventReader.java +++ b/java/src/com/android/inputmethod/research/MotionEventReader.java @@ -34,7 +34,8 @@ import java.util.ArrayList; public class MotionEventReader { 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.` private static final int UNINITIALIZED_ACTION = ~MotionEvent.ACTION_MASK; // No legitimate int is negative diff --git a/java/src/com/android/inputmethod/research/Replayer.java b/java/src/com/android/inputmethod/research/Replayer.java index a9b7a9d0c..903875f3c 100644 --- a/java/src/com/android/inputmethod/research/Replayer.java +++ b/java/src/com/android/inputmethod/research/Replayer.java @@ -37,7 +37,8 @@ import com.android.inputmethod.research.MotionEventReader.ReplayData; */ public class Replayer { 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 boolean mIsReplaying = false; diff --git a/java/src/com/android/inputmethod/research/ResearchLog.java b/java/src/com/android/inputmethod/research/ResearchLog.java index 080366e9b..35a491f2c 100644 --- a/java/src/com/android/inputmethod/research/ResearchLog.java +++ b/java/src/com/android/inputmethod/research/ResearchLog.java @@ -47,12 +47,14 @@ import java.util.concurrent.TimeUnit; * tries to avoid creating unnecessary files if there is nothing to write. It also handles * 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 { // TODO: Automatically initialize the JsonWriter rather than requiring the caller to manage it. 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; /* package */ final ScheduledExecutorService mExecutor; diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index e932a2d91..a38a226f0 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -97,7 +97,8 @@ import java.util.UUID; * 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. * - * 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 { // 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 currentLogUnit management into separate class. 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 - && 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 // private info. 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 // 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 @@ -128,7 +130,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang // Whether all words should be recorded, leaving unsampled word between bigrams. Useful for // testing. /* 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. private static final int NUMBER_OF_WORDS_BETWEEN_SAMPLES = 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 // either side of they keyboard. 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. 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); mUploadNowIntent = new Intent(mLatinIME, UploaderService.class); mUploadNowIntent.putExtra(UploaderService.EXTRA_UPLOAD_UNCONDITIONALLY, true); - if (ProductionFlag.IS_EXPERIMENTAL) { + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { scheduleUploadingService(mLatinIME); } mReplayer.setKeyboardSwitcher(keyboardSwitcher); @@ -1091,7 +1093,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang new LogStatement("LatinImeOnStartInputViewInternal", false, false, "uuid", "packageName", "inputType", "imeOptions", "fieldId", "display", "model", "prefs", "versionCode", "versionName", "outputFormatVersion", "logEverything", - "isExperimentalDebug"); + "isUsingDevelopmentOnlyDiagnosticsDebug"); public static void latinIME_onStartInputViewInternal(final EditorInfo editorInfo, final SharedPreferences prefs) { final ResearchLogger researchLogger = getInstance(); @@ -1113,7 +1115,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang Integer.toHexString(editorInfo.imeOptions), editorInfo.fieldId, Build.DISPLAY, Build.MODEL, prefs, versionCode, versionName, OUTPUT_FORMAT_VERSION, IS_LOGGING_EVERYTHING, - ProductionFlag.IS_EXPERIMENTAL_DEBUG); + ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS_DEBUG); } catch (NameNotFoundException e) { e.printStackTrace(); } diff --git a/java/src/com/android/inputmethod/research/Statistics.java b/java/src/com/android/inputmethod/research/Statistics.java index 50e2b7fbc..7f6c851bb 100644 --- a/java/src/com/android/inputmethod/research/Statistics.java +++ b/java/src/com/android/inputmethod/research/Statistics.java @@ -23,7 +23,8 @@ import com.android.inputmethod.latin.define.ProductionFlag; public class Statistics { 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. // Number of characters entered during a typing session diff --git a/java/src/com/android/inputmethod/research/Uploader.java b/java/src/com/android/inputmethod/research/Uploader.java index 152b94d30..ba05ec12b 100644 --- a/java/src/com/android/inputmethod/research/Uploader.java +++ b/java/src/com/android/inputmethod/research/Uploader.java @@ -46,10 +46,11 @@ import java.net.URL; */ public final class Uploader { 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 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 final Context mContext; diff --git a/java/src/com/android/inputmethod/research/UploaderService.java b/java/src/com/android/inputmethod/research/UploaderService.java index 26b651056..6a9f5c1f4 100644 --- a/java/src/com/android/inputmethod/research/UploaderService.java +++ b/java/src/com/android/inputmethod/research/UploaderService.java @@ -30,7 +30,8 @@ import com.android.inputmethod.latin.define.ProductionFlag; */ public final class UploaderService extends IntentService { 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 String EXTRA_UPLOAD_UNCONDITIONALLY = UploaderService.class.getName() + ".extra.UPLOAD_UNCONDITIONALLY";