com.android.internal.view.IInputMethodManager Java Examples

The following examples show how to use com.android.internal.view.IInputMethodManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Input.java    From JsDroidCmd with Mozilla Public License 2.0 6 votes vote down vote up
public static boolean open() {
	IInputMethodManager mImm;
	mImm = IInputMethodManager.Stub.asInterface(ServiceManager
			.getService("input_method"));
	try {
		List<String> inputList = list();
		for (int i = 0; i < inputList.size(); i++) {
			String _id = inputList.get(i);
			if (_id.contains("CmdInputService")) {
				id = _id;
				break;
			}
		}
		mImm.setInputMethodEnabled(id, true);
		mImm.setInputMethod(null, id);
		return true;
	} catch (RemoteException e) {
	}
	return false;
}
 
Example #2
Source File: InputMethodManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
InputMethodManager(IInputMethodManager service, Looper looper) {
    mService = service;
    mMainLooper = looper;
    mH = new H(looper);
    mIInputContext = new ControlledInputConnectionWrapper(looper,
            mDummyInputConnection, this);
}
 
Example #3
Source File: Input.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public static boolean close() {
	IInputMethodManager mImm;
	mImm = IInputMethodManager.Stub.asInterface(ServiceManager
			.getService("input_method"));
	try {
		mImm.setInputMethodEnabled(id, false);
		for (InputMethodInfo info : mImm.getEnabledInputMethodList()) {
			mImm.setInputMethodEnabled(info.getId(), true);
			mImm.setInputMethod(null, info.getId());
			return true;
		}
	} catch (RemoteException e) {
	}
	return false;
}
 
Example #4
Source File: Input.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public static List<String> list() {
	List<String> ret = new ArrayList<String>();
	IInputMethodManager mImm;
	mImm = IInputMethodManager.Stub.asInterface(ServiceManager
			.getService("input_method"));
	try {

		for (InputMethodInfo info : mImm.getInputMethodList()) {
			ret.add(info.getId());
		}
	} catch (RemoteException e) {
	}
	return ret;
}
 
Example #5
Source File: MyUiAutomatorTestCase.java    From PUMA with Apache License 2.0 5 votes vote down vote up
private void setDummyIme() throws RemoteException {
	IInputMethodManager im = IInputMethodManager.Stub.asInterface(ServiceManager.getService(Context.INPUT_METHOD_SERVICE));
	List<InputMethodInfo> infos = im.getInputMethodList();
	String id = null;
	for (InputMethodInfo info : infos) {
		if (DUMMY_IME_PACKAGE.equals(info.getComponent().getPackageName())) {
			id = info.getId();
		}
	}
	if (id == null) {
		throw new RuntimeException(String.format("Required testing fixture missing: IME package (%s)", DUMMY_IME_PACKAGE));
	}
	im.setInputMethod(null, id);
}
 
Example #6
Source File: Session.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public Session(WindowManagerService service, IWindowSessionCallback callback,
        IInputMethodClient client, IInputContext inputContext) {
    mService = service;
    mCallback = callback;
    mClient = client;
    mUid = Binder.getCallingUid();
    mPid = Binder.getCallingPid();
    mLastReportedAnimatorScale = service.getCurrentAnimatorScale();
    mCanAddInternalSystemWindow = service.mContext.checkCallingOrSelfPermission(
            INTERNAL_SYSTEM_WINDOW) == PERMISSION_GRANTED;
    mCanHideNonSystemOverlayWindows = service.mContext.checkCallingOrSelfPermission(
            HIDE_NON_SYSTEM_OVERLAY_WINDOWS) == PERMISSION_GRANTED;
    mCanAcquireSleepToken = service.mContext.checkCallingOrSelfPermission(DEVICE_POWER)
            == PERMISSION_GRANTED;
    mShowingAlertWindowNotificationAllowed = mService.mShowAlertWindowNotifications;
    mDragDropController = mService.mDragDropController;
    StringBuilder sb = new StringBuilder();
    sb.append("Session{");
    sb.append(Integer.toHexString(System.identityHashCode(this)));
    sb.append(" ");
    sb.append(mPid);
    if (mUid < Process.FIRST_APPLICATION_UID) {
        sb.append(":");
        sb.append(mUid);
    } else {
        sb.append(":u");
        sb.append(UserHandle.getUserId(mUid));
        sb.append('a');
        sb.append(UserHandle.getAppId(mUid));
    }
    sb.append("}");
    mStringName = sb.toString();

    synchronized (mService.mWindowMap) {
        if (mService.mInputMethodManager == null && mService.mHaveInputMethods) {
            IBinder b = ServiceManager.getService(
                    Context.INPUT_METHOD_SERVICE);
            mService.mInputMethodManager = IInputMethodManager.Stub.asInterface(b);
        }
    }
    long ident = Binder.clearCallingIdentity();
    try {
        // Note: it is safe to call in to the input method manager
        // here because we are not holding our lock.
        if (mService.mInputMethodManager != null) {
            mService.mInputMethodManager.addClient(client, inputContext,
                    mUid, mPid);
        } else {
            client.setUsingInputMethod(false);
        }
        client.asBinder().linkToDeath(this, 0);
    } catch (RemoteException e) {
        // The caller has died, so we can just forget about this.
        try {
            if (mService.mInputMethodManager != null) {
                mService.mInputMethodManager.removeClient(client);
            }
        } catch (RemoteException ee) {
        }
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
 
Example #7
Source File: InputMethodManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
InputMethodManager(Looper looper) throws ServiceNotFoundException {
    this(IInputMethodManager.Stub.asInterface(
            ServiceManager.getServiceOrThrow(Context.INPUT_METHOD_SERVICE)), looper);
}
 
Example #8
Source File: NetUtils.java    From TvRemoteControl with Apache License 2.0 4 votes vote down vote up
private NetUtils() {
    IBinder b = ServiceManager.getService(Context.INPUT_METHOD_SERVICE);
    mService = IInputMethodManager.Stub.asInterface(b);
    mPool = Executors.newCachedThreadPool();
    ipDevMap = new HashMap<String, String>();
}