diff --git a/interfaces/inner_api/appexecfwk_base/BUILD.gn b/interfaces/inner_api/appexecfwk_base/BUILD.gn index c9426131a..ff14f87c5 100644 --- a/interfaces/inner_api/appexecfwk_base/BUILD.gn +++ b/interfaces/inner_api/appexecfwk_base/BUILD.gn @@ -109,6 +109,11 @@ ohos_shared_library("appexecfwk_base") { "ipc:ipc_single", ] + if (udmf_enabled) { + defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] + external_deps += [ "udmf:utd_client" ] + } + public_external_deps = [ "json:nlohmann_json_static" ] subsystem_name = "bundlemanager" diff --git a/interfaces/inner_api/appexecfwk_base/include/skill.h b/interfaces/inner_api/appexecfwk_base/include/skill.h index 36472979b..24176757c 100644 --- a/interfaces/inner_api/appexecfwk_base/include/skill.h +++ b/interfaces/inner_api/appexecfwk_base/include/skill.h @@ -69,6 +69,9 @@ private: bool MatchMimeType(const std::string &uriString, size_t &matchUriIndex) const; bool MatchLinkFeature(const std::string &linkFeature, const OHOS::AAFwk::Want &want, size_t &matchUriIndex) const; std::string GetOptParamUri(const std::string &uriString) const; + bool MatchUtd(const std::string ¶mType, const std::string &skillUriType, bool &containsUtd) const; + bool IsUtdMatch(const std::string ¶mUtd, const std::string &skillUtd) const; + bool IsUtd(const std::string ¶m) const; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/inner_api/appexecfwk_base/src/skill.cpp b/interfaces/inner_api/appexecfwk_base/src/skill.cpp index d78e91277..87d4d91f2 100644 --- a/interfaces/inner_api/appexecfwk_base/src/skill.cpp +++ b/interfaces/inner_api/appexecfwk_base/src/skill.cpp @@ -22,6 +22,10 @@ #include "json_util.h" #include #include "nlohmann/json.hpp" +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED +#include "type_descriptor.h" +#include "utd_client.h" +#endif namespace OHOS { namespace AppExecFwk { @@ -416,6 +420,13 @@ bool Skill::MatchType(const std::string &type, const std::string &skillUriType) if (type.empty() || skillUriType.empty()) { return false; } + + bool containsUtd = false; + bool matchUtdRet = MatchUtd(type, skillUriType, containsUtd); + if (containsUtd) { + return matchUtdRet; + } + // only match */* if (type == TYPE_ONLY_MATCH_WILDCARD) { return skillUriType == TYPE_WILDCARD; @@ -440,6 +451,73 @@ bool Skill::MatchType(const std::string &type, const std::string &skillUriType) } } +bool Skill::MatchUtd(const std::string ¶mType, const std::string &skillUriType, bool &containsUtd) const +{ +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED + bool isParamUtd = IsUtd(paramType); + bool isSkillUtd = IsUtd(skillUriType); + + containsUtd = isParamUtd || isSkillUtd; + + if (!isParamUtd && !isSkillUtd) { + // 1.param : mimeType, skill : mimeType + return false; + } else if (isParamUtd && isSkillUtd) { + // 2.param : utd, skill : utd + return IsUtdMatch(paramType, skillUriType); + } else if (!isParamUtd && isSkillUtd) { + // 3.param : mimeType, skill : utd + std::string paramUtd; + auto ret = UDMF::UtdClient::GetInstance().GetUniformDataTypeByMIMEType(paramType, paramUtd); + if (ret != ERR_OK) { + return false; + } + return IsUtdMatch(paramUtd, skillUriType); + } else { + // 4.param : utd, skill : mimeType + std::string skillUtd; + auto ret = UDMF::UtdClient::GetInstance().GetUniformDataTypeByMIMEType(skillUriType, skillUtd); + if (ret != ERR_OK) { + return false; + } + return IsUtdMatch(paramType, skillUtd); + } +#else + containsUtd = false; + return false; +#endif +} + +bool Skill::IsUtdMatch(const std::string ¶mUtd, const std::string &skillUtd) const +{ +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED + std::shared_ptr paramTypeDescriptor; + auto ret = UDMF::UtdClient::GetInstance().GetTypeDescriptor(paramUtd, paramTypeDescriptor); + if (ret != ERR_OK || paramTypeDescriptor == nullptr) { + return false; + } + bool isMatch = false; + ret = paramTypeDescriptor->BelongsTo(skillUtd, isMatch); + if (ret != ERR_OK) { + return false; + } + return isMatch; +#else + return false; +#endif +} + +bool Skill::IsUtd(const std::string ¶m) const +{ +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED + bool isUtd = false; + auto ret = UDMF::UtdClient::GetInstance().IsUtd(param, isUtd); + return ret == ERR_OK && isUtd; +#else + return false; +#endif +} + bool Skill::MatchMimeType(const std::string & uriString) const { std::vector mimeTypes; diff --git a/services/bundlemgr/BUILD.gn b/services/bundlemgr/BUILD.gn index c29167c5c..5789a0637 100644 --- a/services/bundlemgr/BUILD.gn +++ b/services/bundlemgr/BUILD.gn @@ -420,7 +420,7 @@ ohos_shared_library("libbms") { if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/include/app_control/app_control_manager.h b/services/bundlemgr/include/app_control/app_control_manager.h index 3d4ec4d81..4ebc3cb6f 100644 --- a/services/bundlemgr/include/app_control/app_control_manager.h +++ b/services/bundlemgr/include/app_control/app_control_manager.h @@ -100,7 +100,7 @@ private: std::shared_ptr commonEventMgr_; std::mutex appRunningControlMutex_; std::unordered_map> abilityRunningControlRuleCache_; - std::mutex abilityRunningControlRuleMutex_; + std::shared_mutex abilityRunningControlRuleMutex_; }; } // AppExecFwk } // OHOS diff --git a/services/bundlemgr/include/bundle_util.h b/services/bundlemgr/include/bundle_util.h index ae3c78e43..b63c34dd7 100644 --- a/services/bundlemgr/include/bundle_util.h +++ b/services/bundlemgr/include/bundle_util.h @@ -161,6 +161,7 @@ public: * @return Returns result. */ static bool DeleteDir(const std::string &path); + static bool IsUtd(const std::string ¶m); static std::string GetBoolStrVal(bool val); static void MakeFsConfig(const std::string &bundleName, int32_t bundleId, const std::string &configPath); static void RemoveFsConfig(const std::string &bundleName, const std::string &configPath); diff --git a/services/bundlemgr/include/default_app/default_app_mgr.h b/services/bundlemgr/include/default_app/default_app_mgr.h index c17291159..b9ed4927a 100644 --- a/services/bundlemgr/include/default_app/default_app_mgr.h +++ b/services/bundlemgr/include/default_app/default_app_mgr.h @@ -67,6 +67,16 @@ private: std::string GetType(const AAFwk::Want& want) const; bool MatchActionAndType(const std::string& action, const std::string& type, const std::vector& skills) const; bool GetBrokerBundleInfo(const Element& element, BundleInfo& bundleInfo) const; + bool IsSameDefaultApp(const std::vector& bundleInfos) const; + bool IsSameAbilityInfo(const std::vector& bundleInfos) const; + bool IsSameExtensionInfo(const std::vector& bundleInfos) const; + std::vector GetMimeTypes(const std::string& utd) const; + + ErrCode IsDefaultApplicationInternal(int32_t userId, const std::string& type, bool& isDefaultApp) const; + ErrCode GetDefaultApplicationInternal( + int32_t userId, const std::string& type, BundleInfo& bundleInfo, bool backup = false) const; + ErrCode SetDefaultApplicationInternal(int32_t userId, const std::string& type, const Element& element) const; + ErrCode ResetDefaultApplicationInternal(int32_t userId, const std::string& type) const; std::shared_ptr defaultAppDb_; mutable std::mutex mutex_; diff --git a/services/bundlemgr/src/app_control/app_control_manager.cpp b/services/bundlemgr/src/app_control/app_control_manager.cpp index 3e6416eb5..e95432a69 100644 --- a/services/bundlemgr/src/app_control/app_control_manager.cpp +++ b/services/bundlemgr/src/app_control/app_control_manager.cpp @@ -345,7 +345,7 @@ ErrCode AppControlManager::SetDisposedRule(const std::string &callerName, const } std::string key = appId + std::string("_") + std::to_string(userId) + std::string("_") + std::to_string(appIndex); { - std::lock_guard lock(abilityRunningControlRuleMutex_); + std::unique_lock lock(abilityRunningControlRuleMutex_); auto iter = abilityRunningControlRuleCache_.find(key); if (iter != abilityRunningControlRuleCache_.end()) { abilityRunningControlRuleCache_.erase(iter); @@ -376,7 +376,7 @@ ErrCode AppControlManager::DeleteDisposedRule( } std::string key = appId + std::string("_") + std::to_string(userId) + std::string("_") + std::to_string(appIndex); { - std::lock_guard lock(abilityRunningControlRuleMutex_); + std::unique_lock lock(abilityRunningControlRuleMutex_); auto iter = abilityRunningControlRuleCache_.find(key); if (iter != abilityRunningControlRuleCache_.end()) { abilityRunningControlRuleCache_.erase(iter); @@ -431,7 +431,7 @@ void AppControlManager::DeleteAppRunningRuleCache(std::string &key) void AppControlManager::DeleteAbilityRunningRuleCache(std::string &key) { - std::lock_guard cacheLock(abilityRunningControlRuleMutex_); + std::unique_lock lock(abilityRunningControlRuleMutex_); auto cacheIter = abilityRunningControlRuleCache_.find(key); if (cacheIter != abilityRunningControlRuleCache_.end()) { abilityRunningControlRuleCache_.erase(cacheIter); @@ -465,7 +465,7 @@ ErrCode AppControlManager::GetAbilityRunningControlRule( } std::string key = bundleInfo.appId + std::string("_") + std::to_string(userId) + std::string("_") + std::to_string(appIndex); - std::lock_guard lock(abilityRunningControlRuleMutex_); + std::shared_lock lock(abilityRunningControlRuleMutex_); auto iter = abilityRunningControlRuleCache_.find(key); if (iter != abilityRunningControlRuleCache_.end()) { disposedRules = iter->second; diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index e8f492b0c..171bab8e5 100644 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -269,7 +269,7 @@ ErrCode BaseBundleInstaller::InstallBundleByBundleName( InstallScene::CREATE_USER, result); PerfProfile::GetInstance().SetBundleInstallEndTime(GetTickCount()); - APP_LOGD("finish to process %{public}s bundle install", bundleName.c_str()); + APP_LOGI("finish to process %{public}s bundle install, resultCode: %{public}d", bundleName.c_str(), result); return result; } @@ -280,6 +280,9 @@ ErrCode BaseBundleInstaller::Recover( PerfProfile::GetInstance().SetBundleInstallStartTime(GetTickCount()); int32_t uid = Constants::INVALID_UID; ErrCode result = ProcessRecover(bundleName, installParam, uid); + APP_LOGI("recover result: %{public}d, needSendEvent: %{public}d, dataMgr: %{public}d, bundle: %{public}d" + ", modulePackage: %{public}d", result, installParam.needSendEvent, (dataMgr_ == nullptr), bundleName_.empty(), + modulePackage_.empty()); if (installParam.needSendEvent && dataMgr_ && !bundleName_.empty() && !modulePackage_.empty()) { NotifyBundleEvents installRes = { .bundleName = bundleName, @@ -3586,12 +3589,8 @@ void BaseBundleInstaller::RemoveCreatedExtensionDirsForException() const APP_LOGI("no need to remove extension sandbox dir"); return; } - for (const std::string &dir : createExtensionDirs_) { - auto result = InstalldClient::GetInstance()->RemoveDir(dir); - if (result != ERR_OK) { - APP_LOGW("remove created extension sandbox dir %{public}s failed.", dir.c_str()); - continue; - } + if (InstalldClient::GetInstance()->RemoveExtensionDir(userId_, createExtensionDirs_) != ERR_OK) { + APP_LOGW("remove created extension sandbox dir failed."); } } diff --git a/services/bundlemgr/src/bundle_common_event_mgr.cpp b/services/bundlemgr/src/bundle_common_event_mgr.cpp index ef2a4799a..fdd3387db 100755 --- a/services/bundlemgr/src/bundle_common_event_mgr.cpp +++ b/services/bundlemgr/src/bundle_common_event_mgr.cpp @@ -105,11 +105,14 @@ void BundleCommonEventMgr::NotifyBundleStatus(const NotifyBundleEvents &installR } if (installResult.resultCode != ERR_OK || installResult.isBmsExtensionUninstalled) { + APP_LOGI("install ret: %{public}d, extension: %{public}d", + installResult.resultCode, installResult.isBmsExtensionUninstalled); return; } int32_t bundleUserId = BundleUtil::GetUserIdByUid(installResult.uid); int32_t publishUserId = (bundleUserId == Constants::DEFAULT_USERID) ? AccountHelper::GetCurrentActiveUserId() : bundleUserId; + APP_LOGI("%{public}s publish event", installResult.bundleName.c_str()); EventFwk::CommonEventManager::PublishCommonEventAsUser(commonData, publishUserId); } diff --git a/services/bundlemgr/src/bundle_install_checker.cpp b/services/bundlemgr/src/bundle_install_checker.cpp index df077f20f..0fb924cf1 100644 --- a/services/bundlemgr/src/bundle_install_checker.cpp +++ b/services/bundlemgr/src/bundle_install_checker.cpp @@ -193,7 +193,7 @@ ErrCode BundleInstallChecker::CheckMultipleHapsSignInfo( auto verifyRes = BundleVerifyMgr::HapVerify(bundlePath, hapVerifyResult); #ifndef X86_EMULATOR_MODE if (verifyRes != ERR_OK) { - APP_LOGE("hap file verify failed"); + APP_LOGE("hap file verify failed, bundlePath: %{public}s", bundlePath.c_str()); return verifyRes; } #endif diff --git a/services/bundlemgr/src/bundle_util.cpp b/services/bundlemgr/src/bundle_util.cpp index 377a68c2d..504737640 100644 --- a/services/bundlemgr/src/bundle_util.cpp +++ b/services/bundlemgr/src/bundle_util.cpp @@ -39,6 +39,10 @@ #include "ipc_skeleton.h" #include "parameter.h" #include "string_ex.h" +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED +#include "type_descriptor.h" +#include "utd_client.h" +#endif namespace OHOS { namespace AppExecFwk { @@ -534,6 +538,17 @@ bool BundleUtil::DeleteDir(const std::string &path) return true; } +bool BundleUtil::IsUtd(const std::string ¶m) +{ +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED + bool isUtd = false; + auto ret = UDMF::UtdClient::GetInstance().IsUtd(param, isUtd); + return ret == ERR_OK && isUtd; +#else + return false; +#endif +} + std::string BundleUtil::GetBoolStrVal(bool val) { return val ? "true" : "false"; diff --git a/services/bundlemgr/src/default_app/default_app_mgr.cpp b/services/bundlemgr/src/default_app/default_app_mgr.cpp index 77d0a25bb..61eb8b62f 100644 --- a/services/bundlemgr/src/default_app/default_app_mgr.cpp +++ b/services/bundlemgr/src/default_app/default_app_mgr.cpp @@ -24,6 +24,10 @@ #include "ipc_skeleton.h" #include "mime_type_mgr.h" #include "string_ex.h" +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED +#include "type_descriptor.h" +#include "utd_client.h" +#endif namespace OHOS { namespace AppExecFwk { @@ -97,6 +101,29 @@ void DefaultAppMgr::Init() } ErrCode DefaultAppMgr::IsDefaultApplication(int32_t userId, const std::string& type, bool& isDefaultApp) const +{ + LOG_I(BMS_TAG_DEFAULT_APP, + "IsDefaultApplication begin, userId : %{public}d, type : %{public}s", userId, type.c_str()); + if (!BundleUtil::IsUtd(type)) { + return IsDefaultApplicationInternal(userId, type, isDefaultApp); + } + std::vector mimeTypes = GetMimeTypes(type); + if (mimeTypes.empty()) { + LOG_E(BMS_TAG_DEFAULT_APP, "get mimeTypes by utd failed"); + isDefaultApp = false; + return ERR_OK; + } + LOG_I(BMS_TAG_DEFAULT_APP, "mimeTypes : %{public}s", BundleUtil::ToString(mimeTypes).c_str()); + for (const auto& mimeType : mimeTypes) { + (void)IsDefaultApplicationInternal(userId, mimeType, isDefaultApp); + if (!isDefaultApp) { + break; + } + } + return ERR_OK; +} + +ErrCode DefaultAppMgr::IsDefaultApplicationInternal(int32_t userId, const std::string& type, bool& isDefaultApp) const { std::lock_guard lock(mutex_); std::string mimeType = type; @@ -123,12 +150,14 @@ ErrCode DefaultAppMgr::IsDefaultApplication(int32_t userId, const std::string& t std::shared_ptr dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); if (dataMgr == nullptr) { LOG_W(BMS_TAG_DEFAULT_APP, "get BundleDataMgr failed."); + isDefaultApp = false; return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; } std::string callingBundleName; ret = dataMgr->GetBundleNameForUid(IPCSkeleton::GetCallingUid(), callingBundleName); if (!ret) { LOG_W(BMS_TAG_DEFAULT_APP, "GetBundleNameForUid failed."); + isDefaultApp = false; return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; } LOG_D(BMS_TAG_DEFAULT_APP, "callingBundleName : %{public}s", callingBundleName.c_str()); @@ -138,6 +167,36 @@ ErrCode DefaultAppMgr::IsDefaultApplication(int32_t userId, const std::string& t ErrCode DefaultAppMgr::GetDefaultApplication( int32_t userId, const std::string& type, BundleInfo& bundleInfo, bool backup) const +{ + LOG_I(BMS_TAG_DEFAULT_APP, "GetDefaultApplication begin, userId : %{public}d, \ + type : %{public}s, backup : %{public}d", userId, type.c_str(), backup); + if (!BundleUtil::IsUtd(type)) { + return GetDefaultApplicationInternal(userId, type, bundleInfo, backup); + } + std::vector mimeTypes = GetMimeTypes(type); + if (mimeTypes.empty()) { + LOG_E(BMS_TAG_DEFAULT_APP, "get mimeTypes by utd failed"); + return ERR_BUNDLE_MANAGER_INVALID_TYPE; + } + LOG_I(BMS_TAG_DEFAULT_APP, "mimeTypes : %{public}s", BundleUtil::ToString(mimeTypes).c_str()); + std::vector bundleInfos; + for (const auto& mimeType : mimeTypes) { + BundleInfo info; + ErrCode ret = GetDefaultApplicationInternal(userId, mimeType, info, backup); + if (ret != ERR_OK) { + return ret; + } + bundleInfos.emplace_back(info); + } + if (bundleInfos.empty() || !IsSameDefaultApp(bundleInfos)) { + return ERR_BUNDLE_MANAGER_DEFAULT_APP_NOT_EXIST; + } + bundleInfo = bundleInfos[0]; + return ERR_OK; +} + +ErrCode DefaultAppMgr::GetDefaultApplicationInternal( + int32_t userId, const std::string& type, BundleInfo& bundleInfo, bool backup) const { LOG_D(BMS_TAG_DEFAULT_APP, "begin, backup(bool) : %{public}d", backup); std::lock_guard lock(mutex_); @@ -169,7 +228,31 @@ ErrCode DefaultAppMgr::GetDefaultApplication( } } -ErrCode DefaultAppMgr::SetDefaultApplication(int32_t userId, const std::string& type, const Element& element) const +ErrCode DefaultAppMgr::SetDefaultApplication( + int32_t userId, const std::string& type, const Element& element) const +{ + LOG_I(BMS_TAG_DEFAULT_APP, + "SetDefaultApplication begin, userId : %{public}d, type : %{public}s", userId, type.c_str()); + if (!BundleUtil::IsUtd(type)) { + return SetDefaultApplicationInternal(userId, type, element); + } + std::vector mimeTypes = GetMimeTypes(type); + if (mimeTypes.empty()) { + LOG_E(BMS_TAG_DEFAULT_APP, "get mimeTypes by utd failed"); + return ERR_BUNDLE_MANAGER_INVALID_TYPE; + } + LOG_I(BMS_TAG_DEFAULT_APP, "mimeTypes : %{public}s", BundleUtil::ToString(mimeTypes).c_str()); + for (const auto& mimeType : mimeTypes) { + ErrCode ret = SetDefaultApplicationInternal(userId, mimeType, element); + if (ret != ERR_OK) { + return ret; + } + } + return ERR_OK; +} + +ErrCode DefaultAppMgr::SetDefaultApplicationInternal( + int32_t userId, const std::string& type, const Element& element) const { std::lock_guard lock(mutex_); std::string mimeType = type; @@ -217,6 +300,28 @@ ErrCode DefaultAppMgr::SetDefaultApplication(int32_t userId, const std::string& } ErrCode DefaultAppMgr::ResetDefaultApplication(int32_t userId, const std::string& type) const +{ + LOG_I(BMS_TAG_DEFAULT_APP, + "ResetDefaultApplication begin, userId : %{public}d, type : %{public}s", userId, type.c_str()); + if (!BundleUtil::IsUtd(type)) { + return ResetDefaultApplicationInternal(userId, type); + } + std::vector mimeTypes = GetMimeTypes(type); + if (mimeTypes.empty()) { + LOG_E(BMS_TAG_DEFAULT_APP, "get mimeTypes by utd failed"); + return ERR_BUNDLE_MANAGER_INVALID_TYPE; + } + LOG_I(BMS_TAG_DEFAULT_APP, "mimeTypes : %{public}s", BundleUtil::ToString(mimeTypes).c_str()); + for (const auto& mimeType : mimeTypes) { + ErrCode ret = ResetDefaultApplicationInternal(userId, mimeType); + if (ret != ERR_OK) { + return ret; + } + } + return ERR_OK; +} + +ErrCode DefaultAppMgr::ResetDefaultApplicationInternal(int32_t userId, const std::string& type) const { std::lock_guard lock(mutex_); std::string mimeType = type; @@ -779,5 +884,102 @@ bool DefaultAppMgr::GetBrokerBundleInfo(const Element& element, BundleInfo& bund LOG_I(BMS_TAG_DEFAULT_APP, "get broker bundleInfo success"); return true; } + +bool DefaultAppMgr::IsSameDefaultApp(const std::vector& bundleInfos) const +{ + size_t size = bundleInfos.size(); + if (size == 0) { + LOG_W(BMS_TAG_DEFAULT_APP, "size empty"); + return false; + } + if (size == 1) { + return true; + } + return IsSameAbilityInfo(bundleInfos) || IsSameExtensionInfo(bundleInfos); +} + +bool DefaultAppMgr::IsSameAbilityInfo(const std::vector& bundleInfos) const +{ + const BundleInfo& firstBundleInfo = bundleInfos[0]; + if (firstBundleInfo.name.empty()) { + LOG_W(BMS_TAG_DEFAULT_APP, "bundleName empty"); + return false; + } + if (firstBundleInfo.abilityInfos.empty()) { + LOG_W(BMS_TAG_DEFAULT_APP, "abilityInfos empty"); + return false; + } + std::string bundleName = firstBundleInfo.name; + std::string moduleName = firstBundleInfo.abilityInfos[0].moduleName; + std::string abilityName = firstBundleInfo.abilityInfos[0].name; + for (size_t i = 1; i < bundleInfos.size(); ++i) { + if (bundleInfos[i].name != bundleName) { + LOG_W(BMS_TAG_DEFAULT_APP, "bundleName not equal"); + return false; + } + if (bundleInfos[i].abilityInfos.empty()) { + LOG_W(BMS_TAG_DEFAULT_APP, "abilityInfos empty"); + return false; + } + if (bundleInfos[i].abilityInfos[0].moduleName != moduleName) { + LOG_W(BMS_TAG_DEFAULT_APP, "moduleName not equal"); + return false; + } + if (bundleInfos[i].abilityInfos[0].name != abilityName) { + LOG_W(BMS_TAG_DEFAULT_APP, "abilityName not equal"); + return false; + } + } + return true; +} + +bool DefaultAppMgr::IsSameExtensionInfo(const std::vector& bundleInfos) const +{ + const BundleInfo& firstBundleInfo = bundleInfos[0]; + if (firstBundleInfo.name.empty()) { + LOG_W(BMS_TAG_DEFAULT_APP, "bundleName empty"); + return false; + } + if (firstBundleInfo.extensionInfos.empty()) { + LOG_W(BMS_TAG_DEFAULT_APP, "extensionInfos empty"); + return false; + } + std::string bundleName = firstBundleInfo.name; + std::string moduleName = firstBundleInfo.extensionInfos[0].moduleName; + std::string extensionName = firstBundleInfo.extensionInfos[0].name; + for (size_t i = 1; i < bundleInfos.size(); ++i) { + if (bundleInfos[i].name != bundleName) { + LOG_W(BMS_TAG_DEFAULT_APP, "bundleName not equal"); + return false; + } + if (bundleInfos[i].extensionInfos.empty()) { + LOG_W(BMS_TAG_DEFAULT_APP, "extensionInfos empty"); + return false; + } + if (bundleInfos[i].extensionInfos[0].moduleName != moduleName) { + LOG_W(BMS_TAG_DEFAULT_APP, "moduleName not equal"); + return false; + } + if (bundleInfos[i].extensionInfos[0].name != extensionName) { + LOG_W(BMS_TAG_DEFAULT_APP, "extensionName not equal"); + return false; + } + } + return true; +} + +std::vector DefaultAppMgr::GetMimeTypes(const std::string& utd) const +{ +#ifdef BUNDLE_FRAMEWORK_UDMF_ENABLED + std::shared_ptr typeDescriptor; + auto ret = UDMF::UtdClient::GetInstance().GetTypeDescriptor(utd, typeDescriptor); + if (ret != ERR_OK || typeDescriptor == nullptr) { + return {}; + } + return typeDescriptor->GetMimeTypes(); +#else + return {}; +#endif +} } } \ No newline at end of file diff --git a/services/bundlemgr/test/unittest/bms_ability_manager_helper_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_ability_manager_helper_test/BUILD.gn index 417c6b517..e1df6497c 100644 --- a/services/bundlemgr/test/unittest/bms_ability_manager_helper_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_ability_manager_helper_test/BUILD.gn @@ -144,7 +144,7 @@ ohos_unittest("BmsAbilityManagerHelperTest") { if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_accesstokenid_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_accesstokenid_test/BUILD.gn index 654540103..25817d0c8 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_accesstokenid_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_accesstokenid_test/BUILD.gn @@ -171,7 +171,7 @@ ohos_unittest("BmsBundleAccessTokenIdTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_aot_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_aot_test/BUILD.gn index 7b9d72750..8795e3299 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_aot_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_aot_test/BUILD.gn @@ -163,7 +163,7 @@ ohos_unittest("BmsAOTMgrTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_app_control_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_app_control_test/BUILD.gn index 96180afbe..d9df01e99 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_app_control_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_app_control_test/BUILD.gn @@ -160,7 +160,7 @@ ohos_unittest("BmsBundleAppControlTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -317,7 +317,7 @@ ohos_unittest("BmsBundleMockAppControlTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_app_provision_info_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_app_provision_info_test/BUILD.gn index 3508b1cdc..914b42ff0 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_app_provision_info_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_app_provision_info_test/BUILD.gn @@ -164,7 +164,7 @@ ohos_unittest("BmsBundleAppProvisionInfoTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_clone_app_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_clone_app_test/BUILD.gn index 63c2cf357..693289945 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_clone_app_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_clone_app_test/BUILD.gn @@ -154,7 +154,7 @@ ohos_unittest("BmsBundleCloneAppBundleLogicTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -226,7 +226,7 @@ ohos_unittest("BmsBundleCloneAppDataStructTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } } @@ -372,7 +372,7 @@ ohos_unittest("BmsBundleCloneAppIpcTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_common_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_common_test/BUILD.gn index e561dfda5..c0c0206b8 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_common_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_common_test/BUILD.gn @@ -160,7 +160,7 @@ ohos_unittest("BmsBundleCommonTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_crowdtesting_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_crowdtesting_test/BUILD.gn index 13abfdc1f..022de1f11 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_crowdtesting_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_crowdtesting_test/BUILD.gn @@ -155,7 +155,7 @@ ohos_unittest("BmsBundleCrowdtestingTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_data_group_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_data_group_test/BUILD.gn index 66d07e4e8..cf5888d91 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_data_group_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_data_group_test/BUILD.gn @@ -147,7 +147,7 @@ ohos_unittest("BmsBundleDataGroupTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/BUILD.gn index 580f3d631..8fca557c7 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/BUILD.gn @@ -83,7 +83,7 @@ ohos_unittest("BmsBundleDataStorageDatabaseTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } } diff --git a/services/bundlemgr/test/unittest/bms_bundle_default_app_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_default_app_test/BUILD.gn index ac07bf131..59764b3a1 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_default_app_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_default_app_test/BUILD.gn @@ -164,7 +164,7 @@ ohos_unittest("BmsBundleDefaultAppTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_test.cpp index 5a3a5a814..79c71d0ee 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_test.cpp @@ -75,6 +75,10 @@ const std::string ABILITY_EXCEL = "EXCEL"; const std::string ABILITY_EXCEL_ERROR = "EXCEL-ERROR"; const std::string ABILITY_PPT = "PPT"; const std::string ABILITY_PPT_ERROR = "PPT-ERROR"; +const std::string ABILITY_GENERAL_VIDEO = "GeneralVideo"; +const std::string ABILITY_GENERAL_AVI = "GeneralAvi"; +const std::string ABILITY_VIDEO_MS_VIDEO = "VideoMsVideo"; +const std::string UTD_GENERAL_AVI = "general.avi"; const std::string LABEL = "$string:MainAbility_label"; const std::string ICON = "$media:icon"; const std::string DESCRIPTION = "$string:MainAbility_desc"; @@ -260,6 +264,81 @@ ErrCode BmsBundleDefaultAppTest::SetDefaultApplicationWrap(sptr def return defaultAppProxy->SetDefaultApplication(USER_ID, type, want); } + +/** + * @tc.number: UTD_0100 + * @tc.name: test SetDefaultApplication and GetDefaultApplication, param is general.avi, config is general.avi + * @tc.desc: 1. call SetDefaultApplication, return true + * 2. call GetDefaultApplication, return true and the ability is same with SetDefaultApplication's ability + */ +HWTEST_F(BmsBundleDefaultAppTest, UTD_0100, Function | SmallTest | Level1) +{ + auto defaultAppProxy = GetDefaultAppProxy(); + EXPECT_NE(defaultAppProxy, nullptr); + ErrCode result = SetDefaultApplicationWrap(defaultAppProxy, UTD_GENERAL_AVI, ABILITY_GENERAL_AVI); + EXPECT_EQ(result, ERR_OK); + + BundleInfo bundleInfo; + result = defaultAppProxy->GetDefaultApplication(USER_ID, UTD_GENERAL_AVI, bundleInfo); + EXPECT_EQ(result, ERR_OK); + EXPECT_EQ(bundleInfo.abilityInfos.size(), 1); + if (bundleInfo.abilityInfos.size() == 1) { + auto abilityInfo = bundleInfo.abilityInfos[0]; + EXPECT_EQ(abilityInfo.name, ABILITY_GENERAL_AVI); + } + + result = defaultAppProxy->ResetDefaultApplication(USER_ID, UTD_GENERAL_AVI); + EXPECT_EQ(result, ERR_OK); + result = defaultAppProxy->GetDefaultApplication(USER_ID, UTD_GENERAL_AVI, bundleInfo); + EXPECT_NE(result, ERR_OK); +} + +/** + * @tc.number: UTD_0200 + * @tc.name: test SetDefaultApplication and GetDefaultApplication, param is general.avi, config is general.video + * @tc.desc: 1. call SetDefaultApplication, return true + * 2. call GetDefaultApplication, return true and the ability is same with SetDefaultApplication's ability + */ +HWTEST_F(BmsBundleDefaultAppTest, UTD_0200, Function | SmallTest | Level1) +{ + auto defaultAppProxy = GetDefaultAppProxy(); + EXPECT_NE(defaultAppProxy, nullptr); + ErrCode result = SetDefaultApplicationWrap(defaultAppProxy, UTD_GENERAL_AVI, ABILITY_GENERAL_VIDEO); + EXPECT_EQ(result, ERR_OK); + + BundleInfo bundleInfo; + result = defaultAppProxy->GetDefaultApplication(USER_ID, UTD_GENERAL_AVI, bundleInfo); + EXPECT_EQ(result, ERR_OK); + EXPECT_EQ(bundleInfo.abilityInfos.size(), 1); + if (bundleInfo.abilityInfos.size() == 1) { + auto abilityInfo = bundleInfo.abilityInfos[0]; + EXPECT_EQ(abilityInfo.name, ABILITY_GENERAL_VIDEO); + } + + result = defaultAppProxy->ResetDefaultApplication(USER_ID, UTD_GENERAL_AVI); + EXPECT_EQ(result, ERR_OK); + result = defaultAppProxy->GetDefaultApplication(USER_ID, UTD_GENERAL_AVI, bundleInfo); + EXPECT_NE(result, ERR_OK); +} + +/** + * @tc.number: UTD_0300 + * @tc.name: test SetDefaultApplication, param is general.avi, config is video/x-msvideo + * @tc.desc: 1. call SetDefaultApplication, return error + * 2. call GetDefaultApplication, return error + */ +HWTEST_F(BmsBundleDefaultAppTest, UTD_0300, Function | SmallTest | Level1) +{ + auto defaultAppProxy = GetDefaultAppProxy(); + EXPECT_NE(defaultAppProxy, nullptr); + ErrCode result = SetDefaultApplicationWrap(defaultAppProxy, UTD_GENERAL_AVI, ABILITY_VIDEO_MS_VIDEO); + EXPECT_NE(result, ERR_OK); + + BundleInfo bundleInfo; + result = defaultAppProxy->GetDefaultApplication(USER_ID, UTD_GENERAL_AVI, bundleInfo); + EXPECT_NE(result, ERR_OK); +} + /** * @tc.number: BmsBundleDefaultApp_0100 * @tc.name: test IsDefaultApplication @@ -1433,6 +1512,21 @@ HWTEST_F(BmsBundleDefaultAppTest, BmsBundleDefaultApp_6600, Function | SmallTest EXPECT_NE(result, ERR_OK); } +/** + * @tc.number: BmsBundleDefaultApp_6700 + * @tc.name: test IsDefaultApplication + * @tc.desc: 1. call IsDefaultApplication, return false + */ +HWTEST_F(BmsBundleDefaultAppTest, BmsBundleDefaultApp_6700, Function | SmallTest | Level1) +{ + auto defaultAppProxy = GetDefaultAppProxy(); + EXPECT_NE(defaultAppProxy, nullptr); + bool isDefaultApp = false; + ErrCode result = defaultAppProxy->IsDefaultApplication("general.video", isDefaultApp); + EXPECT_EQ(result, ERR_OK); + EXPECT_FALSE(isDefaultApp); +} + /** * @tc.number: AOT_EXECUTOR_0100 * @tc.name: test AOTExecutor diff --git a/services/bundlemgr/test/unittest/bms_bundle_dependencies_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_dependencies_test/BUILD.gn index 88d06d9ce..2d9ef920d 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_dependencies_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_dependencies_test/BUILD.gn @@ -156,7 +156,7 @@ ohos_unittest("BmsBundleDependenciesTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_free_install_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_free_install_test/BUILD.gn index 99dcf79b4..c3bbfb56e 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_free_install_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_free_install_test/BUILD.gn @@ -169,7 +169,7 @@ ohos_unittest("BmsBundleFreeInstallBaseTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -338,7 +338,7 @@ ohos_unittest("BmsBundleFreeInstallTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_hap_verify_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_hap_verify_test/BUILD.gn index 6486c1888..1eec39815 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_hap_verify_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_hap_verify_test/BUILD.gn @@ -157,7 +157,7 @@ ohos_unittest("BmsBundleHapVerifyTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_hsp_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_hsp_test/BUILD.gn index 9d98a9595..18a8fcd09 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_hsp_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_hsp_test/BUILD.gn @@ -158,7 +158,7 @@ ohos_unittest("BmsBundleHspTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -319,7 +319,7 @@ ohos_unittest("BmsBundleSharedLibraryInstallTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -475,7 +475,7 @@ ohos_unittest("BmsBundleSharedLibraryUninstallTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_installer_manager_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_installer_manager_test/BUILD.gn index b265dbdaf..9cb952f38 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_installer_manager_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_installer_manager_test/BUILD.gn @@ -163,7 +163,7 @@ ohos_unittest("BmsBundleInstallerManagerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_installer_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_installer_test/BUILD.gn index 29741f72d..23789cc69 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_installer_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_installer_test/BUILD.gn @@ -187,7 +187,7 @@ ohos_unittest("BmsBundleInstallerTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -374,7 +374,7 @@ ohos_unittest("BmsBundleOtaUpdateTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -562,7 +562,7 @@ ohos_unittest("BmsMultipleBundleInstallerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -722,7 +722,7 @@ ohos_unittest("BmsBundleInstallIpcTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -863,7 +863,7 @@ ohos_unittest("BmsBundleInstallCheckerTest") { defines += [ "GET_BOOL_PARAMETER_TRUE" ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -1004,7 +1004,7 @@ ohos_unittest("BmsBundleInstallDeviceTypeTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -1149,7 +1149,7 @@ ohos_unittest("BmsSystemBundleInstallerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -1338,7 +1338,7 @@ ohos_unittest("BmsBundleInstallDriverTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -1510,7 +1510,7 @@ ohos_unittest("BmsBundleAppServiceFwkInstallerTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_installers_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_installers_test/BUILD.gn index af7272def..df80b22f5 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_installers_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_installers_test/BUILD.gn @@ -163,7 +163,7 @@ ohos_unittest("BmsBundleInstallersTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/BUILD.gn index 78dbe5b55..4408e5aa4 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/BUILD.gn @@ -159,7 +159,7 @@ ohos_unittest("BmsBundleKitServiceBaseTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/BUILD.gn index d8446ec91..482839e16 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/BUILD.gn @@ -164,7 +164,7 @@ ohos_unittest("BmsBundleDataMgrTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -338,7 +338,7 @@ ohos_unittest("BmsBundleKitServiceTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -500,7 +500,7 @@ ohos_unittest("BmsBundleGetWindowPropertiesTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp index 44df69511..37fa39302 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp @@ -249,6 +249,10 @@ const std::string ERROR_LINK_FEATURE = "ERROR_LINK"; const std::string FILE_URI = "test.jpg"; const std::string URI_MIME_IMAGE = "image/jpeg"; constexpr const char* TYPE_ONLY_MATCH_WILDCARD = "reserved/wildcard"; +const std::string TYPE_VIDEO_AVI = "video/avi"; +const std::string TYPE_VIDEO_MS_VIDEO = "video/x-msvideo"; +const std::string UTD_GENERAL_AVI = "general.avi"; +const std::string UTD_GENERAL_VIDEO = "general.video"; } // namespace class BmsBundleKitServiceTest : public testing::Test { @@ -5984,6 +5988,61 @@ HWTEST_F(BmsBundleKitServiceTest, SkillMatch_HOME_ACTION_001, Function | SmallTe EXPECT_EQ(true, ret); } +/** + * @tc.number: skill match rules + * @tc.name: utd match test + * @tc.desc: param : utd, skill : utd + */ +HWTEST_F(BmsBundleKitServiceTest, SkillMatch_UTD_001, Function | SmallTest | Level1) +{ + struct Skill skill; + // success testCase + bool ret = skill.MatchType(UTD_GENERAL_AVI, UTD_GENERAL_AVI); + EXPECT_TRUE(ret); + ret = skill.MatchType(UTD_GENERAL_AVI, UTD_GENERAL_VIDEO); + EXPECT_TRUE(ret); + // failed testCase + ret = skill.MatchType(UTD_GENERAL_VIDEO, UTD_GENERAL_AVI); + EXPECT_FALSE(ret); +} + +/** + * @tc.number: skill match rules + * @tc.name: utd match test + * @tc.desc: param : mimeType, skill : utd + */ +HWTEST_F(BmsBundleKitServiceTest, SkillMatch_UTD_002, Function | SmallTest | Level1) +{ + struct Skill skill; + // success testCase + bool ret = skill.MatchType(TYPE_VIDEO_AVI, UTD_GENERAL_AVI); + EXPECT_TRUE(ret); + ret = skill.MatchType(TYPE_VIDEO_MS_VIDEO, UTD_GENERAL_AVI); + EXPECT_TRUE(ret); + ret = skill.MatchType(TYPE_VIDEO_AVI, UTD_GENERAL_VIDEO); + EXPECT_TRUE(ret); +} + +/** + * @tc.number: skill match rules + * @tc.name: utd match test + * @tc.desc: param : utd, skill : mimeType + */ +HWTEST_F(BmsBundleKitServiceTest, SkillMatch_UTD_003, Function | SmallTest | Level1) +{ + struct Skill skill; + // success testCase + bool ret = skill.MatchType(UTD_GENERAL_AVI, TYPE_VIDEO_AVI); + EXPECT_TRUE(ret); + ret = skill.MatchType(UTD_GENERAL_AVI, TYPE_VIDEO_MS_VIDEO); + EXPECT_TRUE(ret); + // failed testCase + ret = skill.MatchType(UTD_GENERAL_VIDEO, TYPE_VIDEO_AVI); + EXPECT_FALSE(ret); + ret = skill.MatchType(UTD_GENERAL_VIDEO, TYPE_VIDEO_MS_VIDEO); + EXPECT_FALSE(ret); +} + /** * @tc.number: skill match rules * @tc.name: uri and type match test: want uri empty, type not empty, linkFeature not empty; skill uri empty, diff --git a/services/bundlemgr/test/unittest/bms_bundle_manager_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_manager_test/BUILD.gn index 26145c105..0caf73729 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_manager_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_manager_test/BUILD.gn @@ -161,7 +161,7 @@ ohos_unittest("BmsBundleManagerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_navigation_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_navigation_test/BUILD.gn index 059729bd0..242c3b8dc 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_navigation_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_navigation_test/BUILD.gn @@ -160,7 +160,7 @@ ohos_unittest("BmsBundleNavigationTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] diff --git a/services/bundlemgr/test/unittest/bms_bundle_overlay_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_overlay_test/BUILD.gn index 8127ecdd3..7ee4063c9 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_overlay_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_overlay_test/BUILD.gn @@ -140,7 +140,7 @@ ohos_unittest("BmsBundleOverlayCheckerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] @@ -346,7 +346,7 @@ ohos_unittest("BmsBundleOverlayIpcTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] @@ -476,7 +476,7 @@ ohos_unittest("BmsBundleManagerOverlayIpcTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] @@ -608,7 +608,7 @@ ohos_unittest("BmsBundleSetOverlayEnabledTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] @@ -740,7 +740,7 @@ ohos_unittest("BmsBundleGetOverlayModuleInfoTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] diff --git a/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/BUILD.gn index 11e042ed4..8169a5742 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/BUILD.gn @@ -171,7 +171,7 @@ ohos_unittest("BmsBundlePermissionDefListTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -517,7 +517,7 @@ ohos_unittest("BmsBundlePermissionFalseTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -692,7 +692,7 @@ ohos_unittest("BmsBundlePermissionStartFullTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -868,7 +868,7 @@ ohos_unittest("BmsBundlePermissionSyetemAppFalseTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -1039,7 +1039,7 @@ ohos_unittest("BmsBundlePermissionTokenTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -1207,7 +1207,7 @@ ohos_unittest("BmsBundlePermissionGetRequestTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/BUILD.gn index a17a83c6f..11a5372cf 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/BUILD.gn @@ -162,7 +162,7 @@ ohos_unittest("BmsBundleQuickFixBootScannerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_deleter_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_deleter_test/BUILD.gn index a73fc72de..b8baac098 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_deleter_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_deleter_test/BUILD.gn @@ -164,7 +164,7 @@ ohos_unittest("BmsBundleQuickFixDeleterTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_manager_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_manager_test/BUILD.gn index 1fd6e6521..77bbe1397 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_manager_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_manager_test/BUILD.gn @@ -163,7 +163,7 @@ ohos_unittest("BmsBundleQuickFixManagerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/BUILD.gn index c361111e4..1096ea08e 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/BUILD.gn @@ -171,7 +171,7 @@ ohos_unittest("BmsBundleQuickFixMgrRdbTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/BUILD.gn index c7bbf94c3..0320d21bf 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/BUILD.gn @@ -143,7 +143,7 @@ ohos_unittest("BmsBundleQuickFixQueryTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_switcher_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_switcher_test/BUILD.gn index 0197645bd..b58a8ae11 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_switcher_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_switcher_test/BUILD.gn @@ -165,7 +165,7 @@ ohos_unittest("BmsBundleQuickFixSwitcherTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/BUILD.gn index d50085179..cce674617 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/BUILD.gn @@ -166,7 +166,7 @@ ohos_unittest("BmsBundleQuickFixTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_resource_manager_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_resource_manager_test/BUILD.gn index 9d5a4ea80..1e8ddee51 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_resource_manager_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_resource_manager_test/BUILD.gn @@ -163,7 +163,7 @@ ohos_unittest("BmsBundleResourceManagerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_resource_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_resource_test/BUILD.gn index 05621076b..0100cfb5f 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_resource_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_resource_test/BUILD.gn @@ -187,7 +187,7 @@ ohos_unittest("BmsBundleResourceTest") { if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/BUILD.gn index ba2263182..365d40136 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/BUILD.gn @@ -164,7 +164,7 @@ ohos_unittest("BmsSandboxAppTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -328,7 +328,7 @@ ohos_unittest("BmsSandboxRdbTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_uninstaller_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_uninstaller_test/BUILD.gn index e0ea3c689..4ebc018a1 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_uninstaller_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_uninstaller_test/BUILD.gn @@ -173,7 +173,7 @@ ohos_unittest("BmsBundleUninstallerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_updater_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_updater_test/BUILD.gn index 9a219dadd..b3cc363c6 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_updater_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_updater_test/BUILD.gn @@ -176,7 +176,7 @@ ohos_unittest("BmsBundleUpdaterTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_verifymanager_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_bundle_verifymanager_test/BUILD.gn index 1ac64d065..1a66bbdee 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_verifymanager_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_bundle_verifymanager_test/BUILD.gn @@ -157,7 +157,7 @@ ohos_unittest("BmsBundleVerifyManagerTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_data_mgr_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_data_mgr_test/BUILD.gn index 65156e04c..1a83c154c 100644 --- a/services/bundlemgr/test/unittest/bms_data_mgr_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_data_mgr_test/BUILD.gn @@ -133,7 +133,7 @@ ohos_unittest("BmsDataMgrTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -270,7 +270,7 @@ ohos_unittest("BmsExtensionDataMgrTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_event_handler_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_event_handler_test/BUILD.gn index 5cf724351..0e667cb88 100644 --- a/services/bundlemgr/test/unittest/bms_event_handler_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_event_handler_test/BUILD.gn @@ -114,7 +114,7 @@ ohos_unittest("BmsEventHandlerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { @@ -223,7 +223,7 @@ ohos_unittest("BmsEventHandlerUnLockedTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_extend_resource_manager_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_extend_resource_manager_test/BUILD.gn index cca1f3889..d421790a3 100644 --- a/services/bundlemgr/test/unittest/bms_extend_resource_manager_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_extend_resource_manager_test/BUILD.gn @@ -166,7 +166,7 @@ ohos_unittest("BmsExtendResourceManagerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] diff --git a/services/bundlemgr/test/unittest/bms_install_daemon_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_install_daemon_test/BUILD.gn index 8ea22295d..0d91b38d7 100644 --- a/services/bundlemgr/test/unittest/bms_install_daemon_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_install_daemon_test/BUILD.gn @@ -88,7 +88,7 @@ ohos_unittest("BmsInstallDaemonTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } } @@ -167,7 +167,7 @@ ohos_unittest("BmsInstallDaemonIpcTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] @@ -254,7 +254,7 @@ ohos_unittest("BmsInstallDaemonHostImplTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] diff --git a/services/bundlemgr/test/unittest/bms_installd_host_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_installd_host_test/BUILD.gn index 84b767322..bcde6eff2 100644 --- a/services/bundlemgr/test/unittest/bms_installd_host_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_installd_host_test/BUILD.gn @@ -155,7 +155,7 @@ ohos_unittest("BmsInstalldHostTest") { ] if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/BUILD.gn index 2db158e37..946574e3b 100755 --- a/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/BUILD.gn @@ -147,7 +147,7 @@ ohos_unittest("BmsRdbDataManagerTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_service_bundle_scan_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_service_bundle_scan_test/BUILD.gn index 497544922..28c5aabb6 100644 --- a/services/bundlemgr/test/unittest/bms_service_bundle_scan_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_service_bundle_scan_test/BUILD.gn @@ -129,7 +129,7 @@ ohos_unittest("BmsServiceBundleScanTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_service_startup_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_service_startup_test/BUILD.gn index 5be5d6b8c..6eea77b17 100644 --- a/services/bundlemgr/test/unittest/bms_service_startup_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_service_startup_test/BUILD.gn @@ -126,7 +126,7 @@ ohos_unittest("BmsServiceStartupTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/services/bundlemgr/test/unittest/bms_syscap_tool_test/BUILD.gn b/services/bundlemgr/test/unittest/bms_syscap_tool_test/BUILD.gn index 07300e8bc..0ae4b7ec4 100755 --- a/services/bundlemgr/test/unittest/bms_syscap_tool_test/BUILD.gn +++ b/services/bundlemgr/test/unittest/bms_syscap_tool_test/BUILD.gn @@ -153,7 +153,7 @@ ohos_unittest("BmsSyscapToolTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (bms_device_info_manager_part_enabled) { diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 66c036888..7d8c560ed 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -81,6 +81,7 @@ group("fuzztest") { "fuzztest_others/appservicefwkinstallercheckandparsefiles_fuzzer:AppServiceFwkInstallerCheckAndParseFilesFuzzTest", "fuzztest_others/appservicefwkinstallercheckapplabelinfo_fuzzer:AppServiceFwkInstallerCheckAppLabelInfoFuzzTest", "fuzztest_others/appservicefwkinstallerinnerprocessinstall_fuzzer:AppServiceFwkInstallerInnerProcessInstallFuzzTest", + "fuzztest_others/appservicefwkinstallerinstall_fuzzer:AppServiceFwkInstallerInstallFuzzTest", "fuzztest_others/appservicefwkinstallerprocessinstall_fuzzer:AppServiceFwkInstallerProcessInstallFuzzTest", "fuzztest_others/bmsextensionclient_fuzzer:BmsExtensionClientFuzzTest", "fuzztest_others/bundlecloneinstaller_fuzzer:BundlecloneinstallerFuzzTest", @@ -91,6 +92,7 @@ group("fuzztest") { "fuzztest_others/deployquickfix_fuzzer:DeployQuickFixFuzzTest", "fuzztest_others/driverinstaller_fuzzer:DriverInstallerFuzzTest", "fuzztest_others/elementname_fuzzer:ElementNameFuzzTest", + "fuzztest_others/filenamevalid_fuzzer:FileNameValidFuzzTest", "fuzztest_others/installparamunmarshalling_fuzzer:InstallParamUnmarshallingFuzzTest", "fuzztest_others/launcherservice_fuzzer:LauncherServiceFuzzTest", "fuzztest_others/moduleinfo_fuzzer:ModuleInfoFuzzTest", @@ -117,6 +119,7 @@ group("fuzztest") { if (bundle_framework_app_control) { deps += [ "fuzztest_application/addappInstallcontrolrule_fuzzer:AddAppInstallControlRuleFuzzTest", + "fuzztest_application/addappjumpcontrolrule_fuzzer:AddAppJumpControlRuleFuzzTest", "fuzztest_application/addapprunningcontrolrule_fuzzer:AddAppRunningControlRuleFuzzTest", "fuzztest_application/apprunningcontrolrule_fuzzer:AppRunningControlRuleFuzzTest", "fuzztest_application/apprunningcontrolruleresult_fuzzer:AppRunningControlRuleResultFuzzTest", diff --git a/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/BUILD.gn b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/BUILD.gn new file mode 100644 index 000000000..4edb4879f --- /dev/null +++ b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") +import("../../../../appexecfwk.gni") +module_output_path = fuzz_test_path + +##############################fuzztest########################################## +ohos_fuzztest("AddAppJumpControlRuleFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "../../../fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "addappjumpcontrolrule_fuzzer.cpp" ] + + deps = [ + "${base_path}:appexecfwk_base", + "${common_path}:libappexecfwk_common", + "${core_path}:appexecfwk_core", + ] + external_deps = [ + "c_utils:utils", + "ipc:ipc_core", + ] +} diff --git a/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/addappjumpcontrolrule_fuzzer.cpp b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/addappjumpcontrolrule_fuzzer.cpp new file mode 100644 index 000000000..34580181c --- /dev/null +++ b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/addappjumpcontrolrule_fuzzer.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "app_control_proxy.h" + +#include "addappjumpcontrolrule_fuzzer.h" +#include "securec.h" + +using namespace OHOS::AppExecFwk; +namespace OHOS { + constexpr size_t FOO_MAX_LEN = 1024; + constexpr size_t U32_AT_SIZE = 4; + + bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) + { + sptr object; + AppControlProxy appControl(object); + std::vector controlRule; + appControl.AddAppJumpControlRule(controlRule, reinterpret_cast(data)); + return true; + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + if (data == nullptr) { + return 0; + } + + if (size < OHOS::U32_AT_SIZE) { + return 0; + } + + /* Validate the length of size */ + if (size > OHOS::FOO_MAX_LEN) { + return 0; + } + + char* ch = static_cast(malloc(size + 1)); + if (ch == nullptr) { + return 0; + } + + (void)memset_s(ch, size + 1, 0x00, size + 1); + if (memcpy_s(ch, size, data, size) != EOK) { + free(ch); + ch = nullptr; + return 0; + } + OHOS::DoSomethingInterestingWithMyAPI(ch, size); + free(ch); + ch = nullptr; + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/addappjumpcontrolrule_fuzzer.h b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/addappjumpcontrolrule_fuzzer.h new file mode 100644 index 000000000..d3179786e --- /dev/null +++ b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/addappjumpcontrolrule_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADDAPPJUMPCONTROLRULE_FUZZER_H +#define TEST_FUZZTEST_ADDAPPJUMPCONTROLRULE_FUZZER_H + +#define FUZZ_PROJECT_NAME "addappjumpcontrolrule_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/corpus/init b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/corpus/init new file mode 100644 index 000000000..e7c3fecd8 --- /dev/null +++ b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/project.xml b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/project.xml new file mode 100644 index 000000000..7133b2b92 --- /dev/null +++ b/test/fuzztest/fuzztest_application/addappjumpcontrolrule_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/fuzztest_application/bundleinstalldhost_fuzzer/BUILD.gn b/test/fuzztest/fuzztest_application/bundleinstalldhost_fuzzer/BUILD.gn index 60160bf7a..1efad1713 100644 --- a/test/fuzztest/fuzztest_application/bundleinstalldhost_fuzzer/BUILD.gn +++ b/test/fuzztest/fuzztest_application/bundleinstalldhost_fuzzer/BUILD.gn @@ -133,7 +133,7 @@ ohos_fuzztest("BundleInstalldHostFuzzTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] diff --git a/test/fuzztest/fuzztest_application/bundleinstallerhost_fuzzer/BUILD.gn b/test/fuzztest/fuzztest_application/bundleinstallerhost_fuzzer/BUILD.gn index 2f8ea48ce..1b96bccd6 100644 --- a/test/fuzztest/fuzztest_application/bundleinstallerhost_fuzzer/BUILD.gn +++ b/test/fuzztest/fuzztest_application/bundleinstallerhost_fuzzer/BUILD.gn @@ -133,7 +133,7 @@ ohos_fuzztest("BundleInstallerHostFuzzTest") { } if (udmf_enabled) { defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] - external_deps += [ "udmf:udmf_client" ] + external_deps += [ "udmf:utd_client" ] } if (code_signature_enable && pend_sign_screenlock_mgr_enable) { defines += [ "PEND_SIGN_SCREENLOCK_MGR_ENABLED" ] diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/BUILD.gn b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/BUILD.gn new file mode 100644 index 000000000..f93babd17 --- /dev/null +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/BUILD.gn @@ -0,0 +1,190 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +import("../../../../appexecfwk.gni") +import("../../../../services/bundlemgr/appexecfwk_bundlemgr.gni") + +module_output_path = fuzz_test_path + +ohos_fuzztest("AppServiceFwkInstallerInstallFuzzTest") { + fuzz_config_file = + "../../../fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer" + + use_exceptions = true + module_out_path = module_output_path + include_dirs = [ "//third_party/jsoncpp/include" ] + sources = bundle_mgr_source + sources -= [ "${services_path}/bundlemgr/src/bms_param.cpp" ] + sources += [ "${services_path}/bundlemgr/test/mock/src/bms_param.cpp" ] + sources -= [ "${services_path}/bundlemgr/src/system_ability_helper.cpp" ] + sources += [ + "${services_path}/bundlemgr/src/aot/aot_executor.cpp", + "${services_path}/bundlemgr/src/installd/installd_host_impl.cpp", + "${services_path}/bundlemgr/src/installd/installd_operator.cpp", + "${services_path}/bundlemgr/test/mock/src/installd_service.cpp", + ] + + sources += [ + "${services_path}/bundlemgr/test/mock/src/accesstoken_kit.cpp", + "${services_path}/bundlemgr/test/mock/src/installd_permission_mgr.cpp", + "${services_path}/bundlemgr/test/mock/src/mock_status_receiver.cpp", + "${services_path}/bundlemgr/test/mock/src/system_ability_helper.cpp", + ] + + sources += bundle_install_sources + sources -= [ "${services_path}/bundlemgr/src/installd_client.cpp" ] + sources += [ "${services_path}/bundlemgr/test/mock/src/installd_client.cpp" ] + + sources += [ "appservicefwkinstallerinstall_fuzzer.cpp" ] + + configs = [ "${services_path}/bundlemgr/test:bundlemgr_test_config" ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + deps = [ + "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version1_library1:appService_v1_library1", + "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version1_library2:appService_v1_library2", + "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version2_library1:appService_v2_library1", + "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version2_library2:appService_v2_library2", + "${bundle_framework_path}/test/sceneProject/unittest/test_bundle/rightTest:rightTest", + "${core_path}:appexecfwk_core", + ] + deps += bundle_install_deps + + external_deps = [ + "ability_base:want", + "ability_runtime:app_manager", + "access_token:el5_filekey_manager_sdk", + "access_token:libprivacy_sdk", + "access_token:libtokenid_sdk", + "appspawn:hnpapi", + "appverify:libhapverify", + "bounds_checking_function:libsec_shared", + "common_event_service:cesfwk_innerkits", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hitrace:hitrace_meter", + "init:libbegetutil", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + external_deps += bundle_install_external_deps + + defines = [] + if (code_signature_enable) { + sources += [ "${services_path}/bundlemgr/src/code_sign_helper.cpp" ] + include_dirs += [ "${services_path}/bundlemgr/include" ] + external_deps += [ + "bounds_checking_function:libsec_shared", + "code_signature:libcode_sign_utils", + "ets_runtime:libcompiler_service", + ] + defines += [ "CODE_SIGNATURE_ENABLE" ] + } + + if (configpolicy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLOCY_ENABLE" ] + } + + if (bundle_framework_app_control) { + defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ] + sources += [ + "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp", + "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp", + "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp", + "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp", + "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp", + ] + include_dirs += [ "${services_path}/bundlemgr/include/app_control" ] + external_deps += [ "c_utils:utils" ] + } + if (current_cpu == "arm64") { + defines += [ "USE_BUNDLE_EXTENSION" ] + } + + if (build_selinux) { + external_deps += [ "selinux_adapter:libhap_restorecon" ] + } + if (account_enable) { + external_deps += [ "os_account:os_account_innerkits" ] + defines += [ "ACCOUNT_ENABLE" ] + } + if (bundle_framework_free_install) { + sources += aging + sources += free_install + sources += distributed_manager + external_deps += [ + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "battery_manager:batterysrv_client", + "device_usage_statistics:usagestatsinner", + "display_manager:displaymgr", + "power_manager:powermgr_client", + "syscap_codec:syscap_interface_shared", + ] + defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ] + } + if (global_resmgr_enable) { + defines += [ "GLOBAL_RESMGR_ENABLE" ] + external_deps += [ "resource_management:global_resmgr" ] + } + if (hicollie_enable) { + external_deps += [ "hicollie:libhicollie" ] + defines += [ "HICOLLIE_ENABLE" ] + } + + if (hisysevent_enable) { + sources += [ "${services_path}/bundlemgr/src/inner_event_report.cpp" ] + external_deps += [ "hisysevent:libhisysevent" ] + defines += [ "HISYSEVENT_ENABLE" ] + } + + if (bundle_framework_quick_fix) { + include_dirs += [ "${services_path}/bundlemgr/src/include/quick_fix" ] + sources += quick_fix + defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ] + } + + if (storage_service_enable) { + external_deps += [ "storage_service:storage_manager_sa_proxy" ] + defines += [ "STORAGE_SERVICE_ENABLE" ] + } + + external_deps += [ "kv_store:distributeddata_inner" ] + configs += [ "${services_path}/bundlemgr:rdb_config" ] + external_deps += [ "relational_store:native_rdb" ] + sources += [ + "${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp", + "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp", + "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp", + "${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp", + ] + if (udmf_enabled) { + defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] + external_deps += [ "udmf:udmf_client" ] + } + + if (bms_device_info_manager_part_enabled) { + external_deps += [ + "device_info_manager:distributed_device_profile_common", + "device_info_manager:distributed_device_profile_sdk", + ] + defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ] + } +} diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/appservicefwkinstallerinstall_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/appservicefwkinstallerinstall_fuzzer.cpp new file mode 100644 index 000000000..603fdbe91 --- /dev/null +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/appservicefwkinstallerinstall_fuzzer.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "app_service_fwk/app_service_fwk_installer.h" + +#include "appservicefwkinstallerinstall_fuzzer.h" +#include "securec.h" + +using namespace OHOS::AppExecFwk; +namespace OHOS { + constexpr size_t FOO_MAX_LEN = 1024; + constexpr size_t U32_AT_SIZE = 4; + + bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) + { + InstallParam installParam; + installParam.isPreInstallApp = true; + installParam.removable = false; + AppServiceFwkInstaller appServicefwk; + std::vector hspPaths; + appServicefwk.Install(hspPaths, installParam); + return true; + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + if (data == nullptr) { + return 0; + } + + if (size < OHOS::U32_AT_SIZE) { + return 0; + } + + /* Validate the length of size */ + if (size > OHOS::FOO_MAX_LEN) { + return 0; + } + + char* ch = static_cast(malloc(size + 1)); + if (ch == nullptr) { + return 0; + } + + (void)memset_s(ch, size + 1, 0x00, size + 1); + if (memcpy_s(ch, size, data, size) != EOK) { + free(ch); + ch = nullptr; + return 0; + } + OHOS::DoSomethingInterestingWithMyAPI(ch, size); + free(ch); + ch = nullptr; + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/appservicefwkinstallerinstall_fuzzer.h b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/appservicefwkinstallerinstall_fuzzer.h new file mode 100644 index 000000000..565e984c3 --- /dev/null +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/appservicefwkinstallerinstall_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_APPSERVICEFWKINSTALLERINSTALL_FUZZER_H +#define TEST_FUZZTEST_APPSERVICEFWKINSTALLERINSTALL_FUZZER_H + +#define FUZZ_PROJECT_NAME "appservicefwkinstallerinstall_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/corpus/init b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/corpus/init new file mode 100644 index 000000000..e7c3fecd8 --- /dev/null +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/project.xml b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/project.xml new file mode 100644 index 000000000..7133b2b92 --- /dev/null +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerinstall_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/BUILD.gn b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/BUILD.gn new file mode 100644 index 000000000..aa5769051 --- /dev/null +++ b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/BUILD.gn @@ -0,0 +1,175 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/test.gni") +import("../../../../appexecfwk.gni") +import("../../../../services/bundlemgr/appexecfwk_bundlemgr.gni") + +module_output_path = "bundle_framework/bundle_framework" + +ohos_fuzztest("FileNameValidFuzzTest") { + fuzz_config_file = "../../../fuzztest/fuzztest_others/filenamevalid_fuzzer" + + use_exceptions = true + module_out_path = module_output_path + include_dirs = [ + "//third_party/jsoncpp/include", + "//third_party/json/include", + "${services_path}/bundlemgr/include/extend_resource", + ] + sources = bundle_mgr_source + sources -= [ "${services_path}/bundlemgr/src/bms_param.cpp" ] + sources += [ "${services_path}/bundlemgr/test/mock/src/bms_param.cpp" ] + sources -= [ "${services_path}/bundlemgr/src/system_ability_helper.cpp" ] + sources += [ + "${services_path}/bundlemgr/src/aot/aot_executor.cpp", + "${services_path}/bundlemgr/src/installd/installd_operator.cpp", + "${services_path}/bundlemgr/test/mock/src/installd_service.cpp", + "${services_path}/bundlemgr/test/mock/src/mock_installd_host_impl.cpp", + ] + + sources += [ + "${services_path}/bundlemgr/test/mock/src/accesstoken_kit.cpp", + "${services_path}/bundlemgr/test/mock/src/installd_permission_mgr.cpp", + "${services_path}/bundlemgr/test/mock/src/mock_bundle_status.cpp", + "${services_path}/bundlemgr/test/mock/src/mock_clean_cache.cpp", + "${services_path}/bundlemgr/test/mock/src/mock_status_receiver.cpp", + "${services_path}/bundlemgr/test/mock/src/system_ability_helper.cpp", + ] + + sources += bundle_install_sources + sources -= [ "${services_path}/bundlemgr/src/installd_client.cpp" ] + sources += [ "${services_path}/bundlemgr/test/mock/src/installd_client.cpp" ] + + sources += [ "filenamevalid_fuzzer.cpp" ] + + configs = [ "${services_path}/bundlemgr/test:bundlemgr_test_config" ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + deps = [ + "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version1_library1:appService_v1_library1", + "${bundle_framework_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test", + "${bundle_framework_path}/test/sceneProject/unittest/test_bundle/defaultAppTest:defaultAppTest", + "${bundle_framework_path}/test/sceneProject/unittest/test_bundle/resourceManagerTest:resourceManagerTest", + "${core_path}:appexecfwk_core", + ] + deps += bundle_install_deps + + external_deps = [ + "ability_base:want", + "ability_runtime:app_manager", + "access_token:el5_filekey_manager_sdk", + "access_token:libprivacy_sdk", + "access_token:libtokenid_sdk", + "appspawn:hnpapi", + "appverify:libhapverify", + "bounds_checking_function:libsec_shared", + "common_event_service:cesfwk_innerkits", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hitrace:hitrace_meter", + "init:libbegetutil", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + external_deps += bundle_install_external_deps + defines = [] + if (code_signature_enable) { + sources += [ "${services_path}/bundlemgr/src/code_sign_helper.cpp" ] + include_dirs += [ "${services_path}/bundlemgr/include" ] + external_deps += [ + "bounds_checking_function:libsec_shared", + "code_signature:libcode_sign_utils", + "ets_runtime:libcompiler_service", + ] + defines += [ "CODE_SIGNATURE_ENABLE" ] + } + if (configpolicy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLOCY_ENABLE" ] + } + if (build_selinux) { + external_deps += [ "selinux_adapter:libhap_restorecon" ] + } + if (account_enable) { + external_deps += [ "os_account:os_account_innerkits" ] + defines += [ "ACCOUNT_ENABLE" ] + } + if (bundle_framework_free_install) { + sources += aging + sources += free_install + sources += distributed_manager + external_deps += [ + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "battery_manager:batterysrv_client", + "device_info_manager:distributed_device_profile_client", + "device_usage_statistics:usagestatsinner", + "display_manager:displaymgr", + "power_manager:powermgr_client", + "syscap_codec:syscap_interface_shared", + ] + defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ] + } + if (global_resmgr_enable) { + defines += [ "GLOBAL_RESMGR_ENABLE" ] + external_deps += [ "resource_management:global_resmgr" ] + } + if (hicollie_enable) { + external_deps += [ "hicollie:libhicollie" ] + defines += [ "HICOLLIE_ENABLE" ] + } + + if (hisysevent_enable) { + sources += [ "${services_path}/bundlemgr/src/inner_event_report.cpp" ] + external_deps += [ "hisysevent:libhisysevent" ] + defines += [ "HISYSEVENT_ENABLE" ] + } + + if (bundle_framework_default_app) { + sources += default_app + defines += [ "BUNDLE_FRAMEWORK_DEFAULT_APP" ] + } + if (storage_service_enable) { + external_deps += [ "storage_service:storage_manager_sa_proxy" ] + defines += [ "STORAGE_SERVICE_ENABLE" ] + } + configs += [ "../../../../services/bundlemgr:rdb_config" ] + external_deps += [ "relational_store:native_rdb" ] + sources += [ + "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp", + "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp", + "${services_path}/bundlemgr/test/mock/src/bundle_data_storage_rdb.cpp", + "${services_path}/bundlemgr/test/mock/src/mock_rdb_data_manager.cpp", + ] + if (bundle_framework_app_control) { + defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ] + sources += [ + "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp", + "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp", + "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp", + "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp", + "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp", + ] + include_dirs += [ "${services_path}/bundlemgr/include/app_control" ] + external_deps += [ "c_utils:utils" ] + } + if (udmf_enabled) { + defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] + external_deps += [ "udmf:udmf_client" ] + } +} diff --git a/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/corpus/init b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/corpus/init new file mode 100644 index 000000000..bc977bd97 --- /dev/null +++ b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.cpp b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.cpp new file mode 100644 index 000000000..5ae275046 --- /dev/null +++ b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "extend_resource_manager_host_impl.h" +#include "filenamevalid_fuzzer.h" +using namespace OHOS::AppExecFwk; +namespace OHOS { +bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) +{ + ExtendResourceManagerHostImpl impl; + std::vector filePaths; + std::string emptyBundleName; + auto ret = impl.AddExtResource(emptyBundleName, filePaths); + if (ret == ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { + return false; + } + return true; +} +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::DoSomethingInterestingWithMyAPI(data, size); + return 0; +} + diff --git a/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.h b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.h new file mode 100644 index 000000000..8cf88e8d2 --- /dev/null +++ b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_FILENAMEVALID_FUZZER_H +#define TEST_FUZZTEST_FILENAMEVALID_FUZZER_H + +#define FUZZ_PROJECT_NAME "filenamevalid_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/project.xml b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/project.xml new file mode 100644 index 000000000..6e8ad2cfd --- /dev/null +++ b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/sceneProject/unittest/test_bundle/defaultAppTest/entry/src/main/module.json b/test/sceneProject/unittest/test_bundle/defaultAppTest/entry/src/main/module.json index fd8771280..236b1f2cf 100644 --- a/test/sceneProject/unittest/test_bundle/defaultAppTest/entry/src/main/module.json +++ b/test/sceneProject/unittest/test_bundle/defaultAppTest/entry/src/main/module.json @@ -409,6 +409,66 @@ } ] }, + { + "name": "GeneralVideo", + "srcEntry": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "exported": true, + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "general.video" + } + ] + } + ] + }, + { + "name": "GeneralAvi", + "srcEntry": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "exported": true, + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "general.avi" + } + ] + } + ] + }, + { + "name": "VideoMsVideo", + "srcEntry": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "exported": true, + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "video/x-msvideo" + } + ] + } + ] + }, { "name": "MainAbility", "srcEntry": "./ets/MainAbility/MainAbility.ts",