1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware.input; 18 19 import android.hardware.input.KeyboardLayout; 20 import android.hardware.input.IInputDevicesChangedListener; 21 import android.os.IBinder; 22 import android.view.InputDevice; 23 import android.view.InputEvent; 24 25 /** @hide */ 26 interface IInputManager { 27 // Gets input device information. getInputDevice(int deviceId)28 InputDevice getInputDevice(int deviceId); getInputDeviceIds()29 int[] getInputDeviceIds(); 30 31 // Reports whether the hardware supports the given keys; returns true if successful hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists)32 boolean hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists); 33 34 // Temporarily changes the pointer speed. tryPointerSpeed(int speed)35 void tryPointerSpeed(int speed); 36 37 // Injects an input event into the system. To inject into windows owned by other 38 // applications, the caller must have the INJECT_EVENTS permission. injectInputEvent(in InputEvent ev, int mode)39 boolean injectInputEvent(in InputEvent ev, int mode); 40 41 // Keyboard layouts configuration. getKeyboardLayouts()42 KeyboardLayout[] getKeyboardLayouts(); getKeyboardLayout(String keyboardLayoutDescriptor)43 KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor); getCurrentKeyboardLayoutForInputDevice(String inputDeviceDescriptor)44 String getCurrentKeyboardLayoutForInputDevice(String inputDeviceDescriptor); setCurrentKeyboardLayoutForInputDevice(String inputDeviceDescriptor, String keyboardLayoutDescriptor)45 void setCurrentKeyboardLayoutForInputDevice(String inputDeviceDescriptor, 46 String keyboardLayoutDescriptor); getKeyboardLayoutsForInputDevice(String inputDeviceDescriptor)47 String[] getKeyboardLayoutsForInputDevice(String inputDeviceDescriptor); addKeyboardLayoutForInputDevice(String inputDeviceDescriptor, String keyboardLayoutDescriptor)48 void addKeyboardLayoutForInputDevice(String inputDeviceDescriptor, 49 String keyboardLayoutDescriptor); removeKeyboardLayoutForInputDevice(String inputDeviceDescriptor, String keyboardLayoutDescriptor)50 void removeKeyboardLayoutForInputDevice(String inputDeviceDescriptor, 51 String keyboardLayoutDescriptor); 52 53 // Registers an input devices changed listener. registerInputDevicesChangedListener(IInputDevicesChangedListener listener)54 void registerInputDevicesChangedListener(IInputDevicesChangedListener listener); 55 56 // Input device vibrator control. vibrate(int deviceId, in long[] pattern, int repeat, IBinder token)57 void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token); cancelVibrate(int deviceId, IBinder token)58 void cancelVibrate(int deviceId, IBinder token); 59 } 60