blast: Send transaction listener from SCC to SF
Send the TransactionCompletedListeners to SurfaceFlinger via transactions.
The listener will be used to send callbacks after a transaction has completed.
Test: Transaction_test
Bug: 80477568
Change-Id: I51d3877f2803a192f95db4dd211f48aca9651c30
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 2b0a461..7b71b39 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -80,6 +80,13 @@
memcpy(output.writeInplace(16 * sizeof(float)),
colorTransform.asArray(), 16 * sizeof(float));
+ if (output.writeVectorSize(listenerCallbacks) == NO_ERROR) {
+ for (const auto& [listener, callbackIds] : listenerCallbacks) {
+ output.writeStrongBinder(IInterface::asBinder(listener));
+ output.writeInt64Vector(callbackIds);
+ }
+ }
+
return NO_ERROR;
}
@@ -135,6 +142,14 @@
colorTransform = mat4(static_cast<const float*>(input.readInplace(16 * sizeof(float))));
+ int32_t listenersSize = input.readInt32();
+ for (int32_t i = 0; i < listenersSize; i++) {
+ auto listener = interface_cast<ITransactionCompletedListener>(input.readStrongBinder());
+ std::vector<CallbackId> callbackIds;
+ input.readInt64Vector(&callbackIds);
+ listenerCallbacks.emplace_back(listener, callbackIds);
+ }
+
return NO_ERROR;
}
@@ -323,6 +338,10 @@
what |= eColorTransformChanged;
colorTransform = other.colorTransform;
}
+ if (other.what & eListenerCallbacksChanged) {
+ what |= eListenerCallbacksChanged;
+ listenerCallbacks = other.listenerCallbacks;
+ }
if ((other.what & what) != other.what) {
ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "