diff --git a/frameworks/native/backup_ext/src/untar_file.cpp b/frameworks/native/backup_ext/src/untar_file.cpp index a2888357e4000688069c0964e1ac4b547814513f..76181b091429ddae80ca836b62e06ab45ac75761 100644 --- a/frameworks/native/backup_ext/src/untar_file.cpp +++ b/frameworks/native/backup_ext/src/untar_file.cpp @@ -578,7 +578,7 @@ FILE *UntarFile::CreateFile(string &filePath) } uint32_t len = filePath.length(); - HILOGE("Failed to open file %{public}d, %{public}s, err = %{public}d", len, + HILOGW("Failed to open file %{public}d, %{public}s, err = %{public}d, Will create dir", len, GetAnonyPath(filePath).c_str(), errno); size_t pos = filePath.rfind('/'); if (pos == string::npos) { diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index a920813304fc38ad7287bdd30d98c8b167fee814..b48c7a195d793454391edaf9eaa53ce8fdd1b28e 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -330,6 +330,7 @@ UniqueFd Service::GetLocalCapabilities() void Service::StopAll(const wptr &obj, bool force) { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); + HILOGI("Begin Stop session"); std::lock_guard lock(failedBundlesLock_); uint32_t fail_cnt = failedBundles_.size(); uint32_t totalBundles = fail_cnt + successBundlesNum_.load(); @@ -964,6 +965,7 @@ ErrCode Service::ServiceResultReport(const std::string restoreRetInfo, } return BError(BError::Codes::OK); } catch (const BError &e) { + HILOGE("Service result report error"); HandleCurBundleEndWork(callerName, sennario); CallOnBundleEndByScenario(callerName, sennario, e.GetCode()); OnAllBundlesFinished(BError(BError::Codes::OK)); @@ -997,6 +999,7 @@ ErrCode Service::SAResultReport(const std::string bundleName, const std::string void Service::HandleCurBundleEndWork(std::string bundleName, const BackupRestoreScenario sennario) { + HILOGI("Begin"); try { if (sennario != BackupRestoreScenario::FULL_RESTORE && sennario != BackupRestoreScenario::INCREMENTAL_RESTORE) { @@ -1669,68 +1672,6 @@ ErrCode Service::GetBackupInfo(BundleName &bundleName, std::string &result) } } -ErrCode Service::StartExtTimer(bool &isExtStart) -{ - try { - HILOGI("Service::StartExtTimer begin."); - if (session_ == nullptr) { - HILOGE("StartExtTimer error, session_ is nullptr."); - isExtStart = false; - return BError(BError::Codes::SA_INVAL_ARG); - } - session_->IncreaseSessionCnt(__PRETTY_FUNCTION__); - string bundleName; - ErrCode ret = VerifyCallerAndGetCallerName(bundleName); - if (ret != ERR_OK) { - HILOGE("Start extension timer fail, get bundleName failed, ret:%{public}d", ret); - isExtStart = false; - session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); - return ret; - } - auto timeoutCallback = TimeOutCallback(wptr(this), bundleName); - session_->StopFwkTimer(bundleName); - isExtStart = session_->StartExtTimer(bundleName, timeoutCallback); - session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); - return BError(BError::Codes::OK); - } catch (...) { - HILOGE("Unexpected exception"); - isExtStart = false; - session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); - return EPERM; - } -} - -ErrCode Service::StartFwkTimer(bool &isFwkStart) -{ - try { - HILOGI("Service::StartFwkTimer begin."); - if (session_ == nullptr) { - HILOGE("StartFwkTimer error, session_ is nullptr."); - isFwkStart = false; - return BError(BError::Codes::SA_INVAL_ARG); - } - session_->IncreaseSessionCnt(__PRETTY_FUNCTION__); - std::string bundleName; - ErrCode ret = VerifyCallerAndGetCallerName(bundleName); - if (ret != ERR_OK) { - HILOGE("Start fwk timer fail, get bundleName failed, ret:%{public}d", ret); - isFwkStart = false; - session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); - return ret; - } - auto timeoutCallback = TimeOutCallback(wptr(this), bundleName); - session_->StopExtTimer(bundleName); - isFwkStart = session_->StartFwkTimer(bundleName, timeoutCallback); - session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); - return BError(BError::Codes::OK); - } catch (...) { - HILOGE("Unexpected exception"); - isFwkStart = false; - session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); - return EPERM; - } -} - ErrCode Service::AppendBundlesClearSession(const std::vector &bundleNames) { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); diff --git a/services/backup_sa/src/module_ipc/sub_service.cpp b/services/backup_sa/src/module_ipc/sub_service.cpp index ac779fa9b4e742f525404ccfb61a37f4f9c8427f..b679afd82582ab8c7a2da39fe526d53eb67997bb 100644 --- a/services/backup_sa/src/module_ipc/sub_service.cpp +++ b/services/backup_sa/src/module_ipc/sub_service.cpp @@ -903,14 +903,20 @@ void Service::CallOnBundleEndByScenario(const std::string &bundleName, BackupRes HILOGE("Session is empty, bundleName:%{public}s", bundleName.c_str()); return; } - if (scenario == BackupRestoreScenario::FULL_RESTORE) { - session_->GetServiceReverseProxy()->RestoreOnBundleFinished(errCode, bundleName); - } else if (scenario == BackupRestoreScenario::INCREMENTAL_RESTORE) { - session_->GetServiceReverseProxy()->IncrementalRestoreOnBundleFinished(errCode, bundleName); - } else if (scenario == BackupRestoreScenario::FULL_BACKUP) { - session_->GetServiceReverseProxy()->BackupOnBundleFinished(errCode, bundleName); - } else if (scenario == BackupRestoreScenario::INCREMENTAL_BACKUP) { - session_->GetServiceReverseProxy()->IncrementalBackupOnBundleFinished(errCode, bundleName); + HILOGI("Begin"); + try { + if (scenario == BackupRestoreScenario::FULL_RESTORE) { + session_->GetServiceReverseProxy()->RestoreOnBundleFinished(errCode, bundleName); + } else if (scenario == BackupRestoreScenario::INCREMENTAL_RESTORE) { + session_->GetServiceReverseProxy()->IncrementalRestoreOnBundleFinished(errCode, bundleName); + } else if (scenario == BackupRestoreScenario::FULL_BACKUP) { + session_->GetServiceReverseProxy()->BackupOnBundleFinished(errCode, bundleName); + } else if (scenario == BackupRestoreScenario::INCREMENTAL_BACKUP) { + session_->GetServiceReverseProxy()->IncrementalBackupOnBundleFinished(errCode, bundleName); + } + } catch (const BError &e) { + HILOGE("Call onBundleFinished error, client is died"); + return; } } @@ -1144,4 +1150,66 @@ void Service::SendScannedInfo(const string&scannendInfos, sptrIncreaseSessionCnt(__PRETTY_FUNCTION__); + string bundleName; + ErrCode ret = VerifyCallerAndGetCallerName(bundleName); + if (ret != ERR_OK) { + HILOGE("Start extension timer fail, get bundleName failed, ret:%{public}d", ret); + isExtStart = false; + session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); + return ret; + } + auto timeoutCallback = TimeOutCallback(wptr(this), bundleName); + session_->StopFwkTimer(bundleName); + isExtStart = session_->StartExtTimer(bundleName, timeoutCallback); + session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); + return BError(BError::Codes::OK); + } catch (...) { + HILOGE("Unexpected exception"); + isExtStart = false; + session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); + return EPERM; + } +} + +ErrCode Service::StartFwkTimer(bool &isFwkStart) +{ + try { + HILOGI("Service::StartFwkTimer begin."); + if (session_ == nullptr) { + HILOGE("StartFwkTimer error, session_ is nullptr."); + isFwkStart = false; + return BError(BError::Codes::SA_INVAL_ARG); + } + session_->IncreaseSessionCnt(__PRETTY_FUNCTION__); + std::string bundleName; + ErrCode ret = VerifyCallerAndGetCallerName(bundleName); + if (ret != ERR_OK) { + HILOGE("Start fwk timer fail, get bundleName failed, ret:%{public}d", ret); + isFwkStart = false; + session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); + return ret; + } + auto timeoutCallback = TimeOutCallback(wptr(this), bundleName); + session_->StopExtTimer(bundleName); + isFwkStart = session_->StartFwkTimer(bundleName, timeoutCallback); + session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); + return BError(BError::Codes::OK); + } catch (...) { + HILOGE("Unexpected exception"); + isFwkStart = false; + session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); + return EPERM; + } +} } \ No newline at end of file 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 44002f2d4c42a9e13ecb24a47e40e05b23195740..ec982c0cc2606f53c7a74e5d71470d93da4c6797 100644 --- a/services/backup_sa/src/module_ipc/svc_session_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_session_manager.cpp @@ -107,6 +107,7 @@ ErrCode SvcSessionManager::Active(Impl newImpl, bool isOccupyingSession) ErrCode SvcSessionManager::Deactive(const wptr &remoteInAction, bool force) { unique_lock lock(lock_); + HILOGI("Begin Deactive session"); if (!impl_.clientToken) { HILOGE("Deactive session fail, caller token is invalid"); return BError(BError::Codes::SA_INVAL_ARG);