blob: b9aef54eadfdbd2060945435ae8618fa47b7dc25 [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
54bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes,
55 const int32_t* keyCodes, uint8_t* outFlags) {
56 return false;
57}
58
Chris Ye87143712020-11-10 05:05:58 +000059void InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat, int32_t token) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070060
61void InputMapper::cancelVibrate(int32_t token) {}
62
Chris Ye87143712020-11-10 05:05:58 +000063bool InputMapper::isVibrating() {
64 return false;
65}
66
67std::vector<int32_t> InputMapper::getVibratorIds() {
68 return {};
69}
70
Siarhei Vishniakou58ba3d12021-02-11 01:31:07 +000071void InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070072
Chris Yef59a2f42020-10-16 12:55:26 -070073bool InputMapper::enableSensor(InputDeviceSensorType sensorType,
74 std::chrono::microseconds samplingPeriod,
75 std::chrono::microseconds maxBatchReportLatency) {
76 return true;
77}
78
79void InputMapper::disableSensor(InputDeviceSensorType sensorType) {}
80
81void InputMapper::flushSensor(InputDeviceSensorType sensorType) {}
82
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070083int32_t InputMapper::getMetaState() {
84 return 0;
85}
86
Arthur Hungcb40a002021-08-03 14:31:01 +000087bool InputMapper::updateMetaState(int32_t keyCode) {
88 return false;
89}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070090
91void InputMapper::updateExternalStylusState(const StylusState& state) {}
92
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070093status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080094 return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070095}
96
97void InputMapper::bumpGeneration() {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080098 getDeviceContext().bumpGeneration();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070099}
100
101void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
102 const char* name) {
103 if (axis.valid) {
104 dump += StringPrintf(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d, resolution=%d\n", name,
105 axis.minValue, axis.maxValue, axis.flat, axis.fuzz, axis.resolution);
106 } else {
107 dump += StringPrintf(INDENT4 "%s: unknown range\n", name);
108 }
109}
110
111void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
112 dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
113 dump += StringPrintf(INDENT4 "Pressure: %f\n", state.pressure);
114 dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
115 dump += StringPrintf(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType);
116}
117
118} // namespace android