diff --git a/services/backup_sa/src/module_external/bms_adapter.cpp b/services/backup_sa/src/module_external/bms_adapter.cpp index aa78ed8a7d0dae9115f5b330072ff582da0a7837..97100b24ecdf00953b62ca396e6269390de7403c 100644 --- a/services/backup_sa/src/module_external/bms_adapter.cpp +++ b/services/backup_sa/src/module_external/bms_adapter.cpp @@ -45,6 +45,7 @@ const string LINUX_HAP_CODE_PATH = "2"; const string MEDIA_LIBRARY_HAP = "com.ohos.medialibrary.medialibrarydata"; const string EXTERNAL_FILE_HAP = "com.ohos.UserFile.ExternalFileManager"; const int E_ERR = -1; +const int SINGLE_BUNDLE_NUM = 1; const vector dataDir = {"app", "local", "distributed", "database", "cache"}; } // namespace @@ -115,6 +116,10 @@ vector BundleMgrAdapter::GetBundleInfos(const vecto HILOGI("Begin Get bundleName:%{public}s", bundleName.c_str()); AppExecFwk::BundleInfo installedBundle; if (!bms->GetBundleInfo(bundleName, AppExecFwk::GET_BUNDLE_WITH_EXTENSION_INFO, installedBundle, userId)) { + if (bundleNames.size() != SINGLE_BUNDLE_NUM) { + HILOGE("bundleName:%{public}s, current bundle info for backup/restore is empty", bundleName.c_str()); + continue; + } throw BError(BError::Codes::SA_BUNDLE_INFO_EMPTY, "Failed to get bundle info"); } if (installedBundle.applicationInfo.codePath == HMOS_HAP_CODE_PATH || diff --git a/services/backup_sa/src/module_notify/notify_work_service.cpp b/services/backup_sa/src/module_notify/notify_work_service.cpp index 6aa9a98193296b4ef88262eb767151a34ec4750f..3523d74aef5edf13c6f00e64072ef61c8529ffc8 100644 --- a/services/backup_sa/src/module_notify/notify_work_service.cpp +++ b/services/backup_sa/src/module_notify/notify_work_service.cpp @@ -35,11 +35,13 @@ bool NotifyWorkService::NotifyBundleDetail(BJsonUtil::BundleDetailInfo bundleDet { AAFwk::Want want; std::string bundleName = bundleDetailInfo.bundleName; - HILOGI("Start publish event, bundleName is: %{public}s", bundleName.c_str()); + std::string bundleDetail = bundleDetailInfo.detail; + HILOGI("Start publish event, bundleName is: %{public}s, detail:%{public}s", bundleName.c_str(), + bundleDetail.c_str()); want.SetParam("bundleName", bundleName); want.SetParam("userId", bundleDetailInfo.userId); want.SetParam("index", bundleDetailInfo.bundleIndex); - want.SetParam("detail", bundleDetailInfo.detail); + want.SetParam("detail", bundleDetail); want.SetAction(EVENT_NAME); EventFwk::CommonEventData commonData {want}; HILOGI("End publish event, bundleName is: %{public}s", bundleName.c_str()); diff --git a/services/backup_sa/src/module_sched/sched_scheduler.cpp b/services/backup_sa/src/module_sched/sched_scheduler.cpp index 84d539bf76101acbda3f21ee7c4baa4ea12855dd..61ac9a3408e74c75ae8d7e63ffc209708ebe43f1 100644 --- a/services/backup_sa/src/module_sched/sched_scheduler.cpp +++ b/services/backup_sa/src/module_sched/sched_scheduler.cpp @@ -84,6 +84,7 @@ void SchedScheduler::ExecutingQueueTasks(const string &bundleName) // 启动extension reversePtr_->LaunchBackupExtension(bundleName); } else if (action == BConstants::ServiceSchedAction::RUNNING) { + HILOGI("Current bundle %{public}s process is running", bundleName.data()); unique_lock lock(lock_); auto iter = find_if(bundleTimeVec_.begin(), bundleTimeVec_.end(), [&bundleName](auto &obj) { auto &[bName, iTime] = obj; @@ -97,6 +98,7 @@ void SchedScheduler::ExecutingQueueTasks(const string &bundleName) extTime_.Unregister(iTime); lock.unlock(); // 开始执行备份恢复流程 + HILOGI("Current bundle %{public}s extension start", bundleName.data()); reversePtr_->ExtStart(bundleName); } }