Propagate drop input mode correctly to children
We were short circuting updating input info if the layer
did not have an input channel. This prevented us from
propagating the drop input mode correctly.
Fix this by updating all input states that are tied to
parent states as well regardless of input channel.
Test: presbumit (atest LayerSnapshotBuilderTest)
Fixes: 314350323
Change-Id: I955f81aeec1e6eec62f571edb181bbc5a7351385
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index 743cbf3..4e2a25f 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -708,7 +708,7 @@
ftl::Flags<RequestedLayerState::Changes> parentChanges = parentSnapshot.changes &
(RequestedLayerState::Changes::Hierarchy | RequestedLayerState::Changes::Geometry |
RequestedLayerState::Changes::Visibility | RequestedLayerState::Changes::Metadata |
- RequestedLayerState::Changes::AffectsChildren |
+ RequestedLayerState::Changes::AffectsChildren | RequestedLayerState::Changes::Input |
RequestedLayerState::Changes::FrameRate | RequestedLayerState::Changes::GameMode);
snapshot.changes |= parentChanges;
if (args.displayChanges) snapshot.changes |= RequestedLayerState::Changes::Geometry;
@@ -1035,6 +1035,19 @@
snapshot.inputInfo.id = static_cast<int32_t>(snapshot.uniqueSequence);
snapshot.inputInfo.displayId = static_cast<int32_t>(snapshot.outputFilter.layerStack.id);
+ snapshot.inputInfo.touchOcclusionMode = requested.hasInputInfo()
+ ? requested.windowInfoHandle->getInfo()->touchOcclusionMode
+ : parentSnapshot.inputInfo.touchOcclusionMode;
+ if (requested.dropInputMode == gui::DropInputMode::ALL ||
+ parentSnapshot.dropInputMode == gui::DropInputMode::ALL) {
+ snapshot.dropInputMode = gui::DropInputMode::ALL;
+ } else if (requested.dropInputMode == gui::DropInputMode::OBSCURED ||
+ parentSnapshot.dropInputMode == gui::DropInputMode::OBSCURED) {
+ snapshot.dropInputMode = gui::DropInputMode::OBSCURED;
+ } else {
+ snapshot.dropInputMode = gui::DropInputMode::NONE;
+ }
+
updateVisibility(snapshot, snapshot.isVisible);
if (!needsInputInfo(snapshot, requested)) {
return;
@@ -1058,18 +1071,6 @@
}
snapshot.inputInfo.alpha = snapshot.color.a;
- snapshot.inputInfo.touchOcclusionMode = requested.hasInputInfo()
- ? requested.windowInfoHandle->getInfo()->touchOcclusionMode
- : parentSnapshot.inputInfo.touchOcclusionMode;
- if (requested.dropInputMode == gui::DropInputMode::ALL ||
- parentSnapshot.dropInputMode == gui::DropInputMode::ALL) {
- snapshot.dropInputMode = gui::DropInputMode::ALL;
- } else if (requested.dropInputMode == gui::DropInputMode::OBSCURED ||
- parentSnapshot.dropInputMode == gui::DropInputMode::OBSCURED) {
- snapshot.dropInputMode = gui::DropInputMode::OBSCURED;
- } else {
- snapshot.dropInputMode = gui::DropInputMode::NONE;
- }
handleDropInputMode(snapshot, parentSnapshot);