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 #ifndef FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_SERVICES_CORE_INCLUDE_BACKGROUND_TASK_HELPER_H 17 #define FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_SERVICES_CORE_INCLUDE_BACKGROUND_TASK_HELPER_H 18 19 #ifdef STANDBY_SERVICE_UNIT_TEST 20 #define WEAK_FUNC __attribute__((weak)) 21 #else 22 #define WEAK_FUNC 23 #endif // STANDBY_SERVICE_UNIT_TEST 24 25 #include <vector> 26 #include <memory> 27 #include "ipc_skeleton.h" 28 #include "iremote_object.h" 29 #include "single_instance.h" 30 #include "background_task_mgr_helper.h" 31 32 #include "standby_service_log.h" 33 #include "standby_service_errors.h" 34 #include "resource_callback_info.h" 35 36 namespace OHOS { 37 namespace DevStandbyMgr { 38 using namespace OHOS::BackgroundTaskMgr; 39 class BackgroundTaskHelper : public std::enable_shared_from_this<BackgroundTaskHelper> { 40 DECLARE_SINGLE_INSTANCE(BackgroundTaskHelper); 41 public: 42 /** 43 * @brief Get all running continuous task info. 44 */ 45 bool GetContinuousTaskApps(std::vector<std::shared_ptr<ContinuousTaskCallbackInfo>> &list); 46 47 /** 48 * @brief Get all running transient task info. 49 */ 50 bool GetTransientTaskApps(std::vector<std::shared_ptr<TransientTaskAppInfo>> &list); 51 }; 52 } 53 } 54 #endif // FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_SERVICES_CORE_INCLUDE_BACKGROUND_TASK_HELPER_H