Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 1 | /* |
| 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 Pradhan | 9244aea | 2020-02-05 20:31:40 -0800 | [diff] [blame] | 17 | #include "../Macros.h" |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 18 | |
| 19 | #include "InputMapper.h" |
| 20 | |
Harry Cutts | ea73eaa | 2023-01-16 17:55:46 +0000 | [diff] [blame] | 21 | #include <sstream> |
| 22 | |
Harry Cutts | c57cd3c | 2024-04-24 13:52:55 +0000 | [diff] [blame] | 23 | #include <ftl/enum.h> |
| 24 | |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 25 | #include "InputDevice.h" |
Prabir Pradhan | 3f7545f | 2022-10-19 16:56:39 +0000 | [diff] [blame] | 26 | #include "input/PrintTools.h" |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 27 | |
| 28 | namespace android { |
| 29 | |
Arpit Singh | 8e6fb25 | 2023-04-06 11:49:17 +0000 | [diff] [blame] | 30 | InputMapper::InputMapper(InputDeviceContext& deviceContext, |
| 31 | const InputReaderConfiguration& readerConfig) |
| 32 | : mDeviceContext(deviceContext) {} |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 33 | |
| 34 | InputMapper::~InputMapper() {} |
| 35 | |
Harry Cutts | d02ea10 | 2023-03-17 18:21:30 +0000 | [diff] [blame] | 36 | void InputMapper::populateDeviceInfo(InputDeviceInfo& info) { |
| 37 | info.addSource(getSources()); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | void InputMapper::dump(std::string& dump) {} |
| 41 | |
Arpit Singh | ed6c3de | 2023-04-05 19:24:37 +0000 | [diff] [blame] | 42 | std::list<NotifyArgs> InputMapper::reconfigure(nsecs_t when, const InputReaderConfiguration& config, |
Prabir Pradhan | 4bf6d45 | 2023-04-18 21:26:56 +0000 | [diff] [blame] | 43 | ConfigurationChanges changes) { |
Siarhei Vishniakou | 2935db7 | 2022-09-22 13:35:22 -0700 | [diff] [blame] | 44 | return {}; |
| 45 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 46 | |
Siarhei Vishniakou | 2935db7 | 2022-09-22 13:35:22 -0700 | [diff] [blame] | 47 | std::list<NotifyArgs> InputMapper::reset(nsecs_t when) { |
| 48 | return {}; |
| 49 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 50 | |
Siarhei Vishniakou | 2935db7 | 2022-09-22 13:35:22 -0700 | [diff] [blame] | 51 | std::list<NotifyArgs> InputMapper::timeoutExpired(nsecs_t when) { |
| 52 | return {}; |
| 53 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 54 | |
| 55 | int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) { |
| 56 | return AKEY_STATE_UNKNOWN; |
| 57 | } |
| 58 | |
| 59 | int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) { |
| 60 | return AKEY_STATE_UNKNOWN; |
| 61 | } |
| 62 | |
| 63 | int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) { |
| 64 | return AKEY_STATE_UNKNOWN; |
| 65 | } |
| 66 | |
Philip Junker | 4af3b3d | 2021-12-14 10:36:55 +0100 | [diff] [blame] | 67 | int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const { |
| 68 | return AKEYCODE_UNKNOWN; |
| 69 | } |
| 70 | |
Siarhei Vishniakou | 7400794 | 2022-06-13 13:57:47 -0700 | [diff] [blame] | 71 | bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes, |
| 72 | uint8_t* outFlags) { |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 73 | return false; |
| 74 | } |
| 75 | |
Siarhei Vishniakou | 2935db7 | 2022-09-22 13:35:22 -0700 | [diff] [blame] | 76 | std::list<NotifyArgs> InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat, |
| 77 | int32_t token) { |
| 78 | return {}; |
| 79 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 80 | |
Siarhei Vishniakou | 2935db7 | 2022-09-22 13:35:22 -0700 | [diff] [blame] | 81 | std::list<NotifyArgs> InputMapper::cancelVibrate(int32_t token) { |
| 82 | return {}; |
| 83 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 84 | |
Chris Ye | 8714371 | 2020-11-10 05:05:58 +0000 | [diff] [blame] | 85 | bool InputMapper::isVibrating() { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | std::vector<int32_t> InputMapper::getVibratorIds() { |
| 90 | return {}; |
| 91 | } |
| 92 | |
Siarhei Vishniakou | 2935db7 | 2022-09-22 13:35:22 -0700 | [diff] [blame] | 93 | std::list<NotifyArgs> InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) { |
| 94 | return {}; |
| 95 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 96 | |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 97 | bool InputMapper::enableSensor(InputDeviceSensorType sensorType, |
| 98 | std::chrono::microseconds samplingPeriod, |
| 99 | std::chrono::microseconds maxBatchReportLatency) { |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | void InputMapper::disableSensor(InputDeviceSensorType sensorType) {} |
| 104 | |
| 105 | void InputMapper::flushSensor(InputDeviceSensorType sensorType) {} |
| 106 | |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 107 | int32_t InputMapper::getMetaState() { |
| 108 | return 0; |
| 109 | } |
| 110 | |
Arthur Hung | cb40a00 | 2021-08-03 14:31:01 +0000 | [diff] [blame] | 111 | bool InputMapper::updateMetaState(int32_t keyCode) { |
| 112 | return false; |
| 113 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 114 | |
Siarhei Vishniakou | 2935db7 | 2022-09-22 13:35:22 -0700 | [diff] [blame] | 115 | std::list<NotifyArgs> InputMapper::updateExternalStylusState(const StylusState& state) { |
| 116 | return {}; |
| 117 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 118 | |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 119 | status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) { |
Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 120 | return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void InputMapper::bumpGeneration() { |
Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 124 | getDeviceContext().bumpGeneration(); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis, |
| 128 | const char* name) { |
Harry Cutts | ea73eaa | 2023-01-16 17:55:46 +0000 | [diff] [blame] | 129 | std::stringstream out; |
| 130 | out << INDENT4 << name << ": " << axis << "\n"; |
| 131 | dump += out.str(); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) { |
| 135 | dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when); |
Prabir Pradhan | 3f7545f | 2022-10-19 16:56:39 +0000 | [diff] [blame] | 136 | dump += StringPrintf(INDENT4 "Pressure: %s\n", toString(state.pressure).c_str()); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 137 | dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons); |
Harry Cutts | c57cd3c | 2024-04-24 13:52:55 +0000 | [diff] [blame] | 138 | dump += StringPrintf(INDENT4 "Tool Type: %s\n", ftl::enum_string(state.toolType).c_str()); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | } // namespace android |