Merge "Introduce InputConnection#getHandler()." into nyc-dev am: 116d872d9c

am: 887f7c0fe3

* commit '887f7c0fe3b6d8b08e8b53638bbfecc1de2b7f8f':
  Introduce InputConnection#getHandler().
This commit is contained in:
Yohei Yukawa
2016-02-19 02:59:19 +00:00
committed by android-build-merger
9 changed files with 48 additions and 3 deletions

View File

@@ -44356,6 +44356,7 @@ package android.view.inputmethod {
method public int getCursorCapsMode(int);
method public android.text.Editable getEditable();
method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public android.os.Handler getHandler();
method public java.lang.CharSequence getSelectedText(int);
method public java.lang.CharSequence getTextAfterCursor(int, int);
method public java.lang.CharSequence getTextBeforeCursor(int, int);
@@ -44519,6 +44520,7 @@ package android.view.inputmethod {
method public abstract boolean finishComposingText();
method public abstract int getCursorCapsMode(int);
method public abstract android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public abstract android.os.Handler getHandler();
method public abstract java.lang.CharSequence getSelectedText(int);
method public abstract java.lang.CharSequence getTextAfterCursor(int, int);
method public abstract java.lang.CharSequence getTextBeforeCursor(int, int);
@@ -44550,6 +44552,7 @@ package android.view.inputmethod {
method public boolean finishComposingText();
method public int getCursorCapsMode(int);
method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public android.os.Handler getHandler();
method public java.lang.CharSequence getSelectedText(int);
method public java.lang.CharSequence getTextAfterCursor(int, int);
method public java.lang.CharSequence getTextBeforeCursor(int, int);

View File

@@ -47117,6 +47117,7 @@ package android.view.inputmethod {
method public int getCursorCapsMode(int);
method public android.text.Editable getEditable();
method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public android.os.Handler getHandler();
method public java.lang.CharSequence getSelectedText(int);
method public java.lang.CharSequence getTextAfterCursor(int, int);
method public java.lang.CharSequence getTextBeforeCursor(int, int);
@@ -47280,6 +47281,7 @@ package android.view.inputmethod {
method public abstract boolean finishComposingText();
method public abstract int getCursorCapsMode(int);
method public abstract android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public abstract android.os.Handler getHandler();
method public abstract java.lang.CharSequence getSelectedText(int);
method public abstract java.lang.CharSequence getTextAfterCursor(int, int);
method public abstract java.lang.CharSequence getTextBeforeCursor(int, int);
@@ -47311,6 +47313,7 @@ package android.view.inputmethod {
method public boolean finishComposingText();
method public int getCursorCapsMode(int);
method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public android.os.Handler getHandler();
method public java.lang.CharSequence getSelectedText(int);
method public java.lang.CharSequence getTextAfterCursor(int, int);
method public java.lang.CharSequence getTextBeforeCursor(int, int);

View File

@@ -44373,6 +44373,7 @@ package android.view.inputmethod {
method public int getCursorCapsMode(int);
method public android.text.Editable getEditable();
method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public android.os.Handler getHandler();
method public java.lang.CharSequence getSelectedText(int);
method public java.lang.CharSequence getTextAfterCursor(int, int);
method public java.lang.CharSequence getTextBeforeCursor(int, int);
@@ -44536,6 +44537,7 @@ package android.view.inputmethod {
method public abstract boolean finishComposingText();
method public abstract int getCursorCapsMode(int);
method public abstract android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public abstract android.os.Handler getHandler();
method public abstract java.lang.CharSequence getSelectedText(int);
method public abstract java.lang.CharSequence getTextAfterCursor(int, int);
method public abstract java.lang.CharSequence getTextBeforeCursor(int, int);
@@ -44567,6 +44569,7 @@ package android.view.inputmethod {
method public boolean finishComposingText();
method public int getCursorCapsMode(int);
method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
method public android.os.Handler getHandler();
method public java.lang.CharSequence getSelectedText(int);
method public java.lang.CharSequence getTextAfterCursor(int, int);
method public java.lang.CharSequence getTextBeforeCursor(int, int);

View File

@@ -19,6 +19,7 @@ package android.view.inputmethod;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.Editable;
import android.text.NoCopySpan;
@@ -602,6 +603,10 @@ public class BaseInputConnection implements InputConnection {
return false;
}
public Handler getHandler() {
return null;
}
/**
* The default implementation places the given text into the editable,
* replacing any existing composing text. The new text is marked as

View File

@@ -17,6 +17,7 @@
package android.view.inputmethod;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
@@ -786,4 +787,15 @@ public interface InputConnection {
* {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)}.
*/
public boolean requestCursorUpdates(int cursorUpdateMode);
/**
* Called by the {@link InputMethodManager} to enable application developers to specify a
* dedicated {@link Handler} on which incoming IPC method calls from input methods will be
* dispatched.
*
* <p>Note: This does nothing when called from input methods.</p>
*
* @return {@code null} to use the default {@link Handler}.
*/
public Handler getHandler();
}

View File

@@ -17,6 +17,7 @@
package android.view.inputmethod;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
/**
@@ -133,4 +134,8 @@ public class InputConnectionWrapper implements InputConnection {
public boolean requestCursorUpdates(int cursorUpdateMode) {
return mTarget.requestCursorUpdates(cursorUpdateMode);
}
public Handler getHandler() {
return mTarget.getHandler();
}
}

View File

@@ -1215,7 +1215,7 @@ public final class InputMethodManager {
if (mCurrentTextBoxAttribute == null) {
controlFlags |= CONTROL_START_INITIAL;
}
// Hook 'em up and let 'er rip.
mCurrentTextBoxAttribute = tba;
mServedConnecting = false;
@@ -1230,7 +1230,9 @@ public final class InputMethodManager {
mCursorCandEnd = -1;
mCursorRect.setEmpty();
mCursorAnchorInfo = null;
servedContext = new ControlledInputConnectionWrapper(vh.getLooper(), ic, this);
final Handler icHandler = ic.getHandler();
servedContext = new ControlledInputConnectionWrapper(
icHandler != null ? icHandler.getLooper() : vh.getLooper(), ic, this);
} else {
servedContext = null;
}
@@ -1238,7 +1240,7 @@ public final class InputMethodManager {
mServedInputConnectionWrapper.deactivate();
}
mServedInputConnectionWrapper = servedContext;
try {
if (DEBUG) Log.v(TAG, "START INPUT: " + view + " ic="
+ ic + " tba=" + tba + " controlFlags=#"

View File

@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.StrictMode;
@@ -5930,6 +5931,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
public boolean requestCursorUpdates(int cursorUpdateMode) {
return getTarget().requestCursorUpdates(cursorUpdateMode);
}
@Override
public Handler getHandler() {
return getTarget().getHandler();
}
}
/**

View File

@@ -17,6 +17,7 @@
package com.android.internal.view;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log;
@@ -454,4 +455,9 @@ public class InputConnectionWrapper implements InputConnection {
}
return result;
}
public Handler getHandler() {
// Nothing should happen when called from input method.
return null;
}
}