From 32cae4a1a95d8b8d4c09c70b3b6fd7f53cbce374 Mon Sep 17 00:00:00 2001 From: Marissa Wall Date: Tue, 8 Jan 2019 10:08:52 -0800 Subject: blast: create SurfaceControl from Surface parent Create a child SurfaceControl from a parent Surface. This is done by sending the parent IGBP to SurfaceFlinger who gets the parent Layer information. This is change is necessary for public SurfaceControl because createScopedConnection is deprecated. Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTest Bug: 80477568 Change-Id: Id05ac58a6f2dcbb64ff8f8f67f80aaab556614b3 --- libs/gui/SurfaceComposerClient.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 824e43fb07..cee9153cf3 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -972,6 +972,29 @@ sp SurfaceComposerClient::createSurface( return s; } +sp SurfaceComposerClient::createWithSurfaceParent(const String8& name, uint32_t w, + uint32_t h, PixelFormat format, + uint32_t flags, Surface* parent, + int32_t windowType, + int32_t ownerUid) { + sp sur; + status_t err = mStatus; + + if (mStatus == NO_ERROR) { + sp handle; + sp parentGbp = parent->getIGraphicBufferProducer(); + sp gbp; + + err = mClient->createWithSurfaceParent(name, w, h, format, flags, parentGbp, windowType, + ownerUid, &handle, &gbp); + ALOGE_IF(err, "SurfaceComposerClient::createWithSurfaceParent error %s", strerror(-err)); + if (err == NO_ERROR) { + return new SurfaceControl(this, handle, gbp, true /* owned */); + } + } + return nullptr; +} + status_t SurfaceComposerClient::createSurfaceChecked( const String8& name, uint32_t w, @@ -1134,6 +1157,7 @@ status_t SurfaceComposerClient::getDisplayedContentSample(const sp& dis return ComposerService::getComposerService()->getDisplayedContentSample(display, maxFrames, timestamp, outStats); } + // ---------------------------------------------------------------------------- status_t ScreenshotClient::capture(const sp& display, const ui::Dataspace reqDataSpace, -- cgit v1.2.3-59-g8ed1b