diff --git a/services/backup_sa/include/module_app_gallery/app_gallery_service_connection.h b/services/backup_sa/include/module_app_gallery/app_gallery_service_connection.h index d653a8e537f18c0eb75755ce13262c39715255e2..21a710a0e3e399ffc2bff8c20a80210b8e072b19 100644 --- a/services/backup_sa/include/module_app_gallery/app_gallery_service_connection.h +++ b/services/backup_sa/include/module_app_gallery/app_gallery_service_connection.h @@ -30,7 +30,7 @@ namespace OHOS::FileManagement::Backup { using namespace OHOS::AppExecFwk; -const int32_t CONNECT_TIME = 5; +const int32_t CONNECT_TIME = 3; template class AppGralleryConnection : public AbilityConnectionStub { public: diff --git a/services/backup_sa/include/module_ipc/service.h b/services/backup_sa/include/module_ipc/service.h index b45d1ae6eb4b46ba6fcdcbdc14d9bf584338fe2a..aefde85e19e9100e3ab26efd83ef3439187e59aa 100644 --- a/services/backup_sa/include/module_ipc/service.h +++ b/services/backup_sa/include/module_ipc/service.h @@ -90,6 +90,14 @@ public: */ virtual void ExtStart(const std::string &bundleName); + /** + * @brief 发送备份恢复通知到应用市场 + * + * @param bundleName 应用名称 + * + */ + void SendAppGalleryNotify(const std::string &bundleName); + public: explicit Service(int32_t saID, bool runOnCreate = false) : SystemAbility(saID, runOnCreate) { diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index d33611279508a4245b4f16e76627db353d45a08e..89d2aee73e3064c51224c6430795fd584c4d28fa 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -462,11 +462,6 @@ ErrCode Service::LaunchBackupExtension(const BundleName &bundleName) { try { HILOGE("begin %{public}s", bundleName.data()); - - DisposeErr disposeErr = AppGalleryDisposeProxy::GetInstance()->StartRestore(bundleName); - HILOGI("AppGalleryDisposeProxy StartRestore, code=%{public}d, bundleName=%{public}s", disposeErr, - bundleName.c_str()); - IServiceReverse::Scenario scenario = session_->GetScenario(); BConstants::ExtensionAction action; if (scenario == IServiceReverse::Scenario::BACKUP) { @@ -783,4 +778,14 @@ void Service::OnStartSched() } } } + +void Service::SendAppGalleryNotify(const BundleName &bundleName) +{ + IServiceReverse::Scenario scenario = session_->GetScenario(); + if (scenario == IServiceReverse::Scenario::RESTORE) { + DisposeErr disposeErr = AppGalleryDisposeProxy::GetInstance()->StartRestore(bundleName); + HILOGI("AppGalleryDisposeProxy StartRestore, code=%{public}d, bundleName=%{public}s", disposeErr, + bundleName.c_str()); + } +} } // namespace OHOS::FileManagement::Backup diff --git a/services/backup_sa/src/module_sched/sched_scheduler.cpp b/services/backup_sa/src/module_sched/sched_scheduler.cpp index 696d3539ef6f7503c0e7f69fb16eec4ce847a69a..f7c009d7ce5477166e4fbeac2bf74285f607a113 100644 --- a/services/backup_sa/src/module_sched/sched_scheduler.cpp +++ b/services/backup_sa/src/module_sched/sched_scheduler.cpp @@ -72,6 +72,9 @@ void SchedScheduler::ExecutingQueueTasks(const string &bundleName) InstallingState(bundleName); BConstants::ServiceSchedAction action = sessionPtr_->GetServiceSchedAction(bundleName); if (action == BConstants::ServiceSchedAction::START) { + // 通知应用市场 + reversePtr_->SendAppGalleryNotify(bundleName); + // 注册启动定时器 auto callStart = [reversePtr {reversePtr_}, bundleName]() { HILOGE("Extension connect failed = %{public}s", bundleName.data()); diff --git a/tests/mock/module_ipc/service_mock.cpp b/tests/mock/module_ipc/service_mock.cpp index a4e6dc93141a052ba88e306bbf7b95ce2f0c65bc..6c69ba3e7ad66cd22bcb2701d6b0a575384e72c9 100644 --- a/tests/mock/module_ipc/service_mock.cpp +++ b/tests/mock/module_ipc/service_mock.cpp @@ -125,4 +125,6 @@ void Service::VerifyCaller(IServiceReverse::Scenario scenario) {} void Service::OnAllBundlesFinished(ErrCode errCode) {} void Service::OnStartSched() {} + +void Service::SendAppGalleryNotify(const BundleName &bundleName) {} } // namespace OHOS::FileManagement::Backup