Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java

Issue 1664443002: Compile out Java IME logs using a static boolean. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
index 6011be2416ca9aae07aaaaec6d450033d57521c5..16e64e38ce2e00aee4246a941f3dc7f96efddb96 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
@@ -52,6 +52,7 @@ import org.chromium.ui.picker.InputDialogContainer;
@JNINamespace("content")
public class ImeAdapter {
private static final String TAG = "cr_Ime";
+ private static final boolean DEBUG_LOGS = false;
private static final int COMPOSITION_KEY_CODE = 229;
@@ -142,7 +143,7 @@ public class ImeAdapter {
// ImeAdapter#dispatchKeyEvent().
if (mTextInputType == TextInputType.NONE) {
mInputConnection = null;
- Log.d(TAG, "onCreateInputConnection returns null.");
+ if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection returns null.");
// InputMethodService evaluates fullscreen mode even when the new input connection is
// null. This makes sure IME doesn't enter fullscreen mode or open custom UI.
outAttrs.imeOptions =
@@ -160,7 +161,7 @@ public class ImeAdapter {
int initialSelEnd = outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable);
mInputConnection = mInputConnectionFactory.get(
mViewEmbedder.getAttachedView(), this, initialSelStart, initialSelEnd, outAttrs);
- Log.d(TAG, "onCreateInputConnection");
+ if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection");
return mInputConnection;
}
@@ -246,8 +247,10 @@ public class ImeAdapter {
*/
public void updateKeyboardVisibility(int textInputType,
int textInputFlags, boolean showIfNeeded) {
- Log.d(TAG, "updateKeyboardVisibility: type [%d->%d], flags [%d], show [%b], ",
- mTextInputType, textInputType, textInputFlags, showIfNeeded);
+ if (DEBUG_LOGS) {
+ Log.w(TAG, "updateKeyboardVisibility: type [%d->%d], flags [%d], show [%b], ",
+ mTextInputType, textInputType, textInputFlags, showIfNeeded);
+ }
mTextInputFlags = textInputFlags;
if (mTextInputType != textInputType) {
mTextInputType = textInputType;
@@ -306,7 +309,7 @@ public class ImeAdapter {
* Show soft keyboard only if it is the current keyboard configuration.
*/
private void showSoftKeyboard() {
- Log.d(TAG, "showSoftKeyboard");
+ if (DEBUG_LOGS) Log.w(TAG, "showSoftKeyboard");
mInputMethodManagerWrapper.showSoftInput(
mViewEmbedder.getAttachedView(), 0, mViewEmbedder.getNewShowKeyboardReceiver());
if (mViewEmbedder.getAttachedView().getResources().getConfiguration().keyboard
@@ -319,7 +322,7 @@ public class ImeAdapter {
* Hide soft keyboard.
*/
private void hideKeyboard() {
- Log.d(TAG, "hideKeyboard");
+ if (DEBUG_LOGS) Log.w(TAG, "hideKeyboard");
View view = mViewEmbedder.getAttachedView();
if (mInputMethodManagerWrapper.isActive(view)) {
// NOTE: we should not set ResultReceiver here. Otherwise, IMM will own ContentViewCore
@@ -345,7 +348,9 @@ public class ImeAdapter {
// Deep copy newConfig so that we can notice the difference.
mCurrentConfig = new Configuration(newConfig);
- Log.d(TAG, "onKeyboardConfigurationChanged: mTextInputType [%d]", mTextInputType);
+ if (DEBUG_LOGS) {
+ Log.w(TAG, "onKeyboardConfigurationChanged: mTextInputType [%d]", mTextInputType);
+ }
if (mTextInputType != TextInputType.NONE) {
restartInput();
// By default, we show soft keyboard on keyboard changes. This is useful
@@ -360,7 +365,7 @@ public class ImeAdapter {
* @param gainFocus True if we're gaining focus.
*/
public void onViewFocusChanged(boolean gainFocus) {
- Log.d(TAG, "onViewFocusChanged: gainFocus [%b]", gainFocus);
+ if (DEBUG_LOGS) Log.w(TAG, "onViewFocusChanged: gainFocus [%b]", gainFocus);
if (!gainFocus) hideKeyboard();
}
@@ -368,7 +373,7 @@ public class ImeAdapter {
* Move cursor to the end of the current selection.
*/
public void moveCursorToSelectionEnd() {
- Log.d(TAG, "movecursorToEnd");
+ if (DEBUG_LOGS) Log.w(TAG, "movecursorToEnd");
if (mInputConnection != null) {
int selectionEnd = Selection.getSelectionEnd(mEditable);
mInputConnection.setSelection(selectionEnd, selectionEnd);
@@ -389,7 +394,7 @@ public class ImeAdapter {
}
public boolean dispatchKeyEvent(KeyEvent event) {
- Log.d(TAG, "dispatchKeyEvent: action [%d], keycode [%d]", event.getAction(),
+ if (DEBUG_LOGS) Log.w(TAG, "dispatchKeyEvent: action [%d], keycode [%d]", event.getAction(),
event.getKeyCode());
if (mInputConnection != null) {
return mInputConnection.sendKeyEvent(event);
@@ -423,7 +428,7 @@ public class ImeAdapter {
* @see BaseInputConnection#performContextMenuAction(int)
*/
boolean performContextMenuAction(int id) {
- Log.d(TAG, "performContextMenuAction: id [%d]", id);
+ if (DEBUG_LOGS) Log.w(TAG, "performContextMenuAction: id [%d]", id);
return mViewEmbedder.performContextMenuAction(id);
}
@@ -555,7 +560,7 @@ public class ImeAdapter {
@CalledByNative
private void focusedNodeChanged(boolean isEditable) {
- Log.d(TAG, "focusedNodeChanged: isEditable [%b]", isEditable);
+ if (DEBUG_LOGS) Log.w(TAG, "focusedNodeChanged: isEditable [%b]", isEditable);
if (mTextInputType != TextInputType.NONE && mInputConnection != null && isEditable) {
restartInput();
}
@@ -563,7 +568,9 @@ public class ImeAdapter {
@CalledByNative
private void populateUnderlinesFromSpans(CharSequence text, long underlines) {
- Log.d(TAG, "populateUnderlinesFromSpans: text [%s], underlines [%d]", text, underlines);
+ if (DEBUG_LOGS) {
+ Log.w(TAG, "populateUnderlinesFromSpans: text [%s], underlines [%d]", text, underlines);
+ }
if (!(text instanceof SpannableString)) return;
SpannableString spannableString = ((SpannableString) text);
@@ -583,13 +590,13 @@ public class ImeAdapter {
@CalledByNative
private void cancelComposition() {
- Log.d(TAG, "cancelComposition");
+ if (DEBUG_LOGS) Log.w(TAG, "cancelComposition");
if (mInputConnection != null) restartInput();
}
@CalledByNative
private void detach() {
- Log.d(TAG, "detach");
+ if (DEBUG_LOGS) Log.w(TAG, "detach");
mNativeImeAdapterAndroid = 0;
}
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698