From 1a92d462d37b8d099467c39dcb2ef9606cb857f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E5=87=AF?= Date: Mon, 19 May 2025 16:03:48 +0800 Subject: [PATCH] =?UTF-8?q?C-API=20scope=E9=9C=80=E6=B1=82=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘永凯 Change-Id: I11572b1f483752d94f5ed5532b89a96bd698cad4 --- arkui/ace_engine/native/libace.ndk.json | 4 ++++ arkui/ace_engine/native/native_node.h | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 5b65e0b01..3db06e7d2 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3339,6 +3339,10 @@ "first_introduced": "20", "name": "OH_ArkUI_EmbeddedComponentOption_SetOnError" }, + { + "first_introduced": "20", + "name": "OH_ArkUI_RunTaskInScope" + }, { "first_introduced": "20", "name": "OH_ArkUI_EmbeddedComponentOption_SetOnTerminated" diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 1ae255fea..a73e71c42 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -9423,6 +9423,21 @@ ArkUI_ErrorCode OH_ArkUI_AddSupportedUIStates(ArkUI_NodeHandle node, int32_t uiS */ ArkUI_ErrorCode OH_ArkUI_RemoveSupportedUIStates(ArkUI_NodeHandle node, int32_t uiStates); +/** + * @brief Run a custom function inside the UIContext scope. + * + * @param uiContext Indicates the pointer to a UI instance. + * @param userData Indicates the pointer to the custom data. + * @param callback The custom function. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error. + * Returns {@link ARKUI_ERROR_CODE_UI_CONTEXT_INVALID} if the uiContext is invalid. + * Returns {@link ARKUI_ERROR_CODE_CALLBACK_INVALID} if the callback function is invalid. + * @since 20 + */ +int32_t OH_ArkUI_RunTaskInScope(ArkUI_ContextHandle uiContext, void* userData, void(*callback)(void* userData)); + #ifdef __cplusplus }; #endif -- Gitee