SF TimeStats: move dumpStats into TimeStatsHelper

Move dumpStats into TimeStatsHelper to make the TimeStatsHelper class
more modularized.

Test: dumpsys SurfaceFlinger --timestats <see go/sf-timestats for args>
Bug: b/70388650
Change-Id: Ie828d9b4c47aae54df5851e0febb8f48d34b78c8
diff --git a/services/surfaceflinger/TimeStats/TimeStats.h b/services/surfaceflinger/TimeStats/TimeStats.h
index f76a62e..b9016a1 100644
--- a/services/surfaceflinger/TimeStats/TimeStats.h
+++ b/services/surfaceflinger/TimeStats/TimeStats.h
@@ -26,6 +26,7 @@
 #include <utils/Vector.h>
 
 #include <mutex>
+#include <optional>
 #include <unordered_map>
 #include <vector>
 
@@ -90,9 +91,7 @@
     void disable();
     void clear();
     bool isEnabled();
-    void dump(bool asProto, uint32_t maxLayer, String8& result);
-    void dumpAsTextLocked(String8& result);
-    void dumpAsProtoLocked(String8& result);
+    void dump(bool asProto, std::optional<uint32_t> maxLayers, String8& result);
 
     std::atomic<bool> mEnabled = false;
     std::mutex mMutex;