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