blob: f267e5532b9fa922b457349d9dde088cb7c0bf5e [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
25class InputWindowHandle;
26
27namespace inputdispatcher {
28
29struct TouchState {
30 bool down;
31 bool split;
32 int32_t deviceId; // id of the device that is currently down, others are rejected
33 uint32_t source; // source of the device that is current down, others are rejected
34 int32_t displayId; // id to the display that currently has a touch, others are rejected
35 std::vector<TouchedWindow> windows;
36
Garfield Tane84e6f92019-08-29 17:28:41 -070037 std::vector<TouchedMonitor> gestureMonitors;
38
39 TouchState();
40 ~TouchState();
41 void reset();
42 void copyFrom(const TouchState& other);
43 void addOrUpdateWindow(const sp<android::InputWindowHandle>& windowHandle, int32_t targetFlags,
44 BitSet32 pointerIds);
45 void addPortalWindow(const sp<android::InputWindowHandle>& windowHandle);
46 void addGestureMonitors(const std::vector<TouchedMonitor>& monitors);
Garfield Tane84e6f92019-08-29 17:28:41 -070047 void removeWindowByToken(const sp<IBinder>& token);
48 void filterNonAsIsTouchWindows();
49 void filterNonMonitors();
50 sp<InputWindowHandle> getFirstForegroundWindowHandle() const;
51 bool isSlippery() const;
52};
53
54} // namespace inputdispatcher
55} // namespace android
56
57#endif // _UI_INPUT_INPUTDISPATCHER_TOUCHSTATE_H