blob: e0a73247eb4dc62871366366d11fdcc498591c65 [file] [log] [blame]
Siarhei Vishniakou2defec02023-06-08 17:24:44 -07001/*
2 * Copyright 2023 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#pragma once
18
19#include <android-base/logging.h>
20#include "InputDispatcherPolicyInterface.h"
21
22namespace android {
23
24// --- FakeInputDispatcherPolicy ---
25
26class FakeInputDispatcherPolicy : public InputDispatcherPolicyInterface {
27public:
28 FakeInputDispatcherPolicy() = default;
29 virtual ~FakeInputDispatcherPolicy() = default;
30
31private:
32 void notifyConfigurationChanged(nsecs_t) override {}
33
34 void notifyNoFocusedWindowAnr(
35 const std::shared_ptr<InputApplicationHandle>& applicationHandle) override {
36 LOG(ERROR) << "There is no focused window for " << applicationHandle->getName();
37 }
38
39 void notifyWindowUnresponsive(const sp<IBinder>& connectionToken, std::optional<gui::Pid> pid,
40 const std::string& reason) override {
41 LOG(ERROR) << "Window is not responding: " << reason;
42 }
43
44 void notifyWindowResponsive(const sp<IBinder>& connectionToken,
45 std::optional<gui::Pid> pid) override {}
46
47 void notifyInputChannelBroken(const sp<IBinder>&) override {}
48
49 void notifyFocusChanged(const sp<IBinder>&, const sp<IBinder>&) override {}
50
51 void notifySensorEvent(int32_t deviceId, InputDeviceSensorType sensorType,
52 InputDeviceSensorAccuracy accuracy, nsecs_t timestamp,
53 const std::vector<float>& values) override {}
54
55 void notifySensorAccuracy(int32_t deviceId, InputDeviceSensorType sensorType,
56 InputDeviceSensorAccuracy accuracy) override {}
57
58 void notifyVibratorState(int32_t deviceId, bool isOn) override {}
59
60 bool filterInputEvent(const InputEvent& inputEvent, uint32_t policyFlags) override {
61 return true; // dispatch event normally
62 }
63
64 void interceptKeyBeforeQueueing(const KeyEvent&, uint32_t&) override {}
65
Yeabkal Wubshit88a90412023-12-21 18:23:04 -080066 void interceptMotionBeforeQueueing(int32_t, uint32_t, int32_t, nsecs_t, uint32_t&) override {}
Siarhei Vishniakou2defec02023-06-08 17:24:44 -070067
68 nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>&, const KeyEvent&, uint32_t) override {
69 return 0;
70 }
71
72 std::optional<KeyEvent> dispatchUnhandledKey(const sp<IBinder>&, const KeyEvent&,
73 uint32_t) override {
74 return {};
75 }
76
77 void notifySwitch(nsecs_t, uint32_t, uint32_t, uint32_t) override {}
78
79 void pokeUserActivity(nsecs_t, int32_t, int32_t) override {}
80
81 void onPointerDownOutsideFocus(const sp<IBinder>& newToken) override {}
82
83 void setPointerCapture(const PointerCaptureRequest&) override {}
84
85 void notifyDropWindow(const sp<IBinder>&, float x, float y) override {}
86
87 void notifyDeviceInteraction(DeviceId deviceId, nsecs_t timestamp,
88 const std::set<gui::Uid>& uids) override {}
Prabir Pradhanbf3c8322024-02-23 02:38:36 +000089
90 gui::Uid getPackageUid(std::string) override { return gui::Uid::INVALID; }
Siarhei Vishniakou2defec02023-06-08 17:24:44 -070091};
92
93} // namespace android