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 import android.view.PointerIcon;
28 import android.view.inputmethod.InputMethodInfo;
29 import android.view.inputmethod.InputMethodSubtype;
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     // Reports whether the hardware supports the given keys; returns true if successful
hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists)38     boolean hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists);
39 
40     // Temporarily changes the pointer speed.
tryPointerSpeed(int 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.
injectInputEvent(in InputEvent ev, int mode)45     boolean injectInputEvent(in InputEvent ev, int mode);
46 
47     // Calibrate input device position
getTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation)48     TouchCalibration getTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation);
setTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation, in TouchCalibration calibration)49     void setTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation,
50             in TouchCalibration calibration);
51 
52     // Keyboard layouts configuration.
getKeyboardLayouts()53     KeyboardLayout[] getKeyboardLayouts();
getKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier)54     KeyboardLayout[] getKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier);
getKeyboardLayout(String keyboardLayoutDescriptor)55     KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor);
getCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier)56     String getCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier);
setCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)57     void setCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
58             String keyboardLayoutDescriptor);
getEnabledKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier)59     String[] getEnabledKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier);
addKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)60     void addKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
61             String keyboardLayoutDescriptor);
removeKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)62     void removeKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
63             String keyboardLayoutDescriptor);
getKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype)64     KeyboardLayout getKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
65             in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype);
setKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier, in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype, String keyboardLayoutDescriptor)66     void setKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
67             in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype,
68             String keyboardLayoutDescriptor);
69 
70     // Registers an input devices changed listener.
registerInputDevicesChangedListener(IInputDevicesChangedListener listener)71     void registerInputDevicesChangedListener(IInputDevicesChangedListener listener);
72 
73     // Queries whether the device is currently in tablet mode
isInTabletMode()74     int isInTabletMode();
75     // Registers a tablet mode change listener
registerTabletModeChangedListener(ITabletModeChangedListener listener)76     void registerTabletModeChangedListener(ITabletModeChangedListener listener);
77 
78     // Input device vibrator control.
vibrate(int deviceId, in long[] pattern, int repeat, IBinder token)79     void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token);
cancelVibrate(int deviceId, IBinder token)80     void cancelVibrate(int deviceId, IBinder token);
81 
setPointerIconType(int typeId)82     void setPointerIconType(int typeId);
setCustomPointerIcon(in PointerIcon icon)83     void setCustomPointerIcon(in PointerIcon icon);
84 }
85