inputflinger: fix format of parameter name comments
The Google C++ style guide [0] suggests that parameter name comments
should be of the form `/*paramName=*/value`. This potentially allows
tooling to check that the parameter names are correct, too.
[0]: https://google.github.io/styleguide/cppguide.html#Function_Argument_Comments
Bug: 245989146
Test: presubmit
Change-Id: I6239599692ada74438ebd8141adc05afacec915d
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index d3c29a7..abb0610 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -2980,7 +2980,7 @@
!haveSameApplicationToken(windowInfo, otherInfo)) {
if (DEBUG_TOUCH_OCCLUSION) {
info.debugInfo.push_back(
- dumpWindowForTouchOcclusion(otherInfo, /* isTouchedWindow */ false));
+ dumpWindowForTouchOcclusion(otherInfo, /*isTouchedWindow=*/false));
}
// canBeObscuredBy() has returned true above, which means this window is untrusted, so
// we perform the checks below to see if the touch can be propagated or not based on the
@@ -3008,8 +3008,7 @@
}
}
if (DEBUG_TOUCH_OCCLUSION) {
- info.debugInfo.push_back(
- dumpWindowForTouchOcclusion(windowInfo, /* isTouchedWindow */ true));
+ info.debugInfo.push_back(dumpWindowForTouchOcclusion(windowInfo, /*isTouchedWindow=*/true));
}
return info;
}
@@ -6705,7 +6704,7 @@
{ // acquire lock
std::scoped_lock _l(mLock);
// Set an empty list to remove all handles from the specific display.
- setInputWindowsLocked(/* window handles */ {}, displayId);
+ setInputWindowsLocked(/*windowInfoHandles=*/{}, displayId);
setFocusedApplicationLocked(displayId, nullptr);
// Call focus resolver to clean up stale requests. This must be called after input windows
// have been removed for the removed display.
diff --git a/services/inputflinger/reader/mapper/CursorInputMapper.cpp b/services/inputflinger/reader/mapper/CursorInputMapper.cpp
index c684ed4..79f07a5 100644
--- a/services/inputflinger/reader/mapper/CursorInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/CursorInputMapper.cpp
@@ -347,7 +347,7 @@
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
&pointerCoords, mXPrecision, mYPrecision,
xCursorPosition, yCursorPosition, downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
}
@@ -357,7 +357,7 @@
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
&pointerCoords, mXPrecision, mYPrecision, xCursorPosition,
yCursorPosition, downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
if (buttonsPressed) {
BitSet32 pressed(buttonsPressed);
@@ -371,7 +371,7 @@
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
&pointerCoords, mXPrecision, mYPrecision,
xCursorPosition, yCursorPosition, downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
}
@@ -386,7 +386,7 @@
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
&pointerCoords, mXPrecision, mYPrecision,
xCursorPosition, yCursorPosition, downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
// Send scroll events.
@@ -401,7 +401,7 @@
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
&pointerCoords, mXPrecision, mYPrecision,
xCursorPosition, yCursorPosition, downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
}
diff --git a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
index 099a955..8a9ea75 100644
--- a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
@@ -352,7 +352,7 @@
MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&pointerProperties, &pointerCoords, 0, 0,
AMOTION_EVENT_INVALID_CURSOR_POSITION,
- AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, /* videoFrames */ {}));
+ AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, /*videoFrames=*/{}));
return out;
}
diff --git a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
index 7251830..07ae5b1 100644
--- a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
@@ -148,10 +148,10 @@
out.push_back(
NotifyMotionArgs(getContext()->getNextId(), when, readTime, getDeviceId(), mSource,
displayId, policyFlags, AMOTION_EVENT_ACTION_SCROLL, 0, 0,
- metaState, /* buttonState */ 0, MotionClassification::NONE,
+ metaState, /*buttonState=*/0, MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
&pointerCoords, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
- AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, /* videoFrames */ {}));
+ AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, /*videoFrames=*/{}));
}
mRotaryEncoderScrollAccumulator.finishSync();
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index 44538f1..f48ff4c 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -2744,7 +2744,7 @@
buttonState, MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
&pointerCoords, 0, 0, x, y, mPointerGesture.downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
// Update state.
@@ -3643,7 +3643,7 @@
mOrientedXPrecision, mOrientedYPrecision,
mPointerSimple.lastCursorX, mPointerSimple.lastCursorY,
mPointerSimple.downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
if (mPointerSimple.hovering && !hovering) {
@@ -3658,7 +3658,7 @@
&mPointerSimple.lastCoords, mOrientedXPrecision,
mOrientedYPrecision, mPointerSimple.lastCursorX,
mPointerSimple.lastCursorY, mPointerSimple.downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
if (down) {
@@ -3675,7 +3675,7 @@
&mPointerSimple.currentProperties,
&mPointerSimple.currentCoords, mOrientedXPrecision,
mOrientedYPrecision, cursorPosition.x, cursorPosition.y,
- mPointerSimple.downTime, /* videoFrames */ {}));
+ mPointerSimple.downTime, /*videoFrames=*/{}));
}
// Send move.
@@ -3686,7 +3686,7 @@
&mPointerSimple.currentProperties,
&mPointerSimple.currentCoords, mOrientedXPrecision,
mOrientedYPrecision, cursorPosition.x, cursorPosition.y,
- mPointerSimple.downTime, /* videoFrames */ {}));
+ mPointerSimple.downTime, /*videoFrames=*/{}));
}
if (hovering) {
@@ -3702,7 +3702,7 @@
&mPointerSimple.currentProperties,
&mPointerSimple.currentCoords, mOrientedXPrecision,
mOrientedYPrecision, cursorPosition.x, cursorPosition.y,
- mPointerSimple.downTime, /* videoFrames */ {}));
+ mPointerSimple.downTime, /*videoFrames=*/{}));
}
// Send hover move.
@@ -3713,7 +3713,7 @@
MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&mPointerSimple.currentProperties, &mPointerSimple.currentCoords,
mOrientedXPrecision, mOrientedYPrecision, cursorPosition.x,
- cursorPosition.y, mPointerSimple.downTime, /* videoFrames */ {}));
+ cursorPosition.y, mPointerSimple.downTime, /*videoFrames=*/{}));
}
if (mCurrentRawState.rawVScroll || mCurrentRawState.rawHScroll) {
@@ -3735,7 +3735,7 @@
&mPointerSimple.currentProperties, &pointerCoords,
mOrientedXPrecision, mOrientedYPrecision, cursorPosition.x,
cursorPosition.y, mPointerSimple.downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
}
// Save state.
@@ -3766,7 +3766,7 @@
mOrientedXPrecision, mOrientedYPrecision,
mPointerSimple.lastCursorX, mPointerSimple.lastCursorY,
mPointerSimple.downTime,
- /* videoFrames */ {}));
+ /*videoFrames=*/{}));
if (mPointerController != nullptr) {
mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
}
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index 2950656..6a6312e 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -641,7 +641,7 @@
void SetUp() override {
mFakePolicy = std::make_unique<FakeInputDispatcherPolicy>();
mDispatcher = std::make_unique<InputDispatcher>(*mFakePolicy, STALE_EVENT_TIMEOUT);
- mDispatcher->setInputDispatchMode(/*enabled*/ true, /*frozen*/ false);
+ mDispatcher->setInputDispatchMode(/*enabled=*/true, /*frozen=*/false);
// Start InputDispatcher thread
ASSERT_EQ(OK, mDispatcher->start());
}
@@ -682,7 +682,7 @@
// Rejects undefined key actions.
event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD, ADISPLAY_ID_NONE,
INVALID_HMAC,
- /*action*/ -1, 0, AKEYCODE_A, KEY_A, AMETA_NONE, 0, ARBITRARY_TIME,
+ /*action=*/-1, 0, AKEYCODE_A, KEY_A, AMETA_NONE, 0, ARBITRARY_TIME,
ARBITRARY_TIME);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
@@ -718,11 +718,11 @@
ui::Transform identityTransform;
// Rejects undefined motion actions.
event.initialize(InputEvent::nextId(), DEVICE_ID, source, DISPLAY_ID, INVALID_HMAC,
- /*action*/ -1, 0, 0, edgeFlags, metaState, 0, classification,
+ /*action=*/-1, 0, 0, edgeFlags, metaState, 0, classification,
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -734,7 +734,7 @@
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -746,7 +746,7 @@
0, 0, edgeFlags, metaState, 0, classification, identityTransform, 0, 0,
AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_CURSOR_POSITION,
identityTransform, ARBITRARY_TIME, ARBITRARY_TIME,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -758,7 +758,7 @@
0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -770,7 +770,7 @@
0, 0, edgeFlags, metaState, 0, classification, identityTransform, 0, 0,
AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_CURSOR_POSITION,
identityTransform, ARBITRARY_TIME, ARBITRARY_TIME,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -782,7 +782,7 @@
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ 0, pointerProperties, pointerCoords);
+ /*pointerCount=*/0, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -793,7 +793,7 @@
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ MAX_POINTERS + 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/MAX_POINTERS + 1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -806,7 +806,7 @@
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -818,7 +818,7 @@
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -832,7 +832,7 @@
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, ARBITRARY_TIME,
ARBITRARY_TIME,
- /*pointerCount*/ 2, pointerProperties, pointerCoords);
+ /*pointerCount=*/2, pointerProperties, pointerCoords);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -1551,8 +1551,8 @@
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
// Define a valid key event.
NotifyKeyArgs args(/*id=*/0, currentTime, /*readTime=*/0, DEVICE_ID, AINPUT_SOURCE_KEYBOARD,
- displayId, POLICY_FLAG_PASS_TO_USER, action, /* flags */ 0, AKEYCODE_A,
- KEY_A, AMETA_NONE, currentTime);
+ displayId, POLICY_FLAG_PASS_TO_USER, action, /*flags=*/0, AKEYCODE_A, KEY_A,
+ AMETA_NONE, currentTime);
return args;
}
@@ -1562,7 +1562,7 @@
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
// Define a valid key event.
NotifyKeyArgs args(/*id=*/0, currentTime, /*readTime=*/0, DEVICE_ID, AINPUT_SOURCE_KEYBOARD,
- displayId, 0, action, /* flags */ 0, AKEYCODE_C, KEY_C, AMETA_META_ON,
+ displayId, 0, action, /*flags=*/0, AKEYCODE_C, KEY_C, AMETA_META_ON,
currentTime);
return args;
@@ -1573,7 +1573,7 @@
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
// Define a valid key event.
NotifyKeyArgs args(/*id=*/0, currentTime, /*readTime=*/0, DEVICE_ID, AINPUT_SOURCE_KEYBOARD,
- displayId, 0, action, /* flags */ 0, AKEYCODE_ASSIST, KEY_ASSISTANT,
+ displayId, 0, action, /*flags=*/0, AKEYCODE_ASSIST, KEY_ASSISTANT,
AMETA_NONE, currentTime);
return args;
@@ -1603,12 +1603,12 @@
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
// Define a valid motion event.
NotifyMotionArgs args(/*id=*/0, currentTime, /*readTime=*/0, DEVICE_ID, source, displayId,
- POLICY_FLAG_PASS_TO_USER, action, /* actionButton */ 0, /* flags */ 0,
- AMETA_NONE, /* buttonState */ 0, MotionClassification::NONE,
+ POLICY_FLAG_PASS_TO_USER, action, /*actionButton=*/0, /*flags=*/0,
+ AMETA_NONE, /*buttonState=*/0, MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE, pointerCount, pointerProperties,
- pointerCoords, /* xPrecision */ 0, /* yPrecision */ 0,
+ pointerCoords, /*xPrecision=*/0, /*yPrecision=*/0,
AMOTION_EVENT_INVALID_CURSOR_POSITION,
- AMOTION_EVENT_INVALID_CURSOR_POSITION, currentTime, /* videoFrames */ {});
+ AMOTION_EVENT_INVALID_CURSOR_POSITION, currentTime, /*videoFrames=*/{});
return args;
}
@@ -1923,8 +1923,7 @@
AINPUT_SOURCE_TOUCHSCREEN)
.displayId(ADISPLAY_ID_DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
- .pointer(PointerBuilder(/* id */ 1,
- ToolType::FINGER)
+ .pointer(PointerBuilder(/*id=*/1, ToolType::FINGER)
.x(100)
.y(100))
.build(),
@@ -5700,7 +5699,7 @@
virtual void SetUp() override {
mFakePolicy = std::make_unique<FakeInputDispatcherPolicy>();
mDispatcher = std::make_unique<InputDispatcher>(*mFakePolicy);
- mDispatcher->setInputDispatchMode(/*enabled*/ true, /*frozen*/ false);
+ mDispatcher->setInputDispatchMode(/*enabled=*/true, /*frozen=*/false);
mDispatcher->setKeyRepeatConfiguration(KEY_REPEAT_TIMEOUT, KEY_REPEAT_DELAY);
ASSERT_EQ(OK, mDispatcher->start());
@@ -6092,36 +6091,36 @@
// Test InputFilter for MotionEvent
TEST_F(InputFilterTest, MotionEvent_InputFilter) {
// Since the InputFilter is disabled by default, check if touch events aren't filtered.
- testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered*/ false);
- testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered*/ false);
+ testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered=*/false);
+ testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered=*/false);
// Enable InputFilter
mDispatcher->setInputFilterEnabled(true);
// Test touch on both primary and second display, and check if both events are filtered.
- testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered*/ true);
- testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered*/ true);
+ testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered=*/true);
+ testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered=*/true);
// Disable InputFilter
mDispatcher->setInputFilterEnabled(false);
// Test touch on both primary and second display, and check if both events aren't filtered.
- testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered*/ false);
- testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered*/ false);
+ testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered=*/false);
+ testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered=*/false);
}
// Test InputFilter for KeyEvent
TEST_F(InputFilterTest, KeyEvent_InputFilter) {
// Since the InputFilter is disabled by default, check if key event aren't filtered.
- testNotifyKey(/*expectToBeFiltered*/ false);
+ testNotifyKey(/*expectToBeFiltered=*/false);
// Enable InputFilter
mDispatcher->setInputFilterEnabled(true);
// Send a key event, and check if it is filtered.
- testNotifyKey(/*expectToBeFiltered*/ true);
+ testNotifyKey(/*expectToBeFiltered=*/true);
// Disable InputFilter
mDispatcher->setInputFilterEnabled(false);
// Send a key event, and check if it isn't filtered.
- testNotifyKey(/*expectToBeFiltered*/ false);
+ testNotifyKey(/*expectToBeFiltered=*/false);
}
// Ensure that MotionEvents sent to the InputFilter through InputListener are converted to the
@@ -6144,8 +6143,8 @@
mDispatcher->setInputFilterEnabled(true);
// Ensure the correct transforms are used for the displays.
- testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered*/ true, firstDisplayTransform);
- testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered*/ true, secondDisplayTransform);
+ testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered=*/true, firstDisplayTransform);
+ testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered=*/true, secondDisplayTransform);
}
class InputFilterInjectionPolicyTest : public InputDispatcherTest {
@@ -6214,7 +6213,7 @@
identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, eventTime,
eventTime,
- /*pointerCount*/ 1, pointerProperties, pointerCoords);
+ /*pointerCount=*/1, pointerProperties, pointerCoords);
const int32_t additionalPolicyFlags = POLICY_FLAG_PASS_TO_USER;
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
@@ -6763,7 +6762,7 @@
// Define a valid key down event that is stale (too old).
event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD, ADISPLAY_ID_NONE,
- INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, /* flags */ 0, AKEYCODE_A, KEY_A,
+ INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, /*flags=*/0, AKEYCODE_A, KEY_A,
AMETA_NONE, /*repeatCount=*/1, eventTime, eventTime);
const int32_t policyFlags = POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER;
@@ -9435,8 +9434,8 @@
// Spy window pilfers the pointers.
EXPECT_EQ(OK, mDispatcher->pilferPointers(spy->getToken()));
- window->consumeMotionPointerUp(/* idx */ 2, ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
- window->consumeMotionPointerUp(/* idx */ 1, ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
+ window->consumeMotionPointerUp(/*idx=*/2, ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
+ window->consumeMotionPointerUp(/*idx=*/1, ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
spy->assertNoEvents();
window->assertNoEvents();
diff --git a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp
index da0815f..7cfcf71 100644
--- a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp
+++ b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp
@@ -88,14 +88,13 @@
}
// Define a valid motion event.
- NotifyMotionArgs args(/* id */ 0, eventTime, /*readTime=*/0, DEVICE_ID,
- AINPUT_SOURCE_TOUCHSCREEN, /*displayId=*/0, POLICY_FLAG_PASS_TO_USER,
- action, /* actionButton */ 0,
- /* flags */ 0, AMETA_NONE, /* buttonState */ 0,
- MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, pointerCount,
- pointerProperties, pointerCoords, /* xPrecision */ 0, /* yPrecision */ 0,
+ NotifyMotionArgs args(/*id=*/0, eventTime, /*readTime=*/0, DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN,
+ /*displayId=*/0, POLICY_FLAG_PASS_TO_USER, action, /*actionButton=*/0,
+ /*flags=*/0, AMETA_NONE, /*buttonState=*/0, MotionClassification::NONE,
+ AMOTION_EVENT_EDGE_FLAG_NONE, pointerCount, pointerProperties,
+ pointerCoords, /*xPrecision=*/0, /*yPrecision=*/0,
AMOTION_EVENT_INVALID_CURSOR_POSITION,
- AMOTION_EVENT_INVALID_CURSOR_POSITION, downTime, /* videoFrames */ {});
+ AMOTION_EVENT_INVALID_CURSOR_POSITION, downTime, /*videoFrames=*/{});
return args;
}
@@ -104,15 +103,15 @@
InputDeviceIdentifier identifier;
auto info = InputDeviceInfo();
- info.initialize(DEVICE_ID, /*generation*/ 1, /*controllerNumber*/ 1, identifier, "alias",
- /*isExternal*/ false, /*hasMic*/ false, ADISPLAY_ID_NONE);
+ info.initialize(DEVICE_ID, /*generation=*/1, /*controllerNumber=*/1, identifier, "alias",
+ /*isExternal=*/false, /*hasMic=*/false, ADISPLAY_ID_NONE);
info.addSource(AINPUT_SOURCE_TOUCHSCREEN);
- info.addMotionRange(AMOTION_EVENT_AXIS_X, AINPUT_SOURCE_TOUCHSCREEN, 0, 1599, /*flat*/ 0,
- /*fuzz*/ 0, X_RESOLUTION);
- info.addMotionRange(AMOTION_EVENT_AXIS_Y, AINPUT_SOURCE_TOUCHSCREEN, 0, 2559, /*flat*/ 0,
- /*fuzz*/ 0, Y_RESOLUTION);
+ info.addMotionRange(AMOTION_EVENT_AXIS_X, AINPUT_SOURCE_TOUCHSCREEN, 0, 1599, /*flat=*/0,
+ /*fuzz=*/0, X_RESOLUTION);
+ info.addMotionRange(AMOTION_EVENT_AXIS_Y, AINPUT_SOURCE_TOUCHSCREEN, 0, 2559, /*flat=*/0,
+ /*fuzz=*/0, Y_RESOLUTION);
info.addMotionRange(AMOTION_EVENT_AXIS_TOUCH_MAJOR, AINPUT_SOURCE_TOUCHSCREEN, 0, 255,
- /*flat*/ 0, /*fuzz*/ 0, MAJOR_RESOLUTION);
+ /*flat=*/0, /*fuzz=*/0, MAJOR_RESOLUTION);
return info;
}
@@ -152,7 +151,7 @@
}
TEST(RemovePointerIdsTest, RemoveOnePointer) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0,
AMOTION_EVENT_ACTION_MOVE, {{1, 2, 3}, {4, 5, 6}});
NotifyMotionArgs pointer1Only = removePointerIds(args, {0});
@@ -167,7 +166,7 @@
*/
TEST(RemovePointerIdsTest, RemoveTwoPointers) {
NotifyMotionArgs args =
- generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, AMOTION_EVENT_ACTION_MOVE,
+ generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, AMOTION_EVENT_ACTION_MOVE,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
NotifyMotionArgs pointer1Only = removePointerIds(args, {0, 2});
@@ -179,7 +178,7 @@
* pointer during a POINTER_DOWN event.
*/
TEST(RemovePointerIdsTest, ActionPointerDown) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_1_DOWN,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_1_DOWN,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
NotifyMotionArgs pointers0And2 = removePointerIds(args, {1});
@@ -193,7 +192,7 @@
* Remove all pointers during a MOVE event.
*/
TEST(RemovePointerIdsTest, RemoveAllPointersDuringMove) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0,
AMOTION_EVENT_ACTION_MOVE, {{1, 2, 3}, {4, 5, 6}});
NotifyMotionArgs noPointers = removePointerIds(args, {0, 1});
@@ -205,7 +204,7 @@
* then we should just have ACTION_DOWN. Likewise, a POINTER_UP event should become an UP event.
*/
TEST(RemovePointerIdsTest, PointerDownBecomesDown) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_1_DOWN,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_1_DOWN,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
NotifyMotionArgs pointer1 = removePointerIds(args, {0, 2});
@@ -220,11 +219,11 @@
* If a pointer that is now going down is canceled, then we can just drop the POINTER_DOWN event.
*/
TEST(CancelSuppressedPointersTest, CanceledPointerDownIsDropped) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_1_DOWN,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_1_DOWN,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {},
- /*newSuppressedPointerIds*/ {1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{},
+ /*newSuppressedPointerIds=*/{1});
ASSERT_TRUE(result.empty());
}
@@ -232,11 +231,11 @@
* If a pointer is already suppressed, the POINTER_UP event for this pointer should be dropped
*/
TEST(CancelSuppressedPointersTest, SuppressedPointerUpIsDropped) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_1_UP,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_1_UP,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {1},
- /*newSuppressedPointerIds*/ {1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{1},
+ /*newSuppressedPointerIds=*/{1});
ASSERT_TRUE(result.empty());
}
@@ -244,11 +243,11 @@
* If a pointer is already suppressed, it should be removed from a MOVE event.
*/
TEST(CancelSuppressedPointersTest, SuppressedPointerIsRemovedDuringMove) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, MOVE,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, MOVE,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {1},
- /*newSuppressedPointerIds*/ {1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{1},
+ /*newSuppressedPointerIds=*/{1});
ASSERT_EQ(1u, result.size());
assertArgs(result[0], MOVE, {{0, {1, 2, 3}}, {2, {7, 8, 9}}});
}
@@ -259,11 +258,11 @@
* 2) A MOVE event without this pointer
*/
TEST(CancelSuppressedPointersTest, NewlySuppressedPointerIsCanceled) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, MOVE,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, MOVE,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {},
- /*newSuppressedPointerIds*/ {1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{},
+ /*newSuppressedPointerIds=*/{1});
ASSERT_EQ(2u, result.size());
assertArgs(result[0], POINTER_1_UP, {{0, {1, 2, 3}}, {1, {4, 5, 6}}, {2, {7, 8, 9}}});
ASSERT_EQ(FLAG_CANCELED, result[0].flags);
@@ -275,10 +274,10 @@
* should be canceled with ACTION_CANCEL.
*/
TEST(CancelSuppressedPointersTest, SingleSuppressedPointerIsCanceled) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, MOVE, {{1, 2, 3}});
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, MOVE, {{1, 2, 3}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {},
- /*newSuppressedPointerIds*/ {0});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{},
+ /*newSuppressedPointerIds=*/{0});
ASSERT_EQ(1u, result.size());
assertArgs(result[0], CANCEL, {{0, {1, 2, 3}}});
ASSERT_EQ(FLAG_CANCELED, result[0].flags);
@@ -289,11 +288,11 @@
* but this event should also have FLAG_CANCELED to indicate that this pointer was unintentional.
*/
TEST(CancelSuppressedPointersTest, SuppressedPointer1GoingUpIsCanceled) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_1_UP,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_1_UP,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {},
- /*newSuppressedPointerIds*/ {1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{},
+ /*newSuppressedPointerIds=*/{1});
ASSERT_EQ(1u, result.size());
assertArgs(result[0], POINTER_1_UP, {{0, {1, 2, 3}}, {1, {4, 5, 6}}, {2, {7, 8, 9}}});
ASSERT_EQ(FLAG_CANCELED, result[0].flags);
@@ -304,11 +303,11 @@
* errors with handling pointer index inside the action.
*/
TEST(CancelSuppressedPointersTest, SuppressedPointer0GoingUpIsCanceled) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_0_UP,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_0_UP,
{{1, 2, 3}, {4, 5, 6}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {},
- /*newSuppressedPointerIds*/ {0});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{},
+ /*newSuppressedPointerIds=*/{0});
ASSERT_EQ(1u, result.size());
assertArgs(result[0], POINTER_0_UP, {{0, {1, 2, 3}}, {1, {4, 5, 6}}});
ASSERT_EQ(FLAG_CANCELED, result[0].flags);
@@ -320,10 +319,10 @@
*/
TEST(CancelSuppressedPointersTest, TwoNewlySuppressedPointersAreBothCanceled) {
NotifyMotionArgs args =
- generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, MOVE, {{1, 2, 3}, {4, 5, 6}});
+ generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, MOVE, {{1, 2, 3}, {4, 5, 6}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {},
- /*newSuppressedPointerIds*/ {0, 1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{},
+ /*newSuppressedPointerIds=*/{0, 1});
ASSERT_EQ(1u, result.size());
assertArgs(result[0], CANCEL, {{0, {1, 2, 3}}, {1, {4, 5, 6}}});
ASSERT_EQ(FLAG_CANCELED, result[0].flags);
@@ -335,11 +334,11 @@
* would undo the entire gesture.
*/
TEST(CancelSuppressedPointersTest, TwoPointersAreCanceledDuringPointerUp) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_1_UP,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_1_UP,
{{1, 2, 3}, {4, 5, 6}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {1},
- /*newSuppressedPointerIds*/ {0, 1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{1},
+ /*newSuppressedPointerIds=*/{0, 1});
ASSERT_EQ(1u, result.size());
assertArgs(result[0], CANCEL, {{0, {1, 2, 3}}});
ASSERT_EQ(FLAG_CANCELED, result[0].flags);
@@ -350,11 +349,11 @@
* this should become a regular DOWN event because it's the only pointer that will be valid now.
*/
TEST(CancelSuppressedPointersTest, NewPointerDownBecomesDown) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, POINTER_2_DOWN,
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, POINTER_2_DOWN,
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
std::vector<NotifyMotionArgs> result =
- cancelSuppressedPointers(args, /*oldSuppressedPointerIds*/ {0, 1},
- /*newSuppressedPointerIds*/ {0, 1});
+ cancelSuppressedPointers(args, /*oldSuppressedPointerIds=*/{0, 1},
+ /*newSuppressedPointerIds=*/{0, 1});
ASSERT_EQ(1u, result.size());
assertArgs(result[0], DOWN, {{2, {7, 8, 9}}});
ASSERT_EQ(0, result[0].flags);
@@ -365,7 +364,7 @@
* struct is populated as expected.
*/
TEST(GetTouchesTest, ConvertDownEvent) {
- NotifyMotionArgs args = generateMotionArgs(/*downTime*/ 0, /*eventTime*/ 0, DOWN, {{1, 2, 3}});
+ NotifyMotionArgs args = generateMotionArgs(/*downTime=*/0, /*eventTime=*/0, DOWN, {{1, 2, 3}});
AndroidPalmFilterDeviceInfo deviceInfo = generatePalmFilterDeviceInfo();
SlotState slotState;
SlotState oldSlotState = slotState;
@@ -1024,7 +1023,7 @@
mPalmRejector->processMotion(
generateMotionArgs(downTime, downTime, DOWN, {{1342.0, 613.0, 79.0}}));
mPalmRejector->processMotion(
- generateMotionArgs(downTime, /*eventTime*/ 1, POINTER_1_DOWN,
+ generateMotionArgs(downTime, /*eventTime=*/1, POINTER_1_DOWN,
{{1417.0, 685.0, 41.0}, {1062.0, 697.0, 10.0}}));
// Suppress both pointers!!
suppressPointerAtPosition(1414, 702);
@@ -1058,13 +1057,13 @@
mPalmRejector->processMotion(
generateMotionArgs(downTime, downTime, DOWN, {{1342.0, 613.0, 79.0}}));
mPalmRejector->processMotion(
- generateMotionArgs(downTime, /*eventTime*/ 1, POINTER_1_DOWN,
+ generateMotionArgs(downTime, /*eventTime=*/1, POINTER_1_DOWN,
{{1417.0, 685.0, 41.0}, {1062.0, 697.0, 10.0}}));
// Suppress second pointer (pointer 1)
suppressPointerAtPosition(1060, 700);
argsList = mPalmRejector->processMotion(
- generateMotionArgs(downTime, /*eventTime*/ 1, MOVE,
+ generateMotionArgs(downTime, /*eventTime=*/1, MOVE,
{{1417.0, 685.0, 41.0}, {1060, 700, 10.0}}));
ASSERT_EQ(2u, argsList.size());
ASSERT_EQ(POINTER_1_UP, argsList[0].action);
@@ -1076,20 +1075,20 @@
// A new pointer goes down and gets suppressed right away. It should just be dropped
suppressPointerAtPosition(1001, 601);
argsList = mPalmRejector->processMotion(
- generateMotionArgs(downTime, /*eventTime*/ 1, POINTER_2_DOWN,
+ generateMotionArgs(downTime, /*eventTime=*/1, POINTER_2_DOWN,
{{1417.0, 685.0, 41.0}, {1062.0, 697.0, 10.0}, {1001, 601, 5}}));
ASSERT_EQ(0u, argsList.size());
// Likewise, pointer that's already canceled should be ignored
argsList = mPalmRejector->processMotion(
- generateMotionArgs(downTime, /*eventTime*/ 1, POINTER_2_UP,
+ generateMotionArgs(downTime, /*eventTime=*/1, POINTER_2_UP,
{{1417.0, 685.0, 41.0}, {1062.0, 697.0, 10.0}, {1001, 601, 5}}));
ASSERT_EQ(0u, argsList.size());
// Cancel all pointers when pointer 1 goes up. Pointer 1 was already canceled earlier.
suppressPointerAtPosition(1417, 685);
argsList = mPalmRejector->processMotion(
- generateMotionArgs(downTime, /*eventTime*/ 1, POINTER_1_UP,
+ generateMotionArgs(downTime, /*eventTime=*/1, POINTER_1_UP,
{{1417.0, 685.0, 41.0}, {1062.0, 697.0, 10.0}}));
ASSERT_EQ(1u, argsList.size());
ASSERT_EQ(CANCEL, argsList[0].action);