Home | History | Annotate | Download | only in input
      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.
     33     InputDevice getInputDevice(int deviceId);
     34     int[] getInputDeviceIds();
     35 
     36     // Enable/disable input device.
     37     boolean isInputDeviceEnabled(int deviceId);
     38     void enableInputDevice(int deviceId);
     39     void disableInputDevice(int deviceId);
     40 
     41     // Reports whether the hardware supports the given keys; returns true if successful
     42     boolean hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists);
     43 
     44     // Temporarily changes the pointer 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.
     49     boolean injectInputEvent(in InputEvent ev, int mode);
     50 
     51     // Calibrate input device position
     52     TouchCalibration getTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation);
     53     void setTouchCalibrationForInputDevice(String inputDeviceDescriptor, int rotation,
     54             in TouchCalibration calibration);
     55 
     56     // Keyboard layouts configuration.
     57     KeyboardLayout[] getKeyboardLayouts();
     58     KeyboardLayout[] getKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier);
     59     KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor);
     60     String getCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier);
     61     void setCurrentKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
     62             String keyboardLayoutDescriptor);
     63     String[] getEnabledKeyboardLayoutsForInputDevice(in InputDeviceIdentifier identifier);
     64     void addKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
     65             String keyboardLayoutDescriptor);
     66     void removeKeyboardLayoutForInputDevice(in InputDeviceIdentifier identifier,
     67             String keyboardLayoutDescriptor);
     68 
     69     // Registers an input devices changed listener.
     70     void registerInputDevicesChangedListener(IInputDevicesChangedListener listener);
     71 
     72     // Queries whether the device is currently in tablet mode
     73     int isInTabletMode();
     74     // Registers a tablet mode change listener
     75     void registerTabletModeChangedListener(ITabletModeChangedListener listener);
     76 
     77     // Input device vibrator control.
     78     void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token);
     79     void cancelVibrate(int deviceId, IBinder token);
     80 
     81     void setPointerIconType(int typeId);
     82     void setCustomPointerIcon(in PointerIcon icon);
     83 
     84     void requestPointerCapture(IBinder windowToken, boolean enabled);
     85 
     86     /** Create input forwarder to deliver touch events to owned display. */
     87     IInputForwarder createInputForwarder(int displayId);
     88 }
     89