Added a name to Surface created by SurfaceFlinger
Updated the window manager to use this new facility.
Surfaces name are now printed by "dumpsys".
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index 4555b3c..66ac4d2 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -1186,7 +1186,7 @@
}
sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,
- ISurfaceFlingerClient::surface_data_t* params,
+ const String8& name, ISurfaceFlingerClient::surface_data_t* params,
DisplayID d, uint32_t w, uint32_t h, PixelFormat format,
uint32_t flags)
{
@@ -1232,6 +1232,7 @@
}
if (layer != 0) {
+ layer->setName(name);
setTransactionFlags(eTransactionNeeded);
surfaceHandle = layer->getSurface();
if (surfaceHandle != 0) {
@@ -1506,8 +1507,10 @@
if (lbc != 0) {
sp<Client> client(lbc->client.promote());
snprintf(buffer, SIZE,
- " "
- "id=0x%08x, client=0x%08x, identity=%u\n",
+ " name=%s\n", lbc->getName().string());
+ result.append(buffer);
+ snprintf(buffer, SIZE,
+ " id=0x%08x, client=0x%08x, identity=%u\n",
lbc->clientIndex(), client.get() ? client->cid : 0,
lbc->getIdentity());
@@ -1760,10 +1763,12 @@
sp<ISurface> BClient::createSurface(
ISurfaceFlingerClient::surface_data_t* params, int pid,
+ const String8& name,
DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
uint32_t flags)
{
- return mFlinger->createSurface(mId, pid, params, display, w, h, format, flags);
+ return mFlinger->createSurface(mId, pid, name, params, display, w, h,
+ format, flags);
}
status_t BClient::destroySurface(SurfaceID sid)