!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; std::vector<ExtensionAbilityInfo> &infos, int32_t appIndex = 0) const;
void GetAllExtensionInfosByExtensionTypeName(const std::string &typeName, uint32_t flags, int32_t userId, void GetAllExtensionInfosByExtensionTypeName(const std::string &typeName, uint32_t flags, int32_t userId,
const InnerBundleInfo &info, std::vector<ExtensionAbilityInfo> &infos, int32_t appIndex = 0) const; 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 MatchUtd(const std::string &skillUtd, const std::string &wantUtd) const;
bool MatchTypeWithUtd(const std::string &mimeType, 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; 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 shareSummary = pickerSummary.GetWantParams(WANT_PARAM_SUMMARY);
auto utds = shareSummary.KeySet(); auto utds = shareSummary.KeySet();
for (auto &skill : shareActionSkills) { for (const auto &utd : utds) {
bool match = true; int32_t count = shareSummary.GetIntParam(utd, DEFAULT_SUMMARY_COUNT);
for (const auto &utd : utds) { if (count <= DEFAULT_SUMMARY_COUNT) {
int32_t count = shareSummary.GetIntParam(utd, DEFAULT_SUMMARY_COUNT); LOG_W(BMS_TAG_QUERY, "invalid utd count");
if (count <= DEFAULT_SUMMARY_COUNT) { return false;
LOG_W(BMS_TAG_QUERY, "invalid utd count"); }
return false; bool match = false;
} for (const auto &skill : shareActionSkills) {
if (!MatchUtd(skill, utd, count)) { if (MatchUtd(skill, utd, count)) {
match = false; match = true;
break; break;
} }
} }
if (match) { if (!match) {
return true; LOG_D(BMS_TAG_QUERY, "match failed");
return false;
} }
} }
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) { if (skillUri.maxFileSupported < count) {
continue; continue;
} }
if (!skillUri.utd.empty()) { if (!skillUri.utd.empty()) {
if (MatchUtd(skillUri.utd, utd)) { if (MatchUtd(skillUri.utd, utd)) {
skillUri.maxFileSupported -= count;
return true; return true;
} }
} else { } else {
if (MatchTypeWithUtd(skillUri.type, utd)) { if (MatchTypeWithUtd(skillUri.type, utd)) {
skillUri.maxFileSupported -= count;
return true; return true;
} }
} }