blob: 75cebf3ddb99e1122b6be5de6229409039c1c46e [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"
22
23namespace android {
24
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080025InputMapper::InputMapper(InputDeviceContext& deviceContext) : mDeviceContext(deviceContext) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070026
27InputMapper::~InputMapper() {}
28
29void InputMapper::populateDeviceInfo(InputDeviceInfo* info) {
30 info->addSource(getSources());
31}
32
33void InputMapper::dump(std::string& dump) {}
34
35void InputMapper::configure(nsecs_t when, const InputReaderConfiguration* config,
36 uint32_t changes) {}
37
38void InputMapper::reset(nsecs_t when) {}
39
40void InputMapper::timeoutExpired(nsecs_t when) {}
41
42int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {
43 return AKEY_STATE_UNKNOWN;
44}
45
46int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) {
47 return AKEY_STATE_UNKNOWN;
48}
49
50int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) {
51 return AKEY_STATE_UNKNOWN;
52}
53
Philip Junker4af3b3d2021-12-14 10:36:55 +010054int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const {
55 return AKEYCODE_UNKNOWN;
56}
57
Siarhei Vishniakou74007942022-06-13 13:57:47 -070058bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes,
59 uint8_t* outFlags) {
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070060 return false;
61}
62
Chris Ye87143712020-11-10 05:05:58 +000063void InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat, int32_t token) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070064
65void InputMapper::cancelVibrate(int32_t token) {}
66
Chris Ye87143712020-11-10 05:05:58 +000067bool InputMapper::isVibrating() {
68 return false;
69}
70
71std::vector<int32_t> InputMapper::getVibratorIds() {
72 return {};
73}
74
Siarhei Vishniakou58ba3d12021-02-11 01:31:07 +000075void InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070076
Chris Yef59a2f42020-10-16 12:55:26 -070077bool InputMapper::enableSensor(InputDeviceSensorType sensorType,
78 std::chrono::microseconds samplingPeriod,
79 std::chrono::microseconds maxBatchReportLatency) {
80 return true;
81}
82
83void InputMapper::disableSensor(InputDeviceSensorType sensorType) {}
84
85void InputMapper::flushSensor(InputDeviceSensorType sensorType) {}
86
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070087int32_t InputMapper::getMetaState() {
88 return 0;
89}
90
Arthur Hungcb40a002021-08-03 14:31:01 +000091bool InputMapper::updateMetaState(int32_t keyCode) {
92 return false;
93}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070094
95void InputMapper::updateExternalStylusState(const StylusState& state) {}
96
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070097status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080098 return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070099}
100
101void InputMapper::bumpGeneration() {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800102 getDeviceContext().bumpGeneration();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700103}
104
105void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
106 const char* name) {
107 if (axis.valid) {
108 dump += StringPrintf(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d, resolution=%d\n", name,
109 axis.minValue, axis.maxValue, axis.flat, axis.fuzz, axis.resolution);
110 } else {
111 dump += StringPrintf(INDENT4 "%s: unknown range\n", name);
112 }
113}
114
115void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
116 dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
117 dump += StringPrintf(INDENT4 "Pressure: %f\n", state.pressure);
118 dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
119 dump += StringPrintf(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType);
120}
121
122} // namespace android