diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp index 3f8c3f08813bad6b066fa17a7e402636749e737c..6aa0fb89bd770d8aec48b09646742b4c2d3f0025 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp @@ -465,7 +465,7 @@ ErrCode BundleInstallerProxy::StreamInstall(const std::vector &bund sptr streamInstaller = CreateStreamInstaller(installParam, statusReceiver, realPaths); if (streamInstaller == nullptr) { LOG_E(BMS_TAG_INSTALLER, "stream install failed due to nullptr stream installer"); - return ERR_OK; + return ERR_APPEXECFWK_NULL_PTR; } ErrCode res = ERR_OK; // copy hap or hsp file to bms service diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp index bd87f98223d4ff8ed46be033ddca11e41ad9e98c..9ceed852c4a9a815f9fd3d8a441f0c6a66eac7ac 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp @@ -41,7 +41,7 @@ int ProcessCacheCallbackHost::OnRemoteRequest( std::u16string descripter = ProcessCacheCallbackHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - APP_LOGE("fail to write reply message in process cache host due to the reply is nullptr"); + APP_LOGE("fail to write reply message in process cache host due to the descripter is not same"); return OBJECT_NULL; } diff --git a/services/bundlemgr/include/base_bundle_installer.h b/services/bundlemgr/include/base_bundle_installer.h index 159ed3aa51ad3b6222697f73b02f5c252d7741aa..f40d6412e2ff76cb22ed8d0dd61b11b1e4f855e9 100644 --- a/services/bundlemgr/include/base_bundle_installer.h +++ b/services/bundlemgr/include/base_bundle_installer.h @@ -861,8 +861,7 @@ private: bool IsBundleCrossAppSharedConfig(const std::unordered_map &newInfos); ErrCode ProcessDynamicIconFileWhenUpdate(const InnerBundleInfo &oldInfo, const std::string &oldPath, const std::string &newPath); - bool CheckAddResultMsg(const std::unordered_map &newInfos, - const InnerBundleInfo &oldInfo, bool isContainEntry); + bool CheckAddResultMsg(const InnerBundleInfo &info, bool isContainEntry); void ProcessUpdateShortcut(); ErrCode CheckArkTSMode(const std::unordered_map &newInfos); #ifdef BUNDLE_FRAMEWORK_APP_CONTROL diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index 0e38ed0092e7a306bf22fffe54c7a030a083049a..2decdbe77fc45cca2775da3231012b0a24034f6e 100644 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -1592,7 +1592,7 @@ ErrCode BaseBundleInstaller::ProcessBundleInstall(const std::vector SetHybridSpawn(); LOG_I(BMS_TAG_INSTALLER, "finish install %{public}s", bundleName_.c_str()); UtdHandler::InstallUtdAsync(bundleName_, userId_); - CheckAddResultMsg(newInfos, oldInfo, isContainEntry_); + CheckAddResultMsg(cacheInfo, isContainEntry_); return result; } @@ -8024,17 +8024,10 @@ bool BaseBundleInstaller::IsBundleCrossAppSharedConfig(const std::unordered_map< return false; } -bool BaseBundleInstaller::CheckAddResultMsg(const std::unordered_map &newInfos, - const InnerBundleInfo &oldInfo, bool isContainEntry) +bool BaseBundleInstaller::CheckAddResultMsg(const InnerBundleInfo &info, bool isContainEntry) { if (!isContainEntry) { - for (auto &item : newInfos) { - if (item.second.GetModuleDeduplicateHar()) { - SetCheckResultMsg(DEDUPLICATEHAR_NOTE); - return true; - } - } - if (oldInfo.GetModuleDeduplicateHar()) { + if (info.GetModuleDeduplicateHar()) { SetCheckResultMsg(DEDUPLICATEHAR_NOTE); return true; } diff --git a/services/bundlemgr/src/bundle_installer_host.cpp b/services/bundlemgr/src/bundle_installer_host.cpp index ea2ad68f01299dd00ed14e27cca6116047fd69fd..7d8f7c7379af2c718956c391b793ca8b98c9a232 100644 --- a/services/bundlemgr/src/bundle_installer_host.cpp +++ b/services/bundlemgr/src/bundle_installer_host.cpp @@ -393,8 +393,8 @@ void BundleInstallerHost::HandleCreateStreamInstaller(MessageParcel &data, Messa void BundleInstallerHost::HandleDestoryBundleStreamInstaller(MessageParcel &data, MessageParcel &reply) { LOG_D(BMS_TAG_INSTALLER, "handle destory stream installer message begin"); - uint32_t installeId = data.ReadUint32(); - DestoryBundleStreamInstaller(installeId); + uint32_t installerId = data.ReadUint32(); + DestoryBundleStreamInstaller(installerId); LOG_D(BMS_TAG_INSTALLER, "handle destoy stream installer message finish"); } diff --git a/services/bundlemgr/test/unittest/bms_bundle_installer_proxy_test/bms_bundle_installer_proxy_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_installer_proxy_test/bms_bundle_installer_proxy_test.cpp index 41332ff1b14dc2433dc5dc159530a613ad53760c..b131de98abe0f02f53a30d14ecb88f5c59b8983f 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_installer_proxy_test/bms_bundle_installer_proxy_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_installer_proxy_test/bms_bundle_installer_proxy_test.cpp @@ -510,7 +510,7 @@ HWTEST_F(BmsBundleInstallerProxyTest, StreamInstall_0300, Function | MediumTest installParam.userId = 100; const sptr statusReceiver = new (std::nothrow) MockStatusReceiver();; auto res = bundleInstallerProxy.StreamInstall(bundleFilePaths, installParam, statusReceiver); - EXPECT_EQ(res, ERR_OK); + EXPECT_EQ(res, ERR_APPEXECFWK_NULL_PTR); } /** diff --git a/services/bundlemgr/test/unittest/bms_bundle_installer_test/bms_bundle_installer_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_installer_test/bms_bundle_installer_test.cpp index 4115b938836a3f4f827c655d91da3eab2d7bac5e..a5e3a0edd8ec599de4dd516488d4a74daca8c273 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_installer_test/bms_bundle_installer_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_installer_test/bms_bundle_installer_test.cpp @@ -12414,48 +12414,23 @@ HWTEST_F(BmsBundleInstallerTest, CleanAllBundleCache_0010, Function | SmallTest */ HWTEST_F(BmsBundleInstallerTest, CheckAddResultMsg_0010, Function | SmallTest | Level0) { - std::unordered_map infos; - InnerBundleInfo info1; - ApplicationInfo applicationInfo; - applicationInfo.bundleName = "CheckAddResultMsg_0010"; - info1.SetBaseApplicationInfo(applicationInfo); - InnerModuleInfo module1; - module1.moduleName = "hsp1"; - module1.distro.moduleType = Profile::MODULE_TYPE_SHARED; - BundleUtil::SetBit(InnerModuleInfoBoolFlag::HAS_DEDUPLICATE_HAR, module1.boolSet); - module1.modulePackage = "hsp1"; - info1.InsertInnerModuleInfo("hsp1", module1); - - InnerModuleInfo module2; - module2.moduleName = "hsp2"; - BundleUtil::ResetBit(InnerModuleInfoBoolFlag::HAS_DEDUPLICATE_HAR, module2.boolSet); - module2.distro.moduleType = Profile::MODULE_TYPE_SHARED; - module2.modulePackage = "hsp2"; - info1.InsertInnerModuleInfo("hsp2", module2); - - infos.insert(pair("CheckAddResultMsg_0010", info1)); - InnerBundleInfo oldInfo; - ApplicationInfo applicationInfo2; + BaseBundleInstaller installer; + installer.InitDataMgr(); + bool res = installer.CheckAddResultMsg(oldInfo, true); + EXPECT_EQ(res, false); + + ApplicationInfo applicationInfo; applicationInfo.bundleName = "CheckAddResultMsg_0010"; - oldInfo.SetBaseApplicationInfo(applicationInfo2); + oldInfo.SetBaseApplicationInfo(applicationInfo); InnerModuleInfo module3; module3.moduleName = "hsp3"; module3.distro.moduleType = Profile::MODULE_TYPE_SHARED; BundleUtil::SetBit(InnerModuleInfoBoolFlag::HAS_DEDUPLICATE_HAR, module3.boolSet); module3.modulePackage = "hsp3"; oldInfo.InsertInnerModuleInfo("hsp3", module3); - - BaseBundleInstaller installer; - installer.InitDataMgr(); - bool res = installer.CheckAddResultMsg(infos, oldInfo, true); - EXPECT_EQ(res, false); - res = installer.CheckAddResultMsg(infos, oldInfo, false); - EXPECT_EQ(res, true); - - infos.clear(); - res = installer.CheckAddResultMsg(infos, oldInfo, false); + res = installer.CheckAddResultMsg(oldInfo, false); EXPECT_EQ(res, true); }