/* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_DISTRIBUTED_SCHED_PROXY_H #define OHOS_DISTRIBUTED_SCHED_PROXY_H #include "distributed_sched_interface.h" #include "iremote_proxy.h" #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER #include "mission_info.h" #include "mission/distributed_mission_info.h" #endif namespace OHOS { namespace DistributedSchedule { class DistributedSchedProxy : public IRemoteProxy { public: explicit DistributedSchedProxy(const sptr& impl) : IRemoteProxy(impl) {} ~DistributedSchedProxy() {} int32_t StartRemoteAbility(const OHOS::AAFwk::Want& want, int32_t callerUid, int32_t requestCode, uint32_t accessToken) override; int32_t StartAbilityFromRemote(const OHOS::AAFwk::Want& want, const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode, const CallerInfo& callerInfo, const AccountInfo& accountInfo) override; int32_t SendResultFromRemote(OHOS::AAFwk::Want& want, int32_t requestCode, const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t resultCode) override; int32_t ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId, int32_t missionId, const sptr& callback, const OHOS::AAFwk::WantParams& wantParams) override; int32_t ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId, const std::string& bundleName, const sptr& callback, const OHOS::AAFwk::WantParams& wantParams) override; int32_t StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId, int32_t callerUid, int32_t status, uint32_t accessToken) override; void NotifyCompleteContinuation(const std::u16string& devId, int32_t sessionId, bool isSuccess) override; int32_t NotifyContinuationResultFromRemote(int32_t sessionId, bool isSuccess, const std::string dstInfo) override; int32_t NotifyDSchedEventResultFromRemote(const std::string type, int32_t dSchedEventResult) override; int32_t ConnectRemoteAbility(const OHOS::AAFwk::Want& want, const sptr& connect, int32_t callerUid, int32_t callerPid, uint32_t accessToken) override; int32_t DisconnectRemoteAbility(const sptr& connect, int32_t callerUid, uint32_t accessToken) override; int32_t ConnectAbilityFromRemote(const OHOS::AAFwk::Want& want, const AppExecFwk::AbilityInfo& abilityInfo, const sptr& connect, const CallerInfo& callerInfo, const AccountInfo& accountInfo) override; int32_t DisconnectAbilityFromRemote(const sptr& connect, int32_t uid, const std::string& sourceDeviceId) override; int32_t NotifyProcessDiedFromRemote(const CallerInfo& callerInfo) override; #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER int32_t StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) override; int32_t StopSyncRemoteMissions(const std::string& devId) override; int32_t RegisterMissionListener(const std::u16string& devId, const sptr& obj) override; int32_t RegisterDSchedEventListener(const DSchedEventType& type, const sptr& obj) override; int32_t UnRegisterDSchedEventListener(const DSchedEventType& type, const sptr& obj) override; int32_t RegisterOnListener(const std::string& type, const sptr& obj) override; int32_t RegisterOffListener(const std::string& type, const sptr& obj) override; int32_t UnRegisterMissionListener(const std::u16string& devId, const sptr& obj) override; int32_t GetMissionInfos(const std::string& deviceId, int32_t numMissions, std::vector& missionInfos) override; int32_t GetRemoteMissionSnapshotInfo(const std::string& networkId, int32_t missionId, std::unique_ptr& missionSnapshot) override; int32_t NotifyMissionsChangedFromRemote(const std::vector& missionInfos, const CallerInfo& callerInfo) override; int32_t StartSyncMissionsFromRemote(const CallerInfo& callerInfo, std::vector& missionInfos) override; int32_t StopSyncMissionsFromRemote(const CallerInfo& callerInfo) override; int32_t SetMissionContinueState(int32_t missionId, const AAFwk::ContinueState &state) override; #endif int32_t StartRemoteAbilityByCall(const OHOS::AAFwk::Want& want, const sptr& connect, int32_t callerUid, int32_t callerPid, uint32_t accessToken) override; int32_t ReleaseRemoteAbility(const sptr& connect, const AppExecFwk::ElementName &element) override; int32_t StartAbilityByCallFromRemote(const OHOS::AAFwk::Want& want, const sptr& connect, const CallerInfo& callerInfo, const AccountInfo& accountInfo) override; int32_t ReleaseAbilityFromRemote(const sptr& connect, const AppExecFwk::ElementName &element, const CallerInfo& callerInfo) override; int32_t StartRemoteFreeInstall(const OHOS::AAFwk::Want& want, int32_t callerUid, int32_t requestCode, uint32_t accessToken, const sptr& callback) override; int32_t StartFreeInstallFromRemote(const FreeInstallInfo& info, int64_t taskId) override; int32_t NotifyCompleteFreeInstallFromRemote(int64_t taskId, int32_t resultCode) override; #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE int32_t StartRemoteShareForm(const std::string& remoteDeviceId, const AppExecFwk::FormShareInfo& formShareInfo) override; int32_t StartShareFormFromRemote( const std::string& remoteDeviceId, const AppExecFwk::FormShareInfo& formShareInfo) override; #endif int32_t NotifyStateChangedFromRemote(int32_t abilityState, int32_t connectToken, const AppExecFwk::ElementName& element) override; int32_t GetDistributedComponentList(std::vector& distributedComponents) override; virtual int32_t StopRemoteExtensionAbility( const OHOS::AAFwk::Want& want, int32_t callerUid, uint32_t accessToken, int32_t extensionType) override; virtual int32_t StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want& want, const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t extensionType) override; private: bool CallerInfoMarshalling(const CallerInfo& callerInfo, MessageParcel& data); static inline BrokerDelegator delegator_; }; } // namespace DistributedSchedule } // namespace OHOS #endif // OHOS_DISTRIBUTED_SCHED_PROXY_H