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.graphics.Rect; 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.InputMonitor; 29 import android.view.PointerIcon; 30 import android.view.VerifiedInputEvent; 31 32 /** @hide */ 33 interface IInputManager { 34 // Gets input device information. getInputDevice(int deviceId)35 InputDevice getInputDevice(int deviceId); getInputDeviceIds()36 int[] getInputDeviceIds(); 37 38 // Enable/disable input device. isInputDeviceEnabled(int deviceId)39 boolean isInputDeviceEnabled(int deviceId); enableInputDevice(int deviceId)40 void enableInputDevice(int deviceId); disableInputDevice(int deviceId)41 void disableInputDevice(int deviceId); 42 43 // Reports whether the hardware supports the given keys; returns true if successful hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists)44 boolean hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists); 45 46 // Temporarily changes the pointer speed. tryPointerSpeed(int speed)47 void tryPointerSpeed(int speed); 48 49 // Injects an input event into the system. To inject into windows owned by other 50 // applications, the caller must have the INJECT_EVENTS permission. 51 @UnsupportedAppUsage injectInputEvent(in InputEvent ev, int mode)52 boolean injectInputEvent(in InputEvent ev, int mode); 53 verifyInputEvent(in InputEvent ev)54 VerifiedInputEvent verifyInputEvent(in InputEvent ev); 55 56 // Calibrate input device position getTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation)57 TouchCalibration getTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation); setTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation, in TouchCalibration calibration)58 void setTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation, 59 in TouchCalibration calibration); 60 61 // Keyboard layouts configuration. getKeyboardLayouts()62 KeyboardLayout[] getKeyboardLayouts(); getKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier)63 KeyboardLayout[] getKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier); getKeyboardLayout(String keyboardLayoutDescriptor)64 KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor); getCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier)65 String getCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier); setCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)66 void setCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 67 String keyboardLayoutDescriptor); getEnabledKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier)68 String[] getEnabledKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier); addKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)69 void addKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 70 String keyboardLayoutDescriptor); removeKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)71 void removeKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, 72 String keyboardLayoutDescriptor); 73 74 // Registers an input devices changed listener. registerInputDevicesChangedListener(IInputDevicesChangedListener listener)75 void registerInputDevicesChangedListener(IInputDevicesChangedListener listener); 76 77 // Queries whether the device is currently in tablet mode isInTabletMode()78 int isInTabletMode(); 79 // Registers a tablet mode change listener registerTabletModeChangedListener(ITabletModeChangedListener listener)80 void registerTabletModeChangedListener(ITabletModeChangedListener listener); 81 82 // Queries whether the device's microphone is muted by switch isMicMuted()83 int isMicMuted(); 84 85 // Input device vibrator control. vibrate(int deviceId, in long[] pattern, int repeat, IBinder token)86 void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token); cancelVibrate(int deviceId, IBinder token)87 void cancelVibrate(int deviceId, IBinder token); 88 setPointerIconType(int typeId)89 void setPointerIconType(int typeId); setCustomPointerIcon(in PointerIcon icon)90 void setCustomPointerIcon(in PointerIcon icon); 91 requestPointerCapture(IBinder windowToken, boolean enabled)92 void requestPointerCapture(IBinder windowToken, boolean enabled); 93 94 /** Create an input monitor for gestures. */ monitorGestureInput(String name, int displayId)95 InputMonitor monitorGestureInput(String name, int displayId); 96 97 // Add a runtime association between the input port and the display port. This overrides any 98 // static associations. addPortAssociation(in String inputPort, int displayPort)99 void addPortAssociation(in String inputPort, int displayPort); 100 // Remove the runtime association between the input port and the display port. Any existing 101 // static association for the cleared input port will be restored. removePortAssociation(in String inputPort)102 void removePortAssociation(in String inputPort); 103 } 104