!11283 代码自检修改

Merge pull request !11283 from donglin/lock
This commit is contained in:
openharmony_ci 2024-10-30 07:33:01 +00:00 committed by Gitee
commit 1e6440c012
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 13 additions and 3 deletions

View File

@ -955,6 +955,7 @@ void ContextImpl::SubscribeToOverlayEvents(std::shared_ptr<Global::Resource::Res
const std::string &name, const std::string &hapModuleName, std::string &loadPath,
std::vector<AppExecFwk::OverlayModuleInfo> overlayModuleInfos)
{
std::lock_guard<std::mutex> lock(overlaySubscriberMutex_);
if (overlaySubscriber_ != nullptr) {
return;
}
@ -976,6 +977,7 @@ void ContextImpl::SubscribeToOverlayEvents(std::shared_ptr<Global::Resource::Res
void ContextImpl::UnsubscribeToOverlayEvents()
{
std::lock_guard<std::mutex> lock(overlaySubscriberMutex_);
if (overlaySubscriber_ != nullptr) {
EventFwk::CommonEventManager::UnSubscribeCommonEvent(overlaySubscriber_);
overlaySubscriber_ = nullptr;

View File

@ -495,6 +495,7 @@ private:
// False: no need to get a new fms remote object.
volatile bool resetFlag_ = false;
std::mutex overlaySubscriberMutex_;
std::shared_ptr<AppExecFwk::OverlayEventSubscriber> overlaySubscriber_;
};
} // namespace AbilityRuntime

View File

@ -8120,6 +8120,10 @@ bool AppMgrServiceInner::IsProcessContainsOnlyUIAbility(const pid_t pid)
void AppMgrServiceInner::MakeIsolateSandBoxProcessName(const std::shared_ptr<AbilityInfo> &abilityInfo,
const HapModuleInfo &hapModuleInfo, std::string &processName) const
{
if (abilityInfo == nullptr) {
TAG_LOGE(AAFwkTag::APPMGR, "abilityInfo nullptr");
return;
}
auto type = abilityInfo->type;
auto extensionType = abilityInfo->extensionAbilityType;
if (type != AppExecFwk::AbilityType::EXTENSION ||
@ -8127,9 +8131,12 @@ void AppMgrServiceInner::MakeIsolateSandBoxProcessName(const std::shared_ptr<Abi
extensionType == AppExecFwk::ExtensionAbilityType::SERVICE) {
return;
}
for (auto extensionInfo: hapModuleInfo.extensionInfos) {
if (extensionInfo.name == abilityInfo->name && extensionInfo.needCreateSandbox) {
processName = (processName + ":" + abilityInfo->name);
for (const auto& extensionInfo: hapModuleInfo.extensionInfos) {
if (extensionInfo.name == abilityInfo->name) {
if (extensionInfo.needCreateSandbox) {
processName = (processName + ":" + abilityInfo->name);
}
return;
}
}
}