android.hardware.input.InputManager Java Examples

The following examples show how to use android.hardware.input.InputManager. 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: GameView.java    From AndroidDemoProjects with Apache License 2.0 6 votes vote down vote up
public GameView(Context context) {
    super( context );

    setEGLContextClientVersion( 2 );
    this.setRenderer( this );
    this.requestFocus();

    mInstance = this;

    mLastUpdateTimeMillis = System.currentTimeMillis();

    mShip = new Ship();

    InputManager inputManager = (InputManager) context.getSystemService( Context.INPUT_SERVICE );
    inputManager.registerInputDeviceListener( this, null );
    mAsteroids = new ArrayList<Asteroid>();
    mBullets = new ArrayList<Bullet>();
    initLevel();
}
 
Example #2
Source File: UiAutomationConnection.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean injectInputEvent(InputEvent event, boolean sync) {
    synchronized (mLock) {
        throwIfCalledByNotTrustedUidLocked();
        throwIfShutdownLocked();
        throwIfNotConnectedLocked();
    }
    final int mode = (sync) ? InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH
            : InputManager.INJECT_INPUT_EVENT_MODE_ASYNC;
    final long identity = Binder.clearCallingIdentity();
    try {
        return InputManager.getInstance().injectInputEvent(event, mode);
    } finally {
        Binder.restoreCallingIdentity(identity);
    }
}
 
Example #3
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
/**
 * Send a key event to the currently focused window/view and wait for it to
 * be processed.  Finished at some point after the recipient has returned
 * from its event processing, though it may <em>not</em> have completely
 * finished reacting from the event -- for example, if it needs to update
 * its display as a result, it may still be in the process of doing that.
 *
 * @param event The event to send to the current focus.
 */
