Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89844625 authored by Harry Cutts's avatar Harry Cutts
Browse files

Use a sysprop to enable `TouchpadInputMapper`

The new touchpad behaviour can now be toggled using the `setprop`
command followed by a userspace reboot instead of having to change the
const and rebuild.

Bug: 251196347
Test: set the flag with setprop, check the gestures library logs appear
Test: atest inputflinger_tests
Change-Id: Ie4db00219e915fd059647d7541ef84e27e75bd86
parent e23e22d5
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@

#include <algorithm>

#if defined(__ANDROID__)
#include <android/sysprop/InputProperties.sysprop.h>
#endif
#include <ftl/flags.h>

#include "CursorInputMapper.h"
@@ -209,9 +212,13 @@ void InputDevice::addEventHubDevice(int32_t eventHubId, bool populateMappers) {
    }

    // Touchscreens and touchpad devices.
    // 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) &&
    static const bool ENABLE_TOUCHPAD_GESTURES_LIBRARY =
#if defined(__ANDROID__)
            sysprop::InputProperties::enable_touchpad_gestures_library().value_or(false);
#else
            false;
#endif
    if (ENABLE_TOUCHPAD_GESTURES_LIBRARY && classes.test(InputDeviceClass::TOUCHPAD) &&
        classes.test(InputDeviceClass::TOUCH_MT)) {
        mappers.push_back(std::make_unique<TouchpadInputMapper>(*contextPtr));
    } else if (classes.test(InputDeviceClass::TOUCH_MT)) {