| /* |
| * Copyright (C) 2019 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #pragma once |
| |
| #include <input/Input.h> |
| #include <bitset> |
| #include <optional> |
| |
| namespace android { |
| namespace inputdispatcher { |
| |
| /* Specifies which events are to be canceled and why. */ |
| struct CancelationOptions { |
| enum class Mode { |
| CANCEL_ALL_EVENTS = 0, |
| CANCEL_POINTER_EVENTS = 1, |
| CANCEL_NON_POINTER_EVENTS = 2, |
| CANCEL_FALLBACK_EVENTS = 3, |
| ftl_last = CANCEL_FALLBACK_EVENTS, |
| }; |
| |
| // The criterion to use to determine which events should be canceled. |
| Mode mode; |
| |
| // Descriptive reason for the cancelation. |
| const char* reason; |
| |
| // The specific keycode of the key event to cancel, or nullopt to cancel any key event. |
| std::optional<int32_t> keyCode = std::nullopt; |
| |
| // The specific device id of events to cancel, or nullopt to cancel events from any device. |
| std::optional<int32_t> deviceId = std::nullopt; |
| |
| // The specific display id of events to cancel, or nullopt to cancel events on any display. |
| std::optional<int32_t> displayId = std::nullopt; |
| |
| // The specific pointers to cancel, or nullopt to cancel all pointer events |
| std::optional<std::bitset<MAX_POINTER_ID + 1>> pointerIds = std::nullopt; |
| |
| CancelationOptions(Mode mode, const char* reason) : mode(mode), reason(reason) {} |
| }; |
| |
| } // namespace inputdispatcher |
| } // namespace android |