diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index d93c044dece45a3adc25844f5d2a80c9be9cffdd..616cb5fcfb18788a3b581d18c975053d68d47b14 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 36fea1e3849644b5b35429aafaa6de393ef5338d..24e2a9c110254d418bf60209a9816489a1beb764 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 5665c5b3920750089039dd1289a7d9fad2126483..a95edc45938bdfce5eebbe5d9f046cc9fdc912dc 100644 --- a/services/backup_sa/include/module_ipc/service.h +++ b/services/backup_sa/include/module_ipc/service.h @@ -567,7 +567,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, @@ -580,6 +580,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(); @@ -651,6 +661,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_; 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 f8bfd92c9bac75f6cdff512dc9272938f94b634d..4ddabe3d969d386152b481fe189f1133924a627a 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 f76f5f29746519194aee4a80061e4586df44c64d..20ac7d9f14334fab1867a5bbe1e66bbcc86fa013 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)) { @@ -1999,20 +2021,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(); @@ -2026,7 +2034,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) { @@ -2050,6 +2057,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 a11949ab701d718a4ab2b548870f9ad87982084f..62473197f4fa49cfc5f847cb7a59b337c7995a2a 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 9677dea80b54e46d1473efbb62f6bdfc4ada71ad..0ab60c3444c0c16cc973872920e4124f7eb2da3f 100644 --- a/services/backup_sa/src/module_ipc/sub_service.cpp +++ b/services/backup_sa/src/module_ipc/sub_service.cpp @@ -67,6 +67,7 @@ namespace OHOS::FileManagement::Backup { using namespace std; namespace { +const int32_t MAX_FILE_READY_REPORT_TIME = 2; const int32_t WAIT_SCANNING_INFO_SEND_TIME = 5; const int ERR_SIZE = -1; } // namespace @@ -80,6 +81,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__); @@ -687,6 +755,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)) { @@ -723,6 +793,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 58ae38994223b4552403841b68474297e92faab5..fe48a252c19d6a32fbf94e39a6617fa3b682fcbd 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 fcfb87865130aefb9f55bc6e703c447c240a3a86..17634813c31aabd8804a23981c56e9a4cbccbbdd 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 13d6d8fec6102105b0fa1e009118450240be9c0f..547ce256218178fcce43f40f0b7fdfdee8e71f48 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 255d5ddab81a2e23ceba5ed26943a71aaf8e5700..a36e99e0276224a4f88d0459cbce5caa9d6b5810 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 6cc240f17553016b18a938b290b6e778edcdfb3c..c02be5a252d69520dba65030cc4d721662b68fda 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 60d2b8eb25c8112dc3584d05f62b5c3fae9d836d..12574125cf12ef28a0febbcd1fc97cc0990c6916 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 8e0c798c5bb30dc916a3c0a93faf09de452f8726..10de2e27fc5c9e28d91772943eaf5f273ab28826 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 833422e4ebb0d5dee7fa57851714eda00ffa3e34..49ebbc8888f06939f2ece1dac4b87c9003d7bb85 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 9073fcc0d24aa2687bc5cd4ae2fe6f5208357ef4..87616036e9c106a4571302273751ffddcdc2fca5 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 2ec80872ed849717674d7aa70fc536c7e16f95d6..16d4a17f41050da933bcff018e2195b0e582dc18 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 7ad1b2e2579a410ed6467b02c4d5d16e7a81530c..0c93f1f19b5b597a622842222db34d19ee78c4f0 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