[sf] input snapshot fixes
- update inputflinger if the visibility changes
- use passed in uid/pid for input info
- fix touchOcclusionMode propagation to layers
Test: atest InputSurfacesTest
Bug: 238781169
Change-Id: If037270c8b54176dfcb32efef424d2289ead1704
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index 3698943..a16de1b 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -274,7 +274,7 @@
// InputDispatcher, and obviously if they aren't visible they can't occlude
// anything.
const bool visibleForInput =
- (snapshot.inputInfo.token != nullptr) ? snapshot.canReceiveInput() : snapshot.isVisible;
+ snapshot.hasInputInfo() ? snapshot.canReceiveInput() : snapshot.isVisible;
snapshot.inputInfo.setInputConfig(gui::WindowInfo::InputConfig::NOT_VISIBLE, !visibleForInput);
}
@@ -955,12 +955,13 @@
snapshot.inputInfo = *requested.windowInfoHandle->getInfo();
} else {
snapshot.inputInfo = {};
+ // b/271132344 revisit this and see if we can always use the layers uid/pid
+ snapshot.inputInfo.name = requested.name;
+ snapshot.inputInfo.ownerUid = static_cast<int32_t>(requested.ownerUid);
+ snapshot.inputInfo.ownerPid = requested.ownerPid;
}
- snapshot.inputInfo.name = requested.name;
snapshot.inputInfo.id = static_cast<int32_t>(snapshot.uniqueSequence);
- snapshot.inputInfo.ownerUid = static_cast<int32_t>(requested.ownerUid);
- snapshot.inputInfo.ownerPid = requested.ownerPid;
snapshot.inputInfo.displayId = static_cast<int32_t>(snapshot.outputFilter.layerStack.id);
if (!needsInputInfo(snapshot, requested)) {
return;
@@ -984,7 +985,9 @@
}
snapshot.inputInfo.alpha = snapshot.color.a;
- snapshot.inputInfo.touchOcclusionMode = parentSnapshot.inputInfo.touchOcclusionMode;
+ 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;