Introduce WindowInfo::InputConfig flag to control input behavior
Instead of re-using layoutParams flags and layoutParam types and having
redundant information in WindowInfo, we add a new InputConfig flag that
the native input pipeline will use for all input window configurations.
This also reduces WindowInfo's size by converting booleans into flags.
Bug: 216806304
Test: atest libgui_test
Test: atest inputflinger_tests
Change-Id: If0354cc2cfc84986f7f0d48cd9348be1ff82293d
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index a039250..d290a76 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2161,8 +2161,8 @@
void Layer::fillInputFrameInfo(WindowInfo& info, const ui::Transform& screenToDisplay) {
Rect tmpBounds = getInputBounds();
if (!tmpBounds.isValid()) {
- info.flags = WindowInfo::Flag::NOT_TOUCH_MODAL | WindowInfo::Flag::NOT_FOCUSABLE;
- info.focusable = false;
+ info.inputConfig |=
+ WindowInfo::InputConfig::NOT_TOUCH_MODAL | WindowInfo::InputConfig::NOT_FOCUSABLE;
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
@@ -2309,7 +2309,7 @@
mDrawingState.inputInfo.ownerUid = mOwnerUid;
mDrawingState.inputInfo.ownerPid = mOwnerPid;
mDrawingState.inputInfo.inputFeatures = WindowInfo::Feature::NO_INPUT_CHANNEL;
- mDrawingState.inputInfo.flags = WindowInfo::Flag::NOT_TOUCH_MODAL;
+ mDrawingState.inputInfo.inputConfig |= WindowInfo::InputConfig::NOT_TOUCH_MODAL;
mDrawingState.inputInfo.displayId = getLayerStack().id;
}
@@ -2327,7 +2327,9 @@
// We are just using these layers for occlusion detection in
// InputDispatcher, and obviously if they aren't visible they can't occlude
// anything.
- info.visible = hasInputInfo() ? canReceiveInput() : isVisible();
+ const bool visible = hasInputInfo() ? canReceiveInput() : isVisible();
+ info.setInputConfig(WindowInfo::InputConfig::NOT_VISIBLE, !visible);
+
info.alpha = getAlpha();
fillTouchOcclusionMode(info);
handleDropInputMode(info);
@@ -2349,8 +2351,9 @@
// Inherit the trusted state from the parent hierarchy, but don't clobber the trusted state
// if it was set by WM for a known system overlay
- info.trustedOverlay = info.trustedOverlay || isTrustedOverlay();
-
+ if (isTrustedOverlay()) {
+ info.inputConfig |= WindowInfo::InputConfig::TRUSTED_OVERLAY;
+ }
// If the layer is a clone, we need to crop the input region to cloned root to prevent
// touches from going outside the cloned area.
@@ -2482,7 +2485,7 @@
}
// Cloned layers shouldn't handle watch outside since their z order is not determined by
// WM or the client.
- mDrawingState.inputInfo.flags &= ~WindowInfo::Flag::WATCH_OUTSIDE_TOUCH;
+ mDrawingState.inputInfo.setInputConfig(WindowInfo::InputConfig::WATCH_OUTSIDE_TOUCH, false);
}
void Layer::updateClonedRelatives(const std::map<sp<Layer>, sp<Layer>>& clonedLayersMap) {