1 /*
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 
17 #pragma once
18 
19 #include <ftl/flags.h>
20 
21 namespace android::inputdispatcher {
22 
23 enum class InputTargetFlags : uint32_t {
24     /* This flag indicates that the event is being delivered to a foreground application. */
25     FOREGROUND = 1 << 0,
26 
27     /* This flag indicates that the MotionEvent falls within the area of the target
28      * obscured by another visible window above it.  The motion event should be
29      * delivered with flag AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED. */
30     WINDOW_IS_OBSCURED = 1 << 1,
31 
32     /* This flag indicates that a motion event is being split across multiple windows. */
33     SPLIT = 1 << 2,
34 
35     /* This flag indicates that the pointer coordinates dispatched to the application
36      * will be zeroed out to avoid revealing information to an application. This is
37      * used in conjunction with FLAG_DISPATCH_AS_OUTSIDE to prevent apps not sharing
38      * the same UID from watching all touches. */
39     ZERO_COORDS = 1 << 3,
40 
41     /* This flag indicates that the event will not cause a focus change if it is directed to an
42      * unfocused window, even if it an ACTION_DOWN. This is typically used to allow gestures to be
43      * directed to an unfocused window without bringing it into focus. The motion event should be
44      * delivered with flag AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE. */
45     NO_FOCUS_CHANGE = 1 << 4,
46 
47     /* This flag indicates that the target of a MotionEvent is partly or wholly
48      * obscured by another visible window above it.  The motion event should be
49      * delivered with flag AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED. */
50     WINDOW_IS_PARTIALLY_OBSCURED = 1 << 14,
51 };
52 
53 } // namespace android::inputdispatcher
54