blob: 83ca90197b8d623f7c36b0b0602fa3a936a69abf [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_TOUCHSTATE_H
18#define _UI_INPUT_INPUTDISPATCHER_TOUCHSTATE_H
19
20#include "Monitor.h"
21#include "TouchedWindow.h"
22
23namespace android {
24
chaviw98318de2021-05-19 16:45:23 -050025namespace gui {
26class WindowInfoHandle;
27}
Garfield Tane84e6f92019-08-29 17:28:41 -070028
29namespace inputdispatcher {
30
31struct TouchState {
32 bool down;
33 bool split;
34 int32_t deviceId; // id of the device that is currently down, others are rejected
35 uint32_t source; // source of the device that is current down, others are rejected
36 int32_t displayId; // id to the display that currently has a touch, others are rejected
37 std::vector<TouchedWindow> windows;
38
Prabir Pradhan0a99c922021-09-03 08:27:53 -070039 std::vector<Monitor> gestureMonitors;
Garfield Tane84e6f92019-08-29 17:28:41 -070040
41 TouchState();
42 ~TouchState();
43 void reset();
44 void copyFrom(const TouchState& other);
chaviw98318de2021-05-19 16:45:23 -050045 void addOrUpdateWindow(const sp<android::gui::WindowInfoHandle>& windowHandle,
46 int32_t targetFlags, BitSet32 pointerIds);
Prabir Pradhan0a99c922021-09-03 08:27:53 -070047 void addGestureMonitors(const std::vector<Monitor>& monitors);
Garfield Tane84e6f92019-08-29 17:28:41 -070048 void removeWindowByToken(const sp<IBinder>& token);
49 void filterNonAsIsTouchWindows();
Prabir Pradhan07e05b62021-11-19 03:57:24 -080050 void filterWindowsExcept(const sp<IBinder>& token);
chaviw98318de2021-05-19 16:45:23 -050051 sp<android::gui::WindowInfoHandle> getFirstForegroundWindowHandle() const;
Garfield Tane84e6f92019-08-29 17:28:41 -070052 bool isSlippery() const;
Siarhei Vishniakouca205502021-07-16 21:31:58 +000053 sp<android::gui::WindowInfoHandle> getWallpaperWindow() const;
Prabir Pradhan07e05b62021-11-19 03:57:24 -080054 sp<android::gui::WindowInfoHandle> getWindow(const sp<IBinder>&) const;
Garfield Tane84e6f92019-08-29 17:28:41 -070055};
56
57} // namespace inputdispatcher
58} // namespace android
59
60#endif // _UI_INPUT_INPUTDISPATCHER_TOUCHSTATE_H