Add layers to proto by traversing children
There are currently some layers that end up missing from the proto dumps
since their relativeOf layer has been deleted. That means the layers are
still in memory, but not traversable since we skip layers that have a
relativeOf when traversing. Instead, we can traverse the children
directly.
Test: Layers will missing relativeOf are adding to proto
Change-Id: I571ef677de0544dfe7459080cf97ff193e8666e6
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 6fd1629..5386644 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1893,6 +1893,16 @@
setTransactionFlags(eTransactionNeeded);
}
+void Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) const {
+ LayerProto* layerProto = layersProto.add_layers();
+ writeToProtoDrawingState(layerProto, traceFlags);
+ writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags);
+
+ for (const sp<Layer>& layer : mDrawingChildren) {
+ layer->writeToProto(layersProto, traceFlags);
+ }
+}
+
void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags) const {
ui::Transform transform = getTransform();
@@ -2014,6 +2024,8 @@
} else {
layerInfo->set_z_order_relative_of(-1);
}
+
+ layerInfo->set_is_relative_of(state.isRelativeOf);
}
if (traceFlags & SurfaceTracing::TRACE_INPUT) {