blob: 2093b0636ab77c1ee9b1ff56da2d29196741626d [file] [log] [blame]
Prabir Pradhan29814f22024-06-18 14:53:10 +00001/**
2 * Copyright 2024, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os;
18
19import android.os.IInputConstants;
20
21/**
22 * Flag definitions for MotionEvents.
23 * @hide
24 */
25@Backing(type="int")
26enum MotionEventFlag {
27
28 /**
29 * This flag indicates that the window that received this motion event is partly
30 * or wholly obscured by another visible window above it and the event directly passed through
31 * the obscured area.
32 *
33 * A security sensitive application can check this flag to identify situations in which
34 * a malicious application may have covered up part of its content for the purpose
35 * of misleading the user or hijacking touches. An appropriate response might be
36 * to drop the suspect touches or to take additional precautions to confirm the user's
37 * actual intent.
38 */
39 WINDOW_IS_OBSCURED = 0x1,
40
41 /**
42 * This flag indicates that the window that received this motion event is partly
43 * or wholly obscured by another visible window above it and the event did not directly pass
44 * through the obscured area.
45 *
46 * A security sensitive application can check this flag to identify situations in which
47 * a malicious application may have covered up part of its content for the purpose
48 * of misleading the user or hijacking touches. An appropriate response might be
49 * to drop the suspect touches or to take additional precautions to confirm the user's
50 * actual intent.
51 *
52 * Unlike FLAG_WINDOW_IS_OBSCURED, this is only true if the window that received this event is
53 * obstructed in areas other than the touched location.
54 */
55 WINDOW_IS_PARTIALLY_OBSCURED = 0x2,
56
57 /**
58 * This private flag is only set on {@link #ACTION_HOVER_MOVE} events and indicates that
59 * this event will be immediately followed by a {@link #ACTION_HOVER_EXIT}. It is used to
60 * prevent generating redundant {@link #ACTION_HOVER_ENTER} events.
61 * @hide
62 */
63 HOVER_EXIT_PENDING = 0x4,
64
65 /**
66 * This flag indicates that the event has been generated by a gesture generator. It
67 * provides a hint to the GestureDetector to not apply any touch slop.
68 *
69 * @hide
70 */
71 IS_GENERATED_GESTURE = 0x8,
72
73 /**
74 * This flag is only set for events with {@link #ACTION_POINTER_UP} and {@link #ACTION_CANCEL}.
75 * It indicates that the pointer going up was an unintentional user touch. When FLAG_CANCELED
76 * is set, the typical actions that occur in response for a pointer going up (such as click
77 * handlers, end of drawing) should be aborted. This flag is typically set when the user was
78 * accidentally touching the screen, such as by gripping the device, or placing the palm on the
79 * screen.
80 *
81 * @see #ACTION_POINTER_UP
82 * @see #ACTION_CANCEL
83 */
84 CANCELED = IInputConstants.INPUT_EVENT_FLAG_CANCELED,
85
86 /**
87 * This flag indicates that the event will not cause a focus change if it is directed to an
88 * unfocused window, even if it an {@link #ACTION_DOWN}. This is typically used with pointer
89 * gestures to allow the user to direct gestures to an unfocused window without bringing the
90 * window into focus.
91 * @hide
92 */
93 NO_FOCUS_CHANGE = 0x40,
94
95 /**
96 * This flag indicates that the event has a valid value for AXIS_ORIENTATION.
97 *
98 * This is a private flag that is not used in Java.
99 * @hide
100 */
101 PRIVATE_FLAG_SUPPORTS_ORIENTATION = 0x80,
102
103 /**
104 * This flag indicates that the pointers' AXIS_ORIENTATION can be used to precisely determine
105 * the direction in which the tool is pointing. The value of the orientation axis will be in
106 * the range [-pi, pi], which represents a full circle. This is usually supported by devices
107 * like styluses.
108 *
109 * Conversely, AXIS_ORIENTATION cannot be used to tell which direction the tool is pointing
110 * when this flag is not set. In this case, the axis value will have a range of [-pi/2, pi/2],
111 * which represents half a circle. This is usually the case for devices like touchscreens and
112 * touchpads, for which it is difficult to tell which direction along the major axis of the
113 * touch ellipse the finger is pointing.
114 *
115 * This is a private flag that is not used in Java.
116 * @hide
117 */
118 PRIVATE_FLAG_SUPPORTS_DIRECTIONAL_ORIENTATION = 0x100,
119
120 /**
121 * The input event was generated or modified by accessibility service.
122 * Shared by both KeyEvent and MotionEvent flags, so this value should not overlap with either
123 * set of flags, including in input/Input.h and in android/input.h.
124 */
125 IS_ACCESSIBILITY_EVENT = IInputConstants.INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
126
127 /**
128 * Private flag that indicates when the system has detected that this motion event
129 * may be inconsistent with respect to the sequence of previously delivered motion events,
130 * such as when a pointer move event is sent but the pointer is not down.
131 *
132 * @hide
133 * @see #isTainted
134 * @see #setTainted
135 */
136 TAINTED = IInputConstants.INPUT_EVENT_FLAG_TAINTED,
137
138 /**
139 * Private flag indicating that this event was synthesized by the system and should be delivered
140 * to the accessibility focused view first. When being dispatched such an event is not handled
141 * by predecessors of the accessibility focused view and after the event reaches that view the
142 * flag is cleared and normal event dispatch is performed. This ensures that the platform can
143 * click on any view that has accessibility focus which is semantically equivalent to asking the
144 * view to perform a click accessibility action but more generic as views not implementing click
145 * action correctly can still be activated.
146 *
147 * @hide
148 * @see #isTargetAccessibilityFocus()
149 * @see #setTargetAccessibilityFocus(boolean)
150 */
151 TARGET_ACCESSIBILITY_FOCUS = 0x40000000,
152}