use of com.android.internal.view.IInputMethod in project android_frameworks_base by ParanoidAndroid.
the class InputMethodManagerService method dump.
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
return;
}
IInputMethod method;
ClientState client;
final Printer p = new PrintWriterPrinter(pw);
synchronized (mMethodMap) {
p.println("Current Input Method Manager state:");
int N = mMethodList.size();
p.println(" Input Methods:");
for (int i = 0; i < N; i++) {
InputMethodInfo info = mMethodList.get(i);
p.println(" InputMethod #" + i + ":");
info.dump(p, " ");
}
p.println(" Clients:");
for (ClientState ci : mClients.values()) {
p.println(" Client " + ci + ":");
p.println(" client=" + ci.client);
p.println(" inputContext=" + ci.inputContext);
p.println(" sessionRequested=" + ci.sessionRequested);
p.println(" curSession=" + ci.curSession);
}
p.println(" mCurMethodId=" + mCurMethodId);
client = mCurClient;
p.println(" mCurClient=" + client + " mCurSeq=" + mCurSeq);
p.println(" mCurFocusedWindow=" + mCurFocusedWindow);
p.println(" mCurId=" + mCurId + " mHaveConnect=" + mHaveConnection + " mBoundToMethod=" + mBoundToMethod);
p.println(" mCurToken=" + mCurToken);
p.println(" mCurIntent=" + mCurIntent);
method = mCurMethod;
p.println(" mCurMethod=" + mCurMethod);
p.println(" mEnabledSession=" + mEnabledSession);
p.println(" mShowRequested=" + mShowRequested + " mShowExplicitlyRequested=" + mShowExplicitlyRequested + " mShowForced=" + mShowForced + " mInputShown=" + mInputShown);
p.println(" mSystemReady=" + mSystemReady + " mScreenOn=" + mScreenOn);
}
p.println(" ");
if (client != null) {
pw.flush();
try {
client.client.asBinder().dump(fd, args);
} catch (RemoteException e) {
p.println("Input method client dead: " + e);
}
} else {
p.println("No input method client.");
}
p.println(" ");
if (method != null) {
pw.flush();
try {
method.asBinder().dump(fd, args);
} catch (RemoteException e) {
p.println("Input method service dead: " + e);
}
} else {
p.println("No input method service.");
}
}
use of com.android.internal.view.IInputMethod in project platform_frameworks_base by android.
the class InputMethodManagerService method handleMessage.
@Override
public boolean handleMessage(Message msg) {
SomeArgs args;
switch(msg.what) {
case MSG_SHOW_IM_SUBTYPE_PICKER:
final boolean showAuxSubtypes;
switch(msg.arg1) {
case InputMethodManager.SHOW_IM_PICKER_MODE_AUTO:
// This is undocumented so far, but IMM#showInputMethodPicker() has been
// implemented so that auxiliary subtypes will be excluded when the soft
// keyboard is invisible.
showAuxSubtypes = mInputShown;
break;
case InputMethodManager.SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES:
showAuxSubtypes = true;
break;
case InputMethodManager.SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES:
showAuxSubtypes = false;
break;
default:
Slog.e(TAG, "Unknown subtype picker mode = " + msg.arg1);
return false;
}
showInputMethodMenu(showAuxSubtypes);
return true;
case MSG_SHOW_IM_SUBTYPE_ENABLER:
showInputMethodAndSubtypeEnabler((String) msg.obj);
return true;
case MSG_SHOW_IM_CONFIG:
showConfigureInputMethods();
return true;
case MSG_UNBIND_INPUT:
try {
((IInputMethod) msg.obj).unbindInput();
} catch (RemoteException e) {
// There is nothing interesting about the method dying.
}
return true;
case MSG_BIND_INPUT:
args = (SomeArgs) msg.obj;
try {
((IInputMethod) args.arg1).bindInput((InputBinding) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_SHOW_SOFT_INPUT:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Calling " + args.arg1 + ".showSoftInput(" + msg.arg1 + ", " + args.arg2 + ")");
((IInputMethod) args.arg1).showSoftInput(msg.arg1, (ResultReceiver) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_HIDE_SOFT_INPUT:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Calling " + args.arg1 + ".hideSoftInput(0, " + args.arg2 + ")");
((IInputMethod) args.arg1).hideSoftInput(0, (ResultReceiver) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_HIDE_CURRENT_INPUT_METHOD:
synchronized (mMethodMap) {
hideCurrentInputLocked(0, null);
}
return true;
case MSG_ATTACH_TOKEN:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Sending attach of token: " + args.arg2);
((IInputMethod) args.arg1).attachToken((IBinder) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_CREATE_SESSION:
{
args = (SomeArgs) msg.obj;
IInputMethod method = (IInputMethod) args.arg1;
InputChannel channel = (InputChannel) args.arg2;
try {
method.createSession(channel, (IInputSessionCallback) args.arg3);
} catch (RemoteException e) {
} finally {
// because the remote proxy will get its own copy when unparceled.
if (channel != null && Binder.isProxy(method)) {
channel.dispose();
}
}
args.recycle();
return true;
}
case MSG_START_INPUT:
{
int missingMethods = msg.arg1;
args = (SomeArgs) msg.obj;
try {
SessionState session = (SessionState) args.arg1;
setEnabledSessionInMainThread(session);
session.method.startInput((IInputContext) args.arg2, missingMethods, (EditorInfo) args.arg3);
} catch (RemoteException e) {
}
args.recycle();
return true;
}
case MSG_RESTART_INPUT:
{
int missingMethods = msg.arg1;
args = (SomeArgs) msg.obj;
try {
SessionState session = (SessionState) args.arg1;
setEnabledSessionInMainThread(session);
session.method.restartInput((IInputContext) args.arg2, missingMethods, (EditorInfo) args.arg3);
} catch (RemoteException e) {
}
args.recycle();
return true;
}
case MSG_UNBIND_CLIENT:
try {
((IInputMethodClient) msg.obj).onUnbindMethod(msg.arg1, msg.arg2);
} catch (RemoteException e) {
// There is nothing interesting about the last client dying.
}
return true;
case MSG_BIND_CLIENT:
{
args = (SomeArgs) msg.obj;
IInputMethodClient client = (IInputMethodClient) args.arg1;
InputBindResult res = (InputBindResult) args.arg2;
try {
client.onBindMethod(res);
} catch (RemoteException e) {
Slog.w(TAG, "Client died receiving input method " + args.arg2);
} finally {
// because the remote proxy will get its own copy when unparceled.
if (res.channel != null && Binder.isProxy(client)) {
res.channel.dispose();
}
}
args.recycle();
return true;
}
case MSG_SET_ACTIVE:
try {
((ClientState) msg.obj).client.setActive(msg.arg1 != 0);
} catch (RemoteException e) {
Slog.w(TAG, "Got RemoteException sending setActive(false) notification to pid " + ((ClientState) msg.obj).pid + " uid " + ((ClientState) msg.obj).uid);
}
return true;
case MSG_SET_INTERACTIVE:
handleSetInteractive(msg.arg1 != 0);
return true;
case MSG_SWITCH_IME:
handleSwitchInputMethod(msg.arg1 != 0);
return true;
case MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER:
{
final int sequenceNumber = msg.arg1;
final ClientState clientState = (ClientState) msg.obj;
try {
clientState.client.setUserActionNotificationSequenceNumber(sequenceNumber);
} catch (RemoteException e) {
Slog.w(TAG, "Got RemoteException sending " + "setUserActionNotificationSequenceNumber(" + sequenceNumber + ") notification to pid " + clientState.pid + " uid " + clientState.uid);
}
return true;
}
// --------------------------------------------------------------
case MSG_HARD_KEYBOARD_SWITCH_CHANGED:
mHardKeyboardListener.handleHardKeyboardStatusChange(msg.arg1 == 1);
return true;
case MSG_SYSTEM_UNLOCK_USER:
final int userId = msg.arg1;
onUnlockUser(userId);
return true;
}
return false;
}
use of com.android.internal.view.IInputMethod in project platform_frameworks_base by android.
the class InputMethodManagerService method dump.
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
return;
}
IInputMethod method;
ClientState client;
ClientState focusedWindowClient;
final Printer p = new PrintWriterPrinter(pw);
synchronized (mMethodMap) {
p.println("Current Input Method Manager state:");
int N = mMethodList.size();
p.println(" Input Methods:");
for (int i = 0; i < N; i++) {
InputMethodInfo info = mMethodList.get(i);
p.println(" InputMethod #" + i + ":");
info.dump(p, " ");
}
p.println(" Clients:");
for (ClientState ci : mClients.values()) {
p.println(" Client " + ci + ":");
p.println(" client=" + ci.client);
p.println(" inputContext=" + ci.inputContext);
p.println(" sessionRequested=" + ci.sessionRequested);
p.println(" curSession=" + ci.curSession);
}
p.println(" mCurMethodId=" + mCurMethodId);
client = mCurClient;
p.println(" mCurClient=" + client + " mCurSeq=" + mCurSeq);
p.println(" mCurFocusedWindow=" + mCurFocusedWindow);
focusedWindowClient = mCurFocusedWindowClient;
p.println(" mCurFocusedWindowClient=" + focusedWindowClient);
p.println(" mCurId=" + mCurId + " mHaveConnect=" + mHaveConnection + " mBoundToMethod=" + mBoundToMethod);
p.println(" mCurToken=" + mCurToken);
p.println(" mCurIntent=" + mCurIntent);
method = mCurMethod;
p.println(" mCurMethod=" + mCurMethod);
p.println(" mEnabledSession=" + mEnabledSession);
p.println(" mImeWindowVis=" + imeWindowStatusToString(mImeWindowVis));
p.println(" mShowRequested=" + mShowRequested + " mShowExplicitlyRequested=" + mShowExplicitlyRequested + " mShowForced=" + mShowForced + " mInputShown=" + mInputShown);
p.println(" mCurUserActionNotificationSequenceNumber=" + mCurUserActionNotificationSequenceNumber);
p.println(" mSystemReady=" + mSystemReady + " mInteractive=" + mIsInteractive);
p.println(" mSettingsObserver=" + mSettingsObserver);
p.println(" mSwitchingController:");
mSwitchingController.dump(p);
p.println(" mSettings:");
mSettings.dumpLocked(p, " ");
}
p.println(" ");
if (client != null) {
pw.flush();
try {
TransferPipe.dumpAsync(client.client.asBinder(), fd, args);
} catch (IOException | RemoteException e) {
p.println("Failed to dump input method client: " + e);
}
} else {
p.println("No input method client.");
}
if (focusedWindowClient != null && client != focusedWindowClient) {
p.println(" ");
p.println("Warning: Current input method client doesn't match the last focused. " + "window.");
p.println("Dumping input method client in the last focused window just in case.");
p.println(" ");
pw.flush();
try {
TransferPipe.dumpAsync(focusedWindowClient.client.asBinder(), fd, args);
} catch (IOException | RemoteException e) {
p.println("Failed to dump input method client in focused window: " + e);
}
}
p.println(" ");
if (method != null) {
pw.flush();
try {
TransferPipe.dumpAsync(method.asBinder(), fd, args);
} catch (IOException | RemoteException e) {
p.println("Failed to dump input method service: " + e);
}
} else {
p.println("No input method service.");
}
}
use of com.android.internal.view.IInputMethod in project android_frameworks_base by DirtyUnicorns.
the class InputMethodManagerService method dump.
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
return;
}
IInputMethod method;
ClientState client;
ClientState focusedWindowClient;
final Printer p = new PrintWriterPrinter(pw);
synchronized (mMethodMap) {
p.println("Current Input Method Manager state:");
int N = mMethodList.size();
p.println(" Input Methods:");
for (int i = 0; i < N; i++) {
InputMethodInfo info = mMethodList.get(i);
p.println(" InputMethod #" + i + ":");
info.dump(p, " ");
}
p.println(" Clients:");
for (ClientState ci : mClients.values()) {
p.println(" Client " + ci + ":");
p.println(" client=" + ci.client);
p.println(" inputContext=" + ci.inputContext);
p.println(" sessionRequested=" + ci.sessionRequested);
p.println(" curSession=" + ci.curSession);
}
p.println(" mCurMethodId=" + mCurMethodId);
client = mCurClient;
p.println(" mCurClient=" + client + " mCurSeq=" + mCurSeq);
p.println(" mCurFocusedWindow=" + mCurFocusedWindow);
focusedWindowClient = mCurFocusedWindowClient;
p.println(" mCurFocusedWindowClient=" + focusedWindowClient);
p.println(" mCurId=" + mCurId + " mHaveConnect=" + mHaveConnection + " mBoundToMethod=" + mBoundToMethod);
p.println(" mCurToken=" + mCurToken);
p.println(" mCurIntent=" + mCurIntent);
method = mCurMethod;
p.println(" mCurMethod=" + mCurMethod);
p.println(" mEnabledSession=" + mEnabledSession);
p.println(" mImeWindowVis=" + imeWindowStatusToString(mImeWindowVis));
p.println(" mShowRequested=" + mShowRequested + " mShowExplicitlyRequested=" + mShowExplicitlyRequested + " mShowForced=" + mShowForced + " mInputShown=" + mInputShown);
p.println(" mCurUserActionNotificationSequenceNumber=" + mCurUserActionNotificationSequenceNumber);
p.println(" mSystemReady=" + mSystemReady + " mInteractive=" + mIsInteractive);
p.println(" mSettingsObserver=" + mSettingsObserver);
p.println(" mSwitchingController:");
mSwitchingController.dump(p);
p.println(" mSettings:");
mSettings.dumpLocked(p, " ");
}
p.println(" ");
if (client != null) {
pw.flush();
try {
client.client.asBinder().dump(fd, args);
} catch (RemoteException e) {
p.println("Input method client dead: " + e);
}
} else {
p.println("No input method client.");
}
if (focusedWindowClient != null && client != focusedWindowClient) {
p.println(" ");
p.println("Warning: Current input method client doesn't match the last focused. " + "window.");
p.println("Dumping input method client in the last focused window just in case.");
p.println(" ");
pw.flush();
try {
focusedWindowClient.client.asBinder().dump(fd, args);
} catch (RemoteException e) {
p.println("Input method client in focused window dead: " + e);
}
}
p.println(" ");
if (method != null) {
pw.flush();
try {
method.asBinder().dump(fd, args);
} catch (RemoteException e) {
p.println("Input method service dead: " + e);
}
} else {
p.println("No input method service.");
}
}
use of com.android.internal.view.IInputMethod in project android_frameworks_base by AOSPA.
the class InputMethodManagerService method handleMessage.
@Override
public boolean handleMessage(Message msg) {
SomeArgs args;
switch(msg.what) {
case MSG_SHOW_IM_SUBTYPE_PICKER:
final boolean showAuxSubtypes;
switch(msg.arg1) {
case InputMethodManager.SHOW_IM_PICKER_MODE_AUTO:
// This is undocumented so far, but IMM#showInputMethodPicker() has been
// implemented so that auxiliary subtypes will be excluded when the soft
// keyboard is invisible.
showAuxSubtypes = mInputShown;
break;
case InputMethodManager.SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES:
showAuxSubtypes = true;
break;
case InputMethodManager.SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES:
showAuxSubtypes = false;
break;
default:
Slog.e(TAG, "Unknown subtype picker mode = " + msg.arg1);
return false;
}
showInputMethodMenu(showAuxSubtypes);
return true;
case MSG_SHOW_IM_SUBTYPE_ENABLER:
showInputMethodAndSubtypeEnabler((String) msg.obj);
return true;
case MSG_SHOW_IM_CONFIG:
showConfigureInputMethods();
return true;
case MSG_UNBIND_INPUT:
try {
((IInputMethod) msg.obj).unbindInput();
} catch (RemoteException e) {
// There is nothing interesting about the method dying.
}
return true;
case MSG_BIND_INPUT:
args = (SomeArgs) msg.obj;
try {
((IInputMethod) args.arg1).bindInput((InputBinding) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_SHOW_SOFT_INPUT:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Calling " + args.arg1 + ".showSoftInput(" + msg.arg1 + ", " + args.arg2 + ")");
((IInputMethod) args.arg1).showSoftInput(msg.arg1, (ResultReceiver) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_HIDE_SOFT_INPUT:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Calling " + args.arg1 + ".hideSoftInput(0, " + args.arg2 + ")");
((IInputMethod) args.arg1).hideSoftInput(0, (ResultReceiver) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_HIDE_CURRENT_INPUT_METHOD:
synchronized (mMethodMap) {
hideCurrentInputLocked(0, null);
}
return true;
case MSG_ATTACH_TOKEN:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Sending attach of token: " + args.arg2);
((IInputMethod) args.arg1).attachToken((IBinder) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_CREATE_SESSION:
{
args = (SomeArgs) msg.obj;
IInputMethod method = (IInputMethod) args.arg1;
InputChannel channel = (InputChannel) args.arg2;
try {
method.createSession(channel, (IInputSessionCallback) args.arg3);
} catch (RemoteException e) {
} finally {
// because the remote proxy will get its own copy when unparceled.
if (channel != null && Binder.isProxy(method)) {
channel.dispose();
}
}
args.recycle();
return true;
}
case MSG_START_INPUT:
{
int missingMethods = msg.arg1;
args = (SomeArgs) msg.obj;
try {
SessionState session = (SessionState) args.arg1;
setEnabledSessionInMainThread(session);
session.method.startInput((IInputContext) args.arg2, missingMethods, (EditorInfo) args.arg3);
} catch (RemoteException e) {
}
args.recycle();
return true;
}
case MSG_RESTART_INPUT:
{
int missingMethods = msg.arg1;
args = (SomeArgs) msg.obj;
try {
SessionState session = (SessionState) args.arg1;
setEnabledSessionInMainThread(session);
session.method.restartInput((IInputContext) args.arg2, missingMethods, (EditorInfo) args.arg3);
} catch (RemoteException e) {
}
args.recycle();
return true;
}
case MSG_UNBIND_CLIENT:
try {
((IInputMethodClient) msg.obj).onUnbindMethod(msg.arg1, msg.arg2);
} catch (RemoteException e) {
// There is nothing interesting about the last client dying.
}
return true;
case MSG_BIND_CLIENT:
{
args = (SomeArgs) msg.obj;
IInputMethodClient client = (IInputMethodClient) args.arg1;
InputBindResult res = (InputBindResult) args.arg2;
try {
client.onBindMethod(res);
} catch (RemoteException e) {
Slog.w(TAG, "Client died receiving input method " + args.arg2);
} finally {
// because the remote proxy will get its own copy when unparceled.
if (res.channel != null && Binder.isProxy(client)) {
res.channel.dispose();
}
}
args.recycle();
return true;
}
case MSG_SET_ACTIVE:
try {
((ClientState) msg.obj).client.setActive(msg.arg1 != 0);
} catch (RemoteException e) {
Slog.w(TAG, "Got RemoteException sending setActive(false) notification to pid " + ((ClientState) msg.obj).pid + " uid " + ((ClientState) msg.obj).uid);
}
return true;
case MSG_SET_INTERACTIVE:
handleSetInteractive(msg.arg1 != 0);
return true;
case MSG_SWITCH_IME:
handleSwitchInputMethod(msg.arg1 != 0);
return true;
case MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER:
{
final int sequenceNumber = msg.arg1;
final ClientState clientState = (ClientState) msg.obj;
try {
clientState.client.setUserActionNotificationSequenceNumber(sequenceNumber);
} catch (RemoteException e) {
Slog.w(TAG, "Got RemoteException sending " + "setUserActionNotificationSequenceNumber(" + sequenceNumber + ") notification to pid " + clientState.pid + " uid " + clientState.uid);
}
return true;
}
// --------------------------------------------------------------
case MSG_HARD_KEYBOARD_SWITCH_CHANGED:
mHardKeyboardListener.handleHardKeyboardStatusChange(msg.arg1 == 1);
return true;
case MSG_SYSTEM_UNLOCK_USER:
final int userId = msg.arg1;
onUnlockUser(userId);
return true;
}
return false;
}
Aggregations