public class InputManagerService extends IInputManager.Stub implements Watchdog.Monitor
Modifier and Type | Class and Description |
---|---|
static interface |
InputManagerService.WindowManagerCallbacks
Callback interface implemented by the Window Manager.
|
static interface |
InputManagerService.WiredAccessoryCallbacks
Callback interface implemented by WiredAccessoryObserver.
|
Modifier and Type | Field and Description |
---|---|
static int |
BTN_MOUSE
Scan code: Mouse / trackball button.
|
static int |
KEY_STATE_DOWN
The key is down.
|
static int |
KEY_STATE_UNKNOWN
The key state is unknown or the requested key itself is not supported.
|
static int |
KEY_STATE_UP
The key is up
|
static int |
KEY_STATE_VIRTUAL
The key is down but is a virtual key press that is being emulated by the system.
|
static int |
SW_CAMERA_LENS_COVER
Switch code: Camera lens cover.
|
static int |
SW_CAMERA_LENS_COVER_BIT |
static int |
SW_HEADPHONE_INSERT
Switch code: Headphone.
|
static int |
SW_HEADPHONE_INSERT_BIT |
static int |
SW_JACK_BITS |
static int |
SW_JACK_PHYSICAL_INSERT
Switch code: Headphone/Microphone Jack.
|
static int |
SW_JACK_PHYSICAL_INSERT_BIT |
static int |
SW_KEYPAD_SLIDE
Switch code: Keypad slide.
|
static int |
SW_KEYPAD_SLIDE_BIT |
static int |
SW_LID
Switch code: Lid switch.
|
static int |
SW_LID_BIT |
static int |
SW_LINEOUT_INSERT
Switch code: Line out.
|
static int |
SW_LINEOUT_INSERT_BIT |
static int |
SW_MICROPHONE_INSERT
Switch code: Microphone.
|
static int |
SW_MICROPHONE_INSERT_BIT |
static int |
SW_TABLET_MODE
Switch code: Tablet mode switch.
|
static int |
SW_TABLET_MODE_BIT |
Constructor and Description |
---|
InputManagerService(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
addKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier,
String keyboardLayoutDescriptor) |
void |
cancelVibrate(int deviceId,
IBinder token) |
void |
dump(FileDescriptor fd,
PrintWriter pw,
String[] args) |
String |
getCurrentKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier) |
String[] |
getEnabledKeyboardLayoutsForInputDevice(InputDeviceIdentifier identifier) |
InputDevice |
getInputDevice(int deviceId)
Gets information about the input device with the specified id.
|
int[] |
getInputDeviceIds()
Gets the ids of all input devices in the system.
|
InputDevice[] |
getInputDevices()
Gets all input devices in the system.
|
KeyboardLayout |
getKeyboardLayout(String keyboardLayoutDescriptor) |
KeyboardLayout |
getKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier,
InputMethodInfo imeInfo,
InputMethodSubtype imeSubtype) |
KeyboardLayout[] |
getKeyboardLayouts() |
KeyboardLayout[] |
getKeyboardLayoutsForInputDevice(InputDeviceIdentifier identifier) |
int |
getKeyCodeState(int deviceId,
int sourceMask,
int keyCode)
Gets the current state of a key or button by key code.
|
int |
getScanCodeState(int deviceId,
int sourceMask,
int scanCode)
Gets the current state of a key or button by scan code.
|
int |
getSwitchState(int deviceId,
int sourceMask,
int switchCode)
Gets the current state of a switch by switch code.
|
TouchCalibration |
getTouchCalibrationForInputDevice(String inputDeviceDescriptor,
int surfaceRotation) |
boolean |
hasKeys(int deviceId,
int sourceMask,
int[] keyCodes,
boolean[] keyExists)
Determines whether the specified key codes are supported by a particular device.
|
boolean |
injectInputEvent(InputEvent event,
int mode) |
int |
isInTabletMode() |
void |
monitor() |
InputChannel |
monitorInput(String inputChannelName)
Creates an input channel that will receive all input from the input dispatcher.
|
void |
onShellCommand(FileDescriptor in,
FileDescriptor out,
FileDescriptor err,
String[] args,
ResultReceiver resultReceiver) |
int |
onShellCommand(com.android.server.input.InputManagerService.Shell shell,
String cmd) |
void |
registerInputChannel(InputChannel inputChannel,
InputWindowHandle inputWindowHandle)
Registers an input channel so that it can be used as an input event target.
|
void |
registerInputDevicesChangedListener(IInputDevicesChangedListener listener) |
void |
registerTabletModeChangedListener(ITabletModeChangedListener listener) |
void |
removeKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier,
String keyboardLayoutDescriptor) |
void |
setCurrentKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier,
String keyboardLayoutDescriptor) |
void |
setCustomPointerIcon(PointerIcon icon) |
void |
setFocusedApplication(InputApplicationHandle application) |
void |
setInputDispatchMode(boolean enabled,
boolean frozen) |
void |
setInputFilter(IInputFilter filter)
Sets an input filter that will receive all input events before they are dispatched.
|
void |
setInputWindows(InputWindowHandle[] windowHandles) |
void |
setKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier,
InputMethodInfo imeInfo,
InputMethodSubtype imeSubtype,
String keyboardLayoutDescriptor) |
void |
setPointerIconType(int iconId) |
void |
setSystemUiVisibility(int visibility) |
void |
setTouchCalibrationForInputDevice(String inputDeviceDescriptor,
int surfaceRotation,
TouchCalibration calibration) |
void |
setWindowManagerCallbacks(InputManagerService.WindowManagerCallbacks callbacks) |
void |
setWiredAccessoryCallbacks(InputManagerService.WiredAccessoryCallbacks callbacks) |
void |
start() |
void |
systemRunning() |
boolean |
transferTouchFocus(InputChannel fromChannel,
InputChannel toChannel)
Atomically transfers touch focus from one window to another as identified by
their input channels.
|
void |
tryPointerSpeed(int speed) |
void |
unregisterInputChannel(InputChannel inputChannel)
Unregisters an input channel.
|
void |
updateAccessibilityLargePointerFromSettings() |
void |
updatePointerSpeedFromSettings() |
void |
updateShowTouchesFromSettings() |
void |
vibrate(int deviceId,
long[] pattern,
int repeat,
IBinder token) |
public static final int KEY_STATE_UNKNOWN
public static final int KEY_STATE_UP
public static final int KEY_STATE_DOWN
public static final int KEY_STATE_VIRTUAL
public static final int BTN_MOUSE
public static final int SW_LID
public static final int SW_TABLET_MODE
public static final int SW_KEYPAD_SLIDE
public static final int SW_HEADPHONE_INSERT
public static final int SW_MICROPHONE_INSERT
public static final int SW_LINEOUT_INSERT
public static final int SW_JACK_PHYSICAL_INSERT
public static final int SW_CAMERA_LENS_COVER
public static final int SW_LID_BIT
public static final int SW_TABLET_MODE_BIT
public static final int SW_KEYPAD_SLIDE_BIT
public static final int SW_HEADPHONE_INSERT_BIT
public static final int SW_MICROPHONE_INSERT_BIT
public static final int SW_LINEOUT_INSERT_BIT
public static final int SW_JACK_PHYSICAL_INSERT_BIT
public static final int SW_JACK_BITS
public static final int SW_CAMERA_LENS_COVER_BIT
public InputManagerService(Context context)
public void setWindowManagerCallbacks(InputManagerService.WindowManagerCallbacks callbacks)
public void setWiredAccessoryCallbacks(InputManagerService.WiredAccessoryCallbacks callbacks)
public void start()
public void systemRunning()
public int getKeyCodeState(int deviceId, int sourceMask, int keyCode)
deviceId
- The input device id, or -1 to consult all devices.sourceMask
- The input sources to consult, or InputDevice.SOURCE_ANY
to
consider all input sources. An input device is consulted if at least one of its
non-class input source bits matches the specified source mask.keyCode
- The key code to check.public int getScanCodeState(int deviceId, int sourceMask, int scanCode)
deviceId
- The input device id, or -1 to consult all devices.sourceMask
- The input sources to consult, or InputDevice.SOURCE_ANY
to
consider all input sources. An input device is consulted if at least one of its
non-class input source bits matches the specified source mask.scanCode
- The scan code to check.public int getSwitchState(int deviceId, int sourceMask, int switchCode)
deviceId
- The input device id, or -1 to consult all devices.sourceMask
- The input sources to consult, or InputDevice.SOURCE_ANY
to
consider all input sources. An input device is consulted if at least one of its
non-class input source bits matches the specified source mask.switchCode
- The switch code to check.public boolean hasKeys(int deviceId, int sourceMask, int[] keyCodes, boolean[] keyExists)
deviceId
- The input device id, or -1 to consult all devices.sourceMask
- The input sources to consult, or InputDevice.SOURCE_ANY
to
consider all input sources. An input device is consulted if at least one of its
non-class input source bits matches the specified source mask.keyCodes
- The array of key codes to check.keyExists
- An array at least as large as keyCodes whose entries will be set
to true or false based on the presence or absence of support for the corresponding
key codes.public InputChannel monitorInput(String inputChannelName)
inputChannelName
- The input channel name.public void registerInputChannel(InputChannel inputChannel, InputWindowHandle inputWindowHandle)
inputChannel
- The input channel to register.inputWindowHandle
- The handle of the input window associated with the
input channel, or null if none.public void unregisterInputChannel(InputChannel inputChannel)
inputChannel
- The input channel to unregister.public void setInputFilter(IInputFilter filter)
filter
- The input filter, or null to remove the current filter.public boolean injectInputEvent(InputEvent event, int mode)
public InputDevice getInputDevice(int deviceId)
deviceId
- The device id.public int[] getInputDeviceIds()
public InputDevice[] getInputDevices()
public void registerInputDevicesChangedListener(IInputDevicesChangedListener listener)
public TouchCalibration getTouchCalibrationForInputDevice(String inputDeviceDescriptor, int surfaceRotation)
public void setTouchCalibrationForInputDevice(String inputDeviceDescriptor, int surfaceRotation, TouchCalibration calibration)
public int isInTabletMode()
public void registerTabletModeChangedListener(ITabletModeChangedListener listener)
public KeyboardLayout[] getKeyboardLayouts()
public KeyboardLayout[] getKeyboardLayoutsForInputDevice(InputDeviceIdentifier identifier)
public KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor)
public String getCurrentKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier)
public void setCurrentKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)
public String[] getEnabledKeyboardLayoutsForInputDevice(InputDeviceIdentifier identifier)
public KeyboardLayout getKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier, InputMethodInfo imeInfo, InputMethodSubtype imeSubtype)
public void setKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier, InputMethodInfo imeInfo, InputMethodSubtype imeSubtype, String keyboardLayoutDescriptor)
public void addKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)
public void removeKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier, String keyboardLayoutDescriptor)
public void setInputWindows(InputWindowHandle[] windowHandles)
public void setFocusedApplication(InputApplicationHandle application)
public void setInputDispatchMode(boolean enabled, boolean frozen)
public void setSystemUiVisibility(int visibility)
public boolean transferTouchFocus(InputChannel fromChannel, InputChannel toChannel)
WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
but this
method only transfers touch focus of the specified window without affecting
other windows that may also have touch focus at the same time.fromChannel
- The channel of a window that currently has touch focus.toChannel
- The channel of the window that should receive touch focus in
place of the first.public void tryPointerSpeed(int speed)
public void updatePointerSpeedFromSettings()
public void updateShowTouchesFromSettings()
public void updateAccessibilityLargePointerFromSettings()
public void vibrate(int deviceId, long[] pattern, int repeat, IBinder token)
public void cancelVibrate(int deviceId, IBinder token)
public void setPointerIconType(int iconId)
public void setCustomPointerIcon(PointerIcon icon)
public void dump(FileDescriptor fd, PrintWriter pw, String[] args)
public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, String[] args, ResultReceiver resultReceiver)
public int onShellCommand(com.android.server.input.InputManagerService.Shell shell, String cmd)
public void monitor()
monitor
in interface Watchdog.Monitor