Invert some InputConfig flags to simplify default behavior
Invert NOT_TOUCH_MODAL to TOUCH_MODAL, and SPLIT_TOUCH to
PREVENT_SPLITTING. Modal windows and windows that prevent splitting are
exceptional behaviors, so we make sure that these show up when
outputting flag values using ftl::Flags::string().
Bug: 216806304
Test: atest inputflinger_tests
Change-Id: I7cadcc830f06ff0c63da3b61a1a7580cb031f0c2
diff --git a/libs/gui/WindowInfo.cpp b/libs/gui/WindowInfo.cpp
index 2c25e7e..80bd638 100644
--- a/libs/gui/WindowInfo.cpp
+++ b/libs/gui/WindowInfo.cpp
@@ -47,7 +47,7 @@
}
bool WindowInfo::supportsSplitTouch() const {
- return inputConfig.test(InputConfig::SPLIT_TOUCH);
+ return !inputConfig.test(InputConfig::PREVENT_SPLITTING);
}
bool WindowInfo::isSpy() const {
diff --git a/libs/gui/include/gui/WindowInfo.h b/libs/gui/include/gui/WindowInfo.h
index 1b3419a..c8d4986 100644
--- a/libs/gui/include/gui/WindowInfo.h
+++ b/libs/gui/include/gui/WindowInfo.h
@@ -164,8 +164,8 @@
NOT_VISIBLE = 1 << 0,
NOT_FOCUSABLE = 1 << 1,
NOT_TOUCHABLE = 1 << 2,
- NOT_TOUCH_MODAL = 1 << 3,
- SPLIT_TOUCH = 1 << 4,
+ TOUCH_MODAL = 1 << 3,
+ PREVENT_SPLITTING = 1 << 4,
DUPLICATE_TOUCH_TO_WALLPAPER = 1 << 5,
IS_WALLPAPER = 1 << 6,
PAUSE_DISPATCHING = 1 << 7,
diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp
index 1151aa3..fcfe21b 100644
--- a/libs/gui/tests/EndToEndNativeInputTest.cpp
+++ b/libs/gui/tests/EndToEndNativeInputTest.cpp
@@ -268,9 +268,6 @@
mInputInfo.name = "Test info";
mInputInfo.dispatchingTimeout = 5s;
mInputInfo.globalScaleFactor = 1.0;
- mInputInfo.setInputConfig(WindowInfo::InputConfig::NOT_TOUCH_MODAL, true);
- mInputInfo.setInputConfig(WindowInfo::InputConfig::NOT_VISIBLE, false);
-
mInputInfo.touchableRegion.orSelf(Rect(0, 0, width, height));
InputApplicationInfo aInfo;
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index a262563..f5aa45b 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -509,9 +509,8 @@
if (inputConfig.test(WindowInfo::InputConfig::NOT_TOUCHABLE) && !windowCanInterceptTouch) {
return false;
}
- const bool isModalWindow = !inputConfig.test(WindowInfo::InputConfig::NOT_FOCUSABLE) &&
- !inputConfig.test(WindowInfo::InputConfig::NOT_TOUCH_MODAL);
- if (!isModalWindow && !windowInfo.touchableRegionContainsPoint(x, y)) {
+ if (!inputConfig.test(WindowInfo::InputConfig::TOUCH_MODAL) &&
+ !windowInfo.touchableRegionContainsPoint(x, y)) {
return false;
}
return true;
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index da65e17..51ecf76 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -1000,11 +1000,7 @@
mInfo.ownerPid = INJECTOR_PID;
mInfo.ownerUid = INJECTOR_UID;
mInfo.displayId = displayId;
- setVisible(true);
- setFocusable(false);
- setDupTouchToWallpaper(false);
- setPaused(false);
- setTrustedOverlay(false);
+ mInfo.inputConfig = WindowInfo::InputConfig::NONE;
}
sp<FakeWindowHandle> clone(
@@ -1037,11 +1033,11 @@
}
void setTouchModal(bool touchModal) {
- mInfo.setInputConfig(WindowInfo::InputConfig::NOT_TOUCH_MODAL, !touchModal);
+ mInfo.setInputConfig(WindowInfo::InputConfig::TOUCH_MODAL, touchModal);
}
- void setSplitTouch(bool splitTouch) {
- mInfo.setInputConfig(WindowInfo::InputConfig::SPLIT_TOUCH, splitTouch);
+ void setPreventSplitting(bool preventSplitting) {
+ mInfo.setInputConfig(WindowInfo::InputConfig::PREVENT_SPLITTING, preventSplitting);
}
void setSlippery(bool slippery) {
@@ -1567,19 +1563,15 @@
}
/**
- * Calling setInputWindows once with FLAG_NOT_TOUCH_MODAL should not cause any issues.
- * To ensure that window receives only events that were directly inside of it, add
- * FLAG_NOT_TOUCH_MODAL. This will enforce using the touchableRegion of the input
- * when finding touched windows.
+ * Calling setInputWindows once should not cause any issues.
* This test serves as a sanity check for the next test, where setInputWindows is
* called twice.
*/
-TEST_F(InputDispatcherTest, SetInputWindowOnce_SingleWindowTouch) {
+TEST_F(InputDispatcherTest, SetInputWindowOnceWithSingleTouchWindow) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> window =
new FakeWindowHandle(application, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
- window->setTouchModal(false);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
@@ -1593,16 +1585,12 @@
/**
* Calling setInputWindows twice, with the same info, should not cause any issues.
- * To ensure that window receives only events that were directly inside of it, add
- * FLAG_NOT_TOUCH_MODAL. This will enforce using the touchableRegion of the input
- * when finding touched windows.
*/
TEST_F(InputDispatcherTest, SetInputWindowTwice_SingleWindowTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> window =
new FakeWindowHandle(application, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
window->setFrame(Rect(0, 0, 100, 100));
- window->setTouchModal(false);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
@@ -1790,15 +1778,11 @@
sp<FakeWindowHandle> leftWindow =
new FakeWindowHandle(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
leftWindow->setFrame(Rect(0, 0, 200, 200));
- leftWindow->setTouchModal(false);
- leftWindow->setSplitTouch(true);
leftWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> rightWindow =
new FakeWindowHandle(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
rightWindow->setFrame(Rect(200, 0, 400, 200));
- rightWindow->setTouchModal(false);
- rightWindow->setSplitTouch(true);
rightWindow->setDupTouchToWallpaper(true);
sp<FakeWindowHandle> wallpaperWindow =
@@ -1878,11 +1862,9 @@
sp<FakeWindowHandle> windowLeft =
new FakeWindowHandle(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
windowLeft->setFrame(Rect(0, 0, 600, 800));
- windowLeft->setTouchModal(false);
sp<FakeWindowHandle> windowRight =
new FakeWindowHandle(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
windowRight->setFrame(Rect(600, 0, 1200, 800));
- windowRight->setTouchModal(false);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
@@ -1989,7 +1971,6 @@
sp<FakeWindowHandle> window =
new FakeWindowHandle(application, mDispatcher, "Window", ADISPLAY_ID_DEFAULT);
window->setFrame(Rect(0, 0, 1200, 800));
- window->setTouchModal(false);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
@@ -2071,11 +2052,9 @@
sp<FakeWindowHandle> windowLeft =
new FakeWindowHandle(application, mDispatcher, "Left", ADISPLAY_ID_DEFAULT);
windowLeft->setFrame(Rect(0, 0, 600, 800));
- windowLeft->setTouchModal(false);
sp<FakeWindowHandle> windowRight =
new FakeWindowHandle(application, mDispatcher, "Right", ADISPLAY_ID_DEFAULT);
windowRight->setFrame(Rect(600, 0, 1200, 800));
- windowRight->setTouchModal(false);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
@@ -2181,14 +2160,12 @@
// Add two windows to the display. Their frames are represented in the display space.
sp<FakeWindowHandle> firstWindow =
new FakeWindowHandle(application, mDispatcher, "First Window", ADISPLAY_ID_DEFAULT);
- firstWindow->setTouchModal(false);
firstWindow->setFrame(Rect(0, 0, 100, 200), displayTransform);
addWindow(firstWindow);
sp<FakeWindowHandle> secondWindow =
new FakeWindowHandle(application, mDispatcher, "Second Window",
ADISPLAY_ID_DEFAULT);
- secondWindow->setTouchModal(false);
secondWindow->setFrame(Rect(100, 200, 200, 400), displayTransform);
addWindow(secondWindow);
return {std::move(firstWindow), std::move(secondWindow)};
@@ -2331,8 +2308,10 @@
// Create a couple of windows
sp<FakeWindowHandle> firstWindow =
new FakeWindowHandle(application, mDispatcher, "First Window", ADISPLAY_ID_DEFAULT);
+ firstWindow->setPreventSplitting(true);
sp<FakeWindowHandle> secondWindow =
new FakeWindowHandle(application, mDispatcher, "Second Window", ADISPLAY_ID_DEFAULT);
+ secondWindow->setPreventSplitting(true);
// Add the windows to the dispatcher
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {firstWindow, secondWindow}}});
@@ -2405,19 +2384,13 @@
TEST_F(InputDispatcherTest, TransferTouchFocus_TwoPointersSplitTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- // Create a non touch modal window that supports split touch
sp<FakeWindowHandle> firstWindow =
new FakeWindowHandle(application, mDispatcher, "First Window", ADISPLAY_ID_DEFAULT);
firstWindow->setFrame(Rect(0, 0, 600, 400));
- firstWindow->setTouchModal(false);
- firstWindow->setSplitTouch(true);
- // Create a non touch modal window that supports split touch
sp<FakeWindowHandle> secondWindow =
new FakeWindowHandle(application, mDispatcher, "Second Window", ADISPLAY_ID_DEFAULT);
secondWindow->setFrame(Rect(0, 400, 600, 800));
- secondWindow->setTouchModal(false);
- secondWindow->setSplitTouch(true);
// Add the windows to the dispatcher
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {firstWindow, secondWindow}}});
@@ -2479,19 +2452,13 @@
TEST_F(InputDispatcherTest, TransferTouch_TwoPointersSplitTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- // Create a non touch modal window that supports split touch
sp<FakeWindowHandle> firstWindow =
new FakeWindowHandle(application, mDispatcher, "First Window", ADISPLAY_ID_DEFAULT);
firstWindow->setFrame(Rect(0, 0, 600, 400));
- firstWindow->setTouchModal(false);
- firstWindow->setSplitTouch(true);
- // Create a non touch modal window that supports split touch
sp<FakeWindowHandle> secondWindow =
new FakeWindowHandle(application, mDispatcher, "Second Window", ADISPLAY_ID_DEFAULT);
secondWindow->setFrame(Rect(0, 400, 600, 800));
- secondWindow->setTouchModal(false);
- secondWindow->setSplitTouch(true);
// Add the windows to the dispatcher
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {firstWindow, secondWindow}}});
@@ -2556,26 +2523,21 @@
sp<FakeWindowHandle> firstWindowInPrimary =
new FakeWindowHandle(application, mDispatcher, "D_1_W1", ADISPLAY_ID_DEFAULT);
firstWindowInPrimary->setFrame(Rect(0, 0, 100, 100));
- firstWindowInPrimary->setTouchModal(false);
sp<FakeWindowHandle> secondWindowInPrimary =
new FakeWindowHandle(application, mDispatcher, "D_1_W2", ADISPLAY_ID_DEFAULT);
secondWindowInPrimary->setFrame(Rect(100, 0, 200, 100));
- secondWindowInPrimary->setTouchModal(false);
sp<FakeWindowHandle> mirrorWindowInPrimary =
firstWindowInPrimary->clone(application, mDispatcher, ADISPLAY_ID_DEFAULT);
mirrorWindowInPrimary->setFrame(Rect(0, 100, 100, 200));
- mirrorWindowInPrimary->setTouchModal(false);
sp<FakeWindowHandle> firstWindowInSecondary =
firstWindowInPrimary->clone(application, mDispatcher, SECOND_DISPLAY_ID);
firstWindowInSecondary->setFrame(Rect(0, 0, 100, 100));
- firstWindowInSecondary->setTouchModal(false);
sp<FakeWindowHandle> secondWindowInSecondary =
secondWindowInPrimary->clone(application, mDispatcher, SECOND_DISPLAY_ID);
secondWindowInPrimary->setFrame(Rect(100, 0, 200, 100));
- secondWindowInPrimary->setTouchModal(false);
// Update window info, let it find window handle of second display first.
mDispatcher->setInputWindows(
@@ -2620,26 +2582,21 @@
sp<FakeWindowHandle> firstWindowInPrimary =
new FakeWindowHandle(application, mDispatcher, "D_1_W1", ADISPLAY_ID_DEFAULT);
firstWindowInPrimary->setFrame(Rect(0, 0, 100, 100));
- firstWindowInPrimary->setTouchModal(false);
sp<FakeWindowHandle> secondWindowInPrimary =
new FakeWindowHandle(application, mDispatcher, "D_1_W2", ADISPLAY_ID_DEFAULT);
secondWindowInPrimary->setFrame(Rect(100, 0, 200, 100));
- secondWindowInPrimary->setTouchModal(false);
sp<FakeWindowHandle> mirrorWindowInPrimary =
firstWindowInPrimary->clone(application, mDispatcher, ADISPLAY_ID_DEFAULT);
mirrorWindowInPrimary->setFrame(Rect(0, 100, 100, 200));
- mirrorWindowInPrimary->setTouchModal(false);
sp<FakeWindowHandle> firstWindowInSecondary =
firstWindowInPrimary->clone(application, mDispatcher, SECOND_DISPLAY_ID);
firstWindowInSecondary->setFrame(Rect(0, 0, 100, 100));
- firstWindowInSecondary->setTouchModal(false);
sp<FakeWindowHandle> secondWindowInSecondary =
secondWindowInPrimary->clone(application, mDispatcher, SECOND_DISPLAY_ID);
secondWindowInPrimary->setFrame(Rect(100, 0, 200, 100));
- secondWindowInPrimary->setTouchModal(false);
// Update window info, let it find window handle of second display first.
mDispatcher->setInputWindows(
@@ -2733,19 +2690,13 @@
TEST_F(InputDispatcherTest, PointerCancel_SendCancelWhenSplitTouch) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- // Create first non touch modal window that supports split touch
sp<FakeWindowHandle> firstWindow =
new FakeWindowHandle(application, mDispatcher, "First Window", ADISPLAY_ID_DEFAULT);
firstWindow->setFrame(Rect(0, 0, 600, 400));
- firstWindow->setTouchModal(false);
- firstWindow->setSplitTouch(true);
- // Create second non touch modal window that supports split touch
sp<FakeWindowHandle> secondWindow =
new FakeWindowHandle(application, mDispatcher, "Second Window", ADISPLAY_ID_DEFAULT);
secondWindow->setFrame(Rect(0, 400, 600, 800));
- secondWindow->setTouchModal(false);
- secondWindow->setSplitTouch(true);
// Add the windows to the dispatcher
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {firstWindow, secondWindow}}});
@@ -3265,9 +3216,9 @@
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> window =
new FakeWindowHandle(application, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
+ window->setFocusable(false);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
- // Window is not focusable.
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
setFocusedWindow(window);
@@ -3275,7 +3226,7 @@
ASSERT_EQ(InputEventInjectionResult::TIMED_OUT, injectKeyDown(mDispatcher))
<< "Inject key event should return InputEventInjectionResult::TIMED_OUT";
- // window is invalid, so it should not receive any input event.
+ // window is not focusable, so it should not receive any input event.
window->assertNoEvents();
}
@@ -3412,7 +3363,6 @@
sp<FakeWindowHandle> slipperyExitWindow =
new FakeWindowHandle(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
- slipperyExitWindow->setTouchModal(false);
slipperyExitWindow->setSlippery(true);
// Make sure this one overlaps the bottom window
slipperyExitWindow->setFrame(Rect(25, 25, 75, 75));
@@ -4019,14 +3969,10 @@
mUnfocusedWindow =
new FakeWindowHandle(application, mDispatcher, "Top", ADISPLAY_ID_DEFAULT);
mUnfocusedWindow->setFrame(Rect(0, 0, 30, 30));
- // Adding FLAG_NOT_TOUCH_MODAL to ensure taps outside this window are not sent to this
- // window.
- mUnfocusedWindow->setTouchModal(false);
mFocusedWindow =
new FakeWindowHandle(application, mDispatcher, "Second", ADISPLAY_ID_DEFAULT);
mFocusedWindow->setFrame(Rect(50, 50, 100, 100));
- mFocusedWindow->setTouchModal(false);
// Set focused application.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
@@ -4133,16 +4079,10 @@
std::make_shared<FakeApplicationHandle>();
mWindow1 = new FakeWindowHandle(application, mDispatcher, "Fake Window 1",
ADISPLAY_ID_DEFAULT);
- // Adding FLAG_NOT_TOUCH_MODAL otherwise all taps will go to the top most window.
- // We also need FLAG_SPLIT_TOUCH or we won't be able to get touches for both windows.
- mWindow1->setTouchModal(false);
- mWindow1->setSplitTouch(true);
mWindow1->setFrame(Rect(0, 0, 100, 100));
mWindow2 = new FakeWindowHandle(application, mDispatcher, "Fake Window 2",
ADISPLAY_ID_DEFAULT, mWindow1->getToken());
- mWindow2->setTouchModal(false);
- mWindow2->setSplitTouch(true);
mWindow2->setFrame(Rect(100, 100, 200, 200));
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mWindow1, mWindow2}}});
@@ -4339,9 +4279,6 @@
mWindow->setFrame(Rect(0, 0, 30, 30));
mWindow->setDispatchingTimeout(30ms);
mWindow->setFocusable(true);
- // Adding FLAG_NOT_TOUCH_MODAL to ensure taps outside this window are not sent to this
- // window.
- mWindow->setTouchModal(false);
// Set focused application.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApplication);
@@ -4789,19 +4726,13 @@
mUnfocusedWindow =
new FakeWindowHandle(mApplication, mDispatcher, "Unfocused", ADISPLAY_ID_DEFAULT);
mUnfocusedWindow->setFrame(Rect(0, 0, 30, 30));
- // Adding FLAG_NOT_TOUCH_MODAL to ensure taps outside this window are not sent to this
- // window.
// Adding FLAG_WATCH_OUTSIDE_TOUCH to receive ACTION_OUTSIDE when another window is tapped
- mUnfocusedWindow->setTouchModal(false);
- mUnfocusedWindow->setSplitTouch(true);
mUnfocusedWindow->setWatchOutsideTouch(true);
mFocusedWindow =
new FakeWindowHandle(mApplication, mDispatcher, "Focused", ADISPLAY_ID_DEFAULT);
mFocusedWindow->setDispatchingTimeout(30ms);
mFocusedWindow->setFrame(Rect(50, 50, 100, 100));
- mFocusedWindow->setTouchModal(false);
- mFocusedWindow->setSplitTouch(true);
// Set focused application.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApplication);
@@ -5910,11 +5841,9 @@
mApp = std::make_shared<FakeApplicationHandle>();
mWindow = new FakeWindowHandle(mApp, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
mWindow->setFrame(Rect(0, 0, 100, 100));
- mWindow->setTouchModal(false);
mSecondWindow = new FakeWindowHandle(mApp, mDispatcher, "TestWindow2", ADISPLAY_ID_DEFAULT);
mSecondWindow->setFrame(Rect(100, 0, 200, 100));
- mSecondWindow->setTouchModal(false);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApp);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mWindow, mSecondWindow}}});
@@ -6330,7 +6259,6 @@
new FakeWindowHandle(application, mDispatcher, name.c_str(), ADISPLAY_ID_DEFAULT);
spy->setInputFeatures(WindowInfo::Feature::SPY);
spy->setTrustedOverlay(true);
- spy->setTouchModal(false);
return spy;
}
@@ -6340,8 +6268,6 @@
sp<FakeWindowHandle> window =
new FakeWindowHandle(application, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
window->setFocusable(true);
- window->setTouchModal(false);
- window->setSplitTouch(true);
return window;
}
@@ -6515,7 +6441,6 @@
window->setOwnerInfo(12, 34);
auto spy = createSpy();
spy->setWatchOutsideTouch(true);
- spy->setTouchModal(false);
spy->setOwnerInfo(56, 78);
spy->setFrame(Rect{0, 0, 20, 20});
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {spy, window}}});
@@ -6593,7 +6518,6 @@
*/
TEST_F(InputDispatcherSpyWindowTest, ContinuesToReceiveGestureAfterPilfer) {
auto spy = createSpy();
- spy->setTouchModal(false);
auto window = createForeground();
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {spy, window}}});
@@ -6728,14 +6652,11 @@
* windows should be allowed to control split touch.
*/
TEST_F(InputDispatcherSpyWindowTest, SplitIfNoForegroundWindowTouched) {
- // Create a touch modal spy that spies on the entire display.
- // This spy window does not set split touch. However, we still expect to split touches
+ // This spy window prevents touch splitting. However, we still expect to split touches
// because a foreground window has not disabled splitting.
auto spy = createSpy();
- spy->setTouchModal(true);
- spy->setSplitTouch(false);
+ spy->setPreventSplitting(true);
- // Create a non touch modal window that supports split touch.
auto window = createForeground();
window->setFrame(Rect(0, 0, 100, 100));
@@ -6805,7 +6726,6 @@
overlay->setFocusable(false);
overlay->setOwnerInfo(111, 111);
overlay->setTouchable(false);
- overlay->setSplitTouch(true);
overlay->setInputFeatures(WindowInfo::Feature::INTERCEPTS_STYLUS);
overlay->setTrustedOverlay(true);
@@ -6816,7 +6736,6 @@
ADISPLAY_ID_DEFAULT);
window->setFocusable(true);
window->setOwnerInfo(222, 222);
- window->setSplitTouch(true);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {overlay, window}}});
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index d0d79e9..219c716 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2159,8 +2159,8 @@
void Layer::fillInputFrameInfo(WindowInfo& info, const ui::Transform& screenToDisplay) {
Rect tmpBounds = getInputBounds();
if (!tmpBounds.isValid()) {
- info.inputConfig |=
- WindowInfo::InputConfig::NOT_TOUCH_MODAL | WindowInfo::InputConfig::NOT_FOCUSABLE;
+ info.setInputConfig(WindowInfo::InputConfig::TOUCH_MODAL, false);
+ info.setInputConfig(WindowInfo::InputConfig::NOT_FOCUSABLE, true);
info.touchableRegion.clear();
// A layer could have invalid input bounds and still expect to receive touch input if it has
// replaceTouchableRegionWithCrop. For that case, the input transform needs to be calculated
@@ -2307,7 +2307,7 @@
mDrawingState.inputInfo.ownerUid = mOwnerUid;
mDrawingState.inputInfo.ownerPid = mOwnerPid;
mDrawingState.inputInfo.inputFeatures = WindowInfo::Feature::NO_INPUT_CHANNEL;
- mDrawingState.inputInfo.inputConfig |= WindowInfo::InputConfig::NOT_TOUCH_MODAL;
+ mDrawingState.inputInfo.setInputConfig(WindowInfo::InputConfig::TOUCH_MODAL, false);
mDrawingState.inputInfo.displayId = getLayerStack().id;
}