summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Client.cpp
diff options
context:
space:
mode:
author Valerie Hau <vhau@google.com> 2019-12-20 11:39:23 -0800
committer Valerie Hau <vhau@google.com> 2019-12-24 03:00:02 +0000
commit6a8f8af9d0b28dac6231622ed3048e5cc7616d50 (patch)
tree051bef1192e7e2f5f62f238cd0f34f21a59d3052 /services/surfaceflinger/Client.cpp
parent6f548dc84c8c180a4de57ad467f0989d1d2d5da1 (diff)
RESTRICT AUTOMERGE: Fix removal of handle from map
Bug: 144667224, 137284057 Test: build, boot, SurfaceFlinger_test, libgui_test, manual Change-Id: Ie0f111a6b8f4424375cc124ccd2683f5bfad7759
Diffstat (limited to 'services/surfaceflinger/Client.cpp')
-rw-r--r--services/surfaceflinger/Client.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index 09d87b29d6..6b54a142e9 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -106,16 +106,16 @@ void Client::detachLayer(const Layer* layer)
}
}
}
-sp<Layer> Client::getLayerUser(const sp<IBinder>& handle) const
+
+bool Client::isAttached(const sp<IBinder>& handle) const
{
Mutex::Autolock _l(mLock);
sp<Layer> lbc;
wp<Layer> layer(mLayers.valueFor(handle));
if (layer != 0) {
- lbc = layer.promote();
- ALOGE_IF(lbc==0, "getLayerUser(name=%p) is dead", handle.get());
+ return true;
}
- return lbc;
+ return false;
}
status_t Client::onTransact(
@@ -150,7 +150,8 @@ status_t Client::createSurface(
sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp) {
bool parentDied;
- sp<Layer> parentLayer = getParentLayer(&parentDied);
+ sp<Layer> parentLayer;
+ if (!parentHandle) parentLayer = getParentLayer(&parentDied);
if (parentHandle == nullptr && parentDied) {
return NAME_NOT_FOUND;
}
@@ -163,21 +164,11 @@ status_t Client::destroySurface(const sp<IBinder>& handle) {
}
status_t Client::clearLayerFrameStats(const sp<IBinder>& handle) const {
- sp<Layer> layer = getLayerUser(handle);
- if (layer == nullptr) {
- return NAME_NOT_FOUND;
- }
- layer->clearFrameStats();
- return NO_ERROR;
+ return mFlinger->clearLayerFrameStats(this, handle);
}
status_t Client::getLayerFrameStats(const sp<IBinder>& handle, FrameStats* outStats) const {
- sp<Layer> layer = getLayerUser(handle);
- if (layer == nullptr) {
- return NAME_NOT_FOUND;
- }
- layer->getFrameStats(outStats);
- return NO_ERROR;
+ return mFlinger->getLayerFrameStats(this, handle, outStats);
}
// ---------------------------------------------------------------------------