summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceComposerClient.cpp
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2017-04-10 16:55:57 -0700
committer Robert Carr <racarr@google.com> 2017-04-12 12:48:05 -0700
commitdb66e627ad8904491e384c64f82fc77a939b9705 (patch)
tree28bde44d8ef5a51448b544b511539a41ba336828 /libs/gui/SurfaceComposerClient.cpp
parent1d472756aa06f17c34020c35d2f2a598dce69bfb (diff)
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
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r--libs/gui/SurfaceComposerClient.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 56c7586041..8c8384399c 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -149,6 +149,8 @@ public:
uint32_t w, uint32_t h);
status_t setLayer(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
int32_t z);
+ status_t setRelativeLayer(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
+ const sp<IBinder>& relativeTo, int32_t z);
status_t setFlags(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
uint32_t flags, uint32_t mask);
status_t setTransparentRegionHint(
@@ -343,6 +345,20 @@ status_t Composer::setLayer(const sp<SurfaceComposerClient>& client,
return NO_ERROR;
}
+status_t Composer::setRelativeLayer(const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id, const sp<IBinder>& relativeTo,
+ int32_t z) {
+ Mutex::Autolock _l(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s) {
+ return BAD_INDEX;
+ }
+ s->what |= layer_state_t::eRelativeLayerChanged;
+ s->relativeLayerHandle = relativeTo;
+ s->z = z;
+ return NO_ERROR;
+}
+
status_t Composer::setFlags(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, uint32_t flags,
uint32_t mask) {
@@ -760,6 +776,11 @@ status_t SurfaceComposerClient::setLayer(const sp<IBinder>& id, int32_t z) {
return getComposer().setLayer(this, id, z);
}
+status_t SurfaceComposerClient::setRelativeLayer(const sp<IBinder>& id,
+ const sp<IBinder>& relativeTo, int32_t z) {
+ return getComposer().setRelativeLayer(this, id, relativeTo, z);
+}
+
status_t SurfaceComposerClient::hide(const sp<IBinder>& id) {
return getComposer().setFlags(this, id,
layer_state_t::eLayerHidden,