diff --git a/frameworks/native/backup_ext/include/ext_extension.h b/frameworks/native/backup_ext/include/ext_extension.h index 2d9c56ba236428285b836a434ee840756179f43a..7002a49c3971486ddbffb73aaa0d5de25c2f21c4 100644 --- a/frameworks/native/backup_ext/include/ext_extension.h +++ b/frameworks/native/backup_ext/include/ext_extension.h @@ -217,30 +217,30 @@ private: void StartFwkTimer(bool &isFwkStart); /** - * @brief get increCallbackEx for execute onRestore with string param + * @brief get callbackEx for execute onRestore * - * @param errCode + * @param obj */ std::function IncreOnRestoreExCallback(wptr obj); /** * @brief get increCallback for execute onRestore with string param * - * @param errCode + * @param obj */ std::function IncreOnRestoreCallback(wptr obj); /** * @brief get callback for execute onRestore with string param * - * @param errCode + * @param obj */ std::function OnRestoreCallback(wptr obj); /** - * @brief get callbackEx for execute onRestore with string param + * @brief get increCallbackEx for execute onRestore with string param * - * @param errCode + * @param obj */ std::function OnRestoreExCallback(wptr obj); @@ -322,8 +322,8 @@ private: std::mutex onStartTimeLock_; AppRadar::DoRestoreInfo radarRestoreInfo_ { 0 }; OHOS::ThreadPool onProcessTaskPool_; - std::atomic isFirstCallOnProcess_ { false }; - std::atomic isExecAppDone_ { false }; + std::atomic isFirstCallOnProcess_ {false}; + std::atomic isExecAppDone_ {false}; BackupRestoreScenario curScenario_ { BackupRestoreScenario::FULL_BACKUP }; }; diff --git a/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_restore_session.h b/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_restore_session.h index 2a4d6c2ffedafb727268de3b2a4ddb03cbae8ab9..3a2e2ec5fd4d3bd87fffdde7ecc9a4da70e0286e 100644 --- a/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_restore_session.h +++ b/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_restore_session.h @@ -93,7 +93,6 @@ public: * * @param remoteCap 已打开的保存远端设备能力的Json文件。可使用GetLocalCapabilities方法获取 * @param bundlesToRestore 待恢复的应用清单 - * * @return ErrCode 规范错误码 */ ErrCode AppendBundles(UniqueFd remoteCap, std::vector bundlesToRestore); diff --git a/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_session_restore_async.h b/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_session_restore_async.h index 8405b9b88aa67fa16d707b336eb6ca0a2e902dcb..fc705c6f63a2996afbae716e4c8405fe689dbeac 100644 --- a/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_session_restore_async.h +++ b/interfaces/inner_api/native/backup_kit_inner/impl/b_incremental_session_restore_async.h @@ -79,12 +79,15 @@ public: * * @param remoteCap 已打开的保存远端设备能力的Json文件。可使用GetLocalCapabilities方法获取 * @param bundlesToRestore 待恢复的应用清单 + * @param detailInfos bundle的单双映射关系json串 * @param userId 用户ID * @return ErrCode 规范错误码 - */ - ErrCode AppendBundles(UniqueFd remoteCap, std::vector bundlesToRestore, - std::vector detailInfos, RestoreTypeEnum restoreType = RestoreTypeEnum::RESTORE_DATA_WAIT_SEND, - int32_t userId = DEFAULT_INVAL_VALUE); + */ + ErrCode AppendBundles(UniqueFd remoteCap, + std::vector bundlesToRestore, + std::vector detailInfos, + RestoreTypeEnum restoreType = RestoreTypeEnum::RESTORE_DATA_WAIT_SEND, + int32_t userId = DEFAULT_INVAL_VALUE); /** * @brief 用于追加待恢复应用 diff --git a/tests/mock/backup_kit_inner/b_session_restore_async_mock.cpp b/tests/mock/backup_kit_inner/b_session_restore_async_mock.cpp index b1b7b6b2b9587543ec892203481f66fbc9701c79..9e680cd346eea84a7c7045bf1e2af753ae7ca7a8 100644 --- a/tests/mock/backup_kit_inner/b_session_restore_async_mock.cpp +++ b/tests/mock/backup_kit_inner/b_session_restore_async_mock.cpp @@ -80,7 +80,6 @@ ErrCode BSessionRestoreAsync::AppendBundles(UniqueFd remoteCap, vector &bundleNames, - const vector &detailInfos, RestoreTypeEnum restoreType, int32_t userId) +ErrCode ServiceProxy::AppendBundlesRestoreSession(UniqueFd fd, + const vector &bundleNames, + RestoreTypeEnum restoreType, + int32_t userId) { return BError(BError::Codes::OK); } ErrCode ServiceProxy::AppendBundlesRestoreSession(UniqueFd fd, const vector &bundleNames, + const vector &detailInfos, RestoreTypeEnum restoreType, int32_t userId) { diff --git a/tests/moduletests/backup_kit_inner/BUILD.gn b/tests/moduletests/backup_kit_inner/BUILD.gn index 9d97e78341cadf84aad1969755b474194bb2976e..c3fc260eee40865512d9d714ed0bf6303853f5fd 100644 --- a/tests/moduletests/backup_kit_inner/BUILD.gn +++ b/tests/moduletests/backup_kit_inner/BUILD.gn @@ -44,12 +44,6 @@ ohos_unittest("b_session_test") { "${path_backup}/utils:backup_utils", ] - cflags = [ "--coverage" ] - - ldflags = [ "--coverage" ] - - cflags_cc = [ "--coverage" ] - external_deps = [ "c_utils:utils", "hilog:libhilog", diff --git a/tests/moduletests/backup_kit_inner/b_session_restore_async_test.cpp b/tests/moduletests/backup_kit_inner/b_session_restore_async_test.cpp index deb124f876c46082e2e1ff40258851e3adc03d8e..9d6d8e81a51a55e1d61c372e44072d41bc5dd907 100644 --- a/tests/moduletests/backup_kit_inner/b_session_restore_async_test.cpp +++ b/tests/moduletests/backup_kit_inner/b_session_restore_async_test.cpp @@ -54,11 +54,6 @@ static void OnBackupServiceDied() GTEST_LOG_(INFO) << "BSessionRestoreAsyncTest OnBackupServiceDied OK"; } -static void OnResultReport(std::string bundleName, std::string result) -{ - GTEST_LOG_(INFO) << "BSessionRestoreAsyncTest OnResultReport OK"; -} - class BSessionRestoreAsyncTest : public testing::Test { public: static void SetUpTestCase(void) {}; @@ -92,7 +87,6 @@ void BSessionRestoreAsyncTest::Init() callbacks_.onBundleFinished = OnBundleFinished; callbacks_.onAllBundlesFinished = OnAllBundlesFinished; callbacks_.onBackupServiceDied = OnBackupServiceDied; - callbacks_.onResultReport = OnResultReport; } /** @@ -115,7 +109,6 @@ HWTEST_F(BSessionRestoreAsyncTest, SUB_backup_b_session_restore_async_0100, test callbacks_.onBundleFinished(ErrCode(BError::Codes::OK), ""); callbacks_.onAllBundlesFinished(ErrCode(BError::Codes::OK)); callbacks_.onBackupServiceDied(); - callbacks_.onResultReport("", ""); } catch (...) { EXPECT_TRUE(false); GTEST_LOG_(INFO) << "BSessionRestoreAsyncTest-an exception occurred by Callbacks."; diff --git a/tests/moduletests/backup_kit_inner/b_session_restore_test.cpp b/tests/moduletests/backup_kit_inner/b_session_restore_test.cpp index b91a476838a20613ff9f23c6d835e869546d26ca..1ab1115b1996cfbcf16494f7c5a58fa02da0e2c7 100644 --- a/tests/moduletests/backup_kit_inner/b_session_restore_test.cpp +++ b/tests/moduletests/backup_kit_inner/b_session_restore_test.cpp @@ -55,11 +55,6 @@ static void OnBackupServiceDied() GTEST_LOG_(INFO) << "BSessionRestoreTest OnBackupServiceDied OK"; } -static void OnResultReport(std::string bundleName, const std::string result) -{ - GTEST_LOG_(INFO) << "BSessionRestoreAsyncTest OnResultReport OK"; -} - class BSessionRestoreTest : public testing::Test { public: static void SetUpTestCase(void) {}; @@ -93,7 +88,6 @@ void BSessionRestoreTest::Init() callbacks_.onBundleFinished = OnBundleFinished; callbacks_.onAllBundlesFinished = OnAllBundlesFinished; callbacks_.onBackupServiceDied = OnBackupServiceDied; - callbacks_.onResultReport = OnResultReport; } /** diff --git a/tests/unittests/backup_api/backup_impl/include/i_service_mock.h b/tests/unittests/backup_api/backup_impl/include/i_service_mock.h index ec2a2867f161d07687a5110db764a1564a6ba81f..a0da61edc9fc132789a051c9f64d6a9cb84218a6 100644 --- a/tests/unittests/backup_api/backup_impl/include/i_service_mock.h +++ b/tests/unittests/backup_api/backup_impl/include/i_service_mock.h @@ -102,6 +102,7 @@ public: ErrCode AppendBundlesRestoreSession(UniqueFd fd, const std::vector &bundleNames, + const std::vector &detailInfos, RestoreTypeEnum restoreType, int32_t userId) override { @@ -110,7 +111,6 @@ public: ErrCode AppendBundlesRestoreSession(UniqueFd fd, const std::vector &bundleNames, - const std::vector &detailInfos, RestoreTypeEnum restoreType, int32_t userId) override { diff --git a/utils/include/b_json/b_json_entity_caps.h b/utils/include/b_json/b_json_entity_caps.h index e641077e010be6bec3657ce1e2f5891d498bfdc7..74d092864e9b6f7f3356106cf9db82701ee4678d 100644 --- a/utils/include/b_json/b_json_entity_caps.h +++ b/utils/include/b_json/b_json_entity_caps.h @@ -204,10 +204,6 @@ public: if (item.isMember("extraInfo") && item["extraInfo"].isObject()) { extraInfo = item["extraInfo"]; } - int64_t increSpaceOccupied = 0; - if (item.isMember("increSpaceOccupied") && item["increSpaceOccupied"].isInt64()) { - increSpaceOccupied = item["increSpaceOccupied"].asInt64(); - } bool fullBackupOnly = false; if (item.isMember("fullBackupOnly") && item["fullBackupOnly"].isBool()) { fullBackupOnly = item["fullBackupOnly"].asBool(); @@ -216,10 +212,13 @@ public: if (item.isMember("appIndex") && item["appIndex"].isInt()) { appIndex = item["appIndex"].asInt(); } + int64_t increSpaceOccupied = 0; + if (item.isMember("increSpaceOccupied") && item["increSpaceOccupied"].isInt64()) { + increSpaceOccupied = item["increSpaceOccupied"].asInt64(); + } bundleInfos.emplace_back(BundleInfo {item["name"].asString(), appIndex, item["versionCode"].asInt64(), item["versionName"].asString(), item["spaceOccupied"].asInt64(), - increSpaceOccupied, - item["allToBackup"].asBool(), fullBackupOnly, + increSpaceOccupied, item["allToBackup"].asBool(), fullBackupOnly, item["extensionName"].asString(), restoreDeps, supportScene, extraInfo}); }