diff options
author | 2023-06-15 20:41:02 -0700 | |
---|---|---|
committer | 2023-06-22 08:49:43 -0700 | |
commit | 3218fc08efb1d3c15f9060343c0850e018f0301c (patch) | |
tree | b8a18ced029656f480b2b6bef811b68ff06726de | |
parent | c16c3d24b72c5ad015cf76208b9ee14fcaf075c6 (diff) |
Store coords and properties as vector in args
Before this CL, NotifyMotionArgs stored PointerCoords and
PointerProperties in a fixed-size array. Upon creation of a new object,
some of that data typically remained uninitialized.
At the same time, the copy assignment operator was defaulted, which
meant that the uninitialized data was getting accessed in order to copy
the object.
The sanitizers identify this as a problem and crash.
To fix this, store these objects inside vectors.
Bug: 271455682
Test: atest inputflinger_tests
Change-Id: I9dba29f75df59a21f8ed7fd0f46fd1f6d45f2eef
11 files changed, 140 insertions, 176 deletions
diff --git a/services/inputflinger/InputCommonConverter.cpp b/services/inputflinger/InputCommonConverter.cpp index 781288076c..6ccd9e7697 100644 --- a/services/inputflinger/InputCommonConverter.cpp +++ b/services/inputflinger/InputCommonConverter.cpp @@ -289,9 +289,9 @@ static std::vector<common::VideoFrame> convertVideoFrames( static void getHalPropertiesAndCoords(const NotifyMotionArgs& args, std::vector<common::PointerProperties>& outPointerProperties, std::vector<common::PointerCoords>& outPointerCoords) { - outPointerProperties.reserve(args.pointerCount); - outPointerCoords.reserve(args.pointerCount); - for (size_t i = 0; i < args.pointerCount; i++) { + outPointerProperties.reserve(args.getPointerCount()); + outPointerCoords.reserve(args.getPointerCount()); + for (size_t i = 0; i < args.getPointerCount(); i++) { common::PointerProperties properties; properties.id = args.pointerProperties[i].id; properties.toolType = getToolType(args.pointerProperties[i].toolType); diff --git a/services/inputflinger/InputDeviceMetricsCollector.cpp b/services/inputflinger/InputDeviceMetricsCollector.cpp index 2319d51441..220de8fa43 100644 --- a/services/inputflinger/InputDeviceMetricsCollector.cpp +++ b/services/inputflinger/InputDeviceMetricsCollector.cpp @@ -128,10 +128,10 @@ InputDeviceUsageSource getUsageSourceForKeyArgs(const InputDeviceInfo& info, } std::set<InputDeviceUsageSource> getUsageSourcesForMotionArgs(const NotifyMotionArgs& motionArgs) { - LOG_ALWAYS_FATAL_IF(motionArgs.pointerCount < 1, "Received motion args without pointers"); + LOG_ALWAYS_FATAL_IF(motionArgs.getPointerCount() < 1, "Received motion args without pointers"); std::set<InputDeviceUsageSource> sources; - for (uint32_t i = 0; i < motionArgs.pointerCount; i++) { + for (uint32_t i = 0; i < motionArgs.getPointerCount(); i++) { const auto toolType = motionArgs.pointerProperties[i].toolType; if (isFromSource(motionArgs.source, AINPUT_SOURCE_MOUSE)) { if (toolType == ToolType::MOUSE) { diff --git a/services/inputflinger/NotifyArgs.cpp b/services/inputflinger/NotifyArgs.cpp index 408fbed99e..0fa47d1a7c 100644 --- a/services/inputflinger/NotifyArgs.cpp +++ b/services/inputflinger/NotifyArgs.cpp @@ -83,7 +83,6 @@ NotifyMotionArgs::NotifyMotionArgs( buttonState(buttonState), classification(classification), edgeFlags(edgeFlags), - pointerCount(pointerCount), xPrecision(xPrecision), yPrecision(yPrecision), xCursorPosition(xCursorPosition), @@ -92,36 +91,8 @@ NotifyMotionArgs::NotifyMotionArgs( readTime(readTime), videoFrames(videoFrames) { for (uint32_t i = 0; i < pointerCount; i++) { - this->pointerProperties[i].copyFrom(pointerProperties[i]); - this->pointerCoords[i].copyFrom(pointerCoords[i]); - } -} - -NotifyMotionArgs::NotifyMotionArgs(const NotifyMotionArgs& other) - : id(other.id), - eventTime(other.eventTime), - deviceId(other.deviceId), - source(other.source), - displayId(other.displayId), - policyFlags(other.policyFlags), - action(other.action), - actionButton(other.actionButton), - flags(other.flags), - metaState(other.metaState), - buttonState(other.buttonState), - classification(other.classification), - edgeFlags(other.edgeFlags), - pointerCount(other.pointerCount), - xPrecision(other.xPrecision), - yPrecision(other.yPrecision), - xCursorPosition(other.xCursorPosition), - yCursorPosition(other.yCursorPosition), - downTime(other.downTime), - readTime(other.readTime), - videoFrames(other.videoFrames) { - for (uint32_t i = 0; i < pointerCount; i++) { - pointerProperties[i].copyFrom(other.pointerProperties[i]); - pointerCoords[i].copyFrom(other.pointerCoords[i]); + this->pointerProperties.push_back(pointerProperties[i]); + this->pointerCoords.push_back(pointerCoords[i]); } } @@ -130,35 +101,22 @@ static inline bool isCursorPositionEqual(float lhs, float rhs) { } bool NotifyMotionArgs::operator==(const NotifyMotionArgs& rhs) const { - bool equal = id == rhs.id && eventTime == rhs.eventTime && readTime == rhs.readTime && + return id == rhs.id && eventTime == rhs.eventTime && readTime == rhs.readTime && deviceId == rhs.deviceId && source == rhs.source && displayId == rhs.displayId && policyFlags == rhs.policyFlags && action == rhs.action && actionButton == rhs.actionButton && flags == rhs.flags && metaState == rhs.metaState && buttonState == rhs.buttonState && classification == rhs.classification && - edgeFlags == rhs.edgeFlags && - pointerCount == rhs.pointerCount - // PointerProperties and PointerCoords are compared separately below - && xPrecision == rhs.xPrecision && yPrecision == rhs.yPrecision && + edgeFlags == rhs.edgeFlags && pointerProperties == rhs.pointerProperties && + pointerCoords == rhs.pointerCoords && xPrecision == rhs.xPrecision && + yPrecision == rhs.yPrecision && isCursorPositionEqual(xCursorPosition, rhs.xCursorPosition) && isCursorPositionEqual(yCursorPosition, rhs.yCursorPosition) && downTime == rhs.downTime && videoFrames == rhs.videoFrames; - if (!equal) { - return false; - } - - for (size_t i = 0; i < pointerCount; i++) { - equal = pointerProperties[i] == rhs.pointerProperties[i] && - pointerCoords[i] == rhs.pointerCoords[i]; - if (!equal) { - return false; - } - } - return true; } std::string NotifyMotionArgs::dump() const { std::string coords; - for (uint32_t i = 0; i < pointerCount; i++) { + for (uint32_t i = 0; i < getPointerCount(); i++) { if (!coords.empty()) { coords += ", "; } @@ -181,11 +139,10 @@ std::string NotifyMotionArgs::dump() const { coords += "}"; } return StringPrintf("NotifyMotionArgs(id=%" PRId32 ", eventTime=%" PRId64 ", deviceId=%" PRId32 - ", source=%s, action=%s, pointerCount=%" PRIu32 - " pointers=%s, flags=0x%08x)", + ", source=%s, action=%s, pointerCount=%zu pointers=%s, flags=0x%08x)", id, eventTime, deviceId, inputEventSourceToString(source).c_str(), - MotionEvent::actionToString(action).c_str(), pointerCount, coords.c_str(), - flags); + MotionEvent::actionToString(action).c_str(), getPointerCount(), + coords.c_str(), flags); } // --- NotifySwitchArgs --- diff --git a/services/inputflinger/PreferStylusOverTouchBlocker.cpp b/services/inputflinger/PreferStylusOverTouchBlocker.cpp index fbd296c131..ee0ab33559 100644 --- a/services/inputflinger/PreferStylusOverTouchBlocker.cpp +++ b/services/inputflinger/PreferStylusOverTouchBlocker.cpp @@ -22,7 +22,7 @@ namespace android { static std::pair<bool, bool> checkToolType(const NotifyMotionArgs& args) { bool hasStylus = false; bool hasTouch = false; - for (size_t i = 0; i < args.pointerCount; i++) { + for (size_t i = 0; i < args.getPointerCount(); i++) { // Make sure we are canceling stylus pointers const ToolType toolType = args.pointerProperties[i].toolType; if (isStylusToolType(toolType)) { diff --git a/services/inputflinger/UnwantedInteractionBlocker.cpp b/services/inputflinger/UnwantedInteractionBlocker.cpp index 02bc47d6bb..f889de58b8 100644 --- a/services/inputflinger/UnwantedInteractionBlocker.cpp +++ b/services/inputflinger/UnwantedInteractionBlocker.cpp @@ -117,7 +117,7 @@ static int getLinuxToolCode(ToolType toolType) { } static int32_t getActionUpForPointerId(const NotifyMotionArgs& args, int32_t pointerId) { - for (size_t i = 0; i < args.pointerCount; i++) { + for (size_t i = 0; i < args.getPointerCount(); i++) { if (pointerId == args.pointerProperties[i].id) { return AMOTION_EVENT_ACTION_POINTER_UP | (i << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT); @@ -156,9 +156,10 @@ NotifyMotionArgs removePointerIds(const NotifyMotionArgs& args, actionMasked == AMOTION_EVENT_ACTION_POINTER_UP; NotifyMotionArgs newArgs{args}; - newArgs.pointerCount = 0; + newArgs.pointerProperties.clear(); + newArgs.pointerCoords.clear(); int32_t newActionIndex = 0; - for (uint32_t i = 0; i < args.pointerCount; i++) { + for (uint32_t i = 0; i < args.getPointerCount(); i++) { const int32_t pointerId = args.pointerProperties[i].id; if (pointerIds.find(pointerId) != pointerIds.end()) { // skip this pointer @@ -170,19 +171,18 @@ NotifyMotionArgs removePointerIds(const NotifyMotionArgs& args, } continue; } - newArgs.pointerProperties[newArgs.pointerCount].copyFrom(args.pointerProperties[i]); - newArgs.pointerCoords[newArgs.pointerCount].copyFrom(args.pointerCoords[i]); + newArgs.pointerProperties.push_back(args.pointerProperties[i]); + newArgs.pointerCoords.push_back(args.pointerCoords[i]); if (i == actionIndex) { - newActionIndex = newArgs.pointerCount; + newActionIndex = newArgs.getPointerCount() - 1; } - newArgs.pointerCount++; } // Update POINTER_DOWN or POINTER_UP actions if (isPointerUpOrDownAction && newArgs.action != ACTION_UNKNOWN) { newArgs.action = actionMasked | (newActionIndex << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT); // Convert POINTER_DOWN and POINTER_UP to DOWN and UP if there's only 1 pointer remaining - if (newArgs.pointerCount == 1) { + if (newArgs.getPointerCount() == 1) { if (actionMasked == AMOTION_EVENT_ACTION_POINTER_DOWN) { newArgs.action = AMOTION_EVENT_ACTION_DOWN; } else if (actionMasked == AMOTION_EVENT_ACTION_POINTER_UP) { @@ -201,13 +201,14 @@ NotifyMotionArgs removePointerIds(const NotifyMotionArgs& args, */ static std::optional<NotifyMotionArgs> removeStylusPointerIds(const NotifyMotionArgs& args) { std::set<int32_t> stylusPointerIds; - for (uint32_t i = 0; i < args.pointerCount; i++) { + for (uint32_t i = 0; i < args.getPointerCount(); i++) { if (isStylusToolType(args.pointerProperties[i].toolType)) { stylusPointerIds.insert(args.pointerProperties[i].id); } } NotifyMotionArgs withoutStylusPointers = removePointerIds(args, stylusPointerIds); - if (withoutStylusPointers.pointerCount == 0 || withoutStylusPointers.action == ACTION_UNKNOWN) { + if (withoutStylusPointers.getPointerCount() == 0 || + withoutStylusPointers.action == ACTION_UNKNOWN) { return std::nullopt; } return withoutStylusPointers; @@ -272,7 +273,7 @@ std::optional<AndroidPalmFilterDeviceInfo> createPalmFilterDeviceInfo( std::vector<NotifyMotionArgs> cancelSuppressedPointers( const NotifyMotionArgs& args, const std::set<int32_t>& oldSuppressedPointerIds, const std::set<int32_t>& newSuppressedPointerIds) { - LOG_ALWAYS_FATAL_IF(args.pointerCount == 0, "0 pointers in %s", args.dump().c_str()); + LOG_ALWAYS_FATAL_IF(args.getPointerCount() == 0, "0 pointers in %s", args.dump().c_str()); // First, let's remove the old suppressed pointers. They've already been canceled previously. NotifyMotionArgs oldArgs = removePointerIds(args, oldSuppressedPointerIds); @@ -284,7 +285,7 @@ std::vector<NotifyMotionArgs> cancelSuppressedPointers( const int32_t actionMasked = MotionEvent::getActionMasked(args.action); // We will iteratively remove pointers from 'removedArgs'. NotifyMotionArgs removedArgs{oldArgs}; - for (uint32_t i = 0; i < oldArgs.pointerCount; i++) { + for (uint32_t i = 0; i < oldArgs.getPointerCount(); i++) { const int32_t pointerId = oldArgs.pointerProperties[i].id; if (newSuppressedPointerIds.find(pointerId) == newSuppressedPointerIds.end()) { // This is a pointer that should not be canceled. Move on. @@ -296,7 +297,7 @@ std::vector<NotifyMotionArgs> cancelSuppressedPointers( continue; } - if (removedArgs.pointerCount == 1) { + if (removedArgs.getPointerCount() == 1) { // We are about to remove the last pointer, which means there will be no more gesture // remaining. This is identical to canceling all pointers, so just send a single CANCEL // event, without any of the preceding POINTER_UP with FLAG_CANCELED events. @@ -314,7 +315,7 @@ std::vector<NotifyMotionArgs> cancelSuppressedPointers( } // Now 'removedArgs' contains only pointers that are valid. - if (removedArgs.pointerCount <= 0 || removedArgs.action == ACTION_UNKNOWN) { + if (removedArgs.getPointerCount() <= 0 || removedArgs.action == ACTION_UNKNOWN) { return out; } out.push_back(removedArgs); @@ -473,7 +474,7 @@ void UnwantedInteractionBlocker::monitor() { UnwantedInteractionBlocker::~UnwantedInteractionBlocker() {} void SlotState::update(const NotifyMotionArgs& args) { - for (size_t i = 0; i < args.pointerCount; i++) { + for (size_t i = 0; i < args.getPointerCount(); i++) { const int32_t pointerId = args.pointerProperties[i].id; const int32_t resolvedAction = resolveActionForPointer(i, args.action); processPointerId(pointerId, resolvedAction); @@ -571,7 +572,7 @@ std::vector<::ui::InProgressTouchEvdev> getTouches(const NotifyMotionArgs& args, const SlotState& newSlotState) { std::vector<::ui::InProgressTouchEvdev> touches; - for (size_t i = 0; i < args.pointerCount; i++) { + for (size_t i = 0; i < args.getPointerCount(); i++) { const int32_t pointerId = args.pointerProperties[i].id; touches.emplace_back(::ui::InProgressTouchEvdev()); touches.back().major = args.pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR); @@ -660,7 +661,7 @@ std::set<int32_t> PalmRejector::detectPalmPointers(const NotifyMotionArgs& args) // Now that we know which slots should be suppressed, let's convert those to pointer id's. std::set<int32_t> newSuppressedIds; - for (size_t i = 0; i < args.pointerCount; i++) { + for (size_t i = 0; i < args.getPointerCount(); i++) { const int32_t pointerId = args.pointerProperties[i].id; std::optional<size_t> slot = oldSlotState.getSlotForPointerId(pointerId); if (!slot) { diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index b6a9ac5c75..0dea288c20 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -4325,7 +4325,7 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { args.actionButton, args.flags, args.metaState, args.buttonState, args.edgeFlags, args.xPrecision, args.yPrecision, args.xCursorPosition, args.yCursorPosition, args.downTime); - for (uint32_t i = 0; i < args.pointerCount; i++) { + for (uint32_t i = 0; i < args.getPointerCount(); i++) { ALOGD(" Pointer %d: id=%d, toolType=%s, x=%f, y=%f, pressure=%f, size=%f, " "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, orientation=%f", i, args.pointerProperties[i].id, @@ -4342,8 +4342,9 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { } } - Result<void> motionCheck = validateMotionEvent(args.action, args.actionButton, - args.pointerCount, args.pointerProperties); + Result<void> motionCheck = + validateMotionEvent(args.action, args.actionButton, args.getPointerCount(), + args.pointerProperties.data()); if (!motionCheck.ok()) { LOG(ERROR) << "Invalid event: " << args.dump() << "; reason: " << motionCheck.error(); return; @@ -4354,8 +4355,9 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { mVerifiersByDisplay.try_emplace(args.displayId, StringPrintf("display %" PRId32, args.displayId)); Result<void> result = - it->second.processMovement(args.deviceId, args.action, args.pointerCount, - args.pointerProperties, args.pointerCoords, args.flags); + it->second.processMovement(args.deviceId, args.action, args.getPointerCount(), + args.pointerProperties.data(), args.pointerCoords.data(), + args.flags); if (!result.ok()) { LOG(FATAL) << "Bad stream: " << result.error() << " caused by " << args.dump(); } @@ -4400,8 +4402,8 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { args.metaState, args.buttonState, args.classification, displayTransform, args.xPrecision, args.yPrecision, args.xCursorPosition, args.yCursorPosition, displayTransform, - args.downTime, args.eventTime, args.pointerCount, - args.pointerProperties, args.pointerCoords); + args.downTime, args.eventTime, args.getPointerCount(), + args.pointerProperties.data(), args.pointerCoords.data()); policyFlags |= POLICY_FLAG_FILTERED; if (!mPolicy.filterInputEvent(event, policyFlags)) { @@ -4419,8 +4421,9 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { args.buttonState, args.classification, args.edgeFlags, args.xPrecision, args.yPrecision, args.xCursorPosition, args.yCursorPosition, - args.downTime, args.pointerCount, - args.pointerProperties, args.pointerCoords); + args.downTime, args.getPointerCount(), + args.pointerProperties.data(), + args.pointerCoords.data()); if (args.id != android::os::IInputConstants::INVALID_INPUT_EVENT_ID && IdGenerator::getSource(args.id) == IdGenerator::Source::INPUT_READER && diff --git a/services/inputflinger/include/NotifyArgs.h b/services/inputflinger/include/NotifyArgs.h index 7d29dd9cb2..736b1e07b7 100644 --- a/services/inputflinger/include/NotifyArgs.h +++ b/services/inputflinger/include/NotifyArgs.h @@ -104,9 +104,9 @@ struct NotifyMotionArgs { MotionClassification classification; int32_t edgeFlags; - uint32_t pointerCount; - PointerProperties pointerProperties[MAX_POINTERS]; - PointerCoords pointerCoords[MAX_POINTERS]; + // Vectors 'pointerProperties' and 'pointerCoords' must always have the same number of elements + std::vector<PointerProperties> pointerProperties; + std::vector<PointerCoords> pointerCoords; float xPrecision; float yPrecision; /** @@ -131,11 +131,13 @@ struct NotifyMotionArgs { float yCursorPosition, nsecs_t downTime, const std::vector<TouchVideoFrame>& videoFrames); - NotifyMotionArgs(const NotifyMotionArgs& other); + NotifyMotionArgs(const NotifyMotionArgs& other) = default; NotifyMotionArgs& operator=(const android::NotifyMotionArgs&) = default; bool operator==(const NotifyMotionArgs& rhs) const; + inline size_t getPointerCount() const { return pointerProperties.size(); } + std::string dump() const; }; diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp index cef1791ffe..04c98fe271 100644 --- a/services/inputflinger/tests/InputDispatcher_test.cpp +++ b/services/inputflinger/tests/InputDispatcher_test.cpp @@ -6065,7 +6065,7 @@ protected: mDispatcher->notifyMotion(motionArgs); ASSERT_TRUE(mDispatcher->waitForIdle()); if (expectToBeFiltered) { - const auto xy = transform.transform(motionArgs.pointerCoords->getXYValue()); + const auto xy = transform.transform(motionArgs.pointerCoords[0].getXYValue()); mFakePolicy->assertFilterInputEventWasCalled(motionArgs, xy); } else { mFakePolicy->assertFilterInputEventWasNotCalled(); diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp index b0d6bd392d..d1c3f7d156 100644 --- a/services/inputflinger/tests/InputReader_test.cpp +++ b/services/inputflinger/tests/InputReader_test.cpp @@ -1534,8 +1534,8 @@ protected: NotifyMotionArgs args; ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyMotionWasCalled(&args)); EXPECT_EQ(action, args.action); - ASSERT_EQ(points.size(), args.pointerCount); - for (size_t i = 0; i < args.pointerCount; i++) { + ASSERT_EQ(points.size(), args.getPointerCount()); + for (size_t i = 0; i < args.getPointerCount(); i++) { EXPECT_EQ(points[i].x, args.pointerCoords[i].getX()); EXPECT_EQ(points[i].y, args.pointerCoords[i].getY()); } @@ -3949,7 +3949,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaStat ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, args.buttonState); ASSERT_EQ(0, args.edgeFlags); - ASSERT_EQ(uint32_t(1), args.pointerCount); + ASSERT_EQ(uint32_t(1), args.getPointerCount()); ASSERT_EQ(0, args.pointerProperties[0].id); ASSERT_EQ(ToolType::MOUSE, args.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertCursorPointerCoords(args.pointerCoords[0], 0.0f, 0.0f, 1.0f)); @@ -3967,7 +3967,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaStat ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, args.buttonState); ASSERT_EQ(0, args.edgeFlags); - ASSERT_EQ(uint32_t(1), args.pointerCount); + ASSERT_EQ(uint32_t(1), args.getPointerCount()); ASSERT_EQ(0, args.pointerProperties[0].id); ASSERT_EQ(ToolType::MOUSE, args.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertCursorPointerCoords(args.pointerCoords[0], 0.0f, 0.0f, 1.0f)); @@ -3988,7 +3988,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaStat ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); ASSERT_EQ(0, args.buttonState); ASSERT_EQ(0, args.edgeFlags); - ASSERT_EQ(uint32_t(1), args.pointerCount); + ASSERT_EQ(uint32_t(1), args.getPointerCount()); ASSERT_EQ(0, args.pointerProperties[0].id); ASSERT_EQ(ToolType::MOUSE, args.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertCursorPointerCoords(args.pointerCoords[0], 0.0f, 0.0f, 0.0f)); @@ -4006,7 +4006,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaStat ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); ASSERT_EQ(0, args.buttonState); ASSERT_EQ(0, args.edgeFlags); - ASSERT_EQ(uint32_t(1), args.pointerCount); + ASSERT_EQ(uint32_t(1), args.getPointerCount()); ASSERT_EQ(0, args.pointerProperties[0].id); ASSERT_EQ(ToolType::MOUSE, args.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertCursorPointerCoords(args.pointerCoords[0], 0.0f, 0.0f, 0.0f)); @@ -5269,7 +5269,7 @@ TEST_F(SingleTouchInputMapperTest, Process_WhenVirtualKeyIsPressedAndMovedOutOfB ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5293,7 +5293,7 @@ TEST_F(SingleTouchInputMapperTest, Process_WhenVirtualKeyIsPressedAndMovedOutOfB ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5316,7 +5316,7 @@ TEST_F(SingleTouchInputMapperTest, Process_WhenVirtualKeyIsPressedAndMovedOutOfB ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5366,7 +5366,7 @@ TEST_F(SingleTouchInputMapperTest, Process_WhenTouchStartsOutsideDisplayAndMoves ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5389,7 +5389,7 @@ TEST_F(SingleTouchInputMapperTest, Process_WhenTouchStartsOutsideDisplayAndMoves ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5434,7 +5434,7 @@ TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture_VirtualDispl ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5461,7 +5461,7 @@ TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture_VirtualDispl ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5486,7 +5486,7 @@ TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture_VirtualDispl ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5529,7 +5529,7 @@ TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture) { ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5554,7 +5554,7 @@ TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture) { ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -5577,7 +5577,7 @@ TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture) { ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -6932,7 +6932,7 @@ public: NotifyMotionArgs motionArgs; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], point.x, point.y, 1, 0, 0, 0, 0, 0, 0, 0)); } @@ -7004,7 +7004,7 @@ TEST_F(TouchDisplayProjectionTest, EmitsTouchDownAfterEnteringPhysicalDisplay) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_NO_FATAL_FAILURE( assertPointerCoords(motionArgs.pointerCoords[0], 11, 21, 1, 0, 0, 0, 0, 0, 0, 0)); @@ -7792,7 +7792,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -7811,7 +7811,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -7842,7 +7842,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -7871,7 +7871,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -7894,7 +7894,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(1, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -7919,7 +7919,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(1, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -7946,7 +7946,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -7975,7 +7975,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -7998,7 +7998,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8021,7 +8021,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackin ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); ASSERT_EQ(0, motionArgs.buttonState); ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8109,7 +8109,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8117,7 +8117,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_1_DOWN, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8139,7 +8139,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8158,7 +8158,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_0_UP, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8170,7 +8170,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(1, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8185,7 +8185,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(1, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8203,7 +8203,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_0_DOWN, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8222,7 +8222,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_1_UP, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8234,7 +8234,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8246,7 +8246,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingId ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8279,7 +8279,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8287,7 +8287,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_1_DOWN, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8307,7 +8307,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8327,7 +8327,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_0_UP, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8339,7 +8339,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(1, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8352,7 +8352,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(1, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8368,7 +8368,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_0_DOWN, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8388,7 +8388,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_1_UP, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); + ASSERT_EQ(size_t(2), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(1, motionArgs.pointerProperties[1].id); @@ -8400,7 +8400,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8412,7 +8412,7 @@ TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); + ASSERT_EQ(size_t(1), motionArgs.getPointerCount()); ASSERT_EQ(0, motionArgs.pointerProperties[0].id); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], @@ -8553,7 +8553,7 @@ TEST_F(MultiTouchInputMapperTest, Process_TouchAndToolAxes_SummedLinearCalibrati ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); ASSERT_EQ(ACTION_POINTER_1_DOWN, args.action); - ASSERT_EQ(size_t(2), args.pointerCount); + ASSERT_EQ(size_t(2), args.getPointerCount()); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], x, y, 1.0f, size, touch, touch, tool, tool, 0, 0)); ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[1], @@ -9812,7 +9812,7 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandlePalmToolType_TwoPointers) processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // First finger up. It used to be in palm mode, and we already generated ACTION_POINTER_UP for // it. Second finger receive move. @@ -9821,7 +9821,7 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandlePalmToolType_TwoPointers) processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // Second finger keeps moving. processSlot(mapper, SECOND_SLOT); @@ -9830,7 +9830,7 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandlePalmToolType_TwoPointers) processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // Second finger up. processId(mapper, INVALID_TRACKING_ID); @@ -9904,7 +9904,7 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandlePalmToolType_ShouldCancelW ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // third finger move processId(mapper, THIRD_TRACKING_ID); @@ -9919,7 +9919,7 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandlePalmToolType_ShouldCancelW processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // second finger up, third finger receive move. processSlot(mapper, SECOND_SLOT); @@ -9927,7 +9927,7 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandlePalmToolType_ShouldCancelW processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // third finger up. processSlot(mapper, THIRD_SLOT); @@ -9984,7 +9984,7 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandlePalmToolType_KeepFirstPoin processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // second finger up. processSlot(mapper, SECOND_SLOT); @@ -10030,7 +10030,7 @@ TEST_F(MultiTouchInputMapperTest, Process_MultiTouch_WithInvalidTrackingId) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // First finger move. processId(mapper, FIRST_TRACKING_ID); @@ -10039,7 +10039,7 @@ TEST_F(MultiTouchInputMapperTest, Process_MultiTouch_WithInvalidTrackingId) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); // Second finger down. processSlot(mapper, SECOND_SLOT); @@ -10049,7 +10049,7 @@ TEST_F(MultiTouchInputMapperTest, Process_MultiTouch_WithInvalidTrackingId) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_1_DOWN, motionArgs.action); - ASSERT_EQ(uint32_t(2), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(2), motionArgs.getPointerCount()); // second finger up with some unexpected data. processSlot(mapper, SECOND_SLOT); @@ -10058,7 +10058,7 @@ TEST_F(MultiTouchInputMapperTest, Process_MultiTouch_WithInvalidTrackingId) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ACTION_POINTER_1_UP, motionArgs.action); - ASSERT_EQ(uint32_t(2), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(2), motionArgs.getPointerCount()); // first finger up with some unexpected data. processSlot(mapper, FIRST_SLOT); @@ -10068,7 +10068,7 @@ TEST_F(MultiTouchInputMapperTest, Process_MultiTouch_WithInvalidTrackingId) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(uint32_t(1), motionArgs.pointerCount); + ASSERT_EQ(uint32_t(1), motionArgs.getPointerCount()); } TEST_F(MultiTouchInputMapperTest, Reset_PreservesLastTouchState) { @@ -10323,7 +10323,7 @@ TEST_F(MultiTouchInputMapperTest, Process_TouchpadCapture) { NotifyMotionArgs args; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(1U, args.pointerCount); + ASSERT_EQ(1U, args.getPointerCount()); ASSERT_EQ(0, args.pointerProperties[0].id); ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, args.source); ASSERT_NO_FATAL_FAILURE( @@ -10338,7 +10338,7 @@ TEST_F(MultiTouchInputMapperTest, Process_TouchpadCapture) { // expect coord[0] to contain previous location, coord[1] to contain new touch 1 location ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); ASSERT_EQ(ACTION_POINTER_1_DOWN, args.action); - ASSERT_EQ(2U, args.pointerCount); + ASSERT_EQ(2U, args.getPointerCount()); ASSERT_EQ(0, args.pointerProperties[0].id); ASSERT_EQ(1, args.pointerProperties[1].id); ASSERT_NO_FATAL_FAILURE( @@ -10406,7 +10406,7 @@ TEST_F(MultiTouchInputMapperTest, Process_TouchpadCapture) { // expect coord[0] to contain new location of touch 1, and properties[0].id to contain 1 ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, args.action); - ASSERT_EQ(1U, args.pointerCount); + ASSERT_EQ(1U, args.getPointerCount()); ASSERT_EQ(1, args.pointerProperties[0].id); ASSERT_NO_FATAL_FAILURE( assertPointerCoords(args.pointerCoords[0], 320, 900, 1, 0, 0, 0, 0, 0, 0, 0)); @@ -10626,7 +10626,7 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthSwipe) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::NONE, motionArgs.classification); @@ -10648,7 +10648,7 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthSwipe) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::TWO_FINGER_SWIPE, motionArgs.classification); @@ -10686,7 +10686,7 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthLowResolutionSwipe) processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::NONE, motionArgs.classification); @@ -10708,7 +10708,7 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthLowResolutionSwipe) processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::TWO_FINGER_SWIPE, motionArgs.classification); @@ -10742,7 +10742,7 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthFreeform) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::NONE, motionArgs.classification); @@ -10767,16 +10767,16 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthFreeform) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); // The previous PRESS gesture is cancelled, because it is transformed to freeform - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_CANCEL, motionArgs.action); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::NONE, motionArgs.classification); - ASSERT_EQ(2U, motionArgs.pointerCount); + ASSERT_EQ(2U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN, motionArgs.action & AMOTION_EVENT_ACTION_MASK); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::NONE, motionArgs.classification); @@ -10806,7 +10806,7 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthFreeform) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(2U, motionArgs.pointerCount); + ASSERT_EQ(2U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); ASSERT_EQ(ToolType::FINGER, motionArgs.pointerProperties[0].toolType); ASSERT_EQ(MotionClassification::NONE, motionArgs.classification); @@ -10835,7 +10835,7 @@ TEST_F(MultiTouchPointerModeTest, TwoFingerSwipeOffsets) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); ASSERT_EQ(MotionClassification::NONE, motionArgs.classification); ASSERT_EQ(0, motionArgs.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_GESTURE_X_OFFSET)); @@ -10857,7 +10857,7 @@ TEST_F(MultiTouchPointerModeTest, TwoFingerSwipeOffsets) { processSync(mapper); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(1U, motionArgs.pointerCount); + ASSERT_EQ(1U, motionArgs.getPointerCount()); ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); ASSERT_EQ(MotionClassification::TWO_FINGER_SWIPE, motionArgs.classification); ASSERT_LT(motionArgs.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_GESTURE_X_OFFSET), 0); diff --git a/services/inputflinger/tests/TestInputListenerMatchers.h b/services/inputflinger/tests/TestInputListenerMatchers.h index 01b79ca5da..70bad7c66b 100644 --- a/services/inputflinger/tests/TestInputListenerMatchers.h +++ b/services/inputflinger/tests/TestInputListenerMatchers.h @@ -71,8 +71,8 @@ MATCHER_P(WithKeyCode, keyCode, "KeyEvent with specified key code") { } MATCHER_P(WithPointerCount, count, "MotionEvent with specified number of pointers") { - *result_listener << "expected " << count << " pointer(s), but got " << arg.pointerCount; - return arg.pointerCount == count; + *result_listener << "expected " << count << " pointer(s), but got " << arg.getPointerCount(); + return arg.getPointerCount() == count; } MATCHER_P2(WithPointerId, index, id, "MotionEvent with specified pointer ID for pointer index") { diff --git a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp index 1fff2c7590..da0815f088 100644 --- a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp +++ b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp @@ -138,9 +138,10 @@ TEST(DeviceInfoConversionTest, TabletDeviceTest) { static void assertArgs(const NotifyMotionArgs& args, int32_t action, const std::vector<std::pair<int32_t /*pointerId*/, PointerData>>& pointers) { - ASSERT_EQ(action, args.action); - ASSERT_EQ(pointers.size(), args.pointerCount); - for (size_t i = 0; i < args.pointerCount; i++) { + ASSERT_EQ(action, args.action) + << "Expected " << MotionEvent::actionToString(action) << " but got " << args.action; + ASSERT_EQ(pointers.size(), args.getPointerCount()); + for (size_t i = 0; i < args.getPointerCount(); i++) { const auto& [pointerId, pointerData] = pointers[i]; ASSERT_EQ(pointerId, args.pointerProperties[i].id); ASSERT_EQ(pointerData.x, args.pointerCoords[i].getX()); @@ -196,7 +197,7 @@ TEST(RemovePointerIdsTest, RemoveAllPointersDuringMove) { AMOTION_EVENT_ACTION_MOVE, {{1, 2, 3}, {4, 5, 6}}); NotifyMotionArgs noPointers = removePointerIds(args, {0, 1}); - ASSERT_EQ(0u, noPointers.pointerCount); + ASSERT_EQ(0u, noPointers.getPointerCount()); } /** @@ -771,7 +772,7 @@ TEST_F(PalmRejectorTest, TwoPointersAreCanceled) { ASSERT_EQ(POINTER_0_UP, argsList[0].action); ASSERT_EQ(FLAG_CANCELED, argsList[0].flags); ASSERT_EQ(MOVE, argsList[1].action); - ASSERT_EQ(1u, argsList[1].pointerCount); + ASSERT_EQ(1u, argsList[1].getPointerCount()); ASSERT_EQ(0, argsList[1].flags); mPalmRejector->processMotion( @@ -958,7 +959,7 @@ TEST_F(PalmRejectorFakeFilterTest, OneOfTwoPointersIsCanceled) { {{1433.0, 751.0, 43.0}, {1072.0, 766.0, 13.0}})); ASSERT_EQ(1u, argsList.size()); ASSERT_EQ(MOVE, argsList[0].action); - ASSERT_EQ(1u, argsList[0].pointerCount); + ASSERT_EQ(1u, argsList[0].getPointerCount()); ASSERT_EQ(1433, argsList[0].pointerCoords[0].getX()); ASSERT_EQ(751, argsList[0].pointerCoords[0].getY()); } @@ -986,7 +987,7 @@ TEST_F(PalmRejectorFakeFilterTest, NewDownEventAfterCancel) { ASSERT_EQ(1u, argsList.size()); // Cancel all ASSERT_EQ(CANCEL, argsList[0].action); - ASSERT_EQ(2u, argsList[0].pointerCount); + ASSERT_EQ(2u, argsList[0].getPointerCount()); ASSERT_EQ(FLAG_CANCELED, argsList[0].flags); // Future move events are ignored @@ -1001,7 +1002,7 @@ TEST_F(PalmRejectorFakeFilterTest, NewDownEventAfterCancel) { {{1433.0, 751.0, 43.0}, {1072.0, 766.0, 13.0}, {1000, 700, 10}})); ASSERT_EQ(1u, argsList.size()); ASSERT_EQ(DOWN, argsList[0].action); - ASSERT_EQ(1u, argsList[0].pointerCount); + ASSERT_EQ(1u, argsList[0].getPointerCount()); ASSERT_EQ(2, argsList[0].pointerProperties[0].id); } |