Update SF dump to use proto3
The C++ implementation of Proto2 writes default values to the protobuf object, whenever they are set in the app. That is, if we write 0 into an integer or float field, the protobuf writes the value 0 in the object.
Proto3 skips default values, even if they are set.
Changing from proto2 to proto3 reduces by ~20% the memory requirement for storing SF traces. It also allows default values to be ignored in Winscope
Test: Record a SF trace. Flash a device. Record another SF trace. Check the trace size and/or open them in winscope version with "display defaults" unchecked.
Change-Id: I69ff09d141f6f31f22a4f5fc90bf58cf222d9aae
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 51e1f00..26a09e7 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2125,11 +2125,15 @@
auto parent = useDrawing ? mDrawingParent.promote() : mCurrentParent.promote();
if (parent != nullptr) {
layerInfo->set_parent(parent->sequence);
+ } else {
+ layerInfo->set_parent(-1);
}
auto zOrderRelativeOf = state.zOrderRelativeOf.promote();
if (zOrderRelativeOf != nullptr) {
layerInfo->set_z_order_relative_of(zOrderRelativeOf->sequence);
+ } else {
+ layerInfo->set_z_order_relative_of(-1);
}
// XXX getBE().compositionInfo.mBuffer is not protected