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 17package android.hardware.input; 18 19import android.hardware.input.InputDeviceIdentifier; 20import android.hardware.input.KeyboardLayout; 21import android.hardware.input.IInputDevicesChangedListener; 22import android.hardware.input.ITabletModeChangedListener; 23import android.hardware.input.TouchCalibration; 24import android.os.IBinder; 25import android.view.InputDevice; 26import android.view.InputEvent; 27import android.view.PointerIcon; 28import android.view.inputmethod.InputMethodInfo; 29import android.view.inputmethod.InputMethodSubtype; 30 31/** @hide */ 32interface IInputManager { 33 // Gets input device information. 34 InputDevice getInputDevice(int deviceId); 35 int[] getInputDeviceIds(); 36 37 // Reports whether the hardware supports the given keys; returns true if successful 38 boolean hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists); 39 40 // Temporarily changes the pointer speed. 41 void tryPointerSpeed(int speed); 42 43 // Injects an input event into the system. To inject into windows owned by other 44 // applications, the caller must have the INJECT_EVENTS permission. 45 boolean injectInputEvent(in InputEvent ev, int mode); 46 47 // Calibrate input device position 48 TouchCalibration getTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation); 49 void setTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation, 50 in TouchCalibration calibration); 51 52 // Keyboard layouts configuration. 53 KeyboardLayout[] getKeyboardLayouts(); 54 KeyboardLayout[] getKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier); 55 KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor); 56 String getCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier); 57 void setCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 58 String keyboardLayoutDescriptor); 59 String[] getEnabledKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier); 60 void addKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 61 String keyboardLayoutDescriptor); 62 void removeKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 63 String keyboardLayoutDescriptor); 64 KeyboardLayout getKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 65 in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype); 66 void setKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 67 in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype, 68 String keyboardLayoutDescriptor); 69 70 // Registers an input devices changed listener. 71 void registerInputDevicesChangedListener(IInputDevicesChangedListener listener); 72 73 // Queries whether the device is currently in tablet mode 74 int isInTabletMode(); 75 // Registers a tablet mode change listener 76 void registerTabletModeChangedListener(ITabletModeChangedListener listener); 77 78 // Input device vibrator control. 79 void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token); 80 void cancelVibrate(int deviceId, IBinder token); 81 82 void setPointerIconType(int typeId); 83 void setCustomPointerIcon(in PointerIcon icon); 84} 85