From a1f75da1a3e0d9bc28fa05c638b550290b642223 Mon Sep 17 00:00:00 2001 From: "yaoruozi1@huawei.com" Date: Tue, 16 Apr 2024 21:08:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=BA=94=E7=94=A8=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=EF=BC=8C=E6=9F=90=E4=B8=AA=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=BA=94=E8=AF=A5=E8=AE=A9=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yaoruozi1@huawei.com --- services/backup_sa/src/module_external/bms_adapter.cpp | 5 +++++ .../backup_sa/src/module_notify/notify_work_service.cpp | 6 ++++-- services/backup_sa/src/module_sched/sched_scheduler.cpp | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/services/backup_sa/src/module_external/bms_adapter.cpp b/services/backup_sa/src/module_external/bms_adapter.cpp index aa78ed8a7..97100b24e 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 6aa9a9819..3523d74ae 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 84d539bf7..61ac9a340 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); } } -- Gitee