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_STUB_H 17686862fbSopenharmony_ci#define OHOS_DISTRIBUTED_SCHED_STUB_H 18686862fbSopenharmony_ci 19686862fbSopenharmony_ci#include "distributed_sched_interface.h" 20686862fbSopenharmony_ci#include "iremote_stub.h" 21686862fbSopenharmony_ci#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER 22686862fbSopenharmony_ci#include "mission/snapshot.h" 23686862fbSopenharmony_ci#endif 24686862fbSopenharmony_ci 25686862fbSopenharmony_cinamespace OHOS { 26686862fbSopenharmony_cinamespace DistributedSchedule { 27686862fbSopenharmony_ciclass DistributedSchedStub : public IRemoteStub<IDistributedSched> { 28686862fbSopenharmony_cipublic: 29686862fbSopenharmony_ci DistributedSchedStub(); 30686862fbSopenharmony_ci ~DistributedSchedStub(); 31686862fbSopenharmony_ci int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, 32686862fbSopenharmony_ci MessageParcel& reply, MessageOption& option) override; 33686862fbSopenharmony_ci 34686862fbSopenharmony_ci#ifdef DMSFWK_INTERACTIVE_ADAPTER 35686862fbSopenharmony_ci virtual bool CheckRemoteOsType(const std::string& netwokId) = 0; 36686862fbSopenharmony_ci virtual int32_t StartAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) = 0; 37686862fbSopenharmony_ci virtual int32_t StopAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) = 0; 38686862fbSopenharmony_ci virtual int32_t ConnectAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) = 0; 39686862fbSopenharmony_ci virtual int32_t DisconnectAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) = 0; 40686862fbSopenharmony_ci virtual int32_t NotifyAbilityLifecycleChangedFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) = 0; 41686862fbSopenharmony_ci#endif 42686862fbSopenharmony_ci 43686862fbSopenharmony_ciprivate: 44686862fbSopenharmony_ci int32_t StartRemoteAbilityInner(MessageParcel& data, MessageParcel& reply); 45686862fbSopenharmony_ci int32_t StartAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply); 46686862fbSopenharmony_ci int32_t StopAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply); 47686862fbSopenharmony_ci int32_t SendResultFromRemoteInner(MessageParcel& data, MessageParcel& reply); 48686862fbSopenharmony_ci bool IsRemoteInstall(const std::string &networkId, const std::string &bundleName); 49686862fbSopenharmony_ci int32_t ContinueMissionInner(MessageParcel& data, MessageParcel& reply); 50686862fbSopenharmony_ci int32_t ContinueMissionOfBundleNameInner(MessageParcel& data, MessageParcel& reply); 51686862fbSopenharmony_ci int32_t StartContinuationInner(MessageParcel& data, MessageParcel& reply); 52686862fbSopenharmony_ci int32_t NotifyCompleteContinuationInner(MessageParcel& data, MessageParcel& reply); 53686862fbSopenharmony_ci int32_t NotifyContinuationResultFromRemoteInner(MessageParcel& data, MessageParcel& reply); 54686862fbSopenharmony_ci int32_t NotifyDSchedEventResultFromRemoteInner(MessageParcel& data, MessageParcel& reply); 55686862fbSopenharmony_ci int32_t ConnectRemoteAbilityInner(MessageParcel& data, MessageParcel& reply); 56686862fbSopenharmony_ci int32_t DisconnectRemoteAbilityInner(MessageParcel& data, MessageParcel& reply); 57686862fbSopenharmony_ci int32_t ConnectAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply); 58686862fbSopenharmony_ci int32_t DisconnectAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply); 59686862fbSopenharmony_ci int32_t NotifyProcessDiedFromRemoteInner(MessageParcel& data, MessageParcel& reply); 60686862fbSopenharmony_ci 61686862fbSopenharmony_ci#ifdef DMSFWK_INTERACTIVE_ADAPTER 62686862fbSopenharmony_ci bool CheckDmsExtensionCallingUid(); 63686862fbSopenharmony_ci int32_t StartAbilityFromRemoteAdapterInner(MessageParcel& data, MessageParcel& reply); 64686862fbSopenharmony_ci int32_t StopAbilityFromRemoteAdapterInner(MessageParcel& data, MessageParcel& reply); 65686862fbSopenharmony_ci int32_t ConnectAbilityFromRemoteAdapterInner(MessageParcel& data, MessageParcel& reply); 66686862fbSopenharmony_ci int32_t DisconnectAbilityFromRemoteAdapterInner(MessageParcel& data, MessageParcel& reply); 67686862fbSopenharmony_ci int32_t NotifyAbilityLifecycleChangedFromRemoteAdapterInner(MessageParcel& data, MessageParcel& reply); 68686862fbSopenharmony_ci#endif 69686862fbSopenharmony_ci 70686862fbSopenharmony_ci#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER 71686862fbSopenharmony_ci int32_t GetMissionInfosInner(MessageParcel& data, MessageParcel& reply); 72686862fbSopenharmony_ci int32_t GetRemoteMissionSnapshotInfoInner(MessageParcel& data, MessageParcel& reply); 73686862fbSopenharmony_ci int32_t RegisterMissionListenerInner(MessageParcel& data, MessageParcel& reply); 74686862fbSopenharmony_ci int32_t RegisterDSchedEventListenerInner(MessageParcel& data, MessageParcel& reply); 75686862fbSopenharmony_ci int32_t UnRegisterDSchedEventListenerInner(MessageParcel& data, MessageParcel& reply); 76686862fbSopenharmony_ci int32_t GetContinueInfoInner(MessageParcel& data, MessageParcel& reply); 77686862fbSopenharmony_ci int32_t GetDSchedEventInfoInner(MessageParcel& data, MessageParcel& reply); 78686862fbSopenharmony_ci int32_t RegisterOnListenerInner(MessageParcel& data, MessageParcel& reply); 79686862fbSopenharmony_ci int32_t RegisterOffListenerInner(MessageParcel& data, MessageParcel& reply); 80686862fbSopenharmony_ci int32_t UnRegisterMissionListenerInner(MessageParcel& data, MessageParcel& reply); 81686862fbSopenharmony_ci int32_t StartSyncRemoteMissionsInner(MessageParcel& data, MessageParcel& reply); 82686862fbSopenharmony_ci int32_t StartSyncMissionsFromRemoteInner(MessageParcel& data, MessageParcel& reply); 83686862fbSopenharmony_ci int32_t StopSyncRemoteMissionsInner(MessageParcel& data, MessageParcel& reply); 84686862fbSopenharmony_ci int32_t StopSyncMissionsFromRemoteInner(MessageParcel& data, MessageParcel& reply); 85686862fbSopenharmony_ci int32_t NotifyMissionsChangedFromRemoteInner(MessageParcel& data, MessageParcel& reply); 86686862fbSopenharmony_ci int32_t SetMissionContinueStateInner(MessageParcel& data, MessageParcel& reply); 87686862fbSopenharmony_ci#endif 88686862fbSopenharmony_ci int32_t StartRemoteAbilityByCallInner(MessageParcel& data, MessageParcel& reply); 89686862fbSopenharmony_ci int32_t ReleaseRemoteAbilityInner(MessageParcel& data, MessageParcel& reply); 90686862fbSopenharmony_ci int32_t StartAbilityByCallFromRemoteInner(MessageParcel& data, MessageParcel& reply); 91686862fbSopenharmony_ci int32_t ReleaseAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply); 92686862fbSopenharmony_ci int32_t StartRemoteFreeInstallInner(MessageParcel& data, MessageParcel& reply); 93686862fbSopenharmony_ci int32_t CreateJsonObject(std::string& extraInfo, CallerInfo& callerInfo, AccountInfo& accountInfo); 94686862fbSopenharmony_ci int32_t StartFreeInstallFromRemoteInner(MessageParcel& data, MessageParcel& reply); 95686862fbSopenharmony_ci int32_t ReadDataForFreeInstall(MessageParcel& data, 96686862fbSopenharmony_ci CallerInfo &callerInfo, AccountInfo &accountInfo, int64_t &taskId); 97686862fbSopenharmony_ci int32_t NotifyCompleteFreeInstallFromRemoteInner(MessageParcel& data, MessageParcel& reply); 98686862fbSopenharmony_ci#ifdef SUPPORT_DISTRIBUTED_FORM_SHARE 99686862fbSopenharmony_ci int32_t StartRemoteShareFormInner(MessageParcel& data, MessageParcel& reply); 100686862fbSopenharmony_ci int32_t StartShareFormFromRemoteInner(MessageParcel& data, MessageParcel& reply); 101686862fbSopenharmony_ci#endif 102686862fbSopenharmony_ci int32_t NotifyStateChangedFromRemoteInner(MessageParcel& data, MessageParcel& reply); 103686862fbSopenharmony_ci int32_t GetDistributedComponentListInner(MessageParcel& data, MessageParcel& reply); 104686862fbSopenharmony_ci void ReportEvent(const OHOS::AAFwk::Want& want, const std::string& eventName, int32_t result, int32_t callerUid); 105686862fbSopenharmony_ci bool CheckDmsRequestPermission(); 106686862fbSopenharmony_ci bool CheckCallingUid(); 107686862fbSopenharmony_ci bool EnforceInterfaceToken(MessageParcel& data); 108686862fbSopenharmony_ci bool CallerInfoUnmarshalling(CallerInfo& callerInfo, MessageParcel& data); 109686862fbSopenharmony_ci bool IsUsingQos(const std::string& remoteDeviceId); 110686862fbSopenharmony_ci void SaveExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo, AccountInfo& accountInfo); 111686862fbSopenharmony_ci void SaveSendResultExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo, 112686862fbSopenharmony_ci AccountInfo& accountInfo); 113686862fbSopenharmony_ci void InitExtendedLocalFuncsInner(); 114686862fbSopenharmony_ci void InitLocalFuncsInner(); 115686862fbSopenharmony_ci void InitLocalMissionManagerInner(); 116686862fbSopenharmony_ci void InitRemoteFuncsInner(); 117686862fbSopenharmony_ci 118686862fbSopenharmony_ci int32_t StopRemoteExtensionAbilityInner(MessageParcel& data, MessageParcel& reply); 119686862fbSopenharmony_ci int32_t StopExtensionAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply); 120686862fbSopenharmony_ci 121686862fbSopenharmony_ci std::shared_ptr<AAFwk::Want> ReadDistributedWant(MessageParcel& data); 122686862fbSopenharmony_ci int32_t GetEncodeDSchedEventNotify(const EventNotify& event, MessageParcel& reply); 123686862fbSopenharmony_ci int32_t ReadDataForConnect(MessageParcel& data, CallerInfo& callerInfo, AccountInfo& accountInfo); 124686862fbSopenharmony_ci int32_t GetStartAbilityFromRemoteExParam(MessageParcel& data, OHOS::AppExecFwk::AbilityInfo& abilityInfo, 125686862fbSopenharmony_ci int32_t& requestCode, CallerInfo& callerInfo, AccountInfo& accountInfo); 126686862fbSopenharmony_ci int32_t GetConnectAbilityFromRemoteExParam(MessageParcel& data, AppExecFwk::AbilityInfo& abilityInfo, 127686862fbSopenharmony_ci sptr<IRemoteObject>& connect, CallerInfo& callerInfo, AccountInfo& accountInfo); 128686862fbSopenharmony_ci 129686862fbSopenharmony_ciprivate: 130686862fbSopenharmony_ci using DistributedSchedFunc = int32_t(DistributedSchedStub::*)(MessageParcel& data, MessageParcel& reply); 131686862fbSopenharmony_ci std::map<uint32_t, DistributedSchedFunc> remoteFuncsMap_; 132686862fbSopenharmony_ci std::map<uint32_t, DistributedSchedFunc> localFuncsMap_; 133686862fbSopenharmony_ci}; 134686862fbSopenharmony_ci} // namespace DistributedSchedule 135686862fbSopenharmony_ci} // namespace OHOS 136686862fbSopenharmony_ci#endif // OHOS_DISTRIBUTED_SCHEDULE_STUB_H 137