From c980fda0ca8e6ebe9537b6ce3046cc6c1fd9e294 Mon Sep 17 00:00:00 2001 From: huaqingsimeng Date: Mon, 11 Sep 2023 15:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E6=81=A2=E5=A4=8D=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=A4=87=E4=BB=BD=E6=81=A2=E5=A4=8D=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E5=BA=94=E7=94=A8=E6=97=B6=EF=BC=8C=E7=AD=89?= =?UTF-8?q?=E5=BE=85=E9=94=99=E8=AF=AF=E8=BF=94=E5=9B=9E=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=BF=87=E4=B9=85=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huaqingsimeng --- services/backup_sa/src/module_ipc/service.cpp | 16 ++++++++++++++++ .../src/module_ipc/svc_session_manager.cpp | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 9b77fdf77..fec057796 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -143,6 +143,7 @@ string Service::VerifyCallerAndGetCallerName() session_->VerifyBundleName(hapTokenInfo.bundleName); return hapTokenInfo.bundleName; } else { + HILOGE("tokenID = %{private}d", tokenCaller); throw BError(BError::Codes::SA_INVAL_ARG, string("Invalid token type ").append(to_string(tokenType))); } } @@ -238,6 +239,7 @@ ErrCode Service::AppendBundlesRestoreSession(UniqueFd fd, session_->SetSessionUserId(userId); } VerifyCaller(IServiceReverse::Scenario::RESTORE); + auto restoreInfos = BundleMgrAdapter::GetBundleInfos(bundleNames, session_->GetSessionUserId()); BJsonCachedEntity cachedEntity(move(fd)); auto cache = cachedEntity.Structuralize(); auto bundleInfos = cache.GetBundleInfos(); @@ -256,6 +258,13 @@ ErrCode Service::AppendBundlesRestoreSession(UniqueFd fd, session_->SetBundleVersionName(bundleInfo.name, bundleInfo.versionName); } } + for (auto info : restoreInfos) { + if (info.allToBackup == false) { + session_->GetServiceReverseProxy()->RestoreOnBundleStarted(BError(BError::Codes::SA_REFUSED_ACT), + info.name); + session_->RemoveExtInfo(info.name); + } + } Start(); Finish(); OnStartSched(); @@ -266,7 +275,14 @@ ErrCode Service::AppendBundlesBackupSession(const vector &bundleName { HILOGI("Begin"); VerifyCaller(IServiceReverse::Scenario::BACKUP); + auto backupInfos = BundleMgrAdapter::GetBundleInfos(bundleNames, session_->GetSessionUserId()); session_->AppendBundles(bundleNames); + for (auto info : backupInfos) { + if (info.allToBackup == false) { + session_->GetServiceReverseProxy()->BackupOnBundleStarted(BError(BError::Codes::SA_REFUSED_ACT), info.name); + session_->RemoveExtInfo(info.name); + } + } Start(); Finish(); OnStartSched(); diff --git a/services/backup_sa/src/module_ipc/svc_session_manager.cpp b/services/backup_sa/src/module_ipc/svc_session_manager.cpp index 9b5f1abf6..b962f71f7 100644 --- a/services/backup_sa/src/module_ipc/svc_session_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_session_manager.cpp @@ -197,7 +197,9 @@ void SvcSessionManager::RemoveExtInfo(const string &bundleName) return; } impl_.backupExtNameMap.erase(it); - extConnectNum_--; + if (extConnectNum_) { + extConnectNum_--; + } } wptr SvcSessionManager::GetExtConnection(const BundleName &bundleName) -- Gitee