Remove the concept of TOUCH_MODAL from input
We remove modal windows from input. WM will configure modal windows
itself using touchableRegion.
Bug: 216806304
Test: atest inputflinger_tests
Change-Id: I9593865213216b420ab9b5c5b853298f01dabcc6
diff --git a/libs/gui/include/gui/WindowInfo.h b/libs/gui/include/gui/WindowInfo.h
index c8d4986..b9bffaa 100644
--- a/libs/gui/include/gui/WindowInfo.h
+++ b/libs/gui/include/gui/WindowInfo.h
@@ -164,18 +164,17 @@
NOT_VISIBLE = 1 << 0,
NOT_FOCUSABLE = 1 << 1,
NOT_TOUCHABLE = 1 << 2,
- TOUCH_MODAL = 1 << 3,
- PREVENT_SPLITTING = 1 << 4,
- DUPLICATE_TOUCH_TO_WALLPAPER = 1 << 5,
- IS_WALLPAPER = 1 << 6,
- PAUSE_DISPATCHING = 1 << 7,
+ PREVENT_SPLITTING = 1 << 3,
+ DUPLICATE_TOUCH_TO_WALLPAPER = 1 << 4,
+ IS_WALLPAPER = 1 << 5,
+ PAUSE_DISPATCHING = 1 << 6,
// This flag is set when the window is of a trusted type that is allowed to silently
// overlay other windows for the purpose of implementing the secure views feature.
// Trusted overlays, such as IME windows, can partly obscure other windows without causing
// motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED.
- TRUSTED_OVERLAY = 1 << 8,
- WATCH_OUTSIDE_TOUCH = 1 << 9,
- SLIPPERY = 1 << 10,
+ TRUSTED_OVERLAY = 1 << 7,
+ WATCH_OUTSIDE_TOUCH = 1 << 8,
+ SLIPPERY = 1 << 9,
// clang-format on
};
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index f5aa45b..58c9303 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -509,8 +509,7 @@
if (inputConfig.test(WindowInfo::InputConfig::NOT_TOUCHABLE) && !windowCanInterceptTouch) {
return false;
}
- if (!inputConfig.test(WindowInfo::InputConfig::TOUCH_MODAL) &&
- !windowInfo.touchableRegionContainsPoint(x, y)) {
+ if (!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 51ecf76..ae8358a 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -1032,10 +1032,6 @@
mInfo.setInputConfig(WindowInfo::InputConfig::PAUSE_DISPATCHING, paused);
}
- void setTouchModal(bool touchModal) {
- mInfo.setInputConfig(WindowInfo::InputConfig::TOUCH_MODAL, touchModal);
- }
-
void setPreventSplitting(bool preventSplitting) {
mInfo.setInputConfig(WindowInfo::InputConfig::PREVENT_SPLITTING, preventSplitting);
}
@@ -6412,27 +6408,6 @@
}
/**
- * A spy window that is a modal window will receive gestures outside of its frame and touchable
- * region.
- */
-TEST_F(InputDispatcherSpyWindowTest, ModalWindow) {
- auto window = createForeground();
- auto spy = createSpy();
- // Our current policy dictates that modal windows must be focusable.
- spy->setFocusable(true);
- spy->setTouchModal(true);
- spy->setFrame(Rect{0, 0, 20, 20});
- mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {spy, window}}});
-
- // Inject an event outside the spy window's frame and touchable region.
- ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
- << "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- window->consumeMotionDown();
- spy->consumeMotionDown();
-}
-
-/**
* A spy window can listen for touches outside its touchable region using the WATCH_OUTSIDE_TOUCHES
* flag, but it will get zero-ed out coordinates if the foreground has a different owner.
*/
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 219c716..8081096 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2159,7 +2159,6 @@
void Layer::fillInputFrameInfo(WindowInfo& info, const ui::Transform& screenToDisplay) {
Rect tmpBounds = getInputBounds();
if (!tmpBounds.isValid()) {
- 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
@@ -2307,7 +2306,6 @@
mDrawingState.inputInfo.ownerUid = mOwnerUid;
mDrawingState.inputInfo.ownerPid = mOwnerPid;
mDrawingState.inputInfo.inputFeatures = WindowInfo::Feature::NO_INPUT_CHANNEL;
- mDrawingState.inputInfo.setInputConfig(WindowInfo::InputConfig::TOUCH_MODAL, false);
mDrawingState.inputInfo.displayId = getLayerStack().id;
}