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