1 /* 2 * Copyright (c) 2022 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_BACKGROUND_TASK_MGR_FRAMEWORKS_INCLUDE_BACKGROUND_TASK_SUBSCRIBER_PROXY_H 17 #define FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_INCLUDE_BACKGROUND_TASK_SUBSCRIBER_PROXY_H 18 19 #include <iremote_proxy.h> 20 21 #include "ibackground_task_subscriber.h" 22 23 namespace OHOS { 24 namespace BackgroundTaskMgr { 25 class BackgroundTaskSubscriberProxy : public IRemoteProxy<IBackgroundTaskSubscriber> { 26 public: 27 BackgroundTaskSubscriberProxy() = delete; 28 explicit BackgroundTaskSubscriberProxy(const sptr<IRemoteObject>& impl); 29 ~BackgroundTaskSubscriberProxy() override; 30 DISALLOW_COPY_AND_MOVE(BackgroundTaskSubscriberProxy); 31 32 /** 33 * @brief Called back when the subscriber is connected to Background Task Manager Service. 34 */ 35 void OnConnected() override; 36 37 /** 38 * @brief Called back when the subscriber is disconnected from Background Task Manager Service. 39 */ 40 void OnDisconnected() override; 41 42 /** 43 * @brief Called back when a transient task start. 44 * 45 * @param info Transient task app info. 46 */ 47 void OnTransientTaskStart(const std::shared_ptr<TransientTaskAppInfo>& info) override; 48 49 /** 50 * @brief Called back when a transient task end. 51 * 52 * @param info Info of transient tasks. 53 */ 54 void OnTransientTaskEnd(const std::shared_ptr<TransientTaskAppInfo>& info) override; 55 56 /** 57 * Called back when the app has transient task. 58 * 59 * @param info App info of transient task. 60 **/ 61 void OnAppTransientTaskStart(const std::shared_ptr<TransientTaskAppInfo>& info) override; 62 63 /** 64 * Called back when the app does not have transient task. 65 * 66 * @param info App info transient task . 67 **/ 68 void OnAppTransientTaskEnd(const std::shared_ptr<TransientTaskAppInfo>& info) override; 69 70 /** 71 * @brief Called back when a continuous task start. 72 * 73 * @param continuousTaskCallbackInfo Continuous task app info. 74 */ 75 void OnContinuousTaskStart( 76 const std::shared_ptr<ContinuousTaskCallbackInfo> &continuousTaskCallbackInfo) override; 77 78 /** 79 * @brief Called back when a continuous task stop. 80 * 81 * @param continuousTaskCallbackInfo Continuous task app info. 82 */ 83 void OnContinuousTaskStop( 84 const std::shared_ptr<ContinuousTaskCallbackInfo> &continuousTaskCallbackInfo) override; 85 86 /** 87 * Called back when the app does not have continuous task. 88 * 89 * @param uid App uid. 90 **/ 91 void OnAppContinuousTaskStop(int32_t uid) override; 92 93 /** 94 * @brief Apply or unapply efficiency resources of App. 95 * 96 * @param resourceInfo Request params. 97 */ 98 void OnAppEfficiencyResourcesApply(const std::shared_ptr<ResourceCallbackInfo> &resourceInfo) override; 99 100 /** 101 * @brief Called back when the efficiency resources of App reset. 102 * 103 * @param resourceInfo Request params. 104 */ 105 void OnAppEfficiencyResourcesReset(const std::shared_ptr<ResourceCallbackInfo> &resourceInfo) override; 106 107 /** 108 * @brief Apply or unapply efficiency resources of process. 109 * 110 * @param resourceInfo Request params. 111 */ 112 void OnProcEfficiencyResourcesApply(const std::shared_ptr<ResourceCallbackInfo> &resourceInfo) override; 113 114 /** 115 * @brief Called back when the efficiency resources of process reset. 116 * 117 * @param resourceInfo Request params. 118 */ 119 void OnProcEfficiencyResourcesReset(const std::shared_ptr<ResourceCallbackInfo> &resourceInfo) override; 120 private: 121 static inline BrokerDelegator<BackgroundTaskSubscriberProxy> delegator_; 122 }; 123 } // namespace BackgroundTaskMgr 124 } // namespace OHOS 125 #endif // FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_INCLUDE_BACKGROUND_TASK_SUBSCRIBER_PROXY_H