From cf6e5f67792bc9955d3245c6a113501be95e7006 Mon Sep 17 00:00:00 2001 From: huaqingsimeng Date: Tue, 22 Aug 2023 15:04:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E6=81=A2=E5=A4=8D=E6=8E=92?= =?UTF-8?q?=E9=99=A4O=E4=BE=A7A=E4=BE=A7=E7=9A=84=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huaqingsimeng --- .../backup_sa/src/module_external/bms_adapter.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/backup_sa/src/module_external/bms_adapter.cpp b/services/backup_sa/src/module_external/bms_adapter.cpp index f98be9b46..a242f6ad1 100644 --- a/services/backup_sa/src/module_external/bms_adapter.cpp +++ b/services/backup_sa/src/module_external/bms_adapter.cpp @@ -36,6 +36,11 @@ namespace OHOS::FileManagement::Backup { using namespace std; +namespace { +const string HMOS_HAP_CODE_PATH = "1"; +const string LINUX_HAP_CODE_PATH = "2"; +} // namespace + static sptr GetBundleManager() { auto saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); @@ -78,6 +83,11 @@ vector BundleMgrAdapter::GetBundleInfos(int32_t use throw BError(BError::Codes::SA_BROKEN_IPC, "Failed to get bundle infos"); } for (auto const &installedBundle : installedBundles) { + if (installedBundle.applicationInfo.codePath == HMOS_HAP_CODE_PATH || + installedBundle.applicationInfo.codePath == LINUX_HAP_CODE_PATH) { + HILOGI("Unsupported applications, name : %{public}s", installedBundle.name.data()); + continue; + } auto [allToBackup, extName] = GetAllowAndExtName(installedBundle.extensionInfos); auto bundleStats = StorageMgrAdapter::GetBundleStats(installedBundle.name); bundleInfos.emplace_back(BJsonEntityCaps::BundleInfo {installedBundle.name, installedBundle.versionCode, @@ -96,6 +106,11 @@ vector BundleMgrAdapter::GetBundleInfos(const vecto if (!bms->GetBundleInfo(bundleName, AppExecFwk::GET_BUNDLE_WITH_EXTENSION_INFO, installedBundle, userId)) { throw BError(BError::Codes::SA_BROKEN_IPC, "Failed to get bundle info"); } + if (installedBundle.applicationInfo.codePath == HMOS_HAP_CODE_PATH || + installedBundle.applicationInfo.codePath == LINUX_HAP_CODE_PATH) { + HILOGI("Unsupported applications, name : %{public}s", installedBundle.name.data()); + continue; + } auto [allToBackup, extName] = GetAllowAndExtName(installedBundle.extensionInfos); auto bundleStats = StorageMgrAdapter::GetBundleStats(installedBundle.name); bundleInfos.emplace_back(BJsonEntityCaps::BundleInfo {installedBundle.name, installedBundle.versionCode, -- Gitee