From 94c7d3d948beff287eed53e6d841e29e05cad8b3 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 24 Apr 2018 12:30:47 -0700 Subject: SurfaceFlinger: Only update client parent if set. We use the idea of client with parents to allow applications to access SurfaceFlinger as long as they have an original "root" Surface granted to them from the WindowManager. Sometimes the WindowManager may reparent these child surfaces to a new surface, and so we need to update which Surface is providing this grant. However, if a client never had a root surface and is instead relying on ACCESS_SURFACE_FLINGER, e.g. the WindowManager we need to not reparent or we may end up making the client invalid when the Surface dies when we never intended to. Bug: 78301580 Bug: 62536731 Test: Manual repro of b/78301580 Change-Id: Ib18cfe86e1cec3da7808fcd01e2b7ce02bebff6d --- services/surfaceflinger/Layer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 66ad2f60a6..bbc974de2f 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1589,7 +1589,7 @@ bool Layer::reparentChildren(const sp& newParentHandle) { sp client(child->mClientRef.promote()); if (client != nullptr) { - client->setParentLayer(newParent); + client->updateParent(newParent); } } mCurrentChildren.clear(); @@ -1625,7 +1625,7 @@ bool Layer::reparent(const sp& newParentHandle) { sp newParentClient(newParent->mClientRef.promote()); if (client != newParentClient) { - client->setParentLayer(newParent); + client->updateParent(newParent); } return true; -- cgit v1.2.3-59-g8ed1b