MotionEvent.java revision 33bbfd2232ea9eaae9a9d87a05a95a430f09bd83
19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/*
29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Copyright (C) 2007 The Android Open Source Project
39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * you may not use this file except in compliance with the License.
69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You may obtain a copy of the License at
79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Unless required by applicable law or agreed to in writing, software
119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * See the License for the specific language governing permissions and
149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * limitations under the License.
159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage android.view;
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1920e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brownimport android.graphics.Matrix;
209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.Parcel;
219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.Parcelable;
229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.SystemClock;
236f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brownimport android.util.SparseArray;
249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/**
269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Object used to report movement (mouse, pen, finger, trackball) events.  This
279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * class may hold either absolute or relative movements, depending on what
289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * it is being used for.
29dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * <p>
30cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * On pointing devices with source class {@link InputDevice#SOURCE_CLASS_POINTER}
31cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * such as touch screens, the pointer coordinates specify absolute
32dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * positions such as view X/Y coordinates.  Each complete gesture is represented
33dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * by a sequence of motion events with actions that describe pointer state transitions
34dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * and movements.  A gesture starts with a motion event with {@link #ACTION_DOWN}
35dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * that provides the location of the first pointer down.  As each additional
36dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * pointer that goes down or up, the framework will generate a motion event with
37dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * {@link #ACTION_POINTER_DOWN} or {@link #ACTION_POINTER_UP} accordingly.
38dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * Pointer movements are described by motion events with {@link #ACTION_MOVE}.
39dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * Finally, a gesture end either when the final pointer goes up as represented
40dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * by a motion event with {@link #ACTION_UP} or when gesture is canceled
41dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * with {@link #ACTION_CANCEL}.
42dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p><p>
4333bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * Some pointing devices such as mice may support vertical and/or horizontal scrolling.
4433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * A scroll event is reported as a generic motion event with {@link #ACTION_SCROLL} that
4533bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * includes the relative scroll offset in the {@link #AXIS_VSCROLL} and
4633bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * {@link #AXIS_HSCROLL} axes.  See {@link #getAxisValue(int)} for information
4733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * about retrieving these additional axes.
4833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * </p><p>
49cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * On trackball devices with source class {@link InputDevice#SOURCE_CLASS_TRACKBALL},
50cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * the pointer coordinates specify relative movements as X/Y deltas.
51dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * A trackball gesture consists of a sequence of movements described by motion
52dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * events with {@link #ACTION_MOVE} interspersed with occasional {@link #ACTION_DOWN}
53dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * or {@link #ACTION_UP} motion events when the trackball button is pressed or released.
54dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p><p>
55cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * On joystick devices with source class {@link InputDevice#SOURCE_CLASS_JOYSTICK},
56cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * the pointer coordinates specify the absolute position of the joystick axes.
57cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * The joystick axis values are normalized to a range of -1.0 to 1.0 where 0.0 corresponds
58cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * to the center position.  More information about the set of available axes and the
59cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * range of motion can be obtained using {@link InputDevice#getMotionRange}.
6033bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * Some common joystick axes are {@link #AXIS_X}, {@link #AXIS_Y},
6133bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown * {@link #AXIS_HAT_X}, {@link #AXIS_HAT_Y}, {@link #AXIS_Z} and {@link #AXIS_RZ}.
62cb1404e45639d20439d7700b06d57ca1a1aad1faJeff Brown * </p><p>
63dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * Motion events always report movements for all pointers at once.  The number
64dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * of pointers only ever changes by one as individual pointers go up and down,
65dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * except when the gesture is canceled.
66dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p><p>
67dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * The order in which individual pointers appear within a motion event can change
68dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * from one event to the next. Use the {@link #getPointerId(int)} method to obtain a
69dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * pointer id to track pointers across motion events in a gesture.  Then for
70dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * successive motion events, use the {@link #findPointerIndex(int)} method to obtain
71dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * the pointer index for a given pointer id in that motion event.
72dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p><p>
73dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * For efficiency, motion events with {@link #ACTION_MOVE} may batch together
74dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * multiple movement samples within a single object.  The most current
75dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * pointer coordinates are available using {@link #getX(int)} and {@link #getY(int)}.
76dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * Earlier coordinates within the batch are accessed using {@link #getHistoricalX(int, int)}
77dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * and {@link #getHistoricalY(int, int)}.  The coordinates are "historical" only
78dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * insofar as they are older than the current coordinates in the batch; however,
79dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * they are still distinct from any other coordinates reported in prior motion events.
80dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * To process all coordinates in the batch in time order, first consume the historical
81dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * coordinates then consume the current coordinates.
82dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p><p>
83dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * Example: Consuming all samples for all pointers in a motion event in time order.
84dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p><p><pre><code>
85dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * void printSamples(MotionEvent ev) {
86dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *     final int historySize = ev.getHistorySize();
87dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *     final int pointerCount = ev.getPointerCount();
88dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *     for (int h = 0; h &lt; historySize; h++) {
89dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *         System.out.printf("At time %d:", ev.getHistoricalEventTime(h));
90dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *         for (int p = 0; p &lt; pointerCount; p++) {
91dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *             System.out.printf("  pointer %d: (%f,%f)",
92dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *                 ev.getPointerId(p), ev.getHistoricalX(p, h), ev.getHistoricalY(p, h));
93dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *         }
94dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *     }
95dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *     System.out.printf("At time %d:", ev.getEventTime());
96dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *     for (int p = 0; p &lt; pointerCount; p++) {
97dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *         System.out.printf("  pointer %d: (%f,%f)",
98dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *             ev.getPointerId(p), ev.getX(p), ev.getY(p));
99dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown *     }
100dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * }
101dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </code></pre></p><p>
102b699726018a0049665d8ad6b90dbc5af0e18f135Jeff Brown * In general, the framework cannot guarantee that the motion events it delivers
103b699726018a0049665d8ad6b90dbc5af0e18f135Jeff Brown * to a view always constitute a complete motion sequences since some events may be dropped
104b699726018a0049665d8ad6b90dbc5af0e18f135Jeff Brown * or modified by containing views before they are delivered.  The view implementation
105b699726018a0049665d8ad6b90dbc5af0e18f135Jeff Brown * should be prepared to handle {@link #ACTION_CANCEL} and should tolerate anomalous
106b699726018a0049665d8ad6b90dbc5af0e18f135Jeff Brown * situations such as receiving a new {@link #ACTION_DOWN} without first having
107b699726018a0049665d8ad6b90dbc5af0e18f135Jeff Brown * received an {@link #ACTION_UP} for the prior gesture.
108dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p><p>
109dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * Refer to {@link InputDevice} for more information about how different kinds of
110c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown * input devices and sources represent pointer coordinates.
111dc1ab4b5cc274b7d744c11a939bb5910becec5e0Jeff Brown * </p>
1129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
113c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brownpublic final class MotionEvent extends InputEvent implements Parcelable {
11491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static final long NS_PER_MS = 1000000;
11585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown    private static final boolean TRACK_RECYCLED_LOCATION = false;
1160dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn
1179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1189822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * Bit mask of the parts of the action code that are the action itself.
1199822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
1209822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public static final int ACTION_MASK             = 0xff;
1219822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
1229822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
1239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Constant for {@link #getAction}: A pressed gesture has started, the
1249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * motion contains the initial starting location.
1259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int ACTION_DOWN             = 0;
1279822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
1289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Constant for {@link #getAction}: A pressed gesture has finished, the
1309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * motion contains the final release location as well as any intermediate
1319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * points since the last down or move event.
1329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int ACTION_UP               = 1;
1349822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
1359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Constant for {@link #getAction}: A change has happened during a
1379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * press gesture (between {@link #ACTION_DOWN} and {@link #ACTION_UP}).
1389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The motion contains the most recent point, as well as any intermediate
1399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * points since the last down or move event.
1409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int ACTION_MOVE             = 2;
1429822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
1439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Constant for {@link #getAction}: The current gesture has been aborted.
1459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * You will not receive any more points in it.  You should treat this as
1469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * an up event, but not perform any action that you normally would.
1479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int ACTION_CANCEL           = 3;
1499822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
1509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Constant for {@link #getAction}: A movement has happened outside of the
1529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * normal bounds of the UI element.  This does not provide a full gesture,
1539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * but only the initial location of the movement/touch.
1549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int ACTION_OUTSIDE          = 4;
1569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1579822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
1589822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * A non-primary pointer has gone down.  The bits in
1590dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * {@link #ACTION_POINTER_ID_MASK} indicate which pointer changed.
1609822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
1619822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public static final int ACTION_POINTER_DOWN     = 5;
1629822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
1639822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
164b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * A non-primary pointer has gone up.  The bits in
165b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * {@link #ACTION_POINTER_ID_MASK} indicate which pointer changed.
1669822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
167b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public static final int ACTION_POINTER_UP       = 6;
168cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown
169cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown    /**
170cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Constant for {@link #getAction}: A change happened but the pointer
171cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * is not down (unlike {@link #ACTION_MOVE}).  The motion contains the most
172cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * recent point, as well as any intermediate points since the last
173cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * hover move event.
17433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * <p>
17533bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * This action is not a touch event so it is delivered to
17633bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * {@link View#onGenericMotionEvent(MotionEvent)} rather than
17733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * {@link View#onTouchEvent(MotionEvent)}.
17833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * </p>
179cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     */
180cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown    public static final int ACTION_HOVER_MOVE       = 7;
181cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown
1829822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
18333bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * Constant for {@link #getAction}: The motion event contains relative
18433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * vertical and/or horizontal scroll offsets.  Use {@link #getAxisValue(int)}
18533bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * to retrieve the information from {@link #AXIS_VSCROLL} and {@link #AXIS_HSCROLL}.
18633bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * The pointer may or may not be down when this event is dispatched.
18733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * This action is always delivered to the winder under the pointer, which
18833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * may not be the window currently touched.
18933bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * <p>
19033bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * This action is not a touch event so it is delivered to
19133bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * {@link View#onGenericMotionEvent(MotionEvent)} rather than
19233bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * {@link View#onTouchEvent(MotionEvent)}.
19333bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * </p>
19433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     */
19533bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown    public static final int ACTION_SCROLL           = 8;
19633bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown
19733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown    /**
198b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * Bits in the action code that represent a pointer index, used with
199b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * {@link #ACTION_POINTER_DOWN} and {@link #ACTION_POINTER_UP}.  Shifting
200b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * down by {@link #ACTION_POINTER_INDEX_SHIFT} provides the actual pointer
201b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * index where the data for the pointer going up or down can be found; you can
202b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * get its identifier with {@link #getPointerId(int)} and the actual
203b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * data with {@link #getX(int)} etc.
2049822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
205b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public static final int ACTION_POINTER_INDEX_MASK  = 0xff00;
2069822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
2079822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
208b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * Bit shift for the action bits holding the pointer index as
209b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * defined by {@link #ACTION_POINTER_INDEX_MASK}.
2109822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
211b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public static final int ACTION_POINTER_INDEX_SHIFT = 8;
2129822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
2139822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
214b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the
215b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * data index associated with {@link #ACTION_POINTER_DOWN}.
2169822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
217b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
218b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public static final int ACTION_POINTER_1_DOWN   = ACTION_POINTER_DOWN | 0x0000;
219b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn
220b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    /**
221b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the
222b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * data index associated with {@link #ACTION_POINTER_DOWN}.
223b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     */
224b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
225b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public static final int ACTION_POINTER_2_DOWN   = ACTION_POINTER_DOWN | 0x0100;
2269822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
2279822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
228b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the
229b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * data index associated with {@link #ACTION_POINTER_DOWN}.
2309822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
231b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
232b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public static final int ACTION_POINTER_3_DOWN   = ACTION_POINTER_DOWN | 0x0200;
233b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn
234b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    /**
235b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the
236b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * data index associated with {@link #ACTION_POINTER_UP}.
237b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     */
238b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
2399822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public static final int ACTION_POINTER_1_UP     = ACTION_POINTER_UP | 0x0000;
2409822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
2419822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
242b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the
243b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * data index associated with {@link #ACTION_POINTER_UP}.
2449822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
245b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
2469822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public static final int ACTION_POINTER_2_UP     = ACTION_POINTER_UP | 0x0100;
2479822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
2489822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
249b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the
250b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * data index associated with {@link #ACTION_POINTER_UP}.
2519822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
252b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
2539822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public static final int ACTION_POINTER_3_UP     = ACTION_POINTER_UP | 0x0200;
2549822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
2559822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
256b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Renamed to {@link #ACTION_POINTER_INDEX_MASK} to match
257b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * the actual data contained in these bits.
2589822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
259b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
2600dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public static final int ACTION_POINTER_ID_MASK  = 0xff00;
2619822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
2629822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
263b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * @deprecated Renamed to {@link #ACTION_POINTER_INDEX_SHIFT} to match
264b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * the actual data contained in these bits.
2659822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
266b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    @Deprecated
2670dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public static final int ACTION_POINTER_ID_SHIFT = 8;
2689822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
26985a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown    /**
27085a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * This flag indicates that the window that received this motion event is partly
27185a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * or wholly obscured by another visible window above it.  This flag is set to true
27285a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * even if the event did not directly pass through the obscured area.
27385a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * A security sensitive application can check this flag to identify situations in which
27485a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * a malicious application may have covered up part of its content for the purpose
27585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * of misleading the user or hijacking touches.  An appropriate response might be
27685a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * to drop the suspect touches or to take additional precautions to confirm the user's
27785a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * actual intent.
27885a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     */
27985a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown    public static final int FLAG_WINDOW_IS_OBSCURED = 0x1;
280cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
2819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
2829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Flag indicating the motion event intersected the top edge of the screen.
2839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int EDGE_TOP = 0x00000001;
285cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
2869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
2879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Flag indicating the motion event intersected the bottom edge of the screen.
2889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int EDGE_BOTTOM = 0x00000002;
290cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
2919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
2929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Flag indicating the motion event intersected the left edge of the screen.
2939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int EDGE_LEFT = 0x00000004;
295cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
2969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
2979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Flag indicating the motion event intersected the right edge of the screen.
2989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int EDGE_RIGHT = 0x00000008;
300cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
30191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
30291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the X axis of a motion event.
3036f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
3046f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
3056f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen, reports the absolute X screen position of the center of
3066f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * the touch contact area.  The units are display pixels.
3076f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch pad, reports the absolute X surface position of the center of the touch
308cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * contact area.  The units are device-dependent; use {@link InputDevice#getMotionRange(int)}
309cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * to query the effective range of values.
3106f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a mouse, reports the absolute X screen position of the mouse pointer.
3116f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are display pixels.
3126f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a trackball, reports the relative horizontal displacement of the trackball.
3136f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (left) to 1.0 (right).
3146f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute X position of the joystick.
3156f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (left) to 1.0 (right).
3166f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
3176f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
31891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
31991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getX(int)
32091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalX(int, int)
32191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#x
32291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
3239822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
32491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_X = 0;
32591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
32691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
32791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the Y axis of a motion event.
3286f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
3296f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
3306f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen, reports the absolute Y screen position of the center of
3316f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * the touch contact area.  The units are display pixels.
3326f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch pad, reports the absolute Y surface position of the center of the touch
3336f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * contact area.  The units are device-dependent; use {@link InputDevice#getMotionRange(int)}
3346f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to query the effective range of values.
3356f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a mouse, reports the absolute Y screen position of the mouse pointer.
3366f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are display pixels.
3376f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a trackball, reports the relative vertical displacement of the trackball.
3386f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (up) to 1.0 (down).
3396f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute Y position of the joystick.
3406f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near).
3416f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
3426f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
34391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
34491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getY(int)
34591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalY(int, int)
34691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#y
34791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
348c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
34991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_Y = 1;
350c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
35191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
35291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the Pressure axis of a motion event.
3536f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
3546f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
355cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * <li>For a touch screen or touch pad, reports the approximate pressure applied to the surface
3566f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * by a finger or other tool.  The value is normalized to a range from
3576f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1
3586f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * may be generated depending on the calibration of the input device.
3596f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a trackball, the value is set to 1 if the trackball button is pressed
3606f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * or 0 otherwise.
3616f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a mouse, the value is set to 1 if the primary mouse button is pressed
3626f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * or 0 otherwise.
3636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
3646f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
36591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
36691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getPressure(int)
36791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalPressure(int, int)
36891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#pressure
36991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
370c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
37191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_PRESSURE = 2;
37291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
37391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
37491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the Size axis of a motion event.
3756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
3766f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
3776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen or touch pad, reports the approximate size of the contact area in
3786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * relation to the maximum detectable size for the device.  The value is normalized
3796f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to a range from 0 (smallest detectable size) to 1 (largest detectable size),
380cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * although it is not a linear scale.  This value is of limited use.
3816f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * To obtain calibrated size information, use
3826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * {@link #AXIS_TOUCH_MAJOR} or {@link #AXIS_TOOL_MAJOR}.
3836f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
3846f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
38591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
38691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getSize(int)
38791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalSize(int, int)
38891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#size
38991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
390c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
39191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_SIZE = 3;
392c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
39391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
39491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the TouchMajor axis of a motion event.
3956f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
3966f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
3976f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen, reports the length of the major axis of an ellipse that
3986f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the touch area at the point of contact.
3996f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are display pixels.
4006f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch pad, reports the length of the major axis of an ellipse that
4016f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the touch area at the point of contact.
4026f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are device-dependent; use {@link InputDevice#getMotionRange(int)}
4036f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to query the effective range of values.
4046f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
4056f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
40691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
40791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getTouchMajor(int)
40891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalTouchMajor(int, int)
40991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#touchMajor
41091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
411c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
41291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_TOUCH_MAJOR = 4;
41391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
41491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
41591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the TouchMinor axis of a motion event.
4166f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
4176f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
4186f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen, reports the length of the minor axis of an ellipse that
4196f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the touch area at the point of contact.
4206f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are display pixels.
4216f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch pad, reports the length of the minor axis of an ellipse that
4226f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the touch area at the point of contact.
4236f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are device-dependent; use {@link InputDevice#getMotionRange(int)}
4246f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to query the effective range of values.
4256f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
4266f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p><p>
4276f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * When the touch is circular, the major and minor axis lengths will be equal to one another.
4286f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
42991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
43091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getTouchMinor(int)
43191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalTouchMinor(int, int)
43291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#touchMinor
43391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
434c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
43591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_TOUCH_MINOR = 5;
436c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
43791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
43891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the ToolMajor axis of a motion event.
4396f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
4406f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
4416f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen, reports the length of the major axis of an ellipse that
4426f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the size of the approaching finger or tool used to make contact.
4436f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch pad, reports the length of the major axis of an ellipse that
4446f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the size of the approaching finger or tool used to make contact.
4456f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are device-dependent; use {@link InputDevice#getMotionRange(int)}
4466f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to query the effective range of values.
4476f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
4486f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p><p>
4496f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * When the touch is circular, the major and minor axis lengths will be equal to one another.
4506f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p><p>
4516f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The tool size may be larger than the touch size since the tool may not be fully
4526f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * in contact with the touch sensor.
4536f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
45491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
45591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getToolMajor(int)
45691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalToolMajor(int, int)
45791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#toolMajor
45891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
4599822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
46091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_TOOL_MAJOR = 6;
46191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
46291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
46391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the ToolMinor axis of a motion event.
4646f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
4656f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
4666f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen, reports the length of the minor axis of an ellipse that
4676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the size of the approaching finger or tool used to make contact.
4686f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch pad, reports the length of the minor axis of an ellipse that
4696f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * represents the size of the approaching finger or tool used to make contact.
4706f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The units are device-dependent; use {@link InputDevice#getMotionRange(int)}
4716f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to query the effective range of values.
4726f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
4736f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p><p>
4746f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * When the touch is circular, the major and minor axis lengths will be equal to one another.
4756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p><p>
4766f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The tool size may be larger than the touch size since the tool may not be fully
4776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * in contact with the touch sensor.
4786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
47991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
48091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getToolMinor(int)
48191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalToolMinor(int, int)
48291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#toolMinor
48391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
4841e8dfc73fba88766ee3c25ae7b3bb1850319b11dDianne Hackborn     */
48591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_TOOL_MINOR = 7;
48691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
48791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
48891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Constant used to identify the Orientation axis of a motion event.
4896f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
4906f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
4916f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a touch screen or touch pad, reports the orientation of the finger
4926f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * or tool in radians relative to the vertical plane of the device.
4936f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * An angle of 0 radians indicates that the major axis of contact is oriented
49491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * upwards, is perfectly circular or is of unknown orientation.  A positive angle
49591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * indicates that the major axis of contact is oriented to the right.  A negative angle
49691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * indicates that the major axis of contact is oriented to the left.
49791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
49891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * (finger pointing fully right).
4996f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
5006f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
50191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
50291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getOrientation(int)
50391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistoricalOrientation(int, int)
50491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see MotionEvent.PointerCoords#orientation
50591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see InputDevice#getMotionRange
5069e2ad36be87f2703b3d737189944d82f93bd4f27Jeff Brown     */
50791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static final int AXIS_ORIENTATION = 8;
50891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
5096f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
5106f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Vertical Scroll axis of a motion event.
5116f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
5126f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
513cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * <li>For a mouse, reports the relative movement of the vertical scroll wheel.
51433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * The value is normalized to a range from -1.0 (down) to 1.0 (up).
5156f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
5166f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p><p>
5176f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * This axis should be used to scroll views vertically.
5186f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
5196f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
5206f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
5216f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
5226f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
5236f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
5246f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
5256f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_VSCROLL = 9;
5266f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
5276f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
5286f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Horizontal Scroll axis of a motion event.
5296f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
5306f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
531cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * <li>For a mouse, reports the relative movement of the horizontal scroll wheel.
5326f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (left) to 1.0 (right).
5336f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
5346f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p><p>
5356f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * This axis should be used to scroll views horizontally.
5366f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
5376f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
5386f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
5396f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
5406f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
5416f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
5426f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
5436f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_HSCROLL = 10;
5446f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
5456f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
5466f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Z axis of a motion event.
5476f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
5486f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
5496f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute Z position of the joystick.
5506f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (high) to 1.0 (low).
5516f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <em>On game pads with two analog joysticks, this axis is often reinterpreted
5526f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to report the absolute X position of the second joystick instead.</em>
5536f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
5546f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
5556f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
5566f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
5576f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
5586f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
5596f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
5606f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
5616f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_Z = 11;
5626f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
5636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
5646f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the X Rotation axis of a motion event.
5656f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
5666f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
5676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute rotation angle about the X axis.
5686f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
5696f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
5706f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
5716f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
5726f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
5736f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
5746f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
5756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
5766f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
5776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_RX = 12;
5786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
5796f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
5806f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Y Rotation axis of a motion event.
5816f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
5826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
5836f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute rotation angle about the Y axis.
5846f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
5856f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
5866f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
5876f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
5886f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
5896f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
5906f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
5916f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
5926f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
5936f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_RY = 13;
5946f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
5956f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
5966f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Z Rotation axis of a motion event.
5976f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
5986f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
5996f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute rotation angle about the Z axis.
6006f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
6016f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <em>On game pads with two analog joysticks, this axis is often reinterpreted
6026f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * to report the absolute Y position of the second joystick instead.</em>
6036f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
6046f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
6056f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
6066f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
6076f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
6086f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
6096f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
6106f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
6116f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_RZ = 14;
6126f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
6136f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
6146f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Hat X axis of a motion event.
6156f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
6166f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
6176f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute X position of the directional hat control.
6186f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (left) to 1.0 (right).
6196f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
6206f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
6216f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
6226f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
6236f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
6246f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
6256f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
6266f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
6276f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_HAT_X = 15;
6286f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
6296f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
6306f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Hat Y axis of a motion event.
6316f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
6326f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
6336f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute Y position of the directional hat control.
6346f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from -1.0 (up) to 1.0 (down).
6356f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
6366f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
6376f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
6386f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
6396f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
6406f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
6416f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
6426f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
6436f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_HAT_Y = 16;
6446f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
6456f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
6466f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Left Trigger axis of a motion event.
6476f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
6486f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
6496f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute position of the left trigger control.
6506f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
6516f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
6526f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
6536f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
6546f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
6556f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
6566f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
6576f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
6586f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
6596f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_LTRIGGER = 17;
6606f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
6616f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
6626f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Right Trigger axis of a motion event.
6636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <p>
6646f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <ul>
6656f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * <li>For a joystick, reports the absolute position of the right trigger control.
6666f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
6676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </ul>
6686f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * </p>
6696f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
6706f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
6716f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
6726f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
6736f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
6746f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
6756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_RTRIGGER = 18;
6766f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
6776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
6786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 1 axis of a motion event.
6796f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
6806f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
6816f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
6826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
6836f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
6846f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
6856f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
6866f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_1 = 32;
6876f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
6886f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
6896f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 2 axis of a motion event.
6906f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
6916f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
6926f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
6936f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
6946f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
6956f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
6966f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
6976f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_2 = 33;
6986f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
6996f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7006f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 3 axis of a motion event.
7016f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7026f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7036f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7046f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7056f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7066f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7076f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7086f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_3 = 34;
7096f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7106f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7116f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 4 axis of a motion event.
7126f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7136f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7146f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7156f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7166f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7176f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7186f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7196f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_4 = 35;
7206f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7216f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7226f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 5 axis of a motion event.
7236f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7246f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7256f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7266f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7276f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7286f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7296f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7306f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_5 = 36;
7316f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7326f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7336f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 6 axis of a motion event.
7346f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7356f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7366f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7376f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7386f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7396f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7406f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7416f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_6 = 37;
7426f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7436f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7446f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 7 axis of a motion event.
7456f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7466f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7476f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7486f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7496f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7506f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7516f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7526f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_7 = 38;
7536f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7546f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7556f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 8 axis of a motion event.
7566f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7576f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7586f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7596f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7606f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7616f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7626f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_8 = 39;
7646f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7656f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7666f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 9 axis of a motion event.
7676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7686f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7696f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7706f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7716f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7726f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7736f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7746f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_9 = 40;
7756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7766f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 10 axis of a motion event.
7786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7796f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7806f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7816f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7836f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7846f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7856f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_10 = 41;
7866f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7876f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7886f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 11 axis of a motion event.
7896f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
7906f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
7916f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
7926f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
7936f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
7946f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
7956f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
7966f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_11 = 42;
7976f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
7986f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
7996f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 12 axis of a motion event.
8006f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
8016f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
8026f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
8036f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
8046f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
8056f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
8066f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
8076f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_12 = 43;
8086f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
8096f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
8106f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 13 axis of a motion event.
8116f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
8126f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
8136f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
8146f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
8156f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
8166f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
8176f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
8186f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_13 = 44;
8196f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
8206f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
8216f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 14 axis of a motion event.
8226f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
8236f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
8246f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
8256f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
8266f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
8276f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
8286f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
8296f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_14 = 45;
8306f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
8316f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
8326f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 15 axis of a motion event.
8336f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
8346f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
8356f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
8366f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
8376f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
8386f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
8396f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
8406f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_15 = 46;
8416f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
8426f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
8436f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * Constant used to identify the Generic 16 axis of a motion event.
8446f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * The interpretation of a generic axis is device-specific.
8456f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
8466f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getAxisValue(int, int)
8476f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #getHistoricalAxisValue(int, int, int)
8486f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see MotionEvent.PointerCoords#getAxisValue(int)
8496f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see InputDevice#getMotionRange
8506f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
8516f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static final int AXIS_GENERIC_16 = 47;
8526f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
8536f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    // NOTE: If you add a new axis here you must also add it to:
8546f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    //  native/include/android/input.h
8556f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    //  frameworks/base/include/ui/KeycodeLabels.h
8566f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
8576f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    // Symbolic names of all axes.
8586f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    private static final SparseArray<String> AXIS_SYMBOLIC_NAMES = new SparseArray<String>();
8596f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    private static void populateAxisSymbolicNames() {
8606f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        SparseArray<String> names = AXIS_SYMBOLIC_NAMES;
8616f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_X, "AXIS_X");
8626f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_Y, "AXIS_Y");
8636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_PRESSURE, "AXIS_PRESSURE");
8646f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_SIZE, "AXIS_SIZE");
8656f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_TOUCH_MAJOR, "AXIS_TOUCH_MAJOR");
8666f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_TOUCH_MINOR, "AXIS_TOUCH_MINOR");
8676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_TOOL_MAJOR, "AXIS_TOOL_MAJOR");
8686f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_TOOL_MINOR, "AXIS_TOOL_MINOR");
8696f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_ORIENTATION, "AXIS_ORIENTATION");
8706f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_VSCROLL, "AXIS_VSCROLL");
8716f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_HSCROLL, "AXIS_HSCROLL");
8726f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_Z, "AXIS_Z");
8736f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_RX, "AXIS_RX");
8746f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_RY, "AXIS_RY");
8756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_RZ, "AXIS_RZ");
8766f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_HAT_X, "AXIS_HAT_X");
8776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_HAT_Y, "AXIS_HAT_Y");
8786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_LTRIGGER, "AXIS_LTRIGGER");
8796f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_RTRIGGER, "AXIS_RTRIGGER");
8806f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_1, "AXIS_GENERIC_1");
8816f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_2, "AXIS_GENERIC_2");
8826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_3, "AXIS_GENERIC_3");
8836f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_4, "AXIS_GENERIC_4");
8846f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_5, "AXIS_GENERIC_5");
8856f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_6, "AXIS_GENERIC_6");
8866f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_7, "AXIS_GENERIC_7");
8876f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_8, "AXIS_GENERIC_8");
8886f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_9, "AXIS_GENERIC_9");
8896f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_10, "AXIS_GENERIC_10");
8906f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_11, "AXIS_GENERIC_11");
8916f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_12, "AXIS_GENERIC_12");
8926f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_13, "AXIS_GENERIC_13");
8936f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_14, "AXIS_GENERIC_14");
8946f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_15, "AXIS_GENERIC_15");
8956f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        names.append(AXIS_GENERIC_16, "AXIS_GENERIC_16");
8966f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    }
8976f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
8986f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    static {
8996f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        populateAxisSymbolicNames();
9006f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    }
9016f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
90291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    // Private value for history pos that obtains the current sample.
90391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static final int HISTORY_CURRENT = -0x80000000;
90491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
9051f2451007c660091b7b090c1ea332f9044515d2dJeff Brown    private static final int MAX_RECYCLED = 10;
9061f2451007c660091b7b090c1ea332f9044515d2dJeff Brown    private static final Object gRecyclerLock = new Object();
9071f2451007c660091b7b090c1ea332f9044515d2dJeff Brown    private static int gRecyclerUsed;
9081f2451007c660091b7b090c1ea332f9044515d2dJeff Brown    private static MotionEvent gRecyclerTop;
909cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
91091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    // Shared temporary objects used when translating coordinates supplied by
91191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    // the caller into single element PointerCoords and pointer id arrays.
91291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    // Must lock gTmpPointerCoords prior to use.
91391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static final PointerCoords[] gTmpPointerCoords =
91491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            new PointerCoords[] { new PointerCoords() };
91591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static final int[] gTmpPointerIds = new int[] { 0 /*always 0*/ };
91691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
91791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    // Pointer to the native MotionEvent object that contains the actual data.
91891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private int mNativePtr;
9198169daed2f7a8731d478b884b1f455c747b88478Mitsuru Oshima
9209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    private MotionEvent mNext;
9219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    private RuntimeException mRecycledLocation;
9229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    private boolean mRecycled;
9239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
92491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeInitialize(int nativePtr,
92591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            int deviceId, int source, int action, int flags, int edgeFlags, int metaState,
92691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            float xOffset, float yOffset, float xPrecision, float yPrecision,
92791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            long downTimeNanos, long eventTimeNanos,
92891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            int pointerCount, int[] pointerIds, PointerCoords[] pointerCoords);
92991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeCopy(int destNativePtr, int sourceNativePtr,
93091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            boolean keepHistory);
93191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeDispose(int nativePtr);
93291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeAddBatch(int nativePtr, long eventTimeNanos,
93391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            PointerCoords[] pointerCoords, int metaState);
93491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
93591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetDeviceId(int nativePtr);
93691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetSource(int nativePtr);
93791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeSetSource(int nativePtr, int source);
93891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetAction(int nativePtr);
93991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeSetAction(int nativePtr, int action);
94091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetFlags(int nativePtr);
94191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetEdgeFlags(int nativePtr);
94291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeSetEdgeFlags(int nativePtr, int action);
94391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetMetaState(int nativePtr);
94491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeOffsetLocation(int nativePtr, float deltaX, float deltaY);
94591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native float nativeGetXPrecision(int nativePtr);
94691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native float nativeGetYPrecision(int nativePtr);
94791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native long nativeGetDownTimeNanos(int nativePtr);
94891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
94991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetPointerCount(int nativePtr);
95091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetPointerId(int nativePtr, int pointerIndex);
95191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeFindPointerIndex(int nativePtr, int pointerId);
95291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
95391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeGetHistorySize(int nativePtr);
95491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native long nativeGetEventTimeNanos(int nativePtr, int historyPos);
95591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native float nativeGetRawAxisValue(int nativePtr,
95691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            int axis, int pointerIndex, int historyPos);
95791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native float nativeGetAxisValue(int nativePtr,
95891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            int axis, int pointerIndex, int historyPos);
95991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeGetPointerCoords(int nativePtr,
96091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            int pointerIndex, int historyPos, PointerCoords outPointerCoords);
96191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
96291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeScale(int nativePtr, float scale);
96391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeTransform(int nativePtr, Matrix matrix);
96491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
96591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native int nativeReadFromParcel(int nativePtr, Parcel parcel);
96691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private static native void nativeWriteToParcel(int nativePtr, Parcel parcel);
96791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
96891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    private MotionEvent() {
96991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
97020e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown
97191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    @Override
97291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    protected void finalize() throws Throwable {
97391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        try {
97491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            if (mNativePtr != 0) {
97591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                nativeDispose(mNativePtr);
97691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                mNativePtr = 0;
97791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            }
97891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        } finally {
97991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            super.finalize();
98091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
9819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
982cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
98391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    static private MotionEvent obtain() {
98446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown        final MotionEvent ev;
98546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown        synchronized (gRecyclerLock) {
9861f2451007c660091b7b090c1ea332f9044515d2dJeff Brown            ev = gRecyclerTop;
9871f2451007c660091b7b090c1ea332f9044515d2dJeff Brown            if (ev == null) {
98891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                return new MotionEvent();
98946b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown            }
99046b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown            gRecyclerTop = ev.mNext;
9915c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown            gRecyclerUsed -= 1;
99246b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown        }
99346b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown        ev.mRecycledLocation = null;
99446b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown        ev.mRecycled = false;
99546b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown        ev.mNext = null;
99646b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown        return ev;
99746b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown    }
99891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
99953071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan    /**
100053071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * Create a new MotionEvent, filling in all of the basic values that
100153071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * define the motion.
100253071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     *
100353071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * @param downTime The time (in ms) when the user originally pressed down to start
100453071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * a stream of position events.  This must be obtained from {@link SystemClock#uptimeMillis()}.
1005c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param eventTime The the time (in ms) when this specific event was generated.  This
100653071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * must be obtained from {@link SystemClock#uptimeMillis()}.
1007cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * @param action The kind of action being performed, such as {@link #ACTION_DOWN}.
10080dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointers The number of points that will be in this event.
1009c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIds An array of <em>pointers</em> values providing
10100dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * an identifier for each pointer.
1011c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerCoords An array of <em>pointers</em> values providing
1012c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * a {@link PointerCoords} coordinate object for each pointer.
101353071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * @param metaState The state of any meta / modifier keys that were in effect when
101453071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * the event was generated.
101553071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * @param xPrecision The precision of the X coordinate being reported.
101653071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * @param yPrecision The precision of the Y coordinate being reported.
101753071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * @param deviceId The id for the device that this event came from.  An id of
101853071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * zero indicates that the event didn't come from a physical device; other
101953071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * numbers are arbitrary and you shouldn't depend on the values.
102085a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * @param edgeFlags A bitfield indicating which edges, if any, were touched by this
102153071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * MotionEvent.
1022c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param source The source of this event.
102385a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * @param flags The motion event flags.
102453071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     */
1025c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    static public MotionEvent obtain(long downTime, long eventTime,
1026c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown            int action, int pointers, int[] pointerIds, PointerCoords[] pointerCoords,
1027c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown            int metaState, float xPrecision, float yPrecision, int deviceId,
102885a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown            int edgeFlags, int source, int flags) {
102991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        MotionEvent ev = obtain();
103091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        ev.mNativePtr = nativeInitialize(ev.mNativePtr,
103191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                deviceId, source, action, flags, edgeFlags, metaState,
103291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                0, 0, xPrecision, yPrecision,
103391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                downTime * NS_PER_MS, eventTime * NS_PER_MS,
103491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                pointers, pointerIds, pointerCoords);
103553071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan        return ev;
103653071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan    }
103791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
10389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
10399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Create a new MotionEvent, filling in all of the basic values that
10409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * define the motion.
1041cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
1042cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * @param downTime The time (in ms) when the user originally pressed down to start
10439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * a stream of position events.  This must be obtained from {@link SystemClock#uptimeMillis()}.
1044cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * @param eventTime  The the time (in ms) when this specific event was generated.  This
10459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * must be obtained from {@link SystemClock#uptimeMillis()}.
1046cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * @param action The kind of action being performed, such as {@link #ACTION_DOWN}.
10479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param x The X coordinate of this event.
10489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param y The Y coordinate of this event.
1049cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * @param pressure The current pressure of this event.  The pressure generally
1050cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * ranges from 0 (no pressure at all) to 1 (normal pressure), however
1051cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * values higher than 1 may be generated depending on the calibration of
10529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the input device.
10539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param size A scaled value of the approximate size of the area being pressed when
1054cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * touched with the finger. The actual value in pixels corresponding to the finger
10559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * touch is normalized with a device specific range of values
10569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * and scaled to a value between 0 and 1.
10579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param metaState The state of any meta / modifier keys that were in effect when
10589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the event was generated.
10599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param xPrecision The precision of the X coordinate being reported.
10609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param yPrecision The precision of the Y coordinate being reported.
10619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param deviceId The id for the device that this event came from.  An id of
10629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * zero indicates that the event didn't come from a physical device; other
10639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * numbers are arbitrary and you shouldn't depend on the values.
106485a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * @param edgeFlags A bitfield indicating which edges, if any, were touched by this
10659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * MotionEvent.
10669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
10679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    static public MotionEvent obtain(long downTime, long eventTime, int action,
10689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            float x, float y, float pressure, float size, int metaState,
10699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            float xPrecision, float yPrecision, int deviceId, int edgeFlags) {
107091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        synchronized (gTmpPointerCoords) {
107191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            final PointerCoords pc = gTmpPointerCoords[0];
107291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.clear();
107391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.x = x;
107491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.y = y;
107591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.pressure = pressure;
107691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.size = size;
107791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
107891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            MotionEvent ev = obtain();
107991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            ev.mNativePtr = nativeInitialize(ev.mNativePtr,
108091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    deviceId, InputDevice.SOURCE_UNKNOWN, action, 0, edgeFlags, metaState,
108191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    0, 0, xPrecision, yPrecision,
108291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    downTime * NS_PER_MS, eventTime * NS_PER_MS,
108391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    1, gTmpPointerIds, gTmpPointerCoords);
108491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            return ev;
108591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
10869822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
10879822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
10889822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
10899822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * Create a new MotionEvent, filling in all of the basic values that
10909822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * define the motion.
10919822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     *
10929822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param downTime The time (in ms) when the user originally pressed down to start
10939822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * a stream of position events.  This must be obtained from {@link SystemClock#uptimeMillis()}.
10949822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param eventTime  The the time (in ms) when this specific event was generated.  This
10959822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * must be obtained from {@link SystemClock#uptimeMillis()}.
1096cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * @param action The kind of action being performed, such as {@link #ACTION_DOWN}.
10979822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param pointers The number of pointers that are active in this event.
10989822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param x The X coordinate of this event.
10999822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param y The Y coordinate of this event.
11009822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param pressure The current pressure of this event.  The pressure generally
11019822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * ranges from 0 (no pressure at all) to 1 (normal pressure), however
11029822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * values higher than 1 may be generated depending on the calibration of
11039822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * the input device.
11049822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param size A scaled value of the approximate size of the area being pressed when
11059822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * touched with the finger. The actual value in pixels corresponding to the finger
11069822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * touch is normalized with a device specific range of values
11079822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * and scaled to a value between 0 and 1.
11089822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param metaState The state of any meta / modifier keys that were in effect when
11099822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * the event was generated.
11109822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param xPrecision The precision of the X coordinate being reported.
11119822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param yPrecision The precision of the Y coordinate being reported.
11129822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param deviceId The id for the device that this event came from.  An id of
11139822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * zero indicates that the event didn't come from a physical device; other
11149822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * numbers are arbitrary and you shouldn't depend on the values.
111585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * @param edgeFlags A bitfield indicating which edges, if any, were touched by this
11169822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * MotionEvent.
11175c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown     *
11185c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown     * @deprecated Use {@link #obtain(long, long, int, float, float, float, float, int, float, float, int, int)}
11195c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown     * instead.
11209822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
11215c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown    @Deprecated
11229822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    static public MotionEvent obtain(long downTime, long eventTime, int action,
11239822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn            int pointers, float x, float y, float pressure, float size, int metaState,
11249822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn            float xPrecision, float yPrecision, int deviceId, int edgeFlags) {
11255c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown        return obtain(downTime, eventTime, action, x, y, pressure, size,
11265c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown                metaState, xPrecision, yPrecision, deviceId, edgeFlags);
11279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1128cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
11299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
11309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Create a new MotionEvent, filling in a subset of the basic motion
11319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * values.  Those not specified here are: device id (always 0), pressure
11329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * and size (always 1), x and y precision (always 1), and edgeFlags (always 0).
1133cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
1134cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * @param downTime The time (in ms) when the user originally pressed down to start
11359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * a stream of position events.  This must be obtained from {@link SystemClock#uptimeMillis()}.
1136cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * @param eventTime  The the time (in ms) when this specific event was generated.  This
11379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * must be obtained from {@link SystemClock#uptimeMillis()}.
1138cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * @param action The kind of action being performed, such as {@link #ACTION_DOWN}.
11399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param x The X coordinate of this event.
11409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param y The Y coordinate of this event.
11419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param metaState The state of any meta / modifier keys that were in effect when
11429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the event was generated.
11439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
11449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    static public MotionEvent obtain(long downTime, long eventTime, int action,
11459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            float x, float y, int metaState) {
11465c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown        return obtain(downTime, eventTime, action, x, y, 1.0f, 1.0f,
11475c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown                metaState, 1.0f, 1.0f, 0, 0);
11488169daed2f7a8731d478b884b1f455c747b88478Mitsuru Oshima    }
11498169daed2f7a8731d478b884b1f455c747b88478Mitsuru Oshima
11509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
11519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Create a new MotionEvent, copying from an existing one.
11529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
115391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    static public MotionEvent obtain(MotionEvent other) {
115491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        if (other == null) {
115591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            throw new IllegalArgumentException("other motion event must not be null");
115691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
115791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
115891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        MotionEvent ev = obtain();
115991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        ev.mNativePtr = nativeCopy(ev.mNativePtr, other.mNativePtr, true /*keepHistory*/);
11609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        return ev;
11619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1162cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
11639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
11648df8b2b405c60cacf7a66c4e2ca078dd3d7ec7bdDianne Hackborn     * Create a new MotionEvent, copying from an existing one, but not including
11658df8b2b405c60cacf7a66c4e2ca078dd3d7ec7bdDianne Hackborn     * any historical point information.
11668df8b2b405c60cacf7a66c4e2ca078dd3d7ec7bdDianne Hackborn     */
116791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    static public MotionEvent obtainNoHistory(MotionEvent other) {
116891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        if (other == null) {
116991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            throw new IllegalArgumentException("other motion event must not be null");
117091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
117191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
117291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        MotionEvent ev = obtain();
117391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        ev.mNativePtr = nativeCopy(ev.mNativePtr, other.mNativePtr, false /*keepHistory*/);
11748df8b2b405c60cacf7a66c4e2ca078dd3d7ec7bdDianne Hackborn        return ev;
11758df8b2b405c60cacf7a66c4e2ca078dd3d7ec7bdDianne Hackborn    }
11768df8b2b405c60cacf7a66c4e2ca078dd3d7ec7bdDianne Hackborn
11778df8b2b405c60cacf7a66c4e2ca078dd3d7ec7bdDianne Hackborn    /**
11789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Recycle the MotionEvent, to be re-used by a later caller.  After calling
11799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * this function you must not ever touch the event again.
11809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
11815c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown    public final void recycle() {
11829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        // Ensure recycle is only called once!
11839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        if (TRACK_RECYCLED_LOCATION) {
11849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            if (mRecycledLocation != null) {
11859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                throw new RuntimeException(toString() + " recycled twice!", mRecycledLocation);
11869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            }
11879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            mRecycledLocation = new RuntimeException("Last recycled here");
1188d28f4be870ea8850a2d4a2fe51333643f16b9ab1Jeff Brown            //Log.w("MotionEvent", "Recycling event " + this, mRecycledLocation);
1189d28f4be870ea8850a2d4a2fe51333643f16b9ab1Jeff Brown        } else {
1190d28f4be870ea8850a2d4a2fe51333643f16b9ab1Jeff Brown            if (mRecycled) {
1191d28f4be870ea8850a2d4a2fe51333643f16b9ab1Jeff Brown                throw new RuntimeException(toString() + " recycled twice!");
1192d28f4be870ea8850a2d4a2fe51333643f16b9ab1Jeff Brown            }
1193d28f4be870ea8850a2d4a2fe51333643f16b9ab1Jeff Brown            mRecycled = true;
11949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
11959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        synchronized (gRecyclerLock) {
11979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            if (gRecyclerUsed < MAX_RECYCLED) {
11989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                gRecyclerUsed++;
11999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                mNext = gRecyclerTop;
12009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                gRecyclerTop = this;
12019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            }
12029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
12039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
12045c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown
12055c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown    /**
12065c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown     * Scales down the coordination of this event by the given scale.
12075c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown     *
12085c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown     * @hide
12095c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown     */
12105c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown    public final void scale(float scale) {
121191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeScale(mNativePtr, scale);
121291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
121391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
121491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /** {@inheritDoc} */
121591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    @Override
121691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public final int getDeviceId() {
121791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetDeviceId(mNativePtr);
121891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
121991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
122091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /** {@inheritDoc} */
122191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    @Override
122291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public final int getSource() {
122391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetSource(mNativePtr);
122491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
122591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
122691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /** {@inheritDoc} */
122791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    @Override
122891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public final void setSource(int source) {
122991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeSetSource(mNativePtr, source);
12305c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown    }
1231cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
12329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1233cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Return the kind of action being performed.
1234cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Consider using {@link #getActionMasked} and {@link #getActionIndex} to retrieve
1235cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * the separate masked action and pointer index.
1236cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * @return The action, such as {@link #ACTION_DOWN} or
1237cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * the combination of {@link #ACTION_POINTER_DOWN} with a shifted pointer index.
12389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
12399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final int getAction() {
124091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAction(mNativePtr);
12419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
12429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
12439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1244cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Return the masked action being performed, without pointer index information.
1245cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Use {@link #getActionIndex} to return the index associated with pointer actions.
1246cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * @return The action, such as {@link #ACTION_DOWN} or {@link #ACTION_POINTER_DOWN}.
1247b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     */
1248b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public final int getActionMasked() {
124991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAction(mNativePtr) & ACTION_MASK;
1250b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    }
1251b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn
1252b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    /**
1253b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * For {@link #ACTION_POINTER_DOWN} or {@link #ACTION_POINTER_UP}
1254b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * as returned by {@link #getActionMasked}, this returns the associated
1255cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * pointer index.
1256cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * The index may be used with {@link #getPointerId(int)},
1257b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * {@link #getX(int)}, {@link #getY(int)}, {@link #getPressure(int)},
1258b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * and {@link #getSize(int)} to get information about the pointer that has
1259b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     * gone down or up.
1260cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * @return The index associated with the action.
1261b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn     */
1262b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    public final int getActionIndex() {
126391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return (nativeGetAction(mNativePtr) & ACTION_POINTER_INDEX_MASK)
126491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                >> ACTION_POINTER_INDEX_SHIFT;
1265b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    }
1266b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn
1267b125dc5599468a09d82751cd76152071ae485afbDianne Hackborn    /**
126833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * Returns true if this motion event is a touch event.
126933bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * <p>
127033bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * Specifically excludes pointer events with action {@link #ACTION_HOVER_MOVE}
127133bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * or {@link #ACTION_SCROLL} because they are not actually touch events
127233bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * (the pointer is not down).
127333bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * </p>
127433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * @return True if this motion event is a touch event.
127533bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     * @hide
127633bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown     */
127733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown    public final boolean isTouchEvent() {
127833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown        if ((getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
127933bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown            switch (getActionMasked()) {
128033bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                case MotionEvent.ACTION_DOWN:
128133bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                case MotionEvent.ACTION_MOVE:
128233bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                case MotionEvent.ACTION_UP:
128333bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                case MotionEvent.ACTION_POINTER_DOWN:
128433bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                case MotionEvent.ACTION_POINTER_UP:
128533bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                case MotionEvent.ACTION_CANCEL:
128633bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                case MotionEvent.ACTION_OUTSIDE:
128733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                    return true;
128833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown            }
128933bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown        }
129033bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown        return false;
129133bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown    }
129233bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown
129333bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown    /**
129485a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * Gets the motion event flags.
129585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     *
129685a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * @see #FLAG_WINDOW_IS_OBSCURED
129785a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     */
129885a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown    public final int getFlags() {
129991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetFlags(mNativePtr);
130085a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown    }
130185a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown
130285a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown    /**
1303cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * Returns the time (in ms) when the user originally pressed down to start
1304cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * a stream of position events.
13059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
13069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final long getDownTime() {
130791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetDownTimeNanos(mNativePtr) / NS_PER_MS;
13089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
13099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
13109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
13119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the time (in ms) when this specific event was generated.
13129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
13139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final long getEventTime() {
131491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetEventTimeNanos(mNativePtr, HISTORY_CURRENT) / NS_PER_MS;
13159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
13169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
13179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
131853071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * Returns the time (in ns) when this specific event was generated.
131953071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * The value is in nanosecond precision but it may not have nanosecond accuracy.
132053071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     *
132153071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     * @hide
132253071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan     */
132353071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan    public final long getEventTimeNano() {
132491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetEventTimeNanos(mNativePtr, HISTORY_CURRENT);
132553071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan    }
132653071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan
132753071d6d159f6dfd6fe0328a39bcf967ef308a64Michael Chan    /**
13280dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * {@link #getX(int)} for the first pointer index (may be an
13290dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
133091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
133191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
13329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
13339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final float getX() {
133491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_X, 0, HISTORY_CURRENT);
13359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
13369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
13379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
13380dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * {@link #getY(int)} for the first pointer index (may be an
13390dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
134091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
134191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
13429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
13439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final float getY() {
134491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_Y, 0, HISTORY_CURRENT);
13459822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
13469822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
13479822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
13480dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * {@link #getPressure(int)} for the first pointer index (may be an
13490dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
135091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
135191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_PRESSURE
13529822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
13539822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public final float getPressure() {
135491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_PRESSURE, 0, HISTORY_CURRENT);
13559822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
13569822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
13579822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
13580dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * {@link #getSize(int)} for the first pointer index (may be an
13590dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
136091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
136191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_SIZE
13629822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
13639822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public final float getSize() {
136491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_SIZE, 0, HISTORY_CURRENT);
13659822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
1366c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1367c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1368c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getTouchMajor(int)} for the first pointer index (may be an
1369c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
137091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
137191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MAJOR
1372c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1373c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getTouchMajor() {
137491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MAJOR, 0, HISTORY_CURRENT);
1375c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1376c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1377c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1378c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getTouchMinor(int)} for the first pointer index (may be an
1379c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
138091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
138191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MINOR
1382c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1383c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getTouchMinor() {
138491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MINOR, 0, HISTORY_CURRENT);
1385c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1386c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1387c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1388c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getToolMajor(int)} for the first pointer index (may be an
1389c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
139091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
139191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MAJOR
1392c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1393c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getToolMajor() {
139491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MAJOR, 0, HISTORY_CURRENT);
1395c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1396c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1397c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1398c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getToolMinor(int)} for the first pointer index (may be an
1399c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
140091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
140191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MINOR
1402c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1403c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getToolMinor() {
140491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MINOR, 0, HISTORY_CURRENT);
1405c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
140691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
1407c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1408c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getOrientation(int)} for the first pointer index (may be an
1409c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
141091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
141191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_ORIENTATION
1412c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1413c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getOrientation() {
141491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_ORIENTATION, 0, HISTORY_CURRENT);
141591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
141691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
141791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
141891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getAxisValue(int)} for the first pointer index (may be an
141991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * arbitrary pointer identifier).
142091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
142191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param axis The axis identifier for the axis value to retrieve.
142291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
142391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
142491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
142591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     */
142691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public final float getAxisValue(int axis) {
142791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, axis, 0, HISTORY_CURRENT);
1428c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
14299822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
14309822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
14310dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * The number of pointers of data contained in this event.  Always
14320dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * >= 1.
14330dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     */
14340dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final int getPointerCount() {
143591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetPointerCount(mNativePtr);
14360dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    }
14370dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn
14380dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    /**
14390dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Return the pointer identifier associated with a particular pointer
14400dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * data index is this event.  The identifier tells you the actual pointer
14410dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * number associated with the data, accounting for individual pointers
14420dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * going up and down since the start of the current gesture.
14430dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
14440dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
14450dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     */
1446d41ba666d12a24ee4624ea9a009151e6165e3775Dianne Hackborn    public final int getPointerId(int pointerIndex) {
144791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetPointerId(mNativePtr, pointerIndex);
14480dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    }
14490dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn
14500dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    /**
14510dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Given a pointer identifier, find the index of its data in the event.
14520dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     *
14530dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerId The identifier of the pointer to be found.
14540dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @return Returns either the index of the pointer (for use with
1455b0d6ba1ec4f71b96cab7d1ff62b846d5cf162c4fGilles Debunne     * {@link #getX(int)} et al.), or -1 if there is no data available for
14560dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * that pointer identifier.
14570dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     */
14580dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final int findPointerIndex(int pointerId) {
145991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeFindPointerIndex(mNativePtr, pointerId);
14600dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    }
14610dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn
14620dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    /**
14630dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns the X coordinate of this event for the given pointer
14640dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
14650dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * identifier for this index).
14669822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * Whole numbers are pixels; the
14679822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * value may have a fraction for input devices that are sub-pixel precise.
14680dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
14690dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
147091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
147191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
14729822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
14730dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getX(int pointerIndex) {
147491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_X, pointerIndex, HISTORY_CURRENT);
14759822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
14769822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
14779822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
14780dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns the Y coordinate of this event for the given pointer
14790dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
14800dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * identifier for this index).
14819822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * Whole numbers are pixels; the
14829822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * value may have a fraction for input devices that are sub-pixel precise.
14830dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
14840dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
148591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
148691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
14879822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
14880dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getY(int pointerIndex) {
148991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_Y, pointerIndex, HISTORY_CURRENT);
14909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
14919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
14929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
14930dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns the current pressure of this event for the given pointer
14940dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
14950dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * identifier for this index).
14969822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * The pressure generally
1497cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * ranges from 0 (no pressure at all) to 1 (normal pressure), however
1498cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * values higher than 1 may be generated depending on the calibration of
14999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the input device.
15000dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
15010dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
150291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
150391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_PRESSURE
15049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
15050dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getPressure(int pointerIndex) {
150691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_PRESSURE, pointerIndex, HISTORY_CURRENT);
15079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
15089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
15099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
15100dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns a scaled value of the approximate size for the given pointer
15110dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
15120dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * identifier for this index).
15130dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * This represents some approximation of the area of the screen being
15140dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * pressed; the actual value in pixels corresponding to the
15159822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * touch is normalized with the device specific range of values
1516cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * and scaled to a value between 0 and 1. The value of size can be used to
15179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * determine fat touch events.
15180dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
15190dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
152091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
152191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_SIZE
15229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
15230dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getSize(int pointerIndex) {
152491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_SIZE, pointerIndex, HISTORY_CURRENT);
15259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1526c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1527c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1528c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns the length of the major axis of an ellipse that describes the touch
1529c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * area at the point of contact for the given pointer
1530c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
1531c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * identifier for this index).
1532c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1533c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
153491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
153591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MAJOR
1536c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1537c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getTouchMajor(int pointerIndex) {
153891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MAJOR, pointerIndex, HISTORY_CURRENT);
1539c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1540c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1541c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1542c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns the length of the minor axis of an ellipse that describes the touch
1543c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * area at the point of contact for the given pointer
1544c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
1545c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * identifier for this index).
1546c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1547c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
154891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
154991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MINOR
1550c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1551c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getTouchMinor(int pointerIndex) {
155291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MINOR, pointerIndex, HISTORY_CURRENT);
1553c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1554c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1555c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1556c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns the length of the major axis of an ellipse that describes the size of
1557c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * the approaching tool for the given pointer
1558c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
1559c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * identifier for this index).
1560c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * The tool area represents the estimated size of the finger or pen that is
1561c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * touching the device independent of its actual touch area at the point of contact.
1562c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1563c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
156491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
156591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MAJOR
1566c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1567c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getToolMajor(int pointerIndex) {
156891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MAJOR, pointerIndex, HISTORY_CURRENT);
1569c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1570c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1571c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1572c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns the length of the minor axis of an ellipse that describes the size of
1573c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * the approaching tool for the given pointer
1574c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * <em>index</em> (use {@link #getPointerId(int)} to find the pointer
1575c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * identifier for this index).
1576c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * The tool area represents the estimated size of the finger or pen that is
1577c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * touching the device independent of its actual touch area at the point of contact.
1578c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1579c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
158091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
158191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MINOR
1582c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1583c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getToolMinor(int pointerIndex) {
158491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MINOR, pointerIndex, HISTORY_CURRENT);
1585c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1586c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1587c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1588c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns the orientation of the touch area and tool area in radians clockwise from vertical
1589c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * for the given pointer <em>index</em> (use {@link #getPointerId(int)} to find the pointer
1590c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * identifier for this index).
15916f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * An angle of 0 radians indicates that the major axis of contact is oriented
1592c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * upwards, is perfectly circular or is of unknown orientation.  A positive angle
1593c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * indicates that the major axis of contact is oriented to the right.  A negative angle
1594c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * indicates that the major axis of contact is oriented to the left.
15956d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown     * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
1596c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (finger pointing fully right).
1597c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1598c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
159991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
160091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_ORIENTATION
1601c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1602c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getOrientation(int pointerIndex) {
160391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_ORIENTATION, pointerIndex, HISTORY_CURRENT);
1604c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
160591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
160691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
160791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Returns the value of the requested axis for the given pointer <em>index</em>
160891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * (use {@link #getPointerId(int)} to find the pointer identifier for this index).
160991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
161091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param axis The axis identifier for the axis value to retrieve.
161191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
161291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
161391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @return The value of the axis, or 0 if the axis is not available.
161491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
161591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
161691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
161791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     */
161891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public final float getAxisValue(int axis, int pointerIndex) {
161991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, axis, pointerIndex, HISTORY_CURRENT);
162091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
162191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
1622c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1623c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Populates a {@link PointerCoords} object with pointer coordinate data for
1624c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * the specified pointer index.
1625c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
1626c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1627c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
1628c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param outPointerCoords The pointer coordinate object to populate.
162991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
163091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see PointerCoords
1631c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1632c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final void getPointerCoords(int pointerIndex, PointerCoords outPointerCoords) {
163391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeGetPointerCoords(mNativePtr, pointerIndex, HISTORY_CURRENT, outPointerCoords);
1634c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
16359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
16369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
16379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the state of any meta / modifier keys that were in effect when
16389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the event was generated.  This is the same values as those
16399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * returned by {@link KeyEvent#getMetaState() KeyEvent.getMetaState}.
16409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
16419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return an integer in which each bit set to 1 represents a pressed
16429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *         meta key
16439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *
16449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see KeyEvent#getMetaState()
16459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
16469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final int getMetaState() {
164791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetMetaState(mNativePtr);
16489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
16499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
16509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
16519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the original raw X coordinate of this event.  For touch
16529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * events on the screen, this is the original location of the event
16539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * on the screen, before it had been adjusted for the containing window
16549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * and views.
165591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
165691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see getX()
165791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
16589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
16599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final float getRawX() {
166091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetRawAxisValue(mNativePtr, AXIS_X, 0, HISTORY_CURRENT);
16619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
166291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
16639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
16649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the original raw Y coordinate of this event.  For touch
16659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * events on the screen, this is the original location of the event
16669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * on the screen, before it had been adjusted for the containing window
16679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * and views.
166891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
166991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see getY()
167091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
16719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
16729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final float getRawY() {
167391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetRawAxisValue(mNativePtr, AXIS_Y, 0, HISTORY_CURRENT);
16749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
16759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
16769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
16779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Return the precision of the X coordinates being reported.  You can
167891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * multiply this number with {@link #getX} to find the actual hardware
16799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * value of the X coordinate.
16809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return Returns the precision of X coordinates being reported.
168191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
168291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
16839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
16849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final float getXPrecision() {
168591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetXPrecision(mNativePtr);
16869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1687cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
16889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
16899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Return the precision of the Y coordinates being reported.  You can
169091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * multiply this number with {@link #getY} to find the actual hardware
16919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * value of the Y coordinate.
16929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return Returns the precision of Y coordinates being reported.
169391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
169491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
16959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
16969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final float getYPrecision() {
169791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetYPrecision(mNativePtr);
16989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1699cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
17009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
17019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the number of historical points in this event.  These are
17029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * movements that have occurred between this event and the previous event.
17039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * This only applies to ACTION_MOVE events -- all other actions will have
17049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * a size of 0.
1705cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
17069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return Returns the number of historical points in the event.
17079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
17089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final int getHistorySize() {
170991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetHistorySize(mNativePtr);
17109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1711cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
17129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
17139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the time that a historical movement occurred between this event
17149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * and the previous event.  Only applies to ACTION_MOVE events.
1715cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
17169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param pos Which historical value to return; must be less than
17179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link #getHistorySize}
1718cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
17199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getHistorySize
17209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getEventTime
17219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
17229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final long getHistoricalEventTime(int pos) {
172391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetEventTimeNanos(mNativePtr, pos) / NS_PER_MS;
17249822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
17259822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
17269822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
172791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalX(int, int)} for the first pointer index (may be an
17280dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
172991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
173091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
173191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
173291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
173391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
173491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getX()
173591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
17369822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
17379822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public final float getHistoricalX(int pos) {
173891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_X, 0, pos);
17399822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
17409822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
17419822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
174291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalY(int, int)} for the first pointer index (may be an
17430dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
174491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
174591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
174691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
174791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
174891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
174991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getY()
175091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
17519822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
17529822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public final float getHistoricalY(int pos) {
175391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_Y, 0, pos);
17549822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
17559822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
17569822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
175791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalPressure(int, int)} for the first pointer index (may be an
17580dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
175991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
176091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
176191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
176291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
176391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
176491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getPressure()
176591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_PRESSURE
17669822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
17679822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public final float getHistoricalPressure(int pos) {
176891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_PRESSURE, 0, pos);
17699822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
17709822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn
17719822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
177291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalSize(int, int)} for the first pointer index (may be an
17730dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * arbitrary pointer identifier).
177491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
177591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
177691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
177791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
177891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
177991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getSize()
178091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_SIZE
17819822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
17829822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    public final float getHistoricalSize(int pos) {
178391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_SIZE, 0, pos);
17849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1785cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
17869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
178791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalTouchMajor(int, int)} for the first pointer index (may be an
1788c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
178991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
179091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
179191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
179291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
179391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
179491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getTouchMajor()
179591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MAJOR
1796c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1797c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalTouchMajor(int pos) {
179891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MAJOR, 0, pos);
1799c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1800c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1801c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
180291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalTouchMinor(int, int)} for the first pointer index (may be an
1803c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
180491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
180591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
180691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
180791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
180891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
180991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getTouchMinor()
181091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MINOR
1811c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1812c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalTouchMinor(int pos) {
181391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MINOR, 0, pos);
1814c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1815c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1816c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
181791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalToolMajor(int, int)} for the first pointer index (may be an
1818c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
181991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
182091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
182191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
182291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
182391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
182491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getToolMajor()
182591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MAJOR
1826c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1827c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalToolMajor(int pos) {
182891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MAJOR, 0, pos);
1829c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1830c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1831c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
183291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalToolMinor(int, int)} for the first pointer index (may be an
1833c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
183491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
183591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
183691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
183791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
183891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
183991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getToolMinor()
184091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MINOR
1841c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1842c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalToolMinor(int pos) {
184391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MINOR, 0, pos);
1844c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1845c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1846c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
184791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalOrientation(int, int)} for the first pointer index (may be an
1848c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * arbitrary pointer identifier).
184991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
185091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
185191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
185291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
185391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
185491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getOrientation()
185591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_ORIENTATION
1856c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1857c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalOrientation(int pos) {
185891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_ORIENTATION, 0, pos);
1859c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
186091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
186191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
186291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistoricalAxisValue(int, int, int)} for the first pointer index (may be an
186391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * arbitrary pointer identifier).
186491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
186591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param axis The axis identifier for the axis value to retrieve.
186691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
186791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
186891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
186991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getHistorySize
187091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getAxisValue(int)
187191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
187291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
187391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     */
187491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public final float getHistoricalAxisValue(int axis, int pos) {
187591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, axis, 0, pos);
187691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
187791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
1878c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
18790dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns a historical X coordinate, as per {@link #getX(int)}, that
18800dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * occurred between this event and the previous event for the given pointer.
18810dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Only applies to ACTION_MOVE events.
1882cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
18830dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
18840dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
18859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param pos Which historical value to return; must be less than
18869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link #getHistorySize}
1887cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
18889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getHistorySize
188991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getX(int)
189091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
18919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
18920dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getHistoricalX(int pointerIndex, int pos) {
189391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_X, pointerIndex, pos);
18949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1895cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
18969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
18970dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns a historical Y coordinate, as per {@link #getY(int)}, that
18980dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * occurred between this event and the previous event for the given pointer.
18990dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Only applies to ACTION_MOVE events.
1900cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
19010dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
19020dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
19039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param pos Which historical value to return; must be less than
19049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link #getHistorySize}
1905cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
19069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getHistorySize
190791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getY(int)
190891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
19099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
19100dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getHistoricalY(int pointerIndex, int pos) {
191191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_Y, pointerIndex, pos);
19129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1913cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
19149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
19150dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns a historical pressure coordinate, as per {@link #getPressure(int)},
19160dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * that occurred between this event and the previous event for the given
19170dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * pointer.  Only applies to ACTION_MOVE events.
1918cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
19190dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
19200dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
19219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param pos Which historical value to return; must be less than
19229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link #getHistorySize}
19230dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     *
19249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getHistorySize
192591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getPressure(int)
192691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_PRESSURE
19279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
19280dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getHistoricalPressure(int pointerIndex, int pos) {
192991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_PRESSURE, pointerIndex, pos);
19309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1931cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
19329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
19330dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Returns a historical size coordinate, as per {@link #getSize(int)}, that
19340dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * occurred between this event and the previous event for the given pointer.
19350dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * Only applies to ACTION_MOVE events.
1936cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
19370dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
19380dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     * (the first pointer that is down) to {@link #getPointerCount()}-1.
19399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param pos Which historical value to return; must be less than
19409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link #getHistorySize}
19410dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn     *
19429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getHistorySize
194391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getSize(int)
194491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_SIZE
19459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
19460dd7cb4b4ef86eb7d4e837b1948501da66adeebeDianne Hackborn    public final float getHistoricalSize(int pointerIndex, int pos) {
194791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_SIZE, pointerIndex, pos);
19489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1949c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1950c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1951c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns a historical touch major axis coordinate, as per {@link #getTouchMajor(int)}, that
1952c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * occurred between this event and the previous event for the given pointer.
1953c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Only applies to ACTION_MOVE events.
1954c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
1955c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1956c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
1957c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pos Which historical value to return; must be less than
1958c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getHistorySize}
1959c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
1960c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @see #getHistorySize
196191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getTouchMajor(int)
196291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MAJOR
1963c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1964c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalTouchMajor(int pointerIndex, int pos) {
196591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MAJOR, pointerIndex, pos);
1966c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1967cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
19689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1969c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns a historical touch minor axis coordinate, as per {@link #getTouchMinor(int)}, that
1970c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * occurred between this event and the previous event for the given pointer.
1971c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Only applies to ACTION_MOVE events.
1972c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
1973c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1974c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
1975c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pos Which historical value to return; must be less than
1976c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getHistorySize}
1977c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
1978c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @see #getHistorySize
197991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getTouchMinor(int)
198091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOUCH_MINOR
1981c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
1982c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalTouchMinor(int pointerIndex, int pos) {
198391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MINOR, pointerIndex, pos);
1984c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
1985c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
1986c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
1987c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns a historical tool major axis coordinate, as per {@link #getToolMajor(int)}, that
1988c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * occurred between this event and the previous event for the given pointer.
1989c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Only applies to ACTION_MOVE events.
1990c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
1991c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
1992c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
1993c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pos Which historical value to return; must be less than
1994c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getHistorySize}
1995c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
1996c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @see #getHistorySize
199791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getToolMajor(int)
199891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MAJOR
1999c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
2000c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalToolMajor(int pointerIndex, int pos) {
200191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MAJOR, pointerIndex, pos);
2002c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
2003c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2004c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
2005c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns a historical tool minor axis coordinate, as per {@link #getToolMinor(int)}, that
2006c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * occurred between this event and the previous event for the given pointer.
2007c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Only applies to ACTION_MOVE events.
2008c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2009c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
2010c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
2011c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pos Which historical value to return; must be less than
2012c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getHistorySize}
2013c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2014c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @see #getHistorySize
201591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getToolMinor(int)
201691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_TOOL_MINOR
2017c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
2018c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalToolMinor(int pointerIndex, int pos) {
201991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MINOR, pointerIndex, pos);
2020c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
2021c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2022c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
2023c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Returns a historical orientation coordinate, as per {@link #getOrientation(int)}, that
2024c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * occurred between this event and the previous event for the given pointer.
2025c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Only applies to ACTION_MOVE events.
2026c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2027c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
2028c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
2029c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pos Which historical value to return; must be less than
2030c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getHistorySize}
2031c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2032c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @see #getHistorySize
203391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #getOrientation(int)
203491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_ORIENTATION
20359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2036c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final float getHistoricalOrientation(int pointerIndex, int pos) {
203791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, AXIS_ORIENTATION, pointerIndex, pos);
203891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
203991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
204091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
204191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Returns the historical value of the requested axis, as per {@link #getAxisValue(int, int)},
204291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * occurred between this event and the previous event for the given pointer.
204391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Only applies to ACTION_MOVE events.
204491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
204591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param axis The axis identifier for the axis value to retrieve.
204691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
204791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
204891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param pos Which historical value to return; must be less than
204991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * {@link #getHistorySize}
205091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @return The value of the axis, or 0 if the axis is not available.
205191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
205291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_X
205391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see #AXIS_Y
205491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     */
205591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public final float getHistoricalAxisValue(int axis, int pointerIndex, int pos) {
205691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetAxisValue(mNativePtr, axis, pointerIndex, pos);
20579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
2058cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
20599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
2060c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Populates a {@link PointerCoords} object with historical pointer coordinate data,
2061c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * as per {@link #getPointerCoords}, that occurred between this event and the previous
2062c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * event for the given pointer.
2063c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Only applies to ACTION_MOVE events.
2064c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2065c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
2066c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * (the first pointer that is down) to {@link #getPointerCount()}-1.
2067c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pos Which historical value to return; must be less than
2068c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * {@link #getHistorySize}
2069c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param outPointerCoords The pointer coordinate object to populate.
2070c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2071c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @see #getHistorySize
2072c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @see #getPointerCoords
207391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @see PointerCoords
2074c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
2075c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final void getHistoricalPointerCoords(int pointerIndex, int pos,
2076c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown            PointerCoords outPointerCoords) {
207791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeGetPointerCoords(mNativePtr, pointerIndex, pos, outPointerCoords);
2078c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
2079c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2080c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
208146b9ac0ae2162309774a7478cd9d4e578747bfc2Jeff Brown     * Returns a bitfield indicating which edges, if any, were touched by this
2082cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * MotionEvent. For touch events, clients can use this to determine if the
2083cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * user's finger was touching the edge of the display.
2084cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
20859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #EDGE_LEFT
20869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #EDGE_TOP
20879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #EDGE_RIGHT
20889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #EDGE_BOTTOM
20899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
20909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final int getEdgeFlags() {
209191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        return nativeGetEdgeFlags(mNativePtr);
20929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
2093cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
20949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
209585a3176704b5bfbeece9bd928369fbb76eec7dc6Jeff Brown     * Sets the bitfield indicating which edges, if any, were touched by this
2096cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     * MotionEvent.
2097cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
20989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getEdgeFlags()
20999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
21009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final void setEdgeFlags(int flags) {
210191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeSetEdgeFlags(mNativePtr, flags);
21029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
21039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
21049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
21059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Sets this event's action.
21069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
21079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final void setAction(int action) {
210891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeSetAction(mNativePtr, action);
21099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
21109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
21119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
21129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Adjust this event's location.
21139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param deltaX Amount to add to the current X coordinate of the event.
21149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param deltaY Amount to add to the current Y coordinate of the event.
21159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
21169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final void offsetLocation(float deltaX, float deltaY) {
211791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeOffsetLocation(mNativePtr, deltaX, deltaY);
21189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
2119cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
21209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
21219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Set this event's location.  Applies {@link #offsetLocation} with a
21229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * delta from the current location to the given new location.
2123cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
21249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param x New absolute X location.
21259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param y New absolute Y location.
21269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
21279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final void setLocation(float x, float y) {
212891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        float oldX = getX();
212991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        float oldY = getY();
213091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeOffsetLocation(mNativePtr, x - oldX, y - oldY);
21315c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown    }
21325c225b1680e696ae8bbf505a1997d6f720672f74Jeff Brown
213320e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown    /**
213420e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown     * Applies a transformation matrix to all of the points in the event.
213520e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown     *
213620e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown     * @param matrix The transformation matrix to apply.
213720e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown     */
213820e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown    public final void transform(Matrix matrix) {
213920e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown        if (matrix == null) {
214020e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown            throw new IllegalArgumentException("matrix must not be null");
214120e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown        }
214220e987bfc35d0ae6cb6344ead65ed44ee7cf8750Jeff Brown
214391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeTransform(mNativePtr, matrix);
21449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
2145cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
21469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
21479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Add a new movement to the batch of movements in this event.  The event's
2148c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * current location, position and size is updated to the new values.
2149c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * The current values in the event are added to a list of historical values.
215091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
2151cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Only applies to {@link #ACTION_MOVE} or {@link #ACTION_HOVER_MOVE} events.
2152cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy     *
2153c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param eventTime The time stamp (in ms) for this data.
21549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param x The new X position.
21559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param y The new Y position.
21569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param pressure The new pressure.
21579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param size The new size.
21589822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param metaState Meta key state.
21599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
21609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public final void addBatch(long eventTime, float x, float y,
21619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            float pressure, float size, int metaState) {
216291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        synchronized (gTmpPointerCoords) {
216391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            final PointerCoords pc = gTmpPointerCoords[0];
216491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.clear();
216591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.x = x;
216691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.y = y;
216791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.pressure = pressure;
216891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pc.size = size;
216991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            nativeAddBatch(mNativePtr, eventTime * NS_PER_MS, gTmpPointerCoords, metaState);
217091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
21719822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    }
2172cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
21739822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn    /**
2174c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Add a new movement to the batch of movements in this event.  The event's
2175c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * current location, position and size is updated to the new values.
2176c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * The current values in the event are added to a list of historical values.
217791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
2178cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Only applies to {@link #ACTION_MOVE} or {@link #ACTION_HOVER_MOVE} events.
21799822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     *
2180c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param eventTime The time stamp (in ms) for this data.
2181c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * @param pointerCoords The new pointer coordinates.
21829822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     * @param metaState Meta key state.
21839822d2b27330793ea4ba9c3316ef35f402f35fb4Dianne Hackborn     */
2184c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public final void addBatch(long eventTime, PointerCoords[] pointerCoords, int metaState) {
218591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeAddBatch(mNativePtr, eventTime * NS_PER_MS, pointerCoords, metaState);
21869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
2187cafdea61a85c8f5d0646cc9413a09346c637f43fRomain Guy
21889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    @Override
21899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public String toString() {
21909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        return "MotionEvent{" + Integer.toHexString(System.identityHashCode(this))
2191e838a427786f136155b618962bd18781be8e012dHuahui Wu            + " pointerId=" + getPointerId(0)
219291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            + " action=" + actionToString(getAction())
2193497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " x=" + getX()
2194497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " y=" + getY()
2195497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " pressure=" + getPressure()
2196497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " size=" + getSize()
2197497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " touchMajor=" + getTouchMajor()
2198497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " touchMinor=" + getTouchMinor()
2199497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " toolMajor=" + getToolMajor()
2200497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " toolMinor=" + getToolMinor()
2201497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " orientation=" + getOrientation()
220291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            + " meta=" + KeyEvent.metaStateToString(getMetaState())
2203497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " pointerCount=" + getPointerCount()
2204497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + " historySize=" + getHistorySize()
220591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            + " flags=0x" + Integer.toHexString(getFlags())
220691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            + " edgeFlags=0x" + Integer.toHexString(getEdgeFlags())
220791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            + " device=" + getDeviceId()
220891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            + " source=0x" + Integer.toHexString(getSource())
2209e838a427786f136155b618962bd18781be8e012dHuahui Wu            + (getPointerCount() > 1 ?
2210f93246923f0a8c85fddb508533d63d59977f75ebHuahui Wu                " pointerId2=" + getPointerId(1) + " x2=" + getX(1) + " y2=" + getY(1) : "")
2211497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            + "}";
2212497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown    }
2213497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown
2214497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown    /**
2215497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown     * Returns a string that represents the symbolic name of the specified action
221691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * such as "ACTION_DOWN", "ACTION_POINTER_DOWN(3)" or an equivalent numeric constant
221791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * such as "35" if unknown.
2218497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown     *
2219497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown     * @param action The action.
2220497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown     * @return The symbolic name of the specified action.
2221497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown     * @hide
2222497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown     */
2223497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown    public static String actionToString(int action) {
2224497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown        switch (action) {
2225497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            case ACTION_DOWN:
2226497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown                return "ACTION_DOWN";
2227497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            case ACTION_UP:
2228497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown                return "ACTION_UP";
2229497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            case ACTION_CANCEL:
2230497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown                return "ACTION_CANCEL";
223133bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown            case ACTION_OUTSIDE:
223233bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                return "ACTION_OUTSIDE";
2233497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            case ACTION_MOVE:
2234497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown                return "ACTION_MOVE";
2235cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown            case ACTION_HOVER_MOVE:
2236cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown                return "ACTION_HOVER_MOVE";
223733bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown            case ACTION_SCROLL:
223833bbfd2232ea9eaae9a9d87a05a95a430f09bd83Jeff Brown                return "ACTION_SCROLL";
2239497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown        }
2240497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown        int index = (action & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT;
2241497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown        switch (action & ACTION_MASK) {
2242497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            case ACTION_POINTER_DOWN:
2243497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown                return "ACTION_POINTER_DOWN(" + index + ")";
2244497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            case ACTION_POINTER_UP:
2245497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown                return "ACTION_POINTER_UP(" + index + ")";
2246497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown            default:
2247497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown                return Integer.toString(action);
2248497a92cc5ba2176b8a8484b0a7da040eac0e887bJeff Brown        }
22499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
22509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
225191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    /**
225291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * Returns a string that represents the symbolic name of the specified axis
22536f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * such as "AXIS_X" or an equivalent numeric constant such as "42" if unknown.
225491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     *
225591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @param axis The axis
225691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     * @return The symbolic name of the specified axis.
225791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown     */
225891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    public static String axisToString(int axis) {
22596f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        String symbolicName = AXIS_SYMBOLIC_NAMES.get(axis);
22606f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        return symbolicName != null ? symbolicName : Integer.toString(axis);
22616f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    }
22626f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
22636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    /**
2264cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * Gets an axis by its symbolic name such as "AXIS_X" or an
2265cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413Jeff Brown     * equivalent numeric constant such as "42".
22666f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     *
22676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @param symbolicName The symbolic name of the axis.
22686f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @return The axis or -1 if not found.
22696f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     * @see #keycodeToString
22706f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown     */
22716f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown    public static int axisFromString(String symbolicName) {
22726f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        if (symbolicName == null) {
22736f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown            throw new IllegalArgumentException("symbolicName must not be null");
22746f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        }
22756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
22766f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        final int count = AXIS_SYMBOLIC_NAMES.size();
22776f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        for (int i = 0; i < count; i++) {
22786f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown            if (symbolicName.equals(AXIS_SYMBOLIC_NAMES.valueAt(i))) {
22796f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                return i;
22806f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown            }
22816f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        }
22826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown
22836f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        try {
22846f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown            return Integer.parseInt(symbolicName, 10);
22856f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        } catch (NumberFormatException ex) {
22866f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown            return -1;
228791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
228891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown    }
228991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
22909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final Parcelable.Creator<MotionEvent> CREATOR
22919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            = new Parcelable.Creator<MotionEvent>() {
22929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        public MotionEvent createFromParcel(Parcel in) {
22936ec402b5ae33c8927694d8522b4cc6a5c8ba974eJeff Brown            in.readInt(); // skip token, we already know this is a MotionEvent
22946ec402b5ae33c8927694d8522b4cc6a5c8ba974eJeff Brown            return MotionEvent.createFromParcelBody(in);
22959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
22969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
22979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        public MotionEvent[] newArray(int size) {
22989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return new MotionEvent[size];
22999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
23009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    };
23019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
23026ec402b5ae33c8927694d8522b4cc6a5c8ba974eJeff Brown    /** @hide */
23036ec402b5ae33c8927694d8522b4cc6a5c8ba974eJeff Brown    public static MotionEvent createFromParcelBody(Parcel in) {
230491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        MotionEvent ev = obtain();
230591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        ev.mNativePtr = nativeReadFromParcel(ev.mNativePtr, in);
23066ec402b5ae33c8927694d8522b4cc6a5c8ba974eJeff Brown        return ev;
23076ec402b5ae33c8927694d8522b4cc6a5c8ba974eJeff Brown    }
230891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
23099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void writeToParcel(Parcel out, int flags) {
23106ec402b5ae33c8927694d8522b4cc6a5c8ba974eJeff Brown        out.writeInt(PARCEL_TOKEN_MOTION_EVENT);
231191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        nativeWriteToParcel(mNativePtr, out);
23129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
231391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
2314c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    /**
2315c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Transfer object for pointer coordinates.
2316c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2317c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Objects of this type can be used to manufacture new {@link MotionEvent} objects
2318c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * and to query pointer coordinate information in bulk.
2319c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     *
2320c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * Refer to {@link InputDevice} for information about how different kinds of
2321c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     * input devices and sources represent pointer coordinates.
2322c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown     */
2323c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    public static final class PointerCoords {
232491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        private static final int INITIAL_PACKED_AXIS_VALUES = 8;
23256f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown        private long mPackedAxisBits;
232691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        private float[] mPackedAxisValues;
232791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
232891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        /**
232991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * Creates a pointer coords object with all axes initialized to zero.
233091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         */
233191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        public PointerCoords() {
233291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
233391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
233491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        /**
233591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * Creates a pointer coords object as a copy of the
233691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * contents of another pointer coords object.
233791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
233891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @param other The pointer coords object to copy.
233991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         */
234091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        public PointerCoords(PointerCoords other) {
234191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            copyFrom(other);
234291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        }
234391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
2344c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
23456f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown         * The X component of the pointer movement.
234691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
234791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_X
2348c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2349c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float x;
2350c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2351c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
23526f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown         * The Y component of the pointer movement.
235391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
235491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_Y
2355c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2356c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float y;
2357c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2358c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
235991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * A normalized value that describes the pressure applied to the device
236091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * by a finger or other tool.
2361c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
236291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * although values higher than 1 may be generated depending on the calibration of
2363c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * the input device.
236491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
236591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_PRESSURE
2366c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2367c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float pressure;
2368c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2369c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
237091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * A normalized value that describes the approximate size of the pointer touch area
237191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * in relation to the maximum detectable size of the device.
237291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * It represents some approximation of the area of the screen being
2373c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * pressed; the actual value in pixels corresponding to the
2374c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * touch is normalized with the device specific range of values
2375c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * and scaled to a value between 0 and 1. The value of size can be used to
2376c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * determine fat touch events.
237791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
237891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_SIZE
2379c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2380c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float size;
2381c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2382c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
2383c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The length of the major axis of an ellipse that describes the touch area at
2384c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * the point of contact.
238591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * If the device is a touch screen, the length is reported in pixels, otherwise it is
238691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * reported in device-specific units.
238791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
238891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_TOUCH_MAJOR
2389c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2390c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float touchMajor;
2391c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2392c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
2393c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The length of the minor axis of an ellipse that describes the touch area at
2394c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * the point of contact.
239591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * If the device is a touch screen, the length is reported in pixels, otherwise it is
239691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * reported in device-specific units.
239791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
239891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_TOUCH_MINOR
2399c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2400c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float touchMinor;
2401c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2402c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
2403c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The length of the major axis of an ellipse that describes the size of
2404c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * the approaching tool.
2405c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The tool area represents the estimated size of the finger or pen that is
2406c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * touching the device independent of its actual touch area at the point of contact.
240791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * If the device is a touch screen, the length is reported in pixels, otherwise it is
240891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * reported in device-specific units.
240991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
241091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_TOOL_MAJOR
2411c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2412c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float toolMajor;
2413c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2414c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
2415c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The length of the minor axis of an ellipse that describes the size of
2416c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * the approaching tool.
2417c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The tool area represents the estimated size of the finger or pen that is
2418c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * touching the device independent of its actual touch area at the point of contact.
241991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * If the device is a touch screen, the length is reported in pixels, otherwise it is
242091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * reported in device-specific units.
242191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
242291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_TOOL_MINOR
2423c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2424c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float toolMinor;
2425c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown
2426c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        /**
2427c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * The orientation of the touch area and tool area in radians clockwise from vertical.
24286f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown         * An angle of 0 radians indicates that the major axis of contact is oriented
2429c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * upwards, is perfectly circular or is of unknown orientation.  A positive angle
2430c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * indicates that the major axis of contact is oriented to the right.  A negative angle
2431c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * indicates that the major axis of contact is oriented to the left.
24326d0fec2de3601821f4f44eeb7d7deedebb2b7117Jeff Brown         * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
2433c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         * (finger pointing fully right).
243491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
243591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_ORIENTATION
2436c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown         */
2437c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        public float orientation;
243891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
243991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        /**
244091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * Clears the contents of this object.
244191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * Resets all axes to zero.
244291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         */
244391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        public void clear() {
244491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            mPackedAxisBits = 0;
244591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
244691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            x = 0;
244791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            y = 0;
244891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pressure = 0;
244991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            size = 0;
245091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            touchMajor = 0;
245191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            touchMinor = 0;
245291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            toolMajor = 0;
245391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            toolMinor = 0;
245491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            orientation = 0;
2455c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        }
245691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
245791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        /**
245891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * Copies the contents of another pointer coords object.
245991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
246091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @param other The pointer coords object to copy.
246191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         */
246291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        public void copyFrom(PointerCoords other) {
24636f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown            final long bits = other.mPackedAxisBits;
246491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            mPackedAxisBits = bits;
246591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            if (bits != 0) {
246691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                final float[] otherValues = other.mPackedAxisValues;
24676f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                final int count = Long.bitCount(bits);
246891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                float[] values = mPackedAxisValues;
246991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                if (values == null || count > values.length) {
247091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    values = new float[otherValues.length];
247191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    mPackedAxisValues = values;
247291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                }
247391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                System.arraycopy(otherValues, 0, values, 0, count);
247491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            }
247591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
247691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            x = other.x;
247791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            y = other.y;
247891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            pressure = other.pressure;
247991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            size = other.size;
248091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            touchMajor = other.touchMajor;
248191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            touchMinor = other.touchMinor;
248291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            toolMajor = other.toolMajor;
248391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            toolMinor = other.toolMinor;
248491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            orientation = other.orientation;
2485c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        }
248691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
248791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        /**
248891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * Gets the value associated with the specified axis.
248991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
249091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @param axis The axis identifier for the axis value to retrieve.
249191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @return The value associated with the axis, or 0 if none.
249291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
249391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_X
249491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_Y
249591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         */
249691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        public float getAxisValue(int axis) {
249791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            switch (axis) {
249891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_X:
249991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return x;
250091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_Y:
250191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return y;
250291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_PRESSURE:
250391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return pressure;
250491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_SIZE:
250591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return size;
250691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOUCH_MAJOR:
250791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return touchMajor;
250891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOUCH_MINOR:
250991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return touchMinor;
251091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOOL_MAJOR:
251191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return toolMajor;
251291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOOL_MINOR:
251391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return toolMinor;
251491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_ORIENTATION:
251591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return orientation;
251691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                default: {
25176f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    if (axis < 0 || axis > 63) {
25186f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                        throw new IllegalArgumentException("Axis out of range.");
25196f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    }
25206f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    final long bits = mPackedAxisBits;
25216f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    final long axisBit = 1L << axis;
252291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    if ((bits & axisBit) == 0) {
252391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                        return 0;
252491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    }
25256f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    final int index = Long.bitCount(bits & (axisBit - 1L));
252691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    return mPackedAxisValues[index];
252791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                }
252891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            }
2529c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        }
253091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown
253191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        /**
253291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * Sets the value associated with the specified axis.
253391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
253491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @param axis The axis identifier for the axis value to assign.
253591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @param value The value to set.
253691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         *
253791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_X
253891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         * @see MotionEvent#AXIS_Y
253991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown         */
254091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown        public void setAxisValue(int axis, float value) {
254191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            switch (axis) {
254291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_X:
254391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    x = value;
254491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
254591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_Y:
254691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    y = value;
254791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
254891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_PRESSURE:
254991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    pressure = value;
255091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
255191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_SIZE:
255291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    size = value;
255391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
255491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOUCH_MAJOR:
255591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    touchMajor = value;
255691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
255791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOUCH_MINOR:
255891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    touchMinor = value;
255991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
256091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOOL_MAJOR:
256191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    toolMajor = value;
256291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
256391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_TOOL_MINOR:
256491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    toolMinor = value;
256591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
256691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                case AXIS_ORIENTATION:
256791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    orientation = value;
256891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    break;
256991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                default: {
25706f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    if (axis < 0 || axis > 63) {
25716f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                        throw new IllegalArgumentException("Axis out of range.");
25726f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    }
25736f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    final long bits = mPackedAxisBits;
25746f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    final long axisBit = 1L << axis;
25756f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                    final int index = Long.bitCount(bits & (axisBit - 1L));
257691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    float[] values = mPackedAxisValues;
257791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    if ((bits & axisBit) == 0) {
257891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                        if (values == null) {
257991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                            values = new float[INITIAL_PACKED_AXIS_VALUES];
258091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                            mPackedAxisValues = values;
258191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                        } else {
25826f2fba428ca5e77a26d991ad728e346cc47609eeJeff Brown                            final int count = Long.bitCount(bits);
258391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                            if (count < values.length) {
258491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                if (index != count) {
258591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                    System.arraycopy(values, index, values, index + 1,
258691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                            count - index);
258791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                }
258891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                            } else {
258991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                float[] newValues = new float[count * 2];
259091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                System.arraycopy(values, 0, newValues, 0, index);
259191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                System.arraycopy(values, index, newValues, index + 1,
259291c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                        count - index);
259391c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                values = newValues;
259491c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                                mPackedAxisValues = values;
259591c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                            }
259691c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                        }
259791c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                        mPackedAxisBits = bits | axisBit;
259891c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    }
259991c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                    values[index] = value;
260091c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown                }
260191c69ab01539f7ba28708f41ec1835cc2920d0a0Jeff Brown            }
2602c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown        }
2603c5ed5910c9ef066cec6a13bbb404ec57b1e92637Jeff Brown    }
26049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2605