diff options
author | 2017-02-13 11:32:32 -0800 | |
---|---|---|
committer | 2017-02-27 10:21:55 -0800 | |
commit | 9524cb3b37a91b5741790c77ff24fd825b02bca7 (patch) | |
tree | be35f6724ed74a7ebb4f0deb424d903eb1f96159 /libs/gui/SurfaceComposerClient.cpp | |
parent | 0d48072f6047140119ff194c1194ce402fca2c0b (diff) |
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
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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<SurfaceComposerClient>& client, const sp<IBinder>& id, const sp<IBinder>& newParentHandle); + status_t detachChildren(const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id); status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, int32_t overrideScalingMode); status_t setGeometryAppliesWithResize(const sp<SurfaceComposerClient>& client, @@ -476,6 +478,18 @@ status_t Composer::reparentChildren( return NO_ERROR; } +status_t Composer::detachChildren( + const sp<SurfaceComposerClient>& client, + const sp<IBinder>& 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<SurfaceComposerClient>& client, const sp<IBinder>& id, int32_t overrideScalingMode) { @@ -805,6 +819,10 @@ status_t SurfaceComposerClient::reparentChildren(const sp<IBinder>& id, return getComposer().reparentChildren(this, id, newParentHandle); } +status_t SurfaceComposerClient::detachChildren(const sp<IBinder>& id) { + return getComposer().detachChildren(this, id); +} + status_t SurfaceComposerClient::setOverrideScalingMode( const sp<IBinder>& id, int32_t overrideScalingMode) { return getComposer().setOverrideScalingMode( |