summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceComposerClient.cpp
diff options
context:
space:
mode:
author Marissa Wall <marissaw@google.com> 2019-01-08 10:08:52 -0800
committer Marissa Wall <marissaw@google.com> 2019-01-10 09:29:39 -0800
commit35187b32107eff2ded94adf29c19192524537ee1 (patch)
treeb5e7d6dcfd95e6087ffa3644f982e434fe0cf467 /libs/gui/SurfaceComposerClient.cpp
parent6e1ceefbba451a2778c192044ead4bd8add9f394 (diff)
blast: [FIXED] 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. [Previous version used Layer::mStateMutex which was removed hours before this patch went in. Presubmit did not catch the conflict so the patch was immediately reverted. This version does not have that conflict.] Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTest Bug: 80477568 Change-Id: Ibbfb2851ff71c21cce1761cab434b85735e35515
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r--libs/gui/SurfaceComposerClient.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 6c39d6f1b8..8b9e4d7fee 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -977,6 +977,29 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface(
return s;
}
+sp<SurfaceControl> 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<SurfaceControl> sur;
+ status_t err = mStatus;
+
+ if (mStatus == NO_ERROR) {
+ sp<IBinder> handle;
+ sp<IGraphicBufferProducer> parentGbp = parent->getIGraphicBufferProducer();
+ sp<IGraphicBufferProducer> 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,
@@ -1132,6 +1155,7 @@ status_t SurfaceComposerClient::getDisplayedContentSample(const sp<IBinder>& dis
return ComposerService::getComposerService()->getDisplayedContentSample(display, maxFrames,
timestamp, outStats);
}
+
// ----------------------------------------------------------------------------
status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace,