From f0cd83363c72ac0bf9428563b9a60cbfb049d127 Mon Sep 17 00:00:00 2001 From: dujingcheng Date: Mon, 18 Jul 2022 18:54:15 +0800 Subject: [PATCH] test Signed-off-by: dujingcheng Change-Id: I1b51b53658df3935ae519fa0fdb6d5a9b57ad53f --- .../bundlemgr/src/bundle_mgr_host_impl.cpp | 51 +++++++++++++++++-- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/services/bundlemgr/src/bundle_mgr_host_impl.cpp b/services/bundlemgr/src/bundle_mgr_host_impl.cpp index 9b871b7ecb..ae17b05957 100644 --- a/services/bundlemgr/src/bundle_mgr_host_impl.cpp +++ b/services/bundlemgr/src/bundle_mgr_host_impl.cpp @@ -817,7 +817,8 @@ bool BundleMgrHostImpl::DumpAllBundleInfos(int32_t userId, std::string &result) if (!GetBundleInfos( BundleFlag::GET_BUNDLE_WITH_ABILITIES | BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO | - BundleFlag::GET_BUNDLE_WITH_HASH_VALUE, + BundleFlag::GET_BUNDLE_WITH_HASH_VALUE | + BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO, bundleInfos, userId)) { APP_LOGE("get bundleInfos failed."); return false; @@ -840,10 +841,50 @@ bool BundleMgrHostImpl::DumpAllBundleInfos(int32_t userId, std::string &result) result.append(info.name); result.append(":\n"); - nlohmann::json jsonObject = info; - jsonObject["hapModuleInfos"] = info.hapModuleInfos; - jsonObject["userInfo"] = innerBundleUserInfos; - result.append(jsonObject.dump(Constants::DUMP_INDENT)); + nlohmann::json jsonObject; + jsonObject["bundleName"] = info.name; + jsonObject["accessible"] = info.applicationInfo.accessible; + jsonObject["userDataClearable"] = info.applicationInfo.userDataClearable; + jsonObject["keepAlive"] = info.applicationInfo.keepAlive; + jsonObject["removable"] = info.applicationInfo.removable; + jsonObject["singleton"] = info.applicationInfo.singleton; + std::string ability; + if (!info.abilityInfos.empty()) { + for (auto abilityInfo : info.abilityInfos) { + ability + .append("AA") + .append(abilityInfo.name) + .append("-") + .append(std::to_string(abilityInfo.priority)) + .append(", "); + } + + + } + + if (!info.extensionInfos.empty()) { + std::string extensionAbility; + for (auto extensionInfo : info.extensionInfos) { + extensionAbility + .append(extensionInfo.bundleName) + .append("-") + .append(std::to_string(static_cast(extensionInfo.type))) + .append(", "); + + ability + .append("EA") + .append(extensionInfo.name) + .append("-") + .append(std::to_string(extensionInfo.priority)) + .append(", "); + } + + jsonObject["extensionAbilityType"] = extensionAbility; + } + + jsonObject["priority"] = ability; + + result.append(jsonObject.dump()); result.append("\n"); } APP_LOGD("DumpAllBundleInfos successfully"); -- Gitee