Add LayerId to SurfaceControl and LayerState when created
Allows us to then dump the LayerState on transaction merges and have an id to associate the LayerState with a layer
Test: Check if layer id is available in the LayerState when we dump the LayerState on merges
Change-Id: I5046835d6a82574110125c7dbdf2098bd10ac296
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 6e153d9..e37ff89 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -46,11 +46,12 @@
// ============================================================================
SurfaceControl::SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle,
- const sp<IGraphicBufferProducer>& gbp,
+ const sp<IGraphicBufferProducer>& gbp, int32_t layerId,
uint32_t transform)
: mClient(client),
mHandle(handle),
mGraphicBufferProducer(gbp),
+ mLayerId(layerId),
mTransformHint(transform) {}
SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) {
@@ -58,6 +59,7 @@
mHandle = other->mHandle;
mGraphicBufferProducer = other->mGraphicBufferProducer;
mTransformHint = other->mTransformHint;
+ mLayerId = other->mLayerId;
}
SurfaceControl::~SurfaceControl()
@@ -148,6 +150,10 @@
return mHandle;
}
+int32_t SurfaceControl::getLayerId() const {
+ return mLayerId;
+}
+
sp<IGraphicBufferProducer> SurfaceControl::getIGraphicBufferProducer() const
{
Mutex::Autolock _l(mLock);
@@ -173,6 +179,7 @@
SAFE_PARCEL(parcel.writeStrongBinder, ISurfaceComposerClient::asBinder(mClient->getClient()));
SAFE_PARCEL(parcel.writeStrongBinder, mHandle);
SAFE_PARCEL(parcel.writeStrongBinder, IGraphicBufferProducer::asBinder(mGraphicBufferProducer));
+ SAFE_PARCEL(parcel.writeInt32, mLayerId);
SAFE_PARCEL(parcel.writeUint32, mTransformHint);
return NO_ERROR;
@@ -183,18 +190,20 @@
sp<IBinder> client;
sp<IBinder> handle;
sp<IBinder> gbp;
+ int32_t layerId;
uint32_t transformHint;
SAFE_PARCEL(parcel.readStrongBinder, &client);
SAFE_PARCEL(parcel.readStrongBinder, &handle);
SAFE_PARCEL(parcel.readNullableStrongBinder, &gbp);
+ SAFE_PARCEL(parcel.readInt32, &layerId);
SAFE_PARCEL(parcel.readUint32, &transformHint);
// We aren't the original owner of the surface.
*outSurfaceControl =
new SurfaceControl(new SurfaceComposerClient(
interface_cast<ISurfaceComposerClient>(client)),
- handle.get(), interface_cast<IGraphicBufferProducer>(gbp),
+ handle.get(), interface_cast<IGraphicBufferProducer>(gbp), layerId,
transformHint);
return NO_ERROR;