blob: 5dd7bc4f8b5f43345a8ceea782e17c64355ee565 [file] [log] [blame]
Prabir Pradhanbaa5c822019-08-30 15:27:05 -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
Prabir Pradhan9244aea2020-02-05 20:31:40 -080017#include "../Macros.h"
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070018
19#include "InputMapper.h"
20
Harry Cuttsea73eaa2023-01-16 17:55:46 +000021#include <sstream>
22
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070023#include "InputDevice.h"
Prabir Pradhan3f7545f2022-10-19 16:56:39 +000024#include "input/PrintTools.h"
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070025
26namespace android {
27
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080028InputMapper::InputMapper(InputDeviceContext& deviceContext) : mDeviceContext(deviceContext) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070029
30InputMapper::~InputMapper() {}
31
Harry Cuttsd02ea102023-03-17 18:21:30 +000032void InputMapper::populateDeviceInfo(InputDeviceInfo& info) {
33 info.addSource(getSources());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070034}
35
36void InputMapper::dump(std::string& dump) {}
37
Arpit Singhed6c3de2023-04-05 19:24:37 +000038std::list<NotifyArgs> InputMapper::reconfigure(nsecs_t when, const InputReaderConfiguration& config,
Arpit Singh4be4eef2023-03-28 14:26:01 +000039 uint32_t changes) {
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070040 return {};
41}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070042
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070043std::list<NotifyArgs> InputMapper::reset(nsecs_t when) {
44 return {};
45}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070046
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070047std::list<NotifyArgs> InputMapper::timeoutExpired(nsecs_t when) {
48 return {};
49}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070050
51int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {
52 return AKEY_STATE_UNKNOWN;
53}
54
55int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) {
56 return AKEY_STATE_UNKNOWN;
57}
58
59int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) {
60 return AKEY_STATE_UNKNOWN;
61}
62
Philip Junker4af3b3d2021-12-14 10:36:55 +010063int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const {
64 return AKEYCODE_UNKNOWN;
65}
66
Siarhei Vishniakou74007942022-06-13 13:57:47 -070067bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes,
68 uint8_t* outFlags) {
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070069 return false;
70}
71
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070072std::list<NotifyArgs> InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat,
73 int32_t token) {
74 return {};
75}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070076
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070077std::list<NotifyArgs> InputMapper::cancelVibrate(int32_t token) {
78 return {};
79}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070080
Chris Ye87143712020-11-10 05:05:58 +000081bool InputMapper::isVibrating() {
82 return false;
83}
84
85std::vector<int32_t> InputMapper::getVibratorIds() {
86 return {};
87}
88
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070089std::list<NotifyArgs> InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {
90 return {};
91}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070092
Chris Yef59a2f42020-10-16 12:55:26 -070093bool InputMapper::enableSensor(InputDeviceSensorType sensorType,
94 std::chrono::microseconds samplingPeriod,
95 std::chrono::microseconds maxBatchReportLatency) {
96 return true;
97}
98
99void InputMapper::disableSensor(InputDeviceSensorType sensorType) {}
100
101void InputMapper::flushSensor(InputDeviceSensorType sensorType) {}
102
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700103int32_t InputMapper::getMetaState() {
104 return 0;
105}
106
Arthur Hungcb40a002021-08-03 14:31:01 +0000107bool InputMapper::updateMetaState(int32_t keyCode) {
108 return false;
109}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700110
Siarhei Vishniakou2935db72022-09-22 13:35:22 -0700111std::list<NotifyArgs> InputMapper::updateExternalStylusState(const StylusState& state) {
112 return {};
113}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700114
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700115status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800116 return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700117}
118
119void InputMapper::bumpGeneration() {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800120 getDeviceContext().bumpGeneration();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700121}
122
123void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
124 const char* name) {
Harry Cuttsea73eaa2023-01-16 17:55:46 +0000125 std::stringstream out;
126 out << INDENT4 << name << ": " << axis << "\n";
127 dump += out.str();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700128}
129
130void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
131 dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
Prabir Pradhan3f7545f2022-10-19 16:56:39 +0000132 dump += StringPrintf(INDENT4 "Pressure: %s\n", toString(state.pressure).c_str());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700133 dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
134 dump += StringPrintf(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType);
135}
136
137} // namespace android