Loading services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -488,7 +488,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( // Cursor-like devices. if (classes.test(InputDeviceClass::CURSOR)) { mappers.push_back(std::make_unique<CursorInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<CursorInputMapper>(contextPtr, readerConfig)); } // Touchscreens and touchpad devices. Loading services/inputflinger/reader/mapper/CursorInputMapper.cpp +22 −30 Original line number Diff line number Diff line Loading @@ -71,9 +71,7 @@ void CursorMotionAccumulator::finishSync() { CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) : InputMapper(deviceContext, readerConfig), mLastEventTime(std::numeric_limits<nsecs_t>::min()) { configureWithZeroChanges(readerConfig); } mLastEventTime(std::numeric_limits<nsecs_t>::min()) {} CursorInputMapper::~CursorInputMapper() { if (mPointerController != nullptr) { Loading Loading @@ -142,46 +140,51 @@ std::list<NotifyArgs> CursorInputMapper::reconfigure(nsecs_t when, ConfigurationChanges changes) { std::list<NotifyArgs> out = InputMapper::reconfigure(when, readerConfig, changes); if (!changes.any()) { configureWithZeroChanges(readerConfig); return out; if (!changes.any()) { // first time only configureBasicParams(); } const bool configurePointerCapture = mParameters.mode != Parameters::Mode::NAVIGATION && changes.test(InputReaderConfiguration::Change::POINTER_CAPTURE); const bool configurePointerCapture = !changes.any() || (mParameters.mode != Parameters::Mode::NAVIGATION && changes.test(InputReaderConfiguration::Change::POINTER_CAPTURE)); if (configurePointerCapture) { configureOnPointerCapture(readerConfig); out.push_back(NotifyDeviceResetArgs(getContext()->getNextId(), when, getDeviceId())); } if (changes.test(InputReaderConfiguration::Change::POINTER_SPEED) || configurePointerCapture) { if (!changes.any() || changes.test(InputReaderConfiguration::Change::POINTER_SPEED) || configurePointerCapture) { configureOnChangePointerSpeed(readerConfig); } if (changes.test(InputReaderConfiguration::Change::DISPLAY_INFO) || configurePointerCapture) { if (!changes.any() || changes.test(InputReaderConfiguration::Change::DISPLAY_INFO) || configurePointerCapture) { configureOnChangeDisplayInfo(readerConfig); } return out; } void CursorInputMapper::configureParameters() { mParameters.mode = Parameters::Mode::POINTER; const PropertyMap& config = getDeviceContext().getConfiguration(); CursorInputMapper::Parameters CursorInputMapper::computeParameters( const InputDeviceContext& deviceContext) { Parameters parameters; parameters.mode = Parameters::Mode::POINTER; const PropertyMap& config = deviceContext.getConfiguration(); std::optional<std::string> cursorModeString = config.getString("cursor.mode"); if (cursorModeString.has_value()) { if (*cursorModeString == "navigation") { mParameters.mode = Parameters::Mode::NAVIGATION; parameters.mode = Parameters::Mode::NAVIGATION; } else if (*cursorModeString != "pointer" && *cursorModeString != "default") { ALOGW("Invalid value for cursor.mode: '%s'", cursorModeString->c_str()); } } mParameters.orientationAware = config.getBool("cursor.orientationAware").value_or(false); parameters.orientationAware = config.getBool("cursor.orientationAware").value_or(false); mParameters.hasAssociatedDisplay = false; if (mParameters.mode == Parameters::Mode::POINTER || mParameters.orientationAware) { mParameters.hasAssociatedDisplay = true; parameters.hasAssociatedDisplay = false; if (parameters.mode == Parameters::Mode::POINTER || parameters.orientationAware) { parameters.hasAssociatedDisplay = true; } return parameters; } void CursorInputMapper::dumpParameters(std::string& dump) { Loading Loading @@ -424,22 +427,11 @@ std::optional<int32_t> CursorInputMapper::getAssociatedDisplayId() { return mDisplayId; } void CursorInputMapper::configureWithZeroChanges(const InputReaderConfiguration& readerConfig) { // Configuration with zero changes configureBasicParams(); if (mParameters.mode != Parameters::Mode::NAVIGATION && readerConfig.pointerCaptureRequest.enable) { configureOnPointerCapture(readerConfig); } configureOnChangePointerSpeed(readerConfig); configureOnChangeDisplayInfo(readerConfig); } void CursorInputMapper::configureBasicParams() { mCursorScrollAccumulator.configure(getDeviceContext()); // Configure basic parameters. configureParameters(); mParameters = computeParameters(getDeviceContext()); // Configure device mode. switch (mParameters.mode) { Loading services/inputflinger/reader/mapper/CursorInputMapper.h +8 −4 Original line number Diff line number Diff line Loading @@ -53,8 +53,10 @@ private: class CursorInputMapper : public InputMapper { public: explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); virtual ~CursorInputMapper(); virtual uint32_t getSources() const override; Loading Loading @@ -125,15 +127,17 @@ private: nsecs_t mDownTime; nsecs_t mLastEventTime; void configureParameters(); explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); void dumpParameters(std::string& dump); void configureWithZeroChanges(const InputReaderConfiguration& readerConfig); void configureBasicParams(); void configureOnPointerCapture(const InputReaderConfiguration& config); void configureOnChangePointerSpeed(const InputReaderConfiguration& config); void configureOnChangeDisplayInfo(const InputReaderConfiguration& config); [[nodiscard]] std::list<NotifyArgs> sync(nsecs_t when, nsecs_t readTime); static Parameters computeParameters(const InputDeviceContext& deviceContext); }; } // namespace android services/inputflinger/tests/InputReader_test.cpp +21 −21 Original line number Diff line number Diff line Loading @@ -3875,21 +3875,21 @@ void CursorInputMapperTest::testMotionRotation(CursorInputMapper& mapper, int32_ TEST_F(CursorInputMapperTest, WhenModeIsPointer_GetSources_ReturnsMouse) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper.getSources()); } TEST_F(CursorInputMapperTest, WhenModeIsNavigation_GetSources_ReturnsTrackball) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); ASSERT_EQ(AINPUT_SOURCE_TRACKBALL, mapper.getSources()); } TEST_F(CursorInputMapperTest, WhenModeIsPointer_PopulateDeviceInfo_ReturnsRangeFromPointerController) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); InputDeviceInfo info; mapper.populateDeviceInfo(info); Loading Loading @@ -3919,7 +3919,7 @@ TEST_F(CursorInputMapperTest, WhenModeIsPointer_PopulateDeviceInfo_ReturnsRangeF TEST_F(CursorInputMapperTest, WhenModeIsNavigation_PopulateDeviceInfo_ReturnsScaledRange) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); InputDeviceInfo info; mapper.populateDeviceInfo(info); Loading @@ -3937,7 +3937,7 @@ TEST_F(CursorInputMapperTest, WhenModeIsNavigation_PopulateDeviceInfo_ReturnsSca TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaState) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); mReader->getContext()->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); Loading Loading @@ -4025,7 +4025,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaStat TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentXYUpdates) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyMotionArgs args; Loading @@ -4049,7 +4049,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentXYUpdates) { TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentButtonUpdates) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyMotionArgs args; Loading Loading @@ -4078,7 +4078,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentButtonUpdates) { TEST_F(CursorInputMapperTest, Process_ShouldHandleCombinedXYAndButtonUpdates) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyMotionArgs args; Loading Loading @@ -4127,7 +4127,7 @@ TEST_F(CursorInputMapperTest, Process_WhenOrientationAware_ShouldNotRotateMotion // InputReader works in the un-rotated coordinate space, so orientation-aware devices do not // need to be rotated. addConfigurationProperty("cursor.orientationAware", "1"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); prepareDisplay(ui::ROTATION_90); ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, 1, 0, 1)); Loading @@ -4145,7 +4145,7 @@ TEST_F(CursorInputMapperTest, Process_WhenNotOrientationAware_ShouldRotateMotion addConfigurationProperty("cursor.mode", "navigation"); // Since InputReader works in the un-rotated coordinate space, only devices that are not // orientation-aware are affected by display rotation. CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); clearViewports(); prepareDisplay(ui::ROTATION_0); Loading Loading @@ -4194,7 +4194,7 @@ TEST_F(CursorInputMapperTest, Process_WhenNotOrientationAware_ShouldRotateMotion TEST_F(CursorInputMapperTest, Process_ShouldHandleAllButtons) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); mFakePointerController->setBounds(0, 0, 800 - 1, 480 - 1); mFakePointerController->setPosition(100, 200); Loading Loading @@ -4448,7 +4448,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldHandleAllButtons) { TEST_F(CursorInputMapperTest, Process_WhenModeIsPointer_ShouldMoveThePointerAround) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); mFakePointerController->setBounds(0, 0, 800 - 1, 480 - 1); mFakePointerController->setPosition(100, 200); Loading @@ -4469,7 +4469,7 @@ TEST_F(CursorInputMapperTest, Process_WhenModeIsPointer_ShouldMoveThePointerArou TEST_F(CursorInputMapperTest, Process_PointerCapture) { addConfigurationProperty("cursor.mode", "pointer"); mFakePolicy->setPointerCapture(true); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyDeviceResetArgs resetArgs; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); Loading Loading @@ -4561,7 +4561,7 @@ TEST_F(CursorInputMapperTest, PointerCaptureDisablesVelocityProcessing) { const VelocityControlParameters testParams(/*scale=*/5.f, /*low threshold=*/0.f, /*high threshold=*/100.f, /*acceleration=*/10.f); mFakePolicy->setVelocityControlParams(testParams); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyDeviceResetArgs resetArgs; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); Loading Loading @@ -4602,7 +4602,7 @@ TEST_F(CursorInputMapperTest, PointerCaptureDisablesVelocityProcessing) { TEST_F(CursorInputMapperTest, PointerCaptureDisablesOrientationChanges) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyDeviceResetArgs resetArgs; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); Loading Loading @@ -4643,7 +4643,7 @@ TEST_F(CursorInputMapperTest, PointerCaptureDisablesOrientationChanges) { } TEST_F(CursorInputMapperTest, ConfigureDisplayId_NoAssociatedViewport) { CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); // Set up the default display. prepareDisplay(ui::ROTATION_90); Loading @@ -4669,7 +4669,7 @@ TEST_F(CursorInputMapperTest, ConfigureDisplayId_NoAssociatedViewport) { } TEST_F(CursorInputMapperTest, ConfigureDisplayId_WithAssociatedViewport) { CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); // Set up the default display. prepareDisplay(ui::ROTATION_90); Loading @@ -4695,7 +4695,7 @@ TEST_F(CursorInputMapperTest, ConfigureDisplayId_WithAssociatedViewport) { } TEST_F(CursorInputMapperTest, ConfigureDisplayId_IgnoresEventsForMismatchedPointerDisplay) { CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); // Set up the default display as the display on which the pointer should be shown. prepareDisplay(ui::ROTATION_90); Loading Loading @@ -4728,7 +4728,7 @@ protected: TEST_F(BluetoothCursorInputMapperTest, TimestampSmoothening) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); nsecs_t kernelEventTime = ARBITRARY_TIME; nsecs_t expectedEventTime = ARBITRARY_TIME; Loading @@ -4755,7 +4755,7 @@ TEST_F(BluetoothCursorInputMapperTest, TimestampSmoothening) { TEST_F(BluetoothCursorInputMapperTest, TimestampSmootheningIsCapped) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); nsecs_t expectedEventTime = ARBITRARY_TIME; process(mapper, ARBITRARY_TIME, READ_TIME, EV_REL, REL_X, 1); Loading Loading @@ -4792,7 +4792,7 @@ TEST_F(BluetoothCursorInputMapperTest, TimestampSmootheningIsCapped) { TEST_F(BluetoothCursorInputMapperTest, TimestampSmootheningNotUsed) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); nsecs_t kernelEventTime = ARBITRARY_TIME; nsecs_t expectedEventTime = ARBITRARY_TIME; Loading Loading
services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -488,7 +488,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( // Cursor-like devices. if (classes.test(InputDeviceClass::CURSOR)) { mappers.push_back(std::make_unique<CursorInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<CursorInputMapper>(contextPtr, readerConfig)); } // Touchscreens and touchpad devices. Loading
services/inputflinger/reader/mapper/CursorInputMapper.cpp +22 −30 Original line number Diff line number Diff line Loading @@ -71,9 +71,7 @@ void CursorMotionAccumulator::finishSync() { CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) : InputMapper(deviceContext, readerConfig), mLastEventTime(std::numeric_limits<nsecs_t>::min()) { configureWithZeroChanges(readerConfig); } mLastEventTime(std::numeric_limits<nsecs_t>::min()) {} CursorInputMapper::~CursorInputMapper() { if (mPointerController != nullptr) { Loading Loading @@ -142,46 +140,51 @@ std::list<NotifyArgs> CursorInputMapper::reconfigure(nsecs_t when, ConfigurationChanges changes) { std::list<NotifyArgs> out = InputMapper::reconfigure(when, readerConfig, changes); if (!changes.any()) { configureWithZeroChanges(readerConfig); return out; if (!changes.any()) { // first time only configureBasicParams(); } const bool configurePointerCapture = mParameters.mode != Parameters::Mode::NAVIGATION && changes.test(InputReaderConfiguration::Change::POINTER_CAPTURE); const bool configurePointerCapture = !changes.any() || (mParameters.mode != Parameters::Mode::NAVIGATION && changes.test(InputReaderConfiguration::Change::POINTER_CAPTURE)); if (configurePointerCapture) { configureOnPointerCapture(readerConfig); out.push_back(NotifyDeviceResetArgs(getContext()->getNextId(), when, getDeviceId())); } if (changes.test(InputReaderConfiguration::Change::POINTER_SPEED) || configurePointerCapture) { if (!changes.any() || changes.test(InputReaderConfiguration::Change::POINTER_SPEED) || configurePointerCapture) { configureOnChangePointerSpeed(readerConfig); } if (changes.test(InputReaderConfiguration::Change::DISPLAY_INFO) || configurePointerCapture) { if (!changes.any() || changes.test(InputReaderConfiguration::Change::DISPLAY_INFO) || configurePointerCapture) { configureOnChangeDisplayInfo(readerConfig); } return out; } void CursorInputMapper::configureParameters() { mParameters.mode = Parameters::Mode::POINTER; const PropertyMap& config = getDeviceContext().getConfiguration(); CursorInputMapper::Parameters CursorInputMapper::computeParameters( const InputDeviceContext& deviceContext) { Parameters parameters; parameters.mode = Parameters::Mode::POINTER; const PropertyMap& config = deviceContext.getConfiguration(); std::optional<std::string> cursorModeString = config.getString("cursor.mode"); if (cursorModeString.has_value()) { if (*cursorModeString == "navigation") { mParameters.mode = Parameters::Mode::NAVIGATION; parameters.mode = Parameters::Mode::NAVIGATION; } else if (*cursorModeString != "pointer" && *cursorModeString != "default") { ALOGW("Invalid value for cursor.mode: '%s'", cursorModeString->c_str()); } } mParameters.orientationAware = config.getBool("cursor.orientationAware").value_or(false); parameters.orientationAware = config.getBool("cursor.orientationAware").value_or(false); mParameters.hasAssociatedDisplay = false; if (mParameters.mode == Parameters::Mode::POINTER || mParameters.orientationAware) { mParameters.hasAssociatedDisplay = true; parameters.hasAssociatedDisplay = false; if (parameters.mode == Parameters::Mode::POINTER || parameters.orientationAware) { parameters.hasAssociatedDisplay = true; } return parameters; } void CursorInputMapper::dumpParameters(std::string& dump) { Loading Loading @@ -424,22 +427,11 @@ std::optional<int32_t> CursorInputMapper::getAssociatedDisplayId() { return mDisplayId; } void CursorInputMapper::configureWithZeroChanges(const InputReaderConfiguration& readerConfig) { // Configuration with zero changes configureBasicParams(); if (mParameters.mode != Parameters::Mode::NAVIGATION && readerConfig.pointerCaptureRequest.enable) { configureOnPointerCapture(readerConfig); } configureOnChangePointerSpeed(readerConfig); configureOnChangeDisplayInfo(readerConfig); } void CursorInputMapper::configureBasicParams() { mCursorScrollAccumulator.configure(getDeviceContext()); // Configure basic parameters. configureParameters(); mParameters = computeParameters(getDeviceContext()); // Configure device mode. switch (mParameters.mode) { Loading
services/inputflinger/reader/mapper/CursorInputMapper.h +8 −4 Original line number Diff line number Diff line Loading @@ -53,8 +53,10 @@ private: class CursorInputMapper : public InputMapper { public: explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); virtual ~CursorInputMapper(); virtual uint32_t getSources() const override; Loading Loading @@ -125,15 +127,17 @@ private: nsecs_t mDownTime; nsecs_t mLastEventTime; void configureParameters(); explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); void dumpParameters(std::string& dump); void configureWithZeroChanges(const InputReaderConfiguration& readerConfig); void configureBasicParams(); void configureOnPointerCapture(const InputReaderConfiguration& config); void configureOnChangePointerSpeed(const InputReaderConfiguration& config); void configureOnChangeDisplayInfo(const InputReaderConfiguration& config); [[nodiscard]] std::list<NotifyArgs> sync(nsecs_t when, nsecs_t readTime); static Parameters computeParameters(const InputDeviceContext& deviceContext); }; } // namespace android
services/inputflinger/tests/InputReader_test.cpp +21 −21 Original line number Diff line number Diff line Loading @@ -3875,21 +3875,21 @@ void CursorInputMapperTest::testMotionRotation(CursorInputMapper& mapper, int32_ TEST_F(CursorInputMapperTest, WhenModeIsPointer_GetSources_ReturnsMouse) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper.getSources()); } TEST_F(CursorInputMapperTest, WhenModeIsNavigation_GetSources_ReturnsTrackball) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); ASSERT_EQ(AINPUT_SOURCE_TRACKBALL, mapper.getSources()); } TEST_F(CursorInputMapperTest, WhenModeIsPointer_PopulateDeviceInfo_ReturnsRangeFromPointerController) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); InputDeviceInfo info; mapper.populateDeviceInfo(info); Loading Loading @@ -3919,7 +3919,7 @@ TEST_F(CursorInputMapperTest, WhenModeIsPointer_PopulateDeviceInfo_ReturnsRangeF TEST_F(CursorInputMapperTest, WhenModeIsNavigation_PopulateDeviceInfo_ReturnsScaledRange) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); InputDeviceInfo info; mapper.populateDeviceInfo(info); Loading @@ -3937,7 +3937,7 @@ TEST_F(CursorInputMapperTest, WhenModeIsNavigation_PopulateDeviceInfo_ReturnsSca TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaState) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); mReader->getContext()->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); Loading Loading @@ -4025,7 +4025,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaStat TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentXYUpdates) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyMotionArgs args; Loading @@ -4049,7 +4049,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentXYUpdates) { TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentButtonUpdates) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyMotionArgs args; Loading Loading @@ -4078,7 +4078,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentButtonUpdates) { TEST_F(CursorInputMapperTest, Process_ShouldHandleCombinedXYAndButtonUpdates) { addConfigurationProperty("cursor.mode", "navigation"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyMotionArgs args; Loading Loading @@ -4127,7 +4127,7 @@ TEST_F(CursorInputMapperTest, Process_WhenOrientationAware_ShouldNotRotateMotion // InputReader works in the un-rotated coordinate space, so orientation-aware devices do not // need to be rotated. addConfigurationProperty("cursor.orientationAware", "1"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); prepareDisplay(ui::ROTATION_90); ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, 1, 0, 1)); Loading @@ -4145,7 +4145,7 @@ TEST_F(CursorInputMapperTest, Process_WhenNotOrientationAware_ShouldRotateMotion addConfigurationProperty("cursor.mode", "navigation"); // Since InputReader works in the un-rotated coordinate space, only devices that are not // orientation-aware are affected by display rotation. CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); clearViewports(); prepareDisplay(ui::ROTATION_0); Loading Loading @@ -4194,7 +4194,7 @@ TEST_F(CursorInputMapperTest, Process_WhenNotOrientationAware_ShouldRotateMotion TEST_F(CursorInputMapperTest, Process_ShouldHandleAllButtons) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); mFakePointerController->setBounds(0, 0, 800 - 1, 480 - 1); mFakePointerController->setPosition(100, 200); Loading Loading @@ -4448,7 +4448,7 @@ TEST_F(CursorInputMapperTest, Process_ShouldHandleAllButtons) { TEST_F(CursorInputMapperTest, Process_WhenModeIsPointer_ShouldMoveThePointerAround) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); mFakePointerController->setBounds(0, 0, 800 - 1, 480 - 1); mFakePointerController->setPosition(100, 200); Loading @@ -4469,7 +4469,7 @@ TEST_F(CursorInputMapperTest, Process_WhenModeIsPointer_ShouldMoveThePointerArou TEST_F(CursorInputMapperTest, Process_PointerCapture) { addConfigurationProperty("cursor.mode", "pointer"); mFakePolicy->setPointerCapture(true); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyDeviceResetArgs resetArgs; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); Loading Loading @@ -4561,7 +4561,7 @@ TEST_F(CursorInputMapperTest, PointerCaptureDisablesVelocityProcessing) { const VelocityControlParameters testParams(/*scale=*/5.f, /*low threshold=*/0.f, /*high threshold=*/100.f, /*acceleration=*/10.f); mFakePolicy->setVelocityControlParams(testParams); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyDeviceResetArgs resetArgs; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); Loading Loading @@ -4602,7 +4602,7 @@ TEST_F(CursorInputMapperTest, PointerCaptureDisablesVelocityProcessing) { TEST_F(CursorInputMapperTest, PointerCaptureDisablesOrientationChanges) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); NotifyDeviceResetArgs resetArgs; ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); Loading Loading @@ -4643,7 +4643,7 @@ TEST_F(CursorInputMapperTest, PointerCaptureDisablesOrientationChanges) { } TEST_F(CursorInputMapperTest, ConfigureDisplayId_NoAssociatedViewport) { CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); // Set up the default display. prepareDisplay(ui::ROTATION_90); Loading @@ -4669,7 +4669,7 @@ TEST_F(CursorInputMapperTest, ConfigureDisplayId_NoAssociatedViewport) { } TEST_F(CursorInputMapperTest, ConfigureDisplayId_WithAssociatedViewport) { CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); // Set up the default display. prepareDisplay(ui::ROTATION_90); Loading @@ -4695,7 +4695,7 @@ TEST_F(CursorInputMapperTest, ConfigureDisplayId_WithAssociatedViewport) { } TEST_F(CursorInputMapperTest, ConfigureDisplayId_IgnoresEventsForMismatchedPointerDisplay) { CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); // Set up the default display as the display on which the pointer should be shown. prepareDisplay(ui::ROTATION_90); Loading Loading @@ -4728,7 +4728,7 @@ protected: TEST_F(BluetoothCursorInputMapperTest, TimestampSmoothening) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); nsecs_t kernelEventTime = ARBITRARY_TIME; nsecs_t expectedEventTime = ARBITRARY_TIME; Loading @@ -4755,7 +4755,7 @@ TEST_F(BluetoothCursorInputMapperTest, TimestampSmoothening) { TEST_F(BluetoothCursorInputMapperTest, TimestampSmootheningIsCapped) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); nsecs_t expectedEventTime = ARBITRARY_TIME; process(mapper, ARBITRARY_TIME, READ_TIME, EV_REL, REL_X, 1); Loading Loading @@ -4792,7 +4792,7 @@ TEST_F(BluetoothCursorInputMapperTest, TimestampSmootheningIsCapped) { TEST_F(BluetoothCursorInputMapperTest, TimestampSmootheningNotUsed) { addConfigurationProperty("cursor.mode", "pointer"); CursorInputMapper& mapper = addMapperAndConfigure<CursorInputMapper>(); CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>(); nsecs_t kernelEventTime = ARBITRARY_TIME; nsecs_t expectedEventTime = ARBITRARY_TIME; Loading