Signed-off-by: sodanotgreen <limengzheng@huawei.com>
This commit is contained in:
sodanotgreen
2024-07-30 14:12:28 +08:00
parent aad4dc5cdb
commit d5f0318b0a
10 changed files with 26 additions and 26 deletions
@@ -32,7 +32,7 @@ const uint8_t NUMBER_OF_PARAMETERS_THREE = 3;
napi_value ExecuteModeInit(napi_env env)
{
if (env == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "Invalid input parameters");
TAG_LOGE(AAFwkTag::INTENT, "null env");
return nullptr;
}
napi_value objValue = nullptr;
@@ -54,7 +54,7 @@ napi_value JsInsightIntentInit(napi_env env, napi_value exportObj)
{
TAG_LOGD(AAFwkTag::INTENT, "called");
if (env == nullptr || exportObj == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "Invalid input parameters");
TAG_LOGE(AAFwkTag::INTENT, "null env or exportObj");
return nullptr;
}
@@ -96,7 +96,7 @@ private:
{
TAG_LOGD(AAFwkTag::INTENT, "called");
if (info.argc < ARGC_ONE) {
TAG_LOGE(AAFwkTag::INTENT, "Params not match");
TAG_LOGE(AAFwkTag::INTENT, "invalid argc");
ThrowTooFewParametersError(env);
return CreateJsUndefined(env);
}
@@ -23,7 +23,7 @@
namespace OHOS::AbilityRuntime {
std::shared_ptr<InsightIntentExecutor> InsightIntentExecutor::Create(Runtime& runtime)
{
TAG_LOGD(AAFwkTag::INTENT, "InsightIntentExecutor Create runtime");
TAG_LOGD(AAFwkTag::INTENT, "called");
switch (runtime.GetLanguage()) {
case Runtime::Language::JS:
return static_cast<std::shared_ptr<InsightIntentExecutor>>(JsInsightIntentExecutor::Create(
@@ -37,7 +37,7 @@ bool InsightIntentExecutor::Init(const InsightIntentExecutorInfo& intentInfo)
{
auto executeParam = intentInfo.executeParam;
if (executeParam == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "executeParam is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null executeParam");
return false;
}
@@ -22,12 +22,12 @@ namespace OHOS {
namespace AbilityRuntime {
InsightIntentExecutorMgr::InsightIntentExecutorMgr()
{
TAG_LOGD(AAFwkTag::INTENT, "constructor");
TAG_LOGD(AAFwkTag::INTENT, "called");
}
InsightIntentExecutorMgr::~InsightIntentExecutorMgr()
{
TAG_LOGI(AAFwkTag::INTENT, "deconstructor");
TAG_LOGI(AAFwkTag::INTENT, "called");
}
bool InsightIntentExecutorMgr::ExecuteInsightIntent(Runtime& runtime, const InsightIntentExecutorInfo& executeInfo,
@@ -36,7 +36,7 @@ bool InsightIntentExecutorMgr::ExecuteInsightIntent(Runtime& runtime, const Insi
TAG_LOGD(AAFwkTag::INTENT, "called");
auto executeParam = executeInfo.executeParam;
if (executeParam == nullptr || executeParam->insightIntentParam_ == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "executeParam == nullptr or insightIntentParam_ == nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null executeParam or insightIntentParam_");
TriggerCallbackInner(std::move(callback), static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM));
return false;
}
@@ -47,7 +47,7 @@ bool InsightIntentExecutorMgr::ExecuteInsightIntent(Runtime& runtime, const Insi
TAG_LOGD(AAFwkTag::INTENT, "called");
auto executorMgr = weak.lock();
if (executorMgr == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "executorMgr == nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null executorMgr");
return;
}
executorMgr->RemoveInsightIntentExecutor(intentId);
@@ -57,7 +57,7 @@ bool InsightIntentExecutorMgr::ExecuteInsightIntent(Runtime& runtime, const Insi
// Create insight intent executor
auto intentExecutor = InsightIntentExecutor::Create(runtime);
if (intentExecutor == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "intentExecutor == nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null intentExecutor");
TriggerCallbackInner(std::move(callback), static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM));
return false;
}
@@ -51,7 +51,7 @@ JsInsightIntentExecutor::JsInsightIntentExecutor(JsRuntime& runtime) : runtime_(
JsInsightIntentExecutor::~JsInsightIntentExecutor()
{
state_ = State::DESTROYED;
TAG_LOGI(AAFwkTag::INTENT, "JsInsightIntentExecutor destructor");
TAG_LOGI(AAFwkTag::INTENT, "called");
}
bool JsInsightIntentExecutor::Init(const InsightIntentExecutorInfo& insightIntentInfo)
@@ -64,26 +64,26 @@ bool JsInsightIntentExecutor::Init(const InsightIntentExecutorInfo& insightInten
HandleScope handleScope(runtime_);
jsObj_ = JsInsightIntentExecutor::LoadJsCode(insightIntentInfo, runtime_);
if (jsObj_ == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "jsObj_ is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null jsObj_");
STATE_PATTERN_NAIVE_STATE_SET_AND_RETURN(State::INVALID, false);
}
auto env = runtime_.GetNapiEnv();
if (env == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "env == nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null env");
STATE_PATTERN_NAIVE_STATE_SET_AND_RETURN(State::INVALID, false);
}
auto context = GetContext();
if (context == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "Context is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null Context");
STATE_PATTERN_NAIVE_STATE_SET_AND_RETURN(State::INVALID, false);
}
napi_value contextObj = CreateJsInsightIntentContext(env, context);
contextObj_ = JsRuntime::LoadSystemModuleByEngine(env, "app.ability.InsightIntentContext", &contextObj, 1);
if (contextObj_ == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "contextObj_ == nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null contextObj_");
STATE_PATTERN_NAIVE_STATE_SET_AND_RETURN(State::INVALID, false);
}
@@ -167,7 +167,7 @@ std::unique_ptr<NativeReference> JsInsightIntentExecutor::LoadJsCode(
TAG_LOGD(AAFwkTag::INTENT, "called");
auto executeParam = info.executeParam;
if (executeParam == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "executeParam == nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null executeParam");
return std::unique_ptr<NativeReference>();
}
@@ -119,7 +119,7 @@ napi_value CreateJsInsightIntentContext(napi_env env, const std::shared_ptr<Insi
bool CheckStartAbilityParam(napi_env env, NapiCallbackInfo& info, AAFwk::Want& want)
{
if (info.argc == 0) {
TAG_LOGE(AAFwkTag::INTENT, "not enough args");
TAG_LOGE(AAFwkTag::INTENT, "invalid argc");
ThrowTooFewParametersError(env);
return false;
}
@@ -44,7 +44,7 @@ void InsightIntentExecuteCallbackProxy::OnExecuteDone(uint64_t key, int32_t resu
}
sptr<IRemoteObject> remote = Remote();
if (remote == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "remote == nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null remote");
return;
}
@@ -46,7 +46,7 @@ int32_t InsightIntentExecuteCallbackStub::OnExecuteDoneInner(MessageParcel &data
std::shared_ptr<AppExecFwk::InsightIntentExecuteResult> executeResult(
data.ReadParcelable<AppExecFwk::InsightIntentExecuteResult>());
if (executeResult == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "executeResult is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null executeResult");
return ERR_INVALID_VALUE;
}
OnExecuteDone(key, resultCode, *executeResult);
@@ -38,7 +38,7 @@ void InsightIntentExecuteRecipient::OnRemoteDied(const wptr<OHOS::IRemoteObject>
TAG_LOGD(AAFwkTag::INTENT, "InsightIntentExecuteRecipient OnRemoteDied, %{public}" PRIu64, intentId_);
auto object = remote.promote();
if (object == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "remote object is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null remote object");
return;
}
DelayedSingleton<InsightIntentExecuteManager>::GetInstance()->RemoteDied(intentId_);
@@ -56,11 +56,11 @@ int32_t InsightIntentExecuteManager::CheckAndUpdateParam(uint64_t key, const spt
return result;
}
if (callerToken == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "callerToken is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null callerToken");
return ERR_INVALID_VALUE;
}
if (param == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "param is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null param");
return ERR_INVALID_VALUE;
}
if (param->bundleName_.empty() || param->moduleName_.empty() || param->abilityName_.empty() ||
@@ -93,7 +93,7 @@ int32_t InsightIntentExecuteManager::CheckAndUpdateWant(Want &want, ExecuteMode
auto srcEntry = AbilityRuntime::InsightIntentUtils::GetSrcEntry(elementName.GetBundleName(),
elementName.GetModuleName(), want.GetStringParam(INSIGHT_INTENT_EXECUTE_PARAM_NAME));
if (srcEntry.empty()) {
TAG_LOGE(AAFwkTag::INTENT, "srcEntry is empty");
TAG_LOGE(AAFwkTag::INTENT, "empty srcEntry");
return ERR_INVALID_VALUE;
}
want.SetParam(INSIGHT_INTENT_SRC_ENTRY, srcEntry);
@@ -208,7 +208,7 @@ int32_t InsightIntentExecuteManager::GenerateWant(
const std::shared_ptr<AppExecFwk::InsightIntentExecuteParam> &param, Want &want)
{
if (param == nullptr) {
TAG_LOGE(AAFwkTag::INTENT, "param is nullptr");
TAG_LOGE(AAFwkTag::INTENT, "null param");
return ERR_INVALID_VALUE;
}
want.SetElementName("", param->bundleName_, param->abilityName_, param->moduleName_);
@@ -251,7 +251,7 @@ int32_t InsightIntentExecuteManager::IsValidCall(const Want &want)
{
std::string insightIntentName = want.GetStringParam(INSIGHT_INTENT_EXECUTE_PARAM_NAME);
if (insightIntentName.empty()) {
TAG_LOGE(AAFwkTag::INTENT, "insightIntentName is empty");
TAG_LOGE(AAFwkTag::INTENT, "empty insightIntentName");
return ERR_INVALID_VALUE;
}
TAG_LOGD(AAFwkTag::INTENT, "insightIntentName: %{public}s", insightIntentName.c_str());
@@ -79,7 +79,7 @@ bool InsightIntentExecuteParam::GenerateFromWant(const AAFwk::Want &want,
{
const WantParams &wantParams = want.GetParams();
if (!wantParams.HasParam(INSIGHT_INTENT_EXECUTE_PARAM_NAME)) {
TAG_LOGE(AAFwkTag::INTENT, "The want is empty");
TAG_LOGE(AAFwkTag::INTENT, "empty want");
return false;
}