diff --git a/arkui/window_manager/oh_window.h b/arkui/window_manager/oh_window.h index 347d1000275db13023663a48045c143e2daa068f..6bd58b82a03a28f31650351cc67d5a2bcb1d63c5 100644 --- a/arkui/window_manager/oh_window.h +++ b/arkui/window_manager/oh_window.h @@ -289,6 +289,66 @@ void OH_WindowManager_ReleaseAllWindowLayoutInfoList(WindowManager_Rect* windowL int32_t OH_WindowManager_InjectTouchEvent( int32_t windowId, Input_TouchEvent* touchEvent, int32_t windowX, int32_t windowY); +/** + * @brief Get all main window info on device. + * + * @permission ohos.permission.CUSTOM_SCREEN_CAPTURE + * @param infoList Indicates the pointer to a main window info list. + * @param mainWindowInfoSize The size of main window info list. + * @return Returns the status code of the execution. + * {@link WS_OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_NO_PERMISSION} permission verification failed. + * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 21 + */ +int32_t OH_WindowManager_GetAllMainWindowInfo( + WindowManager_MainWindowInfo** infoList, size_t* mainWindowInfoSize); + +/** + * @brief Release all main window info list. + * + * @param infoList Pointer to the main window info list. + * @since 21 + */ +void OH_WindowManager_ReleaseAllMainWindowInfo(WindowManager_MainWindowInfo* infoList); + +/** + * @brief Callback interface for getting main windows' snapshot. + * + * @param snapshotPixelMapList List of windows' snapshot + * @param snapshotListSize Size of snapshotPixelMapList + * @since 21 + */ +typedef void (*OH_WindowManager_WindowSnapshotCallback)(const OH_PixelmapNative* snapshotPixelMapList, + size_t snapshotListSize); + +/** + * @brief Get snapshot of the specified windows. + * + * @permission @code ohos.permission.CUSTOM_SCREEN_CAPTURE + * @param windowIdList Main window id list for getting snapshot. + * @param windowIdListSize Size of main window id list. + * @param config Configuration for getting snapshot. + * @param callback Snapshot callback object. + * @return Returns the status code of the execution. + * {@link WS_OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_NO_PERMISSION} permission verification failed. + * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 21 + */ +int32_t OH_WindowManager_GetMainWindowSnapshot(int32_t* windowIdList, size_t windowIdListSize, + WindowManager_WindowSnapshotConfig config, OH_WindowManager_WindowSnapshotCallback callback); + +/** + * @brief Release main window snapshot list. + * + * @param snapshotPixelMapList Indicates the pointer of a windows' snapshot list. + * @since 21 + */ +void OH_WindowManager_ReleaseMainWindowSnapshot(const OH_PixelmapNative* snapshotPixelMapList); + #ifdef __cplusplus } #endif diff --git a/arkui/window_manager/oh_window_comm.h b/arkui/window_manager/oh_window_comm.h index 152c9a318270f77fde5a60ae796c8a5b502f744d..46be3abab20125d71d62f14121deae29ccb74ec5 100644 --- a/arkui/window_manager/oh_window_comm.h +++ b/arkui/window_manager/oh_window_comm.h @@ -229,6 +229,32 @@ typedef struct { WindowManager_Rect bottomRect; } WindowManager_AvoidArea; +/** + * @brief Main window info + * + * @since 21 + */ +typedef struct { + /** Display id of the window. */ + uint64_t displayId; + /** Window id. */ + int32_t windowId;; + /** Showing state of the window. */ + bool showing; + /** Label of the window. */ + const char* label; +} WindowManager_MainWindowInfo; + +/** + * @brief Window snapshot config info + * + * @since 21 + */ +typedef struct { + /** Use cached windows' snapshot. */ + bool useCache; +} WindowManager_WindowSnapshotConfig; + #ifdef __cplusplus } #endif