New API in InputConnection to signal IME's text correction.
Scafolding so that the IME team can start working on this feature.
The animation part in the TextView is missing.
Change-Id: I8225538564370fba1500e3539742a8ab79bdd199
diff --git a/core/java/com/android/internal/view/IInputConnectionWrapper.java b/core/java/com/android/internal/view/IInputConnectionWrapper.java
index 986ba38..b5df812 100644
--- a/core/java/com/android/internal/view/IInputConnectionWrapper.java
+++ b/core/java/com/android/internal/view/IInputConnectionWrapper.java
@@ -24,6 +24,7 @@
import android.util.Log;
import android.view.KeyEvent;
import android.view.inputmethod.CompletionInfo;
+import android.view.inputmethod.CorrectionInfo;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection;
@@ -39,6 +40,7 @@
private static final int DO_GET_EXTRACTED_TEXT = 40;
private static final int DO_COMMIT_TEXT = 50;
private static final int DO_COMMIT_COMPLETION = 55;
+ private static final int DO_COMMIT_CORRECTION = 56;
private static final int DO_SET_SELECTION = 57;
private static final int DO_PERFORM_EDITOR_ACTION = 58;
private static final int DO_PERFORM_CONTEXT_MENU_ACTION = 59;
@@ -116,6 +118,10 @@
dispatchMessage(obtainMessageO(DO_COMMIT_COMPLETION, text));
}
+ public void commitCorrection(CorrectionInfo info) {
+ dispatchMessage(obtainMessageO(DO_COMMIT_CORRECTION, info));
+ }
+
public void setSelection(int start, int end) {
dispatchMessage(obtainMessageII(DO_SET_SELECTION, start, end));
}
@@ -309,6 +315,15 @@
ic.commitCompletion((CompletionInfo)msg.obj);
return;
}
+ case DO_COMMIT_CORRECTION: {
+ InputConnection ic = mInputConnection.get();
+ if (ic == null || !isActive()) {
+ Log.w(TAG, "commitCorrection on inactive InputConnection");
+ return;
+ }
+ ic.commitCorrection((CorrectionInfo)msg.obj);
+ return;
+ }
case DO_SET_COMPOSING_TEXT: {
InputConnection ic = mInputConnection.get();
if (ic == null || !isActive()) {