Loading services/inputflinger/reader/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ filegroup { "mapper/SingleTouchInputMapper.cpp", "mapper/SwitchInputMapper.cpp", "mapper/TouchInputMapper.cpp", "mapper/TouchpadInputMapper.cpp", "mapper/VibratorInputMapper.cpp", "mapper/accumulator/CursorButtonAccumulator.cpp", "mapper/accumulator/CursorScrollAccumulator.cpp", Loading services/inputflinger/reader/EventHub.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -2215,6 +2215,10 @@ void EventHub::openDeviceLocked(const std::string& devicePath) { // a touch screen. if (device->keyBitmask.test(BTN_TOUCH) || !haveGamepadButtons) { device->classes |= (InputDeviceClass::TOUCH | InputDeviceClass::TOUCH_MT); if (device->propBitmask.test(INPUT_PROP_POINTER) && !device->keyBitmask.any(BTN_TOOL_PEN, BTN_TOOL_FINGER) && !haveStylusButtons) { device->classes |= InputDeviceClass::TOUCHPAD; } } // Is this an old style single-touch driver? } else if (device->keyBitmask.test(BTN_TOUCH) && device->absBitmask.test(ABS_X) && Loading services/inputflinger/reader/InputDevice.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "SensorInputMapper.h" #include "SingleTouchInputMapper.h" #include "SwitchInputMapper.h" #include "TouchpadInputMapper.h" #include "VibratorInputMapper.h" using android::hardware::input::InputDeviceCountryCode; Loading Loading @@ -208,7 +209,11 @@ void InputDevice::addEventHubDevice(int32_t eventHubId, bool populateMappers) { } // Touchscreens and touchpad devices. if (classes.test(InputDeviceClass::TOUCH_MT)) { // TODO(b/251196347): replace this with a proper flag. constexpr bool ENABLE_NEW_TOUCHPAD_STACK = false; if (ENABLE_NEW_TOUCHPAD_STACK && classes.test(InputDeviceClass::TOUCHPAD)) { mappers.push_back(std::make_unique<TouchpadInputMapper>(*contextPtr)); } else if (classes.test(InputDeviceClass::TOUCH_MT)) { mappers.push_back(std::make_unique<MultiTouchInputMapper>(*contextPtr)); } else if (classes.test(InputDeviceClass::TOUCH)) { mappers.push_back(std::make_unique<SingleTouchInputMapper>(*contextPtr)); Loading services/inputflinger/reader/include/EventHub.h +4 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ enum class InputDeviceClass : uint32_t { /* The input device is a cursor device such as a trackball or mouse. */ CURSOR = 0x00000008, /* The input device is a multi-touch touchscreen. */ /* The input device is a multi-touch touchscreen or touchpad. */ TOUCH_MT = 0x00000010, /* The input device is a directional pad (implies keyboard, has DPAD keys). */ Loading Loading @@ -130,6 +130,9 @@ enum class InputDeviceClass : uint32_t { /* The input device has sysfs controllable lights */ LIGHT = 0x00008000, /* The input device is a touchpad, requiring an on-screen cursor. */ TOUCHPAD = 0x00010000, /* The input device is virtual (not a real device, not part of UI configuration). */ VIRTUAL = 0x40000000, Loading services/inputflinger/reader/mapper/TouchpadInputMapper.cpp 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "../Macros.h" #include "TouchpadInputMapper.h" namespace android { TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext) : InputMapper(deviceContext) {} uint32_t TouchpadInputMapper::getSources() const { return AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD; } std::list<NotifyArgs> TouchpadInputMapper::process(const RawEvent* rawEvent) { ALOGD("TODO: process event type=0x%x code=0x%x value=0x%x", rawEvent->type, rawEvent->code, rawEvent->value); return {}; } } // namespace android Loading
services/inputflinger/reader/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ filegroup { "mapper/SingleTouchInputMapper.cpp", "mapper/SwitchInputMapper.cpp", "mapper/TouchInputMapper.cpp", "mapper/TouchpadInputMapper.cpp", "mapper/VibratorInputMapper.cpp", "mapper/accumulator/CursorButtonAccumulator.cpp", "mapper/accumulator/CursorScrollAccumulator.cpp", Loading
services/inputflinger/reader/EventHub.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -2215,6 +2215,10 @@ void EventHub::openDeviceLocked(const std::string& devicePath) { // a touch screen. if (device->keyBitmask.test(BTN_TOUCH) || !haveGamepadButtons) { device->classes |= (InputDeviceClass::TOUCH | InputDeviceClass::TOUCH_MT); if (device->propBitmask.test(INPUT_PROP_POINTER) && !device->keyBitmask.any(BTN_TOOL_PEN, BTN_TOOL_FINGER) && !haveStylusButtons) { device->classes |= InputDeviceClass::TOUCHPAD; } } // Is this an old style single-touch driver? } else if (device->keyBitmask.test(BTN_TOUCH) && device->absBitmask.test(ABS_X) && Loading
services/inputflinger/reader/InputDevice.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "SensorInputMapper.h" #include "SingleTouchInputMapper.h" #include "SwitchInputMapper.h" #include "TouchpadInputMapper.h" #include "VibratorInputMapper.h" using android::hardware::input::InputDeviceCountryCode; Loading Loading @@ -208,7 +209,11 @@ void InputDevice::addEventHubDevice(int32_t eventHubId, bool populateMappers) { } // Touchscreens and touchpad devices. if (classes.test(InputDeviceClass::TOUCH_MT)) { // TODO(b/251196347): replace this with a proper flag. constexpr bool ENABLE_NEW_TOUCHPAD_STACK = false; if (ENABLE_NEW_TOUCHPAD_STACK && classes.test(InputDeviceClass::TOUCHPAD)) { mappers.push_back(std::make_unique<TouchpadInputMapper>(*contextPtr)); } else if (classes.test(InputDeviceClass::TOUCH_MT)) { mappers.push_back(std::make_unique<MultiTouchInputMapper>(*contextPtr)); } else if (classes.test(InputDeviceClass::TOUCH)) { mappers.push_back(std::make_unique<SingleTouchInputMapper>(*contextPtr)); Loading
services/inputflinger/reader/include/EventHub.h +4 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ enum class InputDeviceClass : uint32_t { /* The input device is a cursor device such as a trackball or mouse. */ CURSOR = 0x00000008, /* The input device is a multi-touch touchscreen. */ /* The input device is a multi-touch touchscreen or touchpad. */ TOUCH_MT = 0x00000010, /* The input device is a directional pad (implies keyboard, has DPAD keys). */ Loading Loading @@ -130,6 +130,9 @@ enum class InputDeviceClass : uint32_t { /* The input device has sysfs controllable lights */ LIGHT = 0x00008000, /* The input device is a touchpad, requiring an on-screen cursor. */ TOUCHPAD = 0x00010000, /* The input device is virtual (not a real device, not part of UI configuration). */ VIRTUAL = 0x40000000, Loading
services/inputflinger/reader/mapper/TouchpadInputMapper.cpp 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "../Macros.h" #include "TouchpadInputMapper.h" namespace android { TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext) : InputMapper(deviceContext) {} uint32_t TouchpadInputMapper::getSources() const { return AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD; } std::list<NotifyArgs> TouchpadInputMapper::process(const RawEvent* rawEvent) { ALOGD("TODO: process event type=0x%x code=0x%x value=0x%x", rawEvent->type, rawEvent->code, rawEvent->value); return {}; } } // namespace android