diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 6f84ebb5b6364db97f86c870b27c62b379982643..732585bdb041a888c93dc598b04ea2266698ae85 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -1062,10 +1062,18 @@ void Service::ExtConnectDied(const string &callName) if (backUpConnection != nullptr && backUpConnection->IsExtAbilityConnected()) { backUpConnection->DisconnectBackupExtAbility(); } + bool needCleanData = session_->GetClearDataFlag(callName); + if (!needCleanData) { + HILOGE("Current extension is died, but not need clean data, bundleName:%{public}s", callName.c_str()); + ClearSessionAndSchedInfo(callName); + NoticeClientFinish(callName, BError(BError::Codes::EXT_ABILITY_DIED)); + return; + } session_->SetServiceSchedAction(callName, BConstants::ServiceSchedAction::CLEAN); auto ret = LaunchBackupExtension(callName); if (ret) { /* Clear Session before notice client finish event */ + HILOGE("Current bundle launch extension failed, bundleName:%{public}s", callName.c_str()); ClearSessionAndSchedInfo(callName); } /* Notice Client Ext Ability Process Died */ @@ -1246,6 +1254,7 @@ void Service::ExtConnectDone(string bundleName) BConstants::ServiceSchedAction curSchedAction = session_->GetServiceSchedAction(bundleName); if (curSchedAction == BConstants::ServiceSchedAction::CLEAN) { + HILOGI("Current bundle will execute clean task, bundleName:%{public}s", bundleName.c_str()); sched_->Sched(bundleName); return; } @@ -1254,7 +1263,11 @@ void Service::ExtConnectDone(string bundleName) session_->SetServiceSchedAction(bundleName, BConstants::ServiceSchedAction::CLEAN); } else { session_->SetServiceSchedAction(bundleName, BConstants::ServiceSchedAction::RUNNING); - AddClearBundleRecord(bundleName); + bool needCleanData = session_->GetClearDataFlag(bundleName); + if (needCleanData) { + HILOGI("Current bundle need clean data, bundleName:%{public}s", bundleName.c_str()); + AddClearBundleRecord(bundleName); + } } sched_->Sched(bundleName); } catch (...) { @@ -1579,6 +1592,7 @@ ErrCode Service::ClearResidualBundleData(const std::string &bundleName) throw BError(BError::Codes::SA_INVAL_ARG, "Extension backup Proxy is empty"); } // 通知ext清理 + HILOGI("Current bundle will clean extension data, bundleName:%{public}s", bundleName.c_str()); ErrCode res = proxy->HandleClear(); if (backUpConnection->IsExtAbilityConnected()) { backUpConnection->DisconnectBackupExtAbility();