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

Commit 53e1dac4 authored by Harry Cutts's avatar Harry Cutts Committed by Android (Google) Code Review
Browse files

Merge changes I036d0251,I7723dcba

* changes:
  TouchpadInputMapper: add dump method
  TouchpadInputMapper: Add gesture property provider
parents 6d1c002e ea73eaa7
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <optional>
#include <set>
#include <string>
#include <vector>

namespace android {

@@ -34,6 +35,16 @@ inline std::string constToString(const T& v) {
    return std::to_string(v);
}

template <>
inline std::string constToString(const bool& value) {
    return value ? "true" : "false";
}

template <>
inline std::string constToString(const std::vector<bool>::reference& value) {
    return value ? "true" : "false";
}

inline std::string constToString(const std::string& s) {
    return s;
}
@@ -76,6 +87,19 @@ std::string dumpMap(const std::map<K, V>& map, std::string (*keyToString)(const
    return out;
}

/**
 * Convert a vector to a string. The values of the vector should be of a type supported by
 * constToString.
 */
template <typename T>
std::string dumpVector(std::vector<T> values) {
    std::string dump = constToString(values[0]);
    for (size_t i = 1; i < values.size(); i++) {
        dump += ", " + constToString(values[i]);
    }
    return dump;
}

const char* toString(bool value);

/**
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ filegroup {
        "mapper/gestures/GestureConverter.cpp",
        "mapper/gestures/GesturesLogging.cpp",
        "mapper/gestures/HardwareStateConverter.cpp",
        "mapper/gestures/PropertyProvider.cpp",
    ],
}

+12 −0
Original line number Diff line number Diff line
@@ -515,6 +515,18 @@ ftl::Flags<InputDeviceClass> getAbsAxisUsage(int32_t axis,
    return deviceClasses & InputDeviceClass::JOYSTICK;
}

// --- RawAbsoluteAxisInfo ---

std::ostream& operator<<(std::ostream& out, const RawAbsoluteAxisInfo& info) {
    if (info.valid) {
        out << "min=" << info.minValue << ", max=" << info.maxValue << ", flat=" << info.flat
            << ", fuzz=" << info.fuzz << ", resolution=" << info.resolution;
    } else {
        out << "unknown range";
    }
    return out;
}

// --- EventHub::Device ---

EventHub::Device::Device(int fd, int32_t id, std::string path, InputDeviceIdentifier identifier,
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
#include <bitset>
#include <climits>
#include <filesystem>
#include <ostream>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
@@ -77,6 +79,8 @@ struct RawAbsoluteAxisInfo {
    inline void clear() { *this = RawAbsoluteAxisInfo(); }
};

std::ostream& operator<<(std::ostream& out, const RawAbsoluteAxisInfo& info);

/*
 * Input device classes.
 */
+5 −6
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@

#include "InputMapper.h"

#include <sstream>

#include "InputDevice.h"
#include "input/PrintTools.h"

@@ -120,12 +122,9 @@ void InputMapper::bumpGeneration() {

void InputMapper::dumpRawAbsoluteAxisInfo(std::string& dump, const RawAbsoluteAxisInfo& axis,
                                          const char* name) {
    if (axis.valid) {
        dump += StringPrintf(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d, resolution=%d\n", name,
                             axis.minValue, axis.maxValue, axis.flat, axis.fuzz, axis.resolution);
    } else {
        dump += StringPrintf(INDENT4 "%s: unknown range\n", name);
    }
    std::stringstream out;
    out << INDENT4 << name << ": " << axis << "\n";
    dump += out.str();
}

void InputMapper::dumpStylusState(std::string& dump, const StylusState& state) {
Loading