!9689 context日志整改

Merge pull request !9689 from songjindian/log_context
This commit is contained in:
openharmony_ci 2024-08-09 01:16:27 +00:00 committed by Gitee
commit 28644adb47
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 446 additions and 451 deletions

View File

@ -29,7 +29,7 @@ int CJApplicationContext::GetArea()
{
auto context = applicationContext_.lock();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "application context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return INVALID_CODE;
}
return context->GetArea();
@ -39,7 +39,7 @@ std::shared_ptr<AppExecFwk::ApplicationInfo> CJApplicationContext::GetApplicatio
{
auto context = applicationContext_.lock();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "application context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
return context->GetApplicationInfo();
@ -50,7 +50,7 @@ int64_t FFIGetArea(int64_t id)
{
auto context = FFI::FFIData::GetData<CJApplicationContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "cj application context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return INVALID_CODE;
}
return context->GetArea();
@ -60,13 +60,13 @@ CApplicationInfo* FFICJApplicationInfo(int64_t id)
{
auto context = FFI::FFIData::GetData<CJApplicationContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "cj application context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
auto appInfo = context->GetApplicationInfo();
CApplicationInfo* buffer = static_cast<CApplicationInfo*>(malloc(sizeof(CApplicationInfo)));
if (buffer == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "fail to malloc appinfo.");
TAG_LOGE(AAFwkTag::CONTEXT, "malloc appinfo fail");
return nullptr;
}
buffer->name = CreateCStringFromString(appInfo->name);

View File

@ -31,7 +31,7 @@ ElementNameHandle FFICJElementNameCreateWithContent(
void FFICJElementNameDelete(ElementNameHandle elementNameHandle)
{
if (elementNameHandle == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "input element name handle is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null elementNameHandle");
return;
}
auto actualElementName = reinterpret_cast<ElementName*>(elementNameHandle);
@ -44,7 +44,7 @@ ElementNameParams* FFICJElementNameGetElementNameInfo(ElementNameHandle elementN
{
ElementNameParams* buffer = static_cast<ElementNameParams*>(malloc(sizeof(ElementNameParams)));
if (buffer == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "fail to malloc element name params.");
TAG_LOGE(AAFwkTag::CONTEXT, "null buffer");
return nullptr;
}

View File

@ -46,7 +46,7 @@ public:
void JsContext::Finalizer(napi_env env, void* data, void* hint)
{
TAG_LOGD(AAFwkTag::CONTEXT, "finalizer called");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (data == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "null data");
return;
@ -62,13 +62,13 @@ napi_value CreateSendableContextObject(napi_env env, std::shared_ptr<Context> co
// Sendable context has no property for now.
status = napi_create_sendable_object_with_properties(env, 0, nullptr, &objValue);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "Create sendable context failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "create sendable context failed:%{public}d", status);
return nullptr;
}
status = napi_wrap_sendable(env, objValue, jsContext.release(), JsContext::Finalizer, nullptr);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "Wrap sendable failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "wrap sendable failed:%{public}d", status);
return nullptr;
}
@ -92,7 +92,7 @@ napi_value CreateJsBaseContextFromSendable(napi_env env, void* wrapped)
auto contextPtr = Context::ConvertTo<Context>(context);
if (contextPtr == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Convert to context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
@ -100,7 +100,7 @@ napi_value CreateJsBaseContextFromSendable(napi_env env, void* wrapped)
auto value = CreateJsBaseContext(env, contextPtr);
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.Context", &value, 1);
if (systemModule == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Load context module failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null system module");
return nullptr;
}
@ -118,13 +118,13 @@ napi_value CreateJsApplicationContextFromSendable(napi_env env, void* wrapped)
auto weakContext = sendableContext->context_;
std::shared_ptr<Context> context = weakContext.lock();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Context invalid.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
auto applicationContext = Context::ConvertTo<ApplicationContext>(context);
if (applicationContext == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Convert to application context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null application context");
return nullptr;
}
@ -132,7 +132,7 @@ napi_value CreateJsApplicationContextFromSendable(napi_env env, void* wrapped)
auto value = JsApplicationContextUtils::CreateJsApplicationContext(env);
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.ApplicationContext", &value, 1);
if (systemModule == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Load application context module failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null system module");
return nullptr;
}
@ -150,13 +150,13 @@ napi_value CreateJsAbilityStageContextFromSendable(napi_env env, void* wrapped)
auto weakContext = sendableContext->context_;
std::shared_ptr<Context> context = weakContext.lock();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Context invalid.");
TAG_LOGE(AAFwkTag::CONTEXT, "context invalid");
return nullptr;
}
auto abilitystageContext = Context::ConvertTo<AbilityStageContext>(context);
if (abilitystageContext == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Convert to ability stage context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null abilitystageContext");
return nullptr;
}
@ -164,7 +164,7 @@ napi_value CreateJsAbilityStageContextFromSendable(napi_env env, void* wrapped)
auto value = CreateJsAbilityStageContext(env, abilitystageContext);
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.AbilityStageContext", &value, 1);
if (systemModule == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Load ability stage context module failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null systemModule");
return nullptr;
}
@ -182,7 +182,7 @@ napi_value CreateJsUIAbilityContextFromSendable(napi_env env, void* wrapped)
auto weakContext = sendableContext->context_;
std::shared_ptr<Context> context = weakContext.lock();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "null ontext");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
@ -196,7 +196,7 @@ napi_value CreateJsUIAbilityContextFromSendable(napi_env env, void* wrapped)
auto value = CreateJsAbilityContext(env, uiAbilityContext);
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.AbilityContext", &value, 1);
if (systemModule == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Load ability context module failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null systemModule");
return nullptr;
}
@ -210,9 +210,9 @@ public:
static void Finalizer(napi_env env, void *data, void *hint)
{
TAG_LOGD(AAFwkTag::CONTEXT, "finalizer called");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (data == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "null data");
TAG_LOGE(AAFwkTag::CONTEXT, "input data invalid");
return;
}
std::unique_ptr<JsSendableContextManager>(static_cast<JsSendableContextManager*>(data));
@ -257,21 +257,21 @@ private:
bool stageMode = false;
napi_status status = IsStageContext(env, info.argv[0], stageMode);
if (status != napi_ok || !stageMode) {
TAG_LOGE(AAFwkTag::CONTEXT, "Context isn't stageMode, status is %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "context isn't stageMode, status is %{public}d", status);
ThrowInvalidParamError(env, "Parse param context failed, must be a context of stageMode.");
return CreateJsUndefined(env);
}
auto context = GetStageModeContext(env, info.argv[0]);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Get context failed");
TAG_LOGE(AAFwkTag::CONTEXT, "get context failed");
ThrowInvalidParamError(env, "Parse param context failed, must not be nullptr.");
return CreateJsUndefined(env);
}
auto contextPtr = Context::ConvertTo<Context>(context);
if (contextPtr == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Convert to context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "convert to context failed");
ThrowInvalidParamError(env, "Parse param context failed, must be a context.");
return CreateJsUndefined(env);
}
@ -282,9 +282,9 @@ private:
napi_value OnConvertToContext(napi_env env, NapiCallbackInfo &info)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Convert to context.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (info.argc != ARGC_ONE) {
TAG_LOGE(AAFwkTag::CONTEXT, "The number of parameter is invalid.");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid params");
ThrowInvalidParamError(env, "Parameter error: The number of parameter is invalid.");
return CreateJsUndefined(env);
}
@ -293,7 +293,7 @@ private:
void *wrapped = nullptr;
auto status = napi_unwrap_sendable(env, info.argv[0], &wrapped);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "Unwrap sendable object failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "unwrap sendable failed:%{public}d", status);
ThrowInvalidParamError(env, "Parameter error: Input parameter is invalid.");
return CreateJsUndefined(env);
}
@ -301,7 +301,7 @@ private:
// Create normal context
auto object = CreateJsBaseContextFromSendable(env, wrapped);
if (object == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Create base context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "create base context failed");
ThrowInvalidParamError(env, "Parameter error: Create context failed.");
return CreateJsUndefined(env);
}
@ -311,9 +311,9 @@ private:
napi_value OnConvertToApplicationContext(napi_env env, NapiCallbackInfo &info)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Convert to application context.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (info.argc != ARGC_ONE) {
TAG_LOGE(AAFwkTag::CONTEXT, "The number of parameter is invalid.");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid params");
ThrowInvalidParamError(env, "Parameter error: The number of parameter is invalid.");
return CreateJsUndefined(env);
}
@ -322,7 +322,7 @@ private:
void *wrapped = nullptr;
auto status = napi_unwrap_sendable(env, info.argv[0], &wrapped);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "Unwrap sendable object failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "unwrap sendable failed: %{public}d", status);
ThrowInvalidParamError(env, "Parameter error: Input parameter is invalid.");
return CreateJsUndefined(env);
}
@ -330,7 +330,7 @@ private:
// Create normal context
auto object = CreateJsApplicationContextFromSendable(env, wrapped);
if (object == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Create base context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "create base context failed");
ThrowInvalidParamError(env, "Parameter error: Create application context failed.");
return CreateJsUndefined(env);
}
@ -340,9 +340,9 @@ private:
napi_value OnConvertToAbilityStageContext(napi_env env, NapiCallbackInfo &info)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Convert to ability stage context.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (info.argc != ARGC_ONE) {
TAG_LOGE(AAFwkTag::CONTEXT, "The number of parameter is invalid.");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid params");
ThrowInvalidParamError(env, "Parameter error: The number of parameter is invalid.");
return CreateJsUndefined(env);
}
@ -351,7 +351,7 @@ private:
void *wrapped = nullptr;
auto status = napi_unwrap_sendable(env, info.argv[0], &wrapped);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "Unwrap sendable object failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "unwrap sendable object failed with %{public}d", status);
ThrowInvalidParamError(env, "Parameter error: Input parameter is invalid.");
return CreateJsUndefined(env);
}
@ -359,7 +359,7 @@ private:
// Create normal context
auto object = CreateJsAbilityStageContextFromSendable(env, wrapped);
if (object == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Create base context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context object");
ThrowInvalidParamError(env, "Parameter error: Create ability stage context failed.");
return CreateJsUndefined(env);
}
@ -369,9 +369,9 @@ private:
napi_value OnConvertToUIAbilityContext(napi_env env, NapiCallbackInfo &info)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Convert to uiability context.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (info.argc != ARGC_ONE) {
TAG_LOGE(AAFwkTag::CONTEXT, "The number of parameter is invalid.");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid params");
ThrowInvalidParamError(env, "Parameter error: The number of parameter is invalid.");
return CreateJsUndefined(env);
}
@ -380,7 +380,7 @@ private:
void *wrapped = nullptr;
auto status = napi_unwrap_sendable(env, info.argv[0], &wrapped);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "Unwrap sendable object failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "invalid params %{public}d", status);
ThrowInvalidParamError(env, "Parameter error: Input parameter is invalid.");
return CreateJsUndefined(env);
}
@ -388,7 +388,7 @@ private:
// Create uiability context
auto object = CreateJsUIAbilityContextFromSendable(env, wrapped);
if (object == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Create uiability context failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null uiability context");
ThrowInvalidParamError(env, "Parameter error: Create uiability context failed.");
return CreateJsUndefined(env);
}
@ -399,9 +399,9 @@ private:
napi_value CreateJsSendableContextManager(napi_env env, napi_value exportObj)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Create sendable context manager.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (env == nullptr || exportObj == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Invalid parameter.");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid params");
return nullptr;
}
@ -409,7 +409,7 @@ napi_value CreateJsSendableContextManager(napi_env env, napi_value exportObj)
std::unique_ptr<JsSendableContextManager> sendableMgr = std::make_unique<JsSendableContextManager>();
status = napi_wrap(env, exportObj, sendableMgr.release(), JsSendableContextManager::Finalizer, nullptr, nullptr);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "napi wrap failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "wrap failed:%{public}d", status);
return nullptr;
}
@ -423,7 +423,7 @@ napi_value CreateJsSendableContextManager(napi_env env, napi_value exportObj)
status = napi_define_properties(env, exportObj, sizeof(properties) / sizeof(properties[0]), properties);
if (status != napi_ok) {
TAG_LOGE(AAFwkTag::CONTEXT, "napi define property failed with %{public}d.", status);
TAG_LOGE(AAFwkTag::CONTEXT, "failed:%{public}d", status);
return nullptr;
}

View File

@ -132,7 +132,7 @@ bool AbilityContextImpl::PrintDrawnCompleted()
void AbilityContextImpl::SwitchArea(int mode)
{
TAG_LOGD(AAFwkTag::CONTEXT, "mode:%{public}d.", mode);
TAG_LOGD(AAFwkTag::CONTEXT, "mode:%{public}d", mode);
if (stageContext_ != nullptr) {
stageContext_->SwitchArea(mode);
}
@ -140,9 +140,9 @@ void AbilityContextImpl::SwitchArea(int mode)
int AbilityContextImpl::GetArea()
{
TAG_LOGD(AAFwkTag::CONTEXT, "GetArea");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (stageContext_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "stageContext is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null stageContext");
return ContextImpl::EL_DEFAULT;
}
return stageContext_->GetArea();
@ -151,10 +151,10 @@ int AbilityContextImpl::GetArea()
ErrCode AbilityContextImpl::StartAbility(const AAFwk::Want& want, int requestCode)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbility");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, requestCode);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbility. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
}
return err;
}
@ -162,21 +162,21 @@ ErrCode AbilityContextImpl::StartAbility(const AAFwk::Want& want, int requestCod
ErrCode AbilityContextImpl::StartAbilityAsCaller(const AAFwk::Want &want, int requestCode)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbilityAsCaller");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbilityAsCaller(want, token_, nullptr, requestCode);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityAsCaller. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
}
return err;
}
ErrCode AbilityContextImpl::StartAbilityWithAccount(const AAFwk::Want& want, int accountId, int requestCode)
{
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbilityWithAccount");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
(const_cast<Want &>(want)).SetParam(START_ABILITY_TYPE, true);
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, requestCode, accountId);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityWithAccount. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
}
return err;
}
@ -185,10 +185,10 @@ ErrCode AbilityContextImpl::StartAbility(const AAFwk::Want& want, const AAFwk::S
int requestCode)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbility");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_, requestCode);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbility. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
}
return err;
}
@ -197,11 +197,11 @@ ErrCode AbilityContextImpl::StartAbilityAsCaller(const AAFwk::Want &want, const
int requestCode)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbilityAsCaller");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbilityAsCaller(want,
startOptions, token_, nullptr, requestCode);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityAsCaller. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
}
return err;
}
@ -215,18 +215,18 @@ ErrCode AbilityContextImpl::StartAbilityWithAccount(
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(
want, startOptions, token_, requestCode, accountId);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityWithAccount. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
}
return err;
}
ErrCode AbilityContextImpl::StartAbilityForResult(const AAFwk::Want& want, int requestCode, RuntimeTask&& task)
{
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbilityForResult");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, requestCode, -1);
if (err != ERR_OK && err != AAFwk::START_ABILITY_WAITING) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResult. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
OnAbilityResultInner(requestCode, err, want);
}
return err;
@ -239,7 +239,7 @@ ErrCode AbilityContextImpl::StartAbilityForResultWithAccount(
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, requestCode, accountId);
if (err != ERR_OK && err != AAFwk::START_ABILITY_WAITING) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResultWithAccount. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
OnAbilityResultInner(requestCode, err, want);
}
return err;
@ -248,11 +248,11 @@ ErrCode AbilityContextImpl::StartAbilityForResultWithAccount(
ErrCode AbilityContextImpl::StartAbilityForResult(const AAFwk::Want& want, const AAFwk::StartOptions& startOptions,
int requestCode, RuntimeTask&& task)
{
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbilityForResult");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_, requestCode);
if (err != ERR_OK && err != AAFwk::START_ABILITY_WAITING) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResult. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
OnAbilityResultInner(requestCode, err, want);
}
return err;
@ -262,12 +262,12 @@ ErrCode AbilityContextImpl::StartAbilityForResultWithAccount(
const AAFwk::Want& want, int accountId, const AAFwk::StartOptions& startOptions,
int requestCode, RuntimeTask&& task)
{
TAG_LOGD(AAFwkTag::CONTEXT, "StartAbilityForResultWithAccount");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(
want, startOptions, token_, requestCode, accountId);
if (err != ERR_OK && err != AAFwk::START_ABILITY_WAITING) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResultWithAccount. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "ret=%{public}d", err);
OnAbilityResultInner(requestCode, err, want);
}
return err;
@ -275,43 +275,43 @@ ErrCode AbilityContextImpl::StartAbilityForResultWithAccount(
ErrCode AbilityContextImpl::StartUIServiceExtensionAbility(const AAFwk::Want& want, int32_t accountId)
{
TAG_LOGI(AAFwkTag::CONTEXT, "name:%{public}s %{public}s, accountId=%{public}d",
TAG_LOGD(AAFwkTag::CONTEXT, "name:%{public}s %{public}s, accountId=%{public}d",
want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), accountId);
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartExtensionAbility(
want, token_, accountId, AppExecFwk::ExtensionAbilityType::UI_SERVICE);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartUIServiceExtension is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed, ret: %{public}d", err);
}
return err;
}
ErrCode AbilityContextImpl::StartServiceExtensionAbility(const AAFwk::Want& want, int32_t accountId)
{
TAG_LOGI(AAFwkTag::CONTEXT, "name:%{public}s %{public}s, accountId=%{public}d",
TAG_LOGD(AAFwkTag::CONTEXT, "name:%{public}s %{public}s, accountId=%{public}d",
want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), accountId);
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartExtensionAbility(
want, token_, accountId, AppExecFwk::ExtensionAbilityType::SERVICE);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartServiceExtensionAbility is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed:%{public}d", err);
}
return err;
}
ErrCode AbilityContextImpl::StopServiceExtensionAbility(const AAFwk::Want& want, int32_t accountId)
{
TAG_LOGI(AAFwkTag::CONTEXT, "name:%{public}s %{public}s, accountId=%{public}d",
TAG_LOGD(AAFwkTag::CONTEXT, "name:%{public}s %{public}s, accountId=%{public}d",
want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), accountId);
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StopExtensionAbility(
want, token_, accountId, AppExecFwk::ExtensionAbilityType::SERVICE);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "StopServiceExtensionAbility is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
}
return err;
}
ErrCode AbilityContextImpl::TerminateAbilityWithResult(const AAFwk::Want& want, int resultCode)
{
TAG_LOGI(AAFwkTag::CONTEXT, "TerminateAbilityWithResult");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
isTerminating_.store(true);
#ifdef SUPPORT_SCREEN
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
@ -324,16 +324,16 @@ ErrCode AbilityContextImpl::TerminateAbilityWithResult(const AAFwk::Want& want,
info->resultCode = resultCode;
auto ifaceSessionToken = iface_cast<Rosen::ISession>(sessionToken);
auto err = ifaceSessionToken->TerminateSession(info);
TAG_LOGI(AAFwkTag::CONTEXT, "TerminateAbilityWithResult. ret=%{public}d", err);
TAG_LOGI(AAFwkTag::CONTEXT, "scb, ret=%{public}d", err);
return static_cast<int32_t>(err);
} else {
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(token_, resultCode, &want);
TAG_LOGI(AAFwkTag::CONTEXT, "TerminateAbilityWithResult. ret=%{public}d", err);
TAG_LOGI(AAFwkTag::CONTEXT, "ret=%{public}d", err);
return err;
}
#else
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(token_, resultCode, &want);
TAG_LOGI(AAFwkTag::CONTEXT, "TerminateAbilityWithResult. ret=%{public}d", err);
TAG_LOGI(AAFwkTag::CONTEXT, "ret=%{public}d", err);
return err;
#endif
}
@ -349,20 +349,20 @@ ErrCode AbilityContextImpl::BackToCallerAbilityWithResult(const AAFwk::Want& wan
void AbilityContextImpl::SetWeakSessionToken(const wptr<IRemoteObject>& sessionToken)
{
std::lock_guard lock(sessionTokenMutex_);
TAG_LOGI(AAFwkTag::CONTEXT, "Start calling SetWeakSessionToken.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
sessionToken_ = sessionToken;
}
sptr<IRemoteObject> AbilityContextImpl::GetSessionToken()
{
std::lock_guard lock(sessionTokenMutex_);
TAG_LOGI(AAFwkTag::CONTEXT, "calling");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
return sessionToken_.promote();
}
void AbilityContextImpl::SetAbilityRecordId(int32_t abilityRecordId)
{
TAG_LOGI(AAFwkTag::CONTEXT, "abilityRecordId: %{public}d.", abilityRecordId);
TAG_LOGD(AAFwkTag::CONTEXT, "abilityRecordId: %{public}d", abilityRecordId);
abilityRecordId_ = abilityRecordId;
}
@ -373,7 +373,7 @@ int32_t AbilityContextImpl::GetAbilityRecordId()
void AbilityContextImpl::OnAbilityResult(int requestCode, int resultCode, const AAFwk::Want& resultData)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Start calling OnAbilityResult.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
auto callback = resultCallbacks_.find(requestCode);
if (callback != resultCallbacks_.end()) {
if (callback->second) {
@ -381,12 +381,11 @@ void AbilityContextImpl::OnAbilityResult(int requestCode, int resultCode, const
}
resultCallbacks_.erase(requestCode);
}
TAG_LOGI(AAFwkTag::CONTEXT, "OnAbilityResult");
}
void AbilityContextImpl::OnAbilityResultInner(int requestCode, int resultCode, const AAFwk::Want& resultData)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Start calling OnAbilityResult.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
auto callback = resultCallbacks_.find(requestCode);
if (callback != resultCallbacks_.end()) {
if (callback->second) {
@ -394,17 +393,16 @@ void AbilityContextImpl::OnAbilityResultInner(int requestCode, int resultCode, c
}
resultCallbacks_.erase(requestCode);
}
TAG_LOGI(AAFwkTag::CONTEXT, "OnAbilityResult");
}
ErrCode AbilityContextImpl::ConnectAbility(const AAFwk::Want& want, const sptr<AbilityConnectCallback>& connectCallback)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::CONTEXT,
"ConnectAbility begin, name:%{public}s.", abilityInfo_ == nullptr ? "" : abilityInfo_->name.c_str());
"called, name:%{public}s", abilityInfo_ == nullptr ? "" : abilityInfo_->name.c_str());
ErrCode ret = ConnectionManager::GetInstance().ConnectAbility(token_, want, connectCallback);
if (ret != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "ConnectAbility ret:%{public}d", ret);
TAG_LOGE(AAFwkTag::CONTEXT, "failed, ret:%{public}d", ret);
}
return ret;
}
@ -412,11 +410,11 @@ ErrCode AbilityContextImpl::ConnectAbility(const AAFwk::Want& want, const sptr<A
ErrCode AbilityContextImpl::ConnectAbilityWithAccount(const AAFwk::Want& want, int accountId,
const sptr<AbilityConnectCallback>& connectCallback)
{
TAG_LOGD(AAFwkTag::CONTEXT, "ConnectAbilityWithAccount");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
ErrCode ret =
ConnectionManager::GetInstance().ConnectAbilityWithAccount(token_, want, accountId, connectCallback);
if (ret != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "ConnectAbilityWithAccount ret:%{public}d", ret);
TAG_LOGE(AAFwkTag::CONTEXT, "failed, ret:%{public}d", ret);
}
return ret;
}
@ -425,7 +423,7 @@ void AbilityContextImpl::DisconnectAbility(const AAFwk::Want& want,
const sptr<AbilityConnectCallback>& connectCallback, int32_t accountId)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::CONTEXT, "DisconnectAbility begin, caller:%{public}s.",
TAG_LOGD(AAFwkTag::CONTEXT, "called, caller:%{public}s",
abilityInfo_ == nullptr ? "" : abilityInfo_->name.c_str());
ErrCode ret =
ConnectionManager::GetInstance().DisconnectAbility(token_, want, connectCallback, accountId);
@ -515,10 +513,10 @@ std::shared_ptr<AppExecFwk::Configuration> AbilityContextImpl::GetConfiguration(
void AbilityContextImpl::MinimizeAbility(bool fromUser)
{
TAG_LOGD(AAFwkTag::CONTEXT, "call");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->MinimizeAbility(token_, fromUser);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "MinimizeAbility is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
}
}
@ -527,7 +525,7 @@ ErrCode AbilityContextImpl::OnBackPressedCallBack(bool &needMoveToBackground)
TAG_LOGD(AAFwkTag::CONTEXT, "call");
auto abilityCallback = abilityCallback_.lock();
if (abilityCallback == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "abilityCallback is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null abilityCallback");
return ERR_INVALID_VALUE;
}
#ifdef SUPPORT_SCREEN
@ -538,10 +536,10 @@ ErrCode AbilityContextImpl::OnBackPressedCallBack(bool &needMoveToBackground)
ErrCode AbilityContextImpl::MoveAbilityToBackground()
{
TAG_LOGD(AAFwkTag::CONTEXT, "call");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->MoveAbilityToBackground(token_);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "MoveAbilityToBackground failed: %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed: %{public}d", err);
}
return err;
}
@ -551,22 +549,22 @@ ErrCode AbilityContextImpl::MoveUIAbilityToBackground()
TAG_LOGD(AAFwkTag::CONTEXT, "call");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->MoveUIAbilityToBackground(token_);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "MoveAbilityToBackground failed: %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed: %{public}d", err);
}
return err;
}
ErrCode AbilityContextImpl::TerminateSelf()
{
TAG_LOGI(AAFwkTag::CONTEXT, "TerminateSelf");
TAG_LOGI(AAFwkTag::CONTEXT, "called");
isTerminating_.store(true);
auto sessionToken = GetSessionToken();
if (sessionToken == nullptr) {
TAG_LOGW(AAFwkTag::CONTEXT, "sessionToken is null");
TAG_LOGW(AAFwkTag::CONTEXT, "null sessionToken");
}
#ifdef SUPPORT_SCREEN
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled() && sessionToken) {
TAG_LOGI(AAFwkTag::CONTEXT, "TerminateSelf. SCB");
TAG_LOGI(AAFwkTag::CONTEXT, "terminateSelf SCB");
AAFwk::Want resultWant;
sptr<AAFwk::SessionInfo> info = new AAFwk::SessionInfo();
info->want = resultWant;
@ -578,7 +576,7 @@ ErrCode AbilityContextImpl::TerminateSelf()
AAFwk::Want resultWant;
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(token_, -1, &resultWant);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "AbilityContextImpl::TerminateSelf is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "terminateSelf failed %{public}d", err);
}
return err;
}
@ -586,7 +584,7 @@ ErrCode AbilityContextImpl::TerminateSelf()
AAFwk::Want resultWant;
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(token_, -1, &resultWant);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "AbilityContextImpl::TerminateSelf is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
}
return err;
#endif
@ -595,12 +593,12 @@ ErrCode AbilityContextImpl::TerminateSelf()
ErrCode AbilityContextImpl::CloseAbility()
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::CONTEXT, "CloseAbility");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
isTerminating_.store(true);
AAFwk::Want resultWant;
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->CloseAbility(token_, -1, &resultWant);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "CloseAbility failed: %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed: %{public}d", err);
}
return err;
}
@ -612,7 +610,7 @@ sptr<IRemoteObject> AbilityContextImpl::GetToken()
ErrCode AbilityContextImpl::RestoreWindowStage(napi_env env, napi_value contentStorage)
{
TAG_LOGI(AAFwkTag::CONTEXT, "call");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
napi_ref value = nullptr;
napi_create_reference(env, contentStorage, 1, &value);
contentStorage_ = std::unique_ptr<NativeReference>(reinterpret_cast<NativeReference*>(value));
@ -625,7 +623,7 @@ ErrCode AbilityContextImpl::StartAbilityByCall(
if (localCallContainer_ == nullptr) {
localCallContainer_ = std::make_shared<LocalCallContainer>();
if (localCallContainer_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "localCallContainer_ is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null localCallContainer_");
return ERR_INVALID_VALUE;
}
}
@ -634,29 +632,27 @@ ErrCode AbilityContextImpl::StartAbilityByCall(
ErrCode AbilityContextImpl::ReleaseCall(const std::shared_ptr<CallerCallBack>& callback)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Release begin.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (localCallContainer_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "localCallContainer_ is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null localCallContainer_");
return ERR_INVALID_VALUE;
}
TAG_LOGD(AAFwkTag::CONTEXT, "Release end.");
return localCallContainer_->ReleaseCall(callback);
}
void AbilityContextImpl::ClearFailedCallConnection(const std::shared_ptr<CallerCallBack>& callback)
{
TAG_LOGD(AAFwkTag::CONTEXT, "Clear begin.");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (localCallContainer_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "localCallContainer_ is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null localCallContainer_");
return;
}
localCallContainer_->ClearFailedCallConnection(callback);
TAG_LOGD(AAFwkTag::CONTEXT, "Clear end.");
}
void AbilityContextImpl::RegisterAbilityCallback(std::weak_ptr<AppExecFwk::IAbilityCallback> abilityCallback)
{
TAG_LOGD(AAFwkTag::CONTEXT, "call");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
abilityCallback_ = abilityCallback;
}
@ -684,7 +680,7 @@ ErrCode AbilityContextImpl::RequestDialogService(napi_env env, AAFwk::Want &want
uv_loop_s* loop = nullptr;
napi_get_uv_event_loop(env, &loop);
if (loop == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestDialogService, fail to get uv loop.");
TAG_LOGE(AAFwkTag::CONTEXT, "null uv loop");
return;
}
auto work = new uv_work_t;
@ -709,7 +705,7 @@ ErrCode AbilityContextImpl::RequestDialogService(napi_env env, AAFwk::Want &want
want.SetParam(RequestConstants::REQUEST_CALLBACK_KEY, remoteObject);
auto err = AAFwk::AbilityManagerClient::GetInstance()->RequestDialogService(want, token_);
TAG_LOGD(AAFwkTag::CONTEXT, "RequestDialogService ret=%{public}d", static_cast<int32_t>(err));
TAG_LOGD(AAFwkTag::CONTEXT, "ret=%{public}d", static_cast<int32_t>(err));
return err;
}
@ -730,7 +726,7 @@ ErrCode AbilityContextImpl::RequestDialogService(AAFwk::Want &want, RequestDialo
want.SetParam(RequestConstants::REQUEST_CALLBACK_KEY, remoteObject);
auto err = AAFwk::AbilityManagerClient::GetInstance()->RequestDialogService(want, token_);
TAG_LOGD(AAFwkTag::CONTEXT, "RequestDialogService ret=%{public}d", static_cast<int32_t>(err));
TAG_LOGD(AAFwkTag::CONTEXT, "ret=%{public}d", static_cast<int32_t>(err));
return err;
}
@ -742,14 +738,14 @@ ErrCode AbilityContextImpl::ReportDrawnCompleted()
void AbilityContextImpl::RequestDialogResultJSThreadWorker(uv_work_t* work, int status)
{
TAG_LOGD(AAFwkTag::CONTEXT, "RequestDialogResultJSThreadWorker");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (work == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestDialogResultJSThreadWorker, uv_queue_work input work is nullptr");
TAG_LOGE(AAFwkTag::CONTEXT, "null work");
return;
}
RequestResult* retCB = static_cast<RequestResult*>(work->data);
if (retCB == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestDialogResultJSThreadWorker, retCB is nullptr");
TAG_LOGE(AAFwkTag::CONTEXT, "null retCB");
delete work;
work = nullptr;
return;
@ -767,7 +763,7 @@ void AbilityContextImpl::RequestDialogResultJSThreadWorker(uv_work_t* work, int
ErrCode AbilityContextImpl::GetMissionId(int32_t &missionId)
{
TAG_LOGD(AAFwkTag::CONTEXT, "GetMissionId");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
if (missionId_ != -1) {
missionId = missionId_;
return ERR_OK;
@ -775,38 +771,38 @@ ErrCode AbilityContextImpl::GetMissionId(int32_t &missionId)
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->GetMissionIdByToken(token_, missionId);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "GetMissionId is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
} else {
missionId_ = missionId;
TAG_LOGD(AAFwkTag::CONTEXT, "missionId is %{public}d.", missionId_);
TAG_LOGD(AAFwkTag::CONTEXT, "missionId: %{public}d", missionId_);
}
return err;
}
ErrCode AbilityContextImpl::SetMissionContinueState(const AAFwk::ContinueState &state)
{
TAG_LOGI(AAFwkTag::CONTEXT, "SetMissionContinueState: %{public}d", state);
TAG_LOGI(AAFwkTag::CONTEXT, "called, stage: %{public}d", state);
auto sessionToken = GetSessionToken();
if (sessionToken == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "sessionToken is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null sessionToken");
return ERR_INVALID_VALUE;
}
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->SetMissionContinueState(token_, state, sessionToken);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "SetMissionContinueState failed: %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed: %{public}d", err);
}
return err;
}
void AbilityContextImpl::InsertResultCallbackTask(int requestCode, RuntimeTask &&task)
{
TAG_LOGD(AAFwkTag::CONTEXT, "InsertResultCallbackTask");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
}
void AbilityContextImpl::RemoveResultCallbackTask(int requestCode)
{
TAG_LOGD(AAFwkTag::CONTEXT, "called");
TAG_LOGD(AAFwkTag::CONTEXT, "call");
resultCallbacks_.erase(requestCode);
}
@ -823,10 +819,10 @@ void AbilityContextImpl::GetWindowRect(int32_t &left, int32_t &top, int32_t &wid
void AbilityContextImpl::RegisterAbilityLifecycleObserver(
const std::shared_ptr<AppExecFwk::ILifecycleObserver> &observer)
{
TAG_LOGD(AAFwkTag::CONTEXT, "call");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
auto abilityCallback = abilityCallback_.lock();
if (abilityCallback == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "register ability lifecycle observer failed, abilityCallback is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null abilityCallback, register failed");
return;
}
abilityCallback->RegisterAbilityLifecycleObserver(observer);
@ -838,7 +834,7 @@ void AbilityContextImpl::UnregisterAbilityLifecycleObserver(
TAG_LOGD(AAFwkTag::CONTEXT, "call");
auto abilityCallback = abilityCallback_.lock();
if (abilityCallback == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "unregister ability lifecycle observer failed, abilityCallback is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null abilityCallback, unregister failed");
return;
}
abilityCallback->UnregisterAbilityLifecycleObserver(observer);
@ -847,10 +843,10 @@ void AbilityContextImpl::UnregisterAbilityLifecycleObserver(
#ifdef SUPPORT_SCREEN
ErrCode AbilityContextImpl::SetMissionLabel(const std::string& label)
{
TAG_LOGD(AAFwkTag::CONTEXT, "call label:%{public}s", label.c_str());
TAG_LOGD(AAFwkTag::CONTEXT, "label:%{public}s", label.c_str());
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->SetMissionLabel(token_, label);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "SetMissionLabel is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
} else {
auto abilityCallback = abilityCallback_.lock();
if (abilityCallback) {
@ -865,7 +861,7 @@ ErrCode AbilityContextImpl::SetMissionIcon(const std::shared_ptr<OHOS::Media::Pi
TAG_LOGD(AAFwkTag::CONTEXT, "call");
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->SetMissionIcon(token_, icon);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "SetMissionIcon is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
} else {
auto abilityCallback = abilityCallback_.lock();
if (abilityCallback) {
@ -901,7 +897,7 @@ ErrCode AbilityContextImpl::StartAbilityByType(const std::string &type,
TAG_LOGD(AAFwkTag::CONTEXT, "call");
auto uiContent = GetUIContent();
if (uiContent == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "uiContent is nullptr");
TAG_LOGE(AAFwkTag::CONTEXT, "null uiContent");
return ERR_INVALID_VALUE;
}
wantParams.SetParam(UIEXTENSION_TARGET_TYPE_KEY, AAFwk::String::Box(type));
@ -926,7 +922,7 @@ ErrCode AbilityContextImpl::StartAbilityByType(const std::string &type,
Ace::ModalUIExtensionConfig config;
int32_t sessionId = uiContent->CreateModalUIExtension(want, callback, config);
if (sessionId == 0) {
TAG_LOGE(AAFwkTag::CONTEXT, "CreateModalUIExtension is failed");
TAG_LOGE(AAFwkTag::CONTEXT, "createModalUIExtension failed");
return ERR_INVALID_VALUE;
}
uiExtensionCallbacks->SetUIContent(uiContent);
@ -963,16 +959,16 @@ ErrCode AbilityContextImpl::CreateModalUIExtensionWithApp(const AAFwk::Want &wan
TAG_LOGD(AAFwkTag::CONTEXT, "call");
auto uiContent = GetUIContent();
if (uiContent == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "uiContent is nullptr");
TAG_LOGE(AAFwkTag::CONTEXT, "null uiContent");
return ERR_INVALID_VALUE;
}
if (IsUIExtensionExist(want)) {
TAG_LOGD(AAFwkTag::CONTEXT, "UIExtension is exist, not create again");
TAG_LOGD(AAFwkTag::CONTEXT, "exist uIExtension");
return ERR_OK;
}
auto abilityCallback = abilityCallback_.lock();
if (abilityCallback == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "abilityCallback is nullptr");
TAG_LOGE(AAFwkTag::CONTEXT, "null abilityCallback");
return ERR_INVALID_VALUE;
}
auto disposedCallback = std::make_shared<DialogUIExtensionCallback>(abilityCallback);
@ -990,7 +986,7 @@ ErrCode AbilityContextImpl::CreateModalUIExtensionWithApp(const AAFwk::Want &wan
config.prohibitedRemoveByRouter = true;
int32_t sessionId = uiContent->CreateModalUIExtension(want, callback, config);
if (sessionId == 0) {
TAG_LOGE(AAFwkTag::CONTEXT, "CreateModalUIExtension is failed");
TAG_LOGE(AAFwkTag::CONTEXT, "failed");
return ERR_INVALID_VALUE;
}
disposedCallback->SetUIContent(uiContent);
@ -1007,7 +1003,7 @@ ErrCode AbilityContextImpl::RequestModalUIExtension(const AAFwk::Want& want)
{
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->RequestModalUIExtension(want);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestModalUIExtension is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
}
return err;
}
@ -1016,7 +1012,7 @@ ErrCode AbilityContextImpl::ChangeAbilityVisibility(bool isShow)
{
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->ChangeAbilityVisibility(token_, isShow);
if (err != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "ChangeAbilityVisibility is failed %{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed %{public}d", err);
}
return err;
}
@ -1025,7 +1021,7 @@ ErrCode AbilityContextImpl::AddFreeInstallObserver(const sptr<IFreeInstallObserv
{
ErrCode ret = AAFwk::AbilityManagerClient::GetInstance()->AddFreeInstallObserver(token_, observer);
if (ret != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "AddFreeInstallObserver error, ret: %{public}d", ret);
TAG_LOGE(AAFwkTag::CONTEXT, "failed, ret: %{public}d", ret);
}
return ret;
}
@ -1033,11 +1029,11 @@ ErrCode AbilityContextImpl::AddFreeInstallObserver(const sptr<IFreeInstallObserv
ErrCode AbilityContextImpl::OpenAtomicService(AAFwk::Want& want, const AAFwk::StartOptions &options, int requestCode,
RuntimeTask &&task)
{
TAG_LOGD(AAFwkTag::CONTEXT, "OpenAtomicService");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
resultCallbacks_.insert(make_pair(requestCode, std::move(task)));
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->OpenAtomicService(want, options, token_, requestCode, -1);
if (err != ERR_OK && err != AAFwk::START_ABILITY_WAITING) {
TAG_LOGE(AAFwkTag::CONTEXT, "OpenAtomicService. ret=%{public}d", err);
TAG_LOGE(AAFwkTag::CONTEXT, "failed, ret=%{public}d", err);
OnAbilityResultInner(requestCode, err, want);
}
return err;

View File

@ -27,24 +27,24 @@ void JsExtensionContext::ConfigurationUpdated(napi_env env, const std::shared_pt
const std::shared_ptr<AppExecFwk::Configuration> &config)
{
if (env == nullptr || jsContext == nullptr || config == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "engine or jsContext or config is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null engine or jsContext or config");
return;
}
napi_value object = jsContext->GetNapiValue();
if (!CheckTypeForNapiValue(env, object, napi_object)) {
TAG_LOGE(AAFwkTag::CONTEXT, "object is not object.");
TAG_LOGE(AAFwkTag::CONTEXT, "object is not object");
return;
}
napi_value method = nullptr;
napi_get_named_property(env, object, "onUpdateConfiguration", &method);
if (method == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Failed to get onUpdateConfiguration from object");
TAG_LOGE(AAFwkTag::CONTEXT, "failed to get onUpdateConfiguration from object");
return;
}
TAG_LOGD(AAFwkTag::CONTEXT, "call onUpdateConfiguration.");
TAG_LOGD(AAFwkTag::CONTEXT, "call onUpdateConfiguration");
napi_value argv[] = { CreateJsConfiguration(env, *config) };
napi_call_function(env, object, method, 1, argv, nullptr);
}
@ -53,12 +53,12 @@ napi_value CreateJsExtensionContext(napi_env env, const std::shared_ptr<Extensio
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo)
{
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Failed to CreateJsExtensionContext, context is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
napi_value object = CreateJsBaseContext(env, context);
if (object == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Failed to CreateJsExtensionContext, object is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null object");
return nullptr;
}
auto configuration = context->GetConfiguration();
@ -75,7 +75,7 @@ napi_value CreateJsExtensionContext(napi_env env, const std::shared_ptr<Extensio
auto infoIter = std::find_if(
hapModuleInfo->extensionInfos.begin(), hapModuleInfo->extensionInfos.end(), isExist);
if (infoIter == hapModuleInfo->extensionInfos.end()) {
TAG_LOGE(AAFwkTag::CONTEXT, "Set extensionAbilityInfo fail.");
TAG_LOGE(AAFwkTag::CONTEXT, "set extensionAbilityInfo fail");
} else {
napi_set_named_property(env, object, "extensionAbilityInfo", CreateJsExtensionAbilityInfo(env, *infoIter));
}

View File

@ -50,7 +50,7 @@ const std::string CALLBACK_KEY = "ohos.ability.params.callback";
ErrCode AbilityContext::StartAbility(const AAFwk::Want &want, int requestCode)
{
TAG_LOGD(AAFwkTag::CONTEXT, "requestCode: %{public}d", requestCode);
TAG_LOGD(AAFwkTag::CONTEXT, "requestCode = %{public}d", requestCode);
AppExecFwk::AbilityType type = GetAbilityInfoType();
if (type != AppExecFwk::AbilityType::PAGE && type != AppExecFwk::AbilityType::SERVICE) {
TAG_LOGE(AAFwkTag::CONTEXT, "abilityType: %{public}d", type);
@ -63,7 +63,8 @@ ErrCode AbilityContext::StartAbility(const AAFwk::Want &want, int requestCode)
ErrCode AbilityContext::StartAbility(const Want &want, int requestCode, const AbilityStartSetting &abilityStartSetting)
{
TAG_LOGD(AAFwkTag::CONTEXT, "requestCode: %{public}d", requestCode);
TAG_LOGD(AAFwkTag::CONTEXT, "requestCode: %{public}d",
requestCode);
AppExecFwk::AbilityType type = GetAbilityInfoType();
if (type != AppExecFwk::AbilityType::PAGE && type != AppExecFwk::AbilityType::SERVICE) {
TAG_LOGE(AAFwkTag::CONTEXT, "abilityType: %{public}d", type);
@ -168,7 +169,7 @@ bool AbilityContext::ConnectAbility(const Want &want, const sptr<AAFwk::IAbility
return false;
}
TAG_LOGI(AAFwkTag::CONTEXT, "called, ability:%{public}s.", abilityInfo->name.c_str());
TAG_LOGD(AAFwkTag::CONTEXT, "ability:%{public}s", abilityInfo->name.c_str());
if (type != AppExecFwk::AbilityType::PAGE && type != AppExecFwk::AbilityType::SERVICE) {
TAG_LOGE(AAFwkTag::CONTEXT, "abilityType: %{public}d", type);
@ -179,7 +180,7 @@ bool AbilityContext::ConnectAbility(const Want &want, const sptr<AAFwk::IAbility
TAG_LOGD(AAFwkTag::CONTEXT, "ret=%{public}d", ret);
bool value = ((ret == ERR_OK) ? true : false);
if (!value) {
TAG_LOGE(AAFwkTag::CONTEXT, "errorCode = %{public}d", ret);
TAG_LOGE(AAFwkTag::CONTEXT, "errorCode: %{public}d", ret);
}
TAG_LOGD(AAFwkTag::CONTEXT, "end");
return value;
@ -189,18 +190,18 @@ ErrCode AbilityContext::DisconnectAbility(const sptr<AAFwk::IAbilityConnection>
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
std::shared_ptr<AbilityInfo> info = GetAbilityInfo();
TAG_LOGI(AAFwkTag::CONTEXT, "called, caller:%{public}s",
TAG_LOGI(AAFwkTag::CONTEXT, "caller:%{public}s",
info == nullptr ? "" : info->name.c_str());
AppExecFwk::AbilityType type = GetAbilityInfoType();
if (type != AppExecFwk::AbilityType::PAGE && type != AppExecFwk::AbilityType::SERVICE) {
TAG_LOGE(AAFwkTag::CONTEXT, "AbilityType = %{public}d", type);
TAG_LOGE(AAFwkTag::CONTEXT, "abilityType:%{public}d", type);
return ERR_INVALID_VALUE;
}
ErrCode ret = AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(conn);
if (ret != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "error, ret=%{public}d", ret);
TAG_LOGE(AAFwkTag::CONTEXT, "error, ret:%{public}d", ret);
}
return ret;
}

View File

@ -26,9 +26,9 @@ CJAbilityConnectCallbackFuncs* g_cjAbilityConnectCallbackFuncs = nullptr;
void RegisterCJAbilityConnectCallbackFuncs(void (*registerFunc)(CJAbilityConnectCallbackFuncs* result))
{
TAG_LOGD(AAFwkTag::CONTEXT, "RegisterCJAbilityConnectCallbackFuncs start.");
TAG_LOGD(AAFwkTag::CONTEXT, "start");
if (g_cjAbilityConnectCallbackFuncs != nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Repeated registration for cangjie functions of CJAbilityConnectCallback.");
TAG_LOGE(AAFwkTag::CONTEXT, "not null cangjie callback");
return;
}
@ -39,7 +39,7 @@ void RegisterCJAbilityConnectCallbackFuncs(void (*registerFunc)(CJAbilityConnect
CJAbilityConnectCallback::~CJAbilityConnectCallback()
{
if (g_cjAbilityConnectCallbackFuncs == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Cangjie functions for CJAbilityConnectCallbacks are not registered");
TAG_LOGE(AAFwkTag::CONTEXT, "null cangjie callback");
return;
}
g_cjAbilityConnectCallbackFuncs->release(callbackId_);
@ -48,9 +48,9 @@ CJAbilityConnectCallback::~CJAbilityConnectCallback()
void CJAbilityConnectCallback::OnAbilityConnectDone(
const AppExecFwk::ElementName& element, const sptr<IRemoteObject>& remoteObject, int resultCode)
{
TAG_LOGD(AAFwkTag::CONTEXT, "OnAbilityConnectDone begin, resultCode:%{public}d", resultCode);
TAG_LOGD(AAFwkTag::CONTEXT, "called, resultCode:%{public}d", resultCode);
if (g_cjAbilityConnectCallbackFuncs == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Cangjie functions for CJAbilityConnectCallbacks are not registered");
TAG_LOGE(AAFwkTag::CONTEXT, "cangjie functions for CJAbilityConnectCallbacks are not registered");
return;
}
@ -66,9 +66,9 @@ void CJAbilityConnectCallback::OnAbilityConnectDone(
void CJAbilityConnectCallback::OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int resultCode)
{
TAG_LOGD(AAFwkTag::CONTEXT, "OnAbilityDisconnectDone begin, resultCode:%{public}d", resultCode);
TAG_LOGD(AAFwkTag::CONTEXT, "called, resultCode:%{public}d", resultCode);
if (g_cjAbilityConnectCallbackFuncs == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Cangjie functions for CJAbilityConnectCallbacks are not registered");
TAG_LOGE(AAFwkTag::CONTEXT, "null cangjie callback");
return;
}

View File

@ -30,7 +30,7 @@ std::shared_ptr<AbilityRuntime::AbilityContext> CJAbilityContext::GetAbilityCont
sptr<IRemoteObject> CJAbilityContext::GetToken()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
return context_->GetToken();
@ -39,7 +39,7 @@ sptr<IRemoteObject> CJAbilityContext::GetToken()
std::string CJAbilityContext::GetPreferencesDir()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return "";
}
return context_->GetPreferencesDir();
@ -48,7 +48,7 @@ std::string CJAbilityContext::GetPreferencesDir()
std::string CJAbilityContext::GetDatabaseDir()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return "";
}
return context_->GetDatabaseDir();
@ -57,7 +57,7 @@ std::string CJAbilityContext::GetDatabaseDir()
std::string CJAbilityContext::GetBundleName()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return "";
}
return context_->GetBundleName();
@ -66,7 +66,7 @@ std::string CJAbilityContext::GetBundleName()
int32_t CJAbilityContext::GetArea()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->GetArea();
@ -75,7 +75,7 @@ int32_t CJAbilityContext::GetArea()
std::shared_ptr<AppExecFwk::AbilityInfo> CJAbilityContext::GetAbilityInfo()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
return context_->GetAbilityInfo();
@ -84,7 +84,7 @@ std::shared_ptr<AppExecFwk::AbilityInfo> CJAbilityContext::GetAbilityInfo()
std::shared_ptr<AppExecFwk::HapModuleInfo> CJAbilityContext::GetHapModuleInfo()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
return context_->GetHapModuleInfo();
@ -93,7 +93,7 @@ std::shared_ptr<AppExecFwk::HapModuleInfo> CJAbilityContext::GetHapModuleInfo()
std::shared_ptr<AppExecFwk::Configuration> CJAbilityContext::GetConfiguration()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return nullptr;
}
return context_->GetConfiguration();
@ -102,7 +102,7 @@ std::shared_ptr<AppExecFwk::Configuration> CJAbilityContext::GetConfiguration()
int32_t CJAbilityContext::StartAbility(const AAFwk::Want& want)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
// -1 is default accountId which is the same as js.
@ -112,7 +112,7 @@ int32_t CJAbilityContext::StartAbility(const AAFwk::Want& want)
int32_t CJAbilityContext::StartAbility(const AAFwk::Want& want, const AAFwk::StartOptions& startOptions)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartAbility(want, startOptions, -1);
@ -121,7 +121,7 @@ int32_t CJAbilityContext::StartAbility(const AAFwk::Want& want, const AAFwk::Sta
int32_t CJAbilityContext::StartAbilityWithAccount(const AAFwk::Want& want, int32_t accountId)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartAbilityWithAccount(want, accountId, -1);
@ -131,7 +131,7 @@ int32_t CJAbilityContext::StartAbilityWithAccount(
const AAFwk::Want& want, int32_t accountId, const AAFwk::StartOptions& startOptions)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartAbilityWithAccount(want, accountId, startOptions, -1);
@ -140,7 +140,7 @@ int32_t CJAbilityContext::StartAbilityWithAccount(
int32_t CJAbilityContext::StartServiceExtensionAbility(const Want& want)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartServiceExtensionAbility(want);
@ -149,7 +149,7 @@ int32_t CJAbilityContext::StartServiceExtensionAbility(const Want& want)
int32_t CJAbilityContext::StartServiceExtensionAbilityWithAccount(const Want& want, int32_t accountId)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartServiceExtensionAbility(want, accountId);
@ -158,7 +158,7 @@ int32_t CJAbilityContext::StartServiceExtensionAbilityWithAccount(const Want& wa
int32_t CJAbilityContext::StopServiceExtensionAbility(const Want& want)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StopServiceExtensionAbility(want);
@ -167,7 +167,7 @@ int32_t CJAbilityContext::StopServiceExtensionAbility(const Want& want)
int32_t CJAbilityContext::StopServiceExtensionAbilityWithAccount(const Want& want, int32_t accountId)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StopServiceExtensionAbility(want, accountId);
@ -176,7 +176,7 @@ int32_t CJAbilityContext::StopServiceExtensionAbilityWithAccount(const Want& wan
int32_t CJAbilityContext::TerminateSelf()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->TerminateSelf();
@ -185,7 +185,7 @@ int32_t CJAbilityContext::TerminateSelf()
int32_t CJAbilityContext::TerminateSelfWithResult(const AAFwk::Want& want, int32_t resultCode)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->TerminateAbilityWithResult(want, resultCode);
@ -194,7 +194,7 @@ int32_t CJAbilityContext::TerminateSelfWithResult(const AAFwk::Want& want, int32
std::tuple<int32_t, bool> CJAbilityContext::IsTerminating()
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return std::make_tuple(ERR_INVALID_INSTANCE_CODE, false);
}
return std::make_tuple(SUCCESS_CODE, context_->IsTerminating());
@ -203,7 +203,7 @@ std::tuple<int32_t, bool> CJAbilityContext::IsTerminating()
bool CJAbilityContext::ConnectAbility(const AAFwk::Want& want, int64_t connectionId)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
auto connection = new CJAbilityConnectCallback(connectionId);
@ -214,7 +214,7 @@ int32_t CJAbilityContext::ConnectAbilityWithAccount(
const AAFwk::Want& want, int32_t accountId, int64_t connectionId)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
auto connection = new CJAbilityConnectCallback(connectionId);
@ -224,7 +224,7 @@ int32_t CJAbilityContext::ConnectAbilityWithAccount(
void CJAbilityContext::DisconnectAbility(const AAFwk::Want& want, int64_t connectionId)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return;
}
auto connection = new CJAbilityConnectCallback(connectionId);
@ -234,7 +234,7 @@ void CJAbilityContext::DisconnectAbility(const AAFwk::Want& want, int64_t connec
int32_t CJAbilityContext::StartAbilityForResult(const AAFwk::Want& want, int32_t requestCode, RuntimeTask&& task)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartAbilityForResult(want, requestCode, std::move(task));
@ -244,7 +244,7 @@ int32_t CJAbilityContext::StartAbilityForResult(
const AAFwk::Want& want, const AAFwk::StartOptions& startOptions, int32_t requestCode, RuntimeTask&& task)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartAbilityForResult(want, startOptions, requestCode, std::move(task));
@ -254,7 +254,7 @@ int32_t CJAbilityContext::StartAbilityForResultWithAccount(
const AAFwk::Want& want, int32_t accountId, int32_t requestCode, RuntimeTask&& task)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartAbilityForResultWithAccount(want, accountId, requestCode, std::move(task));
@ -264,7 +264,7 @@ int32_t CJAbilityContext::StartAbilityForResultWithAccount(const AAFwk::Want& wa
const AAFwk::StartOptions& startOptions, int32_t requestCode, RuntimeTask&& task)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->StartAbilityForResultWithAccount(want, accountId, startOptions, requestCode, std::move(task));
@ -274,7 +274,7 @@ int32_t CJAbilityContext::RequestPermissionsFromUser(
AppExecFwk::Ability* ability, std::vector<std::string>& permissions, PermissionRequestTask&& task)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return SUCCESS_CODE;
@ -284,7 +284,7 @@ int32_t CJAbilityContext::RequestPermissionsFromUser(
int32_t CJAbilityContext::SetMissionLabel(const std::string& label)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->SetMissionLabel(label);
@ -293,7 +293,7 @@ int32_t CJAbilityContext::SetMissionLabel(const std::string& label)
int32_t CJAbilityContext::SetMissionIcon(const std::shared_ptr<OHOS::Media::PixelMap>& icon)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->SetMissionIcon(icon);
@ -302,7 +302,7 @@ int32_t CJAbilityContext::SetMissionIcon(const std::shared_ptr<OHOS::Media::Pixe
void CJAbilityContext::InheritWindowMode(AAFwk::Want& want)
{
TAG_LOGD(AAFwkTag::CONTEXT, "CJAbilityContext::InheritWindowMode called");
TAG_LOGD(AAFwkTag::CONTEXT, "called");
#ifdef SUPPORT_GRAPHICS
// Only split mode need inherit.
auto windowMode = context_->GetCurrentWindowMode();
@ -310,15 +310,14 @@ void CJAbilityContext::InheritWindowMode(AAFwk::Want& want)
windowMode == AAFwk::AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_SECONDARY) {
want.SetParam(Want::PARAM_RESV_WINDOW_MODE, windowMode);
}
TAG_LOGD(AAFwkTag::CONTEXT,
"CJAbilityContext::InheritWindowMode called end. window mode is %{public}d", windowMode);
TAG_LOGD(AAFwkTag::CONTEXT, "end, window mode is %{public}d", windowMode);
#endif
}
int32_t CJAbilityContext::RequestDialogService(AAFwk::Want& want, RequestDialogResultTask&& task)
{
if (context_ == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null.");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return context_->RequestDialogService(want, std::move(task));

View File

@ -40,7 +40,7 @@ CJAbilityCallbacks* g_cjAbilityCallbacks = nullptr;
void UnWrapStartOption(CJStartOptions* source, AAFwk::StartOptions& target)
{
if (source == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "UnWrapStartOption failed, source is nullptr");
TAG_LOGE(AAFwkTag::CONTEXT, "null source");
return;
}
target.SetWindowMode(source->windowMode);
@ -51,11 +51,11 @@ std::function<void(int32_t, CJAbilityResult*)> WrapCJAbilityResultTask(int64_t l
{
auto cjTask = [lambdaId](int32_t error, CJAbilityResult* abilityResult) {
if (g_cjAbilityCallbacks == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResult failed, cangjie callbacks are not registered");
TAG_LOGE(AAFwkTag::CONTEXT, "failed, cangjie callbacks are not registered");
return;
}
g_cjAbilityCallbacks->invokeAbilityResultCallback(lambdaId, error, abilityResult);
TAG_LOGD(AAFwkTag::CONTEXT, "WrapCJAbilityResultTask: error is %{public}d", error);
TAG_LOGD(AAFwkTag::CONTEXT, "error: %{public}d", error);
};
return cjTask;
}
@ -66,7 +66,7 @@ RuntimeTask WrapRuntimeTask(std::function<void(int32_t, CJAbilityResult*)> cjTas
WantHandle wantHandle = const_cast<AAFwk::Want*>(&want);
CJAbilityResult abilityResult = { resultCode, wantHandle };
cjTask(error, &abilityResult);
TAG_LOGD(AAFwkTag::CONTEXT, "WrapRuntimeTask: error is %{public}d", error);
TAG_LOGD(AAFwkTag::CONTEXT, "error: %{public}d", error);
};
return task;
}
@ -75,12 +75,12 @@ extern "C" {
void RegisterCJAbilityCallbacks(void (*registerFunc)(CJAbilityCallbacks*))
{
if (g_cjAbilityCallbacks != nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "Repeated registration for cj functions of CJAbility.");
TAG_LOGE(AAFwkTag::CONTEXT, "repeated registration for cj functions of CJAbility");
return;
}
if (registerFunc == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RegisterCJAbilityCallbacks failed, registerFunc is nullptr.");
TAG_LOGE(AAFwkTag::CONTEXT, "null registerFunc");
return;
}
@ -102,7 +102,7 @@ int64_t FFIAbilityContextGetAbilityInfo(int64_t id)
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "GetAbilityInfo failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return INVALID_DATA_ID;
}
return NOT_SUPPORT;
@ -112,7 +112,7 @@ int64_t FFIAbilityContextGetHapModuleInfo(int64_t id)
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "GetHapModuleInfo failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return INVALID_DATA_ID;
}
auto hapModuleInfo = context->GetHapModuleInfo();
@ -123,7 +123,7 @@ int64_t FFIAbilityContextGetConfiguration(int64_t id)
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "GetConfiguration failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return INVALID_DATA_ID;
}
auto configuration = context->GetConfiguration();
@ -134,7 +134,7 @@ int32_t FFIAbilityContextStartAbility(int64_t id, WantHandle want)
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbility failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
@ -147,7 +147,7 @@ int32_t FFIAbilityContextStartAbilityWithOption(int64_t id, WantHandle want, CJS
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbility failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -161,7 +161,7 @@ int32_t FFIAbilityContextStartAbilityWithAccount(int64_t id, WantHandle want, in
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityWithAccount failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -174,7 +174,7 @@ int32_t FFIAbilityContextStartAbilityWithAccountAndOption(
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityWithAccount failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -188,7 +188,7 @@ int32_t FFIAbilityContextStartServiceExtensionAbility(int64_t id, WantHandle wan
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartServiceExtensionAbility failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -199,7 +199,7 @@ int32_t FFIAbilityContextStartServiceExtensionAbilityWithAccount(int64_t id, Wan
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartServiceExtensionAbilityWithAccount failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -210,7 +210,7 @@ int32_t FFIAbilityContextStopServiceExtensionAbility(int64_t id, WantHandle want
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StopServiceExtensionAbility failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -221,7 +221,7 @@ int32_t FFIAbilityContextStopServiceExtensionAbilityWithAccount(int64_t id, Want
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StopServiceExtensionAbilityWithAccount failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -232,7 +232,7 @@ int32_t FFIAbilityContextTerminateSelf(int64_t id)
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "TerminateSelf failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
return context->TerminateSelf();
@ -242,7 +242,7 @@ int32_t FFIAbilityContextTerminateSelfWithResult(int64_t id, WantHandle want, in
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "TerminateSelfWithResult failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<Want*>(want);
@ -254,7 +254,7 @@ RetDataBool FFIAbilityContextIsTerminating(int64_t id)
RetDataBool res = { ERR_INVALID_INSTANCE_CODE, false };
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "IsTerminating failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return res;
}
@ -268,7 +268,7 @@ int32_t FFIAbilityContextConnectAbility(int64_t id, WantHandle want, int64_t con
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ConnectAbility failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<AAFwk::Want*>(want);
@ -280,7 +280,7 @@ int32_t FFIAbilityContextConnectAbilityWithAccount(int64_t id, WantHandle want,
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ConnectAbility failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<AAFwk::Want*>(want);
@ -292,7 +292,7 @@ int32_t FFIAbilityContextDisconnectAbility(int64_t id, WantHandle want, int64_t
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ConnectAbility failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
return ERR_INVALID_INSTANCE_CODE;
}
auto actualWant = reinterpret_cast<AAFwk::Want*>(want);
@ -307,7 +307,7 @@ int32_t FFIAbilityContextStartAbilityForResult(int64_t id, WantHandle want, int3
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResult failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
cjTask(ERR_INVALID_INSTANCE_CODE, nullptr);
return ERR_INVALID_INSTANCE_CODE;
}
@ -325,7 +325,7 @@ int32_t FFIAbilityContextStartAbilityForResultWithOption(
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResult failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
cjTask(ERR_INVALID_INSTANCE_CODE, nullptr);
return ERR_INVALID_INSTANCE_CODE;
}
@ -345,7 +345,7 @@ int32_t FFIAbilityContextStartAbilityForResultWithAccount(
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResult failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "invalid id of cj ability context");
cjTask(ERR_INVALID_INSTANCE_CODE, nullptr);
return ERR_INVALID_INSTANCE_CODE;
}
@ -363,7 +363,7 @@ int32_t FFIAbilityContextStartAbilityForResultWithAccountAndOption(
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "StartAbilityForResult failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
cjTask(ERR_INVALID_INSTANCE_CODE, nullptr);
return ERR_INVALID_INSTANCE_CODE;
}
@ -380,11 +380,11 @@ int32_t FFIAbilityContextRequestPermissionsFromUser(
{
auto cjTask = [lambdaId](int32_t error, CJPermissionRequestResult* cjPermissionRequestResult) {
if (g_cjAbilityCallbacks == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestPermissionsFromUser failed, cangjie callbacks are not registered");
TAG_LOGE(AAFwkTag::CONTEXT, "failed, cangjie callbacks are not registered");
return;
}
g_cjAbilityCallbacks->invokePermissionRequestResultCallback(lambdaId, error, cjPermissionRequestResult);
TAG_LOGD(AAFwkTag::CONTEXT, "RequestPermissionsFromUser callback is called, error is %{public}d", error);
TAG_LOGD(AAFwkTag::CONTEXT, "invoke, error is %{public}d", error);
};
PermissionRequestTask task = [cjTask](const std::vector<std::string>& permissions,
const std::vector<int>& grantResults) {
@ -396,14 +396,14 @@ int32_t FFIAbilityContextRequestPermissionsFromUser(
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestPermissionsFromUser failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "null CJAbilityContext");
cjTask(ERR_INVALID_INSTANCE_CODE, nullptr);
return ERR_INVALID_INSTANCE_CODE;
}
auto actualPermissions = reinterpret_cast<std::vector<std::string>*>(permissions);
if (actualPermissions->empty()) {
TAG_LOGE(AAFwkTag::CONTEXT, "Params do not meet specification, permissions is empty.");
TAG_LOGE(AAFwkTag::CONTEXT, "params do not meet specification, permissions is empty");
cjTask(ERR_INVALID_INSTANCE_CODE, nullptr);
return ERR_INVALID_INSTANCE_CODE;
}
@ -415,7 +415,7 @@ int32_t FFIAbilityContextSetMissionLabel(int64_t id, const char* label)
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "SetMissionLabel failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "null CJAbilityContext");
return ERR_INVALID_INSTANCE_CODE;
}
return context->SetMissionLabel(label);
@ -425,7 +425,7 @@ int32_t FFIAbilityContextSetMissionIcon(int64_t id, int64_t pixelMapId)
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "SetMissionIcon failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return ERR_INVALID_INSTANCE_CODE;
}
return 0;
@ -436,12 +436,12 @@ int32_t FFIAbilityContextRequestDialogService(int64_t id, WantHandle want, int64
{
auto context = FFIData::GetData<CJAbilityContext>(id);
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestDialogService failed, invalid id of CJAbilityContext");
TAG_LOGE(AAFwkTag::CONTEXT, "null CJAbilityContext");
return ERR_INVALID_INSTANCE_CODE;
}
RequestDialogResultTask task = [lambdaId](int32_t resultCode, const AAFwk::Want &resultWant) {
if (g_cjAbilityCallbacks == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "RequestDialogService failed, cangjie callbacks are not registered");
TAG_LOGE(AAFwkTag::CONTEXT, "null g_cjAbilityCallbacks");
return;
}
CJDialogRequestResult dialogRequestResult = {
@ -449,7 +449,7 @@ int32_t FFIAbilityContextRequestDialogService(int64_t id, WantHandle want, int64
.wantHandle = (WantHandle)&resultWant
};
g_cjAbilityCallbacks->invokeDialogRequestResultCallback(lambdaId, resultCode, &dialogRequestResult);
TAG_LOGD(AAFwkTag::CONTEXT, "RequestDialogService callback is called, resultCode is %{public}d", resultCode);
TAG_LOGD(AAFwkTag::CONTEXT, "invoke, resultCode is %{public}d", resultCode);
};
auto actualWant = reinterpret_cast<AAFwk::Want*>(want);
return context->RequestDialogService(*actualWant, std::move(task));
@ -504,7 +504,7 @@ EXPORT napi_value FFICreateNapiValue(void *env, void *context)
napi_value result = nullptr;
napi_create_object((napi_env)env, &result);
if (result == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "FFICreateNapiValue create object failed.");
TAG_LOGE(AAFwkTag::CONTEXT, "null result");
return nullptr;
}
auto nativeFinalize = [](napi_env env, void* data, void* hint) {

View File

@ -26,13 +26,13 @@ extern "C" {
int64_t FFIAbilityGetAbilityContext(AbilityHandle abilityHandle)
{
if (abilityHandle == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ability handle is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null abilityHandle");
return ERR_INVALID_INSTANCE_CODE;
}
auto ability = static_cast<CJUIAbility*>(abilityHandle);
auto context = ability->GetAbilityContext();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "GetAbilityContext failed, abilityContext is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null abilityContext");
return ERR_INVALID_INSTANCE_CODE;
}
auto cjContext = FFI::FFIData::Create<CJAbilityContext>(context);
@ -47,12 +47,12 @@ void FFIAbilityContextGetFilesDir(int64_t id, void(*accept)(const char*))
{
auto cjContext = FFI::FFIData::GetData<CJAbilityContext>(id);
if (cjContext == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "cj abilityContext is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null cj abilityContext");
return;
}
auto context = cjContext->GetAbilityContext();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is null");
TAG_LOGE(AAFwkTag::CONTEXT, "null context");
return;
}
auto filesDir = context->GetFilesDir();

View File

@ -1056,7 +1056,7 @@ void JsUIExtensionContentSession::AddFreeInstallObserver(napi_env env,
freeInstallObserver_ = new JsFreeInstallObserver(env);
auto context = context_.lock();
if (!context) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is nullptr.");
TAG_LOGE(AAFwkTag::UI_EXT, "null context");
return;
}
ret = AAFwk::AbilityManagerClient::GetInstance()->AddFreeInstallObserver(context->GetToken(),

View File

@ -771,7 +771,7 @@ void JsUIExtensionContext::DoConnectUIServiceExtension(napi_env env,
uint64_t connectId = connection->GetConnectionId();
auto context = weakContext.lock();
if (!context) {
TAG_LOGE(AAFwkTag::CONTEXT, "Connect ability failed, context is released.");
TAG_LOGE(AAFwkTag::UISERVC_EXT, "connect ability failed, context is released");
uasyncTaskShared->Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
UIServiceConnection::RemoveUIServiceExtensionConnection(connectId);
return;
@ -863,7 +863,7 @@ napi_value JsUIExtensionContext::OnReportDrawnCompleted(napi_env env, NapiCallba
napi_value JsUIExtensionContext::OnOpenAtomicService(napi_env env, NapiCallbackInfo& info)
{
TAG_LOGD(AAFwkTag::UI_EXT, "start");
TAG_LOGD(AAFwkTag::UI_EXT, "called");
if (info.argc == ARGC_ZERO) {
ThrowTooFewParametersError(env);
return CreateJsUndefined(env);
@ -871,7 +871,7 @@ napi_value JsUIExtensionContext::OnOpenAtomicService(napi_env env, NapiCallbackI
std::string appId;
if (!ConvertFromJsValue(env, info.argv[INDEX_ZERO], appId)) {
TAG_LOGE(AAFwkTag::UI_EXT, "OnOpenAtomicService, parse appId failed");
TAG_LOGE(AAFwkTag::UI_EXT, "parse appId failed");
ThrowInvalidParamError(env, "Parse param appId failed, appId must be string.");
return CreateJsUndefined(env);
}
@ -880,9 +880,9 @@ napi_value JsUIExtensionContext::OnOpenAtomicService(napi_env env, NapiCallbackI
Want want;
AAFwk::StartOptions startOptions;
if (info.argc > ARGC_ONE && CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_object)) {
TAG_LOGD(AAFwkTag::UI_EXT, "OnOpenAtomicService atomic service options is used");
TAG_LOGD(AAFwkTag::UI_EXT, "atomic service options is used");
if (!AppExecFwk::UnwrapStartOptionsAndWant(env, info.argv[INDEX_ONE], startOptions, want)) {
TAG_LOGE(AAFwkTag::UI_EXT, "Fail to parse atomic service options");
TAG_LOGE(AAFwkTag::UI_EXT, "invalid atomic service options");
ThrowInvalidParamError(env,
"Parse param startOptions failed, startOptions must be StartOption.");
return CreateJsUndefined(env);
@ -909,7 +909,7 @@ void JsUIExtensionContext::SetCallbackForTerminateWithResult(int32_t resultCode,
}
auto extensionContext = AbilityRuntime::Context::ConvertTo<AbilityRuntime::UIExtensionContext>(context);
if (!extensionContext) {
TAG_LOGE(AAFwkTag::UI_EXT, "extensionContext is nullptr");
TAG_LOGE(AAFwkTag::UI_EXT, "null extensionContext");
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM));
return;
}
@ -918,7 +918,7 @@ void JsUIExtensionContext::SetCallbackForTerminateWithResult(int32_t resultCode,
#ifdef SUPPORT_SCREEN
sptr<Rosen::Window> uiWindow = context->GetWindow();
if (!uiWindow) {
TAG_LOGE(AAFwkTag::UI_EXT, "uiWindow is nullptr");
TAG_LOGE(AAFwkTag::UI_EXT, "null uiWindow");
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM));
return;
}
@ -948,9 +948,9 @@ napi_value JsUIExtensionContext::OpenAtomicServiceInner(napi_env env, NapiCallba
AddFreeInstallObserver(env, want, nullptr, &result, true);
RuntimeTask task = [env, element = want.GetElement(), startTime, &observer = freeInstallObserver_](
int resultCode, const AAFwk::Want& want, bool isInner) {
TAG_LOGD(AAFwkTag::UI_EXT, "OnOpenAtomicService async callback is begin");
TAG_LOGD(AAFwkTag::UI_EXT, "start async callback");
if (observer == nullptr) {
TAG_LOGW(AAFwkTag::UI_EXT, "observer is nullptr");
TAG_LOGW(AAFwkTag::UI_EXT, "null observer");
return;
}
HandleScope handleScope(env);
@ -986,24 +986,24 @@ void JsUIExtensionContext::AddFreeInstallObserver(napi_env env, const AAFwk::Wan
napi_value *result, bool isAbilityResult, bool isOpenLink)
{
// adapter free install async return install and start result
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
TAG_LOGD(AAFwkTag::UI_EXT, "called");
int ret = 0;
if (freeInstallObserver_ == nullptr) {
freeInstallObserver_ = new JsFreeInstallObserver(env);
auto context = context_.lock();
if (!context) {
TAG_LOGE(AAFwkTag::CONTEXT, "context is nullptr.");
TAG_LOGE(AAFwkTag::UI_EXT, "null context");
return;
}
ret = context->AddFreeInstallObserver(freeInstallObserver_);
}
if (ret != ERR_OK) {
TAG_LOGE(AAFwkTag::UI_EXT, "AddFreeInstallObserver error");
TAG_LOGE(AAFwkTag::UI_EXT, "addFreeInstallObserver error");
}
std::string startTime = want.GetStringParam(Want::PARAM_RESV_START_TIME);
if (!isOpenLink) {
TAG_LOGI(AAFwkTag::UI_EXT, "AddJsObserverObject");
TAG_LOGI(AAFwkTag::UI_EXT, "addJsObserver");
std::string bundleName = want.GetElement().GetBundleName();
std::string abilityName = want.GetElement().GetAbilityName();
freeInstallObserver_->AddJsObserverObject(
@ -1016,7 +1016,7 @@ void JsUIExtensionContext::AddFreeInstallObserver(napi_env env, const AAFwk::Wan
napi_value JsUIExtensionContext::CreateJsUIExtensionContext(napi_env env,
std::shared_ptr<UIExtensionContext> context)
{
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
TAG_LOGD(AAFwkTag::UI_EXT, "called");
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr;
if (context) {
abilityInfo = context->GetAbilityInfo();
@ -1076,19 +1076,19 @@ JSUIExtensionConnection::~JSUIExtensionConnection()
void JSUIExtensionConnection::ReleaseNativeReference(NativeReference* ref)
{
if (ref == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ReleaseNativeReference: ref == nullptr");
TAG_LOGE(AAFwkTag::UISERVC_EXT, "null ref");
return;
}
uv_loop_t *loop = nullptr;
napi_get_uv_event_loop(env_, &loop);
if (loop == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ReleaseNativeReference: failed to get uv loop.");
TAG_LOGE(AAFwkTag::UISERVC_EXT, "null uv loop");
delete ref;
return;
}
uv_work_t *work = new (std::nothrow) uv_work_t;
if (work == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ReleaseNativeReference: failed to create work.");
TAG_LOGE(AAFwkTag::UISERVC_EXT, "null work");
delete ref;
return;
}
@ -1096,11 +1096,11 @@ void JSUIExtensionConnection::ReleaseNativeReference(NativeReference* ref)
int ret = uv_queue_work(loop, work, [](uv_work_t *work) {},
[](uv_work_t *work, int status) {
if (work == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ReleaseNativeReference: work is nullptr.");
TAG_LOGE(AAFwkTag::UISERVC_EXT, "null work");
return;
}
if (work->data == nullptr) {
TAG_LOGE(AAFwkTag::CONTEXT, "ReleaseNativeReference: data is nullptr.");
TAG_LOGE(AAFwkTag::UISERVC_EXT, "null data");
delete work;
work = nullptr;
return;
@ -1263,28 +1263,28 @@ void JSUIExtensionConnection::CallJsFailed(int32_t errorCode)
napi_value JSUIExtensionConnection::CallObjectMethod(const char* name, napi_value const *argv, size_t argc)
{
TAG_LOGD(AAFwkTag::CONTEXT, "name:%{public}s", name);
TAG_LOGD(AAFwkTag::UISERVC_EXT, "name:%{public}s", name);
if (!jsConnectionObject_) {
TAG_LOGW(AAFwkTag::CONTEXT, "Not found jsConnectionObject_");
TAG_LOGW(AAFwkTag::UISERVC_EXT, "null jsConnectionObject_");
return nullptr;
}
HandleScope handleScope(env_);
napi_value obj = jsConnectionObject_->GetNapiValue();
if (!CheckTypeForNapiValue(env_, obj, napi_object)) {
TAG_LOGE(AAFwkTag::CONTEXT, "Failed to get jsConnectionObject_ object");
TAG_LOGE(AAFwkTag::UISERVC_EXT, "jsConnectionObject_ type error");
return nullptr;
}
napi_value method = nullptr;
napi_get_named_property(env_, obj, name, &method);
if (!CheckTypeForNapiValue(env_, method, napi_function)) {
TAG_LOGE(AAFwkTag::CONTEXT, "Failed to get '%{public}s' from jsConnectionObject_ object", name);
TAG_LOGE(AAFwkTag::UISERVC_EXT, "type error, method: '%{public}s'", name);
return nullptr;
}
napi_value result = nullptr;
napi_call_function(env_, obj, method, argc, argv, &result);
TAG_LOGD(AAFwkTag::CONTEXT, "CallFunction(%{public}s) ok", name);
TAG_LOGD(AAFwkTag::UISERVC_EXT, "callFunction(%{public}s) ok", name);
return result;
}

View File

@ -59,7 +59,7 @@ void RemoveUIServiceExtensionConnection(const int64_t& connectId)
} else {
TAG_LOGI(AAFwkTag::UI_EXT, "not found");
}
TAG_LOGI(AAFwkTag::CONTEXT, "Connects new size:%{public}zu", gUiServiceExtConnects.size());
TAG_LOGI(AAFwkTag::UI_EXT, "connects new size:%{public}zu", gUiServiceExtConnects.size());
}
void FindUIServiceExtensionConnection(const int64_t& connectId, AAFwk::Want& want,

View File

@ -287,7 +287,7 @@ ErrCode UIExtensionContext::AddFreeInstallObserver(const sptr<IFreeInstallObserv
{
ErrCode ret = AAFwk::AbilityManagerClient::GetInstance()->AddFreeInstallObserver(token_, observer);
if (ret != ERR_OK) {
TAG_LOGE(AAFwkTag::CONTEXT, "AddFreeInstallObserver error, ret: %{public}d", ret);
TAG_LOGE(AAFwkTag::UI_EXT, "error, ret: %{public}d", ret);
}
return ret;
}