2012-03-23 21:19:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* @addtogroup Input
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file input.h
|
|
|
|
*/
|
|
|
|
|
2012-03-23 21:19:36 +00:00
|
|
|
#ifndef _ANDROID_INPUT_H
|
|
|
|
#define _ANDROID_INPUT_H
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
*
|
|
|
|
* IMPORTANT NOTICE:
|
|
|
|
*
|
|
|
|
* This file is part of Android's set of stable system headers
|
|
|
|
* exposed by the Android NDK (Native Development Kit).
|
|
|
|
*
|
|
|
|
* Third-party source AND binary code relies on the definitions
|
|
|
|
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
|
|
|
*
|
|
|
|
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
|
|
|
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
|
|
|
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
|
|
|
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structures and functions to receive and process input events in
|
|
|
|
* native code.
|
|
|
|
*
|
|
|
|
* NOTE: These functions MUST be implemented by /system/lib/libui.so
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <android/keycodes.h>
|
|
|
|
#include <android/looper.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Key states (may be returned by queries about the current state of a
|
|
|
|
* particular key code, scan code or switch).
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The key state is unknown or the requested key itself is not supported. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_STATE_UNKNOWN = -1,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The key is up. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_STATE_UP = 0,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The key is down. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_STATE_DOWN = 1,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The key is down but is a virtual key press that is being emulated by the system. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_STATE_VIRTUAL = 2
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Meta key / modifer state.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** No meta keys are pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_NONE = 0,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether one of the ALT meta keys is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_ALT_ON = 0x02,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the left ALT meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_ALT_LEFT_ON = 0x10,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the right ALT meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_ALT_RIGHT_ON = 0x20,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether one of the SHIFT meta keys is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_SHIFT_ON = 0x01,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the left SHIFT meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_SHIFT_LEFT_ON = 0x40,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the right SHIFT meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_SHIFT_RIGHT_ON = 0x80,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the SYM meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_SYM_ON = 0x04,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the FUNCTION meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_FUNCTION_ON = 0x08,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether one of the CTRL meta keys is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_CTRL_ON = 0x1000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the left CTRL meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_CTRL_LEFT_ON = 0x2000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the right CTRL meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_CTRL_RIGHT_ON = 0x4000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether one of the META meta keys is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_META_ON = 0x10000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the left META meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_META_LEFT_ON = 0x20000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the right META meta key is pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_META_RIGHT_ON = 0x40000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the CAPS LOCK meta key is on. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_CAPS_LOCK_ON = 0x100000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the NUM LOCK meta key is on. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_NUM_LOCK_ON = 0x200000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is used to check whether the SCROLL LOCK meta key is on. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMETA_SCROLL_LOCK_ON = 0x400000,
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
struct AInputEvent;
|
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Input events.
|
|
|
|
*
|
|
|
|
* Input events are opaque structures. Use the provided accessors functions to
|
|
|
|
* read their properties.
|
|
|
|
*/
|
|
|
|
typedef struct AInputEvent AInputEvent;
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Input event types.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Indicates that the input event is a key event. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_EVENT_TYPE_KEY = 1,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Indicates that the input event is a motion event. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_EVENT_TYPE_MOTION = 2
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Key event actions.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The key has been pressed down. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_ACTION_DOWN = 0,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The key has been released. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_ACTION_UP = 1,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Multiple duplicate key events have occurred in a row, or a
|
|
|
|
* complex string is being delivered. The repeat_count property
|
|
|
|
* of the key event contains the number of times the given key
|
|
|
|
* code should be executed.
|
2012-03-23 21:19:36 +00:00
|
|
|
*/
|
|
|
|
AKEY_EVENT_ACTION_MULTIPLE = 2
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Key event flags.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is set if the device woke because of this key event. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_WOKE_HERE = 0x1,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is set if the key event was generated by a software keyboard. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** This mask is set if we don't want the key event to cause us to leave touch mode. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* This mask is set if an event was known to come from a trusted
|
|
|
|
* part of the system. That is, the event is known to come from
|
|
|
|
* the user, and could not have been spoofed by a third party
|
|
|
|
* component.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* This mask is used for compatibility, to identify enter keys that are
|
2012-03-23 21:19:36 +00:00
|
|
|
* coming from an IME whose enter key has been auto-labelled "next" or
|
|
|
|
* "done". This allows TextView to dispatch these as normal enter keys
|
|
|
|
* for old applications, but still do the appropriate action when
|
2015-03-28 00:15:43 +00:00
|
|
|
* receiving them.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* When associated with up key events, this indicates that the key press
|
2012-03-23 21:19:36 +00:00
|
|
|
* has been canceled. Typically this is used with virtual touch screen
|
|
|
|
* keys, where the user can slide from the virtual key area on to the
|
|
|
|
* display: in that case, the application will receive a canceled up
|
|
|
|
* event and should not perform the action normally associated with the
|
|
|
|
* key. Note that for this to work, the application can not perform an
|
|
|
|
* action for a key until it receives an up or the long press timeout has
|
2015-03-28 00:15:43 +00:00
|
|
|
* expired.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_CANCELED = 0x20,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* This key event was generated by a virtual (on-screen) hard key area.
|
2012-03-23 21:19:36 +00:00
|
|
|
* Typically this is an area of the touchscreen, outside of the regular
|
2015-03-28 00:15:43 +00:00
|
|
|
* display, dedicated to "hardware" buttons.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* This flag is set for the first key repeat that occurs after the
|
|
|
|
* long press timeout.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_LONG_PRESS = 0x80,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
|
|
|
|
* press action was executed while it was down.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
|
2012-03-23 21:19:36 +00:00
|
|
|
* tracked from its initial down. That is, somebody requested that tracking
|
|
|
|
* started on the key down and a long press has not caused
|
2015-03-28 00:15:43 +00:00
|
|
|
* the tracking to be canceled.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_TRACKING = 0x200,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Set when a key event has been synthesized to implement default behavior
|
2012-03-23 21:19:36 +00:00
|
|
|
* for an event that the application did not handle.
|
|
|
|
* Fallback key events are generated by unhandled trackball motions
|
|
|
|
* (to emulate a directional keypad) and by certain unhandled key presses
|
|
|
|
* that are declared in the key map (such as special function numeric keypad
|
2015-03-28 00:15:43 +00:00
|
|
|
* keys when numlock is off).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AKEY_EVENT_FLAG_FALLBACK = 0x400,
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Bit shift for the action bits holding the pointer index as
|
2012-03-23 21:19:36 +00:00
|
|
|
* defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
|
|
|
|
*/
|
|
|
|
#define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Motion event actions */
|
2012-03-23 21:19:36 +00:00
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Bit mask of the parts of the action code that are the action itself. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_ACTION_MASK = 0xff,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Bits in the action code that represent a pointer index, used with
|
2012-03-23 21:19:36 +00:00
|
|
|
* AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting
|
|
|
|
* down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
|
|
|
|
* index where the data for the pointer going up or down can be found.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** A pressed gesture has started, the motion contains the initial starting location. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_ACTION_DOWN = 0,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* A pressed gesture has finished, the motion contains the final release location
|
2012-03-23 21:19:36 +00:00
|
|
|
* as well as any intermediate points since the last down or move event.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_UP = 1,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
|
2012-03-23 21:19:36 +00:00
|
|
|
* AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as
|
|
|
|
* any intermediate points since the last down or move event.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_MOVE = 2,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* The current gesture has been aborted.
|
2012-03-23 21:19:36 +00:00
|
|
|
* You will not receive any more points in it. You should treat this as
|
|
|
|
* an up event, but not perform any action that you normally would.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_CANCEL = 3,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* A movement has happened outside of the normal bounds of the UI element.
|
2012-03-23 21:19:36 +00:00
|
|
|
* This does not provide a full gesture, but only the initial location of the movement/touch.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_OUTSIDE = 4,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* A non-primary pointer has gone down.
|
2012-03-23 21:19:36 +00:00
|
|
|
* The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* A non-primary pointer has gone up.
|
2012-03-23 21:19:36 +00:00
|
|
|
* The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_POINTER_UP = 6,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
|
2012-03-23 21:19:36 +00:00
|
|
|
* The motion contains the most recent point, as well as any intermediate points since
|
|
|
|
* the last hover move event.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* The motion event contains relative vertical and/or horizontal scroll offsets.
|
2012-03-23 21:19:36 +00:00
|
|
|
* Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
|
|
|
|
* and AMOTION_EVENT_AXIS_HSCROLL.
|
|
|
|
* The pointer may or may not be down when this event is dispatched.
|
|
|
|
* This action is always delivered to the winder under the pointer, which
|
|
|
|
* may not be the window currently touched.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_ACTION_SCROLL = 8,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The pointer is not down but has entered the boundaries of a window or view. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_ACTION_HOVER_ENTER = 9,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** The pointer is not down but has exited the boundaries of a window or view. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_ACTION_HOVER_EXIT = 10,
|
2015-05-14 13:48:03 +00:00
|
|
|
|
|
|
|
/* One or more buttons have been pressed. */
|
|
|
|
AMOTION_EVENT_ACTION_BUTTON_PRESS = 11,
|
|
|
|
|
|
|
|
/* One or more buttons have been released. */
|
|
|
|
AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12,
|
2012-03-23 21:19:36 +00:00
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Motion event flags.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* This flag indicates that the window that received this motion event is partly
|
2012-03-23 21:19:36 +00:00
|
|
|
* or wholly obscured by another visible window above it. This flag is set to true
|
|
|
|
* even if the event did not directly pass through the obscured area.
|
|
|
|
* A security sensitive application can check this flag to identify situations in which
|
|
|
|
* a malicious application may have covered up part of its content for the purpose
|
|
|
|
* of misleading the user or hijacking touches. An appropriate response might be
|
|
|
|
* to drop the suspect touches or to take additional precautions to confirm the user's
|
|
|
|
* actual intent.
|
|
|
|
*/
|
|
|
|
AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1,
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Motion event edge touch flags.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** No edges intersected. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_EDGE_FLAG_NONE = 0,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Flag indicating the motion event intersected the top edge of the screen. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_EDGE_FLAG_TOP = 0x01,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Flag indicating the motion event intersected the bottom edge of the screen. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Flag indicating the motion event intersected the left edge of the screen. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Flag indicating the motion event intersected the right edge of the screen. */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Constants that identify each individual axis of a motion event.
|
2015-03-28 00:15:43 +00:00
|
|
|
* @anchor AMOTION_EVENT_AXIS
|
2012-03-23 21:19:36 +00:00
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: X axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen, reports the absolute X screen position of the center of
|
|
|
|
* the touch contact area. The units are display pixels.
|
|
|
|
* - For a touch pad, reports the absolute X surface position of the center of the touch
|
|
|
|
* contact area. The units are device-dependent.
|
|
|
|
* - For a mouse, reports the absolute X screen position of the mouse pointer.
|
|
|
|
* The units are display pixels.
|
|
|
|
* - For a trackball, reports the relative horizontal displacement of the trackball.
|
|
|
|
* The value is normalized to a range from -1.0 (left) to 1.0 (right).
|
|
|
|
* - For a joystick, reports the absolute X position of the joystick.
|
|
|
|
* The value is normalized to a range from -1.0 (left) to 1.0 (right).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_X = 0,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Y axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen, reports the absolute Y screen position of the center of
|
|
|
|
* the touch contact area. The units are display pixels.
|
|
|
|
* - For a touch pad, reports the absolute Y surface position of the center of the touch
|
|
|
|
* contact area. The units are device-dependent.
|
|
|
|
* - For a mouse, reports the absolute Y screen position of the mouse pointer.
|
|
|
|
* The units are display pixels.
|
|
|
|
* - For a trackball, reports the relative vertical displacement of the trackball.
|
|
|
|
* The value is normalized to a range from -1.0 (up) to 1.0 (down).
|
|
|
|
* - For a joystick, reports the absolute Y position of the joystick.
|
|
|
|
* The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_Y = 1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Pressure axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen or touch pad, reports the approximate pressure applied to the surface
|
|
|
|
* by a finger or other tool. The value is normalized to a range from
|
|
|
|
* 0 (no pressure at all) to 1 (normal pressure), although values higher than 1
|
|
|
|
* may be generated depending on the calibration of the input device.
|
|
|
|
* - For a trackball, the value is set to 1 if the trackball button is pressed
|
|
|
|
* or 0 otherwise.
|
|
|
|
* - For a mouse, the value is set to 1 if the primary mouse button is pressed
|
|
|
|
* or 0 otherwise.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_PRESSURE = 2,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Size axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen or touch pad, reports the approximate size of the contact area in
|
|
|
|
* relation to the maximum detectable size for the device. The value is normalized
|
|
|
|
* to a range from 0 (smallest detectable size) to 1 (largest detectable size),
|
|
|
|
* although it is not a linear scale. This value is of limited use.
|
|
|
|
* To obtain calibrated size information, see
|
|
|
|
* {@link AMOTION_EVENT_AXIS_TOUCH_MAJOR} or {@link AMOTION_EVENT_AXIS_TOOL_MAJOR}.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_SIZE = 3,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: TouchMajor axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen, reports the length of the major axis of an ellipse that
|
|
|
|
* represents the touch area at the point of contact.
|
|
|
|
* The units are display pixels.
|
|
|
|
* - For a touch pad, reports the length of the major axis of an ellipse that
|
|
|
|
* represents the touch area at the point of contact.
|
|
|
|
* The units are device-dependent.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: TouchMinor axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen, reports the length of the minor axis of an ellipse that
|
|
|
|
* represents the touch area at the point of contact.
|
|
|
|
* The units are display pixels.
|
|
|
|
* - For a touch pad, reports the length of the minor axis of an ellipse that
|
|
|
|
* represents the touch area at the point of contact.
|
|
|
|
* The units are device-dependent.
|
|
|
|
*
|
|
|
|
* When the touch is circular, the major and minor axis lengths will be equal to one another.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_TOUCH_MINOR = 5,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: ToolMajor axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen, reports the length of the major axis of an ellipse that
|
|
|
|
* represents the size of the approaching finger or tool used to make contact.
|
|
|
|
* - For a touch pad, reports the length of the major axis of an ellipse that
|
|
|
|
* represents the size of the approaching finger or tool used to make contact.
|
|
|
|
* The units are device-dependent.
|
|
|
|
*
|
|
|
|
* When the touch is circular, the major and minor axis lengths will be equal to one another.
|
|
|
|
*
|
|
|
|
* The tool size may be larger than the touch size since the tool may not be fully
|
|
|
|
* in contact with the touch sensor.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_TOOL_MAJOR = 6,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: ToolMinor axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen, reports the length of the minor axis of an ellipse that
|
|
|
|
* represents the size of the approaching finger or tool used to make contact.
|
|
|
|
* - For a touch pad, reports the length of the minor axis of an ellipse that
|
|
|
|
* represents the size of the approaching finger or tool used to make contact.
|
|
|
|
* The units are device-dependent.
|
|
|
|
*
|
|
|
|
* When the touch is circular, the major and minor axis lengths will be equal to one another.
|
|
|
|
*
|
|
|
|
* The tool size may be larger than the touch size since the tool may not be fully
|
|
|
|
* in contact with the touch sensor.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_TOOL_MINOR = 7,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Orientation axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a touch screen or touch pad, reports the orientation of the finger
|
|
|
|
* or tool in radians relative to the vertical plane of the device.
|
|
|
|
* An angle of 0 radians indicates that the major axis of contact is oriented
|
|
|
|
* upwards, is perfectly circular or is of unknown orientation. A positive angle
|
|
|
|
* indicates that the major axis of contact is oriented to the right. A negative angle
|
|
|
|
* indicates that the major axis of contact is oriented to the left.
|
|
|
|
* The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
|
|
|
|
* (finger pointing fully right).
|
|
|
|
* - For a stylus, the orientation indicates the direction in which the stylus
|
|
|
|
* is pointing in relation to the vertical axis of the current orientation of the screen.
|
|
|
|
* The range is from -PI radians to PI radians, where 0 is pointing up,
|
|
|
|
* -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians
|
|
|
|
* is pointing right. See also {@link AMOTION_EVENT_AXIS_TILT}.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_ORIENTATION = 8,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Vertical Scroll axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a mouse, reports the relative movement of the vertical scroll wheel.
|
|
|
|
* The value is normalized to a range from -1.0 (down) to 1.0 (up).
|
|
|
|
*
|
|
|
|
* This axis should be used to scroll views vertically.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_VSCROLL = 9,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Horizontal Scroll axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a mouse, reports the relative movement of the horizontal scroll wheel.
|
|
|
|
* The value is normalized to a range from -1.0 (left) to 1.0 (right).
|
|
|
|
*
|
|
|
|
* This axis should be used to scroll views horizontally.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_HSCROLL = 10,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Z axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute Z position of the joystick.
|
|
|
|
* The value is normalized to a range from -1.0 (high) to 1.0 (low).
|
|
|
|
* <em>On game pads with two analog joysticks, this axis is often reinterpreted
|
|
|
|
* to report the absolute X position of the second joystick instead.</em>
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_Z = 11,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: X Rotation axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute rotation angle about the X axis.
|
|
|
|
* The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_RX = 12,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Y Rotation axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute rotation angle about the Y axis.
|
|
|
|
* The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_RY = 13,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Z Rotation axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute rotation angle about the Z axis.
|
|
|
|
* The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
|
|
|
|
* On game pads with two analog joysticks, this axis is often reinterpreted
|
|
|
|
* to report the absolute Y position of the second joystick instead.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_RZ = 14,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Hat X axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute X position of the directional hat control.
|
|
|
|
* The value is normalized to a range from -1.0 (left) to 1.0 (right).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_HAT_X = 15,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Hat Y axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute Y position of the directional hat control.
|
|
|
|
* The value is normalized to a range from -1.0 (up) to 1.0 (down).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_HAT_Y = 16,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Left Trigger axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute position of the left trigger control.
|
|
|
|
* The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_LTRIGGER = 17,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Right Trigger axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute position of the right trigger control.
|
|
|
|
* The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_RTRIGGER = 18,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Throttle axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute position of the throttle control.
|
|
|
|
* The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_THROTTLE = 19,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Rudder axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute position of the rudder control.
|
|
|
|
* The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_RUDDER = 20,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Wheel axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute position of the steering wheel control.
|
|
|
|
* The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_WHEEL = 21,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Gas axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute position of the gas (accelerator) control.
|
|
|
|
* The value is normalized to a range from 0.0 (no acceleration)
|
|
|
|
* to 1.0 (maximum acceleration).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GAS = 22,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Brake axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a joystick, reports the absolute position of the brake control.
|
|
|
|
* The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_BRAKE = 23,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Distance axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a stylus, reports the distance of the stylus from the screen.
|
|
|
|
* A value of 0.0 indicates direct contact and larger values indicate increasing
|
|
|
|
* distance from the surface.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_DISTANCE = 24,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Tilt axis of a motion event.
|
|
|
|
*
|
|
|
|
* - For a stylus, reports the tilt angle of the stylus in radians where
|
|
|
|
* 0 radians indicates that the stylus is being held perpendicular to the
|
|
|
|
* surface, and PI/2 radians indicates that the stylus is being held flat
|
|
|
|
* against the surface.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_TILT = 25,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 1 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_1 = 32,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 2 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_2 = 33,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 3 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_3 = 34,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 4 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_4 = 35,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 5 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_5 = 36,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 6 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_6 = 37,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 7 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_7 = 38,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 8 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_8 = 39,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 9 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_9 = 40,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 10 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_10 = 41,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 11 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_11 = 42,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 12 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_12 = 43,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 13 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_13 = 44,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 14 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_14 = 45,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 15 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_15 = 46,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Axis constant: Generic 16 axis of a motion event.
|
|
|
|
* The interpretation of a generic axis is device-specific.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_AXIS_GENERIC_16 = 47,
|
|
|
|
|
|
|
|
// NOTE: If you add a new axis here you must also add it to several other files.
|
|
|
|
// Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Constants that identify buttons that are associated with motion events.
|
|
|
|
* Refer to the documentation on the MotionEvent class for descriptions of each button.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** primary */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** secondary */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** tertiary */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** back */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_BUTTON_BACK = 1 << 3,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** forward */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
|
2015-05-14 13:48:03 +00:00
|
|
|
AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
|
|
|
|
AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6,
|
2012-03-23 21:19:36 +00:00
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Constants that identify tool types.
|
|
|
|
* Refer to the documentation on the MotionEvent class for descriptions of each tool type.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** unknown */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** finger */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_TOOL_TYPE_FINGER = 1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** stylus */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_TOOL_TYPE_STYLUS = 2,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** mouse */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_TOOL_TYPE_MOUSE = 3,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** eraser */
|
2012-03-23 21:19:36 +00:00
|
|
|
AMOTION_EVENT_TOOL_TYPE_ERASER = 4,
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Input source masks.
|
2012-03-23 21:19:36 +00:00
|
|
|
*
|
|
|
|
* Refer to the documentation on android.view.InputDevice for more details about input sources
|
|
|
|
* and their correct interpretation.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** mask */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_CLASS_MASK = 0x000000ff,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** none */
|
2013-03-11 21:20:14 +00:00
|
|
|
AINPUT_SOURCE_CLASS_NONE = 0x00000000,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** button */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** pointer */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_CLASS_POINTER = 0x00000002,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** navigation */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** position */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_CLASS_POSITION = 0x00000008,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** joystick */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010,
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Input sources.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** unknown */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_UNKNOWN = 0x00000000,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** keyboard */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** dpad */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** gamepad */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** touchscreen */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** mouse */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** stylus */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER,
|
2015-06-23 18:04:31 +00:00
|
|
|
/** bluetooth stylus */
|
2015-06-12 14:25:08 +00:00
|
|
|
AINPUT_SOURCE_BLUETOOTH_STYLUS = 0x00008000 | AINPUT_SOURCE_STYLUS,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** trackball */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** touchpad */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** navigation */
|
2013-03-11 21:20:14 +00:00
|
|
|
AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | AINPUT_SOURCE_CLASS_NONE,
|
2015-11-05 01:41:42 +00:00
|
|
|
/** gesture sensor (?) */
|
2013-10-08 22:07:21 +00:00
|
|
|
AINPUT_SOURCE_GESTURE_SENSOR = 0x00400000 | AINPUT_SOURCE_CLASS_NONE,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** joystick */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK,
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** any */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_SOURCE_ANY = 0xffffff00,
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Keyboard types.
|
|
|
|
*
|
|
|
|
* Refer to the documentation on android.view.InputDevice for more details.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** none */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_KEYBOARD_TYPE_NONE = 0,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** non alphabetic */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** alphabetic */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2,
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Constants used to retrieve information about the range of motion for a particular
|
|
|
|
* coordinate of a motion event.
|
|
|
|
*
|
|
|
|
* Refer to the documentation on android.view.InputDevice for more details about input sources
|
|
|
|
* and their correct interpretation.
|
|
|
|
*
|
2015-03-28 00:15:43 +00:00
|
|
|
* @deprecated These constants are deprecated. Use {@link AMOTION_EVENT_AXIS AMOTION_EVENT_AXIS_*} constants instead.
|
2012-03-23 21:19:36 +00:00
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** x */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** y */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** pressure */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** size */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** touch major */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** touch minor */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** tool major */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** tool minor */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** orientation */
|
2012-03-23 21:19:36 +00:00
|
|
|
AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION,
|
2015-03-28 00:15:43 +00:00
|
|
|
};
|
2012-03-23 21:19:36 +00:00
|
|
|
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Input event accessors.
|
|
|
|
*
|
|
|
|
* Note that most functions can only be used on input events that are of a given type.
|
|
|
|
* Calling these functions on input events of other types will yield undefined behavior.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*** Accessors for all input events. ***/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the input event type. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AInputEvent_getType(const AInputEvent* event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the id for the device that an input event came from.
|
2012-03-23 21:19:36 +00:00
|
|
|
*
|
|
|
|
* Input events can be generated by multiple different input devices.
|
|
|
|
* Use the input device id to obtain information about the input
|
|
|
|
* device that was responsible for generating a particular event.
|
|
|
|
*
|
|
|
|
* An input device id of 0 indicates that the event didn't come from a physical device;
|
|
|
|
* other numbers are arbitrary and you shouldn't depend on the values.
|
|
|
|
* Use the provided input device query API to obtain information about input devices.
|
|
|
|
*/
|
|
|
|
int32_t AInputEvent_getDeviceId(const AInputEvent* event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the input event source. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AInputEvent_getSource(const AInputEvent* event);
|
|
|
|
|
|
|
|
/*** Accessors for key events only. ***/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the key event action. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AKeyEvent_getAction(const AInputEvent* key_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the key event flags. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AKeyEvent_getFlags(const AInputEvent* key_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the key code of the key event.
|
|
|
|
* This is the physical key that was pressed, not the Unicode character.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the hardware key id of this key event.
|
|
|
|
* These values are not reliable and vary from device to device.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AKeyEvent_getScanCode(const AInputEvent* key_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the meta key state. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AKeyEvent_getMetaState(const AInputEvent* key_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the repeat count of the event.
|
2012-03-23 21:19:36 +00:00
|
|
|
* For both key up an key down events, this is the number of times the key has
|
|
|
|
* repeated with the first down starting at 0 and counting up from there. For
|
2015-03-28 00:15:43 +00:00
|
|
|
* multiple key events, this is the number of down/up pairs that have occurred.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the time of the most recent key down event, in the
|
2012-03-23 21:19:36 +00:00
|
|
|
* java.lang.System.nanoTime() time base. If this is a down event,
|
|
|
|
* this will be the same as eventTime.
|
|
|
|
* Note that when chording keys, this value is the down time of the most recently
|
2015-03-28 00:15:43 +00:00
|
|
|
* pressed key, which may not be the same physical key of this event.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int64_t AKeyEvent_getDownTime(const AInputEvent* key_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the time this event occurred, in the
|
|
|
|
* java.lang.System.nanoTime() time base.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int64_t AKeyEvent_getEventTime(const AInputEvent* key_event);
|
|
|
|
|
|
|
|
/*** Accessors for motion events only. ***/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the combined motion event action code and pointer index. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AMotionEvent_getAction(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the motion event flags. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AMotionEvent_getFlags(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the state of any meta / modifier keys that were in effect when the
|
|
|
|
* event was generated.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the button state of all buttons that are pressed. */
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get a bitfield indicating which edges, if any, were touched by this motion event.
|
2012-03-23 21:19:36 +00:00
|
|
|
* For touch events, clients can use this to determine if the user's finger was
|
2015-03-28 00:15:43 +00:00
|
|
|
* touching the edge of the display.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the time when the user originally pressed down to start a stream of
|
|
|
|
* position events, in the java.lang.System.nanoTime() time base.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the time when this specific event was generated,
|
|
|
|
* in the java.lang.System.nanoTime() time base.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the X coordinate offset.
|
2012-03-23 21:19:36 +00:00
|
|
|
* For touch events on the screen, this is the delta that was added to the raw
|
|
|
|
* screen coordinates to adjust for the absolute position of the containing windows
|
2015-03-28 00:15:43 +00:00
|
|
|
* and views.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getXOffset(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the Y coordinate offset.
|
2012-03-23 21:19:36 +00:00
|
|
|
* For touch events on the screen, this is the delta that was added to the raw
|
|
|
|
* screen coordinates to adjust for the absolute position of the containing windows
|
2015-03-28 00:15:43 +00:00
|
|
|
* and views.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getYOffset(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the precision of the X coordinates being reported.
|
2012-03-23 21:19:36 +00:00
|
|
|
* You can multiply this number with an X coordinate sample to find the
|
2015-03-28 00:15:43 +00:00
|
|
|
* actual hardware value of the X coordinate.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getXPrecision(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the precision of the Y coordinates being reported.
|
2012-03-23 21:19:36 +00:00
|
|
|
* You can multiply this number with a Y coordinate sample to find the
|
2015-03-28 00:15:43 +00:00
|
|
|
* actual hardware value of the Y coordinate.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getYPrecision(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the number of pointers of data contained in this event.
|
|
|
|
* Always >= 1.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the pointer identifier associated with a particular pointer
|
2012-03-23 21:19:36 +00:00
|
|
|
* data index in this event. The identifier tells you the actual pointer
|
|
|
|
* number associated with the data, accounting for individual pointers
|
2015-03-28 00:15:43 +00:00
|
|
|
* going up and down since the start of the current gesture.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the tool type of a pointer for the given pointer index.
|
2012-03-23 21:19:36 +00:00
|
|
|
* The tool type indicates the type of tool used to make contact such as a
|
2015-03-28 00:15:43 +00:00
|
|
|
* finger or stylus, if known.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the original raw X coordinate of this event.
|
2012-03-23 21:19:36 +00:00
|
|
|
* For touch events on the screen, this is the original location of the event
|
|
|
|
* on the screen, before it had been adjusted for the containing window
|
2015-03-28 00:15:43 +00:00
|
|
|
* and views.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the original raw X coordinate of this event.
|
2012-03-23 21:19:36 +00:00
|
|
|
* For touch events on the screen, this is the original location of the event
|
|
|
|
* on the screen, before it had been adjusted for the containing window
|
2015-03-28 00:15:43 +00:00
|
|
|
* and views.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current X coordinate of this event for the given pointer index.
|
2012-03-23 21:19:36 +00:00
|
|
|
* Whole numbers are pixels; the value may have a fraction for input devices
|
2015-03-28 00:15:43 +00:00
|
|
|
* that are sub-pixel precise.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current Y coordinate of this event for the given pointer index.
|
2012-03-23 21:19:36 +00:00
|
|
|
* Whole numbers are pixels; the value may have a fraction for input devices
|
2015-03-28 00:15:43 +00:00
|
|
|
* that are sub-pixel precise.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current pressure of this event for the given pointer index.
|
2012-03-23 21:19:36 +00:00
|
|
|
* The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
|
|
|
|
* although values higher than 1 may be generated depending on the calibration of
|
2015-03-28 00:15:43 +00:00
|
|
|
* the input device.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current scaled value of the approximate size for the given pointer index.
|
2012-03-23 21:19:36 +00:00
|
|
|
* This represents some approximation of the area of the screen being
|
|
|
|
* pressed; the actual value in pixels corresponding to the
|
|
|
|
* touch is normalized with the device specific range of values
|
|
|
|
* and scaled to a value between 0 and 1. The value of size can be used to
|
2015-03-28 00:15:43 +00:00
|
|
|
* determine fat touch events.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current length of the major axis of an ellipse that describes the touch area
|
|
|
|
* at the point of contact for the given pointer index.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current length of the minor axis of an ellipse that describes the touch area
|
|
|
|
* at the point of contact for the given pointer index.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current length of the major axis of an ellipse that describes the size
|
2012-03-23 21:19:36 +00:00
|
|
|
* of the approaching tool for the given pointer index.
|
|
|
|
* The tool area represents the estimated size of the finger or pen that is
|
2015-03-28 00:15:43 +00:00
|
|
|
* touching the device independent of its actual touch area at the point of contact.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current length of the minor axis of an ellipse that describes the size
|
2012-03-23 21:19:36 +00:00
|
|
|
* of the approaching tool for the given pointer index.
|
|
|
|
* The tool area represents the estimated size of the finger or pen that is
|
2015-03-28 00:15:43 +00:00
|
|
|
* touching the device independent of its actual touch area at the point of contact.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current orientation of the touch area and tool area in radians clockwise from
|
2012-03-23 21:19:36 +00:00
|
|
|
* vertical for the given pointer index.
|
|
|
|
* An angle of 0 degrees indicates that the major axis of contact is oriented
|
|
|
|
* upwards, is perfectly circular or is of unknown orientation. A positive angle
|
|
|
|
* indicates that the major axis of contact is oriented to the right. A negative angle
|
|
|
|
* indicates that the major axis of contact is oriented to the left.
|
|
|
|
* The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
|
2015-03-28 00:15:43 +00:00
|
|
|
* (finger pointing fully right).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Get the value of the request axis for the given pointer index. */
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getAxisValue(const AInputEvent* motion_event,
|
|
|
|
int32_t axis, size_t pointer_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the number of historical points in this event. These are movements that
|
2012-03-23 21:19:36 +00:00
|
|
|
* have occurred between this event and the previous event. This only applies
|
|
|
|
* to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
|
2015-03-28 00:15:43 +00:00
|
|
|
* Historical samples are indexed from oldest to newest.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the time that a historical movement occurred between this event and
|
|
|
|
* the previous event, in the java.lang.System.nanoTime() time base.
|
|
|
|
*/
|
2013-05-27 04:26:04 +00:00
|
|
|
int64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event,
|
2012-03-23 21:19:36 +00:00
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical raw X coordinate of this event for the given pointer index that
|
2012-03-23 21:19:36 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* For touch events on the screen, this is the original location of the event
|
|
|
|
* on the screen, before it had been adjusted for the containing window
|
|
|
|
* and views.
|
|
|
|
* Whole numbers are pixels; the value may have a fraction for input devices
|
2015-03-28 00:15:43 +00:00
|
|
|
* that are sub-pixel precise.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index,
|
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical raw Y coordinate of this event for the given pointer index that
|
2012-03-23 21:19:36 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* For touch events on the screen, this is the original location of the event
|
|
|
|
* on the screen, before it had been adjusted for the containing window
|
|
|
|
* and views.
|
|
|
|
* Whole numbers are pixels; the value may have a fraction for input devices
|
2015-03-28 00:15:43 +00:00
|
|
|
* that are sub-pixel precise.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index,
|
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical X coordinate of this event for the given pointer index that
|
2012-03-23 21:19:36 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* Whole numbers are pixels; the value may have a fraction for input devices
|
2015-03-28 00:15:43 +00:00
|
|
|
* that are sub-pixel precise.
|
|
|
|
*/
|
2013-05-27 04:26:04 +00:00
|
|
|
float AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index,
|
2012-03-23 21:19:36 +00:00
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical Y coordinate of this event for the given pointer index that
|
2012-03-23 21:19:36 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* Whole numbers are pixels; the value may have a fraction for input devices
|
2015-03-28 00:15:43 +00:00
|
|
|
* that are sub-pixel precise.
|
|
|
|
*/
|
2013-05-27 04:26:04 +00:00
|
|
|
float AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index,
|
2012-03-23 21:19:36 +00:00
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical pressure of this event for the given pointer index that
|
2012-03-23 21:19:36 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
|
|
|
|
* although values higher than 1 may be generated depending on the calibration of
|
2015-03-28 00:15:43 +00:00
|
|
|
* the input device.
|
|
|
|
*/
|
2013-05-27 04:26:04 +00:00
|
|
|
float AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index,
|
2012-03-23 21:19:36 +00:00
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the current scaled value of the approximate size for the given pointer index that
|
2012-03-23 21:19:36 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* This represents some approximation of the area of the screen being
|
|
|
|
* pressed; the actual value in pixels corresponding to the
|
|
|
|
* touch is normalized with the device specific range of values
|
|
|
|
* and scaled to a value between 0 and 1. The value of size can be used to
|
2015-03-28 00:15:43 +00:00
|
|
|
* determine fat touch events.
|
|
|
|
*/
|
2013-05-27 04:26:04 +00:00
|
|
|
float AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index,
|
2012-03-23 21:19:36 +00:00
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical length of the major axis of an ellipse that describes the touch area
|
2012-03-23 21:19:36 +00:00
|
|
|
* at the point of contact for the given pointer index that
|
2015-03-28 00:15:43 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index,
|
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical length of the minor axis of an ellipse that describes the touch area
|
2012-03-23 21:19:36 +00:00
|
|
|
* at the point of contact for the given pointer index that
|
2015-03-28 00:15:43 +00:00
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index,
|
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical length of the major axis of an ellipse that describes the size
|
2012-03-23 21:19:36 +00:00
|
|
|
* of the approaching tool for the given pointer index that
|
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* The tool area represents the estimated size of the finger or pen that is
|
2015-03-28 00:15:43 +00:00
|
|
|
* touching the device independent of its actual touch area at the point of contact.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index,
|
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical length of the minor axis of an ellipse that describes the size
|
2012-03-23 21:19:36 +00:00
|
|
|
* of the approaching tool for the given pointer index that
|
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* The tool area represents the estimated size of the finger or pen that is
|
2015-03-28 00:15:43 +00:00
|
|
|
* touching the device independent of its actual touch area at the point of contact.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index,
|
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical orientation of the touch area and tool area in radians clockwise from
|
2012-03-23 21:19:36 +00:00
|
|
|
* vertical for the given pointer index that
|
|
|
|
* occurred between this event and the previous motion event.
|
|
|
|
* An angle of 0 degrees indicates that the major axis of contact is oriented
|
|
|
|
* upwards, is perfectly circular or is of unknown orientation. A positive angle
|
|
|
|
* indicates that the major axis of contact is oriented to the right. A negative angle
|
|
|
|
* indicates that the major axis of contact is oriented to the left.
|
|
|
|
* The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
|
2015-03-28 00:15:43 +00:00
|
|
|
* (finger pointing fully right).
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index,
|
|
|
|
size_t history_index);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Get the historical value of the request axis for the given pointer index
|
|
|
|
* that occurred between this event and the previous motion event.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
|
|
|
|
int32_t axis, size_t pointer_index, size_t history_index);
|
|
|
|
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
struct AInputQueue;
|
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Input queue
|
|
|
|
*
|
|
|
|
* An input queue is the facility through which you retrieve input
|
|
|
|
* events.
|
|
|
|
*/
|
|
|
|
typedef struct AInputQueue AInputQueue;
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Add this input queue to a looper for processing. See
|
|
|
|
* ALooper_addFd() for information on the ident, callback, and data params.
|
|
|
|
*/
|
|
|
|
void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
|
|
|
|
int ident, ALooper_callbackFunc callback, void* data);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Remove the input queue from the looper it is currently attached to.
|
|
|
|
*/
|
|
|
|
void AInputQueue_detachLooper(AInputQueue* queue);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns true if there are one or more events available in the
|
|
|
|
* input queue. Returns 1 if the queue has events; 0 if
|
|
|
|
* it does not have events; and a negative value if there is an error.
|
|
|
|
*/
|
|
|
|
int32_t AInputQueue_hasEvents(AInputQueue* queue);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns the next available event from the queue. Returns a negative
|
|
|
|
* value if no events are available or an error has occurred.
|
|
|
|
*/
|
|
|
|
int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Sends the key for standard pre-dispatching -- that is, possibly deliver
|
|
|
|
* it to the current IME to be consumed before the app. Returns 0 if it
|
|
|
|
* was not pre-dispatched, meaning you can process it right now. If non-zero
|
|
|
|
* is returned, you must abandon the current event processing and allow the
|
|
|
|
* event to appear again in the event queue (if it does not get consumed during
|
|
|
|
* pre-dispatching).
|
|
|
|
*/
|
|
|
|
int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Report that dispatching has finished with the given event.
|
|
|
|
* This must be called after receiving an event with AInputQueue_get_event().
|
|
|
|
*/
|
|
|
|
void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _ANDROID_INPUT_H
|
2015-03-28 00:15:43 +00:00
|
|
|
|
|
|
|
/** @} */
|