!7028 回退应用未安装完成可以查到应用信息

Merge pull request !7028 from daiyujia/master
This commit is contained in:
openharmony_ci 2024-09-23 02:11:08 +00:00 committed by Gitee
commit ba527abb07
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 8 additions and 44 deletions

View File

@ -3981,8 +3981,7 @@ bool BundleDataMgr::GetInnerBundleInfoWithFlags(const std::string &bundleName,
return false; return false;
} }
const InnerBundleInfo &innerBundleInfo = item->second; const InnerBundleInfo &innerBundleInfo = item->second;
auto mark = innerBundleInfo.GetInstallMark(); if (innerBundleInfo.IsDisabled()) {
if (innerBundleInfo.IsDisabled() || mark.status != InstallExceptionStatus::INSTALL_FINISH) {
APP_LOGD("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str()); APP_LOGD("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str());
return false; return false;
} }
@ -4063,8 +4062,7 @@ ErrCode BundleDataMgr::GetInnerBundleInfoWithFlagsV9(const std::string &bundleNa
return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST;
} }
const InnerBundleInfo &innerBundleInfo = item->second; const InnerBundleInfo &innerBundleInfo = item->second;
auto mark = innerBundleInfo.GetInstallMark(); if (innerBundleInfo.IsDisabled()) {
if (innerBundleInfo.IsDisabled() || mark.status != InstallExceptionStatus::INSTALL_FINISH) {
APP_LOGD("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str()); APP_LOGD("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str());
return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST;
} }
@ -4107,8 +4105,7 @@ ErrCode BundleDataMgr::GetInnerBundleInfoWithBundleFlagsV9(const std::string &bu
return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST;
} }
const InnerBundleInfo &innerBundleInfo = item->second; const InnerBundleInfo &innerBundleInfo = item->second;
auto mark = innerBundleInfo.GetInstallMark(); if (innerBundleInfo.IsDisabled()) {
if (innerBundleInfo.IsDisabled() || mark.status != InstallExceptionStatus::INSTALL_FINISH) {
APP_LOGW("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str()); APP_LOGW("bundleName: %{public}s status is disabled", innerBundleInfo.GetBundleName().c_str());
return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
} }

View File

@ -127,7 +127,6 @@ void BmsBundleDefaultAppMgrTest::AddInnerBundleInfo(const std::string bundleName
innerBundleInfo.AddInnerModuleInfo(innerModuleInfoMap); innerBundleInfo.AddInnerModuleInfo(innerModuleInfoMap);
innerBundleInfo.AddModuleAbilityInfo(innerAbilityMap); innerBundleInfo.AddModuleAbilityInfo(innerAbilityMap);
innerBundleInfo.AddInnerBundleUserInfo(innerBundleUserInfo); innerBundleInfo.AddInnerBundleUserInfo(innerBundleUserInfo);
innerBundleInfo.SetInstallMark(bundleName, MODULE_NAME, InstallExceptionStatus::INSTALL_FINISH);
Skill skill; Skill skill;
SkillUri uri; SkillUri uri;

View File

@ -209,8 +209,6 @@ void BmsBundleFreeInstallTest::AddInnerBundleInfo(const std::string bundleName,
innerBundleInfo.AddInnerBundleUserInfo(userInfo); innerBundleInfo.AddInnerBundleUserInfo(userInfo);
innerBundleInfo.SetBundlePackInfo(CreateBundlePackInfo(bundleName)); innerBundleInfo.SetBundlePackInfo(CreateBundlePackInfo(bundleName));
innerBundleInfo.AddInnerModuleInfo(innerModuleInfoMap); innerBundleInfo.AddInnerModuleInfo(innerModuleInfoMap);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
if (flag) { if (flag) {
innerBundleInfo.SetApplicationBundleType(BundleType::ATOMIC_SERVICE); innerBundleInfo.SetApplicationBundleType(BundleType::ATOMIC_SERVICE);

View File

@ -166,8 +166,6 @@ void BmsBundleKitServiceBaseTest::MockInstallBundle(
InnerBundleInfo innerBundleInfo; InnerBundleInfo innerBundleInfo;
innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo);
innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
Skill skill; Skill skill;
skill.actions = {ACTION}; skill.actions = {ACTION};
skill.entities = {ENTITY}; skill.entities = {ENTITY};

View File

@ -626,8 +626,6 @@ void BmsBundleKitServiceTest::AddInnerBundleInfoByTest(const std::string &bundle
std::string commonEventKey = bundleName + moduleName + abilityName; std::string commonEventKey = bundleName + moduleName + abilityName;
CommonEventInfo eventInfo = MockCommonEventInfo(bundleName, innerBundleInfo.GetUid(DEFAULT_USERID)); CommonEventInfo eventInfo = MockCommonEventInfo(bundleName, innerBundleInfo.GetUid(DEFAULT_USERID));
innerBundleInfo.InsertCommonEvents(commonEventKey, eventInfo); innerBundleInfo.InsertCommonEvents(commonEventKey, eventInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
} }
void BmsBundleKitServiceTest::MockInstallBundle( void BmsBundleKitServiceTest::MockInstallBundle(
@ -641,8 +639,6 @@ void BmsBundleKitServiceTest::MockInstallBundle(
InnerBundleInfo innerBundleInfo; InnerBundleInfo innerBundleInfo;
innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo);
innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
Skill skill; Skill skill;
skill.actions = {ACTION}; skill.actions = {ACTION};
skill.entities = {ENTITY}; skill.entities = {ENTITY};
@ -664,8 +660,6 @@ void BmsBundleKitServiceTest::MockInstallExtension(const std::string &bundleName
innerBundleInfo.InsertExtensionInfo(keyName, extensionInfo); innerBundleInfo.InsertExtensionInfo(keyName, extensionInfo);
innerBundleInfo.InsertExtensionInfo(keyName02, extensionInfo02); innerBundleInfo.InsertExtensionInfo(keyName02, extensionInfo02);
innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
Skill skill; Skill skill;
skill.actions = {ACTION}; skill.actions = {ACTION};
skill.entities = {ENTITY}; skill.entities = {ENTITY};
@ -688,8 +682,6 @@ void BmsBundleKitServiceTest::MockInstallExtensionWithUri(const std::string &bun
innerBundleInfo.InsertExtensionInfo(keyName, extensionInfo); innerBundleInfo.InsertExtensionInfo(keyName, extensionInfo);
innerBundleInfo.InsertExtensionInfo(keyName02, extensionInfo02); innerBundleInfo.InsertExtensionInfo(keyName02, extensionInfo02);
innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
Skill skill = MockExtensionSkillInfo(); Skill skill = MockExtensionSkillInfo();
std::vector<Skill> skills; std::vector<Skill> skills;
skills.emplace_back(skill); skills.emplace_back(skill);
@ -777,8 +769,6 @@ void BmsBundleKitServiceTest::MockInstallBundle(
AbilityInfo abilityInfo = MockAbilityInfo(bundleName, moduleName, abilityName); AbilityInfo abilityInfo = MockAbilityInfo(bundleName, moduleName, abilityName);
innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo);
innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo); innerBundleInfo.InsertInnerModuleInfo(moduleName, moduleInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
Skill skill; Skill skill;
skill.actions = {ACTION}; skill.actions = {ACTION};
skill.entities = {ENTITY}; skill.entities = {ENTITY};
@ -1021,8 +1011,6 @@ void BmsBundleKitServiceTest::MockInnerBundleInfo(const std::string &bundleName,
std::string keyName = bundleName + "." + moduleName + "." + abilityName; std::string keyName = bundleName + "." + moduleName + "." + abilityName;
innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo); innerBundleInfo.InsertAbilitiesInfo(keyName, abilityInfo);
innerBundleInfo.SetBaseApplicationInfo(appInfo); innerBundleInfo.SetBaseApplicationInfo(appInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
} }
void BmsBundleKitServiceTest::CheckBundleInfo(const std::string &bundleName, const std::string &moduleName, void BmsBundleKitServiceTest::CheckBundleInfo(const std::string &bundleName, const std::string &moduleName,
@ -9243,7 +9231,6 @@ HWTEST_F(BmsBundleKitServiceTest, CleanBundleCacheFilesGetCleanSize_0100, Functi
auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr(); auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
ASSERT_NE(dataMgr, nullptr); ASSERT_NE(dataMgr, nullptr);
InnerBundleInfo innerBundleInfo; InnerBundleInfo innerBundleInfo;
innerBundleInfo.SetInstallMark(BUNDLE_NAME_DEMO, "", InstallExceptionStatus::INSTALL_FINISH);
std::map<std::string, InnerBundleUserInfo> innerBundleUserInfos; std::map<std::string, InnerBundleUserInfo> innerBundleUserInfos;
InnerBundleUserInfo info; InnerBundleUserInfo info;
info.bundleUserInfo.userId = DEFAULT_USERID; info.bundleUserInfo.userId = DEFAULT_USERID;

View File

@ -148,8 +148,6 @@ void BmsBundleQuickFixQueryTest::MockInstallBundleInfo()
innerBundleInfo.SetBaseBundleInfo(bundleInfo); innerBundleInfo.SetBaseBundleInfo(bundleInfo);
innerBundleInfo.SetBaseApplicationInfo(applicationInfo); innerBundleInfo.SetBaseApplicationInfo(applicationInfo);
innerBundleInfo.AddInnerBundleUserInfo(userInfo); innerBundleInfo.AddInnerBundleUserInfo(userInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH);
auto dataMgr = GetBundleDataMgr(); auto dataMgr = GetBundleDataMgr();
EXPECT_NE(dataMgr, nullptr); EXPECT_NE(dataMgr, nullptr);

View File

@ -281,8 +281,6 @@ void BmsBundleQuickFixTest::AddInnerBundleInfo(const std::string bundleName,
innerBundleInfo.SetBaseApplicationInfo(applicationInfo); innerBundleInfo.SetBaseApplicationInfo(applicationInfo);
innerBundleInfo.AddInnerBundleUserInfo(userInfo); innerBundleInfo.AddInnerBundleUserInfo(userInfo);
innerBundleInfo.InsertInnerModuleInfo(bundleName, moduleInfo); innerBundleInfo.InsertInnerModuleInfo(bundleName, moduleInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(bundleName, packageName, InstallExceptionStatus::INSTALL_FINISH);
auto dataMgr = GetBundleDataMgr(); auto dataMgr = GetBundleDataMgr();
EXPECT_NE(dataMgr, nullptr); EXPECT_NE(dataMgr, nullptr);

View File

@ -2193,8 +2193,6 @@ HWTEST_F(BmsSandboxAppTest, GetBundleInfoForSelf_0100, Function | SmallTest | Le
InnerBundleInfo info; InnerBundleInfo info;
info.SetBaseApplicationInfo(appInfo); info.SetBaseApplicationInfo(appInfo);
info.AddInnerBundleUserInfo(innerUserInfo); info.AddInnerBundleUserInfo(innerUserInfo);
std::string packageName;
info.SetInstallMark(BUNDLE_NAME_TEST, packageName, InstallExceptionStatus::INSTALL_FINISH);
SaveSandboxAppInfo(info, APP_INDEX_1); SaveSandboxAppInfo(info, APP_INDEX_1);

View File

@ -574,20 +574,19 @@ HWTEST_F(BmsDataMgrTest, AddBundleInfo_0200, Function | SmallTest | Level0)
info1.SetBaseBundleInfo(bundleInfo1); info1.SetBaseBundleInfo(bundleInfo1);
info1.SetBaseApplicationInfo(applicationInfo1); info1.SetBaseApplicationInfo(applicationInfo1);
info1.AddInnerBundleUserInfo(innerBundleUserInfo); info1.AddInnerBundleUserInfo(innerBundleUserInfo);
info1.SetInstallMark(BUNDLE_NAME, "", InstallExceptionStatus::INSTALL_FINISH);
InnerBundleInfo info2; InnerBundleInfo info2;
BundleInfo bundleInfo2; BundleInfo bundleInfo2;
bundleInfo2.name = BUNDLE_NAME; bundleInfo2.name = BUNDLE_NAME;
bundleInfo2.applicationInfo.name = APP_NAME; bundleInfo2.applicationInfo.name = APP_NAME;
bundleInfo2.applicationInfo.bundleName = BUNDLE_NAME; bundleInfo2.applicationInfo.bundleName = BUNDLE_NAME;
applicationInfo1.name = BUNDLE_NAME; ApplicationInfo applicationInfo2;
applicationInfo1.bundleName = BUNDLE_NAME; applicationInfo2.name = BUNDLE_NAME;
applicationInfo1.deviceId = DEVICE_ID; applicationInfo2.bundleName = BUNDLE_NAME;
applicationInfo2.deviceId = DEVICE_ID;
info2.SetBaseBundleInfo(bundleInfo2); info2.SetBaseBundleInfo(bundleInfo2);
info2.SetBaseApplicationInfo(applicationInfo1); info2.SetBaseApplicationInfo(applicationInfo2);
info2.AddInnerBundleUserInfo(innerBundleUserInfo); info2.AddInnerBundleUserInfo(innerBundleUserInfo);
info2.SetInstallMark(BUNDLE_NAME, "", InstallExceptionStatus::INSTALL_FINISH);
auto dataMgr = GetDataMgr(); auto dataMgr = GetDataMgr();
EXPECT_NE(dataMgr, nullptr); EXPECT_NE(dataMgr, nullptr);
@ -880,8 +879,6 @@ HWTEST_F(BmsDataMgrTest, QueryAbilityInfo_0100, Function | SmallTest | Level0)
info1.InsertAbilitiesInfo(BUNDLE_NAME + PACKAGE_NAME + ABILITY_NAME, abilityInfo); info1.InsertAbilitiesInfo(BUNDLE_NAME + PACKAGE_NAME + ABILITY_NAME, abilityInfo);
info1.AddInnerBundleUserInfo(innerBundleUserInfo); info1.AddInnerBundleUserInfo(innerBundleUserInfo);
info1.SetAbilityEnabled(Constants::EMPTY_STRING, ABILITY_NAME, true, USERID); info1.SetAbilityEnabled(Constants::EMPTY_STRING, ABILITY_NAME, true, USERID);
std::string packageName;
info1.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH);
auto dataMgr = GetDataMgr(); auto dataMgr = GetDataMgr();
EXPECT_NE(dataMgr, nullptr); EXPECT_NE(dataMgr, nullptr);
dataMgr->AddUserId(USERID); dataMgr->AddUserId(USERID);
@ -1008,8 +1005,6 @@ HWTEST_F(BmsDataMgrTest, GetApplicationInfo_0100, Function | SmallTest | Level0)
info1.SetBaseBundleInfo(bundleInfo1); info1.SetBaseBundleInfo(bundleInfo1);
info1.SetBaseApplicationInfo(applicationInfo1); info1.SetBaseApplicationInfo(applicationInfo1);
info1.AddInnerBundleUserInfo(innerBundleUserInfo); info1.AddInnerBundleUserInfo(innerBundleUserInfo);
std::string packageName;
info1.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH);
auto dataMgr = GetDataMgr(); auto dataMgr = GetDataMgr();
EXPECT_NE(dataMgr, nullptr); EXPECT_NE(dataMgr, nullptr);
@ -2465,8 +2460,6 @@ HWTEST_F(BmsDataMgrTest, QueryAbilityInfoByContinueType_0200, Function | SmallTe
applicationInfo.bundleName = BUNDLE_NAME; applicationInfo.bundleName = BUNDLE_NAME;
InnerBundleInfo innerBundleInfo; InnerBundleInfo innerBundleInfo;
innerBundleInfo.SetBaseApplicationInfo(applicationInfo); innerBundleInfo.SetBaseApplicationInfo(applicationInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH);
int32_t userId = Constants::ALL_USERID; int32_t userId = Constants::ALL_USERID;
BundleUserInfo userInfo; BundleUserInfo userInfo;
userInfo.userId = userId; userInfo.userId = userId;
@ -2564,8 +2557,6 @@ HWTEST_F(BmsDataMgrTest, GetInnerBundleInfoWithFlags_0100, Function | SmallTest
InnerBundleUserInfo innerBundleUserInfo; InnerBundleUserInfo innerBundleUserInfo;
innerBundleUserInfo.bundleUserInfo = userInfo; innerBundleUserInfo.bundleUserInfo = userInfo;
innerBundleInfo.AddInnerBundleUserInfo(innerBundleUserInfo); innerBundleInfo.AddInnerBundleUserInfo(innerBundleUserInfo);
std::string packageName;
innerBundleInfo.SetInstallMark(BUNDLE_NAME, packageName, InstallExceptionStatus::INSTALL_FINISH);
dataMgr->multiUserIdsSet_.insert(userId); dataMgr->multiUserIdsSet_.insert(userId);
dataMgr->bundleInfos_.emplace(BUNDLE_NAME, innerBundleInfo); dataMgr->bundleInfos_.emplace(BUNDLE_NAME, innerBundleInfo);
ErrCode res = ErrCode res =