blob: 8e3539c3a6c95f344060f071b555397b8ba5676f [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
21#include "InputDevice.h"
Prabir Pradhan3f7545f2022-10-19 16:56:39 +000022#include "input/PrintTools.h"
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070023
24namespace android {
25
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080026InputMapper::InputMapper(InputDeviceContext& deviceContext) : mDeviceContext(deviceContext) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070027
28InputMapper::~InputMapper() {}
29
30void InputMapper::populateDeviceInfo(InputDeviceInfo* info) {
31 info->addSource(getSources());
32}
33
34void InputMapper::dump(std::string& dump) {}
35
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070036std::list<NotifyArgs> InputMapper::configure(nsecs_t when, const InputReaderConfiguration* config,
37 uint32_t changes) {
38 return {};
39}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070040
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070041std::list<NotifyArgs> InputMapper::reset(nsecs_t when) {
42 return {};
43}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070044
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070045std::list<NotifyArgs> InputMapper::timeoutExpired(nsecs_t when) {
46 return {};
47}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070048
49int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {
50 return AKEY_STATE_UNKNOWN;
51}
52
53int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) {
54 return AKEY_STATE_UNKNOWN;
55}
56
57int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) {
58 return AKEY_STATE_UNKNOWN;
59}
60
Philip Junker4af3b3d2021-12-14 10:36:55 +010061int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const {
62 return AKEYCODE_UNKNOWN;
63}
64
Siarhei Vishniakou74007942022-06-13 13:57:47 -070065bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes,
66 uint8_t* outFlags) {
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070067 return false;
68}
69
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070070std::list<NotifyArgs> InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat,
71 int32_t token) {
72 return {};
73}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070074
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070075std::list<NotifyArgs> InputMapper::cancelVibrate(int32_t token) {
76 return {};
77}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070078
Chris Ye87143712020-11-10 05:05:58 +000079bool InputMapper::isVibrating() {
80 return false;
81}
82
83std::vector<int32_t> InputMapper::getVibratorIds() {
84 return {};
85}
86
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070087std::list<NotifyArgs> InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {
88 return {};
89}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070090
Chris Yef59a2f42020-10-16 12:55:26 -070091bool InputMapper::enableSensor(InputDeviceSensorType sensorType,
92 std::chrono::microseconds samplingPeriod,
93 std::chrono::microseconds maxBatchReportLatency) {
94 return true;
95}
96
97void InputMapper::disableSensor(InputDeviceSensorType sensorType) {}
98
99void InputMapper::flushSensor(InputDeviceSensorType sensorType) {}
100
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700101int32_t InputMapper::getMetaState() {
102 return 0;
103}
104
Arthur Hungcb40a002021-08-03 14:31:01 +0000105bool InputMapper::updateMetaState(int32_t keyCode) {
106 return false;
107}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700108
Siarhei Vishniakou2935db72022-09-22 13:35:22 -0700109std::list<NotifyArgs> InputMapper::updateExternalStylusState(const StylusState& state) {
110 return {};
111}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700112
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700113status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800114 return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700115}
116
117void InputMapper::bumpGeneration() {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800118 getDeviceContext().bumpGeneration();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700119}
120
121void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
122 const char* name) {
123 if (axis.valid) {
124 dump += StringPrintf(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d, resolution=%d\n", name,
125 axis.minValue, axis.maxValue, axis.flat, axis.fuzz, axis.resolution);
126 } else {
127 dump += StringPrintf(INDENT4 "%s: unknown range\n", name);
128 }
129}
130
131void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
132 dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
Prabir Pradhan3f7545f2022-10-19 16:56:39 +0000133 dump += StringPrintf(INDENT4 "Pressure: %s\n", toString(state.pressure).c_str());
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700134 dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
135 dump += StringPrintf(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType);
136}
137
138} // namespace android