From 9524cb3b37a91b5741790c77ff24fd825b02bca7 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 13 Feb 2017 11:32:32 -0800 Subject: Add detachChildren transaction. Add SurfaceControl#detachChildren for use by the WindowManager. This method is used in cases where the WM would previously preserve windows the client tried to destroy. For example, when becoming invisible (in the activity lifecycle sense, not in the SurfaceFlinger sense) an app will destroy its child surfaces. Previously the WM would keep child windows alive until the animation finishes to prevent glitches. The new scheme for this is the WM will detach the children at this point, at which point the parent layer becomes the owner of the children and the WM can control the lifecycle as it wishes. I also included a test for reparentChildren as I realized I had forgotten that. Test: New test in Transaction_test.cpp Change-Id: I79c22b2ccccceb9bdcc37b70c491bdf33dcf83d2 --- libs/gui/SurfaceComposerClient.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index fd277f1beb..2632781982 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -175,6 +175,8 @@ public: status_t reparentChildren(const sp& client, const sp& id, const sp& newParentHandle); + status_t detachChildren(const sp& client, + const sp& id); status_t setOverrideScalingMode(const sp& client, const sp& id, int32_t overrideScalingMode); status_t setGeometryAppliesWithResize(const sp& client, @@ -476,6 +478,18 @@ status_t Composer::reparentChildren( return NO_ERROR; } +status_t Composer::detachChildren( + const sp& client, + const sp& id) { + Mutex::Autolock lock(mLock); + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) { + return BAD_INDEX; + } + s->what |= layer_state_t::eDetachChildren; + return NO_ERROR; +} + status_t Composer::setOverrideScalingMode( const sp& client, const sp& id, int32_t overrideScalingMode) { @@ -805,6 +819,10 @@ status_t SurfaceComposerClient::reparentChildren(const sp& id, return getComposer().reparentChildren(this, id, newParentHandle); } +status_t SurfaceComposerClient::detachChildren(const sp& id) { + return getComposer().detachChildren(this, id); +} + status_t SurfaceComposerClient::setOverrideScalingMode( const sp& id, int32_t overrideScalingMode) { return getComposer().setOverrideScalingMode( -- cgit v1.2.3-59-g8ed1b