• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 OHOS_DISTRIBUTED_SCHED_PROXY_H
17 #define OHOS_DISTRIBUTED_SCHED_PROXY_H
18 
19 #include "distributed_sched_interface.h"
20 #include "iremote_proxy.h"
21 #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
22 #include "mission_info.h"
23 #include "mission/distributed_mission_info.h"
24 #endif
25 
26 namespace OHOS {
27 namespace DistributedSchedule {
28 class DistributedSchedProxy : public IRemoteProxy<IDistributedSched> {
29 public:
DistributedSchedProxy(const sptr<IRemoteObject> & impl)30     explicit DistributedSchedProxy(const sptr<IRemoteObject>& impl)
31         : IRemoteProxy<IDistributedSched>(impl) {}
~DistributedSchedProxy()32     ~DistributedSchedProxy() {}
33     int32_t StartRemoteAbility(const OHOS::AAFwk::Want& want, int32_t callerUid, int32_t requestCode,
34         uint32_t accessToken) override;
35     int32_t StartAbilityFromRemote(const OHOS::AAFwk::Want& want,
36         const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode, const CallerInfo& callerInfo,
37         const AccountInfo& accountInfo) override;
38     int32_t SendResultFromRemote(OHOS::AAFwk::Want& want, int32_t requestCode,
39         const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t resultCode) override;
40     int32_t ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
41         int32_t missionId, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams) override;
42     int32_t ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
43         const std::string& bundleName, const sptr<IRemoteObject>& callback,
44         const OHOS::AAFwk::WantParams& wantParams) override;
45     int32_t StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId, int32_t callerUid,
46         int32_t status, uint32_t accessToken) override;
47     void NotifyCompleteContinuation(const std::u16string& devId, int32_t sessionId, bool isSuccess) override;
48     int32_t NotifyContinuationResultFromRemote(int32_t sessionId, bool isSuccess) override;
49     int32_t ConnectRemoteAbility(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
50         int32_t callerUid, int32_t callerPid, uint32_t accessToken) override;
51     int32_t DisconnectRemoteAbility(const sptr<IRemoteObject>& connect, int32_t callerUid,
52         uint32_t accessToken) override;
53     int32_t ConnectAbilityFromRemote(const OHOS::AAFwk::Want& want, const AppExecFwk::AbilityInfo& abilityInfo,
54         const sptr<IRemoteObject>& connect, const CallerInfo& callerInfo, const AccountInfo& accountInfo) override;
55     int32_t DisconnectAbilityFromRemote(const sptr<IRemoteObject>& connect,
56         int32_t uid, const std::string& sourceDeviceId) override;
57     int32_t NotifyProcessDiedFromRemote(const CallerInfo& callerInfo) override;
58 #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
59     int32_t StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) override;
60     int32_t StopSyncRemoteMissions(const std::string& devId) override;
61     int32_t RegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
62     int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj) override;
63     int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj) override;
64     int32_t UnRegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
65     int32_t GetMissionInfos(const std::string& deviceId, int32_t numMissions,
66         std::vector<AAFwk::MissionInfo>& missionInfos) override;
67     int32_t GetRemoteMissionSnapshotInfo(const std::string& networkId, int32_t missionId,
68         std::unique_ptr<AAFwk::MissionSnapshot>& missionSnapshot) override;
69     int32_t NotifyMissionsChangedFromRemote(const std::vector<DstbMissionInfo>& missionInfos,
70         const CallerInfo& callerInfo) override;
71     int32_t StartSyncMissionsFromRemote(const CallerInfo& callerInfo,
72         std::vector<DstbMissionInfo>& missionInfos) override;
73     int32_t StopSyncMissionsFromRemote(const CallerInfo& callerInfo) override;
74     int32_t SetMissionContinueState(int32_t missionId, const AAFwk::ContinueState &state) override;
75 #endif
76     int32_t StartRemoteAbilityByCall(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
77         int32_t callerUid, int32_t callerPid, uint32_t accessToken) override;
78     int32_t ReleaseRemoteAbility(const sptr<IRemoteObject>& connect,
79         const AppExecFwk::ElementName &element) override;
80     int32_t StartAbilityByCallFromRemote(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
81         const CallerInfo& callerInfo, const AccountInfo& accountInfo) override;
82     int32_t ReleaseAbilityFromRemote(const sptr<IRemoteObject>& connect, const AppExecFwk::ElementName &element,
83         const CallerInfo& callerInfo) override;
84     int32_t StartRemoteFreeInstall(const OHOS::AAFwk::Want& want,
85         int32_t callerUid, int32_t requestCode, uint32_t accessToken, const sptr<IRemoteObject>& callback) override;
86     int32_t StartFreeInstallFromRemote(const FreeInstallInfo& info, int64_t taskId) override;
87     int32_t NotifyCompleteFreeInstallFromRemote(int64_t taskId, int32_t resultCode) override;
88 #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
89     int32_t StartRemoteShareForm(const std::string& remoteDeviceId,
90         const AppExecFwk::FormShareInfo& formShareInfo) override;
91     int32_t StartShareFormFromRemote(
92         const std::string& remoteDeviceId, const AppExecFwk::FormShareInfo& formShareInfo) override;
93 #endif
94     int32_t NotifyStateChangedFromRemote(int32_t abilityState, int32_t connectToken,
95         const AppExecFwk::ElementName& element) override;
96     int32_t GetDistributedComponentList(std::vector<std::string>& distributedComponents) override;
97     virtual int32_t StopRemoteExtensionAbility(
98         const OHOS::AAFwk::Want& want, int32_t callerUid, uint32_t accessToken, int32_t extensionType) override;
99     virtual int32_t StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want& want,
100         const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t extensionType) override;
101 private:
102     bool CallerInfoMarshalling(const CallerInfo& callerInfo, MessageParcel& data);
103     static inline BrokerDelegator<DistributedSchedProxy> delegator_;
104 };
105 } // namespace DistributedSchedule
106 } // namespace OHOS
107 #endif // OHOS_DISTRIBUTED_SCHED_PROXY_H
108