service: allow bugreports to steal write_into_file traces

This is a follow-up to aosp/1515497. Previously we didn't
allow the --save-for-bugreport feature to steal traces
marked as write_into_file. That was because a trace
might have been partially written on disk and that would
make the bugreport re-routing more difficult (also
undesitable given those traces can be ~GB).
This CL softens the check allowing to steal also those
traces, but only if no data has been written yet.
The problem is that Traceur (System Tracing App), uses
write_into_file && --detach both for long and ring-buffer
traces (to keep the code path more uniform).
In ring-buffer mode, traceur sets the file_write_period_ms
to 7days (which really means, only save at the end), to
maintain the ring-buffer behavior.
The alternative would be a more invasive change to traceur
AND making our cmdline more awkward, as we would have to
support both "--detach + path, but only if write_into_file"
and "--attach + path, but only if !write_into_file"

Bug: 175591887
Bug: 170334305
Test: perfetto_integrationtests --gtest_filter=PerfettoTest.SaveForBugreport*
Change-Id: I9b3dbb2c1c27e80af3c25eba35ac8fc0d3992a6a
3 files changed
tree: bf3fdf4c2437e919ca898360a3cef782100ab48c
  1. .github/
  2. bazel/
  3. build_overrides/
  4. buildtools/
  5. debian/
  6. docs/
  7. examples/
  8. gn/
  9. include/
  10. infra/
  11. protos/
  12. src/
  13. test/
  14. tools/
  15. ui/
  16. .clang-format
  17. .clang-tidy
  18. .gitattributes
  19. .gitignore
  20. .gn
  21. .style.yapf
  22. Android.bp
  23. Android.bp.extras
  24. BUILD
  25. BUILD.extras
  26. BUILD.gn
  27. CHANGELOG
  28. codereview.settings
  29. heapprofd.rc
  30. LICENSE
  31. METADATA
  32. MODULE_LICENSE_APACHE2
  33. OWNERS
  34. perfetto.rc
  35. PRESUBMIT.py
  36. README.chromium
  37. README.md
  38. TEST_MAPPING
  39. traced_perf.rc
  40. WORKSPACE
README.md

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.