From e9198ef5f1174b3dc2fd0b6ff001e693c7668a4b Mon Sep 17 00:00:00 2001 From: zhanghang Date: Wed, 30 Apr 2025 15:05:30 +0800 Subject: [PATCH] CAPI supports onIdle event callback 0430. Signed-off-by: zhanghang --- 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 3a129e851..98728d915 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2847,6 +2847,10 @@ "first_introduced": "18", "name": "OH_ArkUI_PostFrameCallback" }, + { + "first_introduced": "18", + "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..4b03fb916 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 18 + */ + int32_t OH_ArkUI_PostIdleCallback(ArkUI_ContextHandle uiContext, void* userData, + void (*callback)(uint64_t nanoTimeLeft, uint32_t frameCount, void* userData)); + #ifdef __cplusplus }; #endif -- Gitee