atrace: only start trace when starting trace

Bug: 74396309
Test: atrace --async_stop > trace
Change-Id: I50a2bc224d6c48aa7cecf69a57b30c8ccc88b9e0
Merged-In: I50a2bc224d6c48aa7cecf69a57b30c8ccc88b9e0
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 898aa90..57745ef 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -1221,8 +1221,10 @@
     }
 
     bool ok = true;
-    ok &= setUpTrace();
-    ok &= startTrace();
+    if (traceStart) {
+        ok &= setUpTrace();
+        ok &= startTrace();
+    }
 
     if (ok && traceStart) {
         if (!traceStream) {