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 ModuleResult TokenizePacket( 40 const protos::pbzero::TracePacket::Decoder& decoder, 41 TraceBlobView* packet, 42 int64_t packet_timestamp, 43 RefPtr<PacketSequenceStateGeneration> state, 44 uint32_t field_id) override; 45 46 void ParseTracePacketData(const protos::pbzero::TracePacket::Decoder&, 47 int64_t ts, 48 const TracePacketData&, 49 uint32_t field_id) override; 50 51 private: 52 void ParseWinscopeExtensionsData(protozero::ConstBytes blob, 53 int64_t timestamp, 54 const TracePacketData&); 55 void ParseInputMethodClientsData(int64_t timestamp, 56 protozero::ConstBytes blob); 57 void ParseInputMethodManagerServiceData(int64_t timestamp, 58 protozero::ConstBytes blob); 59 void ParseInputMethodServiceData(int64_t timestamp, 60 protozero::ConstBytes blob); 61 void ParseViewCaptureData(int64_t timestamp, 62 protozero::ConstBytes blob, 63 PacketSequenceStateGeneration* sequence_state); 64 void ParseWindowManagerData(int64_t timestamp, protozero::ConstBytes blob); 65 66 TraceProcessorContext* const context_; 67 util::ProtoToArgsParser args_parser_; 68 69 SurfaceFlingerLayersParser surfaceflinger_layers_parser_; 70 SurfaceFlingerTransactionsParser surfaceflinger_transactions_parser_; 71 ShellTransitionsParser shell_transitions_parser_; 72 ProtoLogParser protolog_parser_; 73 AndroidInputEventParser android_input_event_parser_; 74 }; 75 76 } // namespace trace_processor 77 } // namespace perfetto 78 79 #endif // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_WINSCOPE_MODULE_H_ 80