From fe94a225a556265e93b1ebfe520d3637fe7cc67d Mon Sep 17 00:00:00 2001 From: chaviw Date: Wed, 21 Aug 2019 13:52:59 -0700 Subject: [Mirror Layers] Added mirrorSurface API to enable mirroring (3/4) Added a new SurfaceComposer API called mirrorSurface that allows a client to request a mirror of a particular heirarchy starting from the passed in layer. The API will return a SurfaceControl that's the parent of the mirrored layer that can be updated by the client. Test: MirrorLayerTest Bug: 131622422 Change-Id: Ia6047f0334eabfc59d6222b2edfd4e9576ba31e5 --- libs/gui/SurfaceComposerClient.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 547e5f1be2..7b256f5c02 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1505,6 +1505,20 @@ status_t SurfaceComposerClient::createSurfaceChecked(const String8& name, uint32 return err; } +sp SurfaceComposerClient::mirrorSurface(SurfaceControl* mirrorFromSurface) { + if (mirrorFromSurface == nullptr) { + return nullptr; + } + + sp handle; + sp mirrorFromHandle = mirrorFromSurface->getHandle(); + status_t err = mClient->mirrorSurface(mirrorFromHandle, &handle); + if (err == NO_ERROR) { + return new SurfaceControl(this, handle, nullptr, true /* owned */); + } + return nullptr; +} + status_t SurfaceComposerClient::clearLayerFrameStats(const sp& token) const { if (mStatus != NO_ERROR) { return mStatus; -- cgit v1.2.3-59-g8ed1b