use of android.view.inputmethod.EditorInfo in project android_frameworks_base by DirtyUnicorns.
the class IInputMethodWrapper method executeMessage.
@Override
public void executeMessage(Message msg) {
InputMethod inputMethod = mInputMethod.get();
// Need a valid reference to the inputMethod for everything except a dump.
if (inputMethod == null && msg.what != DO_DUMP) {
Log.w(TAG, "Input method reference was null, ignoring message: " + msg.what);
return;
}
switch(msg.what) {
case DO_DUMP:
{
AbstractInputMethodService target = mTarget.get();
if (target == null) {
return;
}
SomeArgs args = (SomeArgs) msg.obj;
try {
target.dump((FileDescriptor) args.arg1, (PrintWriter) args.arg2, (String[]) args.arg3);
} catch (RuntimeException e) {
((PrintWriter) args.arg2).println("Exception: " + e);
}
synchronized (args.arg4) {
((CountDownLatch) args.arg4).countDown();
}
args.recycle();
return;
}
case DO_ATTACH_TOKEN:
{
inputMethod.attachToken((IBinder) msg.obj);
return;
}
case DO_SET_INPUT_CONTEXT:
{
inputMethod.bindInput((InputBinding) msg.obj);
return;
}
case DO_UNSET_INPUT_CONTEXT:
inputMethod.unbindInput();
return;
case DO_START_INPUT:
{
SomeArgs args = (SomeArgs) msg.obj;
int missingMethods = msg.arg1;
IInputContext inputContext = (IInputContext) args.arg1;
InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
EditorInfo info = (EditorInfo) args.arg2;
info.makeCompatible(mTargetSdkVersion);
inputMethod.startInput(ic, info);
args.recycle();
return;
}
case DO_RESTART_INPUT:
{
SomeArgs args = (SomeArgs) msg.obj;
int missingMethods = msg.arg1;
IInputContext inputContext = (IInputContext) args.arg1;
InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
EditorInfo info = (EditorInfo) args.arg2;
info.makeCompatible(mTargetSdkVersion);
inputMethod.restartInput(ic, info);
args.recycle();
return;
}
case DO_CREATE_SESSION:
{
SomeArgs args = (SomeArgs) msg.obj;
inputMethod.createSession(new InputMethodSessionCallbackWrapper(mContext, (InputChannel) args.arg1, (IInputSessionCallback) args.arg2));
args.recycle();
return;
}
case DO_SET_SESSION_ENABLED:
inputMethod.setSessionEnabled((InputMethodSession) msg.obj, msg.arg1 != 0);
return;
case DO_REVOKE_SESSION:
inputMethod.revokeSession((InputMethodSession) msg.obj);
return;
case DO_SHOW_SOFT_INPUT:
inputMethod.showSoftInput(msg.arg1, (ResultReceiver) msg.obj);
return;
case DO_HIDE_SOFT_INPUT:
inputMethod.hideSoftInput(msg.arg1, (ResultReceiver) msg.obj);
return;
case DO_CHANGE_INPUTMETHOD_SUBTYPE:
inputMethod.changeInputMethodSubtype((InputMethodSubtype) msg.obj);
return;
}
Log.w(TAG, "Unhandled message code: " + msg.what);
}
use of android.view.inputmethod.EditorInfo in project android_frameworks_base by DirtyUnicorns.
the class InputMethodService method startExtractingText.
void startExtractingText(boolean inputChanged) {
final ExtractEditText eet = mExtractEditText;
if (eet != null && getCurrentInputStarted() && isFullscreenMode()) {
mExtractedToken++;
ExtractedTextRequest req = new ExtractedTextRequest();
req.token = mExtractedToken;
req.flags = InputConnection.GET_TEXT_WITH_STYLES;
req.hintMaxLines = 10;
req.hintMaxChars = 10000;
InputConnection ic = getCurrentInputConnection();
mExtractedText = ic == null ? null : ic.getExtractedText(req, InputConnection.GET_EXTRACTED_TEXT_MONITOR);
if (mExtractedText == null || ic == null) {
Log.e(TAG, "Unexpected null in startExtractingText : mExtractedText = " + mExtractedText + ", input connection = " + ic);
}
final EditorInfo ei = getCurrentInputEditorInfo();
try {
eet.startInternalChanges();
onUpdateExtractingVisibility(ei);
onUpdateExtractingViews(ei);
int inputType = ei.inputType;
if ((inputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {
if ((inputType & EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE) != 0) {
inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}
}
eet.setInputType(inputType);
eet.setHint(ei.hintText);
if (mExtractedText != null) {
eet.setEnabled(true);
eet.setExtractedText(mExtractedText);
} else {
eet.setEnabled(false);
eet.setText("");
}
} finally {
eet.finishInternalChanges();
}
if (inputChanged) {
onExtractingInputChanged(ei);
}
}
}
use of android.view.inputmethod.EditorInfo in project android_frameworks_base by AOSPA.
the class IInputMethodWrapper method executeMessage.
@Override
public void executeMessage(Message msg) {
InputMethod inputMethod = mInputMethod.get();
// Need a valid reference to the inputMethod for everything except a dump.
if (inputMethod == null && msg.what != DO_DUMP) {
Log.w(TAG, "Input method reference was null, ignoring message: " + msg.what);
return;
}
switch(msg.what) {
case DO_DUMP:
{
AbstractInputMethodService target = mTarget.get();
if (target == null) {
return;
}
SomeArgs args = (SomeArgs) msg.obj;
try {
target.dump((FileDescriptor) args.arg1, (PrintWriter) args.arg2, (String[]) args.arg3);
} catch (RuntimeException e) {
((PrintWriter) args.arg2).println("Exception: " + e);
}
synchronized (args.arg4) {
((CountDownLatch) args.arg4).countDown();
}
args.recycle();
return;
}
case DO_ATTACH_TOKEN:
{
inputMethod.attachToken((IBinder) msg.obj);
return;
}
case DO_SET_INPUT_CONTEXT:
{
inputMethod.bindInput((InputBinding) msg.obj);
return;
}
case DO_UNSET_INPUT_CONTEXT:
inputMethod.unbindInput();
return;
case DO_START_INPUT:
{
SomeArgs args = (SomeArgs) msg.obj;
int missingMethods = msg.arg1;
IInputContext inputContext = (IInputContext) args.arg1;
InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
EditorInfo info = (EditorInfo) args.arg2;
info.makeCompatible(mTargetSdkVersion);
inputMethod.startInput(ic, info);
args.recycle();
return;
}
case DO_RESTART_INPUT:
{
SomeArgs args = (SomeArgs) msg.obj;
int missingMethods = msg.arg1;
IInputContext inputContext = (IInputContext) args.arg1;
InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
EditorInfo info = (EditorInfo) args.arg2;
info.makeCompatible(mTargetSdkVersion);
inputMethod.restartInput(ic, info);
args.recycle();
return;
}
case DO_CREATE_SESSION:
{
SomeArgs args = (SomeArgs) msg.obj;
inputMethod.createSession(new InputMethodSessionCallbackWrapper(mContext, (InputChannel) args.arg1, (IInputSessionCallback) args.arg2));
args.recycle();
return;
}
case DO_SET_SESSION_ENABLED:
inputMethod.setSessionEnabled((InputMethodSession) msg.obj, msg.arg1 != 0);
return;
case DO_REVOKE_SESSION:
inputMethod.revokeSession((InputMethodSession) msg.obj);
return;
case DO_SHOW_SOFT_INPUT:
inputMethod.showSoftInput(msg.arg1, (ResultReceiver) msg.obj);
return;
case DO_HIDE_SOFT_INPUT:
inputMethod.hideSoftInput(msg.arg1, (ResultReceiver) msg.obj);
return;
case DO_CHANGE_INPUTMETHOD_SUBTYPE:
inputMethod.changeInputMethodSubtype((InputMethodSubtype) msg.obj);
return;
}
Log.w(TAG, "Unhandled message code: " + msg.what);
}
use of android.view.inputmethod.EditorInfo in project android_frameworks_base by AOSPA.
the class InputMethodService method startExtractingText.
void startExtractingText(boolean inputChanged) {
final ExtractEditText eet = mExtractEditText;
if (eet != null && getCurrentInputStarted() && isFullscreenMode()) {
mExtractedToken++;
ExtractedTextRequest req = new ExtractedTextRequest();
req.token = mExtractedToken;
req.flags = InputConnection.GET_TEXT_WITH_STYLES;
req.hintMaxLines = 10;
req.hintMaxChars = 10000;
InputConnection ic = getCurrentInputConnection();
mExtractedText = ic == null ? null : ic.getExtractedText(req, InputConnection.GET_EXTRACTED_TEXT_MONITOR);
if (mExtractedText == null || ic == null) {
Log.e(TAG, "Unexpected null in startExtractingText : mExtractedText = " + mExtractedText + ", input connection = " + ic);
}
final EditorInfo ei = getCurrentInputEditorInfo();
try {
eet.startInternalChanges();
onUpdateExtractingVisibility(ei);
onUpdateExtractingViews(ei);
int inputType = ei.inputType;
if ((inputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {
if ((inputType & EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE) != 0) {
inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}
}
eet.setInputType(inputType);
eet.setHint(ei.hintText);
if (mExtractedText != null) {
eet.setEnabled(true);
eet.setExtractedText(mExtractedText);
} else {
eet.setEnabled(false);
eet.setText("");
}
} finally {
eet.finishInternalChanges();
}
if (inputChanged) {
onExtractingInputChanged(ei);
}
}
}
use of android.view.inputmethod.EditorInfo in project android_frameworks_base by ResurrectionRemix.
the class IInputMethodWrapper method executeMessage.
@Override
public void executeMessage(Message msg) {
InputMethod inputMethod = mInputMethod.get();
// Need a valid reference to the inputMethod for everything except a dump.
if (inputMethod == null && msg.what != DO_DUMP) {
Log.w(TAG, "Input method reference was null, ignoring message: " + msg.what);
return;
}
boolean formalText = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.FORMAL_TEXT_INPUT, 0, UserHandle.USER_CURRENT_OR_SELF) == 1;
switch(msg.what) {
case DO_DUMP:
{
AbstractInputMethodService target = mTarget.get();
if (target == null) {
return;
}
SomeArgs args = (SomeArgs) msg.obj;
try {
target.dump((FileDescriptor) args.arg1, (PrintWriter) args.arg2, (String[]) args.arg3);
} catch (RuntimeException e) {
((PrintWriter) args.arg2).println("Exception: " + e);
}
synchronized (args.arg4) {
((CountDownLatch) args.arg4).countDown();
}
args.recycle();
return;
}
case DO_ATTACH_TOKEN:
{
inputMethod.attachToken((IBinder) msg.obj);
return;
}
case DO_SET_INPUT_CONTEXT:
{
inputMethod.bindInput((InputBinding) msg.obj);
return;
}
case DO_UNSET_INPUT_CONTEXT:
inputMethod.unbindInput();
return;
case DO_START_INPUT:
{
SomeArgs args = (SomeArgs) msg.obj;
int missingMethods = msg.arg1;
IInputContext inputContext = (IInputContext) args.arg1;
InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
EditorInfo info = (EditorInfo) args.arg2;
info.makeCompatible(mTargetSdkVersion);
info.formalTextInput(formalText);
inputMethod.startInput(ic, info);
args.recycle();
return;
}
case DO_RESTART_INPUT:
{
SomeArgs args = (SomeArgs) msg.obj;
int missingMethods = msg.arg1;
IInputContext inputContext = (IInputContext) args.arg1;
InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
EditorInfo info = (EditorInfo) args.arg2;
info.makeCompatible(mTargetSdkVersion);
info.formalTextInput(formalText);
inputMethod.restartInput(ic, info);
args.recycle();
return;
}
case DO_CREATE_SESSION:
{
SomeArgs args = (SomeArgs) msg.obj;
inputMethod.createSession(new InputMethodSessionCallbackWrapper(mContext, (InputChannel) args.arg1, (IInputSessionCallback) args.arg2));
args.recycle();
return;
}
case DO_SET_SESSION_ENABLED:
inputMethod.setSessionEnabled((InputMethodSession) msg.obj, msg.arg1 != 0);
return;
case DO_REVOKE_SESSION:
inputMethod.revokeSession((InputMethodSession) msg.obj);
return;
case DO_SHOW_SOFT_INPUT:
inputMethod.showSoftInput(msg.arg1, (ResultReceiver) msg.obj);
return;
case DO_HIDE_SOFT_INPUT:
inputMethod.hideSoftInput(msg.arg1, (ResultReceiver) msg.obj);
return;
case DO_CHANGE_INPUTMETHOD_SUBTYPE:
inputMethod.changeInputMethodSubtype((InputMethodSubtype) msg.obj);
return;
}
Log.w(TAG, "Unhandled message code: " + msg.what);
}
Aggregations