!6945 修复应用未安装完成可以查到应用信息

Merge pull request !6945 from daiyujia/fix_install
This commit is contained in:
openharmony_ci 2024-09-15 10:58:51 +00:00 committed by Gitee
commit 2c317093e8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 44 additions and 9 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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};

View File

@ -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<Skill> 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<BundleMgrService>::GetInstance()->GetDataMgr();
ASSERT_NE(dataMgr, nullptr);
InnerBundleInfo innerBundleInfo;
innerBundleInfo.SetInstallMark(BUNDLE_NAME_DEMO, "", InstallExceptionStatus::INSTALL_FINISH);
std::map<std::string, InnerBundleUserInfo> innerBundleUserInfos;
InnerBundleUserInfo info;
info.bundleUserInfo.userId = DEFAULT_USERID;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 =