From c0a732f0320b0d125610adf23d14d742860b5fd3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 5 Aug 2013 18:39:07 +0900 Subject: [PATCH] Remove CODE_RESEARCH Instead of CODE_RESEARCH, special outputText ".research." is used to invoke a research feedback dialog. Change-Id: Ic95c956ab4f2b5f0c3f2205c9bbcdcfb67db5d6e --- .../keyboard/internal/KeyboardCodesSet.java | 3 --- java/src/com/android/inputmethod/latin/Constants.java | 2 -- java/src/com/android/inputmethod/latin/LatinIME.java | 10 +++++----- .../android/inputmethod/research/ResearchLogger.java | 11 ++++------- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java index d65aae2dc..69ffb4c75 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java @@ -53,7 +53,6 @@ public final class KeyboardCodesSet { "key_action_previous", "key_shift_enter", "key_language_switch", - "key_research", "key_unspecified", "key_left_parenthesis", "key_right_parenthesis", @@ -90,7 +89,6 @@ public final class KeyboardCodesSet { Constants.CODE_ACTION_PREVIOUS, Constants.CODE_SHIFT_ENTER, Constants.CODE_LANGUAGE_SWITCH, - Constants.CODE_RESEARCH, Constants.CODE_UNSPECIFIED, CODE_LEFT_PARENTHESIS, CODE_RIGHT_PARENTHESIS, @@ -118,7 +116,6 @@ public final class KeyboardCodesSet { DEFAULT[12], DEFAULT[13], DEFAULT[14], - DEFAULT[15], CODE_RIGHT_PARENTHESIS, CODE_LEFT_PARENTHESIS, CODE_GREATER_THAN_SIGN, diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java index 9848f3d05..f91a21c7a 100644 --- a/java/src/com/android/inputmethod/latin/Constants.java +++ b/java/src/com/android/inputmethod/latin/Constants.java @@ -187,7 +187,6 @@ public final class Constants { public static final int CODE_ACTION_NEXT = -8; public static final int CODE_ACTION_PREVIOUS = -9; public static final int CODE_LANGUAGE_SWITCH = -10; - public static final int CODE_RESEARCH = -11; public static final int CODE_SHIFT_ENTER = -12; // Code value representing the code is not specified. public static final int CODE_UNSPECIFIED = -13; @@ -212,7 +211,6 @@ public final class Constants { case CODE_UNSPECIFIED: return "unspec"; case CODE_TAB: return "tab"; case CODE_ENTER: return "enter"; - case CODE_RESEARCH: return "research"; default: if (code < CODE_SPACE) return String.format("'\\u%02x'", code); if (code < 0x100) return String.format("'%c'", code); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index addf5c3e9..385e884ab 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1512,11 +1512,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen case Constants.CODE_LANGUAGE_SWITCH: handleLanguageSwitchKey(); break; - case Constants.CODE_RESEARCH: - if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { - ResearchLogger.getInstance().onResearchKeySelected(this); - } - break; case Constants.CODE_ENTER: final EditorInfo editorInfo = getCurrentInputEditorInfo(); final int imeOptionsActionId = @@ -1608,6 +1603,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen resetComposingState(true /* alsoResetLastComposedWord */); } mHandler.postUpdateSuggestionStrip(); + if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS + && ResearchLogger.RESEARCH_KEY_OUTPUT_TEXT.equals(rawText)) { + ResearchLogger.getInstance().onResearchKeySelected(this); + return; + } final String text = specificTldProcessingOnTextInput(rawText); if (SPACE_STATE_PHANTOM == mSpaceState) { promotePhantomSpace(); diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index 25187ced1..0bd493970 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -132,6 +132,9 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang // 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; + // The special output text to invoke a research feedback dialog. + public static final String RESEARCH_KEY_OUTPUT_TEXT = ".research."; + // constants related to specific log points private static final String WHITESPACE_SEPARATORS = " \t\n\r"; private static final int MAX_INPUTVIEW_LENGTH_TO_CAPTURE = 8192; // must be >=1 @@ -402,6 +405,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } public void onResearchKeySelected(final LatinIME latinIME) { + mCurrentLogUnit.removeResearchButtonInvocation(); if (mInFeedbackDialog) { Toast.makeText(latinIME, R.string.research_please_exit_feedback_form, Toast.LENGTH_LONG).show(); @@ -1506,16 +1510,9 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang Constants.printableCode(scrubDigitFromCodePoint(code)), outputText == null ? null : scrubDigitsFromString(outputText.toString()), x, y, ignoreModifierKey, altersCode, key.isEnabled()); - if (code == Constants.CODE_RESEARCH) { - researchLogger.suppressResearchKeyMotionData(); - } } } - private void suppressResearchKeyMotionData() { - mCurrentLogUnit.removeResearchButtonInvocation(); - } - /** * Log a call to PointerTracker.callListenerCallListenerOnRelease(). *