Touchpad: Cleanup after PointerChoreographer refactor
Remove duplicated tests and references to PointerController.
Bug: 311416205
Test: atest inputflinger_tests
Change-Id: I02bd7c8f4c4126c9ae7d2fdffd94175b37478925
diff --git a/services/inputflinger/tests/TouchpadInputMapper_test.cpp b/services/inputflinger/tests/TouchpadInputMapper_test.cpp
index a92dce5..402654c 100644
--- a/services/inputflinger/tests/TouchpadInputMapper_test.cpp
+++ b/services/inputflinger/tests/TouchpadInputMapper_test.cpp
@@ -19,9 +19,7 @@
#include <android-base/logging.h>
#include <gtest/gtest.h>
-#include <com_android_input_flags.h>
#include <thread>
-#include "FakePointerController.h"
#include "InputMapperTest.h"
#include "InterfaceMocks.h"
#include "TestEventMatchers.h"
@@ -44,12 +42,10 @@
constexpr int32_t DISPLAY_HEIGHT = 800;
constexpr std::optional<uint8_t> NO_PORT = std::nullopt; // no physical port is specified
-namespace input_flags = com::android::input::flags;
-
/**
* Unit tests for TouchpadInputMapper.
*/
-class TouchpadInputMapperTestBase : public InputMapperUnitTest {
+class TouchpadInputMapperTest : public InputMapperUnitTest {
protected:
void SetUp() override {
InputMapperUnitTest::SetUp();
@@ -117,18 +113,7 @@
return base::ResultError("Axis not supported", NAME_NOT_FOUND);
});
createDevice();
- mMapper = createInputMapper<TouchpadInputMapper>(*mDeviceContext, mReaderConfiguration,
- isPointerChoreographerEnabled());
- }
-
- virtual bool isPointerChoreographerEnabled() { return false; }
-};
-
-class TouchpadInputMapperTest : public TouchpadInputMapperTestBase {
-protected:
- void SetUp() override {
- input_flags::enable_pointer_choreographer(false);
- TouchpadInputMapperTestBase::SetUp();
+ mMapper = createInputMapper<TouchpadInputMapper>(*mDeviceContext, mReaderConfiguration);
}
};
@@ -139,66 +124,6 @@
* but only after the button is released.
*/
TEST_F(TouchpadInputMapperTest, HoverAndLeftButtonPress) {
- std::list<NotifyArgs> args;
-
- args += process(EV_ABS, ABS_MT_TRACKING_ID, 1);
- args += process(EV_KEY, BTN_TOUCH, 1);
- setScanCodeState(KeyState::DOWN, {BTN_TOOL_FINGER});
- args += process(EV_KEY, BTN_TOOL_FINGER, 1);
- args += process(EV_ABS, ABS_MT_POSITION_X, 50);
- args += process(EV_ABS, ABS_MT_POSITION_Y, 50);
- args += process(EV_ABS, ABS_MT_PRESSURE, 1);
- args += process(EV_SYN, SYN_REPORT, 0);
- ASSERT_THAT(args, testing::IsEmpty());
-
- // Without this sleep, the test fails.
- // TODO(b/284133337): Figure out whether this can be removed
- std::this_thread::sleep_for(std::chrono::milliseconds(20));
-
- args += process(EV_KEY, BTN_LEFT, 1);
- setScanCodeState(KeyState::DOWN, {BTN_LEFT});
- args += process(EV_SYN, SYN_REPORT, 0);
-
- args += process(EV_KEY, BTN_LEFT, 0);
- setScanCodeState(KeyState::UP, {BTN_LEFT});
- args += process(EV_SYN, SYN_REPORT, 0);
- ASSERT_THAT(args,
- ElementsAre(VariantWith<NotifyMotionArgs>(WithMotionAction(HOVER_ENTER)),
- VariantWith<NotifyMotionArgs>(WithMotionAction(HOVER_MOVE)),
- VariantWith<NotifyMotionArgs>(WithMotionAction(HOVER_EXIT)),
- VariantWith<NotifyMotionArgs>(WithMotionAction(ACTION_DOWN)),
- VariantWith<NotifyMotionArgs>(WithMotionAction(BUTTON_PRESS)),
- VariantWith<NotifyMotionArgs>(WithMotionAction(BUTTON_RELEASE)),
- VariantWith<NotifyMotionArgs>(WithMotionAction(ACTION_UP)),
- VariantWith<NotifyMotionArgs>(WithMotionAction(HOVER_ENTER))));
-
- // Liftoff
- args.clear();
- args += process(EV_ABS, ABS_MT_PRESSURE, 0);
- args += process(EV_ABS, ABS_MT_TRACKING_ID, -1);
- args += process(EV_KEY, BTN_TOUCH, 0);
- setScanCodeState(KeyState::UP, {BTN_TOOL_FINGER});
- args += process(EV_KEY, BTN_TOOL_FINGER, 0);
- args += process(EV_SYN, SYN_REPORT, 0);
- ASSERT_THAT(args, testing::IsEmpty());
-}
-
-class TouchpadInputMapperTestWithChoreographer : public TouchpadInputMapperTestBase {
-protected:
- void SetUp() override { TouchpadInputMapperTestBase::SetUp(); }
-
- bool isPointerChoreographerEnabled() override { return true; }
-};
-
-// TODO(b/311416205): De-duplicate the test cases after the refactoring is complete and the flagging
-// logic can be removed.
-/**
- * Start moving the finger and then click the left touchpad button. Check whether HOVER_EXIT is
- * generated when hovering stops. Currently, it is not.
- * In the current implementation, HOVER_MOVE and ACTION_DOWN events are not sent out right away,
- * but only after the button is released.
- */
-TEST_F(TouchpadInputMapperTestWithChoreographer, HoverAndLeftButtonPress) {
mFakePolicy->setDefaultPointerDisplayId(DISPLAY_ID);
mFakePolicy->addDisplayViewport(DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT, ui::ROTATION_0,
/*isActive=*/true, "local:0", NO_PORT, ViewportType::INTERNAL);