diff options
Diffstat (limited to 'services/surfaceflinger/tests/MirrorLayer_test.cpp')
-rw-r--r-- | services/surfaceflinger/tests/MirrorLayer_test.cpp | 60 |
1 files changed, 7 insertions, 53 deletions
diff --git a/services/surfaceflinger/tests/MirrorLayer_test.cpp b/services/surfaceflinger/tests/MirrorLayer_test.cpp index d02786504e..b49bd54599 100644 --- a/services/surfaceflinger/tests/MirrorLayer_test.cpp +++ b/services/surfaceflinger/tests/MirrorLayer_test.cpp @@ -18,9 +18,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wconversion" -#include <private/android_filesystem_config.h> #include "LayerTransactionTest.h" -#include "utils/TransactionUtils.h" namespace android { @@ -38,7 +36,7 @@ protected: asTransaction([&](Transaction& t) { t.setDisplayLayerStack(display, 0); t.setLayer(mParentLayer, INT32_MAX - 2).show(mParentLayer); - t.setCrop(mChildLayer, Rect(0, 0, 400, 400)).show(mChildLayer); + t.setCrop_legacy(mChildLayer, Rect(0, 0, 400, 400)).show(mChildLayer); t.setPosition(mChildLayer, 50, 50); t.setFlags(mParentLayer, layer_state_t::eLayerOpaque, layer_state_t::eLayerOpaque); t.setFlags(mChildLayer, layer_state_t::eLayerOpaque, layer_state_t::eLayerOpaque); @@ -60,7 +58,7 @@ TEST_F(MirrorLayerTest, MirrorColorLayer) { createColorLayer("Grandchild layer", Color::BLUE, mChildLayer.get()); Transaction() .setFlags(grandchild, layer_state_t::eLayerOpaque, layer_state_t::eLayerOpaque) - .setCrop(grandchild, Rect(0, 0, 200, 200)) + .setCrop_legacy(grandchild, Rect(0, 0, 200, 200)) .show(grandchild) .apply(); @@ -70,7 +68,7 @@ TEST_F(MirrorLayerTest, MirrorColorLayer) { // Add mirrorLayer as child of mParentLayer so it's shown on the display Transaction() - .reparent(mirrorLayer, mParentLayer) + .reparent(mirrorLayer, mParentLayer->getHandle()) .setPosition(mirrorLayer, 500, 500) .show(mirrorLayer) .apply(); @@ -129,7 +127,7 @@ TEST_F(MirrorLayerTest, MirrorColorLayer) { } // Add grandchild layer to offscreen layer - Transaction().reparent(grandchild, mChildLayer).apply(); + Transaction().reparent(grandchild, mChildLayer->getHandle()).apply(); { SCOPED_TRACE("Added Grandchild Layer"); auto shot = screenshot(); @@ -140,7 +138,7 @@ TEST_F(MirrorLayerTest, MirrorColorLayer) { } // Add child layer - Transaction().reparent(mChildLayer, mParentLayer).apply(); + Transaction().reparent(mChildLayer, mParentLayer->getHandle()).apply(); { SCOPED_TRACE("Added Child Layer"); auto shot = screenshot(); @@ -159,7 +157,7 @@ TEST_F(MirrorLayerTest, MirrorBufferLayer) { sp<SurfaceControl> mirrorLayer = mClient->mirrorSurface(mChildLayer.get()); Transaction() - .reparent(mirrorLayer, mParentLayer) + .reparent(mirrorLayer, mParentLayer->getHandle()) .setPosition(mirrorLayer, 500, 500) .show(mirrorLayer) .apply(); @@ -197,7 +195,7 @@ TEST_F(MirrorLayerTest, MirrorBufferLayer) { createLayer("BufferStateLayer", 200, 200, ISurfaceComposerClient::eFXSurfaceBufferState, mChildLayer.get()); fillBufferStateLayerColor(bufferStateLayer, Color::BLUE, 200, 200); - Transaction().show(bufferStateLayer).apply(); + Transaction().setFrame(bufferStateLayer, Rect(0, 0, 200, 200)).show(bufferStateLayer).apply(); { SCOPED_TRACE("Initial Mirror BufferStateLayer"); @@ -229,50 +227,6 @@ TEST_F(MirrorLayerTest, MirrorBufferLayer) { } } -// Test that the mirror layer is initially offscreen. -TEST_F(MirrorLayerTest, InitialMirrorState) { - const auto display = SurfaceComposerClient::getInternalDisplayToken(); - ui::DisplayMode mode; - SurfaceComposerClient::getActiveDisplayMode(display, &mode); - const ui::Size& size = mode.resolution; - - sp<SurfaceControl> mirrorLayer = nullptr; - { - // Run as system to get the ACCESS_SURFACE_FLINGER permission when mirroring - UIDFaker f(AID_SYSTEM); - // Mirror mChildLayer - mirrorLayer = mClient->mirrorSurface(mChildLayer.get()); - ASSERT_NE(mirrorLayer, nullptr); - } - - // Show the mirror layer, but don't reparent to a layer on screen. - Transaction() - .setPosition(mirrorLayer, 500, 500) - .show(mirrorLayer) - .setLayer(mirrorLayer, INT32_MAX - 1) - .apply(); - - { - SCOPED_TRACE("Offscreen Mirror"); - auto shot = screenshot(); - shot->expectColor(Rect(0, 0, size.getWidth(), 50), Color::RED); - shot->expectColor(Rect(0, 0, 50, size.getHeight()), Color::RED); - shot->expectColor(Rect(450, 0, size.getWidth(), size.getHeight()), Color::RED); - shot->expectColor(Rect(0, 450, size.getWidth(), size.getHeight()), Color::RED); - shot->expectColor(Rect(50, 50, 450, 450), Color::GREEN); - } - - // Add mirrorLayer as child of mParentLayer so it's shown on the display - Transaction().reparent(mirrorLayer, mParentLayer).apply(); - - { - SCOPED_TRACE("On Screen Mirror"); - auto shot = screenshot(); - // Child mirror - shot->expectColor(Rect(550, 550, 950, 950), Color::GREEN); - } -} - } // namespace android // TODO(b/129481165): remove the #pragma below and fix conversion issues |