SF: Cleanup layer construction
Introduce a LayerCreationArg parameter object, and modify all layer
types to use it rather than having the same set of four arguments.
Along the way simplify all constructors by moving to C++11 style default
values defined in the header, and ensure the destructor is defined in
the implementation file (as a default for most layer types, as only
BufferLayer needs a non-default destructor).
Using a uniform parameter object reduces the amount of work needed to
maintain the upcoming factory interface.
Test: Works on marlin.
Test: atest libsurfaceflinger_unittest
Change-Id: Ic09291fd3213ff980bfc600166bf798ba09daa32
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
index 521cdbf..17706b5 100644
--- a/services/surfaceflinger/BufferQueueLayer.cpp
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -21,24 +21,9 @@
namespace android {
-BufferQueueLayer::BufferQueueLayer(SurfaceFlinger* flinger, const sp<Client>& client,
- const String8& name, uint32_t w, uint32_t h, uint32_t flags)
- : BufferLayer(flinger, client, name, w, h, flags),
- mConsumer(nullptr),
- mProducer(nullptr),
- mFormat(PIXEL_FORMAT_NONE),
- mPreviousFrameNumber(0),
- mUpdateTexImageFailed(false),
- mQueueItemLock(),
- mQueueItemCondition(),
- mQueueItems(),
- mLastFrameNumberReceived(0),
- mAutoRefresh(false),
- mActiveBufferSlot(BufferQueue::INVALID_BUFFER_SLOT),
- mQueuedFrames(0),
- mSidebandStreamChanged(false) {
- mCurrentState.requested_legacy = mCurrentState.active_legacy;
-}
+BufferQueueLayer::BufferQueueLayer(const LayerCreationArgs& args) : BufferLayer(args) {}
+
+BufferQueueLayer::~BufferQueueLayer() = default;
// -----------------------------------------------------------------------
// Interface implementation for Layer