summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Client.cpp
diff options
context:
space:
mode:
author Rob Carr <racarr@google.com> 2017-01-25 19:14:27 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-01-25 19:14:27 +0000
commite895863cca8c23bd65d2d21211f81e457b48416d (patch)
tree66e8aca52cd3f9c996e7751526e97800aa74be99 /services/surfaceflinger/Client.cpp
parent2a03c32a4e9089e941335cb496a21509ab5ba5ec (diff)
parent1f0a16a5d7cd00ba7fda82e7d315afa1fd1303b9 (diff)
Merge changes I96f8ad86,I84dcd82e,Ifcece69f
* changes: SurfaceFlinger and libgui: Support for child layers. SurfaceFlinger: Use traversal functions to iterate LayerList. SurfaceFlinger and libgui: Switch Z-order to signed type.
Diffstat (limited to 'services/surfaceflinger/Client.cpp')
-rw-r--r--services/surfaceflinger/Client.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index e14a59b46d..7e04fda6de 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -106,14 +106,22 @@ status_t Client::onTransact(
status_t Client::createSurface(
const String8& name,
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags,
+ const sp<IBinder>& parentHandle,
sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp)
{
+ sp<Layer> parent = nullptr;
+ if (parentHandle != nullptr) {
+ parent = getLayerUser(parentHandle);
+ if (parent == nullptr) {
+ return NAME_NOT_FOUND;
+ }
+ }
+
/*
* createSurface must be called from the GL thread so that it can
* have access to the GL context.
*/
-
class MessageCreateLayer : public MessageBase {
SurfaceFlinger* flinger;
Client* client;
@@ -124,26 +132,29 @@ status_t Client::createSurface(
uint32_t w, h;
PixelFormat format;
uint32_t flags;
+ sp<Layer>* parent;
public:
MessageCreateLayer(SurfaceFlinger* flinger,
const String8& name, Client* client,
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags,
sp<IBinder>* handle,
- sp<IGraphicBufferProducer>* gbp)
+ sp<IGraphicBufferProducer>* gbp,
+ sp<Layer>* parent)
: flinger(flinger), client(client),
handle(handle), gbp(gbp), result(NO_ERROR),
- name(name), w(w), h(h), format(format), flags(flags) {
+ name(name), w(w), h(h), format(format), flags(flags),
+ parent(parent) {
}
status_t getResult() const { return result; }
virtual bool handler() {
result = flinger->createLayer(name, client, w, h, format, flags,
- handle, gbp);
+ handle, gbp, parent);
return true;
}
};
sp<MessageBase> msg = new MessageCreateLayer(mFlinger.get(),
- name, this, w, h, format, flags, handle, gbp);
+ name, this, w, h, format, flags, handle, gbp, &parent);
mFlinger->postMessageSync(msg);
return static_cast<MessageCreateLayer*>( msg.get() )->getResult();
}