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
diff --git a/include/gui/SurfaceControl.h b/include/gui/SurfaceControl.h
index 8d338f9..58ec6dc 100644
--- a/include/gui/SurfaceControl.h
+++ b/include/gui/SurfaceControl.h
@@ -93,6 +93,18 @@
// Reparents all children of this layer to the new parent handle.
status_t reparentChildren(const sp<IBinder>& newParentHandle);
+ // Detaches all child surfaces (and their children recursively)
+ // from their SurfaceControl.
+ // The child SurfaceControl's will not throw exceptions or return errors,
+ // but transactions will have no effect.
+ // The child surfaces will continue to follow their parent surfaces,
+ // and remain eligible for rendering, but their relative state will be
+ // frozen. We use this in the WindowManager, in app shutdown/relaunch
+ // scenarios, where the app would otherwise clean up its child Surfaces.
+ // Sometimes the WindowManager needs to extend their lifetime slightly
+ // in order to perform an exit animation or prevent flicker.
+ status_t detachChildren();
+
// Set an override scaling mode as documented in <system/window.h>
// the override scaling mode will take precedence over any client
// specified scaling mode. -1 will clear the override scaling mode.