Move ADISPLAY_ID_ definitions into LogicalDisplayId
These will eventually replace the existing definitions as follows:
ADISPLAY_ID_NONE -->> LogicalDisplayId::INVALID
ADISPLAY_ID_DEFAULT -->> LogicalDisplayId::DEFAULT
We are keeping the old definitions for now, to reduce the merge
conflicts. These will be removed in subsequent CLs, after the
frameworks/base and other repository patches go in.
The constant "NONE" was renamed to "INVALID" to make it consistent with
the Java definitions.
Bug: 339106983
Test: m checkinput
Change-Id: I0274be345159c85cb51fcea743d8acd3d298cd07
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index 184659d..8ad235f 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -53,7 +53,6 @@
using android::gui::WindowInfoHandle;
using android::os::InputEventInjectionResult;
using android::os::InputEventInjectionSync;
-using android::ui::ADISPLAY_ID_DEFAULT;
namespace android::inputdispatcher {
@@ -73,7 +72,7 @@
static constexpr int32_t SECOND_DEVICE_ID = 2;
// An arbitrary display id.
-constexpr ui::LogicalDisplayId DISPLAY_ID = ADISPLAY_ID_DEFAULT;
+constexpr ui::LogicalDisplayId DISPLAY_ID = ui::LogicalDisplayId::DEFAULT;
constexpr ui::LogicalDisplayId SECOND_DISPLAY_ID = ui::LogicalDisplayId{1};
// Ensure common actions are interchangeable between keys and motions for convenience.
@@ -129,9 +128,9 @@
static KeyEvent getTestKeyEvent() {
KeyEvent event;
- event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD, ui::ADISPLAY_ID_NONE,
- INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, 0, AKEYCODE_A, KEY_A, AMETA_NONE, 0,
- ARBITRARY_TIME, ARBITRARY_TIME);
+ event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD,
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, 0,
+ AKEYCODE_A, KEY_A, AMETA_NONE, 0, ARBITRARY_TIME, ARBITRARY_TIME);
return event;
}
@@ -253,8 +252,8 @@
KeyEvent event;
// Rejects undefined key actions.
- event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD, ui::ADISPLAY_ID_NONE,
- INVALID_HMAC,
+ event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD,
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC,
/*action=*/-1, 0, AKEYCODE_A, KEY_A, AMETA_NONE, 0, ARBITRARY_TIME,
ARBITRARY_TIME);
ASSERT_EQ(InputEventInjectionResult::FAILED,
@@ -263,9 +262,9 @@
<< "Should reject key events with undefined action.";
// Rejects ACTION_MULTIPLE since it is not supported despite being defined in the API.
- event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD, ui::ADISPLAY_ID_NONE,
- INVALID_HMAC, AKEY_EVENT_ACTION_MULTIPLE, 0, AKEYCODE_A, KEY_A, AMETA_NONE, 0,
- ARBITRARY_TIME, ARBITRARY_TIME);
+ event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD,
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC, AKEY_EVENT_ACTION_MULTIPLE, 0,
+ AKEYCODE_A, KEY_A, AMETA_NONE, 0, ARBITRARY_TIME, ARBITRARY_TIME);
ASSERT_EQ(InputEventInjectionResult::FAILED,
mDispatcher->injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
0ms, 0))
@@ -482,7 +481,7 @@
void consumeMotionPointerDown(int32_t pointerIdx) {
int32_t action = AMOTION_EVENT_ACTION_POINTER_DOWN |
(pointerIdx << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
- mInputReceiver.consumeEvent(InputEventType::MOTION, action, ADISPLAY_ID_DEFAULT,
+ mInputReceiver.consumeEvent(InputEventType::MOTION, action, ui::LogicalDisplayId::DEFAULT,
/*expectedFlags=*/0);
}
@@ -500,7 +499,7 @@
static InputEventInjectionResult injectKey(
InputDispatcher& dispatcher, int32_t action, int32_t repeatCount,
- ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE,
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID,
InputEventInjectionSync syncMode = InputEventInjectionSync::WAIT_FOR_RESULT,
std::chrono::milliseconds injectionTimeout = INJECT_EVENT_TIMEOUT,
bool allowKeyRepeat = true, std::optional<gui::Uid> targetUid = {},
@@ -522,15 +521,17 @@
static void assertInjectedKeyTimesOut(InputDispatcher& dispatcher) {
InputEventInjectionResult result =
- injectKey(dispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, ui::ADISPLAY_ID_NONE,
- InputEventInjectionSync::WAIT_FOR_RESULT, CONSUME_TIMEOUT_NO_EVENT_EXPECTED);
+ injectKey(dispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
+ ui::LogicalDisplayId::INVALID, InputEventInjectionSync::WAIT_FOR_RESULT,
+ CONSUME_TIMEOUT_NO_EVENT_EXPECTED);
if (result != InputEventInjectionResult::TIMED_OUT) {
FAIL() << "Injection should have timed out, but got " << ftl::enum_string(result);
}
}
static InputEventInjectionResult injectKeyDown(
- InputDispatcher& dispatcher, ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE) {
+ InputDispatcher& dispatcher,
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID) {
return injectKey(dispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, displayId);
}
@@ -538,14 +539,16 @@
// sending a subsequent key up. When key repeat is enabled, the dispatcher cannot idle because it
// has to be woken up to process the repeating key.
static InputEventInjectionResult injectKeyDownNoRepeat(
- InputDispatcher& dispatcher, ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE) {
+ InputDispatcher& dispatcher,
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID) {
return injectKey(dispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, displayId,
InputEventInjectionSync::WAIT_FOR_RESULT, INJECT_EVENT_TIMEOUT,
/*allowKeyRepeat=*/false);
}
static InputEventInjectionResult injectKeyUp(
- InputDispatcher& dispatcher, ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE) {
+ InputDispatcher& dispatcher,
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID) {
return injectKey(dispatcher, AKEY_EVENT_ACTION_UP, /*repeatCount=*/0, displayId);
}
@@ -596,8 +599,8 @@
return injectMotionEvent(dispatcher, AMOTION_EVENT_ACTION_UP, source, displayId, location);
}
-static NotifyKeyArgs generateKeyArgs(int32_t action,
- ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE) {
+static NotifyKeyArgs generateKeyArgs(
+ int32_t action, ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID) {
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
// Define a valid key event.
NotifyKeyArgs args(InputEvent::nextId(), currentTime, /*readTime=*/0, DEVICE_ID,
@@ -608,7 +611,7 @@
}
static NotifyKeyArgs generateSystemShortcutArgs(
- int32_t action, ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE) {
+ int32_t action, ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID) {
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
// Define a valid key event.
NotifyKeyArgs args(InputEvent::nextId(), currentTime, /*readTime=*/0, DEVICE_ID,
@@ -619,7 +622,7 @@
}
static NotifyKeyArgs generateAssistantKeyArgs(
- int32_t action, ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE) {
+ int32_t action, ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID) {
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
// Define a valid key event.
NotifyKeyArgs args(InputEvent::nextId(), currentTime, /*readTime=*/0, DEVICE_ID,
@@ -686,9 +689,9 @@
*/
TEST_F(InputDispatcherTest, WhenInputChannelBreaks_PolicyIsNotified) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher,
- "Window that breaks its input channel", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
+ "Window that breaks its input channel",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -699,16 +702,18 @@
TEST_F(InputDispatcherTest, SetInputWindow_SingleWindowTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Window should receive motion event.
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
}
using InputDispatcherDeathTest = InputDispatcherTest;
@@ -722,8 +727,9 @@
ScopedSilentDeath _silentDeath;
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
ASSERT_DEATH(mDispatcher->onWindowInfosChanged(
{{*window->getInfo(), *window->getInfo()}, {}, 0, 0}),
"Incorrect WindowInfosUpdate provided");
@@ -731,17 +737,19 @@
TEST_F(InputDispatcherTest, WhenDisplayNotSpecified_InjectMotionToDefaultDisplay) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
// Inject a MotionEvent to an unknown display.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::ADISPLAY_ID_NONE))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::INVALID))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Window should receive motion event.
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
}
/**
@@ -751,18 +759,19 @@
*/
TEST_F(InputDispatcherTest, SetInputWindowOnceWithSingleTouchWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Window should receive motion event.
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
}
/**
@@ -770,37 +779,40 @@
*/
TEST_F(InputDispatcherTest, SetInputWindowTwice_SingleWindowTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Window should receive motion event.
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
}
// The foreground window should receive the first touch down event.
TEST_F(InputDispatcherTest, SetInputWindow_MultiWindowsTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> windowTop =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowTop = sp<FakeWindowHandle>::make(application, mDispatcher, "Top",
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> windowSecond =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Second",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged(
{{*windowTop->getInfo(), *windowSecond->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Top window should receive the touch down event. Second window should not receive anything.
- windowTop->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ windowTop->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
windowSecond->assertNoEvents();
}
@@ -814,10 +826,12 @@
TEST_F(InputDispatcherTest, WhenForegroundWindowDisappears_WallpaperTouchIsCanceled) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> foregroundWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground",
+ ui::LogicalDisplayId::DEFAULT);
foregroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> wallpaperWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper",
+ ui::LogicalDisplayId::DEFAULT);
wallpaperWindow->setIsWallpaper(true);
mDispatcher->onWindowInfosChanged(
@@ -831,7 +845,7 @@
// Both foreground window and its wallpaper should receive the touch down
foregroundWindow->consumeMotionDown();
- wallpaperWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher,
@@ -841,13 +855,13 @@
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
foregroundWindow->consumeMotionEvent(WithMotionAction(ACTION_MOVE));
- wallpaperWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// Now the foreground window goes away, but the wallpaper stays
mDispatcher->onWindowInfosChanged({{*wallpaperWindow->getInfo()}, {}, 0, 0});
foregroundWindow->consumeMotionCancel();
// Since the "parent" window of the wallpaper is gone, wallpaper should receive cancel, too.
- wallpaperWindow->consumeMotionCancel(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
}
/**
@@ -857,8 +871,8 @@
*/
TEST_F(InputDispatcherTest, CancelAfterPointer0Up) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
// First touch pointer down on right window
@@ -897,30 +911,32 @@
TEST_F(InputDispatcherTest, WhenWallpaperDisappears_NoCrash) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> foregroundWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground",
+ ui::LogicalDisplayId::DEFAULT);
foregroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> wallpaperWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper",
+ ui::LogicalDisplayId::DEFAULT);
wallpaperWindow->setIsWallpaper(true);
mDispatcher->onWindowInfosChanged(
{{*foregroundWindow->getInfo(), *wallpaperWindow->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Both foreground window and its wallpaper should receive the touch down
foregroundWindow->consumeMotionDown();
- wallpaperWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 200}))
+ ui::LogicalDisplayId::DEFAULT, {110, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
foregroundWindow->consumeMotionMove();
- wallpaperWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// Wallpaper closes its channel, but the window remains.
wallpaperWindow->destroyReceiver();
@@ -942,23 +958,23 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftForegroundWindow->setFrame(Rect(0, 0, 100, 100));
leftForegroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> leftWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWallpaperWindow->setFrame(Rect(0, 0, 100, 100));
leftWallpaperWindow->setIsWallpaper(true);
sp<FakeWindowHandle> rightForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightForegroundWindow->setFrame(Rect(100, 0, 200, 100));
rightForegroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> rightWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightWallpaperWindow->setFrame(Rect(100, 0, 200, 100));
rightWallpaperWindow->setIsWallpaper(true);
@@ -1026,35 +1042,35 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftForegroundWindow->setFrame(Rect(0, 0, 100, 100));
leftForegroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> leftWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWallpaperWindow->setFrame(Rect(0, 0, 100, 100));
leftWallpaperWindow->setIsWallpaper(true);
sp<FakeWindowHandle> middleForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Middle foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
middleForegroundWindow->setFrame(Rect(100, 0, 200, 100));
middleForegroundWindow->setDupTouchToWallpaper(true);
middleForegroundWindow->setSlippery(true);
sp<FakeWindowHandle> middleWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Middle wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
middleWallpaperWindow->setFrame(Rect(100, 0, 200, 100));
middleWallpaperWindow->setIsWallpaper(true);
sp<FakeWindowHandle> rightForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightForegroundWindow->setFrame(Rect(200, 0, 300, 100));
rightForegroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> rightWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightWallpaperWindow->setFrame(Rect(200, 0, 300, 100));
rightWallpaperWindow->setIsWallpaper(true);
@@ -1132,34 +1148,34 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftForegroundWindow->setFrame(Rect(0, 0, 100, 100));
leftForegroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> leftWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWallpaperWindow->setFrame(Rect(0, 0, 100, 100));
leftWallpaperWindow->setIsWallpaper(true);
sp<FakeWindowHandle> middleForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Middle foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
middleForegroundWindow->setFrame(Rect(100, 0, 200, 100));
middleForegroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> middleWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Middle wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
middleWallpaperWindow->setFrame(Rect(100, 0, 200, 100));
middleWallpaperWindow->setIsWallpaper(true);
sp<FakeWindowHandle> rightForegroundWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right foreground window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightForegroundWindow->setFrame(Rect(200, 0, 300, 100));
rightForegroundWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> rightWallpaperWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right wallpaper window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightWallpaperWindow->setFrame(Rect(200, 0, 300, 100));
rightWallpaperWindow->setIsWallpaper(true);
@@ -1239,12 +1255,14 @@
TEST_P(ShouldSplitTouchFixture, WallpaperWindowReceivesMultiTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> foregroundWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground",
+ ui::LogicalDisplayId::DEFAULT);
foregroundWindow->setDupTouchToWallpaper(true);
foregroundWindow->setPreventSplitting(GetParam());
sp<FakeWindowHandle> wallpaperWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper",
+ ui::LogicalDisplayId::DEFAULT);
wallpaperWindow->setIsWallpaper(true);
mDispatcher->onWindowInfosChanged(
@@ -1252,13 +1270,13 @@
// Touch down on top window
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 100}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 100}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Both top window and its wallpaper should receive the touch down
foregroundWindow->consumeMotionDown();
- wallpaperWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// Second finger down on the top window
const MotionEvent secondFingerDownEvent =
@@ -1272,12 +1290,12 @@
InputEventInjectionSync::WAIT_FOR_RESULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
foregroundWindow->consumeMotionPointerDown(/*pointerIndex=*/1);
- wallpaperWindow->consumeMotionPointerDown(/*pointerIndex=*/1, ADISPLAY_ID_DEFAULT,
+ wallpaperWindow->consumeMotionPointerDown(/*pointerIndex=*/1, ui::LogicalDisplayId::DEFAULT,
EXPECTED_WALLPAPER_FLAGS);
const MotionEvent secondFingerUpEvent =
MotionEventBuilder(POINTER_0_UP, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(100).y(100))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(150).y(150))
@@ -1287,13 +1305,14 @@
InputEventInjectionSync::WAIT_FOR_RESULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
foregroundWindow->consumeMotionPointerUp(0);
- wallpaperWindow->consumeMotionPointerUp(0, ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionPointerUp(0, ui::LogicalDisplayId::DEFAULT,
+ EXPECTED_WALLPAPER_FLAGS);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher,
MotionEventBuilder(AMOTION_EVENT_ACTION_UP,
AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER)
.x(100)
@@ -1301,8 +1320,8 @@
.build(),
INJECT_EVENT_TIMEOUT, InputEventInjectionSync::WAIT_FOR_RESULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- foregroundWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
- wallpaperWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ foregroundWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
+ wallpaperWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
}
/**
@@ -1315,18 +1334,19 @@
*/
TEST_F(InputDispatcherTest, TwoWindows_SplitWallpaperTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
leftWindow->setDupTouchToWallpaper(true);
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
rightWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> wallpaperWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper",
+ ui::LogicalDisplayId::DEFAULT);
wallpaperWindow->setFrame(Rect(0, 0, 400, 200));
wallpaperWindow->setIsWallpaper(true);
@@ -1338,13 +1358,13 @@
// Touch down on left window
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 100}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 100}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Both foreground window and its wallpaper should receive the touch down
leftWindow->consumeMotionDown();
- wallpaperWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// Second finger down on the right window
const MotionEvent secondFingerDownEvent =
@@ -1360,8 +1380,8 @@
leftWindow->consumeMotionMove();
// Since the touch is split, right window gets ACTION_DOWN
- rightWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- wallpaperWindow->consumeMotionPointerDown(/*pointerIndex=*/1, ADISPLAY_ID_DEFAULT,
+ rightWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ wallpaperWindow->consumeMotionPointerDown(/*pointerIndex=*/1, ui::LogicalDisplayId::DEFAULT,
EXPECTED_WALLPAPER_FLAGS);
// Now, leftWindow, which received the first finger, disappears.
@@ -1369,7 +1389,7 @@
{{*rightWindow->getInfo(), *wallpaperWindow->getInfo()}, {}, 0, 0});
leftWindow->consumeMotionCancel();
// Since a "parent" window of the wallpaper is gone, wallpaper should receive cancel, too.
- wallpaperWindow->consumeMotionCancel(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// The pointer that's still down on the right window moves, and goes to the right window only.
// As far as the dispatcher's concerned though, both pointers are still present.
@@ -1396,18 +1416,19 @@
*/
TEST_F(InputDispatcherTest, WallpaperWindowWhenSlippery) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
leftWindow->setDupTouchToWallpaper(true);
leftWindow->setSlippery(true);
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
sp<FakeWindowHandle> wallpaperWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper",
+ ui::LogicalDisplayId::DEFAULT);
wallpaperWindow->setIsWallpaper(true);
mDispatcher->onWindowInfosChanged(
@@ -1418,23 +1439,23 @@
// Touch down on left window
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 100}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 100}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Both foreground window and its wallpaper should receive the touch down
leftWindow->consumeMotionDown();
- wallpaperWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaperWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// Move to right window, the left window should receive cancel.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {201, 100}))
+ ui::LogicalDisplayId::DEFAULT, {201, 100}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
leftWindow->consumeMotionCancel();
- rightWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- wallpaperWindow->consumeMotionCancel(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ rightWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ wallpaperWindow->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
}
/**
@@ -1455,14 +1476,14 @@
*/
TEST_F(InputDispatcherTest, TwoPointerCancelInconsistentPolicy) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 200, 200));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*spyWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
@@ -1533,8 +1554,8 @@
TEST_F(InputDispatcherTest, HoverEventInconsistentPolicy) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 300, 300));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -1595,12 +1616,12 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -1703,12 +1724,12 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -1792,8 +1813,8 @@
*/
TEST_F(InputDispatcherTest, HoverWhileWindowAppears) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
// Only a single window is present at first
@@ -1808,7 +1829,7 @@
// Now, an obscuring window appears!
sp<FakeWindowHandle> obscuringWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Obscuring window",
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
/*createInputChannel=*/false);
obscuringWindow->setFrame(Rect(0, 0, 200, 200));
obscuringWindow->setTouchOcclusionMode(TouchOcclusionMode::BLOCK_UNTRUSTED);
@@ -1841,8 +1862,8 @@
*/
TEST_F(InputDispatcherTest, HoverMoveWhileWindowAppears) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
// Only a single window is present at first
@@ -1857,7 +1878,7 @@
// Now, an obscuring window appears!
sp<FakeWindowHandle> obscuringWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Obscuring window",
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
/*createInputChannel=*/false);
obscuringWindow->setFrame(Rect(0, 0, 200, 200));
obscuringWindow->setTouchOcclusionMode(TouchOcclusionMode::BLOCK_UNTRUSTED);
@@ -1899,8 +1920,8 @@
*/
TEST_F(InputDispatcherTest, HoverMoveAndScroll) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -1931,8 +1952,8 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusDownBlocksTouchDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -1978,8 +1999,8 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusDownDoesNotBlockTouchDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2027,10 +2048,10 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusDownWithSpyBlocksTouchDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 200, 200));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
@@ -2086,10 +2107,10 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusDownWithSpyDoesNotBlockTouchDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 200, 200));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
@@ -2148,8 +2169,8 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusHoverBlocksTouchDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2200,8 +2221,8 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusHoverDoesNotBlockTouchDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2254,8 +2275,8 @@
TEST_F(InputDispatcherMultiDeviceTest, TouchIsCanceledByStylusHover) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2308,8 +2329,8 @@
TEST_F(InputDispatcherMultiDeviceTest, TouchIsNotCanceledByStylusHover) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2363,8 +2384,8 @@
TEST_F(InputDispatcherMultiDeviceTest, LatestStylusWins) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2415,8 +2436,8 @@
TEST_F(InputDispatcherMultiDeviceTest, TwoStylusDevicesActiveAtTheSameTime) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2463,8 +2484,8 @@
TEST_F(InputDispatcherMultiDeviceTest, TouchIsCanceledByStylusDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2508,8 +2529,8 @@
TEST_F(InputDispatcherMultiDeviceTest, TouchIsNotCanceledByStylusDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -2562,12 +2583,12 @@
TEST_F(InputDispatcherMultiDeviceTest, MultiDeviceSplitTouch_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -2647,12 +2668,12 @@
TEST_F(InputDispatcherMultiDeviceTest, MultiDeviceSplitTouch) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -2725,12 +2746,12 @@
*/
TEST_F(InputDispatcherMultiDeviceTest, MultiDeviceHover) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -2784,18 +2805,18 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 400, 400));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
@@ -2860,18 +2881,18 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 400, 400));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
@@ -2939,18 +2960,18 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 400, 400));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -3015,18 +3036,18 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 400, 400));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -3092,8 +3113,8 @@
TEST_F(InputDispatcherMultiDeviceTest, MixedTouchAndMouseWithPointerDown_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 400, 400));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -3172,8 +3193,8 @@
TEST_F(InputDispatcherMultiDeviceTest, MixedTouchAndMouseWithPointerDown) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 400, 400));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -3247,8 +3268,8 @@
TEST_F(InputDispatcherMultiDeviceTest, UnfinishedInjectedEvent_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 400, 400));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -3284,8 +3305,8 @@
TEST_F(InputDispatcherMultiDeviceTest, UnfinishedInjectedEvent) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 400, 400));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -3328,12 +3349,12 @@
TEST_F(InputDispatcherMultiDeviceTest, HoverTapAndSplitTouch_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -3414,12 +3435,12 @@
TEST_F(InputDispatcherMultiDeviceTest, HoverTapAndSplitTouch) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
mDispatcher->onWindowInfosChanged(
@@ -3481,8 +3502,8 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusHoverIgnoresTouchTap) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -3548,8 +3569,8 @@
TEST_F(InputDispatcherMultiDeviceTest, StylusHoverWithTouchTap) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -3608,12 +3629,13 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 100, 100));
sp<FakeWindowHandle> sbtRightWindow =
sp<FakeWindowHandle>::make(application, mDispatcher,
- "Stylus blocks touch (right) window", ADISPLAY_ID_DEFAULT);
+ "Stylus blocks touch (right) window",
+ ui::LogicalDisplayId::DEFAULT);
sbtRightWindow->setFrame(Rect(100, 100, 200, 200));
sbtRightWindow->setGlobalStylusBlocksTouch(true);
@@ -3680,12 +3702,13 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 100, 100));
sp<FakeWindowHandle> sbtRightWindow =
sp<FakeWindowHandle>::make(application, mDispatcher,
- "Stylus blocks touch (right) window", ADISPLAY_ID_DEFAULT);
+ "Stylus blocks touch (right) window",
+ ui::LogicalDisplayId::DEFAULT);
sbtRightWindow->setFrame(Rect(100, 100, 200, 200));
sbtRightWindow->setGlobalStylusBlocksTouch(true);
@@ -3746,13 +3769,13 @@
*/
TEST_F(InputDispatcherTest, StylusHoverAndDownNoInputChannel) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 200, 200));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setNoInputChannel(true);
window->setFrame(Rect(0, 0, 200, 200));
@@ -3805,8 +3828,8 @@
TEST_F(InputDispatcherTest, StaleStylusHoverGestureIsComplete) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -3844,13 +3867,13 @@
TEST_F(InputDispatcherTest, TouchPilferAndMouseMove_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 200, 200));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*spyWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
@@ -3947,13 +3970,13 @@
TEST_F(InputDispatcherTest, TouchPilferAndMouseMove) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 200, 200));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*spyWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
@@ -4171,14 +4194,14 @@
TEST_F(InputDispatcherTest, HoverMoveEnterMouseClickAndHoverMoveExit) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> windowLeft =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowLeft = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
windowLeft->setFrame(Rect(0, 0, 600, 800));
- sp<FakeWindowHandle> windowRight =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowRight = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
windowRight->setFrame(Rect(600, 0, 1200, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged(
{{*windowLeft->getInfo(), *windowRight->getInfo()}, {}, 0, 0});
@@ -4238,7 +4261,7 @@
.buttonState(0)
.pointer(PointerBuilder(0, ToolType::MOUSE).x(300).y(400))
.build()));
- windowLeft->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ windowLeft->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
// Move mouse cursor back to right window
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
@@ -4262,8 +4285,8 @@
TEST_F(InputDispatcherTest, TwoPointersDownMouseClick_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 600, 800));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4322,8 +4345,8 @@
TEST_F(InputDispatcherTest, TwoPointersDownMouseClick) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 600, 800));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4376,16 +4399,16 @@
TEST_F(InputDispatcherTest, HoverWithSpyWindows) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 600, 800));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 600, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*spyWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
// Send mouse cursor to the window
@@ -4409,16 +4432,16 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 600, 800));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 600, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*spyWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
// Send mouse cursor to the window
@@ -4516,16 +4539,16 @@
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(0, 0, 600, 800));
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 600, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*spyWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
// Send mouse cursor to the window
@@ -4612,11 +4635,11 @@
// directly in this test.
TEST_F(InputDispatcherTest, HoverEnterMouseClickAndHoverExit) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 1200, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4663,7 +4686,7 @@
.buttonState(0)
.pointer(PointerBuilder(0, ToolType::MOUSE).x(300).y(400))
.build()));
- window->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
// We already canceled the hovering implicitly by injecting the "DOWN" event without lifting the
// hover first. Therefore, injection of HOVER_EXIT is inconsistent, and should fail.
@@ -4682,11 +4705,11 @@
*/
TEST_F(InputDispatcherTest, HoverExitIsSentToRemovedWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 1200, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4710,11 +4733,11 @@
REQUIRES_FLAGS_DISABLED(ACONFIG_FLAG(com::android::input::flags,
a11y_crash_on_inconsistent_event_stream))) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 1200, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4736,8 +4759,8 @@
TEST_F(InputDispatcherTest, TouchDownAfterMouseHover_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4770,8 +4793,8 @@
TEST_F(InputDispatcherTest, TouchDownAfterMouseHover) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4803,8 +4826,8 @@
TEST_F(InputDispatcherTest, MouseHoverAndTouchTap_legacy) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4843,8 +4866,8 @@
TEST_F(InputDispatcherTest, MouseHoverAndTouchTap) {
SCOPED_FLAG_OVERRIDE(enable_multi_device_same_window_stream, true);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4878,7 +4901,7 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> windowDefaultDisplay =
sp<FakeWindowHandle>::make(application, mDispatcher, "DefaultDisplay",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
windowDefaultDisplay->setFrame(Rect(0, 0, 600, 800));
sp<FakeWindowHandle> windowSecondDisplay =
sp<FakeWindowHandle>::make(application, mDispatcher, "SecondDisplay",
@@ -4894,7 +4917,7 @@
injectMotionEvent(*mDispatcher,
MotionEventBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE,
AINPUT_SOURCE_MOUSE)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.pointer(PointerBuilder(0, ToolType::MOUSE).x(300).y(600))
.build()));
windowDefaultDisplay->consumeMotionEvent(WithMotionAction(AMOTION_EVENT_ACTION_HOVER_ENTER));
@@ -4913,7 +4936,7 @@
injectMotionEvent(*mDispatcher,
MotionEventBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE,
AINPUT_SOURCE_MOUSE)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.pointer(PointerBuilder(0, ToolType::MOUSE).x(400).y(700))
.build()));
windowDefaultDisplay->consumeMotionEvent(
@@ -4925,14 +4948,14 @@
TEST_F(InputDispatcherTest, DispatchMouseEventsUnderCursor) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> windowLeft =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowLeft = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
windowLeft->setFrame(Rect(0, 0, 600, 800));
- sp<FakeWindowHandle> windowRight =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowRight = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
windowRight->setFrame(Rect(600, 0, 1200, 800));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged(
{{*windowLeft->getInfo(), *windowRight->getInfo()}, {}, 0, 0});
@@ -4941,15 +4964,16 @@
// left window. This event should be dispatched to the left window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_MOUSE,
- ADISPLAY_ID_DEFAULT, {610, 400}, {599, 400}));
- windowLeft->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT, {610, 400}, {599, 400}));
+ windowLeft->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
windowRight->assertNoEvents();
}
TEST_F(InputDispatcherTest, NotifyDeviceReset_CancelsKeyStream) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -4957,41 +4981,44 @@
window->consumeFocusEvent(true);
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
// Window should receive key down event.
- window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
// When device reset happens, that key stream should be terminated with FLAG_CANCELED
// on the app side.
mDispatcher->notifyDeviceReset({/*id=*/10, /*eventTime=*/20, DEVICE_ID});
- window->consumeKeyUp(ADISPLAY_ID_DEFAULT, AKEY_EVENT_FLAG_CANCELED);
+ window->consumeKeyUp(ui::LogicalDisplayId::DEFAULT, AKEY_EVENT_FLAG_CANCELED);
}
TEST_F(InputDispatcherTest, NotifyDeviceReset_CancelsMotionStream) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
// Window should receive motion down event.
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
// When device reset happens, that motion stream should be terminated with ACTION_CANCEL
// on the app side.
mDispatcher->notifyDeviceReset({/*id=*/10, /*eventTime=*/20, DEVICE_ID});
window->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
}
TEST_F(InputDispatcherTest, NotifyDeviceResetCancelsHoveringStream) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -5014,8 +5041,9 @@
TEST_F(InputDispatcherTest, InterceptKeyByPolicy) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -5023,13 +5051,14 @@
window->consumeFocusEvent(true);
- const NotifyKeyArgs keyArgs = generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT);
+ const NotifyKeyArgs keyArgs =
+ generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT);
const std::chrono::milliseconds interceptKeyTimeout = 50ms;
const nsecs_t injectTime = keyArgs.eventTime;
mFakePolicy->setInterceptKeyTimeout(interceptKeyTimeout);
mDispatcher->notifyKey(keyArgs);
// The dispatching time should be always greater than or equal to intercept key timeout.
- window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
ASSERT_TRUE((systemTime(SYSTEM_TIME_MONOTONIC) - injectTime) >=
std::chrono::nanoseconds(interceptKeyTimeout).count());
}
@@ -5039,8 +5068,9 @@
*/
TEST_F(InputDispatcherTest, InterceptKeyIfKeyUp) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -5048,15 +5078,15 @@
window->consumeFocusEvent(true);
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
- window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
+ window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
// Set a value that's significantly larger than the default consumption timeout. If the
// implementation is correct, the actual value doesn't matter; it won't slow down the test.
mFakePolicy->setInterceptKeyTimeout(600ms);
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ui::LogicalDisplayId::DEFAULT));
// Window should receive key event immediately when same key up.
- window->consumeKeyUp(ADISPLAY_ID_DEFAULT);
+ window->consumeKeyUp(ui::LogicalDisplayId::DEFAULT);
}
/**
@@ -5068,13 +5098,13 @@
*/
TEST_F(InputDispatcherTest, ActionOutsideForOwnedWindowHasValidCoordinates) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect{0, 0, 100, 100});
sp<FakeWindowHandle> outsideWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Outside Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
outsideWindow->setFrame(Rect{100, 100, 200, 200});
outsideWindow->setWatchOutsideTouch(true);
// outsideWindow must be above 'window' to receive ACTION_OUTSIDE events when 'window' is tapped
@@ -5082,8 +5112,8 @@
// Tap on first window.
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {PointF{50, 50}}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {PointF{50, 50}}));
window->consumeMotionDown();
// The coordinates of the tap in 'outsideWindow' are relative to its top left corner.
// Therefore, we should offset them by (100, 100) relative to the screen's top left corner.
@@ -5092,7 +5122,7 @@
// Ensure outsideWindow doesn't get any more events for the gesture.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {PointF{51, 51}}));
+ ui::LogicalDisplayId::DEFAULT, {PointF{51, 51}}));
window->consumeMotionMove();
outsideWindow->assertNoEvents();
}
@@ -5116,13 +5146,13 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect{0, 0, 100, 100});
leftWindow->setOwnerInfo(gui::Pid{1}, gui::Uid{101});
sp<FakeWindowHandle> outsideWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Outside Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
outsideWindow->setFrame(Rect{100, 100, 200, 200});
outsideWindow->setOwnerInfo(gui::Pid{1}, gui::Uid{101});
outsideWindow->setWatchOutsideTouch(true);
@@ -5131,7 +5161,7 @@
std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> rightWindow =
sp<FakeWindowHandle>::make(anotherApplication, mDispatcher, "Right Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect{100, 0, 200, 100});
rightWindow->setOwnerInfo(gui::Pid{2}, gui::Uid{202});
@@ -5195,32 +5225,33 @@
TEST_F(InputDispatcherTest, ActionOutsideSentOnlyWhenAWindowIsTouched) {
// There are three windows that do not overlap. `window` wants to WATCH_OUTSIDE_TOUCH.
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "First Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setWatchOutsideTouch(true);
window->setFrame(Rect{0, 0, 100, 100});
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
secondWindow->setFrame(Rect{100, 100, 200, 200});
sp<FakeWindowHandle> thirdWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Third Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
thirdWindow->setFrame(Rect{200, 200, 300, 300});
mDispatcher->onWindowInfosChanged(
{{*window->getInfo(), *secondWindow->getInfo(), *thirdWindow->getInfo()}, {}, 0, 0});
// First pointer lands outside all windows. `window` does not get ACTION_OUTSIDE.
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {PointF{-10, -10}}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {PointF{-10, -10}}));
window->assertNoEvents();
secondWindow->assertNoEvents();
// The second pointer lands inside `secondWindow`, which should receive a DOWN event.
// Now, `window` should get ACTION_OUTSIDE.
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
{PointF{-10, -10}, PointF{105, 105}}));
const std::map<int32_t, PointF> expectedPointers{{0, PointF{-10, -10}}, {1, PointF{105, 105}}};
window->consumeMotionEvent(
@@ -5231,7 +5262,8 @@
// The third pointer lands inside `thirdWindow`, which should receive a DOWN event. There is
// no ACTION_OUTSIDE sent to `window` because one has already been sent for this gesture.
mDispatcher->notifyMotion(
- generateMotionArgs(POINTER_2_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ generateMotionArgs(POINTER_2_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT,
{PointF{-10, -10}, PointF{105, 105}, PointF{205, 205}}));
window->assertNoEvents();
secondWindow->consumeMotionMove();
@@ -5240,8 +5272,9 @@
TEST_F(InputDispatcherTest, OnWindowInfosChanged_RemoveAllWindowsOnDisplay) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -5249,13 +5282,15 @@
window->consumeFocusEvent(true);
- const NotifyKeyArgs keyDown = generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT);
- const NotifyKeyArgs keyUp = generateKeyArgs(AKEY_EVENT_ACTION_UP, ADISPLAY_ID_DEFAULT);
+ const NotifyKeyArgs keyDown =
+ generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT);
+ const NotifyKeyArgs keyUp =
+ generateKeyArgs(AKEY_EVENT_ACTION_UP, ui::LogicalDisplayId::DEFAULT);
mDispatcher->notifyKey(keyDown);
mDispatcher->notifyKey(keyUp);
- window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
- window->consumeKeyUp(ADISPLAY_ID_DEFAULT);
+ window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
+ window->consumeKeyUp(ui::LogicalDisplayId::DEFAULT);
// All windows are removed from the display. Ensure that we can no longer dispatch to it.
mDispatcher->onWindowInfosChanged({{}, {}, 0, 0});
@@ -5269,22 +5304,23 @@
TEST_F(InputDispatcherTest, NonSplitTouchableWindowReceivesMultiTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
// Ensure window is non-split and have some transform.
window->setPreventSplitting(true);
window->setWindowOffset(20, 40);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(50).y(50))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(-30).y(-50))
@@ -5315,12 +5351,12 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left splittable Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setPreventSplitting(false);
leftWindow->setFrame(Rect(0, 0, 100, 100));
sp<FakeWindowHandle> rightWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right non-splittable Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setPreventSplitting(true);
rightWindow->setFrame(Rect(100, 100, 200, 200));
mDispatcher->onWindowInfosChanged(
@@ -5343,12 +5379,12 @@
TEST_F(InputDispatcherTest, TouchpadThreeFingerSwipeOnlySentToTrustedOverlays) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 400, 400));
sp<FakeWindowHandle> trustedOverlay =
sp<FakeWindowHandle>::make(application, mDispatcher, "Trusted Overlay",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
trustedOverlay->setSpy(true);
trustedOverlay->setTrustedOverlay(true);
@@ -5411,8 +5447,8 @@
TEST_F(InputDispatcherTest, TouchpadThreeFingerSwipeNotSentToSingleWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 400, 400));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -5468,8 +5504,8 @@
*/
TEST_F(InputDispatcherTest, MultiplePointersWithRotatingWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 400, 400));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -5534,13 +5570,14 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> spyWindowDefaultDisplay =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindowDefaultDisplay->setTrustedOverlay(true);
spyWindowDefaultDisplay->setSpy(true);
sp<FakeWindowHandle> windowDefaultDisplay =
sp<FakeWindowHandle>::make(application, mDispatcher, "DefaultDisplay",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
windowDefaultDisplay->setWindowTransform(1, 0, 0, 1);
sp<FakeWindowHandle> windowSecondDisplay = windowDefaultDisplay->clone(SECOND_DISPLAY_ID);
@@ -5554,10 +5591,10 @@
0,
0});
- // Send down to ADISPLAY_ID_DEFAULT
+ // Send down to ui::LogicalDisplayId::DEFAULT
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 100}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 100}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
spyWindowDefaultDisplay->consumeMotionDown();
@@ -5570,10 +5607,10 @@
ASSERT_NE(nullptr, event);
EXPECT_EQ(AMOTION_EVENT_ACTION_CANCEL, event->getAction());
- // The cancel event is sent to windowDefaultDisplay of the ADISPLAY_ID_DEFAULT display, so
- // the coordinates of the cancel are converted by windowDefaultDisplay's transform, the x and y
- // coordinates are both 100, otherwise if the cancel event is sent to windowSecondDisplay of
- // SECOND_DISPLAY_ID, the x and y coordinates are 200
+ // The cancel event is sent to windowDefaultDisplay of the ui::LogicalDisplayId::DEFAULT
+ // display, so the coordinates of the cancel are converted by windowDefaultDisplay's transform,
+ // the x and y coordinates are both 100, otherwise if the cancel event is sent to
+ // windowSecondDisplay of SECOND_DISPLAY_ID, the x and y coordinates are 200
EXPECT_EQ(100, event->getX(0));
EXPECT_EQ(100, event->getY(0));
}
@@ -5617,7 +5654,7 @@
// respectively.
ui::Transform displayTransform;
displayTransform.set(2, 0, 0, 4);
- addDisplayInfo(ADISPLAY_ID_DEFAULT, displayTransform);
+ addDisplayInfo(ui::LogicalDisplayId::DEFAULT, displayTransform);
std::shared_ptr<FakeApplicationHandle> application =
std::make_shared<FakeApplicationHandle>();
@@ -5625,13 +5662,13 @@
// Add two windows to the display. Their frames are represented in the display space.
sp<FakeWindowHandle> firstWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
firstWindow->setFrame(Rect(0, 0, 100, 200), displayTransform);
addWindow(firstWindow);
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
secondWindow->setFrame(Rect(100, 200, 200, 400), displayTransform);
addWindow(secondWindow);
return {std::move(firstWindow), std::move(secondWindow)};
@@ -5648,8 +5685,8 @@
// selected so that if the hit test was performed with the point and the bounds being in
// different coordinate spaces, the event would end up in the incorrect window.
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {PointF{75, 55}}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {PointF{75, 55}}));
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
@@ -5662,7 +5699,7 @@
// Send down to the first window. The point is represented in the logical display space. The
// point is selected so that if the hit test was done in logical display space, then it would
// end up in the incorrect window.
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
PointF{75 * 2, 55 * 4});
firstWindow->consumeMotionDown();
@@ -5681,7 +5718,7 @@
const vec2 untransformedPoint = injectedEventTransform.inverse().transform(expectedPoint);
MotionEvent event = MotionEventBuilder(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER)
.x(untransformedPoint.x)
@@ -5700,9 +5737,9 @@
auto [firstWindow, secondWindow] = setupScaledDisplayScenario();
// Send down to the second window.
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {PointF{150, 220}}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {PointF{150, 220}}));
firstWindow->assertNoEvents();
std::unique_ptr<MotionEvent> event = secondWindow->consumeMotionEvent();
@@ -5724,17 +5761,17 @@
auto [firstWindow, secondWindow] = setupScaledDisplayScenario();
// The monitor will always receive events in the logical display's coordinate space, because
// it does not have a window.
- FakeMonitorReceiver monitor{*mDispatcher, "Monitor", ADISPLAY_ID_DEFAULT};
+ FakeMonitorReceiver monitor{*mDispatcher, "Monitor", ui::LogicalDisplayId::DEFAULT};
// Send down to the first window.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {PointF{50, 100}}));
+ ui::LogicalDisplayId::DEFAULT, {PointF{50, 100}}));
firstWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_DOWN), WithCoords(100, 400)));
monitor.consumeMotionEvent(AllOf(WithMotionAction(ACTION_DOWN), WithCoords(100, 400)));
// Second pointer goes down on second window.
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
{PointF{50, 100}, PointF{150, 220}}));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_DOWN), WithCoords(100, 80)));
const std::map<int32_t, PointF> expectedMonitorPointers{{0, PointF{100, 400}},
@@ -5755,7 +5792,7 @@
// Send down to the first window.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {PointF{50, 100}}));
+ ui::LogicalDisplayId::DEFAULT, {PointF{50, 100}}));
firstWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_DOWN), WithCoords(100, 400)));
// The pointer is transferred to the second window, and the second window receives it in the
@@ -5770,13 +5807,15 @@
// Send hover move to the second window, and ensure it shows up as hover enter.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{150, 220}}));
+ ui::LogicalDisplayId::DEFAULT,
+ {PointF{150, 220}}));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_ENTER),
WithCoords(100, 80), WithRawCoords(300, 880)));
// Touch down at the same location and ensure a hover exit is synthesized.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_DOWN, AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{150, 220}}));
+ ui::LogicalDisplayId::DEFAULT,
+ {PointF{150, 220}}));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_EXIT), WithCoords(100, 80),
WithRawCoords(300, 880)));
secondWindow->consumeMotionEvent(
@@ -5801,14 +5840,16 @@
// Send hover move to the second window, and ensure it shows up as hover enter.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{150, 220}}));
+ ui::LogicalDisplayId::DEFAULT,
+ {PointF{150, 220}}));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_ENTER),
WithCoords(100, 80), WithRawCoords(300, 880)));
// Touch down at the same location and ensure a hover exit is synthesized for the correct
// display.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_DOWN, AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{150, 220}}));
+ ui::LogicalDisplayId::DEFAULT,
+ {PointF{150, 220}}));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_EXIT), WithCoords(100, 80),
WithRawCoords(300, 880)));
secondWindow->consumeMotionEvent(
@@ -5822,7 +5863,8 @@
// Send hover enter to second window
mDispatcher->notifyMotion(generateMotionArgs(ACTION_HOVER_ENTER, AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{150, 220}}));
+ ui::LogicalDisplayId::DEFAULT,
+ {PointF{150, 220}}));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_ENTER),
WithCoords(100, 80), WithRawCoords(300, 880)));
@@ -5850,17 +5892,18 @@
// Send hover enter to second window
mDispatcher->notifyMotion(generateMotionArgs(ACTION_HOVER_ENTER, AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{150, 220}}));
+ ui::LogicalDisplayId::DEFAULT,
+ {PointF{150, 220}}));
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_ENTER),
WithCoords(100, 80), WithRawCoords(300, 880),
- WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
mDispatcher->cancelCurrentTouch();
// Ensure the cancelation happens with the correct displayId and the correct coordinates.
secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_EXIT), WithCoords(100, 80),
WithRawCoords(300, 880),
- WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
secondWindow->assertNoEvents();
firstWindow->assertNoEvents();
}
@@ -5887,13 +5930,13 @@
const int32_t logicalDisplayHeight = isRotated ? displayWidth : displayHeight;
const ui::Transform displayTransform(ui::Transform::toRotationFlags(rotation),
logicalDisplayWidth, logicalDisplayHeight);
- addDisplayInfo(ADISPLAY_ID_DEFAULT, displayTransform);
+ addDisplayInfo(ui::LogicalDisplayId::DEFAULT, displayTransform);
// Create a window with its bounds determined in the logical display.
const Rect frameInLogicalDisplay(100, 100, 200, 300);
const Rect frameInDisplay = displayTransform.inverse().transform(frameInLogicalDisplay);
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(frameInDisplay, displayTransform);
addWindow(window);
@@ -5903,14 +5946,14 @@
for (const auto pointInsideWindow : insidePoints) {
const vec2 p = displayTransform.inverse().transform(pointInsideWindow);
const PointF pointInDisplaySpace{p.x, p.y};
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
window->consumeMotionDown();
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
window->consumeMotionUp();
}
@@ -5920,13 +5963,13 @@
for (const auto pointOutsideWindow : outsidePoints) {
const vec2 p = displayTransform.inverse().transform(pointOutsideWindow);
const PointF pointInDisplaySpace{p.x, p.y};
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
}
window->assertNoEvents();
}
@@ -5950,7 +5993,7 @@
const int32_t logicalDisplayHeight = isRotated ? displayWidth : displayHeight;
const ui::Transform displayTransform(ui::Transform::toRotationFlags(rotation),
logicalDisplayWidth, logicalDisplayHeight);
- addDisplayInfo(ADISPLAY_ID_DEFAULT, displayTransform);
+ addDisplayInfo(ui::LogicalDisplayId::DEFAULT, displayTransform);
// Create a window that not trusted.
const Rect untrustedWindowFrameInLogicalDisplay(100, 100, 200, 300);
@@ -5960,7 +6003,7 @@
sp<FakeWindowHandle> untrustedWindow =
sp<FakeWindowHandle>::make(untrustedWindowApplication, mDispatcher, "UntrustedWindow",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
untrustedWindow->setFrame(untrustedWindowFrameInDisplay, displayTransform);
untrustedWindow->setTrustedOverlay(false);
untrustedWindow->setTouchOcclusionMode(TouchOcclusionMode::BLOCK_UNTRUSTED);
@@ -5976,7 +6019,7 @@
sp<FakeWindowHandle> simpleAppWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "SimpleAppWindow",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
simpleAppWindow->setFrame(simpleAppWindowFrameInDisplay, displayTransform);
simpleAppWindow->setOwnerInfo(gui::Pid{2}, gui::Uid{202});
addWindow(simpleAppWindow);
@@ -5989,12 +6032,12 @@
for (const auto untrustedPoint : untrustedPoints) {
const vec2 p = displayTransform.inverse().transform(untrustedPoint);
const PointF pointInDisplaySpace{p.x, p.y};
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
}
untrustedWindow->assertNoEvents();
simpleAppWindow->assertNoEvents();
@@ -6005,15 +6048,15 @@
for (const auto trustedPoint : trustedPoints) {
const vec2 p = displayTransform.inverse().transform(trustedPoint);
const PointF pointInDisplaySpace{p.x, p.y};
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
- simpleAppWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT,
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
+ simpleAppWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED);
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInDisplaySpace}));
- simpleAppWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT,
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInDisplaySpace}));
+ simpleAppWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED);
}
untrustedWindow->assertNoEvents();
@@ -6040,13 +6083,14 @@
// Create a couple of windows
sp<FakeWindowHandle> firstWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
firstWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> wallpaper =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper",
+ ui::LogicalDisplayId::DEFAULT);
wallpaper->setIsWallpaper(true);
// Add the windows to the dispatcher, and ensure the first window is focused
mDispatcher->onWindowInfosChanged(
@@ -6056,12 +6100,13 @@
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
// Only the first window should get the down event
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
- wallpaper->consumeMotionDown(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaper->consumeMotionDown(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// Dispatcher reports pointer down outside focus for the wallpaper
mFakePolicy->assertOnPointerDownEquals(wallpaper->getToken());
@@ -6071,17 +6116,19 @@
ASSERT_TRUE(success);
// The first window gets cancel and the second gets down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
- wallpaper->consumeMotionCancel(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ secondWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ wallpaper->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
// There should not be any changes to the focused window when transferring touch
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertOnPointerDownWasNotCalled());
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
// The first window gets no events and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
wallpaper->assertNoEvents();
}
@@ -6101,14 +6148,15 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
// Create a couple of windows + a spy window
- sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spyWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setTrustedOverlay(true);
spyWindow->setSpy(true);
- sp<FakeWindowHandle> firstWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "First", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> firstWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "First",
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> secondWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Second",
+ ui::LogicalDisplayId::DEFAULT);
// Add the windows to the dispatcher
mDispatcher->onWindowInfosChanged(
@@ -6116,7 +6164,8 @@
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
// Only the first window and spy should get the down event
spyWindow->consumeMotionDown();
firstWindow->consumeMotionDown();
@@ -6128,15 +6177,17 @@
ASSERT_TRUE(success);
// The first window gets cancel and the second gets down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
// The first window gets no events and the second+spy get up
firstWindow->assertNoEvents();
spyWindow->consumeMotionUp();
- secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
TEST_P(TransferTouchFixture, TransferTouch_TwoPointersNonSplitTouch) {
@@ -6147,11 +6198,11 @@
// Create a couple of windows
sp<FakeWindowHandle> firstWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
firstWindow->setPreventSplitting(true);
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
secondWindow->setPreventSplitting(true);
// Add the windows to the dispatcher
@@ -6160,15 +6211,16 @@
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {touchPoint}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {touchPoint}));
// Only the first window should get the down event
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
// Send pointer down to the first window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {touchPoint, touchPoint}));
+ ui::LogicalDisplayId::DEFAULT,
+ {touchPoint, touchPoint}));
// Only the first window should get the pointer down event
firstWindow->consumeMotionPointerDown(1);
secondWindow->assertNoEvents();
@@ -6179,24 +6231,27 @@
ASSERT_TRUE(success);
// The first window gets cancel and the second gets down and pointer down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
- secondWindow->consumeMotionPointerDown(1, ADISPLAY_ID_DEFAULT,
+ secondWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionPointerDown(1, ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send pointer up to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {touchPoint, touchPoint}));
+ ui::LogicalDisplayId::DEFAULT,
+ {touchPoint, touchPoint}));
// The first window gets nothing and the second gets pointer up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionPointerUp(1, ADISPLAY_ID_DEFAULT,
+ secondWindow->consumeMotionPointerUp(1, ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
// The first window gets nothing and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
TEST_P(TransferTouchFixture, TransferTouch_MultipleWallpapers) {
@@ -6205,19 +6260,21 @@
// Create a couple of windows
sp<FakeWindowHandle> firstWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
firstWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
secondWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> wallpaper1 =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper1", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper1",
+ ui::LogicalDisplayId::DEFAULT);
wallpaper1->setIsWallpaper(true);
sp<FakeWindowHandle> wallpaper2 =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper2", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper2",
+ ui::LogicalDisplayId::DEFAULT);
wallpaper2->setIsWallpaper(true);
// Add the windows to the dispatcher
mDispatcher->onWindowInfosChanged({{*firstWindow->getInfo(), *wallpaper1->getInfo(),
@@ -6228,12 +6285,13 @@
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
// Only the first window should get the down event
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
- wallpaper1->consumeMotionDown(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaper1->consumeMotionDown(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
wallpaper2->assertNoEvents();
// Transfer touch focus to the second window
@@ -6243,19 +6301,21 @@
// The first window gets cancel and the second gets down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
- wallpaper1->consumeMotionCancel(ADISPLAY_ID_DEFAULT, EXPECTED_WALLPAPER_FLAGS);
- wallpaper2->consumeMotionDown(ADISPLAY_ID_DEFAULT,
+ secondWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ wallpaper1->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT, EXPECTED_WALLPAPER_FLAGS);
+ wallpaper2->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
EXPECTED_WALLPAPER_FLAGS | AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
// The first window gets no events and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
wallpaper1->assertNoEvents();
- wallpaper2->consumeMotionUp(ADISPLAY_ID_DEFAULT,
+ wallpaper2->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
EXPECTED_WALLPAPER_FLAGS | AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
@@ -6268,7 +6328,7 @@
[&](const std::unique_ptr<InputDispatcher>& dispatcher, sp<IBinder> /*ignored*/,
sp<IBinder> destChannelToken) {
return dispatcher->transferTouchOnDisplay(destChannelToken,
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
},
[&](const std::unique_ptr<InputDispatcher>& dispatcher, sp<IBinder> from,
sp<IBinder> to) {
@@ -6281,12 +6341,12 @@
sp<FakeWindowHandle> firstWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
firstWindow->setFrame(Rect(0, 0, 600, 400));
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
secondWindow->setFrame(Rect(0, 400, 600, 800));
// Add the windows to the dispatcher
@@ -6298,15 +6358,15 @@
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInFirst}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInFirst}));
// Only the first window should get the down event
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
// Send down to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
{pointInFirst, pointInSecond}));
// The first window gets a move and the second a down
firstWindow->consumeMotionMove();
@@ -6316,24 +6376,25 @@
mDispatcher->transferTouchGesture(firstWindow->getToken(), secondWindow->getToken());
// The first window gets cancel and the new gets pointer down (it already saw down)
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionPointerDown(1, ADISPLAY_ID_DEFAULT,
+ secondWindow->consumeMotionPointerDown(1, ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send pointer up to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
{pointInFirst, pointInSecond}));
// The first window gets nothing and the second gets pointer up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionPointerUp(1, ADISPLAY_ID_DEFAULT,
+ secondWindow->consumeMotionPointerUp(1, ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
// The first window gets nothing and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
// Same as TransferTouch_TwoPointersSplitTouch, but using 'transferTouchOnDisplay' api.
@@ -6345,12 +6406,12 @@
sp<FakeWindowHandle> firstWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
firstWindow->setFrame(Rect(0, 0, 600, 400));
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
secondWindow->setFrame(Rect(0, 400, 600, 800));
// Add the windows to the dispatcher
@@ -6362,23 +6423,23 @@
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInFirst}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInFirst}));
// Only the first window should get the down event
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
// Send down to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
{pointInFirst, pointInSecond}));
// The first window gets a move and the second a down
firstWindow->consumeMotionMove();
secondWindow->consumeMotionDown();
// Transfer touch focus to the second window
- const bool transferred =
- mDispatcher->transferTouchOnDisplay(secondWindow->getToken(), ADISPLAY_ID_DEFAULT);
+ const bool transferred = mDispatcher->transferTouchOnDisplay(secondWindow->getToken(),
+ ui::LogicalDisplayId::DEFAULT);
// The 'transferTouchOnDisplay' call should not succeed, because there are 2 touched windows
ASSERT_FALSE(transferred);
firstWindow->assertNoEvents();
@@ -6387,7 +6448,7 @@
// The rest of the dispatch should proceed as normal
// Send pointer up to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
{pointInFirst, pointInSecond}));
// The first window gets MOVE and the second gets pointer up
firstWindow->consumeMotionMove();
@@ -6395,7 +6456,7 @@
// Send up event to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
// The first window gets nothing and the second gets up
firstWindow->consumeMotionUp();
secondWindow->assertNoEvents();
@@ -6407,13 +6468,16 @@
TEST_F(InputDispatcherTest, TransferTouch_CloneSurface) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> firstWindowInPrimary =
- sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W1", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W1",
+ ui::LogicalDisplayId::DEFAULT);
firstWindowInPrimary->setFrame(Rect(0, 0, 100, 100));
sp<FakeWindowHandle> secondWindowInPrimary =
- sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W2", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W2",
+ ui::LogicalDisplayId::DEFAULT);
secondWindowInPrimary->setFrame(Rect(100, 0, 200, 100));
- sp<FakeWindowHandle> mirrorWindowInPrimary = firstWindowInPrimary->clone(ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> mirrorWindowInPrimary =
+ firstWindowInPrimary->clone(ui::LogicalDisplayId::DEFAULT);
mirrorWindowInPrimary->setFrame(Rect(0, 100, 100, 200));
sp<FakeWindowHandle> firstWindowInSecondary = firstWindowInPrimary->clone(SECOND_DISPLAY_ID);
@@ -6432,35 +6496,36 @@
0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Window should receive motion event.
- firstWindowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ firstWindowInPrimary->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
// Transfer touch
ASSERT_TRUE(mDispatcher->transferTouchGesture(firstWindowInPrimary->getToken(),
secondWindowInPrimary->getToken()));
// The first window gets cancel.
firstWindowInPrimary->consumeMotionCancel();
- secondWindowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT,
+ secondWindowInPrimary->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {150, 50}))
+ ui::LogicalDisplayId::DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
firstWindowInPrimary->assertNoEvents();
- secondWindowInPrimary->consumeMotionMove(ADISPLAY_ID_DEFAULT,
+ secondWindowInPrimary->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
firstWindowInPrimary->assertNoEvents();
- secondWindowInPrimary->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindowInPrimary->consumeMotionUp(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
// Same as TransferTouch_CloneSurface, but this touch on the secondary display and use
@@ -6468,13 +6533,16 @@
TEST_F(InputDispatcherTest, TransferTouchOnDisplay_CloneSurface) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> firstWindowInPrimary =
- sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W1", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W1",
+ ui::LogicalDisplayId::DEFAULT);
firstWindowInPrimary->setFrame(Rect(0, 0, 100, 100));
sp<FakeWindowHandle> secondWindowInPrimary =
- sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W2", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "D_1_W2",
+ ui::LogicalDisplayId::DEFAULT);
secondWindowInPrimary->setFrame(Rect(100, 0, 200, 100));
- sp<FakeWindowHandle> mirrorWindowInPrimary = firstWindowInPrimary->clone(ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> mirrorWindowInPrimary =
+ firstWindowInPrimary->clone(ui::LogicalDisplayId::DEFAULT);
mirrorWindowInPrimary->setFrame(Rect(0, 100, 100, 200));
sp<FakeWindowHandle> firstWindowInSecondary = firstWindowInPrimary->clone(SECOND_DISPLAY_ID);
@@ -6527,8 +6595,9 @@
TEST_F(InputDispatcherTest, FocusedWindow_ReceivesFocusEventAndKeyEvent) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -6536,10 +6605,10 @@
window->consumeFocusEvent(true);
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
// Window should receive key down event.
- window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
// Should have poked user activity
mDispatcher->waitForIdle();
@@ -6548,8 +6617,9 @@
TEST_F(InputDispatcherTest, FocusedWindow_DisableUserActivity) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setDisableUserActivity(true);
window->setFocusable(true);
@@ -6558,10 +6628,10 @@
window->consumeFocusEvent(true);
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
// Window should receive key down event.
- window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
// Should have poked user activity
mDispatcher->waitForIdle();
@@ -6570,8 +6640,9 @@
TEST_F(InputDispatcherTest, FocusedWindow_DoesNotReceiveSystemShortcut) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -6579,7 +6650,8 @@
window->consumeFocusEvent(true);
- mDispatcher->notifyKey(generateSystemShortcutArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(
+ generateSystemShortcutArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
mDispatcher->waitForIdle();
// System key is not passed down
@@ -6591,8 +6663,9 @@
TEST_F(InputDispatcherTest, FocusedWindow_DoesNotReceiveAssistantKey) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -6600,7 +6673,8 @@
window->consumeFocusEvent(true);
- mDispatcher->notifyKey(generateAssistantKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(
+ generateAssistantKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
mDispatcher->waitForIdle();
// System key is not passed down
@@ -6612,8 +6686,9 @@
TEST_F(InputDispatcherTest, FocusedWindow_SystemKeyIgnoresDisableUserActivity) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setDisableUserActivity(true);
window->setFocusable(true);
@@ -6622,7 +6697,8 @@
window->consumeFocusEvent(true);
- mDispatcher->notifyKey(generateSystemShortcutArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(
+ generateSystemShortcutArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
mDispatcher->waitForIdle();
// System key is not passed down
@@ -6634,18 +6710,19 @@
TEST_F(InputDispatcherTest, InjectedTouchesPokeUserActivity) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {100, 100}))
+ ui::LogicalDisplayId::DEFAULT, {100, 100}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_DOWN), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_DOWN), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
// Should have poked user activity
mDispatcher->waitForIdle();
@@ -6654,12 +6731,13 @@
TEST_F(InputDispatcherTest, UnfocusedWindow_DoesNotReceiveFocusEventOrKeyEvent) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
mDispatcher->waitForIdle();
window->assertNoEvents();
@@ -6668,19 +6746,21 @@
// If a window is touchable, but does not have focus, it should receive motion events, but not keys
TEST_F(InputDispatcherTest, UnfocusedWindow_ReceivesMotionsButNotKeys) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
// Send key
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
// Send motion
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
// Window should receive only the motion event
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
window->assertNoEvents(); // Key event or focus event will not be received
}
@@ -6689,12 +6769,12 @@
sp<FakeWindowHandle> firstWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "First Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
firstWindow->setFrame(Rect(0, 0, 600, 400));
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Second Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
secondWindow->setFrame(Rect(0, 400, 600, 800));
// Add the windows to the dispatcher
@@ -6706,15 +6786,15 @@
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInFirst}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInFirst}));
// Only the first window should get the down event
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
// Send down to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT,
+ ui::LogicalDisplayId::DEFAULT,
{pointInFirst, pointInSecond}));
// The first window gets a move and the second a down
firstWindow->consumeMotionMove();
@@ -6722,17 +6802,17 @@
// Send pointer cancel to the second window
NotifyMotionArgs pointerUpMotionArgs =
- generateMotionArgs(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {pointInFirst, pointInSecond});
+ generateMotionArgs(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {pointInFirst, pointInSecond});
pointerUpMotionArgs.flags |= AMOTION_EVENT_FLAG_CANCELED;
mDispatcher->notifyMotion(pointerUpMotionArgs);
// The first window gets move and the second gets cancel.
- firstWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
- secondWindow->consumeMotionCancel(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
+ firstWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
+ secondWindow->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_CANCELED);
// Send up event.
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
// The first window gets up and the second gets nothing.
firstWindow->consumeMotionUp();
secondWindow->assertNoEvents();
@@ -6741,8 +6821,8 @@
TEST_F(InputDispatcherTest, SendTimeline_DoesNotCrashDispatcher) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
std::array<nsecs_t, GraphicsTimeline::SIZE> graphicsTimeline;
graphicsTimeline[GraphicsTimeline::GPU_COMPLETED_TIME] = 2;
@@ -6765,28 +6845,29 @@
*/
TEST_F(InputDispatcherMonitorTest, MonitorTouchIsCanceledWhenForegroundWindowDisappears) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground",
+ ui::LogicalDisplayId::DEFAULT);
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Both the foreground window and the global monitor should receive the touch down
window->consumeMotionDown();
- monitor.consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 200}))
+ ui::LogicalDisplayId::DEFAULT, {110, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionMove();
- monitor.consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionMove(ui::LogicalDisplayId::DEFAULT);
// Now the foreground window goes away
mDispatcher->onWindowInfosChanged({{}, {}, 0, 0});
@@ -6797,41 +6878,47 @@
// cause a cancel for the monitor, as well.
ASSERT_EQ(InputEventInjectionResult::FAILED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {120, 200}))
+ ui::LogicalDisplayId::DEFAULT, {120, 200}))
<< "Injection should fail because the window was removed";
window->assertNoEvents();
// Global monitor now gets the cancel
- monitor.consumeMotionCancel(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionCancel(ui::LogicalDisplayId::DEFAULT);
}
TEST_F(InputDispatcherMonitorTest, ReceivesMotionEvents) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- monitor.consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ monitor.consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
}
TEST_F(InputDispatcherMonitorTest, MonitorCannotPilferPointers) {
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- monitor.consumeMotionDown(ADISPLAY_ID_DEFAULT);
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
// Pilfer pointers from the monitor.
// This should not do anything and the window should continue to receive events.
@@ -6839,27 +6926,30 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT))
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- monitor.consumeMotionMove(ADISPLAY_ID_DEFAULT);
- window->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionMove(ui::LogicalDisplayId::DEFAULT);
+ window->consumeMotionMove(ui::LogicalDisplayId::DEFAULT);
}
TEST_F(InputDispatcherMonitorTest, NoWindowTransform) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
window->setWindowOffset(20, 40);
window->setWindowTransform(0, 1, -1, 0);
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
std::unique_ptr<MotionEvent> event = monitor.consumeMotion();
ASSERT_NE(nullptr, event);
// Even though window has transform, gesture monitor must not.
@@ -6868,10 +6958,12 @@
TEST_F(InputDispatcherMonitorTest, InjectionFailsWithNoWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::FAILED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Injection should fail if there is a monitor, but no touchable window";
monitor.assertNoEvents();
}
@@ -6889,20 +6981,21 @@
*/
TEST_F(InputDispatcherMonitorTest, MonitorTouchIsNotCanceledWhenAnotherEmptyDisplayReceiveEvents) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground",
+ ui::LogicalDisplayId::DEFAULT);
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
FakeMonitorReceiver secondMonitor = FakeMonitorReceiver(*mDispatcher, "M_2", SECOND_DISPLAY_ID);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "The down event injected into the first display should succeed";
window->consumeMotionDown();
- monitor.consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::FAILED,
injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, SECOND_DISPLAY_ID,
@@ -6913,19 +7006,19 @@
// Continue to inject event to first display.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 220}))
+ ui::LogicalDisplayId::DEFAULT, {110, 220}))
<< "The move event injected into the first display should succeed";
window->consumeMotionMove();
- monitor.consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionMove(ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{110, 220}))
<< "The up event injected into the first display should succeed";
window->consumeMotionUp();
- monitor.consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
window->assertNoEvents();
monitor.assertNoEvents();
@@ -6949,24 +7042,25 @@
*/
TEST_F(InputDispatcherMonitorTest, MonitorTouchIsNotCancelWhenAnotherDisplayMonitorTouchCanceled) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground",
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> secondWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "SecondForeground",
SECOND_DISPLAY_ID);
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
FakeMonitorReceiver secondMonitor = FakeMonitorReceiver(*mDispatcher, "M_2", SECOND_DISPLAY_ID);
// There is a foreground window on both displays.
mDispatcher->onWindowInfosChanged({{*window->getInfo(), *secondWindow->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "The down event injected into the first display should succeed";
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- monitor.consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ monitor.consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, SECOND_DISPLAY_ID,
@@ -6994,11 +7088,11 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 200}))
+ ui::LogicalDisplayId::DEFAULT, {110, 200}))
<< "The move event injected into the first display should succeed";
window->consumeMotionMove();
- monitor.consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionMove(ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::FAILED,
injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, SECOND_DISPLAY_ID,
@@ -7007,12 +7101,12 @@
"touchable window";
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{110, 220}))
<< "The up event injected into the first display should succeed";
- window->consumeMotionUp(ADISPLAY_ID_DEFAULT);
- monitor.consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
+ monitor.consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
window->assertNoEvents();
monitor.assertNoEvents();
@@ -7030,22 +7124,23 @@
*/
TEST_F(InputDispatcherMonitorTest, MonitorTouchCancelEventWithDisplayTransform) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground", ADISPLAY_ID_DEFAULT);
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Foreground",
+ ui::LogicalDisplayId::DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
ui::Transform transform;
transform.set({1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 0, 0, 1});
gui::DisplayInfo displayInfo;
- displayInfo.displayId = ADISPLAY_ID_DEFAULT;
+ displayInfo.displayId = ui::LogicalDisplayId::DEFAULT;
displayInfo.transform = transform;
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {displayInfo}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "The down event injected should succeed";
window->consumeMotionDown();
@@ -7055,7 +7150,7 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 220}))
+ ui::LogicalDisplayId::DEFAULT, {110, 220}))
<< "The move event injected should succeed";
window->consumeMotionMove();
@@ -7071,19 +7166,19 @@
ASSERT_EQ(InputEventInjectionResult::FAILED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 220}))
+ ui::LogicalDisplayId::DEFAULT, {110, 220}))
<< "The move event injected should failed";
// Now foreground should not receive any events, but monitor should receive a cancel event
// with transform that same as display's display.
std::unique_ptr<MotionEvent> cancelMotionEvent = monitor.consumeMotion();
EXPECT_EQ(transform, cancelMotionEvent->getTransform());
- EXPECT_EQ(ADISPLAY_ID_DEFAULT, cancelMotionEvent->getDisplayId());
+ EXPECT_EQ(ui::LogicalDisplayId::DEFAULT, cancelMotionEvent->getDisplayId());
EXPECT_EQ(AMOTION_EVENT_ACTION_CANCEL, cancelMotionEvent->getAction());
// Other event inject to this display should fail.
ASSERT_EQ(InputEventInjectionResult::FAILED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 220}))
+ ui::LogicalDisplayId::DEFAULT, {110, 220}))
<< "The up event injected should fail because the touched window was removed";
window->assertNoEvents();
monitor.assertNoEvents();
@@ -7091,18 +7186,19 @@
TEST_F(InputDispatcherTest, TestMoveEvent) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Fake Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
NotifyMotionArgs motionArgs =
generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->notifyMotion(motionArgs);
// Window should receive motion down event.
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
motionArgs.action = AMOTION_EVENT_ACTION_MOVE;
motionArgs.id += 1;
@@ -7111,7 +7207,7 @@
motionArgs.pointerCoords[0].getX() - 10);
mDispatcher->notifyMotion(motionArgs);
- window->consumeMotionMove(ADISPLAY_ID_DEFAULT, /*expectedFlags=*/0);
+ window->consumeMotionMove(ui::LogicalDisplayId::DEFAULT, /*expectedFlags=*/0);
}
/**
@@ -7121,12 +7217,13 @@
*/
TEST_F(InputDispatcherTest, TouchModeState_IsSentToApps) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Test window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Test window",
+ ui::LogicalDisplayId::DEFAULT);
const WindowInfo& windowInfo = *window->getInfo();
// Set focused application.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
window->setFocusable(true);
SCOPED_TRACE("Check default value of touch mode");
@@ -7141,7 +7238,7 @@
SCOPED_TRACE("Disable touch mode");
mDispatcher->setInTouchMode(false, windowInfo.ownerPid, windowInfo.ownerUid,
- /*hasPermission=*/true, ADISPLAY_ID_DEFAULT);
+ /*hasPermission=*/true, ui::LogicalDisplayId::DEFAULT);
window->consumeTouchModeEvent(false);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -7155,7 +7252,7 @@
SCOPED_TRACE("Enable touch mode again");
mDispatcher->setInTouchMode(true, windowInfo.ownerPid, windowInfo.ownerUid,
- /*hasPermission=*/true, ADISPLAY_ID_DEFAULT);
+ /*hasPermission=*/true, ui::LogicalDisplayId::DEFAULT);
window->consumeTouchModeEvent(true);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -7167,10 +7264,11 @@
TEST_F(InputDispatcherTest, VerifyInputEvent_KeyEvent) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Test window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Test window",
+ ui::LogicalDisplayId::DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -7205,23 +7303,24 @@
TEST_F(InputDispatcherTest, VerifyInputEvent_MotionEvent) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Test window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Test window",
+ ui::LogicalDisplayId::DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
ui::Transform transform;
transform.set({1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 0, 0, 1});
gui::DisplayInfo displayInfo;
- displayInfo.displayId = ADISPLAY_ID_DEFAULT;
+ displayInfo.displayId = ui::LogicalDisplayId::DEFAULT;
displayInfo.transform = transform;
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {displayInfo}, 0, 0});
const NotifyMotionArgs motionArgs =
generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mDispatcher->notifyMotion(motionArgs);
std::unique_ptr<MotionEvent> event = window->consumeMotionEvent();
@@ -7308,11 +7407,12 @@
TEST_F(InputDispatcherTest, SetFocusedWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> windowTop =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowTop = sp<FakeWindowHandle>::make(application, mDispatcher, "Top",
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> windowSecond =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Second",
+ ui::LogicalDisplayId::DEFAULT);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
// Top window is also focusable but is not granted focus.
windowTop->setFocusable(true);
@@ -7326,15 +7426,15 @@
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
// Focused window should receive event.
- windowSecond->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ windowSecond->consumeKeyDown(ui::LogicalDisplayId::INVALID);
windowTop->assertNoEvents();
}
TEST_F(InputDispatcherTest, SetFocusedWindow_DropRequestInvalidChannel) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "TestWindow",
+ ui::LogicalDisplayId::DEFAULT);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
window->setFocusable(true);
// Release channel for window is no longer valid.
@@ -7351,10 +7451,10 @@
TEST_F(InputDispatcherTest, SetFocusedWindow_DropRequestNoFocusableWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "TestWindow",
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(false);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
setFocusedWindow(window);
@@ -7368,11 +7468,12 @@
TEST_F(InputDispatcherTest, SetFocusedWindow_CheckFocusedToken) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> windowTop =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowTop = sp<FakeWindowHandle>::make(application, mDispatcher, "Top",
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> windowSecond =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Second",
+ ui::LogicalDisplayId::DEFAULT);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
windowTop->setFocusable(true);
windowSecond->setFocusable(true);
@@ -7391,16 +7492,17 @@
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
// Focused window should receive event.
- windowSecond->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ windowSecond->consumeKeyDown(ui::LogicalDisplayId::INVALID);
}
TEST_F(InputDispatcherTest, SetFocusedWindow_TransferFocusTokenNotFocusable) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> windowTop =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> windowTop = sp<FakeWindowHandle>::make(application, mDispatcher, "Top",
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> windowSecond =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Second",
+ ui::LogicalDisplayId::DEFAULT);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
windowTop->setFocusable(true);
windowSecond->setFocusable(false);
@@ -7414,18 +7516,18 @@
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
// Event should be dropped.
- windowTop->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ windowTop->consumeKeyDown(ui::LogicalDisplayId::INVALID);
windowSecond->assertNoEvents();
}
TEST_F(InputDispatcherTest, SetFocusedWindow_DeferInvisibleWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "TestWindow",
+ ui::LogicalDisplayId::DEFAULT);
sp<FakeWindowHandle> previousFocusedWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "previousFocusedWindow",
- ADISPLAY_ID_DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ ui::LogicalDisplayId::DEFAULT);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
window->setFocusable(true);
previousFocusedWindow->setFocusable(true);
@@ -7442,7 +7544,7 @@
// Injected key goes to pending queue.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
- ADISPLAY_ID_DEFAULT, InputEventInjectionSync::NONE));
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::NONE));
// Window does not get focus event or key down.
window->assertNoEvents();
@@ -7454,14 +7556,14 @@
// Window receives focus event.
window->consumeFocusEvent(true);
// Focused window receives key down.
- window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
}
TEST_F(InputDispatcherTest, DisplayRemoved) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "window", ADISPLAY_ID_DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "window",
+ ui::LogicalDisplayId::DEFAULT);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
// window is granted focus.
window->setFocusable(true);
@@ -7470,7 +7572,7 @@
window->consumeFocusEvent(true);
// When a display is removed window loses focus.
- mDispatcher->displayRemoved(ADISPLAY_ID_DEFAULT);
+ mDispatcher->displayRemoved(ui::LogicalDisplayId::DEFAULT);
window->consumeFocusEvent(false);
}
@@ -7502,10 +7604,11 @@
constexpr gui::Uid SLIPPERY_UID{WINDOW_UID.val() + 1};
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
sp<FakeWindowHandle> slipperyExitWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Top",
+ ui::LogicalDisplayId::DEFAULT);
slipperyExitWindow->setSlippery(true);
// Make sure this one overlaps the bottom window
slipperyExitWindow->setFrame(Rect(25, 25, 75, 75));
@@ -7514,7 +7617,8 @@
slipperyExitWindow->setOwnerInfo(SLIPPERY_PID, SLIPPERY_UID);
sp<FakeWindowHandle> slipperyEnterWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Second",
+ ui::LogicalDisplayId::DEFAULT);
slipperyExitWindow->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged(
@@ -7522,20 +7626,20 @@
// Use notifyMotion instead of injecting to avoid dealing with injection permissions
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {{50, 50}}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {{50, 50}}));
slipperyExitWindow->consumeMotionDown();
slipperyExitWindow->setFrame(Rect(70, 70, 100, 100));
mDispatcher->onWindowInfosChanged(
{{*slipperyExitWindow->getInfo(), *slipperyEnterWindow->getInfo()}, {}, 0, 0});
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_MOVE,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {{51, 51}}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {{51, 51}}));
slipperyExitWindow->consumeMotionCancel();
- slipperyEnterWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT,
+ slipperyEnterWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED);
}
@@ -7550,12 +7654,14 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftSlipperyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftSlipperyWindow->setSlippery(true);
leftSlipperyWindow->setFrame(Rect(0, 0, 100, 100));
sp<FakeWindowHandle> rightDropTouchesWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightDropTouchesWindow->setFrame(Rect(100, 0, 200, 100));
rightDropTouchesWindow->setDropInput(true);
@@ -7586,12 +7692,14 @@
TEST_F(InputDispatcherTest, InjectedTouchSlips) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> originalWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Original", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Original",
+ ui::LogicalDisplayId::DEFAULT);
originalWindow->setFrame(Rect(0, 0, 200, 200));
originalWindow->setSlippery(true);
sp<FakeWindowHandle> appearingWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Appearing", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Appearing",
+ ui::LogicalDisplayId::DEFAULT);
appearingWindow->setFrame(Rect(0, 0, 200, 200));
mDispatcher->onWindowInfosChanged({{*originalWindow->getInfo()}, {}, 0, 0});
@@ -7645,17 +7753,18 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 100, 100));
leftWindow->setSlippery(true);
sp<FakeWindowHandle> rightWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(100, 0, 200, 100));
sp<FakeWindowHandle> spyWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window",
+ ui::LogicalDisplayId::DEFAULT);
spyWindow->setFrame(Rect(200, 0, 300, 100));
spyWindow->setSpy(true);
spyWindow->setTrustedOverlay(true);
@@ -7708,18 +7817,18 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> leftWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Left window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 100, 100));
leftWindow->setSlippery(true);
sp<FakeWindowHandle> middleWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "middle window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
middleWindow->setFrame(Rect(100, 0, 200, 100));
sp<FakeWindowHandle> rightWindow =
sp<FakeWindowHandle>::make(application, mDispatcher, "Right window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(200, 0, 300, 100));
rightWindow->setSlippery(true);
@@ -7778,20 +7887,21 @@
using Uid = gui::Uid;
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> leftWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> leftWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Left",
+ ui::LogicalDisplayId::DEFAULT);
leftWindow->setFrame(Rect(0, 0, 100, 100));
leftWindow->setOwnerInfo(gui::Pid{1}, Uid{101});
sp<FakeWindowHandle> rightSpy =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Right spy",
+ ui::LogicalDisplayId::DEFAULT);
rightSpy->setFrame(Rect(100, 0, 200, 100));
rightSpy->setOwnerInfo(gui::Pid{2}, Uid{102});
rightSpy->setSpy(true);
rightSpy->setTrustedOverlay(true);
- sp<FakeWindowHandle> rightWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> rightWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Right",
+ ui::LogicalDisplayId::DEFAULT);
rightWindow->setFrame(Rect(100, 0, 200, 100));
rightWindow->setOwnerInfo(gui::Pid{3}, Uid{103});
@@ -7856,8 +7966,8 @@
TEST_F(InputDispatcherTest, NotifiesDeviceInteractionsWithKeys) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
window->setOwnerInfo(gui::Pid{1}, gui::Uid{101});
@@ -7866,14 +7976,14 @@
ASSERT_NO_FATAL_FAILURE(window->consumeFocusEvent(true));
mDispatcher->notifyKey(KeyArgsBuilder(ACTION_DOWN, AINPUT_SOURCE_KEYBOARD).build());
- ASSERT_NO_FATAL_FAILURE(window->consumeKeyDown(ADISPLAY_ID_DEFAULT));
+ ASSERT_NO_FATAL_FAILURE(window->consumeKeyDown(ui::LogicalDisplayId::DEFAULT));
mDispatcher->waitForIdle();
ASSERT_NO_FATAL_FAILURE(
mFakePolicy->assertNotifyDeviceInteractionWasCalled(DEVICE_ID, {gui::Uid{101}}));
// The UP actions are not treated as device interaction.
mDispatcher->notifyKey(KeyArgsBuilder(ACTION_UP, AINPUT_SOURCE_KEYBOARD).build());
- ASSERT_NO_FATAL_FAILURE(window->consumeKeyUp(ADISPLAY_ID_DEFAULT));
+ ASSERT_NO_FATAL_FAILURE(window->consumeKeyUp(ui::LogicalDisplayId::DEFAULT));
mDispatcher->waitForIdle();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertNotifyDeviceInteractionWasNotCalled());
}
@@ -7882,13 +7992,14 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> left = sp<FakeWindowHandle>::make(application, mDispatcher, "Left Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
left->setFrame(Rect(0, 0, 100, 100));
- sp<FakeWindowHandle> right = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Right Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> right =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Right Window",
+ ui::LogicalDisplayId::DEFAULT);
right->setFrame(Rect(100, 0, 200, 100));
- sp<FakeWindowHandle> spy =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spy = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window",
+ ui::LogicalDisplayId::DEFAULT);
spy->setFrame(Rect(0, 0, 200, 100));
spy->setTrustedOverlay(true);
spy->setSpy(true);
@@ -7897,8 +8008,9 @@
{{*spy->getInfo(), *left->getInfo(), *right->getInfo()}, {}, 0, 0});
// Send hover move to the left window, and ensure hover enter is synthesized with a new eventId.
- NotifyMotionArgs notifyArgs = generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{50, 50}});
+ NotifyMotionArgs notifyArgs =
+ generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS,
+ ui::LogicalDisplayId::DEFAULT, {PointF{50, 50}});
mDispatcher->notifyMotion(notifyArgs);
std::unique_ptr<MotionEvent> leftEnter = left->consumeMotionEvent(
@@ -7911,8 +8023,8 @@
WithEventIdSource(IdGenerator::Source::INPUT_DISPATCHER)));
// Send move to the right window, and ensure hover exit and enter are synthesized with new ids.
- notifyArgs = generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS, ADISPLAY_ID_DEFAULT,
- {PointF{150, 50}});
+ notifyArgs = generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS,
+ ui::LogicalDisplayId::DEFAULT, {PointF{150, 50}});
mDispatcher->notifyMotion(notifyArgs);
std::unique_ptr<MotionEvent> leftExit = left->consumeMotionEvent(
@@ -7934,8 +8046,8 @@
*/
TEST_F(InputDispatcherMultiDeviceTest, SingleDevicePointerDownEventRetentionWithoutWindowTarget) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -7960,8 +8072,8 @@
*/
TEST_F(InputDispatcherMultiDeviceTest, SecondDeviceDownEventDroppedWithoutWindowTarget) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
@@ -7991,7 +8103,8 @@
mApp = std::make_shared<FakeApplicationHandle>();
- mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
+ mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "Window",
+ ui::LogicalDisplayId::DEFAULT);
mWindow->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo()}, {}, 0, 0});
@@ -8303,7 +8416,8 @@
void setUpWindow() {
mApp = std::make_shared<FakeApplicationHandle>();
- mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
+ mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "Fake Window",
+ ui::LogicalDisplayId::DEFAULT);
mWindow->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo()}, {}, 0, 0});
@@ -8312,13 +8426,14 @@
}
void sendAndConsumeKeyDown(int32_t deviceId) {
- NotifyKeyArgs keyArgs = generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT);
+ NotifyKeyArgs keyArgs =
+ generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT);
keyArgs.deviceId = deviceId;
keyArgs.policyFlags |= POLICY_FLAG_TRUSTED; // Otherwise it won't generate repeat event
mDispatcher->notifyKey(keyArgs);
// Window should receive key down event.
- mWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
}
void expectKeyRepeatOnce(int32_t repeatCount) {
@@ -8328,19 +8443,21 @@
}
void sendAndConsumeKeyUp(int32_t deviceId) {
- NotifyKeyArgs keyArgs = generateKeyArgs(AKEY_EVENT_ACTION_UP, ADISPLAY_ID_DEFAULT);
+ NotifyKeyArgs keyArgs =
+ generateKeyArgs(AKEY_EVENT_ACTION_UP, ui::LogicalDisplayId::DEFAULT);
keyArgs.deviceId = deviceId;
keyArgs.policyFlags |= POLICY_FLAG_TRUSTED; // Unless it won't generate repeat event
mDispatcher->notifyKey(keyArgs);
// Window should receive key down event.
- mWindow->consumeKeyUp(ADISPLAY_ID_DEFAULT,
+ mWindow->consumeKeyUp(ui::LogicalDisplayId::DEFAULT,
/*expectedFlags=*/0);
}
void injectKeyRepeat(int32_t repeatCount) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, repeatCount, ADISPLAY_ID_DEFAULT))
+ injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, repeatCount,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
}
};
@@ -8401,7 +8518,7 @@
sendAndConsumeKeyDown(DEVICE_ID);
expectKeyRepeatOnce(/*repeatCount=*/1);
mDispatcher->notifyDeviceReset({/*id=*/10, /*eventTime=*/20, DEVICE_ID});
- mWindow->consumeKeyUp(ADISPLAY_ID_DEFAULT,
+ mWindow->consumeKeyUp(ui::LogicalDisplayId::DEFAULT,
AKEY_EVENT_FLAG_CANCELED | AKEY_EVENT_FLAG_LONG_PRESS);
mWindow->assertNoEvents();
}
@@ -8433,7 +8550,7 @@
TEST_F(InputDispatcherKeyRepeatTest, FocusedWindow_CorrectRepeatCountWhenInjectKeyRepeat) {
injectKeyRepeat(0);
- mWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
for (int32_t repeatCount = 1; repeatCount <= 2; ++repeatCount) {
expectKeyRepeatOnce(repeatCount);
}
@@ -8449,11 +8566,11 @@
InputDispatcherTest::SetUp();
application1 = std::make_shared<FakeApplicationHandle>();
- windowInPrimary =
- sp<FakeWindowHandle>::make(application1, mDispatcher, "D_1", ADISPLAY_ID_DEFAULT);
+ windowInPrimary = sp<FakeWindowHandle>::make(application1, mDispatcher, "D_1",
+ ui::LogicalDisplayId::DEFAULT);
// Set focus window for primary display, but focused display would be second one.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application1);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application1);
windowInPrimary->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*windowInPrimary->getInfo()}, {}, 0, 0});
@@ -8494,9 +8611,10 @@
TEST_F(InputDispatcherFocusOnTwoDisplaysTest, SetInputWindow_MultiDisplayTouch) {
// Test touch down on primary display.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- windowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ windowInPrimary->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
windowInSecondary->assertNoEvents();
// Test touch down on second display.
@@ -8510,22 +8628,22 @@
TEST_F(InputDispatcherFocusOnTwoDisplaysTest, SetInputWindow_MultiDisplayFocus) {
// Test inject a key down with display id specified.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectKeyDownNoRepeat(*mDispatcher, ADISPLAY_ID_DEFAULT))
+ injectKeyDownNoRepeat(*mDispatcher, ui::LogicalDisplayId::DEFAULT))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- windowInPrimary->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ windowInPrimary->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
windowInSecondary->assertNoEvents();
// Test inject a key down without display id specified.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDownNoRepeat(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
windowInPrimary->assertNoEvents();
- windowInSecondary->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ windowInSecondary->consumeKeyDown(ui::LogicalDisplayId::INVALID);
// Remove all windows in secondary display.
mDispatcher->onWindowInfosChanged({{*windowInPrimary->getInfo()}, {}, 0, 0});
// Old focus should receive a cancel event.
- windowInSecondary->consumeKeyUp(ui::ADISPLAY_ID_NONE, AKEY_EVENT_FLAG_CANCELED);
+ windowInSecondary->consumeKeyUp(ui::LogicalDisplayId::INVALID, AKEY_EVENT_FLAG_CANCELED);
// Test inject a key down, should timeout because of no target window.
ASSERT_NO_FATAL_FAILURE(assertInjectedKeyTimesOut(*mDispatcher));
@@ -8537,16 +8655,17 @@
// Test per-display input monitors for motion event.
TEST_F(InputDispatcherFocusOnTwoDisplaysTest, MonitorMotionEvent_MultiDisplay) {
FakeMonitorReceiver monitorInPrimary =
- FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
FakeMonitorReceiver monitorInSecondary =
FakeMonitorReceiver(*mDispatcher, "M_2", SECOND_DISPLAY_ID);
// Test touch down on primary display.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- windowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- monitorInPrimary.consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ windowInPrimary->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ monitorInPrimary.consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
windowInSecondary->assertNoEvents();
monitorInSecondary.assertNoEvents();
@@ -8570,19 +8689,20 @@
// If specific a display, it will dispatch to the focused window of particular display,
// or it will dispatch to the focused window of focused display.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TRACKBALL, ui::ADISPLAY_ID_NONE))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TRACKBALL,
+ ui::LogicalDisplayId::INVALID))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
windowInPrimary->assertNoEvents();
monitorInPrimary.assertNoEvents();
- windowInSecondary->consumeMotionDown(ui::ADISPLAY_ID_NONE);
- monitorInSecondary.consumeMotionDown(ui::ADISPLAY_ID_NONE);
+ windowInSecondary->consumeMotionDown(ui::LogicalDisplayId::INVALID);
+ monitorInSecondary.consumeMotionDown(ui::LogicalDisplayId::INVALID);
}
// Test per-display input monitors for key event.
TEST_F(InputDispatcherFocusOnTwoDisplaysTest, MonitorKeyEvent_MultiDisplay) {
// Input monitor per display.
FakeMonitorReceiver monitorInPrimary =
- FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
FakeMonitorReceiver monitorInSecondary =
FakeMonitorReceiver(*mDispatcher, "M_2", SECOND_DISPLAY_ID);
@@ -8591,13 +8711,14 @@
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
windowInPrimary->assertNoEvents();
monitorInPrimary.assertNoEvents();
- windowInSecondary->consumeKeyDown(ui::ADISPLAY_ID_NONE);
- monitorInSecondary.consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ windowInSecondary->consumeKeyDown(ui::LogicalDisplayId::INVALID);
+ monitorInSecondary.consumeKeyDown(ui::LogicalDisplayId::INVALID);
}
TEST_F(InputDispatcherFocusOnTwoDisplaysTest, CanFocusWindowOnUnfocusedDisplay) {
sp<FakeWindowHandle> secondWindowInPrimary =
- sp<FakeWindowHandle>::make(application1, mDispatcher, "D_1_W2", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(application1, mDispatcher, "D_1_W2",
+ ui::LogicalDisplayId::DEFAULT);
secondWindowInPrimary->setFocusable(true);
mDispatcher->onWindowInfosChanged(
{{*windowInPrimary->getInfo(), *secondWindowInPrimary->getInfo(),
@@ -8611,25 +8732,26 @@
// Test inject a key down.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectKeyDown(*mDispatcher, ADISPLAY_ID_DEFAULT))
+ injectKeyDown(*mDispatcher, ui::LogicalDisplayId::DEFAULT))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
windowInPrimary->assertNoEvents();
windowInSecondary->assertNoEvents();
- secondWindowInPrimary->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ secondWindowInPrimary->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
}
TEST_F(InputDispatcherFocusOnTwoDisplaysTest, CancelTouch_MultiDisplay) {
FakeMonitorReceiver monitorInPrimary =
- FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
FakeMonitorReceiver monitorInSecondary =
FakeMonitorReceiver(*mDispatcher, "M_2", SECOND_DISPLAY_ID);
// Test touch down on primary display.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- windowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- monitorInPrimary.consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ windowInPrimary->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ monitorInPrimary.consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
// Test touch down on second display.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
@@ -8640,15 +8762,15 @@
// Trigger cancel touch.
mDispatcher->cancelCurrentTouch();
- windowInPrimary->consumeMotionCancel(ADISPLAY_ID_DEFAULT);
- monitorInPrimary.consumeMotionCancel(ADISPLAY_ID_DEFAULT);
+ windowInPrimary->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT);
+ monitorInPrimary.consumeMotionCancel(ui::LogicalDisplayId::DEFAULT);
windowInSecondary->consumeMotionCancel(SECOND_DISPLAY_ID);
monitorInSecondary.consumeMotionCancel(SECOND_DISPLAY_ID);
// Test inject a move motion event, no window/monitor should receive the event.
ASSERT_EQ(InputEventInjectionResult::FAILED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {110, 200}))
+ ui::LogicalDisplayId::DEFAULT, {110, 200}))
<< "Inject motion event should return InputEventInjectionResult::FAILED";
windowInPrimary->assertNoEvents();
monitorInPrimary.assertNoEvents();
@@ -8671,11 +8793,11 @@
// Send a key down on primary display
mDispatcher->notifyKey(
KeyArgsBuilder(AKEY_EVENT_ACTION_DOWN, AINPUT_SOURCE_KEYBOARD)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.policyFlags(DEFAULT_POLICY_FLAGS | POLICY_FLAG_DISABLE_KEY_REPEAT)
.build());
- windowInPrimary->consumeKeyEvent(
- AllOf(WithKeyAction(AKEY_EVENT_ACTION_DOWN), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ windowInPrimary->consumeKeyEvent(AllOf(WithKeyAction(AKEY_EVENT_ACTION_DOWN),
+ WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
windowInSecondary->assertNoEvents();
// Send a key down on second display
@@ -8691,7 +8813,7 @@
// Send a valid key up event on primary display that will be dropped because it is stale
NotifyKeyArgs staleKeyUp =
KeyArgsBuilder(AKEY_EVENT_ACTION_UP, AINPUT_SOURCE_KEYBOARD)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.policyFlags(DEFAULT_POLICY_FLAGS | POLICY_FLAG_DISABLE_KEY_REPEAT)
.build();
static constexpr std::chrono::duration STALE_EVENT_TIMEOUT = 10ms;
@@ -8703,7 +8825,7 @@
// Therefore, windowInPrimary should get the cancel event and windowInSecondary should not
// receive any events.
windowInPrimary->consumeKeyEvent(AllOf(WithKeyAction(AKEY_EVENT_ACTION_UP),
- WithDisplayId(ADISPLAY_ID_DEFAULT),
+ WithDisplayId(ui::LogicalDisplayId::DEFAULT),
WithFlags(AKEY_EVENT_FLAG_CANCELED)));
windowInSecondary->assertNoEvents();
}
@@ -8716,10 +8838,10 @@
mDispatcher->notifyMotion(
MotionArgsBuilder(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(100).y(200))
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.build());
windowInPrimary->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_DOWN), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_DOWN), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
windowInSecondary->assertNoEvents();
// Send touch down on second display.
@@ -8735,7 +8857,7 @@
// inject a valid MotionEvent on primary display that will be stale when it arrives.
NotifyMotionArgs staleMotionUp =
MotionArgsBuilder(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(100).y(200))
.build();
static constexpr std::chrono::duration STALE_EVENT_TIMEOUT = 10ms;
@@ -8790,19 +8912,19 @@
// 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(ui::LogicalDisplayId::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(ui::LogicalDisplayId::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(ui::LogicalDisplayId::DEFAULT, /*expectToBeFiltered=*/false);
testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered=*/false);
}
@@ -8831,7 +8953,7 @@
secondDisplayTransform.set({-6.6, -5.5, -4.4, -3.3, -2.2, -1.1, 0, 0, 1});
std::vector<gui::DisplayInfo> displayInfos(2);
- displayInfos[0].displayId = ADISPLAY_ID_DEFAULT;
+ displayInfos[0].displayId = ui::LogicalDisplayId::DEFAULT;
displayInfos[0].transform = firstDisplayTransform;
displayInfos[1].displayId = SECOND_DISPLAY_ID;
displayInfos[1].transform = secondDisplayTransform;
@@ -8842,7 +8964,8 @@
mDispatcher->setInputFilterEnabled(true);
// Ensure the correct transforms are used for the displays.
- testNotifyMotion(ADISPLAY_ID_DEFAULT, /*expectToBeFiltered=*/true, firstDisplayTransform);
+ testNotifyMotion(ui::LogicalDisplayId::DEFAULT, /*expectToBeFiltered=*/true,
+ firstDisplayTransform);
testNotifyMotion(SECOND_DISPLAY_ID, /*expectToBeFiltered=*/true, secondDisplayTransform);
}
@@ -8861,9 +8984,9 @@
std::shared_ptr<InputApplicationHandle> application =
std::make_shared<FakeApplicationHandle>();
mWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Test Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mWindow->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo()}, {}, 0, 0});
setFocusedWindow(mWindow);
@@ -8876,8 +8999,8 @@
const nsecs_t eventTime = systemTime(SYSTEM_TIME_MONOTONIC);
event.initialize(InputEvent::nextId(), injectedDeviceId, AINPUT_SOURCE_KEYBOARD,
- ui::ADISPLAY_ID_NONE, INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, 0, AKEYCODE_A,
- KEY_A, AMETA_NONE, /*repeatCount=*/0, eventTime, eventTime);
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, 0,
+ AKEYCODE_A, KEY_A, AMETA_NONE, /*repeatCount=*/0, eventTime, eventTime);
const int32_t additionalPolicyFlags =
POLICY_FLAG_PASS_TO_USER | POLICY_FLAG_DISABLE_KEY_REPEAT;
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
@@ -8957,13 +9080,13 @@
std::make_shared<FakeApplicationHandle>();
application->setDispatchingTimeout(100ms);
mWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "TestWindow",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mWindow->setFrame(Rect(0, 0, 100, 100));
mWindow->setDispatchingTimeout(100ms);
mWindow->setFocusable(true);
// Set focused application.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo()}, {}, 0, 0});
setFocusedWindow(mWindow);
@@ -8991,50 +9114,55 @@
mDispatcher->setMinTimeBetweenUserActivityPokes(50ms);
// First event of type TOUCH. Should poke.
- notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(50));
mFakePolicy->assertUserActivityPoked(
- {{milliseconds_to_nanoseconds(50), USER_ACTIVITY_EVENT_TOUCH, ADISPLAY_ID_DEFAULT}});
+ {{milliseconds_to_nanoseconds(50), USER_ACTIVITY_EVENT_TOUCH,
+ ui::LogicalDisplayId::DEFAULT}});
// 80ns > 50ns has passed since previous TOUCH event. Should poke.
- notifyAndConsumeMotion(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(130));
mFakePolicy->assertUserActivityPoked(
- {{milliseconds_to_nanoseconds(130), USER_ACTIVITY_EVENT_TOUCH, ADISPLAY_ID_DEFAULT}});
+ {{milliseconds_to_nanoseconds(130), USER_ACTIVITY_EVENT_TOUCH,
+ ui::LogicalDisplayId::DEFAULT}});
// First event of type OTHER. Should poke (despite being within 50ns of previous TOUCH event).
- notifyAndConsumeMotion(ACTION_SCROLL, AINPUT_SOURCE_ROTARY_ENCODER, ADISPLAY_ID_DEFAULT,
- milliseconds_to_nanoseconds(135));
+ notifyAndConsumeMotion(ACTION_SCROLL, AINPUT_SOURCE_ROTARY_ENCODER,
+ ui::LogicalDisplayId::DEFAULT, milliseconds_to_nanoseconds(135));
mFakePolicy->assertUserActivityPoked(
- {{milliseconds_to_nanoseconds(135), USER_ACTIVITY_EVENT_OTHER, ADISPLAY_ID_DEFAULT}});
+ {{milliseconds_to_nanoseconds(135), USER_ACTIVITY_EVENT_OTHER,
+ ui::LogicalDisplayId::DEFAULT}});
// Within 50ns of previous TOUCH event. Should NOT poke.
- notifyAndConsumeMotion(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(140));
mFakePolicy->assertUserActivityNotPoked();
// Within 50ns of previous OTHER event. Should NOT poke.
- notifyAndConsumeMotion(ACTION_SCROLL, AINPUT_SOURCE_ROTARY_ENCODER, ADISPLAY_ID_DEFAULT,
- milliseconds_to_nanoseconds(150));
+ notifyAndConsumeMotion(ACTION_SCROLL, AINPUT_SOURCE_ROTARY_ENCODER,
+ ui::LogicalDisplayId::DEFAULT, milliseconds_to_nanoseconds(150));
mFakePolicy->assertUserActivityNotPoked();
// Within 50ns of previous TOUCH event (which was at time 130). Should NOT poke.
// Note that STYLUS is mapped to TOUCH user activity, since it's a pointer-type source.
- notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_STYLUS, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_STYLUS, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(160));
mFakePolicy->assertUserActivityNotPoked();
// 65ns > 50ns has passed since previous OTHER event. Should poke.
- notifyAndConsumeMotion(ACTION_SCROLL, AINPUT_SOURCE_ROTARY_ENCODER, ADISPLAY_ID_DEFAULT,
- milliseconds_to_nanoseconds(200));
+ notifyAndConsumeMotion(ACTION_SCROLL, AINPUT_SOURCE_ROTARY_ENCODER,
+ ui::LogicalDisplayId::DEFAULT, milliseconds_to_nanoseconds(200));
mFakePolicy->assertUserActivityPoked(
- {{milliseconds_to_nanoseconds(200), USER_ACTIVITY_EVENT_OTHER, ADISPLAY_ID_DEFAULT}});
+ {{milliseconds_to_nanoseconds(200), USER_ACTIVITY_EVENT_OTHER,
+ ui::LogicalDisplayId::DEFAULT}});
// 170ns > 50ns has passed since previous TOUCH event. Should poke.
- notifyAndConsumeMotion(ACTION_UP, AINPUT_SOURCE_STYLUS, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_UP, AINPUT_SOURCE_STYLUS, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(300));
mFakePolicy->assertUserActivityPoked(
- {{milliseconds_to_nanoseconds(300), USER_ACTIVITY_EVENT_TOUCH, ADISPLAY_ID_DEFAULT}});
+ {{milliseconds_to_nanoseconds(300), USER_ACTIVITY_EVENT_TOUCH,
+ ui::LogicalDisplayId::DEFAULT}});
// Assert that there's no more user activity poke event.
mFakePolicy->assertUserActivityNotPoked();
@@ -9044,19 +9172,21 @@
InputDispatcherUserActivityPokeTests, DefaultMinPokeTimeOf100MsUsed,
REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(com::android::input::flags,
rate_limit_user_activity_poke_in_dispatcher))) {
- notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(200));
mFakePolicy->assertUserActivityPoked(
- {{milliseconds_to_nanoseconds(200), USER_ACTIVITY_EVENT_TOUCH, ADISPLAY_ID_DEFAULT}});
+ {{milliseconds_to_nanoseconds(200), USER_ACTIVITY_EVENT_TOUCH,
+ ui::LogicalDisplayId::DEFAULT}});
- notifyAndConsumeMotion(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(280));
mFakePolicy->assertUserActivityNotPoked();
- notifyAndConsumeMotion(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ notifyAndConsumeMotion(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
milliseconds_to_nanoseconds(340));
mFakePolicy->assertUserActivityPoked(
- {{milliseconds_to_nanoseconds(340), USER_ACTIVITY_EVENT_TOUCH, ADISPLAY_ID_DEFAULT}});
+ {{milliseconds_to_nanoseconds(340), USER_ACTIVITY_EVENT_TOUCH,
+ ui::LogicalDisplayId::DEFAULT}});
}
TEST_F_WITH_FLAGS(
@@ -9065,10 +9195,12 @@
rate_limit_user_activity_poke_in_dispatcher))) {
mDispatcher->setMinTimeBetweenUserActivityPokes(0ms);
- notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT, 20);
+ notifyAndConsumeMotion(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
+ 20);
mFakePolicy->assertUserActivityPoked();
- notifyAndConsumeMotion(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT, 30);
+ notifyAndConsumeMotion(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
+ 30);
mFakePolicy->assertUserActivityPoked();
}
@@ -9078,16 +9210,16 @@
std::shared_ptr<FakeApplicationHandle> application =
std::make_shared<FakeApplicationHandle>();
- mUnfocusedWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
+ mUnfocusedWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Top",
+ ui::LogicalDisplayId::DEFAULT);
mUnfocusedWindow->setFrame(Rect(0, 0, 30, 30));
- mFocusedWindow =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
+ mFocusedWindow = sp<FakeWindowHandle>::make(application, mDispatcher, "Second",
+ ui::LogicalDisplayId::DEFAULT);
mFocusedWindow->setFrame(Rect(50, 50, 100, 100));
// Set focused application.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mFocusedWindow->setFocusable(true);
// Expect one focus window exist in display.
@@ -9115,8 +9247,8 @@
// the onPointerDownOutsideFocus callback.
TEST_F(InputDispatcherOnPointerDownOutsideFocus, OnPointerDownOutsideFocus_Success) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {20, 20}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {20, 20}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
mUnfocusedWindow->consumeMotionDown();
@@ -9129,7 +9261,7 @@
// onPointerDownOutsideFocus callback.
TEST_F(InputDispatcherOnPointerDownOutsideFocus, OnPointerDownOutsideFocus_NonPointerSource) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TRACKBALL, ADISPLAY_ID_DEFAULT,
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TRACKBALL, ui::LogicalDisplayId::DEFAULT,
{20, 20}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
mFocusedWindow->consumeMotionDown();
@@ -9142,9 +9274,9 @@
// have focus. Ensure no window received the onPointerDownOutsideFocus callback.
TEST_F(InputDispatcherOnPointerDownOutsideFocus, OnPointerDownOutsideFocus_NonMotionFailure) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectKeyDownNoRepeat(*mDispatcher, ADISPLAY_ID_DEFAULT))
+ injectKeyDownNoRepeat(*mDispatcher, ui::LogicalDisplayId::DEFAULT))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mFocusedWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mFocusedWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertOnPointerDownWasNotCalled();
@@ -9155,8 +9287,8 @@
// onPointerDownOutsideFocus callback.
TEST_F(InputDispatcherOnPointerDownOutsideFocus, OnPointerDownOutsideFocus_OnAlreadyFocusedWindow) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- FOCUSED_WINDOW_TOUCH_POINT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, FOCUSED_WINDOW_TOUCH_POINT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
mFocusedWindow->consumeMotionDown();
@@ -9175,7 +9307,8 @@
.build();
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectMotionEvent(*mDispatcher, event))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mUnfocusedWindow->consumeAnyMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mUnfocusedWindow->consumeAnyMotionDown(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertOnPointerDownWasNotCalled();
@@ -9192,10 +9325,10 @@
std::shared_ptr<FakeApplicationHandle> application =
std::make_shared<FakeApplicationHandle>();
mWindow1 = sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window 1",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mWindow1->setFrame(Rect(0, 0, 100, 100));
- mWindow2 = mWindow1->clone(ADISPLAY_ID_DEFAULT);
+ mWindow2 = mWindow1->clone(ui::LogicalDisplayId::DEFAULT);
mWindow2->setFrame(Rect(100, 100, 200, 200));
mDispatcher->onWindowInfosChanged({{*mWindow1->getInfo(), *mWindow2->getInfo()}, {}, 0, 0});
@@ -9236,7 +9369,7 @@
const std::vector<PointF>& touchedPoints,
std::vector<PointF> expectedPoints) {
mDispatcher->notifyMotion(generateMotionArgs(action, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, touchedPoints));
+ ui::LogicalDisplayId::DEFAULT, touchedPoints));
consumeMotionEvent(touchedWindow, action, expectedPoints);
}
@@ -9383,14 +9516,14 @@
// Touch down in window 1
mDispatcher->notifyMotion(generateMotionArgs(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {{50, 50}}));
+ ui::LogicalDisplayId::DEFAULT, {{50, 50}}));
consumeMotionEvent(mWindow1, ACTION_DOWN, {{50, 50}});
// Move touch to be above window 2. Even though window 1 is slippery, touch should not slip.
// That means the gesture should continue normally, without any ACTION_CANCEL or ACTION_DOWN
// getting generated.
mDispatcher->notifyMotion(generateMotionArgs(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {{150, 150}}));
+ ui::LogicalDisplayId::DEFAULT, {{150, 150}}));
consumeMotionEvent(mWindow1, ACTION_MOVE, {{150, 150}});
}
@@ -9425,13 +9558,13 @@
mApplication = std::make_shared<FakeApplicationHandle>();
mApplication->setDispatchingTimeout(100ms);
mWindow = sp<FakeWindowHandle>::make(mApplication, mDispatcher, "TestWindow",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mWindow->setFrame(Rect(0, 0, 30, 30));
mWindow->setDispatchingTimeout(100ms);
mWindow->setFocusable(true);
// Set focused application.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApplication);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApplication);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo()}, {}, 0, 0});
setFocusedWindow(mWindow);
@@ -9462,8 +9595,8 @@
}
sp<FakeWindowHandle> addSpyWindow() {
- sp<FakeWindowHandle> spy =
- sp<FakeWindowHandle>::make(mApplication, mDispatcher, "Spy", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spy = sp<FakeWindowHandle>::make(mApplication, mDispatcher, "Spy",
+ ui::LogicalDisplayId::DEFAULT);
spy->setTrustedOverlay(true);
spy->setFocusable(false);
spy->setSpy(true);
@@ -9485,7 +9618,7 @@
// Send a regular key and respond, which should not cause an ANR.
TEST_F(InputDispatcherSingleWindowAnr, WhenKeyIsConsumed_NoAnr) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDownNoRepeat(*mDispatcher));
- mWindow->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::INVALID);
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertNotifyAnrWasNotCalled();
}
@@ -9496,15 +9629,16 @@
mWindow->consumeFocusEvent(false);
InputEventInjectionResult result =
- injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, ADISPLAY_ID_DEFAULT,
- InputEventInjectionSync::NONE, CONSUME_TIMEOUT_EVENT_EXPECTED,
+ injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::NONE,
+ CONSUME_TIMEOUT_EVENT_EXPECTED,
/*allowKeyRepeat=*/false);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, result);
// Key will not go to window because we have no focused window.
// The 'no focused window' ANR timer should start instead.
// Now, the focused application goes away.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, nullptr);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, nullptr);
// The key should get dropped and there should be no ANR.
ASSERT_TRUE(mDispatcher->waitForIdle());
@@ -9516,8 +9650,8 @@
// So InputDispatcher will enqueue ACTION_CANCEL event as well.
TEST_F(InputDispatcherSingleWindowAnr, OnPointerDown_BasicAnr) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- WINDOW_LOCATION));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, WINDOW_LOCATION));
const auto [sequenceNum, _] = mWindow->receiveEvent(); // ACTION_DOWN
ASSERT_TRUE(sequenceNum);
@@ -9526,7 +9660,7 @@
mWindow->finishEvent(*sequenceNum);
mWindow->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertNotifyWindowResponsiveWasCalled(mWindow->getToken(), mWindow->getPid());
}
@@ -9550,8 +9684,8 @@
// taps on the window work as normal
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- WINDOW_LOCATION));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, WINDOW_LOCATION));
ASSERT_NO_FATAL_FAILURE(mWindow->consumeMotionDown());
mDispatcher->waitForIdle();
mFakePolicy->assertNotifyAnrWasNotCalled();
@@ -9560,8 +9694,8 @@
// We specify the injection timeout to be smaller than the application timeout, to ensure that
// injection times out (instead of failing).
const InputEventInjectionResult result =
- injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, ADISPLAY_ID_DEFAULT,
- InputEventInjectionSync::WAIT_FOR_RESULT, 50ms,
+ injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::WAIT_FOR_RESULT, 50ms,
/*allowKeyRepeat=*/false);
ASSERT_EQ(InputEventInjectionResult::TIMED_OUT, result);
const std::chrono::duration timeout = mApplication->getDispatchingTimeout(DISPATCHING_TIMEOUT);
@@ -9585,9 +9719,10 @@
std::chrono::nanoseconds(STALE_EVENT_TIMEOUT).count();
// Define a valid key down event that is stale (too old).
- event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD, ui::ADISPLAY_ID_NONE,
- INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, /*flags=*/0, AKEYCODE_A, KEY_A,
- AMETA_NONE, /*repeatCount=*/0, eventTime, eventTime);
+ event.initialize(InputEvent::nextId(), DEVICE_ID, AINPUT_SOURCE_KEYBOARD,
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC, AKEY_EVENT_ACTION_DOWN,
+ /*flags=*/0, AKEYCODE_A, KEY_A, AMETA_NONE, /*repeatCount=*/0, eventTime,
+ eventTime);
const int32_t policyFlags =
POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER | POLICY_FLAG_DISABLE_KEY_REPEAT;
@@ -9609,7 +9744,7 @@
TEST_F(InputDispatcherSingleWindowAnr, NoFocusedWindow_DoesNotSendDuplicateAnr) {
const std::chrono::duration appTimeout = 400ms;
mApplication->setDispatchingTimeout(appTimeout);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApplication);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApplication);
mWindow->setFocusable(false);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo()}, {}, 0, 0});
@@ -9621,8 +9756,9 @@
const std::chrono::duration eventInjectionTimeout = 100ms;
ASSERT_LT(eventInjectionTimeout, appTimeout);
const InputEventInjectionResult result =
- injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, ADISPLAY_ID_DEFAULT,
- InputEventInjectionSync::WAIT_FOR_RESULT, eventInjectionTimeout,
+ injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::WAIT_FOR_RESULT,
+ eventInjectionTimeout,
/*allowKeyRepeat=*/false);
ASSERT_EQ(InputEventInjectionResult::TIMED_OUT, result)
<< "result=" << ftl::enum_string(result);
@@ -9670,20 +9806,20 @@
TEST_F(InputDispatcherSingleWindowAnr, Anr_HandlesEventsWithIdenticalTimestamps) {
nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, WINDOW_LOCATION,
+ ui::LogicalDisplayId::DEFAULT, WINDOW_LOCATION,
{AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION},
500ms, InputEventInjectionSync::WAIT_FOR_RESULT, currentTime);
// Now send ACTION_UP, with identical timestamp
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, WINDOW_LOCATION,
+ ui::LogicalDisplayId::DEFAULT, WINDOW_LOCATION,
{AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION},
500ms, InputEventInjectionSync::WAIT_FOR_RESULT, currentTime);
// We have now sent down and up. Let's consume first event and then ANR on the second.
- mWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
const std::chrono::duration timeout = mWindow->getDispatchingTimeout(DISPATCHING_TIMEOUT);
mFakePolicy->assertNotifyWindowUnresponsiveWasCalled(timeout, mWindow);
}
@@ -9693,8 +9829,8 @@
sp<FakeWindowHandle> spy = addSpyWindow();
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- WINDOW_LOCATION));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, WINDOW_LOCATION));
mWindow->consumeMotionDown();
const auto [sequenceNum, _] = spy->receiveEvent(); // ACTION_DOWN
@@ -9704,7 +9840,7 @@
spy->finishEvent(*sequenceNum);
spy->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertNotifyWindowResponsiveWasCalled(spy->getToken(), mWindow->getPid());
}
@@ -9715,9 +9851,10 @@
sp<FakeWindowHandle> spy = addSpyWindow();
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectKeyDown(*mDispatcher, ADISPLAY_ID_DEFAULT));
- mWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
- ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyUp(*mDispatcher, ADISPLAY_ID_DEFAULT));
+ injectKeyDown(*mDispatcher, ui::LogicalDisplayId::DEFAULT));
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
+ ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
+ injectKeyUp(*mDispatcher, ui::LogicalDisplayId::DEFAULT));
// Stuck on the ACTION_UP
const std::chrono::duration timeout = mWindow->getDispatchingTimeout(DISPATCHING_TIMEOUT);
@@ -9725,10 +9862,10 @@
// New tap will go to the spy window, but not to the window
tapOnWindow();
- spy->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- spy->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ spy->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ spy->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
- mWindow->consumeKeyUp(ADISPLAY_ID_DEFAULT); // still the previous motion
+ mWindow->consumeKeyUp(ui::LogicalDisplayId::DEFAULT); // still the previous motion
mDispatcher->waitForIdle();
mFakePolicy->assertNotifyWindowResponsiveWasCalled(mWindow->getToken(), mWindow->getPid());
mWindow->assertNoEvents();
@@ -9741,8 +9878,8 @@
sp<FakeWindowHandle> spy = addSpyWindow();
tapOnWindow();
- spy->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- spy->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ spy->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ spy->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
mWindow->consumeMotionDown();
// Stuck on the ACTION_UP
@@ -9751,10 +9888,10 @@
// New tap will go to the spy window, but not to the window
tapOnWindow();
- spy->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- spy->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ spy->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ spy->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
- mWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); // still the previous motion
+ mWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT); // still the previous motion
mDispatcher->waitForIdle();
mFakePolicy->assertNotifyWindowResponsiveWasCalled(mWindow->getToken(), mWindow->getPid());
mWindow->assertNoEvents();
@@ -9764,13 +9901,14 @@
TEST_F(InputDispatcherSingleWindowAnr, UnresponsiveMonitorAnr) {
mDispatcher->setMonitorDispatchingTimeoutForTest(SPY_TIMEOUT);
- FakeMonitorReceiver monitor = FakeMonitorReceiver(*mDispatcher, "M_1", ADISPLAY_ID_DEFAULT);
+ FakeMonitorReceiver monitor =
+ FakeMonitorReceiver(*mDispatcher, "M_1", ui::LogicalDisplayId::DEFAULT);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- WINDOW_LOCATION));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, WINDOW_LOCATION));
- mWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
const std::optional<uint32_t> consumeSeq = monitor.receiveEvent();
ASSERT_TRUE(consumeSeq);
@@ -9778,7 +9916,7 @@
MONITOR_PID);
monitor.finishEvent(*consumeSeq);
- monitor.consumeMotionCancel(ADISPLAY_ID_DEFAULT);
+ monitor.consumeMotionCancel(ui::LogicalDisplayId::DEFAULT);
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertNotifyWindowResponsiveWasCalled(monitor.getToken(), MONITOR_PID);
@@ -9817,8 +9955,8 @@
// it.
TEST_F(InputDispatcherSingleWindowAnr, Policy_DoesNotGetDuplicateAnr) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- WINDOW_LOCATION));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, WINDOW_LOCATION));
const std::chrono::duration windowTimeout = mWindow->getDispatchingTimeout(DISPATCHING_TIMEOUT);
mFakePolicy->assertNotifyWindowUnresponsiveWasCalled(windowTimeout, mWindow);
@@ -9828,7 +9966,7 @@
// When the ANR happened, dispatcher should abort the current event stream via ACTION_CANCEL
mWindow->consumeMotionDown();
mWindow->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
mWindow->assertNoEvents();
mDispatcher->waitForIdle();
mFakePolicy->assertNotifyWindowResponsiveWasCalled(mWindow->getToken(), mWindow->getPid());
@@ -9865,7 +10003,7 @@
std::this_thread::sleep_for(400ms);
// if we wait long enough though, dispatcher will give up, and still send the key
// to the focused window, even though we have not yet finished the motion event
- mWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
mWindow->finishEvent(*downSequenceNum);
mWindow->finishEvent(*upSequenceNum);
}
@@ -9969,8 +10107,8 @@
// So InputDispatcher will enqueue ACTION_CANCEL event as well.
TEST_F(InputDispatcherSingleWindowAnr, AnrAfterWindowRemoval) {
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {WINDOW_LOCATION}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {WINDOW_LOCATION}));
const auto [sequenceNum, _] = mWindow->receiveEvent(); // ACTION_DOWN
ASSERT_TRUE(sequenceNum);
@@ -9987,7 +10125,7 @@
mWindow->finishEvent(*sequenceNum);
// The cancellation was generated when the window was removed, along with the focus event.
mWindow->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
mWindow->consumeFocusEvent(false);
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertNotifyWindowResponsiveWasCalled(mWindow->getToken(), /*pid=*/std::nullopt);
@@ -9997,8 +10135,8 @@
// notified of the unresponsive window, then remove the app window.
TEST_F(InputDispatcherSingleWindowAnr, AnrFollowedByWindowRemoval) {
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {WINDOW_LOCATION}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {WINDOW_LOCATION}));
const auto [sequenceNum, _] = mWindow->receiveEvent(); // ACTION_DOWN
ASSERT_TRUE(sequenceNum);
@@ -10011,7 +10149,7 @@
mWindow->finishEvent(*sequenceNum);
// The cancellation was generated during the ANR, and the window lost focus when it was removed.
mWindow->consumeMotionEvent(
- AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ADISPLAY_ID_DEFAULT)));
+ AllOf(WithMotionAction(ACTION_CANCEL), WithDisplayId(ui::LogicalDisplayId::DEFAULT)));
mWindow->consumeFocusEvent(false);
ASSERT_TRUE(mDispatcher->waitForIdle());
// Since the window was removed, Dispatcher does not know the PID associated with the window
@@ -10026,18 +10164,18 @@
mApplication = std::make_shared<FakeApplicationHandle>();
mApplication->setDispatchingTimeout(100ms);
mUnfocusedWindow = sp<FakeWindowHandle>::make(mApplication, mDispatcher, "Unfocused",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mUnfocusedWindow->setFrame(Rect(0, 0, 30, 30));
// Adding FLAG_WATCH_OUTSIDE_TOUCH to receive ACTION_OUTSIDE when another window is tapped
mUnfocusedWindow->setWatchOutsideTouch(true);
mFocusedWindow = sp<FakeWindowHandle>::make(mApplication, mDispatcher, "Focused",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mFocusedWindow->setDispatchingTimeout(100ms);
mFocusedWindow->setFrame(Rect(50, 50, 100, 100));
// Set focused application.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApplication);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApplication);
mFocusedWindow->setFocusable(true);
// Expect one focus window exist in display.
@@ -10069,11 +10207,11 @@
private:
void tap(const PointF& location) {
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- location));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, location));
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- location));
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, location));
}
};
@@ -10098,7 +10236,7 @@
.build()));
mFocusedWindow->consumeMotionDown();
mFocusedWindow->consumeMotionUp();
- mUnfocusedWindow->consumeMotionOutside(ADISPLAY_ID_DEFAULT, /*flags=*/0);
+ mUnfocusedWindow->consumeMotionOutside(ui::LogicalDisplayId::DEFAULT, /*flags=*/0);
// We consumed all events, so no ANR
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertNotifyAnrWasNotCalled();
@@ -10174,7 +10312,7 @@
// At the same time, FLAG_WATCH_OUTSIDE_TOUCH targets should not receive any events.
TEST_F(InputDispatcherMultiWindowAnr, DuringAnr_SecondTapIsIgnored) {
tapOnFocusedWindow();
- mUnfocusedWindow->consumeMotionOutside(ADISPLAY_ID_DEFAULT, /*flags=*/0);
+ mUnfocusedWindow->consumeMotionOutside(ui::LogicalDisplayId::DEFAULT, /*flags=*/0);
// Receive the events, but don't respond
const auto [downEventSequenceNum, downEvent] = mFocusedWindow->receiveEvent(); // ACTION_DOWN
ASSERT_TRUE(downEventSequenceNum);
@@ -10187,10 +10325,10 @@
// Tap once again
// We cannot use "tapOnFocusedWindow" because it asserts the injection result to be success
ASSERT_EQ(InputEventInjectionResult::FAILED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- FOCUSED_WINDOW_LOCATION));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, FOCUSED_WINDOW_LOCATION));
ASSERT_EQ(InputEventInjectionResult::FAILED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
FOCUSED_WINDOW_LOCATION));
// Unfocused window does not receive ACTION_OUTSIDE because the tapped window is not a
// valid touch target
@@ -10211,8 +10349,8 @@
// If you tap outside of all windows, there will not be ANR
TEST_F(InputDispatcherMultiWindowAnr, TapOutsideAllWindows_DoesNotAnr) {
ASSERT_EQ(InputEventInjectionResult::FAILED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- LOCATION_OUTSIDE_ALL_WINDOWS));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, LOCATION_OUTSIDE_ALL_WINDOWS));
ASSERT_TRUE(mDispatcher->waitForIdle());
mFakePolicy->assertNotifyAnrWasNotCalled();
}
@@ -10224,8 +10362,8 @@
{{*mUnfocusedWindow->getInfo(), *mFocusedWindow->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::FAILED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- FOCUSED_WINDOW_LOCATION));
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, FOCUSED_WINDOW_LOCATION));
std::this_thread::sleep_for(mFocusedWindow->getDispatchingTimeout(DISPATCHING_TIMEOUT));
ASSERT_TRUE(mDispatcher->waitForIdle());
@@ -10265,8 +10403,8 @@
// window even if motions are still being processed.
InputEventInjectionResult result =
- injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, ADISPLAY_ID_DEFAULT,
- InputEventInjectionSync::NONE,
+ injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::NONE,
/*injectionTimeout=*/100ms);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, result);
// Key will not be sent to the window, yet, because the window is still processing events
@@ -10293,7 +10431,7 @@
// Now that all queues are cleared and no backlog in the connections, the key event
// can finally go to the newly focused "mUnfocusedWindow".
- mUnfocusedWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mUnfocusedWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
mFocusedWindow->assertNoEvents();
mUnfocusedWindow->assertNoEvents();
mFakePolicy->assertNotifyAnrWasNotCalled();
@@ -10304,14 +10442,15 @@
// The other window should not be affected by that.
TEST_F(InputDispatcherMultiWindowAnr, SplitTouch_SingleWindowAnr) {
// Touch Window 1
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {FOCUSED_WINDOW_LOCATION}));
- mUnfocusedWindow->consumeMotionOutside(ADISPLAY_ID_DEFAULT, /*flags=*/0);
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {FOCUSED_WINDOW_LOCATION}));
+ mUnfocusedWindow->consumeMotionOutside(ui::LogicalDisplayId::DEFAULT, /*flags=*/0);
// Touch Window 2
mDispatcher->notifyMotion(
- generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ generateMotionArgs(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT,
{FOCUSED_WINDOW_LOCATION, UNFOCUSED_WINDOW_LOCATION}));
const std::chrono::duration timeout =
@@ -10357,7 +10496,7 @@
std::shared_ptr<FakeApplicationHandle> focusedApplication =
std::make_shared<FakeApplicationHandle>();
focusedApplication->setDispatchingTimeout(300ms);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, focusedApplication);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, focusedApplication);
// The application that owns 'mFocusedWindow' and 'mUnfocusedWindow' is not focused.
mFocusedWindow->setFocusable(false);
@@ -10369,8 +10508,8 @@
// 'focusedApplication' will get blamed if this timer completes.
// Key will not be sent anywhere because we have no focused window. It will remain pending.
InputEventInjectionResult result =
- injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, ADISPLAY_ID_DEFAULT,
- InputEventInjectionSync::NONE,
+ injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::NONE,
/*injectionTimeout=*/100ms,
/*allowKeyRepeat=*/false);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, result);
@@ -10385,9 +10524,9 @@
std::this_thread::sleep_for(100ms);
// Touch unfocused window. This should force the pending key to get dropped.
- mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {UNFOCUSED_WINDOW_LOCATION}));
+ mDispatcher->notifyMotion(
+ generateMotionArgs(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {UNFOCUSED_WINDOW_LOCATION}));
// We do not consume the motion right away, because that would require dispatcher to first
// process (== drop) the key event, and by that time, ANR will be raised.
@@ -10440,20 +10579,20 @@
mFakePolicy->setStaleEventTimeout(3000ms);
sp<FakeWindowHandle> navigationBar =
sp<FakeWindowHandle>::make(systemUiApplication, mDispatcher, "NavigationBar",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
navigationBar->setFocusable(false);
navigationBar->setWatchOutsideTouch(true);
navigationBar->setFrame(Rect(0, 0, 100, 100));
mApplication->setDispatchingTimeout(3000ms);
// 'mApplication' is already focused, but we call it again here to make it explicit.
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApplication);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApplication);
std::shared_ptr<FakeApplicationHandle> anotherApplication =
std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> appWindow =
sp<FakeWindowHandle>::make(anotherApplication, mDispatcher, "Another window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
appWindow->setFocusable(false);
appWindow->setFrame(Rect(100, 100, 200, 200));
@@ -10472,8 +10611,8 @@
// Key will not be sent anywhere because we have no focused window. It will remain pending.
// Pretend we are injecting KEYCODE_BACK, but it doesn't actually matter what key it is.
InputEventInjectionResult result =
- injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0, ADISPLAY_ID_DEFAULT,
- InputEventInjectionSync::NONE,
+ injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::NONE,
/*injectionTimeout=*/100ms,
/*allowKeyRepeat=*/false);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, result);
@@ -10482,8 +10621,8 @@
mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN)
.pointer(PointerBuilder(0, ToolType::FINGER).x(50).y(50))
.build());
- result = injectKey(*mDispatcher, AKEY_EVENT_ACTION_UP, /*repeatCount=*/0, ADISPLAY_ID_DEFAULT,
- InputEventInjectionSync::NONE,
+ result = injectKey(*mDispatcher, AKEY_EVENT_ACTION_UP, /*repeatCount=*/0,
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::NONE,
/*injectionTimeout=*/100ms,
/*allowKeyRepeat=*/false);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, result);
@@ -10519,16 +10658,16 @@
InputDispatcherTest::SetUp();
mApplication = std::make_shared<FakeApplicationHandle>();
- mNoInputWindow =
- sp<FakeWindowHandle>::make(mApplication, mDispatcher,
- "Window without input channel", ADISPLAY_ID_DEFAULT,
- /*createInputChannel=*/false);
+ mNoInputWindow = sp<FakeWindowHandle>::make(mApplication, mDispatcher,
+ "Window without input channel",
+ ui::LogicalDisplayId::DEFAULT,
+ /*createInputChannel=*/false);
mNoInputWindow->setNoInputChannel(true);
mNoInputWindow->setFrame(Rect(0, 0, 100, 100));
// It's perfectly valid for this window to not have an associated input channel
mBottomWindow = sp<FakeWindowHandle>::make(mApplication, mDispatcher, "Bottom window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mBottomWindow->setFrame(Rect(0, 0, 100, 100));
mDispatcher->onWindowInfosChanged(
@@ -10545,8 +10684,8 @@
PointF touchedPoint = {10, 10};
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {touchedPoint}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {touchedPoint}));
mNoInputWindow->assertNoEvents();
// Even though the window 'mNoInputWindow' positioned above 'mBottomWindow' does not have
@@ -10563,7 +10702,7 @@
NoInputChannelFeature_DropsTouchesWithValidChannel) {
mNoInputWindow = sp<FakeWindowHandle>::make(mApplication, mDispatcher,
"Window with input channel and NO_INPUT_CHANNEL",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
mNoInputWindow->setNoInputChannel(true);
mNoInputWindow->setFrame(Rect(0, 0, 100, 100));
@@ -10573,8 +10712,8 @@
PointF touchedPoint = {10, 10};
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {touchedPoint}));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {touchedPoint}));
mNoInputWindow->assertNoEvents();
mBottomWindow->assertNoEvents();
@@ -10589,9 +10728,10 @@
virtual void SetUp() override {
InputDispatcherTest::SetUp();
mApp = std::make_shared<FakeApplicationHandle>();
- mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
- mMirror = mWindow->clone(ADISPLAY_ID_DEFAULT);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApp);
+ mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow",
+ ui::LogicalDisplayId::DEFAULT);
+ mMirror = mWindow->clone(ui::LogicalDisplayId::DEFAULT);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApp);
mWindow->setFocusable(true);
mMirror->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo(), *mMirror->getInfo()}, {}, 0, 0});
@@ -10606,7 +10746,7 @@
mWindow->consumeFocusEvent(true);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::INVALID);
}
// A focused & mirrored window remains focused only if the window and its mirror are both
@@ -10618,10 +10758,10 @@
mWindow->consumeFocusEvent(true);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::INVALID);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyUp(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyUp(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyUp(ui::LogicalDisplayId::INVALID);
mMirror->setFocusable(false);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo(), *mMirror->getInfo()}, {}, 0, 0});
@@ -10643,20 +10783,20 @@
mWindow->consumeFocusEvent(true);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::INVALID);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyUp(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyUp(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyUp(ui::LogicalDisplayId::INVALID);
mMirror->setVisible(false);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo(), *mMirror->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::INVALID);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyUp(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyUp(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyUp(ui::LogicalDisplayId::INVALID);
mWindow->setVisible(false);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo(), *mMirror->getInfo()}, {}, 0, 0});
@@ -10677,20 +10817,20 @@
mWindow->consumeFocusEvent(true);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::INVALID);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyUp(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyUp(ui::ADISPLAY_ID_NONE);
+ mWindow->consumeKeyUp(ui::LogicalDisplayId::INVALID);
// single window is removed but the window token remains focused
mDispatcher->onWindowInfosChanged({{*mMirror->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mMirror->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ mMirror->consumeKeyDown(ui::LogicalDisplayId::INVALID);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyUp(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mMirror->consumeKeyUp(ui::ADISPLAY_ID_NONE);
+ mMirror->consumeKeyUp(ui::LogicalDisplayId::INVALID);
// Both windows are removed
mDispatcher->onWindowInfosChanged({{}, {}, 0, 0});
@@ -10712,7 +10852,7 @@
// Injected key goes to pending queue.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
- ADISPLAY_ID_DEFAULT, InputEventInjectionSync::NONE));
+ ui::LogicalDisplayId::DEFAULT, InputEventInjectionSync::NONE));
mMirror->setVisible(true);
mDispatcher->onWindowInfosChanged({{*mWindow->getInfo(), *mMirror->getInfo()}, {}, 0, 0});
@@ -10720,7 +10860,7 @@
// window gets focused
mWindow->consumeFocusEvent(true);
// window gets the pending key event
- mWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
}
class InputDispatcherPointerCaptureTests : public InputDispatcherTest {
@@ -10732,13 +10872,14 @@
void SetUp() override {
InputDispatcherTest::SetUp();
mApp = std::make_shared<FakeApplicationHandle>();
- mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
+ mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow",
+ ui::LogicalDisplayId::DEFAULT);
mWindow->setFocusable(true);
- mSecondWindow =
- sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow2", ADISPLAY_ID_DEFAULT);
+ mSecondWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow2",
+ ui::LogicalDisplayId::DEFAULT);
mSecondWindow->setFocusable(true);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApp);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApp);
mDispatcher->onWindowInfosChanged(
{{*mWindow->getInfo(), *mSecondWindow->getInfo()}, {}, 0, 0});
@@ -10977,7 +11118,7 @@
sp<FakeWindowHandle> getWindow(gui::Uid uid, std::string name) {
std::shared_ptr<FakeApplicationHandle> app = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> window =
- sp<FakeWindowHandle>::make(app, mDispatcher, name, ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle>::make(app, mDispatcher, name, ui::LogicalDisplayId::DEFAULT);
// Generate an arbitrary PID based on the UID
window->setOwnerInfo(gui::Pid{static_cast<pid_t>(1777 + (uid.val() % 10000))}, uid);
return window;
@@ -10985,8 +11126,8 @@
void touch(const std::vector<PointF>& points = {PointF{100, 200}}) {
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- points));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, points));
}
};
@@ -11351,20 +11492,21 @@
void SetUp() override {
InputDispatcherTest::SetUp();
mApp = std::make_shared<FakeApplicationHandle>();
- mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
+ mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow",
+ ui::LogicalDisplayId::DEFAULT);
mWindow->setFrame(Rect(0, 0, 100, 100));
- mSecondWindow =
- sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow2", ADISPLAY_ID_DEFAULT);
+ mSecondWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow2",
+ ui::LogicalDisplayId::DEFAULT);
mSecondWindow->setFrame(Rect(100, 0, 200, 100));
- mSpyWindow =
- sp<FakeWindowHandle>::make(mApp, mDispatcher, "SpyWindow", ADISPLAY_ID_DEFAULT);
+ mSpyWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "SpyWindow",
+ ui::LogicalDisplayId::DEFAULT);
mSpyWindow->setSpy(true);
mSpyWindow->setTrustedOverlay(true);
mSpyWindow->setFrame(Rect(0, 0, 200, 100));
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApp);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApp);
mDispatcher->onWindowInfosChanged(
{{*mSpyWindow->getInfo(), *mWindow->getInfo(), *mSecondWindow->getInfo()},
{},
@@ -11377,7 +11519,7 @@
case AINPUT_SOURCE_TOUCHSCREEN:
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {50, 50}))
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
break;
case AINPUT_SOURCE_STYLUS:
@@ -11409,9 +11551,9 @@
}
// Window should receive motion event.
- mWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
// Spy window should also receive motion event
- mSpyWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ mSpyWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
}
// Start performing drag, we will create a drag window and transfer touch to it.
@@ -11423,8 +11565,8 @@
}
// The drag window covers the entire display
- mDragWindow =
- sp<FakeWindowHandle>::make(mApp, mDispatcher, "DragWindow", ADISPLAY_ID_DEFAULT);
+ mDragWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "DragWindow",
+ ui::LogicalDisplayId::DEFAULT);
mDragWindow->setTouchableRegion(Region{{0, 0, 0, 0}});
mDispatcher->onWindowInfosChanged({{*mDragWindow->getInfo(), *mSpyWindow->getInfo(),
*mWindow->getInfo(), *mSecondWindow->getInfo()},
@@ -11438,7 +11580,8 @@
/*isDragDrop=*/true);
if (transferred) {
mWindow->consumeMotionCancel();
- mDragWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
return transferred;
}
@@ -11450,35 +11593,38 @@
// Move on window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {50, 50}))
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
// Move to another window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {150, 50}))
+ ui::LogicalDisplayId::DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
// Move back to original window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {50, 50}))
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->consumeDragEvent(true, -50, 50);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
}
@@ -11513,27 +11659,29 @@
// Move on window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {50, 50}))
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
// Move to another window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {150, 50}))
+ ui::LogicalDisplayId::DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
// drop to another window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -11595,7 +11743,8 @@
.pointer(PointerBuilder(0, ToolType::STYLUS).x(50).y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -11607,7 +11756,8 @@
.pointer(PointerBuilder(0, ToolType::STYLUS).x(150).y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
@@ -11620,7 +11770,7 @@
.pointer(PointerBuilder(0, ToolType::STYLUS).x(150).y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
}
@@ -11636,27 +11786,29 @@
// Move on window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {50, 50}))
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
// Move to another window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {150, 50}))
+ ui::LogicalDisplayId::DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->assertNoEvents();
// drop to another window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, nullptr);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -11667,14 +11819,14 @@
mWindow->setPreventSplitting(true);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(50).y(50))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(75).y(50))
@@ -11692,16 +11844,16 @@
TEST_F(InputDispatcherDragTests, DragAndDropWhenSplitTouch) {
// First down on second window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {150, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mSecondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ mSecondWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
// Second down on first window.
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(150).y(50))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(50).y(50))
@@ -11710,8 +11862,8 @@
injectMotionEvent(*mDispatcher, secondFingerDownEvent, INJECT_EVENT_TIMEOUT,
InputEventInjectionSync::WAIT_FOR_RESULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- mSecondWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ mSecondWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT);
// Perform drag and drop from first window.
ASSERT_TRUE(startDrag(false));
@@ -11726,7 +11878,8 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, secondFingerMoveEvent, INJECT_EVENT_TIMEOUT,
InputEventInjectionSync::WAIT_FOR_RESULT));
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->consumeMotionMove();
@@ -11740,7 +11893,7 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, secondFingerUpEvent, INJECT_EVENT_TIMEOUT,
InputEventInjectionSync::WAIT_FOR_RESULT));
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->consumeMotionMove();
@@ -11779,27 +11932,29 @@
// Move on window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {50, 50}))
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
// Move to another window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {150, 50}))
+ ui::LogicalDisplayId::DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
// drop to another window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -11817,7 +11972,8 @@
.y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -11831,7 +11987,8 @@
.y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionMove(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
@@ -11845,7 +12002,7 @@
.y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ mDragWindow->consumeMotionUp(ui::LogicalDisplayId::DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -11858,8 +12015,8 @@
TEST_F(InputDispatcherDragTests, DragAndDropFinishedWhenCancelCurrentTouch) {
// Down on second window
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {150, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
ASSERT_NO_FATAL_FAILURE(mSecondWindow->consumeMotionDown());
@@ -11868,7 +12025,7 @@
// Down on first window
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(150).y(50))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(50).y(50))
.build();
@@ -11886,7 +12043,7 @@
// Trigger cancel
mDispatcher->cancelCurrentTouch();
ASSERT_NO_FATAL_FAILURE(mSecondWindow->consumeMotionCancel());
- ASSERT_NO_FATAL_FAILURE(mDragWindow->consumeMotionCancel(ADISPLAY_ID_DEFAULT,
+ ASSERT_NO_FATAL_FAILURE(mDragWindow->consumeMotionCancel(ui::LogicalDisplayId::DEFAULT,
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE));
ASSERT_NO_FATAL_FAILURE(mSpyWindow->consumeMotionCancel());
@@ -11899,14 +12056,14 @@
// Inject a simple gesture, ensure dispatcher not crashed
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- PointF{50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, PointF{50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
ASSERT_NO_FATAL_FAILURE(mWindow->consumeMotionDown());
const MotionEvent moveEvent =
MotionEventBuilder(AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(50).y(50))
.build();
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
@@ -11916,7 +12073,7 @@
ASSERT_NO_FATAL_FAILURE(mWindow->consumeMotionMove());
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
{50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
ASSERT_NO_FATAL_FAILURE(mWindow->consumeMotionUp());
@@ -11926,7 +12083,7 @@
// Start hovering over the window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, ACTION_HOVER_ENTER, AINPUT_SOURCE_MOUSE,
- ADISPLAY_ID_DEFAULT, {50, 50}));
+ ui::LogicalDisplayId::DEFAULT, {50, 50}));
ASSERT_NO_FATAL_FAILURE(mWindow->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER)));
ASSERT_NO_FATAL_FAILURE(mSpyWindow->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER)));
@@ -11939,23 +12096,25 @@
TEST_F(InputDispatcherDropInputFeatureTest, WindowDropsInput) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Test window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Test window",
+ ui::LogicalDisplayId::DEFAULT);
window->setDropInput(true);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
setFocusedWindow(window);
window->consumeFocusEvent(/*hasFocus=*/true, /*inTouchMode=*/true);
// With the flag set, window should not get any input
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
window->assertNoEvents();
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
mDispatcher->waitForIdle();
window->assertNoEvents();
@@ -11963,12 +12122,13 @@
window->setDropInput(false);
mDispatcher->onWindowInfosChanged({{*window->getInfo()}, {}, 0, 0});
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ADISPLAY_ID_DEFAULT));
- window->consumeKeyUp(ADISPLAY_ID_DEFAULT);
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ui::LogicalDisplayId::DEFAULT));
+ window->consumeKeyUp(ui::LogicalDisplayId::DEFAULT);
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
window->assertNoEvents();
}
@@ -11977,16 +12137,17 @@
std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> obscuringWindow =
sp<FakeWindowHandle>::make(obscuringApplication, mDispatcher, "obscuringWindow",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
obscuringWindow->setFrame(Rect(0, 0, 50, 50));
obscuringWindow->setOwnerInfo(gui::Pid{111}, gui::Uid{111});
obscuringWindow->setTouchable(false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Test window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Test window",
+ ui::LogicalDisplayId::DEFAULT);
window->setDropInputIfObscured(true);
window->setOwnerInfo(gui::Pid{222}, gui::Uid{222});
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged(
{{*obscuringWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
@@ -11994,13 +12155,14 @@
window->consumeFocusEvent(/*hasFocus=*/true, /*inTouchMode=*/true);
// With the flag set, window should not get any input
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
window->assertNoEvents();
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
window->assertNoEvents();
// With the flag cleared, the window should get input
@@ -12008,12 +12170,14 @@
mDispatcher->onWindowInfosChanged(
{{*obscuringWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ADISPLAY_ID_DEFAULT));
- window->consumeKeyUp(ADISPLAY_ID_DEFAULT);
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ui::LogicalDisplayId::DEFAULT));
+ window->consumeKeyUp(ui::LogicalDisplayId::DEFAULT);
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED);
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED);
window->assertNoEvents();
}
@@ -12022,16 +12186,17 @@
std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> obscuringWindow =
sp<FakeWindowHandle>::make(obscuringApplication, mDispatcher, "obscuringWindow",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
obscuringWindow->setFrame(Rect(0, 0, 50, 50));
obscuringWindow->setOwnerInfo(gui::Pid{111}, gui::Uid{111});
obscuringWindow->setTouchable(false);
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Test window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Test window",
+ ui::LogicalDisplayId::DEFAULT);
window->setDropInputIfObscured(true);
window->setOwnerInfo(gui::Pid{222}, gui::Uid{222});
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
window->setFocusable(true);
mDispatcher->onWindowInfosChanged(
{{*obscuringWindow->getInfo(), *window->getInfo()}, {}, 0, 0});
@@ -12039,25 +12204,27 @@
window->consumeFocusEvent(/*hasFocus=*/true, /*inTouchMode=*/true);
// With the flag set, window should not get any input
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT));
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ui::LogicalDisplayId::DEFAULT));
window->assertNoEvents();
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
window->assertNoEvents();
// When the window is no longer obscured because it went on top, it should get input
mDispatcher->onWindowInfosChanged(
{{*window->getInfo(), *obscuringWindow->getInfo()}, {}, 0, 0});
- mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ADISPLAY_ID_DEFAULT));
- window->consumeKeyUp(ADISPLAY_ID_DEFAULT);
+ mDispatcher->notifyKey(generateKeyArgs(AKEY_EVENT_ACTION_UP, ui::LogicalDisplayId::DEFAULT));
+ window->consumeKeyUp(ui::LogicalDisplayId::DEFAULT);
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
- AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT));
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT));
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
window->assertNoEvents();
}
@@ -12074,18 +12241,19 @@
mApp = std::make_shared<FakeApplicationHandle>();
mSecondaryApp = std::make_shared<FakeApplicationHandle>();
- mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
+ mWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow",
+ ui::LogicalDisplayId::DEFAULT);
mWindow->setFocusable(true);
setFocusedWindow(mWindow);
- mSecondWindow =
- sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow2", ADISPLAY_ID_DEFAULT);
+ mSecondWindow = sp<FakeWindowHandle>::make(mApp, mDispatcher, "TestWindow2",
+ ui::LogicalDisplayId::DEFAULT);
mSecondWindow->setFocusable(true);
mThirdWindow =
sp<FakeWindowHandle>::make(mSecondaryApp, mDispatcher,
"TestWindow3_SecondaryDisplay", SECOND_DISPLAY_ID);
mThirdWindow->setFocusable(true);
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApp);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, mApp);
mDispatcher->onWindowInfosChanged(
{{*mWindow->getInfo(), *mSecondWindow->getInfo(), *mThirdWindow->getInfo()},
{},
@@ -12096,7 +12264,8 @@
// Set main display initial touch mode to InputDispatcher::kDefaultInTouchMode.
if (mDispatcher->setInTouchMode(InputDispatcher::kDefaultInTouchMode, WINDOW_PID,
- WINDOW_UID, /*hasPermission=*/true, ADISPLAY_ID_DEFAULT)) {
+ WINDOW_UID, /*hasPermission=*/true,
+ ui::LogicalDisplayId::DEFAULT)) {
mWindow->consumeTouchModeEvent(InputDispatcher::kDefaultInTouchMode);
mSecondWindow->consumeTouchModeEvent(InputDispatcher::kDefaultInTouchMode);
mThirdWindow->assertNoEvents();
@@ -12115,7 +12284,7 @@
void changeAndVerifyTouchModeInMainDisplayOnly(bool inTouchMode, gui::Pid pid, gui::Uid uid,
bool hasPermission) {
ASSERT_TRUE(mDispatcher->setInTouchMode(inTouchMode, pid, uid, hasPermission,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
mWindow->consumeTouchModeEvent(inTouchMode);
mSecondWindow->consumeTouchModeEvent(inTouchMode);
mThirdWindow->assertNoEvents();
@@ -12136,7 +12305,7 @@
mWindow->setOwnerInfo(gui::Pid::INVALID, gui::Uid::INVALID);
ASSERT_FALSE(mDispatcher->setInTouchMode(InputDispatcher::kDefaultInTouchMode, ownerPid,
ownerUid, /*hasPermission=*/false,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
}
@@ -12154,7 +12323,8 @@
const WindowInfo& windowInfo = *mWindow->getInfo();
ASSERT_FALSE(mDispatcher->setInTouchMode(InputDispatcher::kDefaultInTouchMode,
windowInfo.ownerPid, windowInfo.ownerUid,
- /*hasPermission=*/true, ADISPLAY_ID_DEFAULT));
+ /*hasPermission=*/true,
+ ui::LogicalDisplayId::DEFAULT));
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
}
@@ -12172,9 +12342,9 @@
TEST_F(InputDispatcherTouchModeChangedTests, CanChangeTouchModeWhenOwningLastInteractedWindow) {
// Interact with the window first.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectKeyDown(*mDispatcher, ADISPLAY_ID_DEFAULT))
+ injectKeyDown(*mDispatcher, ui::LogicalDisplayId::DEFAULT))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- mWindow->consumeKeyDown(ADISPLAY_ID_DEFAULT);
+ mWindow->consumeKeyDown(ui::LogicalDisplayId::DEFAULT);
// Then remove focus.
mWindow->setFocusable(false);
@@ -12184,7 +12354,8 @@
const WindowInfo& windowInfo = *mWindow->getInfo();
ASSERT_TRUE(mDispatcher->setInTouchMode(!InputDispatcher::kDefaultInTouchMode,
windowInfo.ownerPid, windowInfo.ownerUid,
- /*hasPermission=*/false, ADISPLAY_ID_DEFAULT));
+ /*hasPermission=*/false,
+ ui::LogicalDisplayId::DEFAULT));
}
class InputDispatcherSpyWindowTest : public InputDispatcherTest {
@@ -12194,8 +12365,9 @@
std::make_shared<FakeApplicationHandle>();
std::string name = "Fake Spy ";
name += std::to_string(mSpyCount++);
- sp<FakeWindowHandle> spy = sp<FakeWindowHandle>::make(application, mDispatcher,
- name.c_str(), ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spy =
+ sp<FakeWindowHandle>::make(application, mDispatcher, name.c_str(),
+ ui::LogicalDisplayId::DEFAULT);
spy->setSpy(true);
spy->setTrustedOverlay(true);
return spy;
@@ -12206,7 +12378,7 @@
std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> window =
sp<FakeWindowHandle>::make(application, mDispatcher, "Fake Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
return window;
}
@@ -12237,9 +12409,10 @@
mDispatcher->onWindowInfosChanged({{*spy->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- spy->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ spy->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
}
/**
@@ -12277,7 +12450,8 @@
}
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
std::vector<size_t> eventOrder;
@@ -12315,9 +12489,10 @@
mDispatcher->onWindowInfosChanged({{*spy->getInfo(), *window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
spy->assertNoEvents();
}
@@ -12334,20 +12509,22 @@
// Inject an event outside the spy window's touchable region.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
spy->assertNoEvents();
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionUp();
spy->assertNoEvents();
// Inject an event inside the spy window's touchable region.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {5, 10}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {5, 10}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
spy->consumeMotionDown();
@@ -12368,8 +12545,8 @@
// Inject an event outside the spy window's frame and touchable region.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
spy->consumeMotionOutsideWithZeroedCoords();
@@ -12390,8 +12567,8 @@
{{*spy->getInfo(), *windowLeft->getInfo(), *windowRight->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
windowLeft->consumeMotionDown();
spy->consumeMotionDown();
@@ -12422,8 +12599,8 @@
mDispatcher->onWindowInfosChanged({{*spyRight->getInfo(), *window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {50, 50}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
spyRight->assertNoEvents();
@@ -12459,16 +12636,16 @@
// First finger down, no window touched.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- spy->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ spy->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
window->assertNoEvents();
// Second finger down on window, the window should receive touch down.
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(100).y(200))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(50).y(50))
@@ -12478,7 +12655,7 @@
InputEventInjectionSync::WAIT_FOR_RESULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
spy->consumeMotionPointerDown(/*pointerIndex=*/1);
}
@@ -12497,11 +12674,11 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ window->consumeKeyDown(ui::LogicalDisplayId::INVALID);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyUp(*mDispatcher))
<< "Inject key event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeKeyUp(ui::ADISPLAY_ID_NONE);
+ window->consumeKeyUp(ui::LogicalDisplayId::INVALID);
spy->assertNoEvents();
}
@@ -12520,7 +12697,8 @@
{{*spy1->getInfo(), *spy2->getInfo(), *window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
spy1->consumeMotionDown();
@@ -12535,7 +12713,7 @@
// The rest of the gesture should only be sent to the second spy window.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT))
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
spy2->consumeMotionMove();
spy1->assertNoEvents();
@@ -12552,19 +12730,21 @@
mDispatcher->onWindowInfosChanged({{*spy->getInfo(), *window->getInfo()}, {}, 0, 0});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeMotionDown(ADISPLAY_ID_DEFAULT);
- spy->consumeMotionDown(ADISPLAY_ID_DEFAULT);
+ window->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
+ spy->consumeMotionDown(ui::LogicalDisplayId::DEFAULT);
window->releaseChannel();
EXPECT_EQ(OK, mDispatcher->pilferPointers(spy->getToken()));
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- spy->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ spy->consumeMotionUp(ui::LogicalDisplayId::DEFAULT);
}
/**
@@ -12579,8 +12759,8 @@
// First finger down on the window and the spy.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {100, 200}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {100, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
spy->consumeMotionDown();
window->consumeMotionDown();
@@ -12592,7 +12772,7 @@
// Second finger down on the window and spy, but the window should not receive the pointer down.
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(100).y(200))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(50).y(50))
@@ -12607,7 +12787,7 @@
// Third finger goes down outside all windows, so injection should fail.
const MotionEvent thirdFingerDownEvent =
MotionEventBuilder(POINTER_2_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(100).y(200))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(50).y(50))
@@ -12635,15 +12815,15 @@
// First finger down on the window only
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {150, 150}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {150, 150}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
// Second finger down on the spy and window
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(150).y(150))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(10).y(10))
@@ -12658,7 +12838,7 @@
// Third finger down on the spy and window
const MotionEvent thirdFingerDownEvent =
MotionEventBuilder(POINTER_2_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(150).y(150))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(10).y(10))
@@ -12673,8 +12853,10 @@
// 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, ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_CANCELED);
+ window->consumeMotionPointerUp(/*idx=*/1, ui::LogicalDisplayId::DEFAULT,
+ AMOTION_EVENT_FLAG_CANCELED);
spy->assertNoEvents();
window->assertNoEvents();
@@ -12695,8 +12877,8 @@
// First finger down on both spy and window
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {10, 10}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {10, 10}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
spy->consumeMotionDown();
@@ -12704,7 +12886,7 @@
// Second finger down on the spy and window
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(10).y(10))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(50).y(50))
@@ -12738,8 +12920,8 @@
// First finger down on both window and spy
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
- {10, 10}))
+ injectMotionDown(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN,
+ ui::LogicalDisplayId::DEFAULT, {10, 10}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
spy->consumeMotionDown();
@@ -12751,7 +12933,7 @@
// Second finger down on the window only
const MotionEvent secondFingerDownEvent =
MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
- .displayId(ADISPLAY_ID_DEFAULT)
+ .displayId(ui::LogicalDisplayId::DEFAULT)
.eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
.pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(10).y(10))
.pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(150).y(150))
@@ -12936,9 +13118,9 @@
std::pair<sp<FakeWindowHandle>, sp<FakeWindowHandle>> setupStylusOverlayScenario() {
std::shared_ptr<FakeApplicationHandle> overlayApplication =
std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> overlay =
- sp<FakeWindowHandle>::make(overlayApplication, mDispatcher,
- "Stylus interceptor window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> overlay = sp<FakeWindowHandle>::make(overlayApplication, mDispatcher,
+ "Stylus interceptor window",
+ ui::LogicalDisplayId::DEFAULT);
overlay->setFocusable(false);
overlay->setOwnerInfo(gui::Pid{111}, gui::Uid{111});
overlay->setTouchable(false);
@@ -12949,11 +13131,11 @@
std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> window =
sp<FakeWindowHandle>::make(application, mDispatcher, "Application window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
window->setFocusable(true);
window->setOwnerInfo(gui::Pid{222}, gui::Uid{222});
- mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
+ mDispatcher->setFocusedApplication(ui::LogicalDisplayId::DEFAULT, application);
mDispatcher->onWindowInfosChanged({{*overlay->getInfo(), *window->getInfo()}, {}, 0, 0});
setFocusedWindow(window);
window->consumeFocusEvent(/*hasFocus=*/true, /*inTouchMode=*/true);
@@ -12963,13 +13145,13 @@
void sendFingerEvent(int32_t action) {
mDispatcher->notifyMotion(
generateMotionArgs(action, AINPUT_SOURCE_TOUCHSCREEN | AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{20, 20}}));
+ ui::LogicalDisplayId::DEFAULT, {PointF{20, 20}}));
}
void sendStylusEvent(int32_t action) {
NotifyMotionArgs motionArgs =
generateMotionArgs(action, AINPUT_SOURCE_TOUCHSCREEN | AINPUT_SOURCE_STYLUS,
- ADISPLAY_ID_DEFAULT, {PointF{30, 40}});
+ ui::LogicalDisplayId::DEFAULT, {PointF{30, 40}});
motionArgs.pointerProperties[0].toolType = ToolType::STYLUS;
mDispatcher->notifyMotion(motionArgs);
}
@@ -13073,7 +13255,7 @@
InputEventInjectionResult injectTargetedMotion(int32_t action) const {
return injectMotionEvent(*mDispatcher, action, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT, {100, 200},
+ ui::LogicalDisplayId::DEFAULT, {100, 200},
{AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION},
INJECT_EVENT_TIMEOUT, InputEventInjectionSync::WAIT_FOR_RESULT,
@@ -13082,7 +13264,7 @@
InputEventInjectionResult injectTargetedKey(int32_t action) const {
return inputdispatcher::injectKey(*mDispatcher, action, /*repeatCount=*/0,
- ui::ADISPLAY_ID_NONE,
+ ui::LogicalDisplayId::INVALID,
InputEventInjectionSync::WAIT_FOR_RESULT,
INJECT_EVENT_TIMEOUT, /*allowKeyRepeat=*/false, {mUid},
mPolicyFlags);
@@ -13091,8 +13273,9 @@
sp<FakeWindowHandle> createWindow(const char* name) const {
std::shared_ptr<FakeApplicationHandle> overlayApplication =
std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(overlayApplication, mDispatcher,
- name, ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> window =
+ sp<FakeWindowHandle>::make(overlayApplication, mDispatcher, name,
+ ui::LogicalDisplayId::DEFAULT);
window->setOwnerInfo(mPid, mUid);
return window;
}
@@ -13114,7 +13297,7 @@
EXPECT_EQ(InputEventInjectionResult::SUCCEEDED,
owner.injectTargetedKey(AKEY_EVENT_ACTION_DOWN));
- window->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ window->consumeKeyDown(ui::LogicalDisplayId::INVALID);
}
TEST_F(InputDispatcherTargetedInjectionTest, CannotInjectIntoUnownedWindow) {
@@ -13179,7 +13362,7 @@
// A user that has injection permission can inject into any window.
EXPECT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN,
- ADISPLAY_ID_DEFAULT));
+ ui::LogicalDisplayId::DEFAULT));
randosSpy->consumeMotionDown();
window->consumeMotionDown();
@@ -13187,7 +13370,7 @@
randosSpy->consumeFocusEvent(true);
EXPECT_EQ(InputEventInjectionResult::SUCCEEDED, injectKeyDown(*mDispatcher));
- randosSpy->consumeKeyDown(ui::ADISPLAY_ID_NONE);
+ randosSpy->consumeKeyDown(ui::LogicalDisplayId::INVALID);
window->assertNoEvents();
}
@@ -13214,13 +13397,14 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> left = sp<FakeWindowHandle>::make(application, mDispatcher, "Left Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
left->setFrame(Rect(0, 0, 100, 100));
- sp<FakeWindowHandle> right = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Right Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> right =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Right Window",
+ ui::LogicalDisplayId::DEFAULT);
right->setFrame(Rect(100, 0, 200, 100));
- sp<FakeWindowHandle> spy =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spy = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window",
+ ui::LogicalDisplayId::DEFAULT);
spy->setFrame(Rect(0, 0, 200, 100));
spy->setTrustedOverlay(true);
spy->setSpy(true);
@@ -13237,11 +13421,14 @@
left->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER));
spy->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
// Hover move to the right window.
@@ -13254,11 +13441,14 @@
right->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER));
spy->consumeMotionEvent(WithMotionAction(ACTION_HOVER_MOVE));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
// Stop hovering.
@@ -13270,11 +13460,14 @@
right->consumeMotionEvent(WithMotionAction(ACTION_HOVER_EXIT));
spy->consumeMotionEvent(WithMotionAction(ACTION_HOVER_EXIT));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
}
@@ -13282,13 +13475,14 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> left = sp<FakeWindowHandle>::make(application, mDispatcher, "Left Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
left->setFrame(Rect(0, 0, 100, 100));
- sp<FakeWindowHandle> right = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Right Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> right =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Right Window",
+ ui::LogicalDisplayId::DEFAULT);
right->setFrame(Rect(100, 0, 200, 100));
- sp<FakeWindowHandle> spy =
- sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> spy = sp<FakeWindowHandle>::make(application, mDispatcher, "Spy Window",
+ ui::LogicalDisplayId::DEFAULT);
spy->setFrame(Rect(0, 0, 200, 100));
spy->setTrustedOverlay(true);
spy->setSpy(true);
@@ -13305,11 +13499,14 @@
left->consumeMotionDown();
spy->consumeMotionDown();
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
// Second pointer down on right window.
@@ -13323,17 +13520,23 @@
right->consumeMotionDown();
spy->consumeMotionEvent(WithMotionAction(POINTER_1_DOWN));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/1));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/1));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/1));
// Second pointer up.
@@ -13347,17 +13550,23 @@
right->consumeMotionUp();
spy->consumeMotionEvent(WithMotionAction(POINTER_1_UP));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/1));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/1));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/1));
// First pointer up.
@@ -13369,11 +13578,14 @@
left->consumeMotionUp();
spy->consumeMotionUp();
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(spy->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(spy->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
}
@@ -13382,17 +13594,20 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> left = sp<FakeWindowHandle>::make(application, mDispatcher, "Left Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
left->setFrame(Rect(0, 0, 100, 100));
- sp<FakeWindowHandle> right = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Right Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> right =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Right Window",
+ ui::LogicalDisplayId::DEFAULT);
right->setFrame(Rect(100, 0, 200, 100));
mDispatcher->onWindowInfosChanged({{*left->getInfo(), *right->getInfo()}, {}, 0, 0});
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
// Hover move into the window.
@@ -13406,7 +13621,8 @@
left->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
// Move the mouse with another device. This cancels the hovering pointer from the first device.
@@ -13423,9 +13639,10 @@
// TODO(b/313689709): InputDispatcher's touch state is not updated, even though the window gets
// a HOVER_EXIT from the first device.
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
SECOND_DEVICE_ID,
/*pointerId=*/0));
@@ -13441,9 +13658,10 @@
left->consumeMotionEvent(WithMotionAction(ACTION_HOVER_EXIT));
right->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
SECOND_DEVICE_ID,
/*pointerId=*/0));
}
@@ -13457,17 +13675,20 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> left = sp<FakeWindowHandle>::make(application, mDispatcher, "Left Window",
- ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
left->setFrame(Rect(0, 0, 100, 100));
- sp<FakeWindowHandle> right = sp<FakeWindowHandle>::make(application, mDispatcher,
- "Right Window", ADISPLAY_ID_DEFAULT);
+ sp<FakeWindowHandle> right =
+ sp<FakeWindowHandle>::make(application, mDispatcher, "Right Window",
+ ui::LogicalDisplayId::DEFAULT);
right->setFrame(Rect(100, 0, 200, 100));
mDispatcher->onWindowInfosChanged({{*left->getInfo(), *right->getInfo()}, {}, 0, 0});
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(right->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
// Hover move into the window.
@@ -13481,7 +13702,8 @@
left->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
// Move the mouse with another device
@@ -13496,9 +13718,10 @@
// TODO(b/313689709): InputDispatcher's touch state is not updated, even though the window gets
// a HOVER_EXIT from the first device.
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
SECOND_DEVICE_ID,
/*pointerId=*/0));
@@ -13513,9 +13736,10 @@
.build());
right->consumeMotionEvent(WithMotionAction(ACTION_HOVER_ENTER));
- ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT, DEVICE_ID,
+ ASSERT_TRUE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
+ DEVICE_ID,
/*pointerId=*/0));
- ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ADISPLAY_ID_DEFAULT,
+ ASSERT_FALSE(mDispatcher->isPointerInWindow(left->getToken(), ui::LogicalDisplayId::DEFAULT,
SECOND_DEVICE_ID,
/*pointerId=*/0));
}