summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp49
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.h5
-rw-r--r--services/inputflinger/dispatcher/TouchState.cpp4
-rw-r--r--services/inputflinger/dispatcher/TouchState.h2
-rw-r--r--services/inputflinger/dispatcher/TouchedWindow.cpp4
-rw-r--r--services/inputflinger/dispatcher/TouchedWindow.h7
-rw-r--r--services/inputflinger/dispatcher/include/InputDispatcherInterface.h2
-rw-r--r--services/inputflinger/tests/InputDispatcher_test.cpp170
8 files changed, 217 insertions, 26 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 391703d506..2908c61182 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -2510,6 +2510,24 @@ InputDispatcher::DispatcherTouchState::findTouchedWindowTargets(
return injectionError(InputEventInjectionResult::TARGET_MISMATCH);
}
+ if (newTouchedWindowHandle != nullptr &&
+ maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN) {
+ // Check if this should be redirected to another window, in case this window previously
+ // called 'transferTouch' for this gesture.
+ const auto it =
+ std::find_if(tempTouchState.windows.begin(), tempTouchState.windows.end(),
+ [&](const TouchedWindow& touchedWindow) {
+ return touchedWindow.forwardingWindowToken ==
+ newTouchedWindowHandle->getToken() &&
+ touchedWindow.hasTouchingPointers(entry.deviceId);
+ });
+ if (it != tempTouchState.windows.end()) {
+ LOG(INFO) << "Forwarding pointer from " << newTouchedWindowHandle->getName()
+ << " to " << it->windowHandle->getName();
+ newTouchedWindowHandle = it->windowHandle;
+ }
+ }
+
std::vector<sp<WindowInfoHandle>> newTouchedWindows =
findTouchedSpyWindowsAt(displayId, x, y, isStylus, entry.deviceId, mWindowInfos);
if (newTouchedWindowHandle != nullptr) {
@@ -2550,7 +2568,8 @@ InputDispatcher::DispatcherTouchState::findTouchedWindowTargets(
isDownOrPointerDown
? std::make_optional(
entry.eventTime)
- : std::nullopt);
+ : std::nullopt,
+ /*forwardingWindowToken=*/nullptr);
if (!addResult.ok()) {
LOG(ERROR) << "Error while processing " << entry << " for "
<< windowHandle->getName();
@@ -2577,7 +2596,8 @@ InputDispatcher::DispatcherTouchState::findTouchedWindowTargets(
tempTouchState.addOrUpdateWindow(wallpaper,
InputTarget::DispatchMode::AS_IS,
wallpaperFlags, entry.deviceId, {pointer},
- entry.eventTime);
+ entry.eventTime,
+ /*forwardingWindowToken=*/nullptr);
}
}
}
@@ -2676,7 +2696,8 @@ InputDispatcher::DispatcherTouchState::findTouchedWindowTargets(
tempTouchState.addOrUpdateWindow(newTouchedWindowHandle,
InputTarget::DispatchMode::SLIPPERY_ENTER,
targetFlags, entry.deviceId, {pointer},
- entry.eventTime);
+ entry.eventTime,
+ /*forwardingWindowToken=*/nullptr);
// Check if the wallpaper window should deliver the corresponding event.
slipWallpaperTouch(targetFlags, oldTouchedWindowHandle, newTouchedWindowHandle,
@@ -5833,7 +5854,7 @@ void InputDispatcher::setMaximumObscuringOpacityForTouch(float opacity) {
}
bool InputDispatcher::transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
- bool isDragDrop) {
+ bool isDragDrop, bool transferEntireGesture) {
if (fromToken == toToken) {
LOG_IF(INFO, DEBUG_FOCUS) << "Trivial transfer to same window.";
return true;
@@ -5847,7 +5868,7 @@ bool InputDispatcher::transferTouchGesture(const sp<IBinder>& fromToken, const s
"transferring touch from this window to another window",
traceContext.getTracker());
- auto result = mTouchStates.transferTouchGesture(fromToken, toToken);
+ auto result = mTouchStates.transferTouchGesture(fromToken, toToken, transferEntireGesture);
if (!result.has_value()) {
return false;
}
@@ -5891,7 +5912,8 @@ std::optional<std::tuple<sp<gui::WindowInfoHandle>, DeviceId, std::vector<Pointe
std::list<InputDispatcher::DispatcherTouchState::CancellationArgs>,
std::list<InputDispatcher::DispatcherTouchState::PointerDownArgs>>>
InputDispatcher::DispatcherTouchState::transferTouchGesture(const sp<android::IBinder>& fromToken,
- const sp<android::IBinder>& toToken) {
+ const sp<android::IBinder>& toToken,
+ bool transferEntireGesture) {
// Find the target touch state and touched window by fromToken.
auto touchStateWindowAndDisplay = findTouchStateWindowAndDisplay(fromToken);
if (!touchStateWindowAndDisplay.has_value()) {
@@ -5934,8 +5956,12 @@ InputDispatcher::DispatcherTouchState::transferTouchGesture(const sp<android::IB
}
// Transferring touch focus using this API should not effect the focused window.
newTargetFlags |= InputTarget::Flags::NO_FOCUS_CHANGE;
+ sp<IBinder> forwardingWindowToken;
+ if (transferEntireGesture && com::android::input::flags::allow_transfer_of_entire_gesture()) {
+ forwardingWindowToken = fromToken;
+ }
state.addOrUpdateWindow(toWindowHandle, InputTarget::DispatchMode::AS_IS, newTargetFlags,
- deviceId, pointers, downTimeInTarget);
+ deviceId, pointers, downTimeInTarget, forwardingWindowToken);
// Synthesize cancel for old window and down for new window.
std::shared_ptr<Connection> fromConnection = mConnectionManager.getConnection(fromToken);
@@ -6017,7 +6043,8 @@ bool InputDispatcher::transferTouchOnDisplay(const sp<IBinder>& destChannelToken
fromToken = from->getToken();
} // release lock
- return transferTouchGesture(fromToken, destChannelToken);
+ return transferTouchGesture(fromToken, destChannelToken, /*isDragDrop=*/false,
+ /*transferEntireGesture=*/false);
}
void InputDispatcher::resetAndDropEverythingLocked(const char* reason) {
@@ -7195,7 +7222,8 @@ void InputDispatcher::DispatcherTouchState::slipWallpaperTouch(
state.addOrUpdateWindow(newWallpaper, InputTarget::DispatchMode::SLIPPERY_ENTER,
InputTarget::Flags::WINDOW_IS_OBSCURED |
InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED,
- deviceId, pointers, entry.eventTime);
+ deviceId, pointers, entry.eventTime,
+ /*forwardingWindowToken=*/nullptr);
}
}
@@ -7236,7 +7264,8 @@ InputDispatcher::DispatcherTouchState::transferWallpaperTouch(
wallpaperFlags |= InputTarget::Flags::WINDOW_IS_OBSCURED |
InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED;
state.addOrUpdateWindow(newWallpaper, InputTarget::DispatchMode::AS_IS, wallpaperFlags,
- deviceId, pointers, downTimeInTarget);
+ deviceId, pointers, downTimeInTarget,
+ /*forwardingWindowToken=*/nullptr);
std::shared_ptr<Connection> wallpaperConnection =
mConnectionManager.getConnection(newWallpaper->getToken());
if (wallpaperConnection != nullptr) {
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index ad7e87e192..2e8f2ce04e 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -127,7 +127,7 @@ public:
void setMaximumObscuringOpacityForTouch(float opacity) override;
bool transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
- bool isDragDrop = false) override;
+ bool isDragDrop, bool transferEntireGesture) override;
bool transferTouchOnDisplay(const sp<IBinder>& destChannelToken,
ui::LogicalDisplayId displayId) override;
@@ -440,7 +440,8 @@ private:
std::optional<
std::tuple<sp<gui::WindowInfoHandle>, DeviceId, std::vector<PointerProperties>,
std::list<CancellationArgs>, std::list<PointerDownArgs>>>
- transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken);
+ transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
+ bool transferEntireGesture);
base::Result<std::list<CancellationArgs>, status_t> pilferPointers(
const sp<IBinder>& token, const Connection& requestingConnection);
diff --git a/services/inputflinger/dispatcher/TouchState.cpp b/services/inputflinger/dispatcher/TouchState.cpp
index 2bf63beb05..f1fca0c317 100644
--- a/services/inputflinger/dispatcher/TouchState.cpp
+++ b/services/inputflinger/dispatcher/TouchState.cpp
@@ -74,7 +74,7 @@ android::base::Result<void> TouchState::addOrUpdateWindow(
const sp<WindowInfoHandle>& windowHandle, InputTarget::DispatchMode dispatchMode,
ftl::Flags<InputTarget::Flags> targetFlags, DeviceId deviceId,
const std::vector<PointerProperties>& touchingPointers,
- std::optional<nsecs_t> firstDownTimeInTarget) {
+ std::optional<nsecs_t> firstDownTimeInTarget, sp<IBinder> forwardingWindowToken) {
if (touchingPointers.empty()) {
LOG(FATAL) << __func__ << "No pointers specified for " << windowHandle->getName();
return android::base::Error();
@@ -88,6 +88,7 @@ android::base::Result<void> TouchState::addOrUpdateWindow(
if (touchedWindow.windowHandle == windowHandle) {
touchedWindow.dispatchMode = dispatchMode;
touchedWindow.targetFlags |= targetFlags;
+ touchedWindow.forwardingWindowToken = forwardingWindowToken;
// For cases like hover enter/exit or DISPATCH_AS_OUTSIDE a touch window might not have
// downTime set initially. Need to update existing window when a pointer is down for the
// window.
@@ -103,6 +104,7 @@ android::base::Result<void> TouchState::addOrUpdateWindow(
touchedWindow.windowHandle = windowHandle;
touchedWindow.dispatchMode = dispatchMode;
touchedWindow.targetFlags = targetFlags;
+ touchedWindow.forwardingWindowToken = forwardingWindowToken;
touchedWindow.addTouchingPointers(deviceId, touchingPointers);
if (firstDownTimeInTarget) {
touchedWindow.trySetDownTimeInTarget(deviceId, *firstDownTimeInTarget);
diff --git a/services/inputflinger/dispatcher/TouchState.h b/services/inputflinger/dispatcher/TouchState.h
index 451d91704c..20155f4396 100644
--- a/services/inputflinger/dispatcher/TouchState.h
+++ b/services/inputflinger/dispatcher/TouchState.h
@@ -47,7 +47,7 @@ struct TouchState {
const sp<android::gui::WindowInfoHandle>& windowHandle,
InputTarget::DispatchMode dispatchMode, ftl::Flags<InputTarget::Flags> targetFlags,
DeviceId deviceId, const std::vector<PointerProperties>& touchingPointers,
- std::optional<nsecs_t> firstDownTimeInTarget);
+ std::optional<nsecs_t> firstDownTimeInTarget, sp<IBinder> forwardingWindowToken);
void addHoveringPointerToWindow(const sp<android::gui::WindowInfoHandle>& windowHandle,
DeviceId deviceId, const PointerProperties& pointer, float x,
float y);
diff --git a/services/inputflinger/dispatcher/TouchedWindow.cpp b/services/inputflinger/dispatcher/TouchedWindow.cpp
index fa5be1a719..053a2e2441 100644
--- a/services/inputflinger/dispatcher/TouchedWindow.cpp
+++ b/services/inputflinger/dispatcher/TouchedWindow.cpp
@@ -331,9 +331,9 @@ std::string TouchedWindow::dump() const {
std::string out;
std::string deviceStates =
dumpMap(mDeviceStates, constToString, TouchedWindow::deviceStateToString);
- out += StringPrintf("name='%s', targetFlags=%s, mDeviceStates=%s\n",
+ out += StringPrintf("name='%s', targetFlags=%s, forwardingWindowToken=%p, mDeviceStates=%s\n",
windowHandle->getName().c_str(), targetFlags.string().c_str(),
- deviceStates.c_str());
+ forwardingWindowToken.get(), deviceStates.c_str());
return out;
}
diff --git a/services/inputflinger/dispatcher/TouchedWindow.h b/services/inputflinger/dispatcher/TouchedWindow.h
index c38681eef0..d27c597803 100644
--- a/services/inputflinger/dispatcher/TouchedWindow.h
+++ b/services/inputflinger/dispatcher/TouchedWindow.h
@@ -34,6 +34,11 @@ struct TouchedWindow {
InputTarget::DispatchMode dispatchMode = InputTarget::DispatchMode::AS_IS;
ftl::Flags<InputTarget::Flags> targetFlags;
+ // If another window has transferred touches to this window, and wants to continue sending the
+ // rest of the gesture to this window, store the token of the originating (transferred-from)
+ // window here.
+ sp<IBinder> forwardingWindowToken;
+
// Hovering
bool hasHoveringPointers() const;
bool hasHoveringPointers(DeviceId deviceId) const;
@@ -76,7 +81,7 @@ struct TouchedWindow {
};
std::vector<DeviceId> eraseHoveringPointersIf(
- std::function<bool(const PointerProperties&, float /*x*/, float /*y*/)> condition);
+ std::function<bool(const PointerProperties&, float x, float y)> condition);
private:
struct DeviceState {
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
index ab039c34ef..b22ddca4e6 100644
--- a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
+++ b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
@@ -148,7 +148,7 @@ public:
* Returns true on success. False if the window did not actually have an active touch gesture.
*/
virtual bool transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
- bool isDragDrop) = 0;
+ bool isDragDrop, bool transferEntireGesture) = 0;
/**
* Transfer a touch gesture to the provided channel, no matter where the current touch is.
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index f7dcd6c6e3..298ba4209a 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -1176,7 +1176,9 @@ TEST_F(InputDispatcherTest, MultiDeviceTouchTransferWithWallpaperWindows) {
// Transfer touch from the middle window to the right window.
ASSERT_TRUE(mDispatcher->transferTouchGesture(middleForegroundWindow->getToken(),
- rightForegroundWindow->getToken()));
+ rightForegroundWindow->getToken(),
+ /*isDragDrop=*/false,
+ /*transferEntireGesture=*/false));
middleForegroundWindow->consumeMotionEvent(
AllOf(WithMotionAction(ACTION_CANCEL), WithDeviceId(deviceB)));
@@ -1208,6 +1210,148 @@ TEST_F(InputDispatcherTest, MultiDeviceTouchTransferWithWallpaperWindows) {
}
/**
+ * If a window has requested touch to be transferred, only the current pointers should be
+ * transferred.
+ *
+ * Subsequent pointers should still go through the normal hit testing.
+ *
+ * In this test, we are invoking 'transferTouchGesture' with the parameter 'transferEntireGesture'
+ * set to true, but that value doesn't make any difference, since the flag is disabled. This test
+ * will be removed once that flag is fully rolled out.
+ */
+TEST_F(InputDispatcherTest, TouchTransferDoesNotSendEntireGesture_legacy) {
+ SCOPED_FLAG_OVERRIDE(allow_transfer_of_entire_gesture, false);
+ std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
+ sp<FakeWindowHandle> topWindow =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Top window",
+ ui::LogicalDisplayId::DEFAULT);
+
+ sp<FakeWindowHandle> bottomWindow =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Bottom window",
+ ui::LogicalDisplayId::DEFAULT);
+
+ mDispatcher->onWindowInfosChanged(
+ {{*topWindow->getInfo(), *bottomWindow->getInfo()}, {}, 0, 0});
+
+ mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
+ .pointer(PointerBuilder(0, ToolType::FINGER).x(50).y(50))
+ .build());
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+
+ // Transfer touch from the top window to the bottom window.
+ // The actual value of parameter 'transferEntireGesture' doesn't matter, since the flag is off.
+ ASSERT_TRUE(mDispatcher->transferTouchGesture(topWindow->getToken(), bottomWindow->getToken(),
+ /*isDragDrop=*/false,
+ /*transferEntireGesture=*/true));
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_CANCEL));
+ bottomWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+
+ // When the second pointer goes down, it will hit the top window, and should be delivered there
+ // as a new pointer.
+ mDispatcher->notifyMotion(MotionArgsBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
+ .pointer(PointerBuilder(0, ToolType::FINGER).x(50).y(50))
+ .pointer(PointerBuilder(1, ToolType::FINGER).x(60).y(60))
+ .build());
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+ const std::map<int32_t, PointF> expectedPointers{{0, PointF{50, 50}}};
+ bottomWindow->consumeMotionEvent(
+ AllOf(WithMotionAction(ACTION_MOVE), WithPointers(expectedPointers)));
+ bottomWindow->assertNoEvents();
+}
+
+/**
+ * If a window has requested touch to be transferred, the current pointers should be transferred.
+ *
+ * If the window did not request the "entire gesture" to be transferred, subsequent pointers should
+ * still go through the normal hit testing.
+ */
+TEST_F(InputDispatcherTest, TouchTransferDoesNotSendEntireGesture) {
+ SCOPED_FLAG_OVERRIDE(allow_transfer_of_entire_gesture, true);
+ std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
+ sp<FakeWindowHandle> topWindow =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Top window",
+ ui::LogicalDisplayId::DEFAULT);
+
+ sp<FakeWindowHandle> bottomWindow =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Bottom window",
+ ui::LogicalDisplayId::DEFAULT);
+
+ mDispatcher->onWindowInfosChanged(
+ {{*topWindow->getInfo(), *bottomWindow->getInfo()}, {}, 0, 0});
+
+ mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
+ .pointer(PointerBuilder(0, ToolType::FINGER).x(50).y(50))
+ .build());
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+
+ // Transfer touch from the top window to the bottom window.
+ ASSERT_TRUE(mDispatcher->transferTouchGesture(topWindow->getToken(), bottomWindow->getToken(),
+ /*isDragDrop=*/false,
+ /*transferEntireGesture=*/false));
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_CANCEL));
+ bottomWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+
+ // When the second pointer goes down, it will hit the top window, and should be delivered there
+ // because "entire gesture" was not requested to be transferred when the original call to
+ // 'transferTouchGesture' was made.
+ mDispatcher->notifyMotion(MotionArgsBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
+ .pointer(PointerBuilder(0, ToolType::FINGER).x(50).y(50))
+ .pointer(PointerBuilder(1, ToolType::FINGER).x(60).y(60))
+ .build());
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+ const std::map<int32_t, PointF> expectedPointers{{0, PointF{50, 50}}};
+ bottomWindow->consumeMotionEvent(
+ AllOf(WithMotionAction(ACTION_MOVE), WithPointers(expectedPointers)));
+ bottomWindow->assertNoEvents();
+}
+
+/**
+ * If a window has requested touch to be transferred, all subsequent pointers from the same gesture
+ * should be transferred if 'transferEntireGesture' was set to 'true'.
+ *
+ * In this test, there are 2 windows - one above and one below.
+ * First pointer goes to the top window. Then top window calls 'transferTouch' upon receiving
+ * ACTION_DOWN and transfers touch to the bottom window.
+ * Subsequent pointers from the same gesture should still be forwarded to the bottom window,
+ * as long as they first land into the top window.
+ */
+TEST_F(InputDispatcherTest, TouchTransferSendsEntireGesture) {
+ SCOPED_FLAG_OVERRIDE(allow_transfer_of_entire_gesture, true);
+ std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
+ sp<FakeWindowHandle> topWindow =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Top window",
+ ui::LogicalDisplayId::DEFAULT);
+
+ sp<FakeWindowHandle> bottomWindow =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Bottom window",
+ ui::LogicalDisplayId::DEFAULT);
+
+ mDispatcher->onWindowInfosChanged(
+ {{*topWindow->getInfo(), *bottomWindow->getInfo()}, {}, 0, 0});
+
+ mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
+ .pointer(PointerBuilder(0, ToolType::FINGER).x(50).y(50))
+ .build());
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+
+ // Transfer touch from the top window to the bottom window.
+ ASSERT_TRUE(mDispatcher->transferTouchGesture(topWindow->getToken(), bottomWindow->getToken(),
+ /*isDragDrop=*/false,
+ /*transferEntireGesture=*/true));
+ topWindow->consumeMotionEvent(WithMotionAction(ACTION_CANCEL));
+ bottomWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN));
+
+ // When the second pointer goes down, it will hit the top window, but since the top window has
+ // requested the whole gesture to be transferred, it should be redirected to the bottom window.
+ mDispatcher->notifyMotion(MotionArgsBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
+ .pointer(PointerBuilder(0, ToolType::FINGER).x(50).y(50))
+ .pointer(PointerBuilder(1, ToolType::FINGER).x(60).y(60))
+ .build());
+
+ bottomWindow->consumeMotionEvent(WithMotionAction(POINTER_1_DOWN));
+}
+
+/**
* A single window that receives touch (on top), and a wallpaper window underneath it.
* The top window gets a multitouch gesture.
* Ensure that wallpaper gets the same gesture.
@@ -6608,7 +6752,8 @@ TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeDownWithCorrectCoordinate
// The pointer is transferred to the second window, and the second window receives it in the
// correct coordinate space.
- mDispatcher->transferTouchGesture(firstWindow->getToken(), secondWindow->getToken());
+ mDispatcher->transferTouchGesture(firstWindow->getToken(), secondWindow->getToken(),
+ /*isDragDrop=*/false, /*transferEntireGesture=*/false);
firstWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_CANCEL), WithCoords(100, 400)));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_DOWN), WithCoords(-100, -400)));
}
@@ -7144,7 +7289,8 @@ INSTANTIATE_TEST_SUITE_P(
[&](const std::unique_ptr<InputDispatcher>& dispatcher, sp<IBinder> from,
sp<IBinder> to) {
return dispatcher->transferTouchGesture(from, to,
- /*isDragAndDrop=*/false);
+ /*isDragAndDrop=*/false,
+ /*transferEntireGesture=*/false);
}));
TEST_F(InputDispatcherTest, TransferTouch_TwoPointersSplitTouch) {
@@ -7184,7 +7330,8 @@ TEST_F(InputDispatcherTest, TransferTouch_TwoPointersSplitTouch) {
secondWindow->consumeMotionDown();
// Transfer touch to the second window
- mDispatcher->transferTouchGesture(firstWindow->getToken(), secondWindow->getToken());
+ mDispatcher->transferTouchGesture(firstWindow->getToken(), secondWindow->getToken(),
+ /*isDragDrop=*/false, /*transferEntireGesture=*/false);
// The first window gets cancel and the new gets pointer down (it already saw down)
firstWindow->consumeMotionCancel();
secondWindow->consumeMotionPointerDown(1, ui::LogicalDisplayId::DEFAULT,
@@ -7318,7 +7465,9 @@ TEST_F(InputDispatcherTest, TransferTouch_CloneSurface) {
// Transfer touch
ASSERT_TRUE(mDispatcher->transferTouchGesture(firstWindowInPrimary->getToken(),
- secondWindowInPrimary->getToken()));
+ secondWindowInPrimary->getToken(),
+ /*isDragDrop=*/false,
+ /*transferEntireGesture=*/false));
// The first window gets cancel.
firstWindowInPrimary->consumeMotionCancel();
secondWindowInPrimary->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
@@ -12610,7 +12759,8 @@ protected:
// Transfer touch focus to the drag window
bool transferred =
mDispatcher->transferTouchGesture(targetWindow->getToken(), mDragWindow->getToken(),
- /*isDragDrop=*/true);
+ /*isDragDrop=*/true,
+ /*transferEntireGesture=*/false);
if (transferred) {
targetWindow->consumeMotionCancel(dragStartDisplay);
mDragWindow->consumeMotionDown(dragStartDisplay, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
@@ -15182,7 +15332,9 @@ TEST_P(TransferOrDontTransferFixture, TouchDownAndMouseHover) {
if (GetParam()) {
// Call transferTouchGesture
const bool transferred =
- mDispatcher->transferTouchGesture(mFromWindow->getToken(), mToWindow->getToken());
+ mDispatcher->transferTouchGesture(mFromWindow->getToken(), mToWindow->getToken(),
+ /*isDragDrop=*/false,
+ /*transferEntireGesture=*/false);
ASSERT_TRUE(transferred);
mFromWindow->consumeMotionEvent(WithMotionAction(ACTION_HOVER_EXIT));
@@ -15264,7 +15416,9 @@ TEST_P(TransferOrDontTransferFixture, MouseAndTouchTransferSimultaneousMultiDevi
if (GetParam()) {
// Call transferTouchGesture
const bool transferred =
- mDispatcher->transferTouchGesture(mFromWindow->getToken(), mToWindow->getToken());
+ mDispatcher->transferTouchGesture(mFromWindow->getToken(), mToWindow->getToken(),
+ /*isDragDrop=*/false,
+ /*transferEntireGesture=*/false);
ASSERT_TRUE(transferred);
mFromWindow->consumeMotionEvent(WithMotionAction(ACTION_CANCEL));
mFromWindow->consumeMotionEvent(WithMotionAction(ACTION_HOVER_EXIT));