diff options
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index c2be6eb751..ece07a33fb 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -170,6 +170,9 @@ public: status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, const sp<IBinder>& handle, uint64_t frameNumber); + status_t reparentChildren(const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id, + const sp<IBinder>& newParentHandle); status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, int32_t overrideScalingMode); status_t setGeometryAppliesWithResize(const sp<SurfaceComposerClient>& client, @@ -455,6 +458,20 @@ status_t Composer::deferTransactionUntil( return NO_ERROR; } +status_t Composer::reparentChildren( + const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id, + const sp<IBinder>& newParentHandle) { + Mutex::Autolock lock(mLock); + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) { + return BAD_INDEX; + } + s->what |= layer_state_t::eReparentChildren; + s->reparentHandle = newParentHandle; + return NO_ERROR; +} + status_t Composer::setOverrideScalingMode( const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, int32_t overrideScalingMode) { @@ -564,10 +581,18 @@ SurfaceComposerClient::SurfaceComposerClient() { } +SurfaceComposerClient::SurfaceComposerClient(const sp<IGraphicBufferProducer>& root) + : mStatus(NO_INIT), mComposer(Composer::getInstance()), mParent(root) +{ +} + void SurfaceComposerClient::onFirstRef() { sp<ISurfaceComposer> sm(ComposerService::getComposerService()); if (sm != 0) { - sp<ISurfaceComposerClient> conn = sm->createConnection(); + auto rootProducer = mParent.promote(); + sp<ISurfaceComposerClient> conn; + conn = (rootProducer != nullptr) ? sm->createScopedConnection(rootProducer) : + sm->createConnection(); if (conn != 0) { mClient = conn; mStatus = NO_ERROR; @@ -768,6 +793,11 @@ status_t SurfaceComposerClient::deferTransactionUntil(const sp<IBinder>& id, return getComposer().deferTransactionUntil(this, id, handle, frameNumber); } +status_t SurfaceComposerClient::reparentChildren(const sp<IBinder>& id, + const sp<IBinder>& newParentHandle) { + return getComposer().reparentChildren(this, id, newParentHandle); +} + status_t SurfaceComposerClient::setOverrideScalingMode( const sp<IBinder>& id, int32_t overrideScalingMode) { return getComposer().setOverrideScalingMode( |