Replace releaseCallbackId with generateReleaseCallbackId in BufferData

releaseCallbackId was confusing data in BufferData because it wasn't
being parceled, even though the rest of the object was. This is because
the ReleaseCallbackId can be generated from info in BufferData.
Therefore, remove releaseCallbackId and instead replace with a function
that generates the ReleaseCallbackId

This fixes an issue when Transactions that contained buffers for the
same layer were being merged. The merge was expected to release the old
buffer. However, if the Transaction was parceled before it was merged,
the ReleaseCallbackId would be lost and the release callback would send
an invalid callback id, resulting in a lost buffer that never got
released. By using generateReleaseCallbackId, the callback id is
recreated when the release callback needs to be invoked since the
buffer and framenumber are already being parceled.

Test: ReleaseBufferCallbackTest
Test: AppConfigurationTests
Bug: 209920544
Change-Id: I2a24b8a9764959173c960048dc82e68f4c083898
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index ec0573a..acd9ac5 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -677,6 +677,10 @@
     return NO_ERROR;
 }
 
+ReleaseCallbackId BufferData::generateReleaseCallbackId() const {
+    return {buffer->getId(), frameNumber};
+}
+
 status_t BufferData::write(Parcel& output) const {
     SAFE_PARCEL(output.writeInt32, flags.get());