diff options
author | Garfield Tan <xutan@google.com> | 2019-08-29 17:28:41 -0700 |
---|---|---|
committer | Prabir Pradhan <prabirmsp@google.com> | 2019-09-19 11:50:24 -0700 |
commit | e84e6f99d4fdd3fdaf3d8514d44a916175a16e6e (patch) | |
tree | e243f1409a3f37a4aae65a3b08f35492da03eb83 /services/inputflinger/dispatcher/CancelationOptions.h | |
parent | 0fc2fa7e6b85d90f449ba8ba843784d1284db862 (diff) | |
download | native-e84e6f99d4fdd3fdaf3d8514d44a916175a16e6e.tar.gz |
Divide InputDispatcher into several files.
This CL does:
1) Isolate implementation details of InputDispatcher from outside and
only expose necessary header files;
2) Move implementation details into android::inputdispatcher namespace;
3) Make input dispatcher a static library for inputflinger to link
against;
4) Add InputDispatcherFactory.{h,cpp} to isolate implementation details
in InputDispatcher.h from InputManager.
Bug: 140139676
Test: Touches on touchscreen can be dispatched to right windows.
Change-Id: Ib61c16fd41f3f76f538a3de9b54f31ac304e03a5
Diffstat (limited to 'services/inputflinger/dispatcher/CancelationOptions.h')
-rw-r--r-- | services/inputflinger/dispatcher/CancelationOptions.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/services/inputflinger/dispatcher/CancelationOptions.h b/services/inputflinger/dispatcher/CancelationOptions.h new file mode 100644 index 0000000000..99e2108dbf --- /dev/null +++ b/services/inputflinger/dispatcher/CancelationOptions.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H +#define _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H + +#include <optional> + +namespace android::inputdispatcher { + +/* Specifies which events are to be canceled and why. */ +struct CancelationOptions { + enum Mode { + CANCEL_ALL_EVENTS = 0, + CANCEL_POINTER_EVENTS = 1, + CANCEL_NON_POINTER_EVENTS = 2, + CANCEL_FALLBACK_EVENTS = 3, + }; + + // 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; + + CancelationOptions(Mode mode, const char* reason) : mode(mode), reason(reason) {} +}; + +} // namespace android::inputdispatcher + +#endif // _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H |