Siarhei Vishniakou | 2defec0 | 2023-06-08 17:24:44 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 22 | namespace android { |
| 23 | |
| 24 | // --- FakeInputDispatcherPolicy --- |
| 25 | |
| 26 | class FakeInputDispatcherPolicy : public InputDispatcherPolicyInterface { |
| 27 | public: |
| 28 | FakeInputDispatcherPolicy() = default; |
| 29 | virtual ~FakeInputDispatcherPolicy() = default; |
| 30 | |
| 31 | private: |
| 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 Wubshit | 88a9041 | 2023-12-21 18:23:04 -0800 | [diff] [blame] | 66 | void interceptMotionBeforeQueueing(int32_t, uint32_t, int32_t, nsecs_t, uint32_t&) override {} |
Siarhei Vishniakou | 2defec0 | 2023-06-08 17:24:44 -0700 | [diff] [blame] | 67 | |
| 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 Pradhan | bf3c832 | 2024-02-23 02:38:36 +0000 | [diff] [blame] | 89 | |
| 90 | gui::Uid getPackageUid(std::string) override { return gui::Uid::INVALID; } |
Siarhei Vishniakou | 2defec0 | 2023-06-08 17:24:44 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | } // namespace android |