1686862fbSopenharmony_ci/*
2686862fbSopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3686862fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4686862fbSopenharmony_ci * you may not use this file except in compliance with the License.
5686862fbSopenharmony_ci * You may obtain a copy of the License at
6686862fbSopenharmony_ci *
7686862fbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8686862fbSopenharmony_ci *
9686862fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10686862fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11686862fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12686862fbSopenharmony_ci * See the License for the specific language governing permissions and
13686862fbSopenharmony_ci * limitations under the License.
14686862fbSopenharmony_ci */
15686862fbSopenharmony_ci
16686862fbSopenharmony_ci#ifndef OHOS_DISTRIBUTED_SCHED_PROXY_H
17686862fbSopenharmony_ci#define OHOS_DISTRIBUTED_SCHED_PROXY_H
18686862fbSopenharmony_ci
19686862fbSopenharmony_ci#include "distributed_sched_interface.h"
20686862fbSopenharmony_ci#include "iremote_proxy.h"
21686862fbSopenharmony_ci#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
22686862fbSopenharmony_ci#include "mission_info.h"
23686862fbSopenharmony_ci#include "mission/distributed_mission_info.h"
24686862fbSopenharmony_ci#endif
25686862fbSopenharmony_ci
26686862fbSopenharmony_cinamespace OHOS {
27686862fbSopenharmony_cinamespace DistributedSchedule {
28686862fbSopenharmony_ciclass DistributedSchedProxy : public IRemoteProxy<IDistributedSched> {
29686862fbSopenharmony_cipublic:
30686862fbSopenharmony_ci    explicit DistributedSchedProxy(const sptr<IRemoteObject>& impl)
31686862fbSopenharmony_ci        : IRemoteProxy<IDistributedSched>(impl) {}
32686862fbSopenharmony_ci    ~DistributedSchedProxy() {}
33686862fbSopenharmony_ci    int32_t StartRemoteAbility(const OHOS::AAFwk::Want& want, int32_t callerUid, int32_t requestCode,
34686862fbSopenharmony_ci        uint32_t accessToken) override;
35686862fbSopenharmony_ci    int32_t StartAbilityFromRemote(const OHOS::AAFwk::Want& want,
36686862fbSopenharmony_ci        const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode, const CallerInfo& callerInfo,
37686862fbSopenharmony_ci        const AccountInfo& accountInfo) override;
38686862fbSopenharmony_ci    int32_t SendResultFromRemote(OHOS::AAFwk::Want& want, int32_t requestCode,
39686862fbSopenharmony_ci        const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t resultCode) override;
40686862fbSopenharmony_ci    int32_t ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
41686862fbSopenharmony_ci        int32_t missionId, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams) override;
42686862fbSopenharmony_ci    int32_t ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
43686862fbSopenharmony_ci        const std::string& bundleName, const sptr<IRemoteObject>& callback,
44686862fbSopenharmony_ci        const OHOS::AAFwk::WantParams& wantParams) override;
45686862fbSopenharmony_ci    int32_t StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId, int32_t callerUid,
46686862fbSopenharmony_ci        int32_t status, uint32_t accessToken) override;
47686862fbSopenharmony_ci    void NotifyCompleteContinuation(const std::u16string& devId, int32_t sessionId, bool isSuccess) override;
48686862fbSopenharmony_ci    int32_t NotifyContinuationResultFromRemote(int32_t sessionId, bool isSuccess, const std::string dstInfo) override;
49686862fbSopenharmony_ci    int32_t NotifyDSchedEventResultFromRemote(const std::string type, int32_t dSchedEventResult) override;
50686862fbSopenharmony_ci    int32_t ConnectRemoteAbility(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
51686862fbSopenharmony_ci        int32_t callerUid, int32_t callerPid, uint32_t accessToken) override;
52686862fbSopenharmony_ci    int32_t DisconnectRemoteAbility(const sptr<IRemoteObject>& connect, int32_t callerUid,
53686862fbSopenharmony_ci        uint32_t accessToken) override;
54686862fbSopenharmony_ci    int32_t ConnectAbilityFromRemote(const OHOS::AAFwk::Want& want, const AppExecFwk::AbilityInfo& abilityInfo,
55686862fbSopenharmony_ci        const sptr<IRemoteObject>& connect, const CallerInfo& callerInfo, const AccountInfo& accountInfo) override;
56686862fbSopenharmony_ci    int32_t DisconnectAbilityFromRemote(const sptr<IRemoteObject>& connect,
57686862fbSopenharmony_ci        int32_t uid, const std::string& sourceDeviceId) override;
58686862fbSopenharmony_ci    int32_t NotifyProcessDiedFromRemote(const CallerInfo& callerInfo) override;
59686862fbSopenharmony_ci#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
60686862fbSopenharmony_ci    int32_t StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) override;
61686862fbSopenharmony_ci    int32_t StopSyncRemoteMissions(const std::string& devId) override;
62686862fbSopenharmony_ci    int32_t RegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
63686862fbSopenharmony_ci    int32_t RegisterDSchedEventListener(const DSchedEventType& type, const sptr<IRemoteObject>& obj) override;
64686862fbSopenharmony_ci    int32_t UnRegisterDSchedEventListener(const DSchedEventType& type, const sptr<IRemoteObject>& obj) override;
65686862fbSopenharmony_ci    int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid) override;
66686862fbSopenharmony_ci    int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid) override;
67686862fbSopenharmony_ci    int32_t UnRegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
68686862fbSopenharmony_ci    int32_t GetMissionInfos(const std::string& deviceId, int32_t numMissions,
69686862fbSopenharmony_ci        std::vector<AAFwk::MissionInfo>& missionInfos) override;
70686862fbSopenharmony_ci    int32_t GetRemoteMissionSnapshotInfo(const std::string& networkId, int32_t missionId,
71686862fbSopenharmony_ci        std::unique_ptr<AAFwk::MissionSnapshot>& missionSnapshot) override;
72686862fbSopenharmony_ci    int32_t NotifyMissionsChangedFromRemote(const std::vector<DstbMissionInfo>& missionInfos,
73686862fbSopenharmony_ci        const CallerInfo& callerInfo) override;
74686862fbSopenharmony_ci    int32_t StartSyncMissionsFromRemote(const CallerInfo& callerInfo,
75686862fbSopenharmony_ci        std::vector<DstbMissionInfo>& missionInfos) override;
76686862fbSopenharmony_ci    int32_t StopSyncMissionsFromRemote(const CallerInfo& callerInfo) override;
77686862fbSopenharmony_ci    int32_t SetMissionContinueState(int32_t missionId, const AAFwk::ContinueState &state) override;
78686862fbSopenharmony_ci#endif
79686862fbSopenharmony_ci    int32_t StartRemoteAbilityByCall(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
80686862fbSopenharmony_ci        int32_t callerUid, int32_t callerPid, uint32_t accessToken) override;
81686862fbSopenharmony_ci    int32_t ReleaseRemoteAbility(const sptr<IRemoteObject>& connect,
82686862fbSopenharmony_ci        const AppExecFwk::ElementName &element) override;
83686862fbSopenharmony_ci    int32_t StartAbilityByCallFromRemote(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
84686862fbSopenharmony_ci        const CallerInfo& callerInfo, const AccountInfo& accountInfo) override;
85686862fbSopenharmony_ci    int32_t ReleaseAbilityFromRemote(const sptr<IRemoteObject>& connect, const AppExecFwk::ElementName &element,
86686862fbSopenharmony_ci        const CallerInfo& callerInfo) override;
87686862fbSopenharmony_ci    int32_t StartRemoteFreeInstall(const OHOS::AAFwk::Want& want,
88686862fbSopenharmony_ci        int32_t callerUid, int32_t requestCode, uint32_t accessToken, const sptr<IRemoteObject>& callback) override;
89686862fbSopenharmony_ci    int32_t StartFreeInstallFromRemote(const FreeInstallInfo& info, int64_t taskId) override;
90686862fbSopenharmony_ci    int32_t NotifyCompleteFreeInstallFromRemote(int64_t taskId, int32_t resultCode) override;
91686862fbSopenharmony_ci#ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
92686862fbSopenharmony_ci    int32_t StartRemoteShareForm(const std::string& remoteDeviceId,
93686862fbSopenharmony_ci        const AppExecFwk::FormShareInfo& formShareInfo) override;
94686862fbSopenharmony_ci    int32_t StartShareFormFromRemote(
95686862fbSopenharmony_ci        const std::string& remoteDeviceId, const AppExecFwk::FormShareInfo& formShareInfo) override;
96686862fbSopenharmony_ci#endif
97686862fbSopenharmony_ci    int32_t NotifyStateChangedFromRemote(int32_t abilityState, int32_t connectToken,
98686862fbSopenharmony_ci        const AppExecFwk::ElementName& element) override;
99686862fbSopenharmony_ci    int32_t GetDistributedComponentList(std::vector<std::string>& distributedComponents) override;
100686862fbSopenharmony_ci    virtual int32_t StopRemoteExtensionAbility(
101686862fbSopenharmony_ci        const OHOS::AAFwk::Want& want, int32_t callerUid, uint32_t accessToken, int32_t extensionType) override;
102686862fbSopenharmony_ci    virtual int32_t StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want& want,
103686862fbSopenharmony_ci        const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t extensionType) override;
104686862fbSopenharmony_ci
105686862fbSopenharmony_ciprivate:
106686862fbSopenharmony_ci    bool CallerInfoMarshalling(const CallerInfo& callerInfo, MessageParcel& data);
107686862fbSopenharmony_ci    static inline BrokerDelegator<DistributedSchedProxy> delegator_;
108686862fbSopenharmony_ci};
109686862fbSopenharmony_ci} // namespace DistributedSchedule
110686862fbSopenharmony_ci} // namespace OHOS
111686862fbSopenharmony_ci#endif // OHOS_DISTRIBUTED_SCHED_PROXY_H
112