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/layerproto/LayerProtoParser.cpp b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
index 5c72fea..7ab57f9 100644
--- a/services/surfaceflinger/layerproto/LayerProtoParser.cpp
+++ b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
@@ -199,13 +199,13 @@
}
}
- if (layerProto.has_parent()) {
+ if (layerProto.parent() != -1) {
if (layerMap.count(layerProto.parent()) > 0) {
currLayer->parent = layerMap[layerProto.parent()];
}
}
- if (layerProto.has_z_order_relative_of()) {
+ if (layerProto.z_order_relative_of() != -1) {
if (layerMap.count(layerProto.z_order_relative_of()) > 0) {
currLayer->zOrderRelativeOf = layerMap[layerProto.z_order_relative_of()];
}