Merge \\"API Rename: IC#inputContent to IC#commitContent.\\" into nyc-mr1-dev am: 01e7c10d37
am: 0d7dcf7bc3
Change-Id: I5c4209a79e7426192da082100ac2a7517de36b81
This commit is contained in:
@@ -62,7 +62,7 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
private static final int DO_CLEAR_META_KEY_STATES = 130;
|
||||
private static final int DO_REQUEST_UPDATE_CURSOR_ANCHOR_INFO = 140;
|
||||
private static final int DO_CLOSE_CONNECTION = 150;
|
||||
private static final int DO_INSERT_CONTENT = 160;
|
||||
private static final int DO_COMMIT_CONTENT = 160;
|
||||
|
||||
@GuardedBy("mLock")
|
||||
@Nullable
|
||||
@@ -243,9 +243,9 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
dispatchMessage(obtainMessage(DO_CLOSE_CONNECTION));
|
||||
}
|
||||
|
||||
public void insertContent(InputContentInfo inputContentInfo, Bundle opts,
|
||||
public void commitContent(InputContentInfo inputContentInfo, Bundle opts,
|
||||
int seq, IInputContextCallback callback) {
|
||||
dispatchMessage(obtainMessageOOSC(DO_INSERT_CONTENT, inputContentInfo, opts, seq, callback));
|
||||
dispatchMessage(obtainMessageOOSC(DO_COMMIT_CONTENT, inputContentInfo, opts, seq, callback));
|
||||
}
|
||||
|
||||
void dispatchMessage(Message msg) {
|
||||
@@ -559,26 +559,26 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub {
|
||||
}
|
||||
return;
|
||||
}
|
||||
case DO_INSERT_CONTENT: {
|
||||
case DO_COMMIT_CONTENT: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
try {
|
||||
InputConnection ic = getInputConnection();
|
||||
if (ic == null || !isActive()) {
|
||||
Log.w(TAG, "insertContent on inactive InputConnection");
|
||||
args.callback.setInsertContentResult(false, args.seq);
|
||||
Log.w(TAG, "commitContent on inactive InputConnection");
|
||||
args.callback.setCommitContentResult(false, args.seq);
|
||||
return;
|
||||
}
|
||||
final InputContentInfo inputContentInfo = (InputContentInfo) args.arg1;
|
||||
if (inputContentInfo == null || !inputContentInfo.validate()) {
|
||||
Log.w(TAG, "insertContent with invalid inputContentInfo="
|
||||
Log.w(TAG, "commitContent with invalid inputContentInfo="
|
||||
+ inputContentInfo);
|
||||
args.callback.setInsertContentResult(false, args.seq);
|
||||
args.callback.setCommitContentResult(false, args.seq);
|
||||
return;
|
||||
}
|
||||
args.callback.setInsertContentResult(
|
||||
ic.insertContent(inputContentInfo, (Bundle) args.arg2), args.seq);
|
||||
args.callback.setCommitContentResult(
|
||||
ic.commitContent(inputContentInfo, (Bundle) args.arg2), args.seq);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Got RemoteException calling insertContent", e);
|
||||
Log.w(TAG, "Got RemoteException calling commitContent", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ import com.android.internal.view.IInputContextCallback;
|
||||
void requestUpdateCursorAnchorInfo(int cursorUpdateMode, int seq,
|
||||
IInputContextCallback callback);
|
||||
|
||||
void insertContent(in InputContentInfo inputContentInfo, in Bundle opts, int sec,
|
||||
void commitContent(in InputContentInfo inputContentInfo, in Bundle opts, int sec,
|
||||
IInputContextCallback callback);
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ oneway interface IInputContextCallback {
|
||||
void setExtractedText(in ExtractedText extractedText, int seq);
|
||||
void setSelectedText(CharSequence selectedText, int seq);
|
||||
void setRequestUpdateCursorAnchorInfoResult(boolean result, int seq);
|
||||
void setInsertContentResult(boolean result, int seq);
|
||||
void setCommitContentResult(boolean result, int seq);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.internal.view;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
@@ -48,7 +47,7 @@ public class InputConnectionWrapper implements InputConnection {
|
||||
public ExtractedText mExtractedText;
|
||||
public int mCursorCapsMode;
|
||||
public boolean mRequestUpdateCursorAnchorInfoResult;
|
||||
public boolean mInsertContentResult;
|
||||
public boolean mCommitContentResult;
|
||||
|
||||
// A 'pool' of one InputContextCallback. Each ICW request will attempt to gain
|
||||
// exclusive access to this object.
|
||||
@@ -175,15 +174,15 @@ public class InputConnectionWrapper implements InputConnection {
|
||||
}
|
||||
}
|
||||
|
||||
public void setInsertContentResult(boolean result, int seq) {
|
||||
public void setCommitContentResult(boolean result, int seq) {
|
||||
synchronized (this) {
|
||||
if (seq == mSeq) {
|
||||
mInsertContentResult = result;
|
||||
mCommitContentResult = result;
|
||||
mHaveValue = true;
|
||||
notifyAll();
|
||||
} else {
|
||||
Log.i(TAG, "Got out-of-sequence callback " + seq + " (expected " + mSeq
|
||||
+ ") in setInsertContentResult, ignoring.");
|
||||
+ ") in setCommitContentResult, ignoring.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -507,19 +506,19 @@ public class InputConnectionWrapper implements InputConnection {
|
||||
// Nothing should happen when called from input method.
|
||||
}
|
||||
|
||||
public boolean insertContent(InputContentInfo inputContentInfo, Bundle opts) {
|
||||
public boolean commitContent(InputContentInfo inputContentInfo, Bundle opts) {
|
||||
boolean result = false;
|
||||
if (isMethodMissing(MissingMethodFlags.INSERT_CONTENT)) {
|
||||
if (isMethodMissing(MissingMethodFlags.COMMIT_CONTENT)) {
|
||||
// This method is not implemented.
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
InputContextCallback callback = InputContextCallback.getInstance();
|
||||
mIInputContext.insertContent(inputContentInfo, opts, callback.mSeq, callback);
|
||||
mIInputContext.commitContent(inputContentInfo, opts, callback.mSeq, callback);
|
||||
synchronized (callback) {
|
||||
callback.waitForResultLocked();
|
||||
if (callback.mHaveValue) {
|
||||
result = callback.mInsertContentResult;
|
||||
result = callback.mCommitContentResult;
|
||||
}
|
||||
}
|
||||
callback.dispose();
|
||||
|
||||
Reference in New Issue
Block a user