diff --git a/frameworks/native/backup_ext/include/ext_extension.h b/frameworks/native/backup_ext/include/ext_extension.h index c39e05fcd9dbdfcc9d29cc48be36a806f5c75ec2..5b2434fe8d3672b80f1ca24fdafc8b0227e729d1 100644 --- a/frameworks/native/backup_ext/include/ext_extension.h +++ b/frameworks/native/backup_ext/include/ext_extension.h @@ -36,6 +36,7 @@ public: ErrCode HandleRestore() override; void AsyncTaskRestoreForUpgrade(void); + void ExtClear(void); public: explicit BackupExtExtension(const std::shared_ptr &extension) : extension_(extension) diff --git a/frameworks/native/backup_ext/src/ext_backup.cpp b/frameworks/native/backup_ext/src/ext_backup.cpp index b08d04cecb99286862b260a5f6811f53be493b7c..298df3f9cd0d69912e233bafb14ba85fe00844b2 100644 --- a/frameworks/native/backup_ext/src/ext_backup.cpp +++ b/frameworks/native/backup_ext/src/ext_backup.cpp @@ -184,6 +184,12 @@ sptr ExtBackup::OnConnect(const AAFwk::Want &want) auto remoteObject = sptr(new BackupExtExtension(std::static_pointer_cast(shared_from_this()))); + + // 排除特殊场景 + if (!WasFromSpeicalVersion()) { + remoteObject->ExtClear(); + } + return remoteObject->AsObject(); } catch (const BError &e) { return nullptr; diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index 083e4d7d442e3717b74e3b3d54af96e42b9de4b8..2697e0413c6f57f5ea85a3a020d2adcf091c1d58 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -707,6 +707,12 @@ void BackupExtExtension::AsyncTaskRestoreForUpgrade() }); } +void BackupExtExtension::ExtClear() +{ + HILOGI("ext begin clear"); + DoClear(); +} + void BackupExtExtension::DoClear() { try { diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index a4f6327f26b8a2ae8192f9b784eea0db854b3f21..a7f0cf6e9f6e1fa56dffe629d0396594093a4b3a 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -598,11 +598,6 @@ void Service::ExtStart(const string &bundleName) if (!proxy) { throw BError(BError::Codes::SA_INVAL_ARG, "Extension backup Proxy is empty"); } - if (session_->GetBundleVersionCode(bundleName) != BConstants::DEFAULT_VERSION_CODE && - session_->GetBundleVersionName(bundleName) != BConstants::DEFAULT_VERSION_NAME && - session_->GetBundleRestoreType(bundleName) != RestoreTypeEnum::RESTORE_DATA_READDY) { - proxy->HandleClear(); - } if (scenario == IServiceReverse::Scenario::BACKUP) { auto ret = proxy->HandleBackup(); session_->GetServiceReverseProxy()->BackupOnBundleStarted(ret, bundleName);