Fix output stream creation in layertracegenerator
layertracegenerator creates the output layers trace file specifying
std::ios::app (append mode). Meaning, if an output file already exists
layertracegenerator appends the new layers trace to it.
This commit solves the issue replacing std::ios::app with std::ios::out.
Bug: 301539901
Test: execute multiple times \
adb shell layertracegenerator transaction.winscope test.winscope
and make sure the size of test.winscope remains constant \
and doesn't increase after each execution of layertracegenerator
Change-Id: I23bf4e689cee450b055a0451aa0301ce34131739
diff --git a/services/surfaceflinger/Tracing/tools/main.cpp b/services/surfaceflinger/Tracing/tools/main.cpp
index 65e8479..698ef06 100644
--- a/services/surfaceflinger/Tracing/tools/main.cpp
+++ b/services/surfaceflinger/Tracing/tools/main.cpp
@@ -50,7 +50,7 @@
const auto* outputLayersTracePath =
(argc == 3) ? argv[2] : "/data/misc/wmtrace/layers_trace.winscope";
- auto outStream = std::ofstream{outputLayersTracePath, std::ios::binary | std::ios::app};
+ auto outStream = std::ofstream{outputLayersTracePath, std::ios::binary | std::ios::out};
auto layerTracing = LayerTracing{outStream};