From 2b8e27c949f5589c65ed38875fb48b81c0207693 Mon Sep 17 00:00:00 2001 From: wangxiuxiu96 Date: Wed, 7 May 2025 11:06:18 +0800 Subject: [PATCH] CAPI supports onIdle event callback FE 0508. Signed-off-by: wangxiuxiu96 --- arkui/ace_engine/native/libace.ndk.json | 4 ++++ arkui/ace_engine/native/native_node_napi.h | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index e3f9991bb..d49ea0a58 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2851,6 +2851,10 @@ "first_introduced": "18", "name": "OH_ArkUI_PostFrameCallback" }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PostIdleCallback" + }, { "first_introduced": "15", "name": "OH_ArkUI_HostWindowInfo_GetName" diff --git a/arkui/ace_engine/native/native_node_napi.h b/arkui/ace_engine/native/native_node_napi.h index 8070149fa..af0c3b106 100644 --- a/arkui/ace_engine/native/native_node_napi.h +++ b/arkui/ace_engine/native/native_node_napi.h @@ -374,6 +374,24 @@ ArkUI_ErrorCode OH_ArkUI_GetRouterPageId( int32_t OH_ArkUI_PostFrameCallback(ArkUI_ContextHandle uiContext, void* userData, void (*callback)(uint64_t nanoTimestamp, uint32_t frameCount, void* userData)); +/** + * @brief Register a callback to be executed at the end of the next idle frame.If there is no next frame, will request one automatically. + * + * @param uiContext ArkUI_ContextHandle. + * @param userData Indicates the custom data to be saved. + * @param callback Custom callback function. + * @param nanoTimeLeft The remaining time from the deadline for this frame. + * @param frameCount Frame count. + * @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_PostIdleCallback(ArkUI_ContextHandle uiContext, void* userData, + void (*callback)(uint64_t nanoTimeLeft, uint32_t frameCount, void* userData)); + #ifdef __cplusplus }; #endif -- Gitee