1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_WINSCOPE_MODULE_H_ 18 #define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_WINSCOPE_MODULE_H_ 19 20 #include <cstdint> 21 #include "perfetto/base/build_config.h" 22 #include "src/trace_processor/importers/common/parser_types.h" 23 #include "src/trace_processor/importers/proto/proto_importer_module.h" 24 #include "src/trace_processor/importers/proto/winscope/android_input_event_parser.h" 25 #include "src/trace_processor/importers/proto/winscope/protolog_parser.h" 26 #include "src/trace_processor/importers/proto/winscope/shell_transitions_parser.h" 27 #include "src/trace_processor/importers/proto/winscope/surfaceflinger_layers_parser.h" 28 #include "src/trace_processor/importers/proto/winscope/surfaceflinger_transactions_parser.h" 29 30 #include "protos/perfetto/trace/trace_packet.pbzero.h" 31 32 namespace perfetto { 33 namespace trace_processor { 34 35 class WinscopeModule : public ProtoImporterModule { 36 public: 37 explicit WinscopeModule(TraceProcessorContext* context); 38 39 void ParseTracePacketData(const protos::pbzero::TracePacket::Decoder&, 40 int64_t ts, 41 const TracePacketData&, 42 uint32_t field_id) override; 43 44 private: 45 void ParseWinscopeExtensionsData(protozero::ConstBytes blob, 46 int64_t timestamp, 47 const TracePacketData&); 48 void ParseInputMethodClientsData(int64_t timestamp, 49 protozero::ConstBytes blob); 50 void ParseInputMethodManagerServiceData(int64_t timestamp, 51 protozero::ConstBytes blob); 52 void ParseInputMethodServiceData(int64_t timestamp, 53 protozero::ConstBytes blob); 54 void ParseViewCaptureData(int64_t timestamp, 55 protozero::ConstBytes blob, 56 PacketSequenceStateGeneration* sequence_state); 57 58 static constexpr auto* kInputMethodClientsProtoName = 59 ".perfetto.protos.InputMethodClientsTraceProto"; 60 static constexpr auto* kInputMethodManagerServiceProtoName = 61 ".perfetto.protos.InputMethodManagerServiceTraceProto"; 62 static constexpr auto* kInputMethodServiceProtoName = 63 ".perfetto.protos.InputMethodServiceTraceProto"; 64 static constexpr auto* kViewCaptureProtoName = ".perfetto.protos.ViewCapture"; 65 66 TraceProcessorContext* const context_; 67 DescriptorPool pool_; 68 util::ProtoToArgsParser args_parser_; 69 70 SurfaceFlingerLayersParser surfaceflinger_layers_parser_; 71 SurfaceFlingerTransactionsParser surfaceflinger_transactions_parser_; 72 ShellTransitionsParser shell_transitions_parser_; 73 ProtoLogParser protolog_parser_; 74 AndroidInputEventParser android_input_event_parser_; 75 }; 76 77 } // namespace trace_processor 78 } // namespace perfetto 79 80 #endif // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_WINSCOPE_MODULE_H_ 81