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