SF: Make BufferData mockable
Expose GraphicBuffer properties through the BufferData
class so we can inject fake GraphicBuffers in transactions.
This is required to recreate layer state from transaction
traces without actually allocating buffers.
Test: compiles
Bug: 200284593
Change-Id: I74036cba1f544cbd045489fa5337d59ae4bdebcb
diff --git a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
index 16d4b59..1ce0309 100644
--- a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
@@ -434,9 +434,10 @@
static ComposerState createComposerState(int layerId, sp<Fence> fence,
uint32_t stateFlags = layer_state_t::eBufferChanged) {
ComposerState composer_state;
- composer_state.state.bufferData.acquireFence = std::move(fence);
+ composer_state.state.bufferData = std::make_shared<BufferData>();
+ composer_state.state.bufferData->acquireFence = std::move(fence);
composer_state.state.layerId = layerId;
- composer_state.state.bufferData.flags = BufferData::BufferDataChange::fenceChanged;
+ composer_state.state.bufferData->flags = BufferData::BufferDataChange::fenceChanged;
composer_state.state.flags = stateFlags;
return composer_state;
}