From 35187b32107eff2ded94adf29c19192524537ee1 Mon Sep 17 00:00:00 2001 From: Marissa Wall Date: Tue, 8 Jan 2019 10:08:52 -0800 Subject: 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 --- services/surfaceflinger/Client.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'services/surfaceflinger/Client.cpp') diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp index 4f6fb1cca6..0e447d87f2 100644 --- a/services/surfaceflinger/Client.cpp +++ b/services/surfaceflinger/Client.cpp @@ -95,6 +95,26 @@ status_t Client::createSurface( ownerUid, handle, gbp, &parent); } +status_t Client::createWithSurfaceParent(const String8& name, uint32_t w, uint32_t h, + PixelFormat format, uint32_t flags, + const sp& parent, + int32_t windowType, int32_t ownerUid, sp* handle, + sp* gbp) { + if (mFlinger->authenticateSurfaceTexture(parent) == false) { + return BAD_VALUE; + } + + const auto& layer = (static_cast(parent.get()))->getLayer(); + if (layer == nullptr) { + return BAD_VALUE; + } + + sp parentHandle = layer->getHandle(); + + return createSurface(name, w, h, format, flags, parentHandle, windowType, ownerUid, handle, + gbp); +} + status_t Client::clearLayerFrameStats(const sp& handle) const { sp layer = getLayerUser(handle); if (layer == nullptr) { -- cgit v1.2.3-59-g8ed1b