blob: 0692dbbe0a032114c40d9dd81d91410de7c243ec [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
Arpit Singh8e6fb252023-04-06 11:49:17 +000028InputMapper::InputMapper(InputDeviceContext& deviceContext,
29 const InputReaderConfiguration& readerConfig)
30 : mDeviceContext(deviceContext) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070031
32InputMapper::~InputMapper() {}
33
Harry Cuttsd02ea102023-03-17 18:21:30 +000034void InputMapper::populateDeviceInfo(InputDeviceInfo& info) {
35 info.addSource(getSources());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070036}
37
38void InputMapper::dump(std::string& dump) {}
39
Arpit Singhed6c3de2023-04-05 19:24:37 +000040std::list<NotifyArgs> InputMapper::reconfigure(nsecs_t when, const InputReaderConfiguration& config,
Prabir Pradhan4bf6d452023-04-18 21:26:56 +000041 ConfigurationChanges changes) {
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070042 return {};
43}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070044
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070045std::list<NotifyArgs> InputMapper::reset(nsecs_t when) {
46 return {};
47}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070048
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070049std::list<NotifyArgs> InputMapper::timeoutExpired(nsecs_t when) {
50 return {};
51}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070052
53int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {
54 return AKEY_STATE_UNKNOWN;
55}
56
57int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) {
58 return AKEY_STATE_UNKNOWN;
59}
60
61int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) {
62 return AKEY_STATE_UNKNOWN;
63}
64
Philip Junker4af3b3d2021-12-14 10:36:55 +010065int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const {
66 return AKEYCODE_UNKNOWN;
67}
68
Siarhei Vishniakou74007942022-06-13 13:57:47 -070069bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes,
70 uint8_t* outFlags) {
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070071 return false;
72}
73
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070074std::list<NotifyArgs> InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat,
75 int32_t token) {
76 return {};
77}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070078
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070079std::list<NotifyArgs> InputMapper::cancelVibrate(int32_t token) {
80 return {};
81}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070082
Chris Ye87143712020-11-10 05:05:58 +000083bool InputMapper::isVibrating() {
84 return false;
85}
86
87std::vector<int32_t> InputMapper::getVibratorIds() {
88 return {};
89}
90
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070091std::list<NotifyArgs> InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {
92 return {};
93}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070094
Chris Yef59a2f42020-10-16 12:55:26 -070095bool InputMapper::enableSensor(InputDeviceSensorType sensorType,
96 std::chrono::microseconds samplingPeriod,
97 std::chrono::microseconds maxBatchReportLatency) {
98 return true;
99}
100
101void InputMapper::disableSensor(InputDeviceSensorType sensorType) {}
102
103void InputMapper::flushSensor(InputDeviceSensorType sensorType) {}
104
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700105int32_t InputMapper::getMetaState() {
106 return 0;
107}
108
Arthur Hungcb40a002021-08-03 14:31:01 +0000109bool InputMapper::updateMetaState(int32_t keyCode) {
110 return false;
111}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700112
Siarhei Vishniakou2935db72022-09-22 13:35:22 -0700113std::list<NotifyArgs> InputMapper::updateExternalStylusState(const StylusState& state) {
114 return {};
115}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700116
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700117status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800118 return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700119}
120
121void InputMapper::bumpGeneration() {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800122 getDeviceContext().bumpGeneration();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700123}
124
125void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
126 const char* name) {
Harry Cuttsea73eaa2023-01-16 17:55:46 +0000127 std::stringstream out;
128 out << INDENT4 << name << ": " << axis << "\n";
129 dump += out.str();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700130}
131
132void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
133 dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
Prabir Pradhan3f7545f2022-10-19 16:56:39 +0000134 dump += StringPrintf(INDENT4 "Pressure: %s\n", toString(state.pressure).c_str());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700135 dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
136 dump += StringPrintf(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType);
137}
138
139} // namespace android