public void sendKeySync(KeyEvent event) {
    validateNotAppThread();

    long downTime = event.getDownTime();
    long eventTime = event.getEventTime();
    int source = event.getSource();
    if (source == InputDevice.SOURCE_UNKNOWN) {
        source = InputDevice.SOURCE_KEYBOARD;
    }
    if (eventTime == 0) {
        eventTime = SystemClock.uptimeMillis();
    }
    if (downTime == 0) {
        downTime = eventTime;
    }
    KeyEvent newEvent = new KeyEvent(event);
    newEvent.setTime(downTime, eventTime);
    newEvent.setSource(source);
    newEvent.setFlags(event.getFlags() | KeyEvent.FLAG_FROM_SYSTEM);
    InputManager.getInstance().injectInputEvent(newEvent,
            InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
}
 
Example #4
Source File: PieController.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public void handleMessage(Message m) {
    switch (m.what) {
        case MSG_INJECT_KEY:
            final long eventTime = SystemClock.uptimeMillis();
            final InputManager inputManager = (InputManager)
                    XposedHelpers.callStaticMethod(InputManager.class, "getInstance");

            int flags = KeyEvent.FLAG_FROM_SYSTEM;
            XposedHelpers.callMethod(inputManager, "injectInputEvent",
                    new KeyEvent(eventTime - 50, eventTime - 50, KeyEvent.ACTION_DOWN, m.arg1, 0,
                            0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags, InputDevice.SOURCE_UNKNOWN), 0);
            XposedHelpers.callMethod(inputManager, "injectInputEvent",
                    new KeyEvent(eventTime - 50, eventTime - 25, KeyEvent.ACTION_UP, m.arg1, 0,
                            0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags, InputDevice.SOURCE_UNKNOWN), 0);

            break;
    }
}
 
Example #5
Source File: ModHwKeys.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public static void injectKey(final int keyCode) {
    Handler handler = (Handler) XposedHelpers.getObjectField(mPhoneWindowManager, "mHandler");
    if (handler == null) return;

    handler.post(new Runnable() {
        @Override
        public void run() {
            try {
                final long eventTime = SystemClock.uptimeMillis();
                final InputManager inputManager = (InputManager)
                        mContext.getSystemService(Context.INPUT_SERVICE);
                int flags = KeyEvent.FLAG_FROM_SYSTEM;
                XposedHelpers.callMethod(inputManager, "injectInputEvent",
                        new KeyEvent(eventTime - 50, eventTime - 50, KeyEvent.ACTION_DOWN,
                                keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                                InputDevice.SOURCE_UNKNOWN), 0);
                XposedHelpers.callMethod(inputManager, "injectInputEvent",
                        new KeyEvent(eventTime - 50, eventTime - 25, KeyEvent.ACTION_UP,
                                keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                                InputDevice.SOURCE_UNKNOWN), 0);
            } catch (Throwable t) {
                XposedBridge.log(t);
            }
        }
    });
}
 
Example #6
Source File: NetUtils.java    From TvRemoteControl with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    isFlag = true;/*线程开始运行,设置标志位进入轮询*/
    while (isFlag) {
        try {
            long now = System.currentTimeMillis();
            KeyEvent down = new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 0);
            KeyEvent up = new KeyEvent(now, now, KeyEvent.ACTION_UP, keyCode, 0);
            InputManager.getInstance().injectInputEvent(down, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
            InputManager.getInstance().injectInputEvent(up, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
            Log.i("gky", "--------->injectKeyEvent " + keyCode);
            Thread.sleep(30);
        } catch (InterruptedException e) {
            e.printStackTrace();
            isFlag = false;/*异常结束线程运行*/
        }
    }
    Log.i("gky", "---------->stop LongKeyRunnale");
}
 
Example #7
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void visitAllKeyboardLayouts(KeyboardLayoutVisitor visitor) {
    final PackageManager pm = mContext.getPackageManager();
    Intent intent = new Intent(InputManager.ACTION_QUERY_KEYBOARD_LAYOUTS);
    for (ResolveInfo resolveInfo : pm.queryBroadcastReceivers(intent,
            PackageManager.GET_META_DATA | PackageManager.MATCH_DIRECT_BOOT_AWARE
                    | PackageManager.MATCH_DIRECT_BOOT_UNAWARE)) {
        final ActivityInfo activityInfo = resolveInfo.activityInfo;
        final int priority = resolveInfo.priority;
        visitKeyboardLayoutsInPackage(pm, activityInfo, null, priority, visitor);
    }
}
 
Example #8
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private int getPointerSpeedSetting() {
    int speed = InputManager.DEFAULT_POINTER_SPEED;
    try {
        speed = Settings.System.getIntForUser(mContext.getContentResolver(),
                Settings.System.POINTER_SPEED, UserHandle.USER_CURRENT);
    } catch (SettingNotFoundException snfe) {
    }
    return speed;
}
 
Example #9
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override // Binder call
public void tryPointerSpeed(int speed) {
    if (!checkCallingPermission(android.Manifest.permission.SET_POINTER_SPEED,
            "tryPointerSpeed()")) {
        throw new SecurityException("Requires SET_POINTER_SPEED permission");
    }

    if (speed < InputManager.MIN_POINTER_SPEED || speed > InputManager.MAX_POINTER_SPEED) {
        throw new IllegalArgumentException("speed out of range");
    }

    setPointerSpeedUnchecked(speed);
}
 
Example #10
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void sendInputEvent(InputEvent event, int policyFlags) {
    if (event == null) {
        throw new IllegalArgumentException("event must not be null");
    }

    synchronized (mInputFilterLock) {
        if (!mDisconnected) {
            nativeInjectInputEvent(mPtr, event, Display.DEFAULT_DISPLAY, 0, 0,
                    InputManager.INJECT_INPUT_EVENT_MODE_ASYNC, 0,
                    policyFlags | WindowManagerPolicy.FLAG_FILTERED);
        }
    }
}
 
Example #11
Source File: KeyCharacterMap.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Loads the key character maps for the keyboard with the specified device id.
 *
 * @param deviceId The device id of the keyboard.
 * @return The associated key character map.
 * @throws {@link UnavailableException} if the key character map
 * could not be loaded because it was malformed or the default key character map
 * is missing from the system.
 */
public static KeyCharacterMap load(int deviceId) {
    final InputManager im = InputManager.getInstance();
    InputDevice inputDevice = im.getInputDevice(deviceId);
    if (inputDevice == null) {
        inputDevice = im.getInputDevice(VIRTUAL_KEYBOARD);
        if (inputDevice == null) {
            throw new UnavailableException(
                    "Could not load key character map for device " + deviceId);
        }
    }
    return inputDevice.getKeyCharacterMap();
}
 
Example #12
Source File: Instrumentation.java    From droidel with Apache License 2.0 5 votes vote down vote up
/**
 * Send a key event to the currently focused window/view and wait for it to
 * be processed.  Finished at some point after the recipient has returned
 * from its event processing, though it may <em>not</em> have completely
 * finished reacting from the event -- for example, if it needs to update
 * its display as a result, it may still be in the process of doing that.
 * 
 * @param event The event to send to the current focus.
 */
public void sendKeySync(KeyEvent event) {
    validateNotAppThread();

    long downTime = event.getDownTime();
    long eventTime = event.getEventTime();
    int action = event.getAction();
    int code = event.getKeyCode();
    int repeatCount = event.getRepeatCount();
    int metaState = event.getMetaState();
    int deviceId = event.getDeviceId();
    int scancode = event.getScanCode();
    int source = event.getSource();
    int flags = event.getFlags();
    if (source == InputDevice.SOURCE_UNKNOWN) {
        source = InputDevice.SOURCE_KEYBOARD;
    }
    if (eventTime == 0) {
        eventTime = SystemClock.uptimeMillis();
    }
    if (downTime == 0) {
        downTime = eventTime;
    }
    KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState,
            deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source);
    InputManager.getInstance().injectInputEvent(newEvent,
            InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
}
 
Example #13
Source File: GamepadList.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void attachedToWindow(Context context) {
    if (mAttachedToWindowCounter++ == 0) {
        mInputManager = (InputManager) context.getSystemService(Context.INPUT_SERVICE);
        synchronized (mLock) {
            initializeDevices();
        }
        // Register an input device listener.
        mInputManager.registerInputDeviceListener(mInputDeviceListener, null);
    }
}
 
Example #14
Source File: InputDevice.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the vibrator service associated with the device, if there is one.
 * Even if the device does not have a vibrator, the result is never null.
 * Use {@link Vibrator#hasVibrator} to determine whether a vibrator is
 * present.
 *
 * Note that the vibrator associated with the device may be different from
 * the system vibrator.  To obtain an instance of the system vibrator instead, call
 * {@link Context#getSystemService} with {@link Context#VIBRATOR_SERVICE} as argument.
 *
 * @return The vibrator service associated with the device, never null.
 */
public Vibrator getVibrator() {
    synchronized (mMotionRanges) {
        if (mVibrator == null) {
            if (mHasVibrator) {
                mVibrator = InputManager.getInstance().getInputDeviceVibrator(mId);
            } else {
                mVibrator = NullVibrator.getInstance();
            }
        }
        return mVibrator;
    }
}
 
Example #15
Source File: Instrumentation.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Send a key event to the currently focused window/view and wait for it to
 * be processed.  Finished at some point after the recipient has returned
 * from its event processing, though it may <em>not</em> have completely
 * finished reacting from the event -- for example, if it needs to update
 * its display as a result, it may still be in the process of doing that.
 * 
 * @param event The event to send to the current focus.
 */
public void sendKeySync(KeyEvent event) {
    validateNotAppThread();

    long downTime = event.getDownTime();
    long eventTime = event.getEventTime();
    int action = event.getAction();
    int code = event.getKeyCode();
    int repeatCount = event.getRepeatCount();
    int metaState = event.getMetaState();
    int deviceId = event.getDeviceId();
    int scancode = event.getScanCode();
    int source = event.getSource();
    int flags = event.getFlags();
    if (source == InputDevice.SOURCE_UNKNOWN) {
        source = InputDevice.SOURCE_KEYBOARD;
    }
    if (eventTime == 0) {
        eventTime = SystemClock.uptimeMillis();
    }
    if (downTime == 0) {
        downTime = eventTime;
    }
    KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState,
            deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source);
    InputManager.getInstance().injectInputEvent(newEvent,
            InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
}
 
Example #16
Source File: KeyButtonView.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
void sendEvent(int action, int flags, long when, boolean applyDefaultFlags) {
    try {
        final int repeatCount = (flags & KeyEvent.FLAG_LONG_PRESS) != 0 ? 1 : 0;
        if (applyDefaultFlags) {
            flags |= KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY;
        }
        final KeyEvent ev = new KeyEvent(mDownTime, when, action, mCode, repeatCount,
                0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                InputDevice.SOURCE_KEYBOARD);
        final Object inputManager = XposedHelpers.callStaticMethod(InputManager.class, "getInstance");
        XposedHelpers.callMethod(inputManager, "injectInputEvent", ev, 0);
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #17
Source File: SampleManager.java    From FunnyDraw with Apache License 2.0 5 votes vote down vote up
private MotionInjector() throws MotionDrawException {
    try {
        mInputManager = (InputManager)
                InputManager.class.getDeclaredMethod("getInstance").invoke(null);
        mInjectInputEvent =
                InputManager.class.getDeclaredMethod("injectInputEvent",
                        InputEvent.class, Integer.TYPE);
        mInjectInputEvent.setAccessible(true);
    } catch (Exception e) {
        throw new MotionDrawException(e.getMessage());
    }
}
 
Example #18
Source File: HJInput.java    From HJMirror with MIT License 5 votes vote down vote up
@SuppressLint("PrivateApi")
public HJInput() {
    try {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            mInputManager = (InputManager) InputManager.class.getDeclaredMethod("getInstance").invoke(null);
            mInjectInputEventMethod = InputManager.class.getMethod("injectInputEvent", InputEvent.class, Integer.TYPE);
        }
    } catch (Exception e) {
        HJLog.e(e);
    }
}
 
Example #19
Source File: InputHelper.java    From XposedSmsCode with GNU General Public License v3.0 5 votes vote down vote up
/**
 * refer com.android.commands.input.Input#injectKeyEvent()
 */
@SuppressLint("PrivateApi")
private static void injectKeyEvent(KeyEvent keyEvent) throws Throwable {
    InputManager inputManager = (InputManager) XposedHelpers.callStaticMethod(InputManager.class, "getInstance");

    int INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH =
            XposedHelpers.getStaticIntField(InputManager.class, "INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH");

    Class<?>[] paramTypes = {KeyEvent.class, int.class,};
    Object[] args = {keyEvent, INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH,};

    XposedHelpers.callMethod(inputManager, "injectInputEvent", paramTypes, args);
}
 
Example #20
Source File: HdmiCecLocalDevice.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
static void injectKeyEvent(long time, int action, int keycode, int repeat) {
     KeyEvent keyEvent = KeyEvent.obtain(time, time, action, keycode,
             repeat, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_FROM_SYSTEM,
             InputDevice.SOURCE_HDMI, null);
     InputManager.getInstance().injectInputEvent(keyEvent,
             InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
     keyEvent.recycle();
}
 
Example #21
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Send a key event to the currently focused window/view and wait for it to
 * be processed.  Finished at some point after the recipient has returned
 * from its event processing, though it may <em>not</em> have completely
 * finished reacting from the event -- for example, if it needs to update
 * its display as a result, it may still be in the process of doing that.
 * 
 * @param event The event to send to the current focus.
 */
public void sendKeySync(KeyEvent event) {
    validateNotAppThread();

    long downTime = event.getDownTime();
    long eventTime = event.getEventTime();
    int action = event.getAction();
    int code = event.getKeyCode();
    int repeatCount = event.getRepeatCount();
    int metaState = event.getMetaState();
    int deviceId = event.getDeviceId();
    int scancode = event.getScanCode();
    int source = event.getSource();
    int flags = event.getFlags();
    if (source == InputDevice.SOURCE_UNKNOWN) {
        source = InputDevice.SOURCE_KEYBOARD;
    }
    if (eventTime == 0) {
        eventTime = SystemClock.uptimeMillis();
    }
    if (downTime == 0) {
        downTime = eventTime;
    }
    KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState,
            deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source);
    InputManager.getInstance().injectInputEvent(newEvent,
            InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
}
 
Example #22
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Send a key event to the currently focused window/view and wait for it to
 * be processed.  Finished at some point after the recipient has returned
 * from its event processing, though it may <em>not</em> have completely
 * finished reacting from the event -- for example, if it needs to update
 * its display as a result, it may still be in the process of doing that.
 * 
 * @param event The event to send to the current focus.
 */
public void sendKeySync(KeyEvent event) {
    validateNotAppThread();

    long downTime = event.getDownTime();
    long eventTime = event.getEventTime();
    int action = event.getAction();
    int code = event.getKeyCode();
    int repeatCount = event.getRepeatCount();
    int metaState = event.getMetaState();
    int deviceId = event.getDeviceId();
    int scancode = event.getScanCode();
    int source = event.getSource();
    int flags = event.getFlags();
    if (source == InputDevice.SOURCE_UNKNOWN) {
        source = InputDevice.SOURCE_KEYBOARD;
    }
    if (eventTime == 0) {
        eventTime = SystemClock.uptimeMillis();
    }
    if (downTime == 0) {
        downTime = eventTime;
    }
    KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState,
            deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source);
    InputManager.getInstance().injectInputEvent(newEvent,
            InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
}
 
Example #23
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Dispatch a pointer event. Finished at some point after the recipient has
 * returned from its event processing, though it may <em>not</em> have
 * completely finished reacting from the event -- for example, if it needs
 * to update its display as a result, it may still be in the process of
 * doing that.
 * 
 * @param event A motion event describing the pointer action.  (As noted in 
 * {@link MotionEvent#obtain(long, long, int, float, float, int)}, be sure to use 
 * {@link SystemClock#uptimeMillis()} as the timebase.
 */
public void sendPointerSync(MotionEvent event) {
    validateNotAppThread();
    if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) {
        event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
    }
    try {
        WindowManagerGlobal.getWindowManagerService().injectInputAfterTransactionsApplied(event,
                InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
    } catch (RemoteException e) {
    }
}
 
Example #24
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private boolean injectInputEventInternal(InputEvent event, int displayId, int mode) {
    if (event == null) {
        throw new IllegalArgumentException("event must not be null");
    }
    if (mode != InputManager.INJECT_INPUT_EVENT_MODE_ASYNC
            && mode != InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH
            && mode != InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT) {
        throw new IllegalArgumentException("mode is invalid");
    }

    final int pid = Binder.getCallingPid();
    final int uid = Binder.getCallingUid();
    final long ident = Binder.clearCallingIdentity();
    final int result;
    try {
        result = nativeInjectInputEvent(mPtr, event, displayId, pid, uid, mode,
                INJECTION_TIMEOUT_MILLIS, WindowManagerPolicy.FLAG_DISABLE_KEY_REPEAT);
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
    switch (result) {
        case INPUT_EVENT_INJECTION_PERMISSION_DENIED:
            Slog.w(TAG, "Input event injection from pid " + pid + " permission denied.");
            throw new SecurityException(
                    "Injecting to another application requires INJECT_EVENTS permission");
        case INPUT_EVENT_INJECTION_SUCCEEDED:
            return true;
        case INPUT_EVENT_INJECTION_TIMED_OUT:
            Slog.w(TAG, "Input event injection from pid " + pid + " timed out.");
            return false;
        case INPUT_EVENT_INJECTION_FAILED:
        default:
            Slog.w(TAG, "Input event injection from pid " + pid + " failed.");
            return false;
    }
}
 
Example #25
Source File: DragState.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
void overridePointerIconLocked(int touchSource) {
    mTouchSource = touchSource;
    if (isFromSource(InputDevice.SOURCE_MOUSE)) {
        InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_GRABBING);
    }
}
 
Example #26
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createStaticService() {
    return InputManager.getInstance();
}
 
Example #27
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object createStaticService() {
    return InputManager.getInstance();
}
 
Example #28
Source File: ServiceUtil.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
@TargetApi(16)
public static InputManager getInputManager() {
    return (InputManager) getSystemService(Context.INPUT_SERVICE);
}
 
Example #29
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public InputManager createService() {
    return InputManager.getInstance();
}
 
Example #30
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private void setPointerSpeedUnchecked(int speed) {
    speed = Math.min(Math.max(speed, InputManager.MIN_POINTER_SPEED),
            InputManager.MAX_POINTER_SPEED);
    nativeSetPointerSpeed(mPtr, speed);
}