/**@class android.hardware.input.InputManager @extends java.lang.Object Provides information about input devices and available key layouts. */ var InputManager = { /** Broadcast Action: Query available keyboard layouts. <p> The input manager service locates available keyboard layouts by querying broadcast receivers that are registered for this action. An application can offer additional keyboard layouts to the user by declaring a suitable broadcast receiver in its manifest. </p><p> Here is an example broadcast receiver declaration that an application might include in its AndroidManifest.xml to advertise keyboard layouts. The meta-data specifies a resource that contains a description of each keyboard layout that is provided by the application. <pre><code> <receiver android:name=".InputDeviceReceiver" android:label="@string/keyboard_layouts_label"> <intent-filter> <action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" /> </intent-filter> <meta-data android:name="android.hardware.input.metadata.KEYBOARD_LAYOUTS" android:resource="@xml/keyboard_layouts" /> </receiver> </code></pre> </p><p> In the above example, the <code>@xml/keyboard_layouts</code> resource refers to an XML resource whose root element is <code><keyboard-layouts></code> that contains zero or more <code><keyboard-layout></code> elements. Each <code><keyboard-layout></code> element specifies the name, label, and location of a key character map for a particular keyboard layout. The label on the receiver is used to name the collection of keyboard layouts provided by this receiver in the keyboard layout settings. <pre><code> <?xml version="1.0" encoding="utf-8"?> <keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android"> <keyboard-layout android:name="keyboard_layout_english_us" android:label="@string/keyboard_layout_english_us_label" android:keyboardLayout="@raw/keyboard_layout_english_us" /> </keyboard-layouts> </pre></code> </p><p> The <code>android:name</code> attribute specifies an identifier by which the keyboard layout will be known in the package. The <code>android:label</code> attribute specifies a human-readable descriptive label to describe the keyboard layout in the user interface, such as "English (US)". The <code>android:keyboardLayout</code> attribute refers to a <a href="http://source.android.com/tech/input/key-character-map-files.html"> key character map</a> resource that defines the keyboard layout. </p> */ ACTION_QUERY_KEYBOARD_LAYOUTS : "android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS", /** Metadata Key: Keyboard layout metadata associated with {@link #ACTION_QUERY_KEYBOARD_LAYOUTS}. <p> Specifies the resource id of a XML resource that describes the keyboard layouts that are provided by the application. </p> */ META_DATA_KEYBOARD_LAYOUTS : "android.hardware.input.metadata.KEYBOARD_LAYOUTS", /** Pointer Speed: The minimum (slowest) pointer speed (-7). @hide */ MIN_POINTER_SPEED : "-7", /** Pointer Speed: The maximum (fastest) pointer speed (7). @hide */ MAX_POINTER_SPEED : "7", /** Pointer Speed: The default pointer speed (0). @hide */ DEFAULT_POINTER_SPEED : "0", /** Input Event Injection Synchronization Mode: None. Never blocks. Injection is asynchronous and is assumed always to be successful. @hide */ INJECT_INPUT_EVENT_MODE_ASYNC : "0", /** Input Event Injection Synchronization Mode: Wait for result. Waits for previous events to be dispatched so that the input dispatcher can determine whether input event injection will be permitted based on the current input focus. Does not wait for the input event to finish being handled by the application. @hide */ INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT : "1", /** Input Event Injection Synchronization Mode: Wait for finish. Waits for the event to be delivered to the application and handled. @hide */ INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH : "2", /** Switch State: Unknown. The system has yet to report a valid value for the switch. @hide */ SWITCH_STATE_UNKNOWN : "-1", /** Switch State: Off. @hide */ SWITCH_STATE_OFF : "0", /** Switch State: On. @hide */ SWITCH_STATE_ON : "1", /**Gets an instance of the input manager. @return {Object {android.hardware.input.InputManager}} The input manager instance. @hide */ getInstance : function( ) {}, /**Gets information about the input device with the specified id. @param {Number} id The device id. @return {Object {android.view.InputDevice}} The input device or null if not found. */ getInputDevice : function( ) {}, /**Gets information about the input device with the specified descriptor. @param {String} descriptor The input device descriptor. @return {Object {android.view.InputDevice}} The input device or null if not found. @hide */ getInputDeviceByDescriptor : function( ) {}, /**Gets the ids of all input devices in the system. @return {Number} The input device ids. */ getInputDeviceIds : function( ) {}, /**Returns true if an input device is enabled. Should return true for most situations. Some system apps may disable an input device, for example to prevent unwanted touch events. @param {Number} id The input device Id. @hide */ isInputDeviceEnabled : function( ) {}, /**Enables an InputDevice. <p> Requires {@link android.Manifest.permissions.DISABLE_INPUT_DEVICE}. </p> @param {Number} id The input device Id. @hide */ enableInputDevice : function( ) {}, /**Disables an InputDevice. <p> Requires {@link android.Manifest.permissions.DISABLE_INPUT_DEVICE}. </p> @param {Number} id The input device Id. @hide */ disableInputDevice : function( ) {}, /**Registers an input device listener to receive notifications about when input devices are added, removed or changed. @param {Object {InputManager.InputDeviceListener}} listener The listener to register. @param {Object {Handler}} handler The handler on which the listener should be invoked, or null if the listener should be invoked on the calling thread's looper. @see #unregisterInputDeviceListener */ registerInputDeviceListener : function( ) {}, /**Unregisters an input device listener. @param {Object {InputManager.InputDeviceListener}} listener The listener to unregister. @see #registerInputDeviceListener */ unregisterInputDeviceListener : function( ) {}, /**Queries whether the device is in tablet mode. @return {Number} The tablet switch state which is one of {@link #SWITCH_STATE_UNKNOWN}, {@link #SWITCH_STATE_OFF} or {@link #SWITCH_STATE_ON}. @hide */ isInTabletMode : function( ) {}, /**Register a tablet mode changed listener. @param {Object {InputManager.OnTabletModeChangedListener}} listener The listener to register. @param {Object {Handler}} handler The handler on which the listener should be invoked, or null if the listener should be invoked on the calling thread's looper. @hide */ registerOnTabletModeChangedListener : function( ) {}, /**Unregister a tablet mode changed listener. @param {Object {InputManager.OnTabletModeChangedListener}} listener The listener to unregister. @hide */ unregisterOnTabletModeChangedListener : function( ) {}, /**Gets information about all supported keyboard layouts. <p> The input manager consults the built-in keyboard layouts as well as all keyboard layouts advertised by applications using a {@link #ACTION_QUERY_KEYBOARD_LAYOUTS} broadcast receiver. </p> @return {Object {android.hardware.input.KeyboardLayout}} A list of all supported keyboard layouts. @hide */ getKeyboardLayouts : function( ) {}, /**Gets information about all supported keyboard layouts appropriate for a specific input device. <p> The input manager consults the built-in keyboard layouts as well as all keyboard layouts advertised by applications using a {@link #ACTION_QUERY_KEYBOARD_LAYOUTS} broadcast receiver. </p> @return {Object {android.hardware.input.KeyboardLayout}} A list of all supported keyboard layouts for a specific input device. @hide */ getKeyboardLayoutsForInputDevice : function( ) {}, /**Gets the keyboard layout with the specified descriptor. @param {String} keyboardLayoutDescriptor The keyboard layout descriptor, as returned by {@link KeyboardLayout#getDescriptor()}. @return {Object {android.hardware.input.KeyboardLayout}} The keyboard layout, or null if it could not be loaded. @hide */ getKeyboardLayout : function( ) {}, /**Gets the current keyboard layout descriptor for the specified input device. @param {Object {InputDeviceIdentifier}} identifier Identifier for the input device @return {String} The keyboard layout descriptor, or null if no keyboard layout has been set. @hide */ getCurrentKeyboardLayoutForInputDevice : function( ) {}, /**Sets the current keyboard layout descriptor for the specified input device. <p> This method may have the side-effect of causing the input device in question to be reconfigured. </p> @param {Object {InputDeviceIdentifier}} identifier The identifier for the input device. @param {String} keyboardLayoutDescriptor The keyboard layout descriptor to use, must not be null. @hide */ setCurrentKeyboardLayoutForInputDevice : function( ) {}, /**Gets all keyboard layout descriptors that are enabled for the specified input device. @param {Object {InputDeviceIdentifier}} identifier The identifier for the input device. @return {String} The keyboard layout descriptors. @hide */ getEnabledKeyboardLayoutsForInputDevice : function( ) {}, /**Adds the keyboard layout descriptor for the specified input device. <p> This method may have the side-effect of causing the input device in question to be reconfigured. </p> @param {Object {InputDeviceIdentifier}} identifier The identifier for the input device. @param {String} keyboardLayoutDescriptor The descriptor of the keyboard layout to add. @hide */ addKeyboardLayoutForInputDevice : function( ) {}, /**Removes the keyboard layout descriptor for the specified input device. <p> This method may have the side-effect of causing the input device in question to be reconfigured. </p> @param {Object {InputDeviceIdentifier}} identifier The identifier for the input device. @param {String} keyboardLayoutDescriptor The descriptor of the keyboard layout to remove. @hide */ removeKeyboardLayoutForInputDevice : function( ) {}, /**Gets the TouchCalibration applied to the specified input device's coordinates. @param {String} inputDeviceDescriptor The input device descriptor. @return {Object {android.hardware.input.TouchCalibration}} The TouchCalibration currently assigned for use with the given input device. If none is set, an identity TouchCalibration is returned. @hide */ getTouchCalibration : function( ) {}, /**Sets the TouchCalibration to apply to the specified input device's coordinates. <p> This method may have the side-effect of causing the input device in question to be reconfigured. Requires {@link android.Manifest.permissions.SET_INPUT_CALIBRATION}. </p> @param {String} inputDeviceDescriptor The input device descriptor. @param {Number} calibration The calibration to be applied @hide */ setTouchCalibration : function( ) {}, /**Gets the mouse pointer speed. <p> Only returns the permanent mouse pointer speed. Ignores any temporary pointer speed set by {@link #tryPointerSpeed}. </p> @param {Object {Context}} context The application context. @return {Number} The pointer speed as a value between {@link #MIN_POINTER_SPEED} and {@link #MAX_POINTER_SPEED}, or the default value {@link #DEFAULT_POINTER_SPEED}. @hide */ getPointerSpeed : function( ) {}, /**Sets the mouse pointer speed. <p> Requires {@link android.Manifest.permissions.WRITE_SETTINGS}. </p> @param {Object {Context}} context The application context. @param {Number} speed The pointer speed as a value between {@link #MIN_POINTER_SPEED} and {@link #MAX_POINTER_SPEED}, or the default value {@link #DEFAULT_POINTER_SPEED}. @hide */ setPointerSpeed : function( ) {}, /**Changes the mouse pointer speed temporarily, but does not save the setting. <p> Requires {@link android.Manifest.permission.SET_POINTER_SPEED}. </p> @param {Number} speed The pointer speed as a value between {@link #MIN_POINTER_SPEED} and {@link #MAX_POINTER_SPEED}, or the default value {@link #DEFAULT_POINTER_SPEED}. @hide */ tryPointerSpeed : function( ) {}, /**Queries the framework about whether any physical keys exist on the any keyboard attached to the device that are capable of producing the given array of key codes. @param {Object {int[]}} keyCodes The array of key codes to query. @return {Boolean} A new array of the same size as the key codes array whose elements are set to true if at least one attached keyboard supports the corresponding key code at the same index in the key codes array. @hide */ deviceHasKeys : function( ) {}, /**Queries the framework about whether any physical keys exist on the any keyboard attached to the device that are capable of producing the given array of key codes. @param {Number} id The id of the device to query. @param {Object {int[]}} keyCodes The array of key codes to query. @return {Boolean} A new array of the same size as the key codes array whose elements are set to true if the given device could produce the corresponding key code at the same index in the key codes array. @hide */ deviceHasKeys : function( ) {}, /**Injects an input event into the event system on behalf of an application. The synchronization mode determines whether the method blocks while waiting for input injection to proceed. <p> Requires {@link android.Manifest.permission.INJECT_EVENTS} to inject into windows that are owned by other applications. </p><p> Make sure you correctly set the event time and input source of the event before calling this method. </p> @param {Object {InputEvent}} event The event to inject. @param {Number} mode The synchronization mode. One of: {@link #INJECT_INPUT_EVENT_MODE_ASYNC}, {@link #INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT}, or {@link #INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH}. @return {Boolean} True if input event injection succeeded. @hide */ injectInputEvent : function( ) {}, /**Changes the mouse pointer's icon shape into the specified id. @param {Number} iconId The id of the pointer graphic, as a value between {@link PointerIcon.TYPE_ARROW} and {@link PointerIcon.TYPE_GRABBING}. @hide */ setPointerIconType : function( ) {}, /** @hide */ setCustomPointerIcon : function( ) {}, /**Request or release pointer capture. <p> When in capturing mode, the pointer icon disappears and all mouse events are dispatched to the window which has requested the capture. Relative position changes are available through {@link MotionEvent#getX} and {@link MotionEvent#getY}. @param {Object {IBinder}} enable true when requesting pointer capture, false when releasing. @hide */ requestPointerCapture : function( ) {}, /**Monitor input on the specified display for gestures. @hide */ monitorGestureInput : function( ) {}, /**Gets a vibrator service associated with an input device, assuming it has one. @return {Object {android.os.Vibrator}} The vibrator, never null. @hide */ getInputDeviceVibrator : function( ) {}, };