规范参数调用方式

Signed-off-by: m30043719 <maxiaodong25@huawei.com>
This commit is contained in:
m30043719 2024-10-23 14:11:41 +08:00
parent 42cbdc4981
commit acc75b38b8
2 changed files with 42 additions and 33 deletions

View File

@ -101,6 +101,7 @@ public:
* @param startReason, The reason why SA was pulled up.
*/
void HandleBootStart(const SystemAbilityOnDemandReason &startReason);
bool DoStart();
int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override;
void DeviceOnlineNotify(const std::string& deviceId);
void DeviceOfflineNotify(const std::string& deviceId);

View File

@ -155,40 +155,10 @@ DistributedSchedService::DistributedSchedService() : SystemAbility(DISTRIBUTED_S
void DistributedSchedService::OnStart(const SystemAbilityOnDemandReason &startReason)
{
HILOGI("OnStart reason %{public}s, reasonId_:%{public}d", startReason.GetName().c_str(), startReason.GetId());
#ifdef DMS_SERVICE_DISABLE
HILOGI("DMS service disabled, exiting.");
_exit(0);
#endif
HILOGI("Dms service OnStart enter.");
if (!Init()) {
HILOGE("failed to init DistributedSchedService");
if (!DoStart()) {
HILOGI("OnStart dms service failed.");
return;
}
FuncContinuationCallback continuationCallback = [this] (int32_t missionId) {
HILOGW("continuationCallback timeout.");
NotifyContinuationCallbackResult(missionId, CONTINUE_ABILITY_TIMEOUT_ERR);
};
DmsCallbackTaskInitCallbackFunc freeCallback = [this] (int64_t taskId) {
HILOGW("DmsCallbackTaskInitCallbackFunc timeout, taskId:%{public}" PRId64 ".", taskId);
NotifyCompleteFreeInstallFromRemote(taskId, AAFwk::FREE_INSTALL_TIMEOUT);
};
dschedContinuation_ = std::make_shared<DSchedContinuation>();
collaborateCbMgr_ = std::make_shared<DSchedCollaborationCallbackMgr>();
dmsCallbackTask_ = std::make_shared<DmsCallbackTask>();
dschedContinuation_->Init(continuationCallback);
collaborateCbMgr_->Init();
dmsCallbackTask_->Init(freeCallback);
#ifdef DMSFWK_INTERACTIVE_ADAPTER
HILOGI("Get dms interactive adapter proxy enter.");
int32_t ret = GetDmsInteractiveAdapterProxy();
if (ret != ERR_OK) {
HILOGE("Get remote dms interactive adapter proxy fail, ret %{public}d.", ret);
}
#endif
HILOGI("OnStart dms service success.");
Publish(this);
HandleBootStart(startReason);
}
@ -214,7 +184,7 @@ void DistributedSchedService::OnStop(const SystemAbilityOnDemandReason &stopReas
void DistributedSchedService::OnActive(const SystemAbilityOnDemandReason &activeReason)
{
HILOGI("OnStart reason %{public}s, reasonId_:%{public}d", activeReason.GetName().c_str(), activeReason.GetId());
OnStart(activeReason);
DoStart();
}
void DistributedSchedService::HandleBootStart(const SystemAbilityOnDemandReason &startReason)
@ -240,6 +210,44 @@ void DistributedSchedService::HandleBootStart(const SystemAbilityOnDemandReason
}
}
bool DistributedSchedService::DoStart()
{
#ifdef DMS_SERVICE_DISABLE
HILOGI("DMS service disabled, exiting.");
_exit(0);
#endif
HILOGI("Dms service DoStart enter.");
if (!Init()) {
HILOGE("failed to init DistributedSchedService");
return false;
}
FuncContinuationCallback continuationCallback = [this] (int32_t missionId) {
HILOGW("continuationCallback timeout.");
NotifyContinuationCallbackResult(missionId, CONTINUE_ABILITY_TIMEOUT_ERR);
};
DmsCallbackTaskInitCallbackFunc freeCallback = [this] (int64_t taskId) {
HILOGW("DmsCallbackTaskInitCallbackFunc timeout, taskId:%{public}" PRId64 ".", taskId);
NotifyCompleteFreeInstallFromRemote(taskId, AAFwk::FREE_INSTALL_TIMEOUT);
};
dschedContinuation_ = std::make_shared<DSchedContinuation>();
collaborateCbMgr_ = std::make_shared<DSchedCollaborationCallbackMgr>();
dmsCallbackTask_ = std::make_shared<DmsCallbackTask>();
dschedContinuation_->Init(continuationCallback);
collaborateCbMgr_->Init();
dmsCallbackTask_->Init(freeCallback);
#ifdef DMSFWK_INTERACTIVE_ADAPTER
HILOGI("Get dms interactive adapter proxy enter.");
int32_t ret = GetDmsInteractiveAdapterProxy();
if (ret != ERR_OK) {
HILOGE("Get remote dms interactive adapter proxy fail, ret %{public}d.", ret);
}
#endif
HILOGI("OnStart dms service success.");
return true;
}
int32_t DistributedSchedService::Dump(int32_t fd, const std::vector<std::u16string>& args)
{
std::vector<std::string> argsInStr8;