mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2025-01-08 01:51:23 +00:00
IssueNo:#I5EUK2:Rollback some code of moduleName
Description: Rollback some code of moduleName Sig:SIG_ApplicationFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: zhoujun62 <zhoujun62@huawei.com> Change-Id: I4259188cb49bc289213da158150dd116b63154fa
This commit is contained in:
parent
6bc18d6166
commit
a881d0f8c4
@ -3690,24 +3690,21 @@ napi_value ConnectAbilityWrap(napi_env env, napi_callback_info info, ConnectAbil
|
||||
std::string deviceId = connectAbilityCB->want.GetElement().GetDeviceID();
|
||||
std::string bundleName = connectAbilityCB->want.GetBundle();
|
||||
std::string abilityName = connectAbilityCB->want.GetElement().GetAbilityName();
|
||||
std::string moduleName = connectAbilityCB->want.GetElement().GetModuleName();
|
||||
|
||||
auto item = std::find_if(connects_.begin(),
|
||||
connects_.end(), [&deviceId, &bundleName, &abilityName, &moduleName](const std::map<ConnecttionKey,
|
||||
connects_.end(), [&deviceId, &bundleName, &abilityName](const std::map<ConnecttionKey,
|
||||
sptr<NAPIAbilityConnection>>::value_type &obj) {
|
||||
return (deviceId == obj.first.want.GetElement().GetDeviceID()) &&
|
||||
(bundleName == obj.first.want.GetBundle()) &&
|
||||
(abilityName == obj.first.want.GetElement().GetAbilityName()) &&
|
||||
(moduleName == obj.first.want.GetElement().GetModuleName());
|
||||
(abilityName == obj.first.want.GetElement().GetAbilityName());
|
||||
});
|
||||
if (item != connects_.end()) {
|
||||
// match bundlename && abilityname
|
||||
// match deviceid & bundlename && abilityname
|
||||
connectAbilityCB->id = item->first.id;
|
||||
connectAbilityCB->abilityConnection = item->second;
|
||||
HILOG_INFO("%{public}s find connection exist", __func__);
|
||||
} else {
|
||||
sptr<NAPIAbilityConnection> conn(new (std::nothrow) NAPIAbilityConnection());
|
||||
conn->SetModuleName(moduleName);
|
||||
connectAbilityCB->id = serialNumber_;
|
||||
connectAbilityCB->abilityConnection = conn;
|
||||
ConnecttionKey key;
|
||||
@ -4060,16 +4057,6 @@ void NAPIAbilityConnection::SetDisconnectCBRef(const napi_ref &ref)
|
||||
disconnectRef_ = ref;
|
||||
}
|
||||
|
||||
void NAPIAbilityConnection::SetModuleName(const std::string &moduleName)
|
||||
{
|
||||
moduleName_ = moduleName;
|
||||
}
|
||||
|
||||
std::string NAPIAbilityConnection::GetModuleName() const
|
||||
{
|
||||
return moduleName_;
|
||||
}
|
||||
|
||||
void UvWorkOnAbilityConnectDone(uv_work_t *work, int status)
|
||||
{
|
||||
HILOG_INFO("UvWorkOnAbilityConnectDone, uv_queue_work");
|
||||
@ -4197,17 +4184,16 @@ void UvWorkOnAbilityDisconnectDone(uv_work_t *work, int status)
|
||||
std::string deviceId = connectAbilityCB->abilityConnectionCB.elementName.GetDeviceID();
|
||||
std::string bundleName = connectAbilityCB->abilityConnectionCB.elementName.GetBundleName();
|
||||
std::string abilityName = connectAbilityCB->abilityConnectionCB.elementName.GetAbilityName();
|
||||
std::string moduleName = connectAbilityCB->abilityConnection->GetModuleName();
|
||||
auto item = std::find_if(connects_.begin(),
|
||||
connects_.end(), [deviceId, bundleName, abilityName, moduleName](const std::map<ConnecttionKey,
|
||||
connects_.end(),
|
||||
[deviceId, bundleName, abilityName](const std::map<ConnecttionKey,
|
||||
sptr<NAPIAbilityConnection>>::value_type &obj) {
|
||||
return (deviceId == obj.first.want.GetDeviceId()) &&
|
||||
(bundleName == obj.first.want.GetBundle()) &&
|
||||
(abilityName == obj.first.want.GetElement().GetAbilityName()) &&
|
||||
(moduleName == obj.first.want.GetElement().GetModuleName());
|
||||
(abilityName == obj.first.want.GetElement().GetAbilityName());
|
||||
});
|
||||
if (item != connects_.end()) {
|
||||
// match bundlename && abilityname && modulename
|
||||
// match deviceid & bundlename && abilityname
|
||||
connects_.erase(item);
|
||||
HILOG_INFO("UvWorkOnAbilityDisconnectDone erase connects_.size:%{public}zu", connects_.size());
|
||||
}
|
||||
@ -4234,8 +4220,8 @@ void NAPIAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementNam
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_INFO("%{public}s bundleName:%{public}s abilityName:%{public}s moduleName:%{public}s, resultCode:%{public}d",
|
||||
__func__, element.GetBundleName().c_str(), element.GetAbilityName().c_str(), moduleName_.c_str(), resultCode);
|
||||
HILOG_INFO("%{public}s bundleName:%{public}s abilityName:%{public}s, resultCode:%{public}d",
|
||||
__func__, element.GetBundleName().c_str(), element.GetAbilityName().c_str(), resultCode);
|
||||
|
||||
uv_work_t *work = new(std::nothrow) uv_work_t;
|
||||
if (work == nullptr) {
|
||||
@ -4253,18 +4239,10 @@ void NAPIAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementNam
|
||||
return;
|
||||
}
|
||||
|
||||
connectAbilityCB->abilityConnection = new (std::nothrow) NAPIAbilityConnection;
|
||||
if (connectAbilityCB->abilityConnection == nullptr) {
|
||||
delete connectAbilityCB;
|
||||
delete work;
|
||||
return;
|
||||
}
|
||||
|
||||
connectAbilityCB->cbBase.cbInfo.env = env_;
|
||||
connectAbilityCB->cbBase.cbInfo.callback = disconnectRef_;
|
||||
connectAbilityCB->abilityConnectionCB.elementName = element;
|
||||
connectAbilityCB->abilityConnectionCB.resultCode = resultCode;
|
||||
connectAbilityCB->abilityConnection->SetModuleName(moduleName_);
|
||||
work->data = (void *)connectAbilityCB;
|
||||
|
||||
int rev = uv_queue_work(
|
||||
|
@ -219,14 +219,11 @@ public:
|
||||
void SetEnv(const napi_env &env);
|
||||
void SetConnectCBRef(const napi_ref &ref);
|
||||
void SetDisconnectCBRef(const napi_ref &ref);
|
||||
void SetModuleName(const std::string &moduleName);
|
||||
std::string GetModuleName() const;
|
||||
|
||||
private:
|
||||
napi_env env_;
|
||||
napi_ref connectRef_;
|
||||
napi_ref disconnectRef_;
|
||||
std::string moduleName_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,8 @@ int LocalCallContainer::StartAbilityByCallInner(
|
||||
|
||||
if (want.GetElement().GetBundleName().empty() ||
|
||||
want.GetElement().GetAbilityName().empty()) {
|
||||
HILOG_DEBUG("the element of want is empty.");
|
||||
HILOG_ERROR("the element of want is empty.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (want.GetElement().GetDeviceID().empty()) {
|
||||
@ -179,7 +180,7 @@ bool LocalCallContainer::GetCallLocalRecord(
|
||||
AppExecFwk::ElementName callElement;
|
||||
if (!callElement.ParseURI(pair.first)) {
|
||||
HILOG_ERROR("Parse uri to elementName failed, elementName uri: %{public}s", pair.first.c_str());
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
// elementName in callProxyRecords_ has moduleName (sometimes not empty),
|
||||
// but the moduleName of input param elementName is usually empty.
|
||||
|
@ -219,7 +219,6 @@ std::shared_ptr<AbilityRecord> MissionList::GetAbilityRecordByName(const AppExec
|
||||
abilityInfo.name, abilityInfo.moduleName);
|
||||
AppExecFwk::ElementName localElementNoModuleName(abilityInfo.deviceId,
|
||||
abilityInfo.bundleName, abilityInfo.name); // note: moduleName of input param element maybe empty
|
||||
|
||||
if (localElement == element || localElementNoModuleName == element) {
|
||||
return mission->GetAbilityRecord();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user