Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9679086f authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Update mirror layer tests to support detach mirror flag" into main

parents da0a3cfb 422b81cb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
}

+20 −2
Original line number Diff line number Diff line
@@ -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);