Loading services/inputflinger/tests/FakeInputReaderPolicy.cpp +24 −27 Original line number Diff line number Diff line Loading @@ -31,6 +31,30 @@ static const int HW_TIMEOUT_MULTIPLIER = base::GetIntProperty("ro.hw_timeout_mul } // namespace DisplayViewport createViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type) { const bool isRotated = orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270; DisplayViewport v; v.displayId = displayId; v.orientation = orientation; v.logicalLeft = 0; v.logicalTop = 0; v.logicalRight = isRotated ? height : width; v.logicalBottom = isRotated ? width : height; v.physicalLeft = 0; v.physicalTop = 0; v.physicalRight = isRotated ? height : width; v.physicalBottom = isRotated ? width : height; v.deviceWidth = isRotated ? height : width; v.deviceHeight = isRotated ? width : height; v.isActive = isActive; v.uniqueId = uniqueId; v.physicalPort = physicalPort; v.type = type; return v; }; void FakeInputReaderPolicy::assertInputDevicesChanged() { waitForInputDevices( [](bool devicesChanged) { Loading Loading @@ -115,33 +139,6 @@ void FakeInputReaderPolicy::addDisplayViewport(DisplayViewport viewport) { mConfig.setDisplayViewports(mViewports); } void FakeInputReaderPolicy::addDisplayViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type) { const bool isRotated = orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270; DisplayViewport v; v.displayId = displayId; v.orientation = orientation; v.logicalLeft = 0; v.logicalTop = 0; v.logicalRight = isRotated ? height : width; v.logicalBottom = isRotated ? width : height; v.physicalLeft = 0; v.physicalTop = 0; v.physicalRight = isRotated ? height : width; v.physicalBottom = isRotated ? width : height; v.deviceWidth = isRotated ? height : width; v.deviceHeight = isRotated ? width : height; v.isActive = isActive; v.uniqueId = uniqueId; v.physicalPort = physicalPort; v.type = type; addDisplayViewport(v); } bool FakeInputReaderPolicy::updateViewport(const DisplayViewport& viewport) { size_t count = mViewports.size(); for (size_t i = 0; i < count; i++) { Loading services/inputflinger/tests/FakeInputReaderPolicy.h +4 −3 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ namespace android { DisplayViewport createViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type); class FakeInputReaderPolicy : public InputReaderPolicyInterface { protected: virtual ~FakeInputReaderPolicy() {} Loading @@ -50,9 +54,6 @@ public: std::optional<DisplayViewport> getDisplayViewportByType(ViewportType type) const; std::optional<DisplayViewport> getDisplayViewportByPort(uint8_t displayPort) const; void addDisplayViewport(DisplayViewport viewport); void addDisplayViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type); bool updateViewport(const DisplayViewport& viewport); void addExcludedDeviceName(const std::string& deviceName); void addInputPortAssociation(const std::string& inputPort, uint8_t displayPort); Loading services/inputflinger/tests/InputMapperTest.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -186,8 +186,10 @@ void InputMapperTest::setDisplayInfoAndReconfigure(ui::LogicalDisplayId displayI const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType viewportType) { mFakePolicy->addDisplayViewport(displayId, width, height, orientation, /* isActive= */ true, uniqueId, physicalPort, viewportType); DisplayViewport viewport = createViewport(displayId, width, height, orientation, /* isActive= */ true, uniqueId, physicalPort, viewportType); mFakePolicy->addDisplayViewport(viewport); configureDevice(InputReaderConfiguration::Change::DISPLAY_INFO); } Loading services/inputflinger/tests/InputReader_test.cpp +137 −126 File changed.Preview size limit exceeded, changes collapsed. Show changes services/inputflinger/tests/MultiTouchInputMapper_test.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -109,9 +109,10 @@ protected: mockSlotValues({}); mFakePolicy->setDefaultPointerDisplayId(DISPLAY_ID); mFakePolicy->addDisplayViewport(DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT, ui::ROTATION_0, /*isActive=*/true, "local:0", NO_PORT, ViewportType::INTERNAL); DisplayViewport internalViewport = createViewport(DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT, ui::ROTATION_0, /*isActive=*/true, "local:0", NO_PORT, ViewportType::INTERNAL); mFakePolicy->addDisplayViewport(internalViewport); mMapper = createInputMapper<MultiTouchInputMapper>(*mDeviceContext, mFakePolicy->getReaderConfiguration()); } Loading Loading
services/inputflinger/tests/FakeInputReaderPolicy.cpp +24 −27 Original line number Diff line number Diff line Loading @@ -31,6 +31,30 @@ static const int HW_TIMEOUT_MULTIPLIER = base::GetIntProperty("ro.hw_timeout_mul } // namespace DisplayViewport createViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type) { const bool isRotated = orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270; DisplayViewport v; v.displayId = displayId; v.orientation = orientation; v.logicalLeft = 0; v.logicalTop = 0; v.logicalRight = isRotated ? height : width; v.logicalBottom = isRotated ? width : height; v.physicalLeft = 0; v.physicalTop = 0; v.physicalRight = isRotated ? height : width; v.physicalBottom = isRotated ? width : height; v.deviceWidth = isRotated ? height : width; v.deviceHeight = isRotated ? width : height; v.isActive = isActive; v.uniqueId = uniqueId; v.physicalPort = physicalPort; v.type = type; return v; }; void FakeInputReaderPolicy::assertInputDevicesChanged() { waitForInputDevices( [](bool devicesChanged) { Loading Loading @@ -115,33 +139,6 @@ void FakeInputReaderPolicy::addDisplayViewport(DisplayViewport viewport) { mConfig.setDisplayViewports(mViewports); } void FakeInputReaderPolicy::addDisplayViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type) { const bool isRotated = orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270; DisplayViewport v; v.displayId = displayId; v.orientation = orientation; v.logicalLeft = 0; v.logicalTop = 0; v.logicalRight = isRotated ? height : width; v.logicalBottom = isRotated ? width : height; v.physicalLeft = 0; v.physicalTop = 0; v.physicalRight = isRotated ? height : width; v.physicalBottom = isRotated ? width : height; v.deviceWidth = isRotated ? height : width; v.deviceHeight = isRotated ? width : height; v.isActive = isActive; v.uniqueId = uniqueId; v.physicalPort = physicalPort; v.type = type; addDisplayViewport(v); } bool FakeInputReaderPolicy::updateViewport(const DisplayViewport& viewport) { size_t count = mViewports.size(); for (size_t i = 0; i < count; i++) { Loading
services/inputflinger/tests/FakeInputReaderPolicy.h +4 −3 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ namespace android { DisplayViewport createViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type); class FakeInputReaderPolicy : public InputReaderPolicyInterface { protected: virtual ~FakeInputReaderPolicy() {} Loading @@ -50,9 +54,6 @@ public: std::optional<DisplayViewport> getDisplayViewportByType(ViewportType type) const; std::optional<DisplayViewport> getDisplayViewportByPort(uint8_t displayPort) const; void addDisplayViewport(DisplayViewport viewport); void addDisplayViewport(ui::LogicalDisplayId displayId, int32_t width, int32_t height, ui::Rotation orientation, bool isActive, const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType type); bool updateViewport(const DisplayViewport& viewport); void addExcludedDeviceName(const std::string& deviceName); void addInputPortAssociation(const std::string& inputPort, uint8_t displayPort); Loading
services/inputflinger/tests/InputMapperTest.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -186,8 +186,10 @@ void InputMapperTest::setDisplayInfoAndReconfigure(ui::LogicalDisplayId displayI const std::string& uniqueId, std::optional<uint8_t> physicalPort, ViewportType viewportType) { mFakePolicy->addDisplayViewport(displayId, width, height, orientation, /* isActive= */ true, uniqueId, physicalPort, viewportType); DisplayViewport viewport = createViewport(displayId, width, height, orientation, /* isActive= */ true, uniqueId, physicalPort, viewportType); mFakePolicy->addDisplayViewport(viewport); configureDevice(InputReaderConfiguration::Change::DISPLAY_INFO); } Loading
services/inputflinger/tests/InputReader_test.cpp +137 −126 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/inputflinger/tests/MultiTouchInputMapper_test.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -109,9 +109,10 @@ protected: mockSlotValues({}); mFakePolicy->setDefaultPointerDisplayId(DISPLAY_ID); mFakePolicy->addDisplayViewport(DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT, ui::ROTATION_0, /*isActive=*/true, "local:0", NO_PORT, ViewportType::INTERNAL); DisplayViewport internalViewport = createViewport(DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT, ui::ROTATION_0, /*isActive=*/true, "local:0", NO_PORT, ViewportType::INTERNAL); mFakePolicy->addDisplayViewport(internalViewport); mMapper = createInputMapper<MultiTouchInputMapper>(*mDeviceContext, mFakePolicy->getReaderConfiguration()); } Loading