Signed-off-by: sodanotgreen <limengzheng@huawei.com>
This commit is contained in:
sodanotgreen 2024-07-22 17:49:45 +08:00
parent f5be29f135
commit 2138974b20
15 changed files with 904 additions and 908 deletions

View File

@ -32,7 +32,7 @@ enum class MemoryLevel {
static napi_status SetEnumItem(napi_env env, napi_value object, const char* name, int32_t value)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_status status;
napi_value itemName;
napi_value itemValue;
@ -49,7 +49,7 @@ static napi_status SetEnumItem(napi_env env, napi_value object, const char* name
static napi_value InitLaunchReasonObject(napi_env env)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value object;
NAPI_CALL(env, napi_create_object(env, &object));
@ -68,7 +68,7 @@ static napi_value InitLaunchReasonObject(napi_env env)
static napi_value InitLastExitReasonObject(napi_env env)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value object;
NAPI_CALL(env, napi_create_object(env, &object));
@ -88,7 +88,7 @@ static napi_value InitLastExitReasonObject(napi_env env)
static napi_value InitOnContinueResultObject(napi_env env)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value object;
NAPI_CALL(env, napi_create_object(env, &object));
@ -113,7 +113,7 @@ static napi_value InitContinueStateObject(napi_env env)
static napi_value InitWindowModeObject(napi_env env)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value object;
NAPI_CALL(env, napi_create_object(env, &object));
@ -130,7 +130,7 @@ static napi_value InitWindowModeObject(napi_env env)
// AbilityConstant.OnSaveResult
static napi_value InitOnSaveResultEnum(napi_env env)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value object;
NAPI_CALL(env, napi_create_object(env, &object));
NAPI_CALL(env, SetEnumItem(env, object, "ALL_AGREE", AppExecFwk::ALL_AGREE));
@ -146,7 +146,7 @@ static napi_value InitOnSaveResultEnum(napi_env env)
// AbilityConstant.StateType
static napi_value InitStateTypeEnum(napi_env env)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value object;
NAPI_CALL(env, napi_create_object(env, &object));
NAPI_CALL(env, SetEnumItem(env, object, "CONTINUATION", AppExecFwk::CONTINUATION));
@ -157,7 +157,7 @@ static napi_value InitStateTypeEnum(napi_env env)
static napi_value InitMemoryLevelObject(napi_env env)
{
TAG_LOGD(AAFwkTag::JSNAPI, "start");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value object;
NAPI_CALL(env, napi_create_object(env, &object));

View File

@ -142,7 +142,7 @@ public:
static void Finalizer(napi_env env, void* data, void* hint)
{
TAG_LOGI(AAFwkTag::JSNAPI, "JsErrorManager Finalizer is called");
TAG_LOGI(AAFwkTag::JSNAPI, "called");
std::unique_ptr<JsErrorManager>(static_cast<JsErrorManager*>(data));
ClearReference(env);
}
@ -203,14 +203,14 @@ public:
private:
napi_value OnOn(napi_env env, const size_t argc, napi_value* argv)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
std::string type = ParseParamType(env, argc, argv);
if (type == ON_OFF_TYPE_SYNC) {
return OnOnNew(env, argc, argv);
}
if (type == ON_OFF_TYPE_SYNC_LOOP) {
if (!AppExecFwk::EventRunner::IsAppMainThread()) {
TAG_LOGE(AAFwkTag::JSNAPI, "LoopObserver can only be set from main thread.");
TAG_LOGE(AAFwkTag::JSNAPI, "LoopObserver can only be set from main thread");
ThrowInvalidCallerError(env);
return CreateJsUndefined(env);
}
@ -218,7 +218,7 @@ private:
}
if (type == ON_OFF_TYPE_UNHANDLED_REJECTION) {
if (argc != ARGC_TWO) {
TAG_LOGE(AAFwkTag::JSNAPI, "The number of params is invalid.");
TAG_LOGE(AAFwkTag::JSNAPI, "The number of params is invalid");
ThrowInvalidNumParametersError(env);
return CreateJsUndefined(env);
}
@ -229,9 +229,9 @@ private:
napi_value OnOnOld(napi_env env, const size_t argc, napi_value* argv)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
if (argc != ARGC_TWO) {
TAG_LOGE(AAFwkTag::JSNAPI, "The param is invalid, observers need.");
TAG_LOGE(AAFwkTag::JSNAPI, "The param is invalid, observers need");
ThrowTooFewParametersError(env);
return CreateJsUndefined(env);
}
@ -250,7 +250,7 @@ private:
}
if (observer_ == nullptr) {
TAG_LOGD(AAFwkTag::JSNAPI, "observer_ is null.");
TAG_LOGD(AAFwkTag::JSNAPI, "observer_ is nullptr");
// create observer
observer_ = std::make_shared<JsErrorObserver>(env);
AppExecFwk::ApplicationDataManager::GetInstance().AddErrorObserver(observer_);
@ -283,9 +283,9 @@ private:
napi_value OnOnNew(napi_env env, const size_t argc, napi_value* argv)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
if (argc < ARGC_TWO) {
TAG_LOGE(AAFwkTag::JSNAPI, "The param is invalid, observers need.");
TAG_LOGE(AAFwkTag::JSNAPI, "The param is invalid, observers need");
ThrowTooFewParametersError(env);
return CreateJsUndefined(env);
}
@ -314,14 +314,14 @@ private:
napi_value OnOff(napi_env env, size_t argc, napi_value* argv)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
std::string type = ParseParamType(env, argc, argv);
if (type == ON_OFF_TYPE_SYNC) {
return OnOffNew(env, argc, argv);
}
if (type == ON_OFF_TYPE_SYNC_LOOP) {
if (!AppExecFwk::EventRunner::IsAppMainThread()) {
TAG_LOGE(AAFwkTag::JSNAPI, "LoopObserver can only be set from main thread.");
TAG_LOGE(AAFwkTag::JSNAPI, "LoopObserver can only be set from main thread");
ThrowInvalidCallerError(env);
return CreateJsUndefined(env);
}
@ -329,7 +329,7 @@ private:
}
if (type == ON_OFF_TYPE_UNHANDLED_REJECTION) {
if (argc != ARGC_TWO && argc != ARGC_ONE) {
TAG_LOGE(AAFwkTag::JSNAPI, "The number of params is invalid.");
TAG_LOGE(AAFwkTag::JSNAPI, "The number of params is invalid");
ThrowInvalidNumParametersError(env);
return CreateJsUndefined(env);
}
@ -340,11 +340,11 @@ private:
napi_value OnOffOld(napi_env env, size_t argc, napi_value* argv)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
int32_t observerId = -1;
if (argc != ARGC_TWO && argc != ARGC_THREE) {
ThrowTooFewParametersError(env);
TAG_LOGE(AAFwkTag::JSNAPI, "unregister errorObserver error, not enough params.");
TAG_LOGE(AAFwkTag::JSNAPI, "unregister errorObserver error, not enough params");
} else {
napi_get_value_int32(env, argv[INDEX_ONE], &observerId);
TAG_LOGI(AAFwkTag::JSNAPI, "unregister errorObserver called, observer:%{public}d", observerId);
@ -360,7 +360,7 @@ private:
NapiAsyncTask::CompleteCallback complete =
[&observer = observer_, observerId](
napi_env env, NapiAsyncTask& task, int32_t status) {
TAG_LOGI(AAFwkTag::JSNAPI, "Unregister errorObserver called.");
TAG_LOGI(AAFwkTag::JSNAPI, "Unregister errorObserver called");
if (observerId == -1) {
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM));
return;
@ -415,10 +415,10 @@ private:
napi_value OnOffNew(napi_env env, size_t argc, napi_value* argv)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
if (argc < ARGC_TWO) {
ThrowTooFewParametersError(env);
TAG_LOGE(AAFwkTag::JSNAPI, "unregister errorObserver error, not enough params.");
TAG_LOGE(AAFwkTag::JSNAPI, "unregister errorObserver error, not enough params");
return CreateJsUndefined(env);
}
int32_t observerId = -1;
@ -448,7 +448,7 @@ private:
static void CallJsFunction(napi_env env, napi_value obj, const char* methodName,
napi_value const* argv, size_t argc)
{
TAG_LOGI(AAFwkTag::JSNAPI, "CallJsFunction begin methodName: %{public}s", methodName);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (obj == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "Failed to get object");
return;
@ -469,15 +469,15 @@ private:
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>
([number](napi_env env, NapiAsyncTask &task, int32_t status) {
if (loopObserver_ == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "loopObserver_ is null.");
TAG_LOGE(AAFwkTag::JSNAPI, "loopObserver_ is nullptr");
return;
}
if (loopObserver_->env == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "env is null.");
TAG_LOGE(AAFwkTag::JSNAPI, "env is nullptr");
return;
}
if (loopObserver_->observerObject == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "observerObject is null.");
TAG_LOGE(AAFwkTag::JSNAPI, "observerObject is nullptr");
return;
}
napi_value jsValue[] = { CreateJsValue(loopObserver_->env, number) };
@ -495,23 +495,23 @@ private:
napi_value OnSetLoopWatch(napi_env env, size_t argc, napi_value* argv)
{
if (argc != ARGC_THREE) {
TAG_LOGE(AAFwkTag::JSNAPI, "OnSetLoopWatch: Not enough params.");
TAG_LOGE(AAFwkTag::JSNAPI, "Not enough params");
ThrowTooFewParametersError(env);
return CreateJsUndefined(env);
}
if (!CheckTypeForNapiValue(env, argv[INDEX_ONE], napi_number)) {
TAG_LOGE(AAFwkTag::JSNAPI, "OnSetLoopWatch: Invalid param");
TAG_LOGE(AAFwkTag::JSNAPI, "parse timeout failed");
ThrowInvalidParamError(env, "Parameter error: Failed to parse timeout, must be a number.");
return CreateJsUndefined(env);
}
if (!CheckTypeForNapiValue(env, argv[INDEX_TWO], napi_object)) {
TAG_LOGE(AAFwkTag::JSNAPI, "OnSetLoopWatch: Invalid param");
TAG_LOGE(AAFwkTag::JSNAPI, "parse observer failed");
ThrowInvalidParamError(env, "Parameter error: Failed to parse observer, must be a LoopObserver.");
return CreateJsUndefined(env);
}
int64_t number;
if (!ConvertFromJsNumber(env, argv[INDEX_ONE], number)) {
TAG_LOGE(AAFwkTag::JSNAPI, "OnSetLoopWatch: Parse timeout failed");
TAG_LOGE(AAFwkTag::JSNAPI, "parse timeout failed");
ThrowInvalidParamError(env, "Parameter error: Failed to parse timeout, must be a number.");
return CreateJsUndefined(env);
}
@ -541,7 +541,7 @@ private:
loopObserver_ = nullptr;
TAG_LOGI(AAFwkTag::JSNAPI, "Remove loopObserver success");
} else {
TAG_LOGI(AAFwkTag::JSNAPI, "Unregister loopObserver Called.");
TAG_LOGI(AAFwkTag::JSNAPI, "Unregister loopObserver Called");
}
return nullptr;
}
@ -574,16 +574,16 @@ private:
napi_value JsErrorManagerInit(napi_env env, napi_value exportObj)
{
TAG_LOGI(AAFwkTag::JSNAPI, "Js error manager Init.");
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (env == nullptr || exportObj == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "env or exportObj null");
TAG_LOGI(AAFwkTag::JSNAPI, "env or exportObj nullptr");
return nullptr;
}
std::unique_ptr<JsErrorManager> jsErrorManager = std::make_unique<JsErrorManager>();
jsErrorManager->SetRejectionCallback(env);
napi_wrap(env, exportObj, jsErrorManager.release(), JsErrorManager::Finalizer, nullptr, nullptr);
TAG_LOGI(AAFwkTag::JSNAPI, "JsErrorManager BindNativeFunction called");
TAG_LOGI(AAFwkTag::JSNAPI, "BindNativeFunction called");
const char *moduleName = "JsErrorManager";
BindNativeFunction(env, exportObj, "on", moduleName, JsErrorManager::On);
BindNativeFunction(env, exportObj, "off", moduleName, JsErrorManager::Off);

View File

@ -32,7 +32,7 @@ JsErrorObserver::~JsErrorObserver() = default;
void JsErrorObserver::OnUnhandledException(const std::string errMsg)
{
TAG_LOGD(AAFwkTag::JSNAPI, "OnUnhandledException come.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
std::weak_ptr<JsErrorObserver> thisWeakPtr(shared_from_this());
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>
([thisWeakPtr, errMsg](napi_env env, NapiAsyncTask &task, int32_t status) {
@ -49,7 +49,7 @@ void JsErrorObserver::OnUnhandledException(const std::string errMsg)
void JsErrorObserver::HandleOnUnhandledException(const std::string &errMsg)
{
TAG_LOGD(AAFwkTag::JSNAPI, "HandleOnUnhandledException come.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
auto tmpMap = jsObserverObjectMap_;
for (auto &item : tmpMap) {
napi_value value = (item.second)->GetNapiValue();
@ -66,7 +66,7 @@ void JsErrorObserver::HandleOnUnhandledException(const std::string &errMsg)
void JsErrorObserver::CallJsFunction(napi_value obj, const char* methodName, napi_value const* argv, size_t argc)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called method:%{public}s", methodName);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
if (obj == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "Failed to get object");
return;
@ -114,7 +114,7 @@ bool JsErrorObserver::IsEmpty()
void JsErrorObserver::OnExceptionObject(const AppExecFwk::ErrorObject &errorObj)
{
TAG_LOGD(AAFwkTag::JSNAPI, "OnExceptionObject come.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
std::weak_ptr<JsErrorObserver> thisWeakPtr(shared_from_this());
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>
([thisWeakPtr, errorObj](napi_env env, NapiAsyncTask &task, int32_t status) {
@ -131,7 +131,7 @@ void JsErrorObserver::OnExceptionObject(const AppExecFwk::ErrorObject &errorObj)
void JsErrorObserver::HandleException(const AppExecFwk::ErrorObject &errorObj)
{
TAG_LOGD(AAFwkTag::JSNAPI, "HandleException come.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
auto tmpMap = jsObserverObjectMap_;
for (auto &item : tmpMap) {
napi_value jsObj = (item.second)->GetNapiValue();

View File

@ -40,7 +40,7 @@ JsNapiCommon::~JsNapiCommon()
napi_value JsNapiCommon::HandleJsConnectAbilityError(napi_env env,
std::shared_ptr<ConnectionCallback> &connectionCallback, const Want &want, int32_t errorVal)
{
TAG_LOGE(AAFwkTag::JSNAPI, "CommonJsConnectAbility failed.");
TAG_LOGE(AAFwkTag::JSNAPI, "CommonJsConnectAbility failed");
// return error code in onFailed async callback
napi_value callback = nullptr;
napi_value undefinedVal = nullptr;
@ -70,7 +70,7 @@ napi_value JsNapiCommon::HandleJsConnectAbilityError(napi_env env,
napi_value JsNapiCommon::OnFindAbilityConnection(napi_env env, sptr<NAPIAbilityConnection> &abilityConnection,
std::shared_ptr<ConnectionCallback> &connectionCallback, const Want &want, int64_t id)
{
TAG_LOGI(AAFwkTag::JSNAPI, "find abilityConnection exist, current callbackSize: %{public}zu.",
TAG_LOGI(AAFwkTag::JSNAPI, "find abilityConnection exist, current callbackSize: %{public}zu",
abilityConnection->GetCallbackSize());
// Add callback to connection
abilityConnection->AddConnectionCallback(connectionCallback);
@ -90,7 +90,7 @@ napi_value JsNapiCommon::OnFindAbilityConnection(napi_env env, sptr<NAPIAbilityC
napi_value JsNapiCommon::JsConnectAbility(napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s is called", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -140,7 +140,7 @@ void JsNapiCommon::SetJsDisConnectAbilityCallback(std::shared_ptr<int32_t> &erro
execute = [obj = this, value = errorVal, abilityType, abilityConnection] () {
if (obj->ability_ == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ACE_ABILITY);
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the ability is nullptr.");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the ability is nullptr");
return;
}
if (!obj->CheckAbilityType(abilityType)) {
@ -184,7 +184,7 @@ napi_value JsNapiCommon::JsDisConnectAbility(napi_env env, napi_callback_info in
if (item != connects_.end()) {
abilityConnection = item->second;
} else {
TAG_LOGE(AAFwkTag::JSNAPI, "there is no ability to disconnect.");
TAG_LOGE(AAFwkTag::JSNAPI, "there is no ability to disconnect");
return CreateJsUndefined(env);
}
@ -228,7 +228,7 @@ bool JsNapiCommon::CreateConnectionAndConnectAbilityLocked(
sptr<NAPIAbilityConnection> JsNapiCommon::FindConnectionLocked(const Want &want, int64_t &id)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s uri:%{public}s", __func__, want.GetElement().GetURI().c_str());
TAG_LOGD(AAFwkTag::JSNAPI, "called uri:%{public}s", want.GetElement().GetURI().c_str());
std::string deviceId = want.GetElement().GetDeviceID();
std::string bundleName = want.GetBundle();
std::string abilityName = want.GetElement().GetAbilityName();
@ -255,7 +255,7 @@ sptr<NAPIAbilityConnection> JsNapiCommon::FindConnectionLocked(const Want &want,
void JsNapiCommon::RemoveAllCallbacksLocked()
{
TAG_LOGD(AAFwkTag::JSNAPI, "RemoveAllCallbacksLocked begin");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
std::lock_guard<std::mutex> lock(g_connectionsLock_);
for (auto it = connects_.begin(); it != connects_.end();) {
auto connection = it->second;
@ -300,12 +300,12 @@ napi_value JsNapiCommon::JsGetContext(napi_env env, const napi_callback_info inf
napi_value JsNapiCommon::JsGetFilesDir(napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetFilesDir called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
if (argc > ARGS_ONE) {
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetFilesDir input params count error, argc=%{public}zu", argc);
TAG_LOGE(AAFwkTag::JSNAPI, "input params count error, argc=%{public}zu", argc);
return CreateJsUndefined(env);
}
@ -314,7 +314,7 @@ napi_value JsNapiCommon::JsGetFilesDir(napi_env env, napi_callback_info info, co
auto execute = [obj = this, dir = filesDir, abilityType, value = errorVal] () {
if (obj->ability_ == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ACE_ABILITY);
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetFilesDir task execute error, the ability is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the ability is nullptr");
return;
}
if (!obj->CheckAbilityType(abilityType)) {
@ -324,7 +324,7 @@ napi_value JsNapiCommon::JsGetFilesDir(napi_env env, napi_callback_info info, co
auto context = obj->ability_->GetAbilityContext();
if (context == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ABILITY_CALL_INVALID);
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetFilesDir task execute error, the abilitycontext is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the abilitycontext is nullptr");
return;
}
dir->name = context->GetFilesDir();
@ -349,12 +349,12 @@ napi_value JsNapiCommon::JsGetFilesDir(napi_env env, napi_callback_info info, co
napi_value JsNapiCommon::JsIsUpdatingConfigurations(
napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsIsUpdatingConfigurations called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
if (argc > ARGS_ONE) {
TAG_LOGE(AAFwkTag::JSNAPI, "JsIsUpdatingConfigurations input params count error, argc=%{public}zu", argc);
TAG_LOGE(AAFwkTag::JSNAPI, "input params count error, argc=%{public}zu", argc);
return CreateJsUndefined(env);
}
@ -363,7 +363,7 @@ napi_value JsNapiCommon::JsIsUpdatingConfigurations(
auto execute = [obj = this, data = config, value = errorVal, abilityType] () {
if (obj->ability_ == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ACE_ABILITY);
TAG_LOGE(AAFwkTag::JSNAPI, "JsIsUpdatingConfigurations task execute error, the ability is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the ability is nullptr");
return;
}
if (!obj->CheckAbilityType(abilityType)) {
@ -372,7 +372,7 @@ napi_value JsNapiCommon::JsIsUpdatingConfigurations(
}
if (data == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ABILITY_CALL_INVALID);
TAG_LOGE(AAFwkTag::JSNAPI, "JsIsUpdatingConfigurations task execute error, param is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, param is nullptr");
return;
}
data->status = obj->ability_->IsUpdatingConfigurations();
@ -398,12 +398,12 @@ napi_value JsNapiCommon::JsIsUpdatingConfigurations(
napi_value JsNapiCommon::JsPrintDrawnCompleted(
napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsPrintDrawnCompleted called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
if (argc > ARGS_ONE) {
TAG_LOGE(AAFwkTag::JSNAPI, "JsPrintDrawnCompleted input params count error, argc=%{public}zu", argc);
TAG_LOGE(AAFwkTag::JSNAPI, "input params count error, argc=%{public}zu", argc);
return CreateJsUndefined(env);
}
@ -412,7 +412,7 @@ napi_value JsNapiCommon::JsPrintDrawnCompleted(
auto execute = [obj = this, data = drawComplete, value = errorVal, abilityType] () {
if (obj->ability_ == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ACE_ABILITY);
TAG_LOGE(AAFwkTag::JSNAPI, "JsPrintDrawnCompleted task execute error, the ability is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the ability is nullptr");
return;
}
if (!obj->CheckAbilityType(abilityType)) {
@ -421,7 +421,7 @@ napi_value JsNapiCommon::JsPrintDrawnCompleted(
}
if (data == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ABILITY_CALL_INVALID);
TAG_LOGE(AAFwkTag::JSNAPI, "JsPrintDrawnCompleted task execute error, data is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, data is nullptr");
return;
}
data->status = obj->ability_->PrintDrawnCompleted();
@ -446,12 +446,12 @@ napi_value JsNapiCommon::JsPrintDrawnCompleted(
napi_value JsNapiCommon::JsGetCacheDir(napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetCacheDir called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
if (argc > ARGS_ONE) {
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetCacheDir input params count error, argc=%{public}zu", argc);
TAG_LOGE(AAFwkTag::JSNAPI, "input params count error, argc=%{public}zu", argc);
return CreateJsUndefined(env);
}
@ -460,7 +460,7 @@ napi_value JsNapiCommon::JsGetCacheDir(napi_env env, napi_callback_info info, co
auto execute = [obj = this, dir = cacheDir, value = errorVal, abilityType] () {
if (obj->ability_ == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ACE_ABILITY);
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetCacheDir task execute error, the ability is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the ability is nullptr");
return;
}
if (!obj->CheckAbilityType(abilityType)) {
@ -470,7 +470,7 @@ napi_value JsNapiCommon::JsGetCacheDir(napi_env env, napi_callback_info info, co
auto context = obj->ability_->GetAbilityContext();
if (context == nullptr) {
*value = static_cast<int32_t>(NAPI_ERR_ABILITY_CALL_INVALID);
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetCacheDir task execute error, the ability context is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "task execute error, the ability context is nullptr");
return;
}
dir->name = context->GetCacheDir();
@ -497,7 +497,7 @@ napi_value JsNapiCommon::JsGetCacheDir(napi_env env, napi_callback_info info, co
napi_value JsNapiCommon::JsGetCtxAppType(
napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetCtxAppType called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -545,7 +545,7 @@ napi_value JsNapiCommon::JsGetCtxAppType(
napi_value JsNapiCommon::JsGetCtxHapModuleInfo(
napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetCtxHapModuleInfo called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -577,7 +577,7 @@ napi_value JsNapiCommon::JsGetCtxHapModuleInfo(
auto complete = [obj = this, info = infoData, value = errorVal]
(napi_env env, NapiAsyncTask &task, int32_t status) {
if (*value != static_cast<int32_t>(NAPI_ERR_NO_ERROR) || info == nullptr) {
TAG_LOGD(AAFwkTag::JSNAPI, "JsHapModuleInfo is null or errorVal is 0.");
TAG_LOGD(AAFwkTag::JSNAPI, "JsHapModuleInfo is null or errorVal is 0");
auto ecode = info == nullptr ? static_cast<int32_t>(NAPI_ERR_ABILITY_CALL_INVALID) : *value;
task.Reject(env, CreateJsError(env, ecode, obj->ConvertErrorCode(ecode)));
return;
@ -596,7 +596,7 @@ napi_value JsNapiCommon::JsGetCtxHapModuleInfo(
napi_value JsNapiCommon::JsGetAppVersionInfo(
napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetAppVersionInfo called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -647,7 +647,7 @@ napi_value JsNapiCommon::JsGetAppVersionInfo(
napi_value JsNapiCommon::JsGetCtxAbilityInfo(
napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetCtxAbilityInfo called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -679,7 +679,7 @@ napi_value JsNapiCommon::JsGetCtxAbilityInfo(
auto complete = [obj = this, info = infoData, value = errorVal]
(napi_env env, NapiAsyncTask &task, int32_t status) {
if (*value != static_cast<int32_t>(NAPI_ERR_NO_ERROR) || info == nullptr) {
TAG_LOGD(AAFwkTag::JSNAPI, "errorVal is 0 or JsHapModuleInfo is null.");
TAG_LOGD(AAFwkTag::JSNAPI, "errorVal is 0 or JsHapModuleInfo is null");
auto ecode = info == nullptr ? static_cast<int32_t>(NAPI_ERR_ABILITY_CALL_INVALID) : *value;
task.Reject(env, CreateJsError(env, ecode, obj->ConvertErrorCode(ecode)));
return;
@ -698,7 +698,7 @@ napi_value JsNapiCommon::JsGetCtxAbilityInfo(
napi_value JsNapiCommon::JsGetOrCreateDistributedDir(
napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetOrCreateDistributedDir called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -749,7 +749,7 @@ napi_value JsNapiCommon::JsGetOrCreateDistributedDir(
#ifdef SUPPORT_GRAPHICS
napi_value JsNapiCommon::JsGetDisplayOrientation(napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetDisplayOrientation called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -772,7 +772,7 @@ napi_value JsNapiCommon::JsGetDisplayOrientation(napi_env env, napi_callback_inf
*value = obj->ability_->GetDisplayOrientation();
};
auto complete = [value = errorVal] (napi_env env, NapiAsyncTask &task, int32_t status) {
TAG_LOGD(AAFwkTag::JSNAPI, "JsGetDisplayOrientation value = %{public}d", *value);
TAG_LOGD(AAFwkTag::JSNAPI, "inner call value = %{public}d", *value);
if (*value == NAPI_ERR_ACE_ABILITY) {
task.Reject(env, CreateJsError(env, NAPI_ERR_ACE_ABILITY, "ability is nullptr"));
} else if (*value == NAPI_ERR_ABILITY_TYPE_INVALID) {
@ -795,7 +795,7 @@ napi_value JsNapiCommon::JsGetDisplayOrientation(napi_env env, napi_callback_inf
napi_value JsNapiCommon::CreateProcessInfo(napi_env env, const std::shared_ptr<JsProcessInfo> &processInfo)
{
TAG_LOGD(AAFwkTag::JSNAPI, "CreateProcessInfo called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
CHECK_POINTER_AND_RETURN_LOG(processInfo, CreateJsUndefined(env), "input params error");
napi_value objContext = nullptr;
@ -810,7 +810,7 @@ napi_value JsNapiCommon::CreateProcessInfo(napi_env env, const std::shared_ptr<J
napi_value JsNapiCommon::CreateElementName(napi_env env, const std::shared_ptr<JsElementName> &elementName)
{
TAG_LOGD(AAFwkTag::JSNAPI, "CreateElementName called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
CHECK_POINTER_AND_RETURN_LOG(elementName, CreateJsUndefined(env), "input params error");
napi_value objContext = nullptr;
@ -828,7 +828,7 @@ napi_value JsNapiCommon::CreateElementName(napi_env env, const std::shared_ptr<J
napi_value JsNapiCommon::CreateHapModuleInfo(napi_env env, const std::shared_ptr<JsHapModuleInfo> &hapModInfo)
{
TAG_LOGD(AAFwkTag::JSNAPI, "CreateHapModuleInfo called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
CHECK_POINTER_AND_RETURN_LOG(hapModInfo, CreateJsUndefined(env), "input params error");
napi_value objContext = nullptr;
napi_create_object(env, &objContext);
@ -897,7 +897,7 @@ napi_value JsNapiCommon::CreateModuleInfos(napi_env env, const std::vector<Modul
napi_value JsNapiCommon::CreateAppInfo(napi_env env, const ApplicationInfo &appInfo)
{
TAG_LOGD(AAFwkTag::JSNAPI, "CreateAppInfo called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value objContext = nullptr;
napi_create_object(env, &objContext);
if (objContext == nullptr) {
@ -905,7 +905,7 @@ napi_value JsNapiCommon::CreateAppInfo(napi_env env, const ApplicationInfo &appI
return CreateJsUndefined(env);
}
if (!CheckTypeForNapiValue(env, objContext, napi_object)) {
TAG_LOGE(AAFwkTag::JSNAPI, "CreateAppInfo, ConvertNativeValueTo object error");
TAG_LOGE(AAFwkTag::JSNAPI, "ConvertNativeValueTo object error");
return CreateJsUndefined(env);
}
@ -940,15 +940,15 @@ napi_value JsNapiCommon::CreateAppInfo(napi_env env, const std::shared_ptr<JsApp
napi_value JsNapiCommon::CreateAbilityInfo(napi_env env, const AbilityInfo &abilityInfo)
{
TAG_LOGD(AAFwkTag::JSNAPI, "CreateAbilityInfo called");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value objContext = nullptr;
napi_create_object(env, &objContext);
if (objContext == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "CreateAbilityInfo, CreateObject failed");
TAG_LOGE(AAFwkTag::JSNAPI, "CreateObject failed");
return CreateJsUndefined(env);
}
if (!CheckTypeForNapiValue(env, objContext, napi_object)) {
TAG_LOGE(AAFwkTag::JSNAPI, "CreateAbilityInfo, ConvertNativeValueTo object error");
TAG_LOGE(AAFwkTag::JSNAPI, "ConvertNativeValueTo object error");
return CreateJsUndefined(env);
}
@ -994,7 +994,7 @@ napi_value JsNapiCommon::CreateAbilityInfo(
{
TAG_LOGD(AAFwkTag::JSNAPI, "called");
if (abilityInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "called");
TAG_LOGE(AAFwkTag::JSNAPI, "abilityInfo is nullptr");
return CreateJsUndefined(env);
}
@ -1067,12 +1067,12 @@ bool JsNapiCommon::UnwrapVerifyPermissionParams(napi_env env, napi_callback_info
flagCall = false;
} else if (argc == ARGS_TWO && !AppExecFwk::IsTypeForNapiValue(env, argv[PARAM1], napi_function)) {
if (!GetPermissionOptions(env, argv[PARAM1], options)) {
TAG_LOGW(AAFwkTag::JSNAPI, "input params string error");
TAG_LOGE(AAFwkTag::JSNAPI, "argc is 2, input params string error");
}
flagCall = false;
} else if (argc == ARGS_THREE) {
if (!GetPermissionOptions(env, argv[PARAM1], options)) {
TAG_LOGW(AAFwkTag::JSNAPI, "input params string error");
TAG_LOGE(AAFwkTag::JSNAPI, "argc is 3, input params string error");
}
}
@ -1138,7 +1138,7 @@ std::string JsNapiCommon::ConvertErrorCode(int32_t errCode)
napi_value JsNapiCommon::JsGetWant(napi_env env, napi_callback_info info, const AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
@ -1200,7 +1200,7 @@ napi_value JsNapiCommon::CreateWant(napi_env env, const std::shared_ptr<JsWant>
napi_value JsNapiCommon::JsTerminateAbility(napi_env env, NapiCallbackInfo& info)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
if (info.argc > ARGS_ONE) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s input params count error, argc=%{public}zu", __func__, info.argc);
return CreateJsUndefined(env);
@ -1233,19 +1233,19 @@ napi_value JsNapiCommon::JsTerminateAbility(napi_env env, NapiCallbackInfo& info
*/
bool UnwrapParamForWant(napi_env env, napi_value args, AbilityType, CallAbilityParam &param)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
bool ret = false;
napi_valuetype valueType = napi_undefined;
param.setting = nullptr;
NAPI_CALL_BASE(env, napi_typeof(env, args, &valueType), false);
if (valueType != napi_object) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, Wrong argument type.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type");
return false;
}
napi_value jsWant = GetPropertyValueByPropertyName(env, args, "want", napi_object);
if (jsWant == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, jsWant == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "jsWant == nullptr");
return false;
}
@ -1258,12 +1258,12 @@ bool UnwrapParamForWant(napi_env env, napi_value args, AbilityType, CallAbilityP
if (jsSettingObj != nullptr) {
param.setting = AbilityStartSetting::GetEmptySetting();
if (!UnwrapAbilityStartSetting(env, jsSettingObj, *(param.setting))) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, unwrap abilityStartSetting failed.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "unwrap abilityStartSetting failed");
}
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s abilityStartSetting", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "abilityStartSetting");
}
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return ret;
}
@ -1272,7 +1272,7 @@ void JsNapiCommon::SetJsStartAbilityExecuteCallback(std::shared_ptr<int32_t> &er
{
execute = [obj = this, value = errorVal, abilityType, paramObj = param, &observer = freeInstallObserver_] () {
if (*value != NAPI_ERR_NO_ERROR) {
TAG_LOGE(AAFwkTag::JSNAPI, "JsStartAbility params error!");
TAG_LOGE(AAFwkTag::JSNAPI, "JsStartAbility params error");
return;
}
@ -1305,10 +1305,10 @@ void JsNapiCommon::SetJsStartAbilityExecuteCallback(std::shared_ptr<int32_t> &er
}
#endif
if (paramObj->setting == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "param.setting == nullptr call StartAbility.");
TAG_LOGI(AAFwkTag::JSNAPI, "param.setting == nullptr call StartAbility");
*value = obj->ability_->StartAbility(paramObj->want);
} else {
TAG_LOGI(AAFwkTag::JSNAPI, "param.setting != nullptr call StartAbility.");
TAG_LOGI(AAFwkTag::JSNAPI, "param.setting != nullptr call StartAbility");
*value = obj->ability_->StartAbility(paramObj->want, *(paramObj->setting));
}
if ((paramObj->want.GetFlags() & Want::FLAG_INSTALL_ON_DEMAND) == Want::FLAG_INSTALL_ON_DEMAND &&
@ -1323,7 +1323,7 @@ void JsNapiCommon::SetJsStartAbilityExecuteCallback(std::shared_ptr<int32_t> &er
napi_value JsNapiCommon::JsStartAbility(napi_env env, napi_callback_info info, AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
auto errorVal = std::make_shared<int32_t>(static_cast<int32_t>(NAPI_ERR_NO_ERROR));
auto param = std::make_shared<CallAbilityParam>();
size_t argc = ARGS_MAX_COUNT;
@ -1334,7 +1334,7 @@ napi_value JsNapiCommon::JsStartAbility(napi_env env, napi_callback_info info, A
*errorVal = NAPI_ERR_PARAM_INVALID;
} else {
if (!UnwrapParamForWant(env, argv[PARAM0], abilityType, *param)) {
TAG_LOGE(AAFwkTag::JSNAPI, "call UnwrapParamForWant failed.");
TAG_LOGE(AAFwkTag::JSNAPI, "call UnwrapParamForWant failed");
*errorVal = NAPI_ERR_PARAM_INVALID;
}
}
@ -1372,18 +1372,18 @@ napi_value JsNapiCommon::JsStartAbility(napi_env env, napi_callback_info info, A
napi_value JsNapiCommon::JsGetExternalCacheDir(napi_env env, napi_callback_info info, AbilityType abilityType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t argc = ARGS_MAX_COUNT;
napi_value argv[ARGS_MAX_COUNT] = {nullptr};
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
if (argc > ARGS_ONE) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s input params count error, argc=%{public}zu", __func__, argc);
TAG_LOGE(AAFwkTag::JSNAPI, "input params count error, argc=%{public}zu", argc);
return CreateJsUndefined(env);
}
auto complete = [obj = this, abilityType](napi_env env, NapiAsyncTask &task, int32_t status) {
if (obj->ability_ == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetExternalCacheDir ability is nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "ability is nullptr");
task.RejectWithCustomize(
env,
CreateJsError(env, NAPI_ERR_ACE_ABILITY, "JsGetExternalCacheDir Failed"),
@ -1392,7 +1392,7 @@ napi_value JsNapiCommon::JsGetExternalCacheDir(napi_env env, napi_callback_info
}
if (!obj->CheckAbilityType(abilityType)) {
TAG_LOGE(AAFwkTag::JSNAPI, "JsGetExternalCacheDir abilityType is error");
TAG_LOGE(AAFwkTag::JSNAPI, "abilityType is error");
task.Reject(env, CreateJsError(env, NAPI_ERR_ABILITY_TYPE_INVALID, "JsGetExternalCacheDir Failed"));
return;
}
@ -1412,7 +1412,7 @@ void JsNapiCommon::AddFreeInstallObserver(napi_env env, const AAFwk::Want &want,
napi_value* result)
{
// adapter free install async return install and start result
TAG_LOGD(AAFwkTag::JSNAPI, "AddFreeInstallObserver start.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
int ret = 0;
if (freeInstallObserver_ == nullptr) {
freeInstallObserver_ = new JsFreeInstallObserver(env);
@ -1420,9 +1420,9 @@ void JsNapiCommon::AddFreeInstallObserver(napi_env env, const AAFwk::Want &want,
}
if (ret != ERR_OK) {
TAG_LOGE(AAFwkTag::JSNAPI, "AddFreeInstallObserver wrong.");
TAG_LOGE(AAFwkTag::JSNAPI, "AddFreeInstallObserver wrong");
} else {
TAG_LOGI(AAFwkTag::JSNAPI, "AddJsObserverObject");
TAG_LOGD(AAFwkTag::JSNAPI, "AddJsObserverObject called");
// build a callback observer with last param
std::string bundleName = want.GetElement().GetBundleName();
std::string abilityName = want.GetElement().GetAbilityName();

View File

@ -95,18 +95,18 @@ bool CheckAbilityType(AbilityType typeInAbility, AbilityType typeWant)
bool CheckAbilityType(const CBBase *cbBase)
{
if (cbBase == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s cbBase == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "cbBase == nullptr");
return false;
}
if (cbBase->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s cbBase->ability == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "cbBase->ability == nullptr");
return false;
}
const std::shared_ptr<AbilityInfo> info = cbBase->ability->GetAbilityInfo();
if (info == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s info == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "info == nullptr");
return false;
}
return CheckAbilityType((AbilityType)info->type, cbBase->abilityType);
@ -114,53 +114,53 @@ bool CheckAbilityType(const CBBase *cbBase)
bool CheckAbilityType(const AsyncJSCallbackInfo *asyncCallbackInfo)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s start.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "start");
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s asyncCallbackInfo == null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == null");
return false;
}
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability == null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability == null");
return false;
}
const std::shared_ptr<AbilityInfo> info = asyncCallbackInfo->ability->GetAbilityInfo();
if (info == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s info == null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "info == null");
return false;
}
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s exit.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "exit");
return CheckAbilityType((AbilityType)info->type, asyncCallbackInfo->abilityType);
}
bool CheckAbilityType(const AsyncCallbackInfo *asyncCallbackInfo)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s asyncCallbackInfo == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
return false;
}
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability == nullptr");
return false;
}
const std::shared_ptr<AbilityInfo> info = asyncCallbackInfo->ability->GetAbilityInfo();
if (info == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s info == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "info == nullptr");
return false;
}
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return CheckAbilityType((AbilityType)info->type, asyncCallbackInfo->abilityType);
}
napi_value GetContinueAbilityOptionsInfoCommon(
const napi_env &env, const napi_value &value, ContinueAbilityOptionsInfo &info)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value result = nullptr;
// reversible?: boolean
@ -174,14 +174,14 @@ napi_value GetContinueAbilityOptionsInfoCommon(
}
napi_get_null(env, &result);
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
napi_value GetContinueAbilityOptionsReversible(
const napi_env &env, const napi_value &value, ContinueAbilityOptionsInfo &info)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_valuetype valuetype = napi_undefined;
napi_value result = nullptr;
bool hasProperty = false;
@ -192,20 +192,20 @@ napi_value GetContinueAbilityOptionsReversible(
napi_get_named_property(env, value, "reversible", &result);
NAPI_CALL(env, napi_typeof(env, result, &valuetype));
if (valuetype != napi_boolean) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, Wrong argument type. Bool expected.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type. Bool expected");
return nullptr;
}
napi_get_value_bool(env, result, &reversible);
info.reversible = reversible;
}
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
napi_value GetContinueAbilityOptionsDeviceID(
const napi_env &env, const napi_value &value, ContinueAbilityOptionsInfo &info)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_valuetype valuetype = napi_undefined;
napi_value result = nullptr;
bool hasProperty = false;
@ -217,19 +217,19 @@ napi_value GetContinueAbilityOptionsDeviceID(
napi_get_named_property(env, value, "deviceId", &result);
NAPI_CALL(env, napi_typeof(env, result, &valuetype));
if (valuetype != napi_string) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, Wrong argument type. String expected.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type. String expected");
return nullptr;
}
NAPI_CALL(env, napi_get_value_string_utf8(env, result, str, STR_MAX_SIZE - 1, &strLen));
info.deviceId = str;
}
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
napi_value WrapAppInfo(napi_env env, const ApplicationInfo &appInfo)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value result = nullptr;
napi_value proValue = nullptr;
NAPI_CALL(env, napi_create_object(env, &result));
@ -264,7 +264,7 @@ napi_value WrapAppInfo(napi_env env, const ApplicationInfo &appInfo)
(void)WrapModuleInfos(env, appInfo, result);
NAPI_CALL(env, napi_create_string_utf8(env, appInfo.entryDir.c_str(), NAPI_AUTO_LENGTH, &proValue));
NAPI_CALL(env, napi_set_named_property(env, result, "entryDir", proValue));
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
@ -285,23 +285,23 @@ int32_t GetStartAbilityErrorCode(ErrCode innerErrorCode)
*/
void GetFilesDirExecuteCallback(napi_env, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s start", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "start");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s. asyncCallbackInfo is nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is nullptr");
return;
}
asyncCallbackInfo->error_code = NAPI_ERR_NO_ERROR;
asyncCallbackInfo->native_data.data_type = NVT_NONE;
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability == null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability == null");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
if (!CheckAbilityType(asyncCallbackInfo)) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s error ability type", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "error ability type");
asyncCallbackInfo->error_code = NAPI_ERR_ABILITY_TYPE_INVALID;
asyncCallbackInfo->native_data.data_type = NVT_UNDEFINED;
return;
@ -310,34 +310,34 @@ void GetFilesDirExecuteCallback(napi_env, void *data)
asyncCallbackInfo->native_data.data_type = NVT_STRING;
std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext = asyncCallbackInfo->ability->GetAbilityContext();
if (abilityContext == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s GetAbilityContext is null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "GetAbilityContext is null");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
asyncCallbackInfo->native_data.str_value = abilityContext->GetFilesDir();
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end. filesDir=%{public}s", __func__,
TAG_LOGI(AAFwkTag::JSNAPI, "end filesDir=%{public}s",
asyncCallbackInfo->native_data.str_value.c_str());
}
void IsUpdatingConfigurationsExecuteCallback(napi_env, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s begin", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "begin");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s. asyncCallbackInfo is null.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is null");
return;
}
asyncCallbackInfo->error_code = NAPI_ERR_NO_ERROR;
asyncCallbackInfo->native_data.data_type = NVT_NONE;
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability == nullptr");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
if (!CheckAbilityType(asyncCallbackInfo)) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s fail ability type", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "fail ability type");
asyncCallbackInfo->error_code = NAPI_ERR_ABILITY_TYPE_INVALID;
asyncCallbackInfo->native_data.data_type = NVT_UNDEFINED;
return;
@ -345,7 +345,7 @@ void IsUpdatingConfigurationsExecuteCallback(napi_env, void *data)
asyncCallbackInfo->native_data.data_type = NVT_BOOL;
asyncCallbackInfo->native_data.bool_value = asyncCallbackInfo->ability->IsUpdatingConfigurations();
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
}
/**
@ -356,23 +356,23 @@ void IsUpdatingConfigurationsExecuteCallback(napi_env, void *data)
*/
void PrintDrawnCompletedExecuteCallback(napi_env, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s enter", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s. asyncCallbackInfo is nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is nullptr");
return;
}
asyncCallbackInfo->error_code = NAPI_ERR_NO_ERROR;
asyncCallbackInfo->native_data.data_type = NVT_NONE;
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability == nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability == nullptr");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
if (!CheckAbilityType(asyncCallbackInfo)) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s fail ability type.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "fail ability type");
asyncCallbackInfo->error_code = NAPI_ERR_ABILITY_TYPE_INVALID;
asyncCallbackInfo->native_data.data_type = NVT_UNDEFINED;
return;
@ -380,29 +380,29 @@ void PrintDrawnCompletedExecuteCallback(napi_env, void *data)
asyncCallbackInfo->native_data.data_type = NVT_NONE;
asyncCallbackInfo->native_data.bool_value = asyncCallbackInfo->ability->PrintDrawnCompleted();
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
}
void GetOrCreateDistributedDirExecuteCallback(napi_env, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s. asyncCallbackInfo is nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is nullptr");
return;
}
asyncCallbackInfo->error_code = NAPI_ERR_NO_ERROR;
asyncCallbackInfo->native_data.data_type = NVT_NONE;
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability: nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability: nullptr");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
if (!CheckAbilityType(asyncCallbackInfo)) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s wrong type of ability", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "wrong type of ability");
asyncCallbackInfo->error_code = NAPI_ERR_ABILITY_TYPE_INVALID;
asyncCallbackInfo->native_data.data_type = NVT_UNDEFINED;
return;
@ -411,12 +411,12 @@ void GetOrCreateDistributedDirExecuteCallback(napi_env, void *data)
asyncCallbackInfo->native_data.data_type = NVT_STRING;
std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext = asyncCallbackInfo->ability->GetAbilityContext();
if (abilityContext == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s GetAbilityContext is nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "GetAbilityContext is nullptr");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
asyncCallbackInfo->native_data.str_value = abilityContext->GetDistributedFilesDir();
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end. filesDir=%{public}s", __func__,
TAG_LOGI(AAFwkTag::JSNAPI, "end filesDir=%{public}s",
asyncCallbackInfo->native_data.str_value.c_str());
}
@ -428,23 +428,23 @@ void GetOrCreateDistributedDirExecuteCallback(napi_env, void *data)
*/
void GetCacheDirExecuteCallback(napi_env, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "GetCacheDirExecuteCallback called");
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s. asyncCallbackInfo is null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is null");
return;
}
asyncCallbackInfo->error_code = NAPI_ERR_NO_ERROR;
asyncCallbackInfo->native_data.data_type = NVT_NONE;
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability: null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability: null");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
if (!CheckAbilityType(asyncCallbackInfo)) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s error type of ability", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "error type of ability");
asyncCallbackInfo->error_code = NAPI_ERR_ABILITY_TYPE_INVALID;
asyncCallbackInfo->native_data.data_type = NVT_UNDEFINED;
return;
@ -453,12 +453,12 @@ void GetCacheDirExecuteCallback(napi_env, void *data)
asyncCallbackInfo->native_data.data_type = NVT_STRING;
std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext = asyncCallbackInfo->ability->GetAbilityContext();
if (abilityContext == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s GetAbilityContext is nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "GetAbilityContext is nullptr");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
asyncCallbackInfo->native_data.str_value = abilityContext->GetCacheDir();
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end. CacheDir=%{public}s", __func__,
TAG_LOGI(AAFwkTag::JSNAPI, "end CacheDir=%{public}s",
asyncCallbackInfo->native_data.str_value.c_str());
}
@ -470,23 +470,23 @@ void GetCacheDirExecuteCallback(napi_env, void *data)
*/
void GetExternalCacheDirExecuteCallback(napi_env, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "GetExternalCacheDirExecuteCallback called");
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s. asyncCallbackInfo is nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is nullptr");
return;
}
asyncCallbackInfo->error_code = NAPI_ERR_NO_ERROR;
asyncCallbackInfo->native_data.data_type = NVT_NONE;
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s ability == null.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "ability == null");
asyncCallbackInfo->error_code = NAPI_ERR_ACE_ABILITY;
return;
}
if (!CheckAbilityType(asyncCallbackInfo)) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s wrong ability type.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "wrong ability type");
asyncCallbackInfo->error_code = NAPI_ERR_ABILITY_TYPE_INVALID;
asyncCallbackInfo->native_data.data_type = NVT_UNDEFINED;
return;
@ -494,7 +494,7 @@ void GetExternalCacheDirExecuteCallback(napi_env, void *data)
asyncCallbackInfo->native_data.data_type = NVT_STRING;
asyncCallbackInfo->native_data.str_value = asyncCallbackInfo->ability->GetExternalCacheDir();
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end. ExternalCacheDir=%{private}s", __func__,
TAG_LOGI(AAFwkTag::JSNAPI, "end ExternalCacheDir=%{private}s",
asyncCallbackInfo->native_data.str_value.c_str());
}
@ -507,7 +507,7 @@ void GetExternalCacheDirExecuteCallback(napi_env, void *data)
*/
AppTypeCB *CreateAppTypeCBInfo(napi_env env)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value global = nullptr;
NAPI_CALL(env, napi_get_global(env, &global));
@ -519,7 +519,7 @@ AppTypeCB *CreateAppTypeCBInfo(napi_env env)
AppTypeCB *appTypeCB = new (std::nothrow) AppTypeCB;
if (appTypeCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, appTypeCB == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "appTypeCB == nullptr");
return nullptr;
}
appTypeCB->cbBase.cbInfo.env = env;
@ -527,7 +527,7 @@ AppTypeCB *CreateAppTypeCBInfo(napi_env env)
appTypeCB->cbBase.deferred = nullptr;
appTypeCB->cbBase.ability = ability;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return appTypeCB;
}
@ -540,7 +540,7 @@ AppTypeCB *CreateAppTypeCBInfo(napi_env env)
*/
AbilityInfoCB *CreateAbilityInfoCBInfo(napi_env env)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value global = nullptr;
NAPI_CALL(env, napi_get_global(env, &global));
@ -552,7 +552,7 @@ AbilityInfoCB *CreateAbilityInfoCBInfo(napi_env env)
AbilityInfoCB *abilityInfoCB = new (std::nothrow) AbilityInfoCB;
if (abilityInfoCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, abilityInfoCB == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "abilityInfoCB == nullptr");
return nullptr;
}
abilityInfoCB->cbBase.cbInfo.env = env;
@ -560,7 +560,7 @@ AbilityInfoCB *CreateAbilityInfoCBInfo(napi_env env)
abilityInfoCB->cbBase.deferred = nullptr;
abilityInfoCB->cbBase.ability = ability;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return abilityInfoCB;
}
@ -655,7 +655,7 @@ napi_value BuildJsAbilityInfoNamedPropertySecond(napi_env env, const AbilityInfo
napi_value WrapAbilityInfo(napi_env env, const AbilityInfo &abilityInfo)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value result = nullptr;
napi_value proValue = nullptr;
NAPI_CALL(env, napi_create_object(env, &result));
@ -668,7 +668,7 @@ napi_value WrapAbilityInfo(napi_env env, const AbilityInfo &abilityInfo)
napi_value applicationInfo = nullptr;
applicationInfo = WrapAppInfo(env, abilityInfo.applicationInfo);
NAPI_CALL(env, napi_set_named_property(env, result, "applicationInfo", applicationInfo));
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
@ -724,7 +724,7 @@ napi_value ConvertAbilityInfo(napi_env env, const AbilityInfo &abilityInfo)
*/
HapModuleInfoCB *CreateHapModuleInfoCBInfo(napi_env env)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value global = nullptr;
NAPI_CALL(env, napi_get_global(env, &global));
@ -736,7 +736,7 @@ HapModuleInfoCB *CreateHapModuleInfoCBInfo(napi_env env)
HapModuleInfoCB *hapModuleInfoCB = new (std::nothrow) HapModuleInfoCB;
if (hapModuleInfoCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, hapModuleInfoCB == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "hapModuleInfoCB == nullptr");
return nullptr;
}
hapModuleInfoCB->cbBase.cbInfo.env = env;
@ -744,7 +744,7 @@ HapModuleInfoCB *CreateHapModuleInfoCBInfo(napi_env env)
hapModuleInfoCB->cbBase.deferred = nullptr;
hapModuleInfoCB->cbBase.ability = ability;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return hapModuleInfoCB;
}
@ -791,7 +791,7 @@ napi_value BuildJsHapModuleInfoNamedProperty(napi_env env, const HapModuleInfoCB
napi_value WrapHapModuleInfo(napi_env env, const HapModuleInfoCB &cb)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value result = nullptr;
napi_value proValue = nullptr;
NAPI_CALL(env, napi_create_object(env, &result));
@ -828,7 +828,7 @@ napi_value WrapHapModuleInfo(napi_env env, const HapModuleInfoCB &cb)
NAPI_CALL(env, napi_set_element(env, abilityInfos, i, abilityInfo));
}
NAPI_CALL(env, napi_set_named_property(env, result, "abilityInfo", abilityInfos));
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
@ -841,7 +841,7 @@ napi_value WrapHapModuleInfo(napi_env env, const HapModuleInfoCB &cb)
*/
AppVersionInfoCB *CreateAppVersionInfoCBInfo(napi_env env)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value global = nullptr;
NAPI_CALL(env, napi_get_global(env, &global));
@ -853,7 +853,7 @@ AppVersionInfoCB *CreateAppVersionInfoCBInfo(napi_env env)
AppVersionInfoCB *appVersionInfoCB = new (std::nothrow) AppVersionInfoCB;
if (appVersionInfoCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, appVersionInfoCB == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "appVersionInfoCB == nullptr");
return nullptr;
}
appVersionInfoCB->cbBase.cbInfo.env = env;
@ -861,23 +861,23 @@ AppVersionInfoCB *CreateAppVersionInfoCBInfo(napi_env env)
appVersionInfoCB->cbBase.deferred = nullptr;
appVersionInfoCB->cbBase.ability = ability;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return appVersionInfoCB;
}
void SaveAppVersionInfo(AppVersionInfo &appVersionInfo, const std::string appName, const std::string versionName,
const int32_t versionCode)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
appVersionInfo.appName = appName;
appVersionInfo.versionName = versionName;
appVersionInfo.versionCode = versionCode;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
}
napi_value WrapAppVersionInfo(napi_env env, const AppVersionInfoCB &appVersionInfoCB)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value result = nullptr;
napi_value proValue = nullptr;
NAPI_CALL(env, napi_create_object(env, &result));
@ -892,7 +892,7 @@ napi_value WrapAppVersionInfo(napi_env env, const AppVersionInfoCB &appVersionIn
NAPI_CALL(env, napi_create_int32(env, appVersionInfoCB.appVersionInfo.versionCode, &proValue));
NAPI_CALL(env, napi_set_named_property(env, result, "versionCode", proValue));
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
@ -905,7 +905,7 @@ napi_value WrapAppVersionInfo(napi_env env, const AppVersionInfoCB &appVersionIn
*/
AbilityNameCB *CreateAbilityNameCBInfo(napi_env env)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value global = nullptr;
NAPI_CALL(env, napi_get_global(env, &global));
@ -917,7 +917,7 @@ AbilityNameCB *CreateAbilityNameCBInfo(napi_env env)
AbilityNameCB *abilityNameCB = new (std::nothrow) AbilityNameCB;
if (abilityNameCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, abilityNameCB == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "abilityNameCB == nullptr");
return nullptr;
}
abilityNameCB->cbBase.cbInfo.env = env;
@ -925,20 +925,20 @@ AbilityNameCB *CreateAbilityNameCBInfo(napi_env env)
abilityNameCB->cbBase.deferred = nullptr;
abilityNameCB->cbBase.ability = ability;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return abilityNameCB;
}
napi_value WrapAbilityName(napi_env env, const AbilityNameCB *abilityNameCB)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (abilityNameCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, Invalid param(abilityNameCB == nullptr)", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Invalid param(abilityNameCB == nullptr)");
return nullptr;
}
napi_value result = nullptr;
NAPI_CALL(env, napi_create_string_utf8(env, abilityNameCB->name.c_str(), NAPI_AUTO_LENGTH, &result));
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, end.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "end");
return result;
}
@ -950,12 +950,12 @@ void UnwrapAbilityStartSettingForNumber(
bool isReadValue32 = false;
bool isReadDouble = false;
if (napi_get_value_int32(env, param, &natValue32) == napi_ok) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Property value=%{private}d.", __func__, natValue32);
TAG_LOGI(AAFwkTag::JSNAPI, "Property value=%{private}d.", natValue32);
isReadValue32 = true;
}
if (napi_get_value_double(env, param, &natValueDouble) == napi_ok) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Property value=%{private}lf.", __func__, natValueDouble);
TAG_LOGI(AAFwkTag::JSNAPI, "Property value=%{private}lf", natValueDouble);
isReadDouble = true;
}
@ -974,7 +974,7 @@ void UnwrapAbilityStartSettingForNumber(
bool UnwrapAbilityStartSetting(napi_env env, napi_value param, AAFwk::AbilityStartSetting &setting)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (!IsTypeForNapiValue(env, param, napi_object)) {
return false;
@ -986,7 +986,7 @@ bool UnwrapAbilityStartSetting(napi_env env, napi_value param, AAFwk::AbilitySta
NAPI_CALL_BASE(env, napi_get_property_names(env, param, &jsProNameList), false);
NAPI_CALL_BASE(env, napi_get_array_length(env, jsProNameList, &jsProCount), false);
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Property size: %{public}d.", __func__, jsProCount);
TAG_LOGI(AAFwkTag::JSNAPI, "Property size: %{public}d.", jsProCount);
napi_value jsProName = nullptr;
napi_value jsProValue = nullptr;
@ -994,14 +994,14 @@ bool UnwrapAbilityStartSetting(napi_env env, napi_value param, AAFwk::AbilitySta
NAPI_CALL_BASE(env, napi_get_element(env, jsProNameList, index, &jsProName), false);
std::string strProName = UnwrapStringFromJS(env, jsProName);
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Property name=%{public}s.", __func__, strProName.c_str());
TAG_LOGI(AAFwkTag::JSNAPI, "Property name=%{public}s.", strProName.c_str());
NAPI_CALL_BASE(env, napi_get_named_property(env, param, strProName.c_str(), &jsProValue), false);
NAPI_CALL_BASE(env, napi_typeof(env, jsProValue, &jsValueType), false);
switch (jsValueType) {
case napi_string: {
std::string natValue = UnwrapStringFromJS(env, jsProValue);
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Property value=%{private}s.", __func__,
TAG_LOGI(AAFwkTag::JSNAPI, "Property value=%{private}s",
natValue.c_str());
setting.AddProperty(strProName, natValue);
break;
@ -1009,7 +1009,7 @@ bool UnwrapAbilityStartSetting(napi_env env, napi_value param, AAFwk::AbilitySta
case napi_boolean: {
bool natValue = false;
NAPI_CALL_BASE(env, napi_get_value_bool(env, jsProValue, &natValue), false);
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Property value=%{public}s.", __func__,
TAG_LOGI(AAFwkTag::JSNAPI, "Property value=%{public}s.",
natValue ? "true" : "false");
setting.AddProperty(strProName, std::to_string(natValue));
break;
@ -1027,16 +1027,16 @@ bool UnwrapAbilityStartSetting(napi_env env, napi_value param, AAFwk::AbilitySta
bool UnwrapParamStopAbilityWrap(napi_env env, size_t argc, napi_value *argv, AsyncJSCallbackInfo *asyncCallbackInfo)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, argc=%{public}zu", __func__, argc);
TAG_LOGI(AAFwkTag::JSNAPI, "called argc=%{public}zu", argc);
const size_t argcMax = 2;
if (argc > argcMax || argc < argcMax - 1) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, Params is invalid.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid");
return false;
}
if (argc == argcMax) {
if (!CreateAsyncCallback(env, argv[PARAM1], asyncCallbackInfo)) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, the second parameter is invalid.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "the second parameter is invalid");
return false;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -35,8 +35,8 @@ bool InnerWrapConfigurationString(
napi_env env, napi_value jsObject, const std::string &key, const std::string &value)
{
if (!value.empty()) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. key=%{public}s, value=%{private}s",
__func__, key.c_str(), value.c_str());
TAG_LOGI(AAFwkTag::JSNAPI, "key=%{public}s, value=%{private}s",
key.c_str(), value.c_str());
napi_value jsValue = WrapStringToJS(env, value);
if (jsValue != nullptr) {
NAPI_CALL_BASE(env, napi_set_named_property(env, jsObject, key.c_str(), jsValue), false);
@ -80,7 +80,7 @@ napi_value WrapConfiguration(napi_env env, const AppExecFwk::Configuration &conf
std::string fontSizeScale = configuration.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_FONT_SIZE_SCALE);
jsValue = WrapDoubleToJS(env, fontSizeScale != "" ? std::stod(fontSizeScale) : 1.0);
SetPropertyValueByPropertyName(env, jsObject, "fontSizeScale", jsValue);
std::string fontWeightScale = configuration.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_FONT_WEIGHT_SCALE);
jsValue = WrapDoubleToJS(env, fontWeightScale != "" ? std::stod(fontWeightScale) : 1.0);
SetPropertyValueByPropertyName(env, jsObject, "fontWeightScale", jsValue);
@ -96,10 +96,10 @@ napi_value WrapConfiguration(napi_env env, const AppExecFwk::Configuration &conf
bool UnwrapConfiguration(napi_env env, napi_value param, Configuration &config)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (!IsTypeForNapiValue(env, param, napi_object)) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Params is invalid.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid");
return false;
}
@ -116,7 +116,7 @@ bool UnwrapConfiguration(napi_env env, napi_value param, Configuration &config)
if (UnwrapInt32ByPropertyName(env, param, "colorMode", colormode)) {
TAG_LOGD(AAFwkTag::JSNAPI, "The parsed colormode part %{public}d", colormode);
if (colormode != Global::Resource::DARK && colormode != Global::Resource::LIGHT) {
TAG_LOGE(AAFwkTag::JSNAPI, "Set colorMode to unsupported value.");
TAG_LOGE(AAFwkTag::JSNAPI, "Set colorMode to unsupported value");
return false;
}
if (!config.AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_COLORMODE, GetColorModeStr(colormode))) {

View File

@ -26,34 +26,34 @@ using namespace OHOS::AppExecFwk;
bool UnwrapExecuteParam(napi_env env, napi_value param, InsightIntentExecuteParam &executeParam)
{
if (!IsTypeForNapiValue(env, param, napi_object)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid.");
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid");
return false;
}
std::string bundleName {""};
if (!UnwrapStringByPropertyName(env, param, "bundleName", bundleName)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type bundleName.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type bundleName");
return false;
}
executeParam.bundleName_ = bundleName;
std::string moduleName {""};
if (!UnwrapStringByPropertyName(env, param, "moduleName", moduleName)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type moduleName.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type moduleName");
return false;
}
executeParam.moduleName_ = moduleName;
std::string abilityName {""};
if (!UnwrapStringByPropertyName(env, param, "abilityName", abilityName)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type abilityName.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type abilityName");
return false;
}
executeParam.abilityName_ = abilityName;
std::string insightIntentName {""};
if (!UnwrapStringByPropertyName(env, param, "insightIntentName", insightIntentName)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type insightIntentName.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type insightIntentName");
return false;
}
executeParam.insightIntentName_ = insightIntentName;
@ -61,7 +61,7 @@ bool UnwrapExecuteParam(napi_env env, napi_value param, InsightIntentExecutePara
napi_value napiIntentParam = nullptr;
napi_get_named_property(env, param, "insightIntentParam", &napiIntentParam);
if (napiIntentParam == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type insightIntentParam.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type insightIntentParam");
return false;
}
@ -73,14 +73,14 @@ bool UnwrapExecuteParam(napi_env env, napi_value param, InsightIntentExecutePara
}
auto wp = std::make_shared<WantParams>();
if (!AppExecFwk::UnwrapWantParams(env, napiIntentParam, *wp)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type intentParam.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type intentParam, Unwrap want fail");
return false;
}
executeParam.insightIntentParam_ = wp;
int32_t executeMode = 0;
if (!UnwrapInt32ByPropertyName(env, param, "executeMode", executeMode)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type executeMode.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type executeMode");
return false;
}
executeParam.executeMode_ = executeMode;
@ -89,10 +89,10 @@ bool UnwrapExecuteParam(napi_env env, napi_value param, InsightIntentExecutePara
if (executeMode == ExecuteMode::UI_ABILITY_FOREGROUND &&
UnwrapInt32ByPropertyName(env, param, "displayId", displayId)) {
if (displayId < 0) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument displayId.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument displayId");
return false;
}
TAG_LOGI(AAFwkTag::JSNAPI, "Get displayId %{public}d.", displayId);
TAG_LOGI(AAFwkTag::JSNAPI, "Get displayId %{public}d", displayId);
executeParam.displayId_ = displayId;
}

View File

@ -28,7 +28,7 @@ namespace AbilityRuntime {
using namespace OHOS::AppExecFwk;
bool UnwrapExecuteResult(napi_env env, napi_value param, InsightIntentExecuteResult &executeResult)
{
TAG_LOGD(AAFwkTag::JSNAPI, "called.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
if (!IsTypeForNapiValue(env, param, napi_valuetype::napi_object)) {
TAG_LOGE(AAFwkTag::JSNAPI, "UnwrapExecuteResult not object");
@ -36,7 +36,7 @@ bool UnwrapExecuteResult(napi_env env, napi_value param, InsightIntentExecuteRes
}
int32_t code = 0;
if (!UnwrapInt32ByPropertyName(env, param, "code", code)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Intent result must contain a code.");
TAG_LOGE(AAFwkTag::JSNAPI, "Intent result must contain a code");
return false;
}
executeResult.code = code;
@ -48,16 +48,16 @@ bool UnwrapExecuteResult(napi_env env, napi_value param, InsightIntentExecuteRes
napi_valuetype valueType = napi_undefined;
napi_typeof(env, result, &valueType);
if (valueType != napi_object) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type result.");
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type result");
return false;
}
auto wp = std::make_shared<AAFwk::WantParams>();
if (!AppExecFwk::UnwrapWantParams(env, result, *wp)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type result.");
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap want fail, Wrong argument type result");
return false;
}
if (!executeResult.CheckResult(wp)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Invalid intent result.");
TAG_LOGE(AAFwkTag::JSNAPI, "Invalid intent result");
return false;
}
executeResult.result = wp;

View File

@ -35,22 +35,22 @@ bool UnwrapProcessOptions(napi_env env, napi_value param, std::shared_ptr<AAFwk:
auto option = std::make_shared<AAFwk::ProcessOptions>();
int32_t processMode = 0;
if (!UnwrapInt32ByPropertyName(env, param, "processMode", processMode)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap processMode failed.");
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap processMode failed");
return false;
}
option->processMode = AAFwk::ProcessOptions::ConvertInt32ToProcessMode(processMode);
if (option->processMode == AAFwk::ProcessMode::UNSPECIFIED) {
TAG_LOGE(AAFwkTag::JSNAPI, "Convert processMode failed.");
TAG_LOGE(AAFwkTag::JSNAPI, "Convert processMode failed");
return false;
}
int32_t startupVisibility = 0;
if (!UnwrapInt32ByPropertyName(env, param, "startupVisibility", startupVisibility)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap startupVisibility failed.");
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap startupVisibility failed");
return false;
}
option->startupVisibility = AAFwk::ProcessOptions::ConvertInt32ToStartupVisibility(startupVisibility);
if (option->startupVisibility == AAFwk::StartupVisibility::UNSPECIFIED) {
TAG_LOGE(AAFwkTag::JSNAPI, "Convert startupVisibility failed.");
TAG_LOGE(AAFwkTag::JSNAPI, "Convert startupVisibility failed");
return false;
}
processOptions = option;
@ -64,7 +64,7 @@ bool UnwrapStartOptionsWithProcessOption(napi_env env, napi_value param, AAFwk::
{
UnwrapStartOptions(env, param, startOptions);
if (!UnwrapProcessOptions(env, param, startOptions.processOptions)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap processOptions failed.");
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap processOptions failed");
return false;
}
return true;
@ -72,10 +72,10 @@ bool UnwrapStartOptionsWithProcessOption(napi_env env, napi_value param, AAFwk::
bool UnwrapStartOptions(napi_env env, napi_value param, AAFwk::StartOptions &startOptions)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (!IsTypeForNapiValue(env, param, napi_object)) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Params is invalid.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid");
return false;
}
@ -130,7 +130,7 @@ bool UnwrapStartOptions(napi_env env, napi_value param, AAFwk::StartOptions &sta
bool UnwrapStartOptionsAndWant(napi_env env, napi_value param, AAFwk::StartOptions &startOptions, AAFwk::Want &want)
{
if (!IsTypeForNapiValue(env, param, napi_object)) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Params is invalid.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid");
return false;
}
napi_value jsValue = GetPropertyValueByPropertyName(env, param, "parameters", napi_object);

View File

@ -26,7 +26,7 @@ namespace OHOS {
namespace AppExecFwk {
bool IsTypeForNapiValue(napi_env env, napi_value param, napi_valuetype expectType)
{
TAG_LOGD(AAFwkTag::JSNAPI, "IsTypeForNapiValue start.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_valuetype valueType = napi_undefined;
if (param == nullptr) {
@ -43,7 +43,7 @@ bool IsTypeForNapiValue(napi_env env, napi_value param, napi_valuetype expectTyp
bool IsArrayForNapiValue(napi_env env, napi_value param, uint32_t &arraySize)
{
TAG_LOGD(AAFwkTag::JSNAPI, "IsArrayForNapiValue start.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
bool isArray = false;
arraySize = 0;
@ -280,7 +280,7 @@ bool UnwrapStringFromJS2(napi_env env, napi_value param, std::string &value)
napi_value WrapArrayInt32ToJS(napi_env env, const std::vector<int> &value)
{
TAG_LOGD(AAFwkTag::JSNAPI, "WrapArrayInt32ToJS start.");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
napi_value jsArray = nullptr;
napi_value jsValue = nullptr;
uint32_t index = 0;
@ -304,7 +304,7 @@ bool UnwrapArrayInt32FromJS(napi_env env, napi_value param, std::vector<int> &va
int natValue = 0;
if (!IsArrayForNapiValue(env, param, arraySize)) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS failed");
TAG_LOGD(AAFwkTag::JSNAPI, "arraySize Expanding ArrayInt32 from JS failed");
return false;
}
@ -313,7 +313,7 @@ bool UnwrapArrayInt32FromJS(napi_env env, napi_value param, std::vector<int> &va
jsValue = nullptr;
natValue = 0;
if (napi_get_element(env, param, i, &jsValue) != napi_ok) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS failed");
TAG_LOGD(AAFwkTag::JSNAPI, "array item Expanding ArrayInt32 from JS failed");
return false;
}
@ -351,7 +351,7 @@ bool UnwrapArrayLongFromJS(napi_env env, napi_value param, std::vector<long> &va
long natValue = 0;
if (!IsArrayForNapiValue(env, param, arraySize)) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS failed.");
TAG_LOGD(AAFwkTag::JSNAPI, "arraySize Expanding ArrayInt32 from JS failed.");
return false;
}
@ -360,7 +360,7 @@ bool UnwrapArrayLongFromJS(napi_env env, napi_value param, std::vector<long> &va
jsValue = nullptr;
natValue = 0;
if (napi_get_element(env, param, i, &jsValue) != napi_ok) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS failed.");
TAG_LOGD(AAFwkTag::JSNAPI, "array item Expanding ArrayInt32 from JS failed.");
return false;
}
@ -398,7 +398,7 @@ bool UnwrapArrayInt64FromJS(napi_env env, napi_value param, std::vector<int64_t>
int64_t natValue = 0;
if (!IsArrayForNapiValue(env, param, arraySize)) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS error");
TAG_LOGD(AAFwkTag::JSNAPI, "arraySize Expanding ArrayInt32 from JS error");
return false;
}
@ -407,7 +407,7 @@ bool UnwrapArrayInt64FromJS(napi_env env, napi_value param, std::vector<int64_t>
jsValue = nullptr;
natValue = 0;
if (napi_get_element(env, param, i, &jsValue) != napi_ok) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS error");
TAG_LOGD(AAFwkTag::JSNAPI, "array item Expanding ArrayInt32 from JS error");
return false;
}
@ -445,7 +445,7 @@ bool UnwrapArrayDoubleFromJS(napi_env env, napi_value param, std::vector<double>
double natValue = 0;
if (!IsArrayForNapiValue(env, param, arraySize)) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS error.");
TAG_LOGD(AAFwkTag::JSNAPI, "arraySize Expanding ArrayInt32 from JS error");
return false;
}
@ -454,7 +454,7 @@ bool UnwrapArrayDoubleFromJS(napi_env env, napi_value param, std::vector<double>
jsValue = nullptr;
natValue = 0;
if (napi_get_element(env, param, i, &jsValue) != napi_ok) {
TAG_LOGD(AAFwkTag::JSNAPI, "Expanding ArrayInt32 from JS error.");
TAG_LOGD(AAFwkTag::JSNAPI, "array item Expanding ArrayInt32 from JS error");
return false;
}
@ -852,7 +852,7 @@ napi_value GetCallbackErrorValue(napi_env env, int errCode)
*/
AsyncJSCallbackInfo *CreateAsyncJSCallbackInfo(napi_env env)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
napi_value global = nullptr;
NAPI_CALL(env, napi_get_global(env, &global));
@ -865,7 +865,7 @@ AsyncJSCallbackInfo *CreateAsyncJSCallbackInfo(napi_env env)
AsyncJSCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncJSCallbackInfo;
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, asyncCallbackInfo == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
return nullptr;
}
asyncCallbackInfo->cbInfo.env = env;
@ -947,16 +947,16 @@ bool WrapThreadReturnData(napi_env env, const ThreadReturnData *data, napi_value
*/
bool CreateAsyncCallback(napi_env env, napi_value param, AsyncJSCallbackInfo *callback)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (param == nullptr || callback == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, param or callback is null.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "param or callback is null");
return false;
}
callback->cbInfo.callback = CreateCallbackRefFromJS(env, param);
if (callback->cbInfo.callback == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, create ref failed.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "create ref failed");
return false;
}
@ -966,7 +966,7 @@ bool CreateAsyncCallback(napi_env env, napi_value param, AsyncJSCallbackInfo *ca
napi_ref CreateCallbackRefFromJS(napi_env env, napi_value param)
{
if (env == nullptr || param == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, env or param is null ", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "env or param is null");
return nullptr;
}
@ -974,7 +974,7 @@ napi_ref CreateCallbackRefFromJS(napi_env env, napi_value param)
NAPI_CALL(env, napi_typeof(env, param, &valueType));
if (valueType != napi_function) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, Param is invalid.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "Param is invalid");
return nullptr;
}
@ -994,9 +994,9 @@ napi_ref CreateCallbackRefFromJS(napi_env env, napi_value param)
*/
napi_value ExecuteAsyncCallbackWork(napi_env env, AsyncJSCallbackInfo *asyncCallbackInfo, const AsyncParamEx *param)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (asyncCallbackInfo == nullptr || param == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, asyncCallbackInfo or param is null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo or param is null");
return nullptr;
}
@ -1028,9 +1028,9 @@ napi_value ExecuteAsyncCallbackWork(napi_env env, AsyncJSCallbackInfo *asyncCall
*/
napi_value ExecutePromiseCallbackWork(napi_env env, AsyncJSCallbackInfo *asyncCallbackInfo, const AsyncParamEx *param)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (asyncCallbackInfo == nullptr || param == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, asyncCallbackInfo or param is null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo or param is null");
return nullptr;
}
@ -1063,11 +1063,11 @@ napi_value ExecutePromiseCallbackWork(napi_env env, AsyncJSCallbackInfo *asyncCa
*/
void CompleteAsyncCallbackWork(napi_env env, napi_status status, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, asyncCallbackInfo is nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is nullptr");
return;
}
@ -1093,10 +1093,10 @@ void CompleteAsyncCallbackWork(napi_env env, napi_status status, void *data)
void CompleteAsyncVoidCallbackWork(napi_env env, napi_status status, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, asyncCallbackInfo is null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is null");
return;
}
napi_value callback = nullptr;
@ -1133,11 +1133,11 @@ void CompleteAsyncVoidCallbackWork(napi_env env, napi_status status, void *data)
*/
void CompletePromiseCallbackWork(napi_env env, napi_status status, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, asyncCallbackInfo is nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is nullptr");
return;
}
@ -1156,11 +1156,11 @@ void CompletePromiseCallbackWork(napi_env env, napi_status status, void *data)
void CompletePromiseVoidCallbackWork(napi_env env, napi_status status, void *data)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncJSCallbackInfo *asyncCallbackInfo = static_cast<AsyncJSCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, asyncCallbackInfo is null", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo is null");
return;
}
napi_value result = nullptr;
@ -1208,7 +1208,7 @@ std::vector<std::string> ConvertStringVector(napi_env env, napi_value jsValue)
bool isTypedArray = false;
napi_status status = napi_is_typedarray(env, jsValue, &isTypedArray);
if (status != napi_ok || !isTypedArray) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s called, napi_is_typedarray error", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "napi_is_typedarray error");
return {};
}
@ -1218,7 +1218,7 @@ std::vector<std::string> ConvertStringVector(napi_env env, napi_value jsValue)
size_t offset = 0;
NAPI_CALL_BASE(env, napi_get_typedarray_info(env, jsValue, &type, &length, nullptr, &buffer, &offset), {});
if (type != napi_uint8_array) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s called, napi_uint8_array is nullptr", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "napi_uint8_array is nullptr");
return {};
}
std::string *data = nullptr;

View File

@ -268,7 +268,7 @@ bool InnerWrapWantParamsFloat(
bool InnerWrapWantParamsDouble(
napi_env env, napi_value jsObject, const std::string &key, const AAFwk::WantParams &wantParams)
{
TAG_LOGD(AAFwkTag::JSNAPI, "enter");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
auto value = wantParams.GetParam(key);
AAFwk::IDouble *ao = AAFwk::IDouble::Query(value);
if (ao == nullptr) {
@ -288,7 +288,7 @@ bool InnerWrapWantParamsDouble(
bool InnerWrapWantParamsWantParams(
napi_env env, napi_value jsObject, const std::string &key, const AAFwk::WantParams &wantParams)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called. key=%{public}s", __func__, key.c_str());
TAG_LOGD(AAFwkTag::JSNAPI, "called key=%{public}s", key.c_str());
auto value = wantParams.GetParam(key);
AAFwk::IWantParams *o = AAFwk::IWantParams::Query(value);
if (o == nullptr) {
@ -308,17 +308,17 @@ bool InnerWrapWantParamsWantParams(
bool InnerWrapWantParamsRemoteObject(
napi_env env, napi_value jsObject, const std::string &key, const AAFwk::WantParams &wantParams)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called. key=%{public}s", __func__, key.c_str());
TAG_LOGD(AAFwkTag::JSNAPI, "called key=%{public}s", key.c_str());
auto value = wantParams.GetParam(key);
AAFwk::IRemoteObjectWrap *remoteObjectIWrap = AAFwk::IRemoteObjectWrap::Query(value);
if (remoteObjectIWrap == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s remoteObjectIWrap is nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "remoteObjectIWrap is nullptr");
return false;
}
auto remoteObject = AAFwk::RemoteObjectWrap::UnBox(remoteObjectIWrap);
auto jsValue = NAPI_ohos_rpc_CreateJsRemoteObject(env, remoteObject);
if (jsValue == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s jsValue is nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "jsValue is nullptr");
return false;
}
@ -328,7 +328,7 @@ bool InnerWrapWantParamsRemoteObject(
bool InnerWrapWantParamsArrayChar(napi_env env, napi_value jsObject, const std::string &key, sptr<AAFwk::IArray> &ao)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
long size = 0;
if (ao->GetLength(size) != ERR_OK) {
return false;
@ -609,7 +609,7 @@ bool InnerWrapWantParamsArrayWantParams(napi_env env, napi_value jsObject,
bool InnerWrapWantParamsArray(napi_env env, napi_value jsObject, const std::string &key, sptr<AAFwk::IArray> &ao)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called. key=%{public}s", __func__, key.c_str());
TAG_LOGD(AAFwkTag::JSNAPI, "called key=%{public}s", key.c_str());
if (AAFwk::Array::IsStringArray(ao)) {
return InnerWrapWantParamsArrayString(env, jsObject, key, ao);
} else if (AAFwk::Array::IsBooleanArray(ao)) {
@ -698,7 +698,7 @@ bool InnerSetWantParamsArrayObject(napi_env env, const std::string &key,
bool InnerSetWantParamsArrayString(
const std::string &key, const std::vector<std::string> &value, AAFwk::WantParams &wantParams)
{
TAG_LOGD(AAFwkTag::JSNAPI, "InnerSetWantParamsArrayString enter");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IString);
if (ao != nullptr) {
@ -775,7 +775,7 @@ bool InnerSetWantParamsArrayDouble(
bool InnerUnwrapWantParamsArray(napi_env env, const std::string &key, napi_value param, AAFwk::WantParams &wantParams)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
ComplexArrayData natArrayValue;
if (!UnwrapArrayComplexFromJS(env, param, natArrayValue)) {
return false;
@ -804,7 +804,7 @@ bool InnerUnwrapWantParamsArray(napi_env env, const std::string &key, napi_value
bool InnerUnwrapWantParams(napi_env env, const std::string &key, napi_value param, AAFwk::WantParams &wantParams)
{
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called.", __func__);
TAG_LOGD(AAFwkTag::JSNAPI, "called");
AAFwk::WantParams wp;
if (UnwrapWantParams(env, param, wp)) {
@ -879,7 +879,7 @@ bool UnwrapWantParams(napi_env env, napi_value param, AAFwk::WantParams &wantPar
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s is filtered.", strProName.c_str());
continue;
}
TAG_LOGD(AAFwkTag::JSNAPI, "%{public}s called. Property name=%{public}s.", __func__, strProName.c_str());
TAG_LOGD(AAFwkTag::JSNAPI, "Property name=%{public}s.", strProName.c_str());
NAPI_CALL_BASE(env, napi_get_named_property(env, param, strProName.c_str(), &jsProValue), false);
NAPI_CALL_BASE(env, napi_typeof(env, jsProValue, &jsValueType), false);
@ -959,7 +959,7 @@ bool IsSpecialObject(napi_env env, napi_value param, std::string &strProName, st
NAPI_CALL_BASE(env, napi_get_array_length(env, jsProNameList, &jsProCount), false);
if (jsProCount != PROPERTIES_SIZE) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s called, size is invalid, this object is not fd object.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "size is invalid, this object is not fd object");
return false;
}
@ -969,7 +969,7 @@ bool IsSpecialObject(napi_env env, napi_value param, std::string &strProName, st
false);
NAPI_CALL_BASE(env, napi_typeof(env, jsProValue, &jsValueType), false);
if (jsValueType != jsValueProType) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s called, value property is invalid, this object is not fd object.",
TAG_LOGE(AAFwkTag::JSNAPI, "value property is invalid, this object is not fd object",
__func__);
return false;
}
@ -987,7 +987,7 @@ bool HandleFdObject(napi_env env, napi_value param, std::string &strProName, AAF
int32_t natValue32 = 0;
napi_get_value_int32(env, jsProValue, &natValue32);
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called, fd:%{public}d.", __func__, natValue32);
TAG_LOGI(AAFwkTag::JSNAPI, "fd:%{public}d", natValue32);
WantParams wp;
wp.SetParam(TYPE_PROPERTY, String::Box(FD));
wp.SetParam(VALUE_PROPERTY, Integer::Box(natValue32));
@ -1006,7 +1006,7 @@ bool HandleRemoteObject(napi_env env, napi_value param, std::string &strProName,
sptr<IRemoteObject> remoteObject = NAPI_ohos_rpc_getNativeRemoteObject(env, jsProValue);
if (remoteObject == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s called, transfer to remoteObject fail", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "transfer to remoteObject fail");
return false;
}
@ -1072,7 +1072,7 @@ napi_value WrapWant(napi_env env, const Want &want)
napi_value jsElementName = WrapElementName(env, want.GetElement());
if (jsElementName == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Invoke WrapElementName failed.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "Invoke WrapElementName failed");
return nullptr;
}
@ -1121,7 +1121,7 @@ napi_value WrapWant(napi_env env, const Want &want)
bool UnwrapWant(napi_env env, napi_value param, Want &want)
{
if (!IsTypeForNapiValue(env, param, napi_object)) {
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. Params is invalid.", __func__);
TAG_LOGI(AAFwkTag::JSNAPI, "Params is invalid");
return false;
}
@ -1291,7 +1291,7 @@ bool InnerWrapJsWantParamsWantParams(
bool WrapJsWantParamsArray(napi_env env, napi_value object, const std::string &key, sptr<AAFwk::IArray> &ao)
{
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s called. key=%{public}s", __func__, key.c_str());
TAG_LOGI(AAFwkTag::JSNAPI, "called key=%{public}s", key.c_str());
if (AAFwk::Array::IsStringArray(ao)) {
return InnerWrapWantParamsArray<AAFwk::IString, AAFwk::String, std::string>(
env, object, key, ao);

View File

@ -29,7 +29,7 @@ bool UnwrapOpenLinkOptions(napi_env env, napi_value param, AAFwk::OpenLinkOption
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (!IsTypeForNapiValue(env, param, napi_object)) {
TAG_LOGI(AAFwkTag::JSNAPI, "Params is invalid.");
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid");
return false;
}