diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-19 21:22:47 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-19 21:22:47 +0000 |
commit | fe39dab17cd8263483027b07a50292c33cac7002 (patch) | |
tree | 5eb1ea4f64a74c35763c32717234f2feb67f2ed1 | |
parent | 592fc6986c0cdcd3885ef5fd0c07c1162b7bf910 (diff) | |
parent | 954766c39bd2649b1a7137fafa9f1e122458d40e (diff) | |
download | native-fe39dab17cd8263483027b07a50292c33cac7002.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25917149'] into 24Q1-release.android-14.0.0_r37android-14.0.0_r36android-14.0.0_r35android-14.0.0_r34android-14.0.0_r33android-14.0.0_r32android-14.0.0_r31android-14.0.0_r30android-14.0.0_r29android14-qpr2-s5-releaseandroid14-qpr2-s4-releaseandroid14-qpr2-s3-releaseandroid14-qpr2-s2-releaseandroid14-qpr2-s1-releaseandroid14-qpr2-release
Change-Id: I6e963816f63e55a07636c92962ae409edff22f9a
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 7 | ||||
-rw-r--r-- | services/surfaceflinger/tests/LayerTransaction_test.cpp | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index c56dc83412..4fe729feb3 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2436,6 +2436,13 @@ bool SurfaceFlinger::updateLayerSnapshots(VsyncId vsyncId, nsecs_t frameTimeNs, const bool willReleaseBufferOnLatch = layer->willReleaseBufferOnLatch(); auto it = mLegacyLayers.find(layer->id); + if (it == mLegacyLayers.end() && + layer->changes.test(frontend::RequestedLayerState::Changes::Destroyed)) { + // Layer handle was created and immediately destroyed. It was destroyed before it + // was added to the map. + continue; + } + LLOG_ALWAYS_FATAL_WITH_TRACE_IF(it == mLegacyLayers.end(), "Couldnt find layer object for %s", layer->getDebugString().c_str()); diff --git a/services/surfaceflinger/tests/LayerTransaction_test.cpp b/services/surfaceflinger/tests/LayerTransaction_test.cpp index 03de8d0b6d..ea141f3257 100644 --- a/services/surfaceflinger/tests/LayerTransaction_test.cpp +++ b/services/surfaceflinger/tests/LayerTransaction_test.cpp @@ -213,6 +213,15 @@ TEST_F(LayerTransactionTest, CommitCallbackCalledOnce) { ASSERT_EQ(callCount, 1); } +TEST_F(LayerTransactionTest, AddRemoveLayers) { + for (int i = 0; i < 100; i++) { + sp<SurfaceControl> layer; + ASSERT_NO_FATAL_FAILURE( + layer = createLayer("test", 32, 32, ISurfaceComposerClient::eFXSurfaceBufferState)); + layer.clear(); + } +} + } // namespace android // TODO(b/129481165): remove the #pragma below and fix conversion issues |