From db66e627ad8904491e384c64f82fc77a939b9705 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 10 Apr 2017 16:55:57 -0700 Subject: SurfaceFlinger: Add parent-less relative layering. This is a temporary functionality for the intermediate state where not all child-surface like things in WM land are ported to use Child Surfaces. In particular, we have ported SurfaceView to use child surfaces and relative Z ordering. However the TV frameworks provide a View framework component which overlays views over the SurfaceView but below the main application window. Since we have not ported View framework surfaces to use child layers, there is nothing the WM or View Framework can do about this situation. Luckily the WM API's to have requested this are @hide but we have the one media framework component using it. In order to solve this issue we provide a method to set Z ordering relative to another window without inheriting its coordinate space as a child window would. This way the WM can recognize these TYPE_APPLICATION_MEDIA_OVERLAY windows and Z-order them at -1 with respect to the parents (and the SurfaceView can be at -2). Test: Included in transaction tests. Also manual test of bug repro steps with accomp frameworks/base CL Bug: 36693738 Change-Id: I921852d3d34f67f79ec745b9703f9e679867e7a1 --- include/gui/SurfaceControl.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include/gui/SurfaceControl.h') diff --git a/include/gui/SurfaceControl.h b/include/gui/SurfaceControl.h index 3cff7df260..712a323337 100644 --- a/include/gui/SurfaceControl.h +++ b/include/gui/SurfaceControl.h @@ -62,6 +62,27 @@ public: status_t setLayerStack(uint32_t layerStack); status_t setLayer(int32_t layer); + + // Sets a Z order relative to the Surface specified by "relativeTo" but + // without becoming a full child of the relative. Z-ordering works exactly + // as if it were a child however. + // + // As a nod to sanity, only non-child surfaces may have a relative Z-order. + // + // This overrides any previous and is overriden by any future calls + // to setLayer. + // + // If the relative dissapears, the Surface will have no layer and be + // invisible, until the next time set(Relative)Layer is called. + // + // TODO: This is probably a hack. Currently it exists only to work around + // some framework usage of the hidden APPLICATION_MEDIA_OVERLAY window type + // which allows inserting a window between a SurfaceView and it's main application + // window. However, since we are using child windows for the SurfaceView, but not using + // child windows elsewhere in O, the WindowManager can't set the layer appropriately. + // This is only used by the "TvInputService" and following the port of ViewRootImpl + // to child surfaces, we can then port this and remove this method. + status_t setRelativeLayer(const sp& relativeTo, int32_t layer); status_t setPosition(float x, float y); status_t setSize(uint32_t w, uint32_t h); status_t hide(); -- cgit v1.2.3-59-g8ed1b