blob: 2f634d58eaf4965dc3ea22afe88db2a4ab9b09fb [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/properties.h>
20#include <android/os/IInputConstants.h>
21#include <gui/InputApplication.h>
22
23namespace android {
24
25namespace inputdispatcher {
26
27class FakeApplicationHandle : public InputApplicationHandle {
28public:
29 FakeApplicationHandle() {
30 static const std::chrono::duration DISPATCHING_TIMEOUT = std::chrono::milliseconds(
31 android::os::IInputConstants::UNMULTIPLIED_DEFAULT_DISPATCHING_TIMEOUT_MILLIS *
32 android::base::HwTimeoutMultiplier());
33 mInfo.name = "Fake Application";
34 mInfo.token = sp<BBinder>::make();
35 mInfo.dispatchingTimeoutMillis =
36 std::chrono::duration_cast<std::chrono::milliseconds>(DISPATCHING_TIMEOUT).count();
37 }
38 virtual ~FakeApplicationHandle() {}
39
40 bool updateInfo() override { return true; }
41
42 void setDispatchingTimeout(std::chrono::milliseconds timeout) {
43 mInfo.dispatchingTimeoutMillis = timeout.count();
44 }
45};
46
47} // namespace inputdispatcher
48} // namespace android