blob: b6c5c9806cc1692bc5cc2ec6d9a741ec56f5fb02 [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
Harry Cuttsc57cd3c2024-04-24 13:52:55 +000023#include <ftl/enum.h>
24
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070025#include "InputDevice.h"
Prabir Pradhan3f7545f2022-10-19 16:56:39 +000026#include "input/PrintTools.h"
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070027
28namespace android {
29
Arpit Singh8e6fb252023-04-06 11:49:17 +000030InputMapper::InputMapper(InputDeviceContext& deviceContext,
31 const InputReaderConfiguration& readerConfig)
32 : mDeviceContext(deviceContext) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070033
34InputMapper::~InputMapper() {}
35
Harry Cuttsd02ea102023-03-17 18:21:30 +000036void InputMapper::populateDeviceInfo(InputDeviceInfo& info) {
37 info.addSource(getSources());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070038}
39
40void InputMapper::dump(std::string& dump) {}
41
Arpit Singhed6c3de2023-04-05 19:24:37 +000042std::list<NotifyArgs> InputMapper::reconfigure(nsecs_t when, const InputReaderConfiguration& config,
Prabir Pradhan4bf6d452023-04-18 21:26:56 +000043 ConfigurationChanges changes) {
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070044 return {};
45}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070046
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070047std::list<NotifyArgs> InputMapper::reset(nsecs_t when) {
48 return {};
49}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070050
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070051std::list<NotifyArgs> InputMapper::timeoutExpired(nsecs_t when) {
52 return {};
53}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070054
55int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {
56 return AKEY_STATE_UNKNOWN;
57}
58
59int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) {
60 return AKEY_STATE_UNKNOWN;
61}
62
63int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) {
64 return AKEY_STATE_UNKNOWN;
65}
66
Philip Junker4af3b3d2021-12-14 10:36:55 +010067int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const {
68 return AKEYCODE_UNKNOWN;
69}
70
Siarhei Vishniakou74007942022-06-13 13:57:47 -070071bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes,
72 uint8_t* outFlags) {
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070073 return false;
74}
75
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070076std::list<NotifyArgs> InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat,
77 int32_t token) {
78 return {};
79}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070080
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070081std::list<NotifyArgs> InputMapper::cancelVibrate(int32_t token) {
82 return {};
83}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070084
Chris Ye87143712020-11-10 05:05:58 +000085bool InputMapper::isVibrating() {
86 return false;
87}
88
89std::vector<int32_t> InputMapper::getVibratorIds() {
90 return {};
91}
92
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070093std::list<NotifyArgs> InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {
94 return {};
95}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070096
Chris Yef59a2f42020-10-16 12:55:26 -070097bool InputMapper::enableSensor(InputDeviceSensorType sensorType,
98 std::chrono::microseconds samplingPeriod,
99 std::chrono::microseconds maxBatchReportLatency) {
100 return true;
101}
102
103void InputMapper::disableSensor(InputDeviceSensorType sensorType) {}
104
105void InputMapper::flushSensor(InputDeviceSensorType sensorType) {}
106
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700107int32_t InputMapper::getMetaState() {
108 return 0;
109}
110
Arthur Hungcb40a002021-08-03 14:31:01 +0000111bool InputMapper::updateMetaState(int32_t keyCode) {
112 return false;
113}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700114
Siarhei Vishniakou2935db72022-09-22 13:35:22 -0700115std::list<NotifyArgs> InputMapper::updateExternalStylusState(const StylusState& state) {
116 return {};
117}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700118
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700119status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800120 return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700121}
122
123void InputMapper::bumpGeneration() {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800124 getDeviceContext().bumpGeneration();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700125}
126
127void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
128 const char* name) {
Harry Cuttsea73eaa2023-01-16 17:55:46 +0000129 std::stringstream out;
130 out << INDENT4 << name << ": " << axis << "\n";
131 dump += out.str();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700132}
133
134void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
135 dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
Prabir Pradhan3f7545f2022-10-19 16:56:39 +0000136 dump += StringPrintf(INDENT4 "Pressure: %s\n", toString(state.pressure).c_str());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700137 dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
Harry Cuttsc57cd3c2024-04-24 13:52:55 +0000138 dump += StringPrintf(INDENT4 "Tool Type: %s\n", ftl::enum_string(state.toolType).c_str());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700139}
140
141} // namespace android