chromium/third_party/perfetto/src/trace_processor/importers/android_bugreport/android_bugreport_reader.cc

/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "src/trace_processor/importers/android_bugreport/android_bugreport_reader.h"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>

#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/string_utils.h"
#include "protos/perfetto/common/builtin_clock.pbzero.h"
#include "src/trace_processor/importers/android_bugreport/android_dumpstate_reader.h"
#include "src/trace_processor/importers/android_bugreport/android_log_reader.h"
#include "src/trace_processor/importers/common/clock_tracker.h"
#include "src/trace_processor/importers/common/trace_file_tracker.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include "src/trace_processor/util/status_macros.h"
#include "src/trace_processor/util/trace_type.h"
#include "src/trace_processor/util/zip_reader.h"

namespace perfetto::trace_processor {
namespace {
const util::ZipFile* FindBugReportFile(
    const std::vector<util::ZipFile>& zip_file_entries) {}

std::optional<int32_t> ExtractYearFromBugReportFilename(
    const std::string& filename) {}

}  // namespace

// static
bool AndroidBugreportReader::IsAndroidBugReport(
    const std::vector<util::ZipFile>& zip_file_entries) {}

// static
util::Status AndroidBugreportReader::Parse(
    TraceProcessorContext* context,
    std::vector<util::ZipFile> zip_file_entries) {}

AndroidBugreportReader::AndroidBugreportReader(
    TraceProcessorContext* context,
    std::vector<util::ZipFile> zip_file_entries)
    :{}

AndroidBugreportReader::~AndroidBugreportReader() = default;

util::Status AndroidBugreportReader::ParseImpl() {}

base::Status AndroidBugreportReader::ParseDumpstateTxt(
    std::vector<TimestampedAndroidLogEvent> logcat_events) {}

base::StatusOr<std::vector<TimestampedAndroidLogEvent>>
AndroidBugreportReader::ParsePersistentLogcat() {}

// Populates the `year_` field from the bugreport-xxx.txt file name.
// This is because logcat events have only the month and day.
// This is obviously bugged for cases of bugreports collected across new year
// but we'll live with that.
bool AndroidBugreportReader::DetectYearAndBrFilename() {}

}  // namespace perfetto::trace_processor