diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index c80fc0750649e90dbc180d82275ce63ba87c42dc..b9d1cdc1647cc9db61d004af63d80e67a2dcb246 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 64cae7e06ea74db39542281356b42f0bcb425b82..0b91544ff8d6bab9ccb26820dc7c3f80e8264b56 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 68e03458616775fbe8bbef56770b4b4334f26cdb..04bdc80e81d8b600a3a5efed63cd7ae5be432516 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 64676cb956567bca6b4a76e163dd7889c41599f8..956e3e581726409fee760e64989d8bebab619741 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