summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chavi Weingarten <chaviw@google.com> 2024-01-22 15:41:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-01-22 15:41:28 +0000
commita9c519873255af50508ba47d483b951b272c88e9 (patch)
tree4a02c236f062c31c1b0cebb8f602877f8c642c84
parentc8f2afec993a5ed2ccfd997f8a14ee8fae4f9858 (diff)
parent92c7d8c52b3923ff123e4df744ba7c84cf2d71b1 (diff)
Merge "Ensure non visible layers that have input are traversed for input" into main
-rw-r--r--services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp4
-rw-r--r--services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp38
2 files changed, 40 insertions, 2 deletions
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index bb32afa991..8df5d8c679 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -587,8 +587,8 @@ LayerSnapshot* LayerSnapshotBuilder::createSnapshot(const LayerHierarchy::Traver
bool LayerSnapshotBuilder::sortSnapshotsByZ(const Args& args) {
if (!mResortSnapshots && args.forceUpdate == ForceUpdateFlags::NONE &&
!args.layerLifecycleManager.getGlobalChanges().any(
- RequestedLayerState::Changes::Hierarchy |
- RequestedLayerState::Changes::Visibility)) {
+ RequestedLayerState::Changes::Hierarchy | RequestedLayerState::Changes::Visibility |
+ RequestedLayerState::Changes::Input)) {
// We are not force updating and there are no hierarchy or visibility changes. Avoid sorting
// the snapshots.
return false;
diff --git a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
index 6394d63098..13b47ffa4c 100644
--- a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
@@ -64,6 +64,18 @@ protected:
actualBuilder.update(args);
}
+ void update(LayerSnapshotBuilder& actualBuilder) {
+ LayerSnapshotBuilder::Args args{.root = mHierarchyBuilder.getHierarchy(),
+ .layerLifecycleManager = mLifecycleManager,
+ .includeMetadata = false,
+ .displays = mFrontEndDisplayInfos,
+ .globalShadowSettings = globalShadowSettings,
+ .supportsBlur = true,
+ .supportedLayerGenericMetadata = {},
+ .genericLayerMetadataKeyMap = {}};
+ update(actualBuilder, args);
+ }
+
void updateAndVerify(LayerSnapshotBuilder& actualBuilder, bool hasDisplayChanges,
const std::vector<uint32_t> expectedVisibleLayerIdsInZOrder) {
LayerSnapshotBuilder::Args args{.root = mHierarchyBuilder.getHierarchy(),
@@ -1199,4 +1211,30 @@ TEST_F(LayerSnapshotTest, propagateDropInputMode) {
EXPECT_EQ(getSnapshot(11)->dropInputMode, gui::DropInputMode::ALL);
}
+TEST_F(LayerSnapshotTest, NonVisibleLayerWithInput) {
+ LayerHierarchyTestBase::createRootLayer(3);
+ setColor(3, {-1._hf, -1._hf, -1._hf});
+ UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER);
+
+ std::vector<TransactionState> transactions;
+ transactions.emplace_back();
+ transactions.back().states.push_back({});
+ transactions.back().states.front().state.what = layer_state_t::eInputInfoChanged;
+ transactions.back().states.front().layerId = 3;
+ transactions.back().states.front().state.windowInfoHandle = sp<gui::WindowInfoHandle>::make();
+ auto inputInfo = transactions.back().states.front().state.windowInfoHandle->editInfo();
+ inputInfo->token = sp<BBinder>::make();
+ mLifecycleManager.applyTransactions(transactions);
+
+ update(mSnapshotBuilder);
+
+ bool foundInputLayer = false;
+ mSnapshotBuilder.forEachInputSnapshot([&](const frontend::LayerSnapshot& snapshot) {
+ if (snapshot.uniqueSequence == 3) {
+ foundInputLayer = true;
+ }
+ });
+ EXPECT_TRUE(foundInputLayer);
+}
+
} // namespace android::surfaceflinger::frontend