1 #pragma once 2 3 #ifndef ANDROID_TRACING 4 #define ANDROID_TRACING(FLAG) ANDROID_TRACING_##FLAG 5 #endif 6 7 #ifndef ANDROID_TRACING_CLIENT_SIDE_PROTO_LOGGING 8 #define ANDROID_TRACING_CLIENT_SIDE_PROTO_LOGGING false 9 #endif 10 #ifndef ANDROID_TRACING_PERFETTO_IME 11 #define ANDROID_TRACING_PERFETTO_IME true 12 #endif 13 #ifndef ANDROID_TRACING_PERFETTO_PROTOLOG_TRACING 14 #define ANDROID_TRACING_PERFETTO_PROTOLOG_TRACING true 15 #endif 16 #ifndef ANDROID_TRACING_PERFETTO_VIEW_CAPTURE_TRACING 17 #define ANDROID_TRACING_PERFETTO_VIEW_CAPTURE_TRACING true 18 #endif 19 #ifndef ANDROID_TRACING_PERFETTO_WM_DUMP 20 #define ANDROID_TRACING_PERFETTO_WM_DUMP false 21 #endif 22 #ifndef ANDROID_TRACING_PERFETTO_WM_DUMP_CTS 23 #define ANDROID_TRACING_PERFETTO_WM_DUMP_CTS false 24 #endif 25 #ifndef ANDROID_TRACING_PERFETTO_WM_TRACING 26 #define ANDROID_TRACING_PERFETTO_WM_TRACING false 27 #endif 28 29 #ifdef __cplusplus 30 31 #include <memory> 32 33 namespace android::tracing { 34 35 class flag_provider_interface { 36 public: 37 virtual ~flag_provider_interface() = default; 38 virtual bool client_side_proto_logging() = 0; 39 virtual bool perfetto_ime() = 0; 40 virtual bool perfetto_ime_tracing() = 0; 41 virtual bool perfetto_protolog_tracing() = 0; 42 virtual bool perfetto_transition_tracing() = 0; 43 virtual bool perfetto_view_capture_tracing() = 0; 44 virtual bool perfetto_wm_dump() = 0; 45 virtual bool perfetto_wm_dump_cts() = 0; 46 virtual bool perfetto_wm_tracing() = 0; 47 }; 48 49 extern std::unique_ptr<flag_provider_interface> provider_; 50 51 client_side_proto_logging()52inline bool client_side_proto_logging() { 53 return ANDROID_TRACING_CLIENT_SIDE_PROTO_LOGGING; 54 } perfetto_ime()55inline bool perfetto_ime() { 56 return ANDROID_TRACING_PERFETTO_IME; 57 } perfetto_ime_tracing()58inline bool perfetto_ime_tracing() { 59 return false; 60 } perfetto_protolog_tracing()61inline bool perfetto_protolog_tracing() { 62 return ANDROID_TRACING_PERFETTO_PROTOLOG_TRACING; 63 } perfetto_transition_tracing()64inline bool perfetto_transition_tracing() { 65 return true; 66 } perfetto_view_capture_tracing()67inline bool perfetto_view_capture_tracing() { 68 return ANDROID_TRACING_PERFETTO_VIEW_CAPTURE_TRACING; 69 } perfetto_wm_dump()70inline bool perfetto_wm_dump() { 71 return ANDROID_TRACING_PERFETTO_WM_DUMP; 72 } perfetto_wm_dump_cts()73inline bool perfetto_wm_dump_cts() { 74 return ANDROID_TRACING_PERFETTO_WM_DUMP_CTS; 75 } perfetto_wm_tracing()76inline bool perfetto_wm_tracing() { 77 return ANDROID_TRACING_PERFETTO_WM_TRACING; 78 } 79 80 } 81 82 extern "C" { 83 #endif // __cplusplus 84 85 86 bool android_tracing_client_side_proto_logging(); 87 bool android_tracing_perfetto_ime(); 88 bool android_tracing_perfetto_ime_tracing(); 89 bool android_tracing_perfetto_protolog_tracing(); 90 bool android_tracing_perfetto_transition_tracing(); 91 bool android_tracing_perfetto_view_capture_tracing(); 92 bool android_tracing_perfetto_wm_dump(); 93 bool android_tracing_perfetto_wm_dump_cts(); 94 bool android_tracing_perfetto_wm_tracing(); 95 96 #ifdef __cplusplus 97 } // extern "C" 98 #endif 99 100