1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include "background_task_helper.h"
17#include "background_task_mgr_helper.h"
18#include "standby_service_log.h"
19
20namespace OHOS {
21namespace DevStandbyMgr {
22BackgroundTaskHelper::BackgroundTaskHelper()
23{
24}
25
26BackgroundTaskHelper::~BackgroundTaskHelper()
27{
28}
29
30std::shared_ptr<BackgroundTaskHelper> BackgroundTaskHelper::GetInstance()
31{
32    return DelayedSingleton<BackgroundTaskHelper>::GetInstance();
33}
34
35bool WEAK_FUNC BackgroundTaskHelper::GetContinuousTaskApps(
36    std::vector<std::shared_ptr<ContinuousTaskCallbackInfo>> &list)
37{
38    #ifdef ENABLE_BACKGROUND_TASK_MGR
39    if (BackgroundTaskMgrHelper::GetContinuousTaskApps(list) != OHOS::ERR_OK) {
40        STANDBYSERVICE_LOGW("Get continuous task failed");
41        return false;
42    }
43    #endif
44    return true;
45}
46
47bool WEAK_FUNC BackgroundTaskHelper::GetTransientTaskApps(std::vector<std::shared_ptr<TransientTaskAppInfo>> &list)
48{
49    #ifdef ENABLE_BACKGROUND_TASK_MGR
50    if (BackgroundTaskMgrHelper::GetTransientTaskApps(list) != OHOS::ERR_OK) {
51        STANDBYSERVICE_LOGE("Get transient task failed");
52        return false;
53    }
54    #endif
55    return true;
56}
57} // OHOS
58} // DevStandbyMgr