@@ -5181,7 +5181,7 @@ TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeDownWithCorrectCoordinate
51815181
51825182 // The pointer is transferred to the second window, and the second window receives it in the
51835183 // correct coordinate space.
5184- mDispatcher->transferTouchFocus (firstWindow->getToken(), secondWindow->getToken());
5184+ mDispatcher->transferTouchGesture (firstWindow->getToken(), secondWindow->getToken());
51855185 firstWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_CANCEL), WithCoords(100, 400)));
51865186 secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_DOWN), WithCoords(-100, -400)));
51875187}
@@ -5419,16 +5419,16 @@ TEST_P(TransferTouchFixture, TransferTouch_OnePointer) {
54195419}
54205420
54215421/**
5422- * When 'transferTouch ' API is invoked, dispatcher needs to find the "best" window to take touch
5423- * from. When we have spy windows, there are several windows to choose from: either spy, or the
5424- * 'real' (non-spy) window. Always prefer the 'real' window because that's what would be most
5422+ * When 'transferTouchGesture ' API is invoked, dispatcher needs to find the "best" window to take
5423+ * touch from. When we have spy windows, there are several windows to choose from: either spy, or
5424+ * the 'real' (non-spy) window. Always prefer the 'real' window because that's what would be most
54255425 * natural to the user.
54265426 * In this test, we are sending a pointer to both spy window and first window. We then try to
54275427 * transfer touch to the second window. The dispatcher should identify the first window as the
54285428 * one that should lose the gesture, and therefore the action should be to move the gesture from
54295429 * the first window to the second.
5430- * The main goal here is to test the behaviour of 'transferTouch ' API, but it's still valid to test
5431- * the other API, as well.
5430+ * The main goal here is to test the behaviour of 'transferTouchGesture ' API, but it's still valid
5431+ * to test the other API, as well.
54325432 */
54335433TEST_P(TransferTouchFixture, TransferTouch_MultipleWindowsWithSpy) {
54345434 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
@@ -5455,7 +5455,7 @@ TEST_P(TransferTouchFixture, TransferTouch_MultipleWindowsWithSpy) {
54555455 firstWindow->consumeMotionDown();
54565456
54575457 // Transfer touch to the second window. Non-spy window should be preferred over the spy window
5458- // if f === 'transferTouch '.
5458+ // if f === 'transferTouchGesture '.
54595459 TransferFunction f = GetParam();
54605460 const bool success = f(mDispatcher, firstWindow->getToken(), secondWindow->getToken());
54615461 ASSERT_TRUE(success);
@@ -5593,22 +5593,23 @@ TEST_P(TransferTouchFixture, TransferTouch_MultipleWallpapers) {
55935593}
55945594
55955595// For the cases of single pointer touch and two pointers non-split touch, the api's
5596- // 'transferTouch ' and 'transferTouchFocus ' are equivalent in behaviour. They only differ
5596+ // 'transferTouchGesture ' and 'transferTouchOnDisplay ' are equivalent in behaviour. They only differ
55975597// for the case where there are multiple pointers split across several windows.
5598- INSTANTIATE_TEST_SUITE_P(InputDispatcherTransferFunctionTests, TransferTouchFixture,
5599- ::testing::Values(
5600- [&](const std::unique_ptr<InputDispatcher>& dispatcher,
5601- sp<IBinder> /*ignored*/, sp<IBinder> destChannelToken) {
5602- return dispatcher->transferTouch(destChannelToken,
5603- ADISPLAY_ID_DEFAULT);
5604- },
5605- [&](const std::unique_ptr<InputDispatcher>& dispatcher,
5606- sp<IBinder> from, sp<IBinder> to) {
5607- return dispatcher->transferTouchFocus(from, to,
5608- /*isDragAndDrop=*/false);
5609- }));
5610-
5611- TEST_F(InputDispatcherTest, TransferTouchFocus_TwoPointersSplitTouch) {
5598+ INSTANTIATE_TEST_SUITE_P(
5599+ InputDispatcherTransferFunctionTests, TransferTouchFixture,
5600+ ::testing::Values(
5601+ [&](const std::unique_ptr<InputDispatcher>& dispatcher, sp<IBinder> /*ignored*/,
5602+ sp<IBinder> destChannelToken) {
5603+ return dispatcher->transferTouchOnDisplay(destChannelToken,
5604+ ADISPLAY_ID_DEFAULT);
5605+ },
5606+ [&](const std::unique_ptr<InputDispatcher>& dispatcher, sp<IBinder> from,
5607+ sp<IBinder> to) {
5608+ return dispatcher->transferTouchGesture(from, to,
5609+ /*isDragAndDrop=*/false);
5610+ }));
5611+
5612+ TEST_F(InputDispatcherTest, TransferTouch_TwoPointersSplitTouch) {
56125613 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
56135614
56145615 sp<FakeWindowHandle> firstWindow =
@@ -5644,8 +5645,8 @@ TEST_F(InputDispatcherTest, TransferTouchFocus_TwoPointersSplitTouch) {
56445645 firstWindow->consumeMotionMove();
56455646 secondWindow->consumeMotionDown();
56465647
5647- // Transfer touch focus to the second window
5648- mDispatcher->transferTouchFocus (firstWindow->getToken(), secondWindow->getToken());
5648+ // Transfer touch to the second window
5649+ mDispatcher->transferTouchGesture (firstWindow->getToken(), secondWindow->getToken());
56495650 // The first window gets cancel and the new gets pointer down (it already saw down)
56505651 firstWindow->consumeMotionCancel();
56515652 secondWindow->consumeMotionPointerDown(1, ADISPLAY_ID_DEFAULT,
@@ -5668,11 +5669,11 @@ TEST_F(InputDispatcherTest, TransferTouchFocus_TwoPointersSplitTouch) {
56685669 secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
56695670}
56705671
5671- // Same as TransferTouchFocus_TwoPointersSplitTouch , but using 'transferTouch ' api.
5672- // Unlike 'transferTouchFocus ', calling 'transferTouch ' when there are two windows receiving
5673- // touch is not supported, so the touch should continue on those windows and the transferred-to
5674- // window should get nothing.
5675- TEST_F(InputDispatcherTest, TransferTouch_TwoPointersSplitTouch ) {
5672+ // Same as TransferTouch_TwoPointersSplitTouch , but using 'transferTouchOnDisplay ' api.
5673+ // Unlike 'transferTouchGesture ', calling 'transferTouchOnDisplay ' when there are two windows
5674+ // receiving touch is not supported, so the touch should continue on those windows and the
5675+ // transferred-to window should get nothing.
5676+ TEST_F(InputDispatcherTest, TransferTouchOnDisplay_TwoPointersSplitTouch ) {
56765677 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
56775678
56785679 sp<FakeWindowHandle> firstWindow =
@@ -5710,8 +5711,8 @@ TEST_F(InputDispatcherTest, TransferTouch_TwoPointersSplitTouch) {
57105711
57115712 // Transfer touch focus to the second window
57125713 const bool transferred =
5713- mDispatcher->transferTouch (secondWindow->getToken(), ADISPLAY_ID_DEFAULT);
5714- // The 'transferTouch ' call should not succeed, because there are 2 touched windows
5714+ mDispatcher->transferTouchOnDisplay (secondWindow->getToken(), ADISPLAY_ID_DEFAULT);
5715+ // The 'transferTouchOnDisplay ' call should not succeed, because there are 2 touched windows
57155716 ASSERT_FALSE(transferred);
57165717 firstWindow->assertNoEvents();
57175718 secondWindow->assertNoEvents();
@@ -5734,9 +5735,9 @@ TEST_F(InputDispatcherTest, TransferTouch_TwoPointersSplitTouch) {
57345735}
57355736
57365737// This case will create two windows and one mirrored window on the default display and mirror
5737- // two windows on the second display. It will test if 'transferTouchFocus ' works fine if we put
5738+ // two windows on the second display. It will test if 'transferTouchGesture ' works fine if we put
57385739// the windows info of second display before default display.
5739- TEST_F(InputDispatcherTest, TransferTouchFocus_CloneSurface ) {
5740+ TEST_F(InputDispatcherTest, TransferTouch_CloneSurface ) {
57405741 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
57415742 sp<FakeWindowHandle> firstWindowInPrimary =
57425743 sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W1", ADISPLAY_ID_DEFAULT);
@@ -5771,9 +5772,9 @@ TEST_F(InputDispatcherTest, TransferTouchFocus_CloneSurface) {
57715772 // Window should receive motion event.
57725773 firstWindowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT);
57735774
5774- // Transfer touch focus
5775- ASSERT_TRUE(mDispatcher->transferTouchFocus (firstWindowInPrimary->getToken(),
5776- secondWindowInPrimary->getToken()));
5775+ // Transfer touch
5776+ ASSERT_TRUE(mDispatcher->transferTouchGesture (firstWindowInPrimary->getToken(),
5777+ secondWindowInPrimary->getToken()));
57775778 // The first window gets cancel.
57785779 firstWindowInPrimary->consumeMotionCancel();
57795780 secondWindowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT,
@@ -5795,9 +5796,9 @@ TEST_F(InputDispatcherTest, TransferTouchFocus_CloneSurface) {
57955796 secondWindowInPrimary->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
57965797}
57975798
5798- // Same as TransferTouchFocus_CloneSurface , but this touch on the secondary display and use
5799- // 'transferTouch ' api.
5800- TEST_F(InputDispatcherTest, TransferTouch_CloneSurface ) {
5799+ // Same as TransferTouch_CloneSurface , but this touch on the secondary display and use
5800+ // 'transferTouchOnDisplay ' api.
5801+ TEST_F(InputDispatcherTest, TransferTouchOnDisplay_CloneSurface ) {
58015802 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
58025803 sp<FakeWindowHandle> firstWindowInPrimary =
58035804 sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W1", ADISPLAY_ID_DEFAULT);
@@ -5834,7 +5835,8 @@ TEST_F(InputDispatcherTest, TransferTouch_CloneSurface) {
58345835 firstWindowInSecondary->consumeMotionDown(SECOND_DISPLAY_ID);
58355836
58365837 // Transfer touch focus
5837- ASSERT_TRUE(mDispatcher->transferTouch(secondWindowInSecondary->getToken(), SECOND_DISPLAY_ID));
5838+ ASSERT_TRUE(mDispatcher->transferTouchOnDisplay(secondWindowInSecondary->getToken(),
5839+ SECOND_DISPLAY_ID));
58385840
58395841 // The first window gets cancel.
58405842 firstWindowInSecondary->consumeMotionCancel(SECOND_DISPLAY_ID);
@@ -10520,8 +10522,8 @@ class InputDispatcherDragTests : public InputDispatcherTest {
1052010522
1052110523 // Transfer touch focus to the drag window
1052210524 bool transferred =
10523- mDispatcher->transferTouchFocus (mWindow->getToken(), mDragWindow->getToken(),
10524- /*isDragDrop=*/true);
10525+ mDispatcher->transferTouchGesture (mWindow->getToken(), mDragWindow->getToken(),
10526+ /*isDragDrop=*/true);
1052510527 if (transferred) {
1052610528 mWindow->consumeMotionCancel();
1052710529 mDragWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
0 commit comments