Address internal comments: Pointer icon refactor for mouse

Bug: 293587049
Test: atest inputflinger_tests
Change-Id: I9609e186ec92f283c25d2c9734ea2c3465445d5c
diff --git a/services/inputflinger/tests/FakeInputReaderPolicy.cpp b/services/inputflinger/tests/FakeInputReaderPolicy.cpp
index 305685d..88f514f 100644
--- a/services/inputflinger/tests/FakeInputReaderPolicy.cpp
+++ b/services/inputflinger/tests/FakeInputReaderPolicy.cpp
@@ -261,7 +261,7 @@
     mStylusGestureNotified = deviceId;
 }
 
-std::optional<DisplayViewport> FakeInputReaderPolicy::getViewportForPointerDevice(
+std::optional<DisplayViewport> FakeInputReaderPolicy::getPointerViewportForAssociatedDisplay(
         int32_t associatedDisplayId) {
     if (associatedDisplayId == ADISPLAY_ID_NONE) {
         associatedDisplayId = mConfig.defaultPointerDisplayId;
diff --git a/services/inputflinger/tests/FakeInputReaderPolicy.h b/services/inputflinger/tests/FakeInputReaderPolicy.h
index 084aae1..4ef9c3e 100644
--- a/services/inputflinger/tests/FakeInputReaderPolicy.h
+++ b/services/inputflinger/tests/FakeInputReaderPolicy.h
@@ -79,7 +79,7 @@
     void setStylusPointerIconEnabled(bool enabled);
     void setIsInputMethodConnectionActive(bool active);
     bool isInputMethodConnectionActive() override;
-    std::optional<DisplayViewport> getViewportForPointerDevice(
+    std::optional<DisplayViewport> getPointerViewportForAssociatedDisplay(
             int32_t associatedDisplayId) override;
 
 private:
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index 53a55f8..5044b3e 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -4930,7 +4930,7 @@
     }
 };
 
-TEST_F(CursorInputMapperTestWithChoreographer, PopulateDeviceInfo_ReturnsRangeFromPolicy) {
+TEST_F(CursorInputMapperTestWithChoreographer, PopulateDeviceInfoReturnsRangeFromPolicy) {
     addConfigurationProperty("cursor.mode", "pointer");
     CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>();
 
@@ -4961,7 +4961,7 @@
                                               AINPUT_SOURCE_MOUSE, 0.0f, 1.0f, 0.0f, 0.0f));
 }
 
-TEST_F(CursorInputMapperTestWithChoreographer, Process_ShouldHandleAllButtonsWithZeroCoords) {
+TEST_F(CursorInputMapperTestWithChoreographer, ProcessShouldHandleAllButtonsWithZeroCoords) {
     addConfigurationProperty("cursor.mode", "pointer");
     CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>();
 
@@ -5218,7 +5218,7 @@
     ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode);
 }
 
-TEST_F(CursorInputMapperTestWithChoreographer, Process_WhenModeIsPointer_ShouldKeepZeroCoords) {
+TEST_F(CursorInputMapperTestWithChoreographer, ProcessWhenModeIsPointerShouldKeepZeroCoords) {
     addConfigurationProperty("cursor.mode", "pointer");
     CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>();
 
@@ -5242,8 +5242,8 @@
 
 TEST_F(CursorInputMapperTestWithChoreographer, PointerCaptureDisablesVelocityProcessing) {
     addConfigurationProperty("cursor.mode", "pointer");
-    const VelocityControlParameters testParams(/*scale=*/5.f, /*low threshold=*/0.f,
-                                               /*high threshold=*/100.f, /*acceleration=*/10.f);
+    const VelocityControlParameters testParams(/*scale=*/5.f, /*lowThreshold=*/0.f,
+                                               /*highThreshold=*/100.f, /*acceleration=*/10.f);
     mFakePolicy->setVelocityControlParams(testParams);
     CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>();
 
@@ -5289,7 +5289,7 @@
     ASSERT_EQ(20, relY2);
 }
 
-TEST_F(CursorInputMapperTestWithChoreographer, ConfigureDisplayId_NoAssociatedViewport) {
+TEST_F(CursorInputMapperTestWithChoreographer, ConfigureDisplayIdNoAssociatedViewport) {
     CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>();
 
     // Set up the default display.
@@ -5315,7 +5315,7 @@
                   WithCoords(0.0f, 0.0f))));
 }
 
-TEST_F(CursorInputMapperTestWithChoreographer, ConfigureDisplayId_WithAssociatedViewport) {
+TEST_F(CursorInputMapperTestWithChoreographer, ConfigureDisplayIdWithAssociatedViewport) {
     CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>();
 
     // Set up the default display.
@@ -5343,7 +5343,7 @@
 }
 
 TEST_F(CursorInputMapperTestWithChoreographer,
-       ConfigureDisplayId_ShouldGenerateEventWithMismatchedPointerDisplay) {
+       ConfigureDisplayIdShouldGenerateEventWithMismatchedPointerDisplay) {
     CursorInputMapper& mapper = constructAndAddMapper<CursorInputMapper>();
 
     // Set up the default display as the display on which the pointer should be shown.
diff --git a/services/inputflinger/tests/PointerChoreographer_test.cpp b/services/inputflinger/tests/PointerChoreographer_test.cpp
index 84673a6..4bce824 100644
--- a/services/inputflinger/tests/PointerChoreographer_test.cpp
+++ b/services/inputflinger/tests/PointerChoreographer_test.cpp
@@ -38,13 +38,17 @@
 constexpr int32_t DISPLAY_ID = 5;
 constexpr int32_t ANOTHER_DISPLAY_ID = 10;
 
+const auto MOUSE_POINTER = PointerBuilder(/*id=*/0, ToolType::MOUSE)
+                                   .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
+                                   .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20);
+
 static InputDeviceInfo generateTestDeviceInfo(int32_t deviceId, uint32_t source,
                                               int32_t associatedDisplayId) {
     InputDeviceIdentifier identifier;
 
     auto info = InputDeviceInfo();
-    info.initialize(deviceId, /*generation*/ 1, /*controllerNumber*/ 1, identifier, "alias",
-                    /*isExternal*/ false, /*hasMic*/ false, associatedDisplayId);
+    info.initialize(deviceId, /*generation=*/1, /*controllerNumber=*/1, identifier, "alias",
+                    /*isExternal=*/false, /*hasMic=*/false, associatedDisplayId);
     info.addSource(source);
     return info;
 }
@@ -161,21 +165,19 @@
     }
 }
 
-TEST_F(PointerChoreographerTest, WhenMouseIsJustAdded_DoesNotCreatePointerController) {
+TEST_F(PointerChoreographerTest, WhenMouseIsJustAddedDoesNotCreatePointerController) {
     mChoreographer.notifyInputDevicesChanged(
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     assertPointerControllerNotCreated();
     assertPointerControllerCount(size_t(0));
 }
 
-TEST_F(PointerChoreographerTest, WhenMouseEventOccurs_CreatesPointerController) {
+TEST_F(PointerChoreographerTest, WhenMouseEventOccursCreatesPointerController) {
     mChoreographer.notifyInputDevicesChanged(
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -183,14 +185,12 @@
     assertPointerControllerCount(size_t(1));
 }
 
-TEST_F(PointerChoreographerTest, WhenMouseIsRemoved_RemovesPointerController) {
+TEST_F(PointerChoreographerTest, WhenMouseIsRemovedRemovesPointerController) {
     mChoreographer.notifyInputDevicesChanged(
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -202,7 +202,7 @@
     assertPointerControllerCount(size_t(0));
 }
 
-TEST_F(PointerChoreographerTest, WhenKeyboardIsAdded_DoesNotCreatePointerController) {
+TEST_F(PointerChoreographerTest, WhenKeyboardIsAddedDoesNotCreatePointerController) {
     mChoreographer.notifyInputDevicesChanged(
             {/*id=*/0,
              {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_KEYBOARD, ADISPLAY_ID_NONE)}});
@@ -220,9 +220,7 @@
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, DISPLAY_ID)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(DISPLAY_ID)
                     .build());
@@ -231,16 +229,14 @@
     ASSERT_EQ(DISPLAY_ID, mPointerControllers.back().lock()->getDisplayId());
 }
 
-TEST_F(PointerChoreographerTest, WhenViewportSetLater_SetsViewportForAssociatedMouse) {
+TEST_F(PointerChoreographerTest, WhenViewportSetLaterSetsViewportForAssociatedMouse) {
     // Without viewport information, PointerController will be created by a mouse event
     // but viewport won't be set.
     mChoreographer.notifyInputDevicesChanged(
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, DISPLAY_ID)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(DISPLAY_ID)
                     .build());
@@ -263,9 +259,7 @@
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -275,7 +269,7 @@
 }
 
 TEST_F(PointerChoreographerTest,
-       WhenDefaultMouseDisplayChanges_SetsDefaultMouseViewportForPointerController) {
+       WhenDefaultMouseDisplayChangesSetsDefaultMouseViewportForPointerController) {
     // Set one display as a default mouse display and emit mouse event to create PointerController.
     mChoreographer.setDisplayViewports(createViewports({DISPLAY_ID, ANOTHER_DISPLAY_ID}));
     mChoreographer.setDefaultMouseDisplayId(DISPLAY_ID);
@@ -283,9 +277,7 @@
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -301,9 +293,7 @@
     // New PointerController for the new default display will be created by the motion event.
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -319,9 +309,7 @@
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -329,15 +317,13 @@
     assertPointerDisplayIdNotified(DISPLAY_ID);
 }
 
-TEST_F(PointerChoreographerTest, WhenViewportIsSetLater_CallsNotifyPointerDisplayIdChanged) {
+TEST_F(PointerChoreographerTest, WhenViewportIsSetLaterCallsNotifyPointerDisplayIdChanged) {
     mChoreographer.setDefaultMouseDisplayId(DISPLAY_ID);
     mChoreographer.notifyInputDevicesChanged(
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -347,16 +333,14 @@
     assertPointerDisplayIdNotified(DISPLAY_ID);
 }
 
-TEST_F(PointerChoreographerTest, WhenMouseIsRemoved_CallsNotifyPointerDisplayIdChanged) {
+TEST_F(PointerChoreographerTest, WhenMouseIsRemovedCallsNotifyPointerDisplayIdChanged) {
     mChoreographer.setDefaultMouseDisplayId(DISPLAY_ID);
     mChoreographer.setDisplayViewports(createViewports({DISPLAY_ID}));
     mChoreographer.notifyInputDevicesChanged(
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -368,8 +352,7 @@
     assertPointerControllerCount(size_t(0));
 }
 
-TEST_F(PointerChoreographerTest,
-       WhenDefaultMouseDisplayChanges_CallsNotifyPointerDisplayIdChanged) {
+TEST_F(PointerChoreographerTest, WhenDefaultMouseDisplayChangesCallsNotifyPointerDisplayIdChanged) {
     // Add two viewports.
     mChoreographer.setDisplayViewports(createViewports({DISPLAY_ID, ANOTHER_DISPLAY_ID}));
 
@@ -379,9 +362,7 @@
             {/*id=*/0, {generateTestDeviceInfo(DEVICE_ID, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_NONE)}});
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
@@ -395,9 +376,7 @@
     // After a mouse event, pointer display ID will be notified with new default mouse display.
     mChoreographer.notifyMotion(
             MotionArgsBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE, AINPUT_SOURCE_MOUSE)
-                    .pointer(PointerBuilder(/*id=*/0, ToolType::MOUSE)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_X, 10)
-                                     .axis(AMOTION_EVENT_AXIS_RELATIVE_Y, 20))
+                    .pointer(MOUSE_POINTER)
                     .deviceId(DEVICE_ID)
                     .displayId(ADISPLAY_ID_NONE)
                     .build());
diff --git a/services/inputflinger/tests/fuzzers/MapperHelpers.h b/services/inputflinger/tests/fuzzers/MapperHelpers.h
index 6245a22..2f84497 100644
--- a/services/inputflinger/tests/fuzzers/MapperHelpers.h
+++ b/services/inputflinger/tests/fuzzers/MapperHelpers.h
@@ -310,7 +310,7 @@
     void setTouchAffineTransformation(const TouchAffineTransformation t) { mTransform = t; }
     void notifyStylusGestureStarted(int32_t, nsecs_t) {}
     bool isInputMethodConnectionActive() override { return mFdp->ConsumeBool(); }
-    std::optional<DisplayViewport> getViewportForPointerDevice(
+    std::optional<DisplayViewport> getPointerViewportForAssociatedDisplay(
             int32_t associatedDisplayId) override {
         return {};
     }