blob: fec5f83638c203af2b83f629dfe49a9efb5a41d8 [file] [log] [blame]
Garfield Tane84e6f92019-08-29 17:28:41 -07001/*
2 * Copyright (C) 2019 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#ifndef _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H
18#define _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H
19
Vaibhav Devmurariff798f32022-05-09 23:45:04 +000020#include <utils/BitSet.h>
Garfield Tane84e6f92019-08-29 17:28:41 -070021#include <optional>
22
Vaibhav Devmurariff798f32022-05-09 23:45:04 +000023namespace android {
24namespace inputdispatcher {
Garfield Tane84e6f92019-08-29 17:28:41 -070025
26/* Specifies which events are to be canceled and why. */
27struct CancelationOptions {
28 enum Mode {
29 CANCEL_ALL_EVENTS = 0,
30 CANCEL_POINTER_EVENTS = 1,
31 CANCEL_NON_POINTER_EVENTS = 2,
32 CANCEL_FALLBACK_EVENTS = 3,
33 };
34
35 // The criterion to use to determine which events should be canceled.
36 Mode mode;
37
38 // Descriptive reason for the cancelation.
39 const char* reason;
40
41 // The specific keycode of the key event to cancel, or nullopt to cancel any key event.
42 std::optional<int32_t> keyCode = std::nullopt;
43
44 // The specific device id of events to cancel, or nullopt to cancel events from any device.
45 std::optional<int32_t> deviceId = std::nullopt;
46
47 // The specific display id of events to cancel, or nullopt to cancel events on any display.
48 std::optional<int32_t> displayId = std::nullopt;
49
Vaibhav Devmurariff798f32022-05-09 23:45:04 +000050 // The specific pointers to cancel, or nullopt to cancel all pointer events
51 std::optional<BitSet32> pointerIds = std::nullopt;
52
Garfield Tane84e6f92019-08-29 17:28:41 -070053 CancelationOptions(Mode mode, const char* reason) : mode(mode), reason(reason) {}
54};
55
Vaibhav Devmurariff798f32022-05-09 23:45:04 +000056} // namespace inputdispatcher
57} // namespace android
Garfield Tane84e6f92019-08-29 17:28:41 -070058
59#endif // _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H