13e5483f6Sopenharmony_ci/*
23e5483f6Sopenharmony_ci * Copyright (C) 2024 Huawei Device Co., Ltd.
33e5483f6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
43e5483f6Sopenharmony_ci * you may not use this file except in compliance with the License.
53e5483f6Sopenharmony_ci * You may obtain a copy of the License at
63e5483f6Sopenharmony_ci *
73e5483f6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
83e5483f6Sopenharmony_ci *
93e5483f6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
103e5483f6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
113e5483f6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123e5483f6Sopenharmony_ci * See the License for the specific language governing permissions and
133e5483f6Sopenharmony_ci * limitations under the License.
143e5483f6Sopenharmony_ci */
153e5483f6Sopenharmony_ci
163e5483f6Sopenharmony_ci#ifndef OHOS_RINGTONE_DFX_MANAGER_H
173e5483f6Sopenharmony_ci#define OHOS_RINGTONE_DFX_MANAGER_H
183e5483f6Sopenharmony_ci
193e5483f6Sopenharmony_ci#include "fa_ability_context.h"
203e5483f6Sopenharmony_ci#include "dfx_reporter.h"
213e5483f6Sopenharmony_ci#include "ringtone_type.h"
223e5483f6Sopenharmony_ci
233e5483f6Sopenharmony_ci#define EXPORT __attribute__ ((visibility ("default")))
243e5483f6Sopenharmony_ci
253e5483f6Sopenharmony_cinamespace OHOS {
263e5483f6Sopenharmony_cinamespace Media {
273e5483f6Sopenharmony_ciclass DfxManager {
283e5483f6Sopenharmony_cipublic:
293e5483f6Sopenharmony_ci    DfxManager();
303e5483f6Sopenharmony_ci    ~DfxManager();
313e5483f6Sopenharmony_ci    EXPORT static std::shared_ptr<DfxManager> GetInstance();
323e5483f6Sopenharmony_ci    EXPORT int64_t HandleReportXml();
333e5483f6Sopenharmony_ci    EXPORT int32_t Init(const std::shared_ptr<OHOS::AbilityRuntime::Context> &context);
343e5483f6Sopenharmony_ci    EXPORT int64_t RequestTonesCount(SourceType type);
353e5483f6Sopenharmony_ci
363e5483f6Sopenharmony_ciprivate:
373e5483f6Sopenharmony_ci    static std::mutex instanceLock_;
383e5483f6Sopenharmony_ci    static std::shared_ptr<DfxManager> dfxManagerInstance_;
393e5483f6Sopenharmony_ci    std::atomic<bool> isInitSuccess_;
403e5483f6Sopenharmony_ci    std::shared_ptr<DfxReporter> dfxReporter_;
413e5483f6Sopenharmony_ci    std::shared_ptr<OHOS::AbilityRuntime::Context> context_ = nullptr;
423e5483f6Sopenharmony_ci};
433e5483f6Sopenharmony_ci} // namespace Media
443e5483f6Sopenharmony_ci} // namespace OHOS
453e5483f6Sopenharmony_ci
463e5483f6Sopenharmony_ci#endif  // OHOS_RINGTONE_DFX_MANAGER_H
47