From dc1dc01cb5981475ee8f8325192a66a6b8a4dd7c Mon Sep 17 00:00:00 2001 From: "Zhangyao(Maggie)" Date: Tue, 14 Jan 2025 19:26:46 +0800 Subject: [PATCH] radar 3.0 Signed-off-by: Zhangyao(Maggie) --- .../native/backup_ext/src/ext_extension.cpp | 2 +- .../backup_ext/src/sub_ext_extension.cpp | 2 +- .../backup_sa/include/module_ipc/service.h | 16 +++- .../include/module_ipc/svc_session_manager.h | 8 ++ services/backup_sa/src/module_ipc/service.cpp | 40 ++++++---- .../src/module_ipc/service_incremental.cpp | 4 + .../backup_sa/src/module_ipc/sub_service.cpp | 75 +++++++++++++++++++ .../src/module_ipc/svc_session_manager.cpp | 11 +++ .../include/svc_session_manager_mock.h | 2 + tests/mock/module_ipc/service_mock.cpp | 18 ++++- .../src/svc_session_manager_mock.cpp | 5 ++ .../module_ipc/svc_session_manager_mock.cpp | 5 ++ .../svc_session_manager_throw_mock.cpp | 5 ++ .../svc_session_manager_throw_mock.h | 2 + .../module_ipc/service_incremental_test.cpp | 16 ++++ utils/include/b_error/b_error.h | 6 ++ utils/include/b_radar/b_radar.h | 4 +- utils/include/b_resources/b_constants.h | 1 + 18 files changed, 200 insertions(+), 22 deletions(-) diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index d93c044de..616cb5fcf 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -1143,7 +1143,7 @@ ErrCode BackupExtExtension::RestoreFilesForSpecialCloneCloud() UniqueFd fd(open(INDEX_FILE_RESTORE.data(), O_RDONLY)); if (fd < 0) { HILOGE("Failed to open index json file = %{private}s, err = %{public}d", INDEX_FILE_RESTORE.c_str(), errno); - return BError::GetCodeByErrno(errno); + return errno; } BJsonCachedEntity cachedEntity(move(fd)); auto cache = cachedEntity.Structuralize(); diff --git a/frameworks/native/backup_ext/src/sub_ext_extension.cpp b/frameworks/native/backup_ext/src/sub_ext_extension.cpp index 36fea1e38..24e2a9c11 100644 --- a/frameworks/native/backup_ext/src/sub_ext_extension.cpp +++ b/frameworks/native/backup_ext/src/sub_ext_extension.cpp @@ -977,7 +977,7 @@ static TarMap GetIncrmentBigInfos(const vector &files) struct stat sta = {}; if (stat(item.filePath.c_str(), &sta) != 0) { HILOGE("Failed to stat file %{public}s, err = %{public}d", item.filePath.c_str(), errno); - throw BError(BError::Codes::EXT_INVAL_ARG, "Get file stat failed"); + throw errno; } string md5Name = getStringHash(bigFiles, item.filePath); if (!md5Name.empty()) { diff --git a/services/backup_sa/include/module_ipc/service.h b/services/backup_sa/include/module_ipc/service.h index 3d2cf16ba..89d2ded4c 100644 --- a/services/backup_sa/include/module_ipc/service.h +++ b/services/backup_sa/include/module_ipc/service.h @@ -559,7 +559,7 @@ private: void BundleBeginRadarReport(const std::string &bundleName, const ErrCode errCode, const IServiceReverse::Scenario scenario); - void BundleEndRadarReport(const std::string &bundleName, const ErrCode errCode, + void BundleEndRadarReport(const std::string &bundleName, ErrCode errCode, const IServiceReverse::Scenario scenario); void FileReadyRadarReport(const std::string &bundleName, const std::string &fileName, const ErrCode errCode, @@ -572,6 +572,16 @@ private: void PermissionCheckFailRadar(const std::string &info, const std::string &func); + bool IsReportBundleExecFail(const std::string &bundleName); + + void ClearBundleRadarReport(); + + void UpdateBundleRadarReport(const std::string &bundleName); + + bool IsReportFileReadyFail(const std::string &bundleName); + + void ClearFileReadyRadarReport(); + void UpdateFailedBundles(const std::string &bundleName, BundleTaskInfo taskInfo); void ClearFailedBundles(); @@ -623,6 +633,10 @@ private: friend class ServiceTest; OHOS::ThreadPool threadPool_; + std::mutex bundleExecRadarLock_; + std::set bundleExecRadarSet_; + std::mutex fileReadyRadarLock_; + std::map fileReadyRadarMap_; std::mutex extensionMutexLock_; std::mutex failedBundlesLock_; public: diff --git a/services/backup_sa/include/module_ipc/svc_session_manager.h b/services/backup_sa/include/module_ipc/svc_session_manager.h index f8bfd92c9..4ddabe3d9 100644 --- a/services/backup_sa/include/module_ipc/svc_session_manager.h +++ b/services/backup_sa/include/module_ipc/svc_session_manager.h @@ -520,6 +520,14 @@ public: */ void SetMemParaCurSize(int32_t size); + /** + * @brief 获取超时时间 + * + * @param bundleName 应用名称 + * @return uint32_t + */ + uint32_t GetTimeoutValue(const std::string &bundleName); + /** * @brief Set the old device backup version object * diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 4f00a34da..45e9d27b5 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -123,6 +123,10 @@ void Service::BundleBeginRadarReport(const std::string &bundleName, const ErrCod if (errCode == ERR_OK || errCode == BError(BError::Codes::SA_BOOT_EXT_FAIL).GetCode()) { return; } + if (!IsReportBundleExecFail(bundleName)) { + return; + } + UpdateBundleRadarReport(bundleName); BundleTaskInfo taskInfo; taskInfo.reportTime = TimeUtils::GetCurrentTime(); taskInfo.errCode = errCode; @@ -137,13 +141,20 @@ void Service::BundleBeginRadarReport(const std::string &bundleName, const ErrCod } } -void Service::BundleEndRadarReport(const std::string &bundleName, const ErrCode errCode, +void Service::BundleEndRadarReport(const std::string &bundleName, ErrCode errCode, const IServiceReverse::Scenario scenario) { if (errCode == ERR_OK) { successBundlesNum_++; return; } + if (!IsReportBundleExecFail(bundleName)) { + return; + } + if (session_->GetTimeoutValue(bundleName) == 0) { + errCode = BError::BackupErrorCode::E_FORCE_TIMEOUT; + } + UpdateBundleRadarReport(bundleName); BundleTaskInfo taskInfo; taskInfo.reportTime = TimeUtils::GetCurrentTime(); taskInfo.errCode = errCode; @@ -164,6 +175,9 @@ void Service::FileReadyRadarReport(const std::string &bundleName, const std::str if (errCode == ERR_OK) { return; } + if (!IsReportFileReadyFail(bundleName)) { + return; + } std::string fileNameReport = std::string("fileName:\"") + GetAnonyPath(fileName) + "\""; AppRadar::Info info(bundleName, "", fileNameReport); if (scenario == IServiceReverse::Scenario::RESTORE) { @@ -178,6 +192,10 @@ void Service::FileReadyRadarReport(const std::string &bundleName, const std::str void Service::ExtensionConnectFailRadarReport(const std::string &bundleName, const ErrCode errCode, const IServiceReverse::Scenario scenario) { + if (!IsReportBundleExecFail(bundleName)) { + return; + } + UpdateBundleRadarReport(bundleName); std::stringstream ss; ss << "errCode:" << errCode; AppRadar::Info info(bundleName, "", ss.str()); @@ -461,6 +479,8 @@ ErrCode Service::InitRestoreSession(sptr remote) if (ret == ERR_OK) { ClearFailedBundles(); successBundlesNum_ = 0; + ClearBundleRadarReport(); + ClearFileReadyRadarReport(); return ret; } if (ret == BError(BError::Codes::SA_SESSION_CONFLICT)) { @@ -494,6 +514,8 @@ ErrCode Service::InitBackupSession(sptr remote) if (ret == ERR_OK) { ClearFailedBundles(); successBundlesNum_ = 0; + ClearBundleRadarReport(); + ClearFileReadyRadarReport(); return ret; } if (ret == BError(BError::Codes::SA_SESSION_CONFLICT)) { @@ -1993,20 +2015,6 @@ std::function Service::TimeOutCallback(wptr ptr, std::string bu }; } -void Service::TimeoutRadarReport(IServiceReverse::Scenario scenario, std::string &bundleName) -{ - int32_t errCode = BError(BError::Codes::EXT_ABILITY_TIMEOUT).GetCode(); - if (scenario == IServiceReverse::Scenario::BACKUP) { - AppRadar::Info info(bundleName, "", "on backup timeout"); - AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), - BizStageBackup::BIZ_STAGE_ON_BACKUP, errCode); - } else if (scenario == IServiceReverse::Scenario::RESTORE) { - AppRadar::Info info(bundleName, "", "on restore timeout"); - AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), - BizStageRestore::BIZ_STAGE_ON_RESTORE, errCode); - } -} - void Service::DoTimeout(wptr ptr, std::string bundleName) { auto thisPtr = ptr.promote(); @@ -2020,7 +2028,6 @@ void Service::DoTimeout(wptr ptr, std::string bundleName) return; } IServiceReverse::Scenario scenario = sessionPtr->GetScenario(); - TimeoutRadarReport(scenario, bundleName); try { std::shared_ptr mutexPtr = GetExtensionMutex(bundleName); if (mutexPtr == nullptr) { @@ -2044,6 +2051,7 @@ void Service::DoTimeout(wptr ptr, std::string bundleName) } sessionConnection->DisconnectBackupExtAbility(); } + TimeoutRadarReport(scenario, bundleName); sessionPtr->StopFwkTimer(bundleName); sessionPtr->StopExtTimer(bundleName); thisPtr->ClearSessionAndSchedInfo(bundleName); diff --git a/services/backup_sa/src/module_ipc/service_incremental.cpp b/services/backup_sa/src/module_ipc/service_incremental.cpp index a11949ab7..62473197f 100644 --- a/services/backup_sa/src/module_ipc/service_incremental.cpp +++ b/services/backup_sa/src/module_ipc/service_incremental.cpp @@ -314,6 +314,8 @@ ErrCode Service::InitIncrementalBackupSession(sptr remote) if (errCode == ERR_OK) { ClearFailedBundles(); successBundlesNum_ = 0; + ClearBundleRadarReport(); + ClearFileReadyRadarReport(); return errCode; } if (errCode == BError(BError::Codes::SA_SESSION_CONFLICT)) { @@ -347,6 +349,8 @@ ErrCode Service::InitIncrementalBackupSession(sptr remote, std: if (errCode == ERR_OK) { ClearFailedBundles(); successBundlesNum_ = 0; + ClearBundleRadarReport(); + ClearFileReadyRadarReport(); return errCode; } if (errCode == BError(BError::Codes::SA_SESSION_CONFLICT)) { diff --git a/services/backup_sa/src/module_ipc/sub_service.cpp b/services/backup_sa/src/module_ipc/sub_service.cpp index 63a9538d9..9a176ee19 100644 --- a/services/backup_sa/src/module_ipc/sub_service.cpp +++ b/services/backup_sa/src/module_ipc/sub_service.cpp @@ -66,6 +66,10 @@ namespace OHOS::FileManagement::Backup { using namespace std; +namespace { +const int32_t MAX_FILE_READY_REPORT_TIME = 2; +} // namespace + vector Service::MakeDetailList(const vector &bundleNames) { vector bundleDetails {}; @@ -75,6 +79,73 @@ vector Service::MakeDetailList(const vector &bundl return bundleDetails; } +void Service::UpdateBundleRadarReport(const std::string &bundleName) +{ + std::unique_lock lock(bundleExecRadarLock_); + bundleExecRadarSet_.insert(bundleName); +} + +void Service::ClearBundleRadarReport() +{ + std::unique_lock lock(bundleExecRadarLock_); + bundleExecRadarSet_.clear(); +} + +bool Service::IsReportBundleExecFail(const std::string &bundleName) +{ + std::unique_lock lock(bundleExecRadarLock_); + auto it = bundleExecRadarSet_.find(bundleName); + if (it != bundleExecRadarSet_.end()) { + HILOGI("BundleName %{public}s has already been reported", bundleName.c_str()); + return false; + } + return true; +} + +void Service::ClearFileReadyRadarReport() +{ + std::unique_lock lock(fileReadyRadarLock_); + fileReadyRadarMap_.clear(); +} + +bool Service::IsReportFileReadyFail(const std::string &bundleName) +{ + std::unique_lock lock(fileReadyRadarLock_); + auto it = fileReadyRadarMap_.find(bundleName); + if (it != fileReadyRadarMap_.end()) { + it->second++; + } else { + fileReadyRadarMap_[bundleName] = 1; + } + if (it->second > MAX_FILE_READY_REPORT_TIME) { + HILOGI("FileReady radar report more than %{public}d times, bundleName = %{public}s", + MAX_FILE_READY_REPORT_TIME, bundleName.c_str()); + return false; + } + return true; +} + +void Service::TimeoutRadarReport(IServiceReverse::Scenario scenario, std::string &bundleName) +{ + if (!IsReportBundleExecFail(bundleName)) { + return; + } + UpdateBundleRadarReport(bundleName); + int32_t errCode = BError::BackupErrorCode::E_ETO; + if (session_->GetTimeoutValue(bundleName) == 0) { + errCode = BError::BackupErrorCode::E_FORCE_TIMEOUT; + } + if (scenario == IServiceReverse::Scenario::BACKUP) { + AppRadar::Info info(bundleName, "", "on backup timeout"); + AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), + BizStageBackup::BIZ_STAGE_ON_BACKUP, errCode); + } else if (scenario == IServiceReverse::Scenario::RESTORE) { + AppRadar::Info info(bundleName, "", "on restore timeout"); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), + BizStageRestore::BIZ_STAGE_ON_RESTORE, errCode); + } +} + ErrCode Service::Finish() { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); @@ -674,6 +745,8 @@ ErrCode Service::InitRestoreSession(sptr remote, std::string &e if (ret == ERR_OK) { ClearFailedBundles(); successBundlesNum_ = 0; + ClearBundleRadarReport(); + ClearFileReadyRadarReport(); return ret; } if (ret == BError(BError::Codes::SA_SESSION_CONFLICT)) { @@ -710,6 +783,8 @@ ErrCode Service::InitBackupSession(sptr remote, std::string &er if (ret == ERR_OK) { ClearFailedBundles(); successBundlesNum_ = 0; + ClearBundleRadarReport(); + ClearFileReadyRadarReport(); return ret; } if (ret == BError(BError::Codes::SA_SESSION_CONFLICT)) { 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 58ae38994..fe48a252c 100644 --- a/services/backup_sa/src/module_ipc/svc_session_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_session_manager.cpp @@ -1137,6 +1137,17 @@ bool SvcSessionManager::GetClearDataFlag(const std::string &bundleName) return it->second.isClearData; } +uint32_t SvcSessionManager::GetTimeoutValue(const std::string &bundleName) +{ + unique_lock lock(lock_); + auto [findBundleSuc, it] = GetBackupExtNameMap(bundleName); + if (!findBundleSuc) { + HILOGE("BackupExtNameMap can not find bundle %{public}s", bundleName.c_str()); + return BConstants::TIMEOUT_INVALID; + } + return it->second.timeout; +} + bool SvcSessionManager::ValidRestoreDataType(RestoreTypeEnum restoreDataType) { return impl_.restoreDataType == restoreDataType; diff --git a/tests/mock/module_ipc/include/svc_session_manager_mock.h b/tests/mock/module_ipc/include/svc_session_manager_mock.h index fcfb87865..17634813c 100644 --- a/tests/mock/module_ipc/include/svc_session_manager_mock.h +++ b/tests/mock/module_ipc/include/svc_session_manager_mock.h @@ -55,6 +55,7 @@ public: virtual int64_t GetLastIncrementalTime(const std::string&) = 0; virtual int32_t GetMemParaCurSize() = 0; virtual bool ValidRestoreDataType(RestoreTypeEnum) = 0; + virtual uint32_t GetTimeoutValue(const std::string &) = 0; virtual bool GetClearDataFlag(const std::string&) = 0; virtual bool CleanAndCheckIfNeedWait(ErrCode &, std::vector &) = 0; virtual ErrCode ClearSessionData() = 0; @@ -102,6 +103,7 @@ public: MOCK_METHOD(int64_t, GetLastIncrementalTime, (const std::string&)); MOCK_METHOD(int32_t, GetMemParaCurSize, ()); MOCK_METHOD(bool, ValidRestoreDataType, (RestoreTypeEnum)); + MOCK_METHOD(uint32_t, GetTimeoutValue, (const std::string &)); MOCK_METHOD(bool, GetClearDataFlag, (const std::string&)); MOCK_METHOD(bool, CleanAndCheckIfNeedWait, (ErrCode &, std::vector &)); MOCK_METHOD(ErrCode, ClearSessionData, ()); diff --git a/tests/mock/module_ipc/service_mock.cpp b/tests/mock/module_ipc/service_mock.cpp index 309c0bfdb..0b9a1afe8 100644 --- a/tests/mock/module_ipc/service_mock.cpp +++ b/tests/mock/module_ipc/service_mock.cpp @@ -319,7 +319,7 @@ void Service::HandleExceptionOnAppendBundles(sptr session, void Service::BundleBeginRadarReport(const std::string &bundleName, const ErrCode errCode, const IServiceReverse::Scenario scenario) {} -void Service::BundleEndRadarReport(const std::string &bundleName, const ErrCode errCode, +void Service::BundleEndRadarReport(const std::string &bundleName, ErrCode errCode, const IServiceReverse::Scenario scenario) {} void Service::FileReadyRadarReport(const std::string &bundleName, const std::string &fileName, const ErrCode errCode, @@ -337,6 +337,22 @@ std::string Service::GetCallerName() return ""; } +bool Service::IsReportBundleExecFail(const std::string &bundleName) +{ + return true; +} + +void Service::ClearBundleRadarReport() {} + +void Service::UpdateBundleRadarReport(const std::string &bundleName) {} + +bool Service::IsReportFileReadyFail(const std::string &bundleName) +{ + return true; +} + +void Service::ClearFileReadyRadarReport() {} + void Service::UpdateFailedBundles(const std::string &bundleName, BundleTaskInfo taskInfo) {} void Service::ClearFailedBundles() {} diff --git a/tests/mock/module_ipc/src/svc_session_manager_mock.cpp b/tests/mock/module_ipc/src/svc_session_manager_mock.cpp index 255d5ddab..a36e99e02 100644 --- a/tests/mock/module_ipc/src/svc_session_manager_mock.cpp +++ b/tests/mock/module_ipc/src/svc_session_manager_mock.cpp @@ -239,6 +239,11 @@ bool SvcSessionManager::ValidRestoreDataType(RestoreTypeEnum restoreDataType) return BSvcSessionManager::sessionManager->ValidRestoreDataType(restoreDataType); } +uint32_t SvcSessionManager::GetTimeoutValue(const std::string &bundleName) +{ + return BSvcSessionManager::sessionManager->GetTimeoutValue(bundleName); +} + void SvcSessionManager::SetIncrementalData(const BIncrementalData &) {} int32_t SvcSessionManager::GetIncrementalManifestFd(const string &bundleName) diff --git a/tests/mock/module_ipc/svc_session_manager_mock.cpp b/tests/mock/module_ipc/svc_session_manager_mock.cpp index 6cc240f17..c02be5a25 100644 --- a/tests/mock/module_ipc/svc_session_manager_mock.cpp +++ b/tests/mock/module_ipc/svc_session_manager_mock.cpp @@ -430,6 +430,11 @@ bool SvcSessionManager::ValidRestoreDataType(RestoreTypeEnum restoreDataType) return impl_.restoreDataType == restoreDataType; } +uint32_t SvcSessionManager::GetTimeoutValue(const std::string &bundleName) +{ + return 0; +} + SvcSessionManager::Impl SvcSessionManager::GetImpl() { return impl_; diff --git a/tests/mock/module_ipc/svc_session_manager_throw_mock.cpp b/tests/mock/module_ipc/svc_session_manager_throw_mock.cpp index 60d2b8eb2..12574125c 100644 --- a/tests/mock/module_ipc/svc_session_manager_throw_mock.cpp +++ b/tests/mock/module_ipc/svc_session_manager_throw_mock.cpp @@ -291,6 +291,11 @@ bool SvcSessionManager::ValidRestoreDataType(RestoreTypeEnum restoreDataType) return BackupSvcSessionManager::session->ValidRestoreDataType(restoreDataType); } +uint32_t SvcSessionManager::GetTimeoutValue(const std::string &bundleName) +{ + return BackupSvcSessionManager::session->GetTimeoutValue(bundleName); +} + SvcSessionManager::Impl SvcSessionManager::GetImpl() { return BackupSvcSessionManager::session->GetImpl(); diff --git a/tests/mock/module_ipc/svc_session_manager_throw_mock.h b/tests/mock/module_ipc/svc_session_manager_throw_mock.h index 8e0c798c5..10de2e27f 100644 --- a/tests/mock/module_ipc/svc_session_manager_throw_mock.h +++ b/tests/mock/module_ipc/svc_session_manager_throw_mock.h @@ -82,6 +82,7 @@ public: virtual ErrCode ClearSessionData() = 0; virtual bool GetIsIncrementalBackup() = 0; virtual bool ValidRestoreDataType(RestoreTypeEnum) = 0; + virtual uint32_t GetTimeoutValue(const std::string &) = 0; virtual SvcSessionManager::Impl GetImpl() = 0; virtual int GetSessionCnt() = 0; virtual void SetClearDataFlag(const std::string &bundleName, bool isNotClear) = 0; @@ -156,6 +157,7 @@ public: MOCK_METHOD(ErrCode, ClearSessionData, ()); MOCK_METHOD(bool, GetIsIncrementalBackup, ()); MOCK_METHOD(bool, ValidRestoreDataType, (RestoreTypeEnum)); + MOCK_METHOD(uint32_t, GetTimeoutValue, (const std::string &)); MOCK_METHOD(SvcSessionManager::Impl, GetImpl, ()); MOCK_METHOD(int, GetSessionCnt, ()); MOCK_METHOD(void, SetClearDataFlag, (const std::string &, bool)); diff --git a/tests/unittests/backup_sa/module_ipc/service_incremental_test.cpp b/tests/unittests/backup_sa/module_ipc/service_incremental_test.cpp index a46f15816..6b65d8126 100644 --- a/tests/unittests/backup_sa/module_ipc/service_incremental_test.cpp +++ b/tests/unittests/backup_sa/module_ipc/service_incremental_test.cpp @@ -288,6 +288,22 @@ std::string Service::GetCallerName() return ""; } +bool Service::IsReportBundleExecFail(const std::string &bundleName) +{ + return true; +} + +void Service::ClearBundleRadarReport() {} + +void Service::UpdateBundleRadarReport(const std::string &bundleName) {} + +bool Service::IsReportFileReadyFail(const std::string &bundleName) +{ + return true; +} + +void Service::ClearFileReadyRadarReport() {} + void Service::UpdateFailedBundles(const std::string &bundleName, BundleTaskInfo taskInfo) {} void Service::ClearFailedBundles() {} diff --git a/utils/include/b_error/b_error.h b/utils/include/b_error/b_error.h index 9073fcc0d..87616036e 100644 --- a/utils/include/b_error/b_error.h +++ b/utils/include/b_error/b_error.h @@ -122,6 +122,8 @@ public: E_CANCEL_UNSTARTED_TASK = 13500011, E_CANCEL_NO_TASK = 13500012, E_CONFLICT = 13500013, + E_INCOMPATIBLE = 13500014, + E_FORCE_TIMEOUT = 13500015, }; public: @@ -327,6 +329,8 @@ private: {BackupErrorCode::E_CANCEL_UNSTARTED_TASK, BackupErrorCode::E_CANCEL_UNSTARTED_TASK}, {BackupErrorCode::E_CANCEL_NO_TASK, BackupErrorCode::E_CANCEL_NO_TASK}, {BackupErrorCode::E_CONFLICT, BackupErrorCode::E_CONFLICT}, + {BackupErrorCode::E_FORCE_TIMEOUT, BackupErrorCode::E_FORCE_TIMEOUT}, + {BackupErrorCode::E_INCOMPATIBLE, BackupErrorCode::E_INCOMPATIBLE}, }; static inline const std::map sysErrnoCodeTable_ { @@ -365,6 +369,8 @@ private: {BackupErrorCode::E_CANCEL_UNSTARTED_TASK, "Cancel unstarted backup or restore task "}, {BackupErrorCode::E_CANCEL_NO_TASK, "Cancel a backup or restore task that does not exist"}, {BackupErrorCode::E_CONFLICT, "Session Conflict"}, + {BackupErrorCode::E_INCOMPATIBLE, "Not compatible"}, + {BackupErrorCode::E_FORCE_TIMEOUT, "Exit actively"} }; private: diff --git a/utils/include/b_radar/b_radar.h b/utils/include/b_radar/b_radar.h index 2ec80872e..16d4a17f4 100644 --- a/utils/include/b_radar/b_radar.h +++ b/utils/include/b_radar/b_radar.h @@ -40,7 +40,7 @@ enum class BizStageBackup : int32_t { BIZ_STAGE_DEACTIVE_SESSION, BIZ_STAGE_RELEASE, BIZ_STAGE_ONSTART_DISPOSE, - BIZ_STAGE_ONSTART_RESIDUAL + BIZ_STAGE_ONSTART_RESIDUAL, }; enum class BizStageRestore : int32_t { @@ -63,7 +63,7 @@ enum class BizStageRestore : int32_t { BIZ_STAGE_DEACTIVE_SESSION, BIZ_STAGE_RELEASE, BIZ_STAGE_ONSTART_DISPOSE, - BIZ_STAGE_ONSTART_RESIDUAL + BIZ_STAGE_ONSTART_RESIDUAL, }; class AppRadar { diff --git a/utils/include/b_resources/b_constants.h b/utils/include/b_resources/b_constants.h index 7ad1b2e25..0c93f1f19 100644 --- a/utils/include/b_resources/b_constants.h +++ b/utils/include/b_resources/b_constants.h @@ -239,6 +239,7 @@ constexpr int32_t MS_1000 = 1000; constexpr int32_t MAX_TIME_COST = 900000; constexpr int32_t MAX_INEXCLUDE_SIZE = 25; constexpr uint8_t INDEX = 3; +constexpr int INVALID_TIMEOUT_VALUE = -1; static inline std::string FILE_BACKUP_RESTORE_EVENTS = "FILE_BACKUP_RESTORE_EVENTS"; static inline std::string FILE_BACKUP_RESTORE_STATISTIC = "FILE_BACKUP_RESTORE_STATISTIC"; } // namespace OHOS::FileManagement::Backup::BConstants -- Gitee