blob: 844afe052202ae6b44d56f4e0ec7ef7feeecbfff [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
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070035std::list<NotifyArgs> InputMapper::configure(nsecs_t when, const InputReaderConfiguration* config,
36 uint32_t changes) {
37 return {};
38}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070039
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070040std::list<NotifyArgs> InputMapper::reset(nsecs_t when) {
41 return {};
42}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070043
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070044std::list<NotifyArgs> InputMapper::timeoutExpired(nsecs_t when) {
45 return {};
46}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070047
48int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {
49 return AKEY_STATE_UNKNOWN;
50}
51
52int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) {
53 return AKEY_STATE_UNKNOWN;
54}
55
56int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) {
57 return AKEY_STATE_UNKNOWN;
58}
59
Philip Junker4af3b3d2021-12-14 10:36:55 +010060int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const {
61 return AKEYCODE_UNKNOWN;
62}
63
Siarhei Vishniakou74007942022-06-13 13:57:47 -070064bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes,
65 uint8_t* outFlags) {
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070066 return false;
67}
68
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070069std::list<NotifyArgs> InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat,
70 int32_t token) {
71 return {};
72}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070073
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070074std::list<NotifyArgs> InputMapper::cancelVibrate(int32_t token) {
75 return {};
76}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070077
Chris Ye87143712020-11-10 05:05:58 +000078bool InputMapper::isVibrating() {
79 return false;
80}
81
82std::vector<int32_t> InputMapper::getVibratorIds() {
83 return {};
84}
85
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070086std::list<NotifyArgs> InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {
87 return {};
88}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070089
Chris Yef59a2f42020-10-16 12:55:26 -070090bool InputMapper::enableSensor(InputDeviceSensorType sensorType,
91 std::chrono::microseconds samplingPeriod,
92 std::chrono::microseconds maxBatchReportLatency) {
93 return true;
94}
95
96void InputMapper::disableSensor(InputDeviceSensorType sensorType) {}
97
98void InputMapper::flushSensor(InputDeviceSensorType sensorType) {}
99
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700100int32_t InputMapper::getMetaState() {
101 return 0;
102}
103
Arthur Hungcb40a002021-08-03 14:31:01 +0000104bool InputMapper::updateMetaState(int32_t keyCode) {
105 return false;
106}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700107
Siarhei Vishniakou2935db72022-09-22 13:35:22 -0700108std::list<NotifyArgs> InputMapper::updateExternalStylusState(const StylusState& state) {
109 return {};
110}
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700111
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700112status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800113 return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700114}
115
116void InputMapper::bumpGeneration() {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800117 getDeviceContext().bumpGeneration();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700118}
119
120void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
121 const char* name) {
122 if (axis.valid) {
123 dump += StringPrintf(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d, resolution=%d\n", name,
124 axis.minValue, axis.maxValue, axis.flat, axis.fuzz, axis.resolution);
125 } else {
126 dump += StringPrintf(INDENT4 "%s: unknown range\n", name);
127 }
128}
129
130void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
131 dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
132 dump += StringPrintf(INDENT4 "Pressure: %f\n", state.pressure);
133 dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
134 dump += StringPrintf(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType);
135}
136
137} // namespace android