mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 01:10:52 +00:00
commit
5203278a23
@ -34,7 +34,7 @@ void AbilityConnection::OnAbilityConnectDone(
|
||||
element.GetBundleName().c_str(), element.GetAbilityName().c_str(), resultCode);
|
||||
mutex_.lock();
|
||||
if (abilityConnectCallbackList_.empty()) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "empty abilityConnectCallbackList");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "empty callbackList");
|
||||
mutex_.unlock();
|
||||
return;
|
||||
}
|
||||
|
@ -2149,7 +2149,11 @@ void JSAbilityConnection::HandleOnAbilityConnectDone(const AppExecFwk::ElementNa
|
||||
// wrap RemoteObject
|
||||
napi_value napiRemoteObject = NAPI_ohos_rpc_CreateJsRemoteObject(env_, remoteObject);
|
||||
napi_value argv[] = { ConvertElement(element), napiRemoteObject };
|
||||
napi_call_function(env_, obj, methodOnConnect, ARGC_TWO, argv, nullptr);
|
||||
TAG_LOGI(AAFwkTag::CONTEXT, "Call onConnect");
|
||||
napi_status status = napi_call_function(env_, obj, methodOnConnect, ARGC_TWO, argv, nullptr);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "call js func failed %{public}d", status);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::CONTEXT, "end");
|
||||
}
|
||||
|
||||
@ -2213,8 +2217,11 @@ void JSAbilityConnection::HandleOnAbilityDisconnectDone(const AppExecFwk::Elemen
|
||||
}
|
||||
|
||||
napi_value argv[] = { ConvertElement(element) };
|
||||
TAG_LOGD(AAFwkTag::CONTEXT, "success");
|
||||
napi_call_function(env_, obj, method, ARGC_ONE, argv, nullptr);
|
||||
TAG_LOGI(AAFwkTag::CONTEXT, "Call onDisconnect");
|
||||
napi_status status = napi_call_function(env_, obj, method, ARGC_ONE, argv, nullptr);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "call js func failed %{public}d", status);
|
||||
}
|
||||
}
|
||||
|
||||
void JSAbilityConnection::CallJsFailed(int32_t errorCode)
|
||||
|
@ -635,7 +635,11 @@ napi_value JsServiceExtension::CallOnConnect(const AAFwk::Want &want)
|
||||
return nullptr;
|
||||
}
|
||||
napi_value remoteNative = nullptr;
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, &remoteNative);
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Call onConnect");
|
||||
napi_status status = napi_call_function(env, obj, method, ARGC_ONE, argv, &remoteNative);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "call js func failed %{public}d", status);
|
||||
}
|
||||
if (remoteNative == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null remoteNative");
|
||||
}
|
||||
@ -666,13 +670,19 @@ napi_value JsServiceExtension::CallOnDisconnect(const AAFwk::Want &want, bool wi
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get onDisconnect from ServiceExtension obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Call onDisconnect");
|
||||
if (withResult) {
|
||||
napi_value result = nullptr;
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, &result);
|
||||
napi_status status = napi_call_function(env, obj, method, ARGC_ONE, argv, &result);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "call js func failed %{public}d", status);
|
||||
}
|
||||
return handleEscape.Escape(result);
|
||||
} else {
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, nullptr);
|
||||
napi_status status = napi_call_function(env, obj, method, ARGC_ONE, argv, nullptr);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "call js func failed %{public}d", status);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1426,7 +1426,11 @@ void JSServiceExtensionConnection::HandleOnAbilityConnectDone(const AppExecFwk::
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null methodOnConnect");
|
||||
return;
|
||||
}
|
||||
napi_call_function(env_, obj, methodOnConnect, ARGC_TWO, argv, nullptr);
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Call onConnect");
|
||||
napi_status status = napi_call_function(env_, obj, methodOnConnect, ARGC_TWO, argv, nullptr);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "call js func failed %{public}d", status);
|
||||
}
|
||||
}
|
||||
|
||||
void JSServiceExtensionConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode)
|
||||
@ -1492,7 +1496,11 @@ void JSServiceExtensionConnection::HandleOnAbilityDisconnectDone(const AppExecFw
|
||||
AAFwkTag::SERVICE_EXT, "OnAbilityDisconnectDone erase g_connects.size:%{public}zu", g_connects.size());
|
||||
}
|
||||
}
|
||||
napi_call_function(env_, obj, method, ARGC_ONE, argv, nullptr);
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Call onDisconnect");
|
||||
napi_status status = napi_call_function(env_, obj, method, ARGC_ONE, argv, nullptr);
|
||||
if (status != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "call js func failed %{public}d", status);
|
||||
}
|
||||
}
|
||||
|
||||
void JSServiceExtensionConnection::SetJsConnectionObject(napi_value jsConnectionObject)
|
||||
|
@ -139,13 +139,14 @@ int AbilityConnectionStub::OnRemoteRequest(
|
||||
auto resultCode = data.ReadInt32();
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "AbilityConnectionStub ON_ABILITY_CONNECT_DONE");
|
||||
OnAbilityConnectDone(*element, remoteObject, resultCode);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "AbilityConnectionStub ON_ABILITY_CONNECT_DONE end");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "AbilityConnectionStub ON_ABILITY_CONNECT_DONE end");
|
||||
return NO_ERROR;
|
||||
}
|
||||
case IAbilityConnection::ON_ABILITY_DISCONNECT_DONE: {
|
||||
auto resultCode = data.ReadInt32();
|
||||
OnAbilityDisconnectDone(*element, resultCode);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "AbilityConnectionStub ON_ABILITY_DISCONNECT_DONE");
|
||||
OnAbilityDisconnectDone(*element, resultCode);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "AbilityConnectionStub ON_ABILITY_DISCONNECT_DONE end");
|
||||
return NO_ERROR;
|
||||
}
|
||||
case IAbilityConnection::ON_REMOTE_STATE_CHANGED: {
|
||||
|
@ -571,7 +571,7 @@ int AbilityConnectManager::ConnectAbilityLocked(const AbilityRequest &abilityReq
|
||||
bool isCallbackConnected = !connectRecordList.empty();
|
||||
// 3. If this service ability and callback has been connected, There is no need to connect repeatedly
|
||||
if (isLoadedAbility && (isCallbackConnected) && IsAbilityConnected(targetService, connectRecordList)) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Service/callback connected");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Service/callback connected");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -608,7 +608,7 @@ int AbilityConnectManager::ConnectAbilityLocked(const AbilityRequest &abilityReq
|
||||
targetService->SetWant(abilityRequest.want);
|
||||
HandleActiveAbility(targetService, connectRecord);
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "TargetService active");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "TargetService activing");
|
||||
targetService->SaveConnectWant(abilityRequest.want);
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user