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/SurfaceControl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libs/gui/SurfaceControl.cpp') diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 94094e5a51..0080ff9812 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -183,6 +183,12 @@ status_t SurfaceControl::reparentChildren(const sp& newParentHandle) { return mClient->reparentChildren(mHandle, newParentHandle); } +status_t SurfaceControl::detachChildren() { + status_t err = validate(); + if (err < 0) return err; + return mClient->detachChildren(mHandle); +} + status_t SurfaceControl::setOverrideScalingMode(int32_t overrideScalingMode) { status_t err = validate(); if (err < 0) return err; -- cgit v1.2.3-59-g8ed1b