Merge "InputListener: Pass NotifyArgs by reference" into udc-dev
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index cc8ac0a..63f3821 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -700,6 +700,11 @@
return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE, "Couldn't linkToDeath.");
}
+ // make sure all callbacks have been told about a consistent state - b/278038751
+ if (serviceIt->second.hasClients) {
+ cb->onClients(service, true);
+ }
+
mNameToClientCallback[name].push_back(cb);
return Status::ok();
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index d09bc65..60bf857 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -3601,17 +3601,19 @@
"%s cannot be used when the device is not in POINTER mode.", __func__);
std::list<NotifyArgs> out;
int32_t metaState = getContext()->getGlobalMetaState();
+ auto cursorPosition = mPointerSimple.currentCoords.getXYValue();
- if (down || hovering) {
- mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER);
- mPointerController->clearSpots();
- mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE);
- } else if (!down && !hovering && (mPointerSimple.down || mPointerSimple.hovering)) {
- mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
+ if (displayId == mPointerController->getDisplayId()) {
+ std::tie(cursorPosition.x, cursorPosition.y) = mPointerController->getPosition();
+ if (down || hovering) {
+ mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER);
+ mPointerController->clearSpots();
+ mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE);
+ } else if (!down && !hovering && (mPointerSimple.down || mPointerSimple.hovering)) {
+ mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
+ }
}
- const auto [xCursorPosition, yCursorPosition] = mPointerController->getPosition();
-
if (mPointerSimple.down && !down) {
mPointerSimple.down = false;
@@ -3621,8 +3623,9 @@
0, metaState, mLastRawState.buttonState,
MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&mPointerSimple.lastProperties, &mPointerSimple.lastCoords,
- mOrientedXPrecision, mOrientedYPrecision, xCursorPosition,
- yCursorPosition, mPointerSimple.downTime,
+ mOrientedXPrecision, mOrientedYPrecision,
+ mPointerSimple.lastCursorX, mPointerSimple.lastCursorY,
+ mPointerSimple.downTime,
/* videoFrames */ {}));
}
@@ -3630,15 +3633,15 @@
mPointerSimple.hovering = false;
// Send hover exit.
- out.push_back(NotifyMotionArgs(getContext()->getNextId(), when, readTime, getDeviceId(),
- mSource, displayId, policyFlags,
- AMOTION_EVENT_ACTION_HOVER_EXIT, 0, 0, metaState,
- mLastRawState.buttonState, MotionClassification::NONE,
- AMOTION_EVENT_EDGE_FLAG_NONE, 1,
- &mPointerSimple.lastProperties, &mPointerSimple.lastCoords,
- mOrientedXPrecision, mOrientedYPrecision, xCursorPosition,
- yCursorPosition, mPointerSimple.downTime,
- /* videoFrames */ {}));
+ out.push_back(
+ NotifyMotionArgs(getContext()->getNextId(), when, readTime, getDeviceId(), mSource,
+ displayId, policyFlags, AMOTION_EVENT_ACTION_HOVER_EXIT, 0, 0,
+ metaState, mLastRawState.buttonState, MotionClassification::NONE,
+ AMOTION_EVENT_EDGE_FLAG_NONE, 1, &mPointerSimple.lastProperties,
+ &mPointerSimple.lastCoords, mOrientedXPrecision,
+ mOrientedYPrecision, mPointerSimple.lastCursorX,
+ mPointerSimple.lastCursorY, mPointerSimple.downTime,
+ /* videoFrames */ {}));
}
if (down) {
@@ -3654,7 +3657,7 @@
AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&mPointerSimple.currentProperties,
&mPointerSimple.currentCoords, mOrientedXPrecision,
- mOrientedYPrecision, xCursorPosition, yCursorPosition,
+ mOrientedYPrecision, cursorPosition.x, cursorPosition.y,
mPointerSimple.downTime, /* videoFrames */ {}));
}
@@ -3665,7 +3668,7 @@
MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&mPointerSimple.currentProperties,
&mPointerSimple.currentCoords, mOrientedXPrecision,
- mOrientedYPrecision, xCursorPosition, yCursorPosition,
+ mOrientedYPrecision, cursorPosition.x, cursorPosition.y,
mPointerSimple.downTime, /* videoFrames */ {}));
}
@@ -3681,7 +3684,7 @@
AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&mPointerSimple.currentProperties,
&mPointerSimple.currentCoords, mOrientedXPrecision,
- mOrientedYPrecision, xCursorPosition, yCursorPosition,
+ mOrientedYPrecision, cursorPosition.x, cursorPosition.y,
mPointerSimple.downTime, /* videoFrames */ {}));
}
@@ -3692,8 +3695,8 @@
metaState, mCurrentRawState.buttonState,
MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&mPointerSimple.currentProperties, &mPointerSimple.currentCoords,
- mOrientedXPrecision, mOrientedYPrecision, xCursorPosition,
- yCursorPosition, mPointerSimple.downTime, /* videoFrames */ {}));
+ mOrientedXPrecision, mOrientedYPrecision, cursorPosition.x,
+ cursorPosition.y, mPointerSimple.downTime, /* videoFrames */ {}));
}
if (mCurrentRawState.rawVScroll || mCurrentRawState.rawHScroll) {
@@ -3713,8 +3716,8 @@
0, 0, metaState, mCurrentRawState.buttonState,
MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
&mPointerSimple.currentProperties, &pointerCoords,
- mOrientedXPrecision, mOrientedYPrecision, xCursorPosition,
- yCursorPosition, mPointerSimple.downTime,
+ mOrientedXPrecision, mOrientedYPrecision, cursorPosition.x,
+ cursorPosition.y, mPointerSimple.downTime,
/* videoFrames */ {}));
}
@@ -3724,8 +3727,8 @@
mPointerSimple.lastProperties.copyFrom(mPointerSimple.currentProperties);
mPointerSimple.displayId = displayId;
mPointerSimple.source = mSource;
- mPointerSimple.lastCursorX = xCursorPosition;
- mPointerSimple.lastCursorY = yCursorPosition;
+ mPointerSimple.lastCursorX = cursorPosition.x;
+ mPointerSimple.lastCursorY = cursorPosition.y;
} else {
mPointerSimple.reset();
}