From 4a72a92b9525cc539ee7161e6bf2090d7d222794 Mon Sep 17 00:00:00 2001 From: wangyang2022 Date: Mon, 21 Apr 2025 03:40:28 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9ECAPI=E5=B9=B6=E8=A1=8C?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3api=20Signed-off-by:=20wangyang2022?= =?UTF-8?q?=20=20Change-Id:=20I776ed483a14de59aecc?= =?UTF-8?q?074f021c9ae7261b0fb83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arkui/ace_engine/native/libace.ndk.json | 8 +++++++ arkui/ace_engine/native/native_interface.h | 5 ++++ arkui/ace_engine/native/native_node.h | 28 ++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 5 ++++ 4 files changed, 46 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index c80fc0750..b9d1cdc16 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3290,5 +3290,13 @@ { "first_introduced": "18", "name": "OH_ArkUI_XComponent_IsInitialized" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_PostAsyncUITask" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_PostUITask" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_interface.h b/arkui/ace_engine/native/native_interface.h index 64cae7e06..0b91544ff 100644 --- a/arkui/ace_engine/native/native_interface.h +++ b/arkui/ace_engine/native/native_interface.h @@ -57,6 +57,11 @@ typedef enum { ARKUI_NATIVE_GESTURE, /** API related to animations. For details, see the struct definition in .*/ ARKUI_NATIVE_ANIMATE, + /** + * API related to supported multi thread UI components. + * For details, see the struct definition in . + */ + ARKUI_MULTI_THREAD_NATIVE_NODE, } ArkUI_NativeAPIVariantKind; /** diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 68e034586..04bdc80e8 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -9219,6 +9219,34 @@ int32_t OH_ArkUI_GetNodeSnapshot(ArkUI_NodeHandle node, ArkUI_SnapshotOptions* s */ int32_t OH_ArkUI_NodeUtils_GetPositionToParent(ArkUI_NodeHandle node, ArkUI_IntOffset* globalOffset); +/** + * @brief Post UI task to background threads. + * + * @param context UIContext pointer of the page where the UI task located. + * @param asyncUITaskData Parameter of asyncUITask and onFinish. + * @param asyncUITask Function executed by a background thread. + * @param onFinish Function executed by UI thread after async UI task is executed. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_PostAsyncUITask(ArkUI_ContextHandle context, void* asyncUITaskData, + void (*asyncUITask)(void* asyncUITaskData), void (*onFinish)(void* asyncUITaskData)); + +/** + * @brief Post UI task to UI thread. + * + * @param context UIContext pointer of the page where the UI task located. + * @param taskData Parameter of task. + * @param task Function executed by UI thread. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_PostUITask(ArkUI_ContextHandle context, void* taskData, void (*task)(void* taskData)); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 64676cb95..956e3e581 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -2173,6 +2173,11 @@ typedef enum { * @since 15 */ ARKUI_ERROR_CODE_NODE_NOT_ON_MAIN_TREE = 106203, + /** + * @error The node is running on invalid thread. + * @since 18 + */ + ARKUI_ERROR_CODE_NODE_ON_INVALID_THREAD = 106204, /** * @error The node requesting focus is not focusable. * @since 15 -- Gitee