From 740edbd60ff4862c43ec930b3df986d905506a24 Mon Sep 17 00:00:00 2001 From: huaqingsimeng <1004904143@qq.com> Date: Tue, 18 Jul 2023 15:12:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E6=81=A2=E5=A4=8D=E9=9D=99?= =?UTF-8?q?=E6=80=81=E6=89=AB=E6=8F=8F=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huaqingsimeng --- .../backup_kit_inner/src/b_session_restore_async.cpp | 3 ++- tools/backup_tool/BUILD.gn | 1 + tools/backup_tool/src/tools_op_restore_async.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp index 38e8e1673..c3f0b8ee8 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp @@ -139,7 +139,8 @@ void BSessionRestoreAsync::AppendBundlesImpl(AppendBundleInfo info) { auto proxy = ServiceProxy::GetInstance(); if (proxy == nullptr) { - BError(BError::Codes::SDK_BROKEN_IPC, "Failed to get backup service").GetCode(); + return OnBundleStarted(BError(BError::Codes::SDK_BROKEN_IPC, "Failed to get backup service").GetCode(), + info.bundlesToRestore); } auto onBackupServiceDied = bind(&BSessionRestoreAsync::OnBackupServiceDied, shared_from_this()); RegisterBackupServiceDied(onBackupServiceDied); diff --git a/tools/backup_tool/BUILD.gn b/tools/backup_tool/BUILD.gn index f27c0d80e..6d8c5f5ed 100644 --- a/tools/backup_tool/BUILD.gn +++ b/tools/backup_tool/BUILD.gn @@ -22,6 +22,7 @@ ohos_executable("backup_tool") { "src/tools_op_check_sa.cpp", "src/tools_op_help.cpp", "src/tools_op_restore.cpp", + "src/tools_op_restore_async.cpp", ] defines = [ diff --git a/tools/backup_tool/src/tools_op_restore_async.cpp b/tools/backup_tool/src/tools_op_restore_async.cpp index b79f15d2a..82ed49779 100644 --- a/tools/backup_tool/src/tools_op_restore_async.cpp +++ b/tools/backup_tool/src/tools_op_restore_async.cpp @@ -239,7 +239,10 @@ static int32_t AppendBundles(shared_ptr restore, return 0; } -static int32_t InitArg(const string &pathCapFile, vector bundleNames, const string &type, const string &userId) +static int32_t InitArg(const string &pathCapFile, + const vector &bundleNames, + const string &type, + const string &userId) { StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Init"); BExcepUltils::VerifyPath(pathCapFile, false); @@ -268,7 +271,7 @@ static int32_t InitArg(const string &pathCapFile, vector bundleNames, co static int Exec(map> &mapArgToVal) { if (mapArgToVal.find("pathCapFile") == mapArgToVal.end() || mapArgToVal.find("bundles") == mapArgToVal.end() || - mapArgToVal["restoreType"].empty() || mapArgToVal["userId"].empty()) { + mapArgToVal.find("restoreType") == mapArgToVal.end() || mapArgToVal.find("userId") == mapArgToVal.end()) { return -EPERM; } return InitArg(*(mapArgToVal["pathCapFile"].begin()), mapArgToVal["bundles"], *(mapArgToVal["restoreType"].begin()), -- Gitee