diff options
| author | 2022-02-02 10:01:25 -0800 | |
|---|---|---|
| committer | 2022-02-11 08:43:39 -0800 | |
| commit | 685cfefb624ec9414cf3c1bb2de1f8fbadefc0dd (patch) | |
| tree | 833214c4f4ea5bb295724500707d9bb612f433aa /libs/gui/LayerState.cpp | |
| parent | ea17733868104b139916717f0541f69f8768b3d7 (diff) | |
TransactionTracing: Introduce FlingerDataMapper
Allow the proto parser to handle dependencies
that are external to layer via a clear interface.
This is needed to make sure the parser can map
handles to ids, get buffer info from cached buffers
or inject fake buffers in transactions to recreate
the layer's internal state.
Test: presubmit
Bug: 200284593
Change-Id: I830048a560945cce088d7276e764c953f408e0d3
Diffstat (limited to 'libs/gui/LayerState.cpp')
| -rw-r--r-- | libs/gui/LayerState.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index eec4a874b9..9022e7d5a4 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -35,7 +35,9 @@ using gui::FocusRequest; using gui::WindowInfoHandle; layer_state_t::layer_state_t() - : what(0), + : surface(nullptr), + layerId(-1), + what(0), x(0), y(0), z(0), @@ -153,8 +155,12 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeBool, isTrustedOverlay); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); - SAFE_PARCEL(output.writeNullableParcelable, - bufferData ? std::make_optional<BufferData>(*bufferData) : std::nullopt); + + const bool hasBufferData = (bufferData != nullptr); + SAFE_PARCEL(output.writeBool, hasBufferData); + if (hasBufferData) { + SAFE_PARCEL(output.writeParcelable, *bufferData); + } return NO_ERROR; } @@ -264,9 +270,15 @@ status_t layer_state_t::read(const Parcel& input) uint32_t mode; SAFE_PARCEL(input.readUint32, &mode); dropInputMode = static_cast<gui::DropInputMode>(mode); - std::optional<BufferData> tmpBufferData; - SAFE_PARCEL(input.readParcelable, &tmpBufferData); - bufferData = tmpBufferData ? std::make_shared<BufferData>(*tmpBufferData) : nullptr; + + bool hasBufferData; + SAFE_PARCEL(input.readBool, &hasBufferData); + if (hasBufferData) { + bufferData = std::make_shared<BufferData>(); + SAFE_PARCEL(input.readParcelable, bufferData.get()); + } else { + bufferData = nullptr; + } return NO_ERROR; } |