From f8a49119618c0f6930fa4d6dca38e9713689afda Mon Sep 17 00:00:00 2001 From: daiyujia Date: Fri, 13 Sep 2024 02:30:50 +0000 Subject: [PATCH] =?UTF-8?q?IssueNo:#IAR1FA=20Description:=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=BA=94=E7=94=A8=E6=9C=AA=E5=AE=89=E8=A3=85=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=8F=AF=E4=BB=A5=E6=9F=A5=E5=88=B0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20Sig:bundleManager=20Feature=20or=20Bugfix:?= =?UTF-8?q?BugFix=20Binary=20Source:No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: daiyujia Change-Id: Id9d921ddadb42a03bdcb1594f261441fe9f973e2 --- .../bundlemgr/src/base_bundle_installer.cpp | 1 - services/bundlemgr/src/bundle_data_mgr.cpp | 9 ++++++--- .../bms_bundle_default_app_mgr_test.cpp | 1 + .../bms_bundle_free_install_test.cpp | 2 ++ .../bms_bundle_kit_service_base_test.cpp | 2 ++ .../bms_bundle_kit_service_test.cpp | 13 +++++++++++++ .../bms_bundle_quick_fix_query_test.cpp | 2 ++ .../bms_bundle_quick_fix_test.cpp | 2 ++ .../bms_bundle_sandbox_app_test.cpp | 2 ++ .../bms_data_mgr_test/bms_data_mgr_test.cpp | 19 ++++++++++++++----- 10 files changed, 44 insertions(+), 9 deletions(-) diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index 46cd56a03..75cad6365 100644 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -2039,7 +2039,6 @@ ErrCode BaseBundleInstaller::ProcessBundleInstallStatus(InnerBundleInfo &info, i dataMgr_->UpdateBundleInstallState(bundleName_, InstallState::UNINSTALL_SUCCESS); return ERR_APPEXECFWK_INSTALL_BUNDLE_MGR_SERVICE_ERROR; } - stateGuard.Dismiss(); bundleGuard.Dismiss(); diff --git a/services/bundlemgr/src/bundle_data_mgr.cpp b/services/bundlemgr/src/bundle_data_mgr.cpp index b27a386c1..195bc8fcd 100644 --- a/services/bundlemgr/src/bundle_data_mgr.cpp +++ b/services/bundlemgr/src/bundle_data_mgr.cpp @@ -3912,7 +3912,8 @@ bool BundleDataMgr::GetInnerBundleInfoWithFlags(const std::string &bundleName, return false; } const InnerBundleInfo &innerBundleInfo = item->second; - if (innerBundleInfo.IsDisabled()) { + auto mark = innerBundleInfo.GetInstallMark(); + if (innerBundleInfo.IsDisabled() || mark.status != InstallExceptionStatus::INSTALL_FINISH) { APP_LOGD("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str()); return false; } @@ -3977,7 +3978,8 @@ ErrCode BundleDataMgr::GetInnerBundleInfoWithFlagsV9(const std::string &bundleNa return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; } const InnerBundleInfo &innerBundleInfo = item->second; - if (innerBundleInfo.IsDisabled()) { + auto mark = innerBundleInfo.GetInstallMark(); + if (innerBundleInfo.IsDisabled() || mark.status != InstallExceptionStatus::INSTALL_FINISH) { APP_LOGD("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str()); return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; } @@ -4020,7 +4022,8 @@ ErrCode BundleDataMgr::GetInnerBundleInfoWithBundleFlagsV9(const std::string &bu return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; } const InnerBundleInfo &innerBundleInfo = item->second; - if (innerBundleInfo.IsDisabled()) { + auto mark = innerBundleInfo.GetInstallMark(); + if (innerBundleInfo.IsDisabled() || mark.status != InstallExceptionStatus::INSTALL_FINISH) { APP_LOGW("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str()); return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; } diff --git a/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_mgr_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_mgr_test.cpp index 79747f5ab..467f64de1 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_mgr_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_default_app_test/bms_bundle_default_app_mgr_test.cpp @@ -127,6 +127,7 @@ void BmsBundleDefaultAppMgrTest::AddInnerBundleInfo(const std::string bundleName innerBundleInfo.AddInnerModuleInfo(innerModuleInfoMap); innerBundleInfo.AddModuleAbilityInfo(innerAbilityMap); innerBundleInfo.AddInnerBundleUserInfo(innerBundleUserInfo); + innerBundleInfo.SetInstallMark(bundleName, MODULE_NAME, InstallExceptionStatus::INSTALL_FINISH); Skill skill; SkillUri uri; diff --git a/services/bundlemgr/test/unittest/bms_bundle_free_install_test/bms_bundle_free_install_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_free_install_test/bms_bundle_free_install_test.cpp index c223601ea..17fcaf8ba 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_free_install_test/bms_bundle_free_install_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_free_install_test/bms_bundle_free_install_test.cpp @@ -209,6 +209,8 @@ void BmsBundleFreeInstallTest::AddInnerBundleInfo(const std::string bundleName, innerBundleInfo.AddInnerBundleUserInfo(userInfo); innerBundleInfo.SetBundlePackInfo(CreateBundlePackInfo(bundleName)); innerBundleInfo.AddInnerModuleInfo(innerModuleInfoMap); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); if (flag) { innerBundleInfo.SetApplicationBundleType(BundleType::ATOMIC_SERVICE); diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/bms_bundle_kit_service_base_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/bms_bundle_kit_service_base_test.cpp index a98bf0c90..81f598b80 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/bms_bundle_kit_service_base_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_base_test/bms_bundle_kit_service_base_test.cpp @@ -166,6 +166,8 @@ void BmsBundleKitServiceBaseTest::MockInstallBundle( InnerBundleInfo innerBundleInfo; innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); Skill skill; skill.actions = {ACTION}; skill.entities = {ENTITY}; 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 56342e1fa..529ebc2e9 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 @@ -626,6 +626,8 @@ void BmsBundleKitServiceTest::AddInnerBundleInfoByTest(const std::string &bundle std::string commonEventKey = bundleName + moduleName + abilityName; CommonEventInfo eventInfo = MockCommonEventInfo(bundleName, innerBundleInfo.GetUid(DEFAULT_USERID)); innerBundleInfo.InsertCommonEvents(commonEventKey, eventInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); } void BmsBundleKitServiceTest::MockInstallBundle( @@ -639,6 +641,8 @@ void BmsBundleKitServiceTest::MockInstallBundle( InnerBundleInfo innerBundleInfo; innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); Skill skill; skill.actions = {ACTION}; skill.entities = {ENTITY}; @@ -660,6 +664,8 @@ void BmsBundleKitServiceTest::MockInstallExtension(const std::string &bundleName innerBundleInfo.InsertExtensionInfo(keyName, extensionInfo); innerBundleInfo.InsertExtensionInfo(keyName02, extensionInfo02); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); Skill skill; skill.actions = {ACTION}; skill.entities = {ENTITY}; @@ -682,6 +688,8 @@ void BmsBundleKitServiceTest::MockInstallExtensionWithUri(const std::string &bun innerBundleInfo.InsertExtensionInfo(keyName, extensionInfo); innerBundleInfo.InsertExtensionInfo(keyName02, extensionInfo02); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); Skill skill = MockExtensionSkillInfo(); std::vector skills; skills.emplace_back(skill); @@ -769,6 +777,8 @@ void BmsBundleKitServiceTest::MockInstallBundle( AbilityInfo abilityInfo = MockAbilityInfo(bundleName, moduleName, abilityName); innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); Skill skill; skill.actions = {ACTION}; skill.entities = {ENTITY}; @@ -1011,6 +1021,8 @@ void BmsBundleKitServiceTest::MockInnerBundleInfo(const std::string &bundleName, std::string keyName = bundleName + "." + moduleName + "." + abilityName; innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.SetBaseApplicationInfo(appInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); } void BmsBundleKitServiceTest::CheckBundleInfo(const std::string &bundleName, const std::string &moduleName, @@ -9231,6 +9243,7 @@ HWTEST_F(BmsBundleKitServiceTest, CleanBundleCacheFilesGetCleanSize_0100, Functi auto dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); ASSERT_NE(dataMgr, nullptr); InnerBundleInfo innerBundleInfo; + innerBundleInfo.SetInstallMark(BUNDLE_NAME_DEMO, "", InstallExceptionStatus::INSTALL_FINISH); std::map innerBundleUserInfos; InnerBundleUserInfo info; info.bundleUserInfo.userId = DEFAULT_USERID; diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/bms_bundle_quick_fix_query_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/bms_bundle_quick_fix_query_test.cpp index 21beaa13c..b67627214 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/bms_bundle_quick_fix_query_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_query_test/bms_bundle_quick_fix_query_test.cpp @@ -148,6 +148,8 @@ void BmsBundleQuickFixQueryTest::MockInstallBundleInfo() innerBundleInfo.SetBaseBundleInfo(bundleInfo); innerBundleInfo.SetBaseApplicationInfo(applicationInfo); innerBundleInfo.AddInnerBundleUserInfo(userInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH); auto dataMgr = GetBundleDataMgr(); EXPECT_NE(dataMgr, nullptr); diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp index 03bf8fa42..606ccbbc8 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp @@ -281,6 +281,8 @@ void BmsBundleQuickFixTest::AddInnerBundleInfo(const std::string bundleName, innerBundleInfo.SetBaseApplicationInfo(applicationInfo); innerBundleInfo.AddInnerBundleUserInfo(userInfo); innerBundleInfo.InsertInnerModuleInfo(bundleName, moduleInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH); auto dataMgr = GetBundleDataMgr(); EXPECT_NE(dataMgr, nullptr); diff --git a/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/bms_bundle_sandbox_app_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/bms_bundle_sandbox_app_test.cpp index 3a8e7e428..4bcc45488 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/bms_bundle_sandbox_app_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_sandbox_app_test/bms_bundle_sandbox_app_test.cpp @@ -2193,6 +2193,8 @@ HWTEST_F(BmsSandboxAppTest, GetBundleInfoForSelf_0100, Function | SmallTest | Le InnerBundleInfo info; info.SetBaseApplicationInfo(appInfo); info.AddInnerBundleUserInfo(innerUserInfo); + std::string packageName; + info.SetInstallMark(BUNDLE_NAME_TEST, packageName, InstallExceptionStatus::INSTALL_FINISH); SaveSandboxAppInfo(info, APP_INDEX_1); diff --git a/services/bundlemgr/test/unittest/bms_data_mgr_test/bms_data_mgr_test.cpp b/services/bundlemgr/test/unittest/bms_data_mgr_test/bms_data_mgr_test.cpp index 86203f5e6..84d59feb0 100644 --- a/services/bundlemgr/test/unittest/bms_data_mgr_test/bms_data_mgr_test.cpp +++ b/services/bundlemgr/test/unittest/bms_data_mgr_test/bms_data_mgr_test.cpp @@ -574,19 +574,20 @@ HWTEST_F(BmsDataMgrTest, AddBundleInfo_0200, Function | SmallTest | Level0) info1.SetBaseBundleInfo(bundleInfo1); info1.SetBaseApplicationInfo(applicationInfo1); info1.AddInnerBundleUserInfo(innerBundleUserInfo); + info1.SetInstallMark(BUNDLE_NAME, "", InstallExceptionStatus::INSTALL_FINISH); InnerBundleInfo info2; BundleInfo bundleInfo2; bundleInfo2.name = BUNDLE_NAME; bundleInfo2.applicationInfo.name = APP_NAME; bundleInfo2.applicationInfo.bundleName = BUNDLE_NAME; - ApplicationInfo applicationInfo2; - applicationInfo2.name = BUNDLE_NAME; - applicationInfo2.bundleName = BUNDLE_NAME; - applicationInfo2.deviceId = DEVICE_ID; + applicationInfo1.name = BUNDLE_NAME; + applicationInfo1.bundleName = BUNDLE_NAME; + applicationInfo1.deviceId = DEVICE_ID; info2.SetBaseBundleInfo(bundleInfo2); - info2.SetBaseApplicationInfo(applicationInfo2); + info2.SetBaseApplicationInfo(applicationInfo1); info2.AddInnerBundleUserInfo(innerBundleUserInfo); + info2.SetInstallMark(BUNDLE_NAME, "", InstallExceptionStatus::INSTALL_FINISH); auto dataMgr = GetDataMgr(); EXPECT_NE(dataMgr, nullptr); @@ -879,6 +880,8 @@ HWTEST_F(BmsDataMgrTest, QueryAbilityInfo_0100, Function | SmallTest | Level0) info1.InsertAbilitiesInfo(BUNDLE_NAME + PACKAGE_NAME + ABILITY_NAME, abilityInfo); info1.AddInnerBundleUserInfo(innerBundleUserInfo); info1.SetAbilityEnabled(Constants::EMPTY_STRING, ABILITY_NAME, true, USERID); + std::string packageName; + info1.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH); auto dataMgr = GetDataMgr(); EXPECT_NE(dataMgr, nullptr); dataMgr->AddUserId(USERID); @@ -1005,6 +1008,8 @@ HWTEST_F(BmsDataMgrTest, GetApplicationInfo_0100, Function | SmallTest | Level0) info1.SetBaseBundleInfo(bundleInfo1); info1.SetBaseApplicationInfo(applicationInfo1); info1.AddInnerBundleUserInfo(innerBundleUserInfo); + std::string packageName; + info1.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH); auto dataMgr = GetDataMgr(); EXPECT_NE(dataMgr, nullptr); @@ -2434,6 +2439,8 @@ HWTEST_F(BmsDataMgrTest, QueryAbilityInfoByContinueType_0200, Function | SmallTe applicationInfo.bundleName = BUNDLE_NAME; InnerBundleInfo innerBundleInfo; innerBundleInfo.SetBaseApplicationInfo(applicationInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH); int32_t userId = Constants::ALL_USERID; BundleUserInfo userInfo; userInfo.userId = userId; @@ -2531,6 +2538,8 @@ HWTEST_F(BmsDataMgrTest, GetInnerBundleInfoWithFlags_0100, Function | SmallTest InnerBundleUserInfo innerBundleUserInfo; innerBundleUserInfo.bundleUserInfo = userInfo; innerBundleInfo.AddInnerBundleUserInfo(innerBundleUserInfo); + std::string packageName; + innerBundleInfo.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH); dataMgr->multiUserIdsSet_.insert(userId); dataMgr->bundleInfos_.emplace(BUNDLE_NAME, innerBundleInfo); ErrCode res =