Enable CursorAnchorInfo callback when necessary

Change-Id: If3dda7442418053600ac935da50baaddb0e31d37
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 3993517..2cf7a04 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -424,9 +424,12 @@
                                 latinIme.getCurrentInputConnection(), true /* enableMonitor */);
                     }
                     if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) {
-                        InputConnectionCompatUtils.requestCursorAnchorInfo(
-                                latinIme.getCurrentInputConnection(), true /* enableMonitor */,
-                                true /* requestImmediateCallback */);
+                        // AcceptTypedWord feature relies on CursorAnchorInfo.
+                        if (latinIme.mSettings.getCurrent().mShouldShowUiToAcceptTypedWord) {
+                            InputConnectionCompatUtils.requestCursorAnchorInfo(
+                                    latinIme.getCurrentInputConnection(), true /* enableMonitor */,
+                                    true /* requestImmediateCallback */);
+                        }
                     }
                 }
             }
diff --git a/java/src/com/android/inputmethod/latin/define/ProductionFlags.java b/java/src/com/android/inputmethod/latin/define/ProductionFlags.java
index d385cf8..461c226 100644
--- a/java/src/com/android/inputmethod/latin/define/ProductionFlags.java
+++ b/java/src/com/android/inputmethod/latin/define/ProductionFlags.java
@@ -29,7 +29,7 @@
      *  and prior. In general, this callback provides more detailed positional information,
      *  even though an explicit support is required by the editor.
      */
-    public static final boolean ENABLE_CURSOR_ANCHOR_INFO_CALLBACK = false;
+    public static final boolean ENABLE_CURSOR_ANCHOR_INFO_CALLBACK = true;
 
     /**
      * When true, enable {@link InputMethodService#onUpdateCursor} callback via