diff --git a/services/backup_sa/src/module_external/bms_adapter.cpp b/services/backup_sa/src/module_external/bms_adapter.cpp index f98be9b4695499fc5395d737fb264f834a8085d5..a242f6ad19b897ac4de7d8b0829365a7ab25c854 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,