Remove ENABLE_CURSOR_ANCHOR_INFO_CALLBACK

We can now start relying on L APIs even in unbundled release.

This means ENABLE_CURSOR_ANCHOR_INFO_CALLBACK can be always true.
Hence we simply remove it.

Change-Id: I0353e992e97e252059f83accea100504594bf171
main
Yohei Yukawa 2014-10-06 19:32:01 +09:00
parent 8b24e7abde
commit 81c2dfe9c6
3 changed files with 8 additions and 20 deletions

View File

@ -23,14 +23,6 @@ public final class ProductionFlags {
public static final boolean IS_HARDWARE_KEYBOARD_SUPPORTED = false; public static final boolean IS_HARDWARE_KEYBOARD_SUPPORTED = false;
/**
* When true, enable {@link InputMethodService#onUpdateCursorAnchorInfo} callback via
* {@link InputConnection#requestUpdateCursorAnchorInfo}. This flag has no effect in API
* Level 20 and prior. In general, this callback provides detailed positional information,
* even though an explicit support is required by the editor.
*/
public static final boolean ENABLE_CURSOR_ANCHOR_INFO_CALLBACK = true;
/** /**
* Include all suggestions from all dictionaries in {@link SuggestedWords#mRawSuggestions}. * Include all suggestions from all dictionaries in {@link SuggestedWords#mRawSuggestions}.
*/ */

View File

@ -755,12 +755,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (prevExtractEditText == nextExtractEditText) { if (prevExtractEditText == nextExtractEditText) {
return; return;
} }
if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK && prevExtractEditText != null) { if (prevExtractEditText != null) {
prevExtractEditText.getViewTreeObserver().removeOnPreDrawListener( prevExtractEditText.getViewTreeObserver().removeOnPreDrawListener(
mExtractTextViewPreDrawListener); mExtractTextViewPreDrawListener);
} }
mExtractEditText = nextExtractEditText; mExtractEditText = nextExtractEditText;
if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK && mExtractEditText != null) { if (mExtractEditText != null) {
mExtractEditText.getViewTreeObserver().addOnPreDrawListener( mExtractEditText.getViewTreeObserver().addOnPreDrawListener(
mExtractTextViewPreDrawListener); mExtractTextViewPreDrawListener);
} }
@ -776,8 +776,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}; };
private void onExtractTextViewPreDraw() { private void onExtractTextViewPreDraw() {
if (!ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK || !isFullscreenMode() if (!isFullscreenMode() || mExtractEditText == null) {
|| mExtractEditText == null) {
return; return;
} }
final CursorAnchorInfo info = CursorAnchorInfoUtils.getCursorAnchorInfo(mExtractEditText); final CursorAnchorInfo info = CursorAnchorInfoUtils.getCursorAnchorInfo(mExtractEditText);
@ -1060,7 +1059,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// We cannot mark this method as @Override until new SDK becomes publicly available. // We cannot mark this method as @Override until new SDK becomes publicly available.
// @Override // @Override
public void onUpdateCursorAnchorInfo(final CursorAnchorInfo info) { public void onUpdateCursorAnchorInfo(final CursorAnchorInfo info) {
if (!ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK || isFullscreenMode()) { if (isFullscreenMode()) {
return; return;
} }
mInputLogic.onUpdateCursorAnchorInfo(CursorAnchorInfoCompatWrapper.fromObject(info)); mInputLogic.onUpdateCursorAnchorInfo(CursorAnchorInfoCompatWrapper.fromObject(info));

View File

@ -169,14 +169,11 @@ public final class InputLogic {
mInputLogicHandler.reset(); mInputLogicHandler.reset();
} }
if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) { if (settingsValues.mShouldShowUiToAcceptTypedWord) {
// AcceptTypedWord feature relies on CursorAnchorInfo. mConnection.requestCursorUpdates(true /* enableMonitor */,
if (settingsValues.mShouldShowUiToAcceptTypedWord) { true /* requestImmediateCallback */);
mConnection.requestCursorUpdates(true /* enableMonitor */,
true /* requestImmediateCallback */);
}
mTextDecorator.reset();
} }
mTextDecorator.reset();
} }
/** /**