From e1b2add2def49f5f29df50daf0040c22fbf63a16 Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Tue, 22 Jul 2025 16:21:48 +0800 Subject: [PATCH] upd want agent Signed-off-by: zhangzezhong --- .../ets/ani/wantagent/src/ani_want_agent.cpp | 26 +++++++++---------- .../ets/ets/wantAgent/wantAgentInfo.ets | 4 --- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/frameworks/ets/ani/wantagent/src/ani_want_agent.cpp b/frameworks/ets/ani/wantagent/src/ani_want_agent.cpp index db2bd736cdb..ce4634f7dcf 100644 --- a/frameworks/ets/ani/wantagent/src/ani_want_agent.cpp +++ b/frameworks/ets/ani/wantagent/src/ani_want_agent.cpp @@ -373,7 +373,7 @@ int32_t EtsWantAgent::GetWantAgentParam(ani_env *env, ani_object info, WantAgent TAG_LOGE(AAFwkTag::WANTAGENT, "wants GetProperty status: %{public}d, or null wantsRef", status); return PARAMETER_ERROR; } - ani_array_ref wantsArr = reinterpret_cast(wantsRef); + ani_array wantsArr = reinterpret_cast(wantsRef); ani_size length = 0; if ((status = env->Array_GetLength(wantsArr, &length)) != ANI_OK) { TAG_LOGE(AAFwkTag::WANTAGENT, "wants Array_GetLength failed status: %{public}d", status); @@ -381,8 +381,8 @@ int32_t EtsWantAgent::GetWantAgentParam(ani_env *env, ani_object info, WantAgent } for (size_t i = 0; i < length; i++) { ani_ref wantRef = nullptr; - if ((status = env->Array_Get_Ref(wantsArr, i, &wantRef)) != ANI_OK || wantRef == nullptr) { - TAG_LOGE(AAFwkTag::WANTAGENT, "Array_Get_Ref failed status: %{public}d, or null wantRef", status); + if ((status = env->Array_Get(wantsArr, i, &wantRef)) != ANI_OK || wantRef == nullptr) { + TAG_LOGE(AAFwkTag::WANTAGENT, "Array_Get failed status: %{public}d, or null wantRef", status); return PARAMETER_ERROR; } std::shared_ptr want = std::make_shared(); @@ -395,8 +395,8 @@ int32_t EtsWantAgent::GetWantAgentParam(ani_env *env, ani_object info, WantAgent ani_boolean isUndefined = true; ani_ref actionTypeRef = nullptr; - if (!GetPropertyRef(env, info, "actionType", actionTypeRef, isUndefined) || actionTypeRef == nullptr) { - TAG_LOGE(AAFwkTag::WANTAGENT, "GetPropertyRef failed, or null actionTypeRef"); + if (!GetPropertyRef(env, info, "actionType", actionTypeRef, isUndefined)) { + TAG_LOGE(AAFwkTag::WANTAGENT, "actionType GetPropertyRef failed"); return PARAMETER_ERROR; } if (!isUndefined) { @@ -406,18 +406,18 @@ int32_t EtsWantAgent::GetWantAgentParam(ani_env *env, ani_object info, WantAgent ani_double dRequestCode = 0.0; if ((status = env->Object_GetPropertyByName_Double(info, "requestCode", &dRequestCode)) != ANI_OK) { - TAG_LOGE(AAFwkTag::WANTAGENT, "Object_GetPropertyByName_Double failed status: %{public}d", status); + TAG_LOGE(AAFwkTag::WANTAGENT, "requestCode GetProperty failed status: %{public}d", status); return PARAMETER_ERROR; } params.requestCode = dRequestCode; ani_ref actionFlagsRef = nullptr; - if (!GetPropertyRef(env, info, "actionFlags", actionFlagsRef, isUndefined) || actionFlagsRef == nullptr) { - TAG_LOGE(AAFwkTag::WANTAGENT, "GetPropertyRef failed, or null actionFlagsRef"); + if (!GetPropertyRef(env, info, "actionFlags", actionFlagsRef, isUndefined)) { + TAG_LOGE(AAFwkTag::WANTAGENT, "actionFlags GetPropertyRef failed"); return PARAMETER_ERROR; } - ani_array_ref actionFlagsArr = reinterpret_cast(actionFlagsRef); if (!isUndefined) { + ani_array actionFlagsArr = reinterpret_cast(actionFlagsRef); ani_size actionFlagsLen = 0; if ((status = env->Array_GetLength(actionFlagsArr, &actionFlagsLen)) != ANI_OK) { TAG_LOGE(AAFwkTag::WANTAGENT, "Array_GetLength failed status: %{public}d", status); @@ -425,9 +425,9 @@ int32_t EtsWantAgent::GetWantAgentParam(ani_env *env, ani_object info, WantAgent } for (size_t i = 0; i < actionFlagsLen; i++) { ani_ref actionFlagRef = nullptr; - if ((status = env->Array_Get_Ref(actionFlagsArr, i, &actionFlagRef)) != ANI_OK || + if ((status = env->Array_Get(actionFlagsArr, i, &actionFlagRef)) != ANI_OK || actionFlagRef == nullptr) { - TAG_LOGE(AAFwkTag::WANTAGENT, "Array_Get_Ref failed status: %{public}d, or null actionFlagRef", status); + TAG_LOGE(AAFwkTag::WANTAGENT, "Array_Get failed status: %{public}d, or null actionFlagRef", status); return PARAMETER_ERROR; } int32_t actionFlag = 0; @@ -439,12 +439,12 @@ int32_t EtsWantAgent::GetWantAgentParam(ani_env *env, ani_object info, WantAgent ani_ref extraInfoRef = nullptr; if (!GetPropertyRef(env, info, "extraInfos", extraInfoRef, isUndefined)) { - TAG_LOGE(AAFwkTag::WANTAGENT, "GetPropertyRef failed"); + TAG_LOGE(AAFwkTag::WANTAGENT, "extraInfos GetPropertyRef failed"); return PARAMETER_ERROR; } if (isUndefined) { if (!GetPropertyRef(env, info, "extraInfo", extraInfoRef, isUndefined)) { - TAG_LOGE(AAFwkTag::WANTAGENT, "GetPropertyRef failed"); + TAG_LOGE(AAFwkTag::WANTAGENT, "extraInfo GetPropertyRef failed"); return PARAMETER_ERROR; } } diff --git a/frameworks/ets/ets/wantAgent/wantAgentInfo.ets b/frameworks/ets/ets/wantAgent/wantAgentInfo.ets index 4487de50bf1..ae0859b67e6 100644 --- a/frameworks/ets/ets/wantAgent/wantAgentInfo.ets +++ b/frameworks/ets/ets/wantAgent/wantAgentInfo.ets @@ -19,10 +19,8 @@ import type abilityWantAgent from '@ohos.app.ability.wantAgent'; export interface WantAgentInfo { wants: Array; - operationType?: wantAgent.OperationType; actionType?: abilityWantAgent.OperationType; requestCode: number; - wantAgentFlags?: Array; actionFlags?: Array; extraInfo?: Record; extraInfos?: Record; @@ -30,10 +28,8 @@ export interface WantAgentInfo { class WantAgentInfoImpl implements WantAgentInfo { public wants: Array; - public operationType?: wantAgent.OperationType; public actionType?: abilityWantAgent.OperationType; public requestCode: number; - public wantAgentFlags?: Array; public actionFlags?: Array; public extraInfo?: Record; public extraInfos?: Record; -- Gitee