!7086 隐式匹配action为分享类型时校验文件数量需计算总数-代码回退

Merge pull request !7086 from 张欣宇/master
This commit is contained in:
openharmony_ci 2024-09-26 01:13:11 +00:00 committed by Gitee
commit a2aba75425
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 17 additions and 18 deletions

View File

@ -1052,7 +1052,7 @@ private:
std::vector<ExtensionAbilityInfo> &infos, int32_t appIndex = 0) const;
void GetAllExtensionInfosByExtensionTypeName(const std::string &typeName, uint32_t flags, int32_t userId,
const InnerBundleInfo &info, std::vector<ExtensionAbilityInfo> &infos, int32_t appIndex = 0) const;
bool MatchUtd(Skill &skill, const std::string &utd, int32_t count) const;
bool MatchUtd(const Skill &skill, const std::string &utd, int32_t count) const;
bool MatchUtd(const std::string &skillUtd, const std::string &wantUtd) const;
bool MatchTypeWithUtd(const std::string &mimeType, const std::string &wantUtd) const;
std::vector<int32_t> GetCloneAppIndexesNoLock(const std::string &bundleName, int32_t userId) const;

View File

@ -1775,40 +1775,39 @@ bool BundleDataMgr::MatchShare(const Want &want, const std::vector<Skill> &skill
}
auto shareSummary = pickerSummary.GetWantParams(WANT_PARAM_SUMMARY);
auto utds = shareSummary.KeySet();
for (auto &skill : shareActionSkills) {
bool match = true;
for (const auto &utd : utds) {
int32_t count = shareSummary.GetIntParam(utd, DEFAULT_SUMMARY_COUNT);
if (count <= DEFAULT_SUMMARY_COUNT) {
LOG_W(BMS_TAG_QUERY, "invalid utd count");
return false;
}
if (!MatchUtd(skill, utd, count)) {
match = false;
bool match = false;
for (const auto &skill : shareActionSkills) {
if (MatchUtd(skill, utd, count)) {
match = true;
break;
}
}
if (match) {
return true;
}
}
if (!match) {
LOG_D(BMS_TAG_QUERY, "match failed");
return false;
}
}
return true;
}
bool BundleDataMgr::MatchUtd(Skill &skill, const std::string &utd, int32_t count) const
bool BundleDataMgr::MatchUtd(const Skill &skill, const std::string &utd, int32_t count) const
{
for (SkillUri &skillUri : skill.uris) {
for (const SkillUri &skillUri : skill.uris) {
if (skillUri.maxFileSupported < count) {
continue;
}
if (!skillUri.utd.empty()) {
if (MatchUtd(skillUri.utd, utd)) {
skillUri.maxFileSupported -= count;
return true;
}
} else {
if (MatchTypeWithUtd(skillUri.type, utd)) {
skillUri.maxFileSupported -= count;
return true;
}
}