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 | |
| 21 | #include "InputDevice.h" |
| 22 | |
| 23 | namespace android { |
| 24 | |
Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 25 | InputMapper::InputMapper(InputDeviceContext& deviceContext) : mDeviceContext(deviceContext) {} |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 26 | |
| 27 | InputMapper::~InputMapper() {} |
| 28 | |
| 29 | void InputMapper::populateDeviceInfo(InputDeviceInfo* info) { |
| 30 | info->addSource(getSources()); |
| 31 | } |
| 32 | |
| 33 | void InputMapper::dump(std::string& dump) {} |
| 34 | |
| 35 | void InputMapper::configure(nsecs_t when, const InputReaderConfiguration* config, |
| 36 | uint32_t changes) {} |
| 37 | |
| 38 | void InputMapper::reset(nsecs_t when) {} |
| 39 | |
| 40 | void InputMapper::timeoutExpired(nsecs_t when) {} |
| 41 | |
| 42 | int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) { |
| 43 | return AKEY_STATE_UNKNOWN; |
| 44 | } |
| 45 | |
| 46 | int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) { |
| 47 | return AKEY_STATE_UNKNOWN; |
| 48 | } |
| 49 | |
| 50 | int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) { |
| 51 | return AKEY_STATE_UNKNOWN; |
| 52 | } |
| 53 | |
Philip Junker | 4af3b3d | 2021-12-14 10:36:55 +0100 | [diff] [blame] | 54 | int32_t InputMapper::getKeyCodeForKeyLocation(int32_t locationKeyCode) const { |
| 55 | return AKEYCODE_UNKNOWN; |
| 56 | } |
| 57 | |
Siarhei Vishniakou | 7400794 | 2022-06-13 13:57:47 -0700 | [diff] [blame^] | 58 | bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes, |
| 59 | uint8_t* outFlags) { |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 60 | return false; |
| 61 | } |
| 62 | |
Chris Ye | 8714371 | 2020-11-10 05:05:58 +0000 | [diff] [blame] | 63 | void InputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat, int32_t token) {} |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 64 | |
| 65 | void InputMapper::cancelVibrate(int32_t token) {} |
| 66 | |
Chris Ye | 8714371 | 2020-11-10 05:05:58 +0000 | [diff] [blame] | 67 | bool InputMapper::isVibrating() { |
| 68 | return false; |
| 69 | } |
| 70 | |
| 71 | std::vector<int32_t> InputMapper::getVibratorIds() { |
| 72 | return {}; |
| 73 | } |
| 74 | |
Siarhei Vishniakou | 58ba3d1 | 2021-02-11 01:31:07 +0000 | [diff] [blame] | 75 | void InputMapper::cancelTouch(nsecs_t when, nsecs_t readTime) {} |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 76 | |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 77 | bool InputMapper::enableSensor(InputDeviceSensorType sensorType, |
| 78 | std::chrono::microseconds samplingPeriod, |
| 79 | std::chrono::microseconds maxBatchReportLatency) { |
| 80 | return true; |
| 81 | } |
| 82 | |
| 83 | void InputMapper::disableSensor(InputDeviceSensorType sensorType) {} |
| 84 | |
| 85 | void InputMapper::flushSensor(InputDeviceSensorType sensorType) {} |
| 86 | |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 87 | int32_t InputMapper::getMetaState() { |
| 88 | return 0; |
| 89 | } |
| 90 | |
Arthur Hung | cb40a00 | 2021-08-03 14:31:01 +0000 | [diff] [blame] | 91 | bool InputMapper::updateMetaState(int32_t keyCode) { |
| 92 | return false; |
| 93 | } |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 94 | |
| 95 | void InputMapper::updateExternalStylusState(const StylusState& state) {} |
| 96 | |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 97 | status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) { |
Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 98 | return getDeviceContext().getAbsoluteAxisInfo(axis, axisInfo); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | void InputMapper::bumpGeneration() { |
Nathaniel R. Lewis | 26ec222 | 2020-01-10 16:30:54 -0800 | [diff] [blame] | 102 | getDeviceContext().bumpGeneration(); |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | void 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 | |
| 115 | void 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 |