summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2023-02-21 19:19:27 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-02-21 19:19:27 +0000
commitabe094a24bea8852d1d43b54d05e42d1ac6731b2 (patch)
tree3280e324017dbaad352e8170371e45d1198a76cd
parent731cb5302d7588b367ada1299cba28997b8565b7 (diff)
parent16e4fa05e8ae620cb8247de72af8c0038bfee7c3 (diff)
Merge "Improve crash message when downTime is missing" into udc-dev
-rw-r--r--services/inputflinger/dispatcher/Entry.cpp14
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp18
-rw-r--r--services/inputflinger/dispatcher/InputState.cpp4
-rw-r--r--services/inputflinger/dispatcher/InputState.h3
4 files changed, 21 insertions, 18 deletions
diff --git a/services/inputflinger/dispatcher/Entry.cpp b/services/inputflinger/dispatcher/Entry.cpp
index ce7c882f7d..621543a1ee 100644
--- a/services/inputflinger/dispatcher/Entry.cpp
+++ b/services/inputflinger/dispatcher/Entry.cpp
@@ -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 += ", ";
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 9d5bbbdd11..3f0d130ecf 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -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;
}
diff --git a/services/inputflinger/dispatcher/InputState.cpp b/services/inputflinger/dispatcher/InputState.cpp
index ad5a7fde07..cc9cc4efb2 100644
--- a/services/inputflinger/dispatcher/InputState.cpp
+++ b/services/inputflinger/dispatcher/InputState.cpp
@@ -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 &&
diff --git a/services/inputflinger/dispatcher/InputState.h b/services/inputflinger/dispatcher/InputState.h
index 42d8cc6af3..d788e47429 100644
--- a/services/inputflinger/dispatcher/InputState.h
+++ b/services/inputflinger/dispatcher/InputState.h
@@ -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;