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

Commit abe094a2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Improve crash message when downTime is missing" into udc-dev

parents 731cb530 16e4fa05
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -23,11 +23,17 @@
#include <cutils/atomic.h>
#include <inttypes.h>

using android::base::GetBoolProperty;
using android::base::StringPrintf;

namespace android::inputdispatcher {

static const bool DEBUGGABLE =
#if defined(__ANDROID__)
        android::base::GetBoolProperty("ro.debuggable", false);
#else
        true;
#endif

VerifiedKeyEvent verifiedKeyEventFromKeyEntry(const KeyEntry& entry) {
    return {{VerifiedInputEvent::Type::KEY, entry.deviceId, entry.eventTime, entry.source,
             entry.displayId},
@@ -172,7 +178,7 @@ KeyEntry::KeyEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t sou
KeyEntry::~KeyEntry() {}

std::string KeyEntry::getDescription() const {
    if (!GetBoolProperty("ro.debuggable", false)) {
    if (!DEBUGGABLE) {
        return "KeyEvent";
    }
    return StringPrintf("KeyEvent(deviceId=%d, eventTime=%" PRIu64 ", source=%s, displayId=%" PRId32
@@ -242,7 +248,7 @@ MotionEntry::MotionEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32
MotionEntry::~MotionEntry() {}

std::string MotionEntry::getDescription() const {
    if (!GetBoolProperty("ro.debuggable", false)) {
    if (!DEBUGGABLE) {
        return "MotionEvent";
    }
    std::string msg;
@@ -292,7 +298,7 @@ std::string SensorEntry::getDescription() const {
                        deviceId, inputEventSourceToString(source).c_str(),
                        ftl::enum_string(sensorType).c_str(), accuracy, hwTimestamp);

    if (!GetBoolProperty("ro.debuggable", false)) {
    if (DEBUGGABLE) {
        for (size_t i = 0; i < values.size(); i++) {
            if (i > 0) {
                msg += ", ";
+11 −7
Original line number Diff line number Diff line
@@ -2191,7 +2191,7 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked(
            ALOGI("Dropping event because a pointer for a different device is already down "
                  "in display %" PRId32,
                  displayId);
            // TODO: test multiple simultaneous input streams.
            // TODO(b/211379801): test multiple simultaneous input streams.
            outInjectionResult = InputEventInjectionResult::FAILED;
            return {}; // wrong device
        }
@@ -2203,7 +2203,7 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked(
        ALOGI("Dropping move event because a pointer for a different device is already active "
              "in display %" PRId32,
              displayId);
        // TODO: test multiple simultaneous input streams.
        // TODO(b/211379801): test multiple simultaneous input streams.
        outInjectionResult = InputEventInjectionResult::FAILED;
        return {}; // wrong device
    }
@@ -3048,9 +3048,13 @@ void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime,

        const MotionEntry& originalMotionEntry = static_cast<const MotionEntry&>(*eventEntry);
        if (inputTarget.pointerIds.count() != originalMotionEntry.pointerCount) {
            LOG_ALWAYS_FATAL_IF(!inputTarget.firstDownTimeInTarget.has_value(),
                                "Splitting motion events requires a down time to be set for the "
                                "target");
            if (!inputTarget.firstDownTimeInTarget.has_value()) {
                logDispatchStateLocked();
                LOG(FATAL) << "Splitting motion events requires a down time to be set for the "
                              "target on connection "
                           << connection->getInputChannelName() << " for "
                           << originalMotionEntry.getDescription();
            }
            std::unique_ptr<MotionEntry> splitMotionEntry =
                    splitMotionEvent(originalMotionEntry, inputTarget.pointerIds,
                                     inputTarget.firstDownTimeInTarget.value());
@@ -3931,8 +3935,8 @@ std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent(
        // in this way.
        ALOGW("Dropping split motion event because the pointer count is %d but "
              "we expected there to be %zu pointers.  This probably means we received "
              "a broken sequence of pointer ids from the input device.",
              splitPointerCount, pointerIds.count());
              "a broken sequence of pointer ids from the input device: %s",
              splitPointerCount, pointerIds.count(), originalMotionEntry.getDescription().c_str());
        return nullptr;
    }

+0 −4
Original line number Diff line number Diff line
@@ -28,10 +28,6 @@ InputState::InputState(const IdGenerator& idGenerator) : mIdGenerator(idGenerato

InputState::~InputState() {}

bool InputState::isNeutral() const {
    return mKeyMementos.empty() && mMotionMementos.empty();
}

bool InputState::isHovering(int32_t deviceId, uint32_t source, int32_t displayId) const {
    for (const MotionMemento& memento : mMotionMementos) {
        if (memento.deviceId == deviceId && memento.source == source &&
+0 −3
Original line number Diff line number Diff line
@@ -34,9 +34,6 @@ public:
    explicit InputState(const IdGenerator& idGenerator);
    ~InputState();

    // Returns true if there is no state to be canceled.
    bool isNeutral() const;

    // Returns true if the specified source is known to have received a hover enter
    // motion event.
    bool isHovering(int32_t deviceId, uint32_t source, int32_t displayId) const;