Fix lint warnings in IInputConnectionWrapper
This is a clean-up CL of IInputConnectionWrapper with no behavior change. As a preparation to move IInputConnectionWrapper into com.android.internal.inputmethod this CL cleans up all the existing lint warnings in this file. There should be no behavior change in this CL. Bug: 192412909 Test: presubmit Change-Id: I215437cc4e45f369af56e3d42fdc2bdc6d353a4f
This commit is contained in:
@@ -50,6 +50,9 @@ import com.android.internal.inputmethod.InputConnectionProtoDumper;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* Takes care of remote method invocations of {@link InputConnection} in the IME client side.
|
||||
*/
|
||||
public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
private static final String TAG = "IInputConnectionWrapper";
|
||||
private static final boolean DEBUG = false;
|
||||
@@ -78,6 +81,9 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
mServedView = new WeakReference<>(servedView);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link InputConnection} to which incoming IPCs will be dispatched.
|
||||
*/
|
||||
@Nullable
|
||||
public InputConnection getInputConnection() {
|
||||
synchronized (mLock) {
|
||||
@@ -99,6 +105,11 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
return mServedView.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this object needs to be permanently deactivated.
|
||||
*
|
||||
* <p>Multiple invocations will be simply ignored.</p>
|
||||
*/
|
||||
public void deactivate() {
|
||||
if (isFinished()) {
|
||||
// This is a small performance optimization. Still only the 1st call of
|
||||
@@ -136,6 +147,13 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
+ "}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by {@link InputMethodManager} to dump the editor state.
|
||||
*
|
||||
* @param proto {@link ProtoOutputStream} to which the editor state should be dumped.
|
||||
* @param fieldId the ID to be passed to
|
||||
* {@link DumpableInputConnection#dumpDebug(ProtoOutputStream, long)}.
|
||||
*/
|
||||
public void dumpDebug(ProtoOutputStream proto, long fieldId) {
|
||||
synchronized (mLock) {
|
||||
// Check that the call is initiated in the main thread of the current InputConnection
|
||||
@@ -150,6 +168,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTextAfterCursor(int length, int flags, ICharSequenceResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#getTextAfterCursor");
|
||||
@@ -180,6 +199,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTextBeforeCursor(int length, int flags, ICharSequenceResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#getTextBeforeCursor");
|
||||
@@ -210,6 +230,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSelectedText(int flags, ICharSequenceResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#getSelectedText");
|
||||
@@ -240,11 +261,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches the request for retrieving surrounding text.
|
||||
*
|
||||
* <p>See {@link InputConnection#getSurroundingText(int, int, int)}.
|
||||
*/
|
||||
@Override
|
||||
public void getSurroundingText(int beforeLength, int afterLength, int flags,
|
||||
ISurroundingTextResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
@@ -276,6 +293,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCursorCapsMode(int reqModes, IIntResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#getCursorCapsMode");
|
||||
@@ -306,6 +324,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getExtractedText(ExtractedTextRequest request, int flags,
|
||||
IExtractedTextResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
@@ -337,6 +356,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitText(CharSequence text, int newCursorPosition) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#commitText");
|
||||
@@ -353,6 +373,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitCompletion(CompletionInfo text) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#commitCompletion");
|
||||
@@ -369,6 +390,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitCorrection(CorrectionInfo info) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#commitCorrection");
|
||||
@@ -385,6 +407,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelection(int start, int end) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#setSelection");
|
||||
@@ -401,6 +424,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performEditorAction(int id) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#performEditorAction");
|
||||
@@ -417,6 +441,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performContextMenuAction(int id) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#performContextMenuAction");
|
||||
@@ -433,6 +458,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposingRegion(int start, int end) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#setComposingRegion");
|
||||
@@ -449,6 +475,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposingText(CharSequence text, int newCursorPosition) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#setComposingText");
|
||||
@@ -465,6 +492,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishComposingText() {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#finishComposingText");
|
||||
@@ -493,6 +521,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendKeyEvent(KeyEvent event) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#sendKeyEvent");
|
||||
@@ -509,6 +538,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearMetaKeyStates(int states) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#clearMetaKeyStates");
|
||||
@@ -525,6 +555,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSurroundingText(int beforeLength, int afterLength) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#deleteSurroundingText");
|
||||
@@ -541,6 +572,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSurroundingTextInCodePoints(int beforeLength, int afterLength) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT,
|
||||
@@ -558,6 +590,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginBatchEdit() {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#beginBatchEdit");
|
||||
@@ -574,6 +607,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endBatchEdit() {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#endBatchEdit");
|
||||
@@ -590,11 +624,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches the request for performing spell check.
|
||||
*
|
||||
* @see InputConnection#performSpellCheck()
|
||||
*/
|
||||
@Override
|
||||
public void performSpellCheck() {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#performSpellCheck");
|
||||
@@ -611,6 +641,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performPrivateCommand(String action, Bundle data) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#performPrivateCommand");
|
||||
@@ -627,6 +658,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestCursorUpdates(int cursorUpdateMode, IBooleanResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#requestCursorUpdates");
|
||||
@@ -651,7 +683,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
public void closeConnection() {
|
||||
private void closeConnection() {
|
||||
dispatch(() -> {
|
||||
// Note that we do not need to worry about race condition here, because 1) mFinished is
|
||||
// updated only inside this block, and 2) the code here is running on a Handler hence we
|
||||
@@ -684,6 +716,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts,
|
||||
IBooleanResultCallback callback) {
|
||||
dispatch(() -> {
|
||||
@@ -715,11 +748,7 @@ public final class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches the request for setting ime consumes input.
|
||||
*
|
||||
* <p>See {@link InputConnection#setImeConsumesInput(boolean)}.
|
||||
*/
|
||||
@Override
|
||||
public void setImeConsumesInput(boolean imeConsumesInput) {
|
||||
dispatch(() -> {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_INPUT, "InputConnection#setImeConsumesInput");
|
||||
|
||||
Reference in New Issue
Block a user