blob: e154ed3711872848e7a4d498a210e8bbc4bb50f5 [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
Garfield Tane84e6f92019-08-29 17:28:41 -070039 TouchState();
40 ~TouchState();
41 void reset();
42 void copyFrom(const TouchState& other);
chaviw98318de2021-05-19 16:45:23 -050043 void addOrUpdateWindow(const sp<android::gui::WindowInfoHandle>& windowHandle,
44 int32_t targetFlags, BitSet32 pointerIds);
Garfield Tane84e6f92019-08-29 17:28:41 -070045 void removeWindowByToken(const sp<IBinder>& token);
46 void filterNonAsIsTouchWindows();
Prabir Pradhan07e05b62021-11-19 03:57:24 -080047 void filterWindowsExcept(const sp<IBinder>& token);
chaviw98318de2021-05-19 16:45:23 -050048 sp<android::gui::WindowInfoHandle> getFirstForegroundWindowHandle() const;
Garfield Tane84e6f92019-08-29 17:28:41 -070049 bool isSlippery() const;
Siarhei Vishniakouca205502021-07-16 21:31:58 +000050 sp<android::gui::WindowInfoHandle> getWallpaperWindow() const;
Prabir Pradhan07e05b62021-11-19 03:57:24 -080051 sp<android::gui::WindowInfoHandle> getWindow(const sp<IBinder>&) const;
Garfield Tane84e6f92019-08-29 17:28:41 -070052};
53
54} // namespace inputdispatcher
55} // namespace android
56
57#endif // _UI_INPUT_INPUTDISPATCHER_TOUCHSTATE_H