• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <memory>
26 #include <vector>
27 
28 #include "continuous_task_callback_info.h"
29 #include "transient_task_app_info.h"
30 #include "ipc_skeleton.h"
31 #include "iremote_object.h"
32 #include "singleton.h"
33 #include "standby_service_errors.h"
34 
35 namespace OHOS {
36 namespace DevStandbyMgr {
37 using namespace OHOS::BackgroundTaskMgr;
38 class BackgroundTaskHelper : public std::enable_shared_from_this<BackgroundTaskHelper> {
39 DECLARE_DELAYED_SINGLETON(BackgroundTaskHelper);
40 public:
41     static std::shared_ptr<BackgroundTaskHelper> GetInstance();
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 private:
53     BackgroundTaskHelper(const BackgroundTaskHelper&) = delete;
54     BackgroundTaskHelper& operator= (const BackgroundTaskHelper&) = delete;
55     BackgroundTaskHelper(BackgroundTaskHelper&&) = delete;
56     BackgroundTaskHelper& operator= (BackgroundTaskHelper&&) = delete;
57 };
58 }
59 }
60 #endif // FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_SERVICES_CORE_INCLUDE_BACKGROUND_TASK_HELPER_H