inputflinger: make parameter comment style consistent
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: none
Test: host-side inputflinger_tests
Change-Id: I89625844bcd19d27c43b4f14f1f207ade39a4718
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 44c133c..143d25c 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -670,8 +670,7 @@
while (!mConnectionsByToken.empty()) {
sp<Connection> connection = mConnectionsByToken.begin()->second;
- removeInputChannelLocked(connection->inputChannel->getConnectionToken(),
- false /* notify */);
+ removeInputChannelLocked(connection->inputChannel->getConnectionToken(), /*notify=*/false);
}
}
@@ -1023,7 +1022,7 @@
if (isPointerDownEvent && mAwaitedFocusedApplication != nullptr) {
const int32_t displayId = motionEntry.displayId;
const auto [x, y] = resolveTouchedPosition(motionEntry);
- const bool isStylus = isPointerFromStylus(motionEntry, 0 /*pointerIndex*/);
+ const bool isStylus = isPointerFromStylus(motionEntry, /*pointerIndex=*/0);
auto [touchedWindowHandle, _] = findTouchedWindowAtLocked(displayId, x, y, isStylus);
if (touchedWindowHandle != nullptr &&
@@ -2372,7 +2371,7 @@
if (maskedAction == AMOTION_EVENT_ACTION_MOVE && entry.pointerCount == 1 &&
tempTouchState.isSlippery()) {
const auto [x, y] = resolveTouchedPosition(entry);
- const bool isStylus = isPointerFromStylus(entry, 0 /*pointerIndex*/);
+ const bool isStylus = isPointerFromStylus(entry, /*pointerIndex=*/0);
sp<WindowInfoHandle> oldTouchedWindowHandle =
tempTouchState.getFirstForegroundWindowHandle();
auto [newTouchedWindowHandle, _] = findTouchedWindowAtLocked(displayId, x, y, isStylus);
@@ -2609,7 +2608,7 @@
constexpr bool isStylus = false;
auto [dropWindow, _] =
- findTouchedWindowAtLocked(displayId, x, y, isStylus, true /*ignoreDragWindow*/);
+ findTouchedWindowAtLocked(displayId, x, y, isStylus, /*ignoreDragWindow=*/true);
if (dropWindow) {
vec2 local = dropWindow->getInfo()->transform.transform(x, y);
sendDropWindowCommandLocked(dropWindow->getToken(), local.x, local.y);
@@ -2666,19 +2665,19 @@
constexpr bool isStylus = false;
auto [hoverWindowHandle, _] = findTouchedWindowAtLocked(entry.displayId, x, y, isStylus,
- true /*ignoreDragWindow*/);
+ /*ignoreDragWindow=*/true);
// enqueue drag exit if needed.
if (hoverWindowHandle != mDragState->dragHoverWindowHandle &&
!haveSameToken(hoverWindowHandle, mDragState->dragHoverWindowHandle)) {
if (mDragState->dragHoverWindowHandle != nullptr) {
- enqueueDragEventLocked(mDragState->dragHoverWindowHandle, true /*isExiting*/, x,
+ enqueueDragEventLocked(mDragState->dragHoverWindowHandle, /*isExiting=*/true, x,
y);
}
mDragState->dragHoverWindowHandle = hoverWindowHandle;
}
// enqueue drag location if needed.
if (hoverWindowHandle != nullptr) {
- enqueueDragEventLocked(hoverWindowHandle, false /*isExiting*/, x, y);
+ enqueueDragEventLocked(hoverWindowHandle, /*isExiting=*/false, x, y);
}
break;
}
@@ -3356,8 +3355,7 @@
// Don't apply window scale here since we don't want scale to affect raw
// coordinates. The scale will be sent back to the client and applied
// later when requesting relative coordinates.
- scaledCoords[i].scale(globalScaleFactor, 1 /* windowXScale */,
- 1 /* windowYScale */);
+ scaledCoords[i].scale(globalScaleFactor, /*windowXScale=*/1, /*windowYScale=*/1);
}
usingCoords = scaledCoords;
}
@@ -3493,7 +3491,7 @@
"event to it, status=%s(%d)",
connection->getInputChannelName().c_str(), statusToString(status).c_str(),
status);
- abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
+ abortBrokenDispatchCycleLocked(currentTime, connection, /*notify=*/true);
} else {
// Pipe is full and we are waiting for the app to finish process some events
// before sending more events to it.
@@ -3508,7 +3506,7 @@
"status=%s(%d)",
connection->getInputChannelName().c_str(), statusToString(status).c_str(),
status);
- abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
+ abortBrokenDispatchCycleLocked(currentTime, connection, /*notify=*/true);
}
return;
}
@@ -4245,7 +4243,7 @@
// Just enqueue a new sensor event.
std::unique_ptr<SensorEntry> newEntry =
std::make_unique<SensorEntry>(args->id, args->eventTime, args->deviceId,
- args->source, 0 /* policyFlags*/, args->hwTimestamp,
+ args->source, /* policyFlags=*/0, args->hwTimestamp,
args->sensorType, args->accuracy,
args->accuracyChanged, args->values);
@@ -5639,7 +5637,7 @@
const sp<IBinder>& token = serverChannel->getConnectionToken();
int fd = serverChannel->getFd();
sp<Connection> connection =
- sp<Connection>::make(std::move(serverChannel), false /*monitor*/, mIdGenerator);
+ sp<Connection>::make(std::move(serverChannel), /*monitor=*/false, mIdGenerator);
if (mConnectionsByToken.find(token) != mConnectionsByToken.end()) {
ALOGE("Created a new connection, but the token %p is already known", token.get());
@@ -5677,7 +5675,7 @@
}
sp<Connection> connection =
- sp<Connection>::make(serverChannel, true /*monitor*/, mIdGenerator);
+ sp<Connection>::make(serverChannel, /*monitor=*/true, mIdGenerator);
const sp<IBinder>& token = serverChannel->getConnectionToken();
const int fd = serverChannel->getFd();
@@ -5703,7 +5701,7 @@
{ // acquire lock
std::scoped_lock _l(mLock);
- status_t status = removeInputChannelLocked(connectionToken, false /*notify*/);
+ status_t status = removeInputChannelLocked(connectionToken, /*notify=*/false);
if (status) {
return status;
}
@@ -6411,11 +6409,11 @@
CancelationOptions options(CancelationOptions::Mode::CANCEL_NON_POINTER_EVENTS,
"focus left window");
synthesizeCancelationEventsForInputChannelLocked(focusedInputChannel, options);
- enqueueFocusEventLocked(changes.oldFocus, false /*hasFocus*/, changes.reason);
+ enqueueFocusEventLocked(changes.oldFocus, /*hasFocus=*/false, changes.reason);
}
}
if (changes.newFocus) {
- enqueueFocusEventLocked(changes.newFocus, true /*hasFocus*/, changes.reason);
+ enqueueFocusEventLocked(changes.newFocus, /*hasFocus=*/true, changes.reason);
}
// If a window has pointer capture, then it must have focus. We need to ensure that this
diff --git a/services/inputflinger/dispatcher/InputState.cpp b/services/inputflinger/dispatcher/InputState.cpp
index 93419a1..de8bfd5 100644
--- a/services/inputflinger/dispatcher/InputState.cpp
+++ b/services/inputflinger/dispatcher/InputState.cpp
@@ -97,7 +97,7 @@
switch (actionMasked) {
case AMOTION_EVENT_ACTION_UP:
case AMOTION_EVENT_ACTION_CANCEL: {
- ssize_t index = findMotionMemento(entry, false /*hovering*/);
+ ssize_t index = findMotionMemento(entry, /*hovering=*/false);
if (index >= 0) {
mMotionMementos.erase(mMotionMementos.begin() + index);
return true;
@@ -111,11 +111,11 @@
}
case AMOTION_EVENT_ACTION_DOWN: {
- ssize_t index = findMotionMemento(entry, false /*hovering*/);
+ ssize_t index = findMotionMemento(entry, /*hovering=*/false);
if (index >= 0) {
mMotionMementos.erase(mMotionMementos.begin() + index);
}
- addMotionMemento(entry, flags, false /*hovering*/);
+ addMotionMemento(entry, flags, /*hovering=*/false);
return true;
}
@@ -129,7 +129,7 @@
return true;
}
- ssize_t index = findMotionMemento(entry, false /*hovering*/);
+ ssize_t index = findMotionMemento(entry, /*hovering=*/false);
if (entry.source & AINPUT_SOURCE_CLASS_JOYSTICK) {
// Joysticks can send MOVE events without a corresponding DOWN or UP. Since all
@@ -145,7 +145,7 @@
memento.setPointers(entry);
}
} else if (!entry.pointerCoords[0].isEmpty()) {
- addMotionMemento(entry, flags, false /*hovering*/);
+ addMotionMemento(entry, flags, /*hovering=*/false);
}
// Joysticks and trackballs can send MOVE events without corresponding DOWN or UP.
@@ -168,7 +168,7 @@
}
case AMOTION_EVENT_ACTION_HOVER_EXIT: {
- ssize_t index = findMotionMemento(entry, true /*hovering*/);
+ ssize_t index = findMotionMemento(entry, /*hovering=*/true);
if (index >= 0) {
mMotionMementos.erase(mMotionMementos.begin() + index);
return true;
@@ -183,11 +183,11 @@
case AMOTION_EVENT_ACTION_HOVER_ENTER:
case AMOTION_EVENT_ACTION_HOVER_MOVE: {
- ssize_t index = findMotionMemento(entry, true /*hovering*/);
+ ssize_t index = findMotionMemento(entry, /*hovering=*/true);
if (index >= 0) {
mMotionMementos.erase(mMotionMementos.begin() + index);
}
- addMotionMemento(entry, flags, true /*hovering*/);
+ addMotionMemento(entry, flags, /*hovering=*/true);
return true;
}
@@ -280,7 +280,7 @@
memento.policyFlags, AKEY_EVENT_ACTION_UP,
memento.flags | AKEY_EVENT_FLAG_CANCELED,
memento.keyCode, memento.scanCode, memento.metaState,
- 0 /*repeatCount*/, memento.downTime));
+ /*repeatCount=*/0, memento.downTime));
}
}
@@ -297,8 +297,8 @@
std::make_unique<MotionEntry>(mIdGenerator.nextId(), currentTime,
memento.deviceId, memento.source,
memento.displayId, memento.policyFlags,
- action, 0 /*actionButton*/, flags, AMETA_NONE,
- 0 /*buttonState*/, MotionClassification::NONE,
+ action, /*actionButton=*/0, flags, AMETA_NONE,
+ /*buttonState=*/0, MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE,
memento.xPrecision, memento.yPrecision,
memento.xCursorPosition,
@@ -359,8 +359,8 @@
std::make_unique<MotionEntry>(mIdGenerator.nextId(), currentTime,
memento.deviceId, memento.source,
memento.displayId, memento.policyFlags, action,
- 0 /*actionButton*/, memento.flags, AMETA_NONE,
- 0 /*buttonState*/, MotionClassification::NONE,
+ /*actionButton=*/0, memento.flags, AMETA_NONE,
+ /*buttonState=*/0, MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE, memento.xPrecision,
memento.yPrecision, memento.xCursorPosition,
memento.yCursorPosition, memento.downTime,
@@ -398,8 +398,8 @@
events.push_back(
std::make_unique<MotionEntry>(mIdGenerator.nextId(), currentTime, memento.deviceId,
memento.source, memento.displayId,
- memento.policyFlags, action, 0 /*actionButton*/,
- flags, AMETA_NONE, 0 /*buttonState*/,
+ memento.policyFlags, action, /*actionButton=*/0,
+ flags, AMETA_NONE, /*buttonState=*/0,
MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE, memento.xPrecision,
memento.yPrecision, memento.xCursorPosition,
@@ -425,9 +425,9 @@
std::make_unique<MotionEntry>(mIdGenerator.nextId(), currentTime,
memento.deviceId, memento.source,
memento.displayId, memento.policyFlags, action,
- 0 /*actionButton*/,
+ /*actionButton=*/0,
memento.flags | AMOTION_EVENT_FLAG_CANCELED,
- AMETA_NONE, 0 /*buttonState*/,
+ AMETA_NONE, /*buttonState=*/0,
MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE, memento.xPrecision,
memento.yPrecision, memento.xCursorPosition,
diff --git a/services/inputflinger/dispatcher/LatencyTracker.cpp b/services/inputflinger/dispatcher/LatencyTracker.cpp
index 52f189c..2dd7d3f 100644
--- a/services/inputflinger/dispatcher/LatencyTracker.cpp
+++ b/services/inputflinger/dispatcher/LatencyTracker.cpp
@@ -148,7 +148,7 @@
void LatencyTracker::reportAndPruneMatureRecords(nsecs_t newEventTime) {
while (!mEventTimes.empty()) {
const auto& [oldestEventTime, oldestInputEventId] = *mEventTimes.begin();
- if (isMatureEvent(oldestEventTime, newEventTime /*now*/)) {
+ if (isMatureEvent(oldestEventTime, /*now=*/newEventTime)) {
// Report and drop this event
const auto it = mTimelines.find(oldestInputEventId);
LOG_ALWAYS_FATAL_IF(it == mTimelines.end(),