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 #ifndef FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_WORK_SCHED_SERVICE_PROXY_H 16 #define FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_WORK_SCHED_SERVICE_PROXY_H 17 18 #include <iremote_proxy.h> 19 #include <nocopyable.h> 20 #include <memory> 21 22 #include "iwork_sched_service.h" 23 24 namespace OHOS { 25 namespace WorkScheduler { 26 class WorkSchedServiceProxy : public IRemoteProxy<IWorkSchedService> { 27 public: WorkSchedServiceProxy(const sptr<IRemoteObject> & impl)28 explicit WorkSchedServiceProxy(const sptr<IRemoteObject>& impl) : 29 IRemoteProxy<IWorkSchedService>(impl) {} 30 ~WorkSchedServiceProxy() = default; 31 DISALLOW_COPY_AND_MOVE(WorkSchedServiceProxy); 32 33 virtual bool StartWork(WorkInfo& workInfo) override; 34 virtual bool StopWork(WorkInfo& workInfo) override; 35 virtual bool StopAndCancelWork(WorkInfo& workInfo) override; 36 virtual bool StopAndClearWorks() override; 37 virtual bool IsLastWorkTimeout(int32_t workId) override; 38 virtual std::list<std::shared_ptr<WorkInfo>> ObtainAllWorks(int32_t &uid, int32_t &pid) override; 39 virtual std::shared_ptr<WorkInfo> GetWorkStatus(int32_t &uid, int32_t &workId) override; 40 virtual bool ShellDump(const std::vector<std::string> &dumpOption, std::vector<std::string> &dumpInfo) override; 41 private: 42 static inline BrokerDelegator<WorkSchedServiceProxy> delegator_; 43 }; 44 } // namespace WorkScheduler 45 } // namespace OHOS 46 #endif // FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_WORK_SCHED_SERVICE_PROXY_H