/*
 * Copyright (C) 2017 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.
 */

#pragma once

#include <string>

#include "JankTracker.h"
#include "utils/Macros.h"
#include <stats_pull_atom_callback.h>

namespace android {
namespace uirenderer {
namespace protos {
class GraphicsStatsProto;
}

/*
 * The exported entry points used by GraphicsStatsService.java in f/b/services/core
 *
 * NOTE: Avoid exporting a requirement on the protobuf itself. Keep the usage
 * of the generated protobuf classes internal to libhwui.so to minimize library
 * bloat.
 */
class GraphicsStatsService {
public:
    class Dump;
    enum class DumpType {
        Text,
        Protobuf,
        ProtobufStatsd,
    };

    static void saveBuffer(const std::string& path, uid_t uid, const std::string& package,
                           int64_t versionCode, int64_t startTime, int64_t endTime,
                           const ProfileData* data);

    static Dump* createDump(int outFd, DumpType type);
    static void addToDump(Dump* dump, const std::string& path, uid_t uid,
                          const std::string& package, int64_t versionCode, int64_t startTime,
                          int64_t endTime, const ProfileData* data);
    static void addToDump(Dump* dump, const std::string& path);
    static void finishDump(Dump* dump);
    static void finishDumpInMemory(Dump* dump, AStatsEventList* data, bool lastFullDay);

    // Visible for testing
    static bool parseFromFile(const std::string& path, protos::GraphicsStatsProto* output);
};

} /* namespace uirenderer */
} /* namespace android */
