Use CacheId when buffer is null.

It's likely the buffer is null even if eBufferChanged is set because we
already cached the buffer. This can happen when the transaction is sent
over IPC and we automatically cache the buffer.

This change uses the cacheId if the buffer is null

Test: Hard to repro
Bug: 225815507
Change-Id: Ic95bfc179cc86e494943e9bd6e15cb9afd69f1df
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 49b669e..34db5b1 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -774,7 +774,13 @@
 }; // namespace gui
 
 ReleaseCallbackId BufferData::generateReleaseCallbackId() const {
-    return {buffer->getId(), frameNumber};
+    uint64_t bufferId;
+    if (buffer) {
+        bufferId = buffer->getId();
+    } else {
+        bufferId = cachedBuffer.id;
+    }
+    return {bufferId, frameNumber};
 }
 
 status_t BufferData::writeToParcel(Parcel* output) const {