diff options
| author | 2024-05-16 05:44:28 +0000 | |
|---|---|---|
| committer | 2024-05-16 07:53:39 -0700 | |
| commit | 422b81cb4ffcf28bb5becfb1fcaf93008b41d618 (patch) | |
| tree | 6d75d6218d6f13829477368089410b45e3374f2b | |
| parent | 834336a3957f181bfb0c744d5a947b406645d01f (diff) | |
Update mirror layer tests to support detach mirror flag
We changed mirroring behavior to ignore the local transforms
to support cases like mirroring a freeform window.
This cl fixes the tests to update the position of the mirrored
layer if the flag is set.
Bug: 337845753
Test: presubmit
Change-Id: I28294c36afb4d9f0de2e6c6017332617315f0c4d
| -rw-r--r-- | services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp | 1 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/MirrorLayer_test.cpp | 22 |
2 files changed, 21 insertions, 2 deletions
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp index e40c79cf62..f2497d4bc8 100644 --- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp @@ -362,6 +362,7 @@ LayerSnapshot LayerSnapshotBuilder::getRootSnapshot() { snapshot.gameMode = gui::GameMode::Unsupported; snapshot.frameRate = {}; snapshot.fixedTransformHint = ui::Transform::ROT_INVALID; + snapshot.ignoreLocalTransform = false; return snapshot; } diff --git a/services/surfaceflinger/tests/MirrorLayer_test.cpp b/services/surfaceflinger/tests/MirrorLayer_test.cpp index 0ea0824732..d97d433160 100644 --- a/services/surfaceflinger/tests/MirrorLayer_test.cpp +++ b/services/surfaceflinger/tests/MirrorLayer_test.cpp @@ -19,6 +19,7 @@ #pragma clang diagnostic ignored "-Wconversion" #include <android-base/properties.h> +#include <common/FlagManager.h> #include <private/android_filesystem_config.h> #include "LayerTransactionTest.h" #include "utils/TransactionUtils.h" @@ -78,6 +79,10 @@ TEST_F(MirrorLayerTest, MirrorColorLayer) { .show(mirrorLayer) .apply(); + if (FlagManager::getInstance().detached_mirror()) { + Transaction().setPosition(mirrorLayer, 550, 550).apply(); + } + { SCOPED_TRACE("Initial Mirror"); auto shot = screenshot(); @@ -172,6 +177,9 @@ TEST_F(MirrorLayerTest, MirrorBufferLayer) { .show(mirrorLayer) .apply(); + if (FlagManager::getInstance().detached_mirror()) { + Transaction().setPosition(mirrorLayer, 550, 550).apply(); + } { SCOPED_TRACE("Initial Mirror BufferQueueLayer"); auto shot = screenshot(); @@ -263,6 +271,9 @@ TEST_F(MirrorLayerTest, InitialMirrorState) { .setLayer(mirrorLayer, INT32_MAX - 1) .apply(); + if (FlagManager::getInstance().detached_mirror()) { + Transaction().setPosition(mirrorLayer, 550, 550).apply(); + } { SCOPED_TRACE("Offscreen Mirror"); auto shot = screenshot(); @@ -313,8 +324,15 @@ TEST_F(MirrorLayerTest, OffscreenMirrorScreenshot) { ASSERT_NE(mirrorLayer, nullptr); } + sp<SurfaceControl> mirrorParent = + createLayer("Grandchild layer", 50, 50, ISurfaceComposerClient::eFXSurfaceBufferState); + // Show the mirror layer, but don't reparent to a layer on screen. - Transaction().show(mirrorLayer).apply(); + Transaction().reparent(mirrorLayer, mirrorParent).show(mirrorLayer).apply(); + + if (FlagManager::getInstance().detached_mirror()) { + Transaction().setPosition(mirrorLayer, 50, 50).apply(); + } { SCOPED_TRACE("Offscreen Mirror"); @@ -331,7 +349,7 @@ TEST_F(MirrorLayerTest, OffscreenMirrorScreenshot) { SCOPED_TRACE("Capture Mirror"); // Capture just the mirror layer and child. LayerCaptureArgs captureArgs; - captureArgs.layerHandle = mirrorLayer->getHandle(); + captureArgs.layerHandle = mirrorParent->getHandle(); captureArgs.sourceCrop = childBounds; std::unique_ptr<ScreenCapture> shot; ScreenCapture::captureLayers(&shot, captureArgs); |