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

Commit e7ffef74 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Move external MultiTouch test into InputMapperUnitTest

This test is broken because it relies on an incorrect ACTION_CANCEL
event being generated. Move this test over to the new
InputMapperUnitTest infra before fixing it in subsequent CLs.

Bug: 378308551
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Flag: TEST_ONLY
Change-Id: I016fb66f7fcbe957cd5b6e8ca86513cb8c372cd3
parent 07978260
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -19,13 +19,18 @@
#include <bitset>
#include <map>
#include <optional>
#include <set>
#include <ranges>
#include <sstream>
#include <string>
#include <vector>

namespace android {

namespace internal {
template <typename T>
concept Container = std::ranges::range<T>;
}

template <size_t N>
std::string bitsetToString(const std::bitset<N>& bitset) {
    if (bitset.none()) {
@@ -72,10 +77,12 @@ inline std::string toString(const std::optional<T>& optional,
/**
 * Convert a set of integral types to string.
 */
template <typename T>
std::string dumpSet(const std::set<T>& v, std::string (*toString)(const T&) = constToString) {
template <internal::Container T>
std::string dumpContainer(
        const T& container,
        std::string (*toString)(const std::ranges::range_value_t<T>&) = constToString) {
    std::string out;
    for (const T& entry : v) {
    for (const auto& entry : container) {
        out += out.empty() ? "{" : ", ";
        out += toString(entry);
    }
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define ATRACE_TAG ATRACE_TAG_INPUT

#include <inttypes.h>
#include <set>

#include <android-base/logging.h>
#include <android-base/properties.h>
+5 −0
Original line number Diff line number Diff line
@@ -206,4 +206,9 @@ const char* toString(const NotifyArgs& args) {
    return std::visit(toStringVisitor, args);
}

std::ostream& operator<<(std::ostream& out, const NotifyArgs& args) {
    out << toString(args);
    return out;
}

} // namespace android
+3 −3
Original line number Diff line number Diff line
@@ -216,10 +216,10 @@ static std::string dumpArgs(const NotifyMotionArgs& args) {

std::string PreferStylusOverTouchBlocker::dump() const {
    std::string out;
    out += "mActiveStyli: " + dumpSet(mActiveStyli) + "\n";
    out += "mActiveStyli: " + dumpContainer(mActiveStyli) + "\n";
    out += "mLastTouchEvents: " + dumpMap(mLastTouchEvents, constToString, dumpArgs) + "\n";
    out += "mDevicesWithMixedToolType: " + dumpSet(mDevicesWithMixedToolType) + "\n";
    out += "mCanceledDevices: " + dumpSet(mCanceledDevices) + "\n";
    out += "mDevicesWithMixedToolType: " + dumpContainer(mDevicesWithMixedToolType) + "\n";
    out += "mCanceledDevices: " + dumpContainer(mCanceledDevices) + "\n";
    return out;
}

+2 −2
Original line number Diff line number Diff line
@@ -727,7 +727,7 @@ std::vector<NotifyMotionArgs> PalmRejector::processMotion(const NotifyMotionArgs
    if (!std::includes(oldSuppressedIds.begin(), oldSuppressedIds.end(),
                       mSuppressedPointerIds.begin(), mSuppressedPointerIds.end())) {
        ALOGI("Palm detected, removing pointer ids %s after %" PRId64 "ms from %s",
              dumpSet(mSuppressedPointerIds).c_str(), ns2ms(args.eventTime - args.downTime),
              dumpContainer(mSuppressedPointerIds).c_str(), ns2ms(args.eventTime - args.downTime),
              args.dump().c_str());
    }

@@ -748,7 +748,7 @@ std::string PalmRejector::dump() const {
    out += "mSlotState:\n";
    out += addLinePrefix(mSlotState.dump(), "  ");
    out += "mSuppressedPointerIds: ";
    out += dumpSet(mSuppressedPointerIds) + "\n";
    out += dumpContainer(mSuppressedPointerIds) + "\n";
    std::stringstream state;
    state << *mSharedPalmState;
    out += "mSharedPalmState: " + state.str() + "\n";
Loading