diff --git a/ability/ability_runtime/child_process/native_child_process.h b/ability/ability_runtime/child_process/native_child_process.h index ce59adf740bd17bd4832cc76d0e6ef13fddae81c..2c70a5d941af48a726fa47b48d304c048584e02b 100644 --- a/ability/ability_runtime/child_process/native_child_process.h +++ b/ability/ability_runtime/child_process/native_child_process.h @@ -152,13 +152,13 @@ typedef struct Ability_ChildProcessConfigs Ability_ChildProcessConfigs; Ability_ChildProcessConfigs* OH_Ability_CreateChildProcessConfigs(); /** - * @brief Destroys a child process configs object and releases associated rescources. + * @brief Destroys a child process configs object and releases associated resources. * * @param configs Pointer to the child process configs object to be destroyed. * After this call, the pointer becomes invalid and must not be used. * Passing nullptr is allowed and will be ignored. * @return Returns {@link NCP_NO_ERROR} if the operation is successful or if the input is nullptr. - * Returns {@link NCP_NO_ERR_INVALID_PARAM} if the input parameters are invalid. + * Returns {@link NCP_ERR_INVALID_PARAM} if the input parameters are invalid. * @since 20 */ Ability_NativeChildProcess_ErrCode OH_Ability_DestroyChildProcessConfigs(Ability_ChildProcessConfigs* configs); @@ -169,8 +169,8 @@ Ability_NativeChildProcess_ErrCode OH_Ability_DestroyChildProcessConfigs(Ability * * @param configs Pointer to the child process configs object. Must not be nullptr. * @param isolationMode The isolation mode to set. See {@link NativeChildProcess_IsolationMode} for details. - * @return Returns {@link NCP_NO_ERROR} if the isolation mode is set successful. - * Returns {@link NCP_NO_ERR_INVALID_PARAM} if the input parameters are invalid. + * @return Returns {@link NCP_NO_ERROR} if the isolation mode is set successfully. + * Returns {@link NCP_ERR_INVALID_PARAM} if the input parameters are invalid. * @since 20 */ Ability_NativeChildProcess_ErrCode OH_Ability_ChildProcessConfigs_SetIsolationMode( @@ -184,8 +184,8 @@ Ability_NativeChildProcess_ErrCode OH_Ability_ChildProcessConfigs_SetIsolationMo * Must be a non-empty string containing only letters, digits, or underscores. * Maximum length is 64 characters. * The name ultimately assigned to the process is {bundleName}:{processName}. - * @return Returns {@link NCP_NO_ERROR} if the process name is set successful. - * Returns {@link NCP_NO_ERR_INVALID_PARAM} if the input parameters are invalid. + * @return Returns {@link NCP_NO_ERROR} if the process name is set successfully. + * Returns {@link NCP_ERR_INVALID_PARAM} if the input parameters are invalid. * @since 20 */ Ability_NativeChildProcess_ErrCode OH_Ability_ChildProcessConfigs_SetProcessName(Ability_ChildProcessConfigs* configs, @@ -426,7 +426,7 @@ Ability_NativeChildProcess_ErrCode OH_Ability_StartNativeChildProcessWithConfigs NativeChildProcess_Args* OH_Ability_GetCurrentChildProcessArgs(); /** - * @brief Define a callback function to handle the exit of a native child process. + * @brief Defines a callback function to handle the exit of a native child process. * * @param pid The pid of the exited native child process. * @param signal The signal of the exited native child process. diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 7a15d4e4f25e8fad68814e6c38199ed4a42e7213..f0145c3c8f8fbb2323aaefff7ba64ed4e1d1c701 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3426,5 +3426,25 @@ { "first_introduced": "20", "name": "OH_ArkUI_SurfaceCallback_SetSurfaceHideEvent" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_UIInputEvent_GetLatestStatus" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_NodeUtils_GetNodeHandleByUniqueId" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_NodeUtils_GetNodeUniqueId" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PreventGestureRecognizerBegin" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_SetTouchTestDoneCallback" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_gesture.h b/arkui/ace_engine/native/native_gesture.h index aa4b37c23759e2e08572eee0a3454cc0ba76113f..5a439910883793e55d9f59ed219533eb59bf3c2d 100644 --- a/arkui/ace_engine/native/native_gesture.h +++ b/arkui/ace_engine/native/native_gesture.h @@ -868,6 +868,31 @@ ArkUI_ErrorCode OH_ArkUI_PanGesture_SetDistanceMap( ArkUI_ErrorCode OH_ArkUI_PanGesture_GetDistanceByToolType( ArkUI_GestureRecognizer* recognizer, int toolType, double* distance); +/** + * @brief Registers a callback that is executed after all gesture recognizers are collected. + * When the user begins touching the screen, the system performs hit testing and collects gesture recognizers + * based on the touch location. Subsequently, before processing any move events, the component can use this API + * to determine the gesture recognizers that will participate in and compete for recognition. + * + * @param node Handle to the node on which the callback is to be set. + * @param userData Custom data. + * @param touchTestDone Callback for completion of gesture recognizer collection. + * @return Result code. + * {@link ARKUI_ERROR_CODE_NO_ERROR}: The operation is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID}: A parameter error occurs. + * @since 20 + */ +ArkUI_ErrorCode OH_ArkUI_SetTouchTestDoneCallback( + ArkUI_NodeHandle node, + void* userData, + void (*touchTestDone)( + ArkUI_GestureEvent* event, + ArkUI_GestureRecognizerHandleArray recognizers, + int32_t count, + void* userData + ) +); + /** * @brief Defines the gesture APIs. * @@ -1162,6 +1187,20 @@ typedef struct { */ void* OH_ArkUI_GestureInterrupter_GetUserData(ArkUI_GestureInterruptInfo* event); +/** + * @brief Prevents a gesture recognizer from participating in the current gesture recognition before all fingers are + * lifted. + * If the system has already determined the result of the gesture recognizer (regardless of success or failure), + * calling this API will be ineffective. + * + * @param recognizer Pointer to a gesture recognizer. + * @return Result code. + * {@link ARKUI_ERROR_CODE_NO_ERROR}: The operation is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID}: A parameter error occurs. + * @since 20 + */ +ArkUI_ErrorCode OH_ArkUI_PreventGestureRecognizerBegin(ArkUI_GestureRecognizer* recognizer); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index a3daf6262e6090bedc4194c16ec8b7af185c4fa2..248c7b520b062f89ce30e174b4fd7dfb1e0f29ec 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -2365,6 +2365,20 @@ typedef enum { */ NODE_TEXT_LINE_COUNT = 1031, + /** + * @brief Sets whether to optimize the trailing spaces at the end of each line during text layout. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * value[0].i32: whether to optimize trailing spaces at the end of each line during text layout. + * The default value is false. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: whether to optimize trailing spaces at the end of each line during text layout. \n + * + * @since 20 + */ + NODE_TEXT_OPTIMIZE_TRAILING_SPACE = 1032, /** * @brief Sets a linear gradient effect for text. * This attribute can be set, reset, and obtained as required through APIs. @@ -2430,6 +2444,22 @@ typedef enum { */ NODE_TEXT_RADIAL_GRADIENT = 1034, + /** + * @brief Sets the vertical alignment of the text content. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: vertical alignment of the text content, specified using the {@link ArkUI_TextVerticalAlignment} + * enum. The default value is ARKUI_TEXT_VERTICAL_ALIGNMENT_BASELINE. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: vertical alignment of the text content, specified using the {@link ArkUI_TextVerticalAlignment} + * enum. \n + * + * @since 20 + */ + NODE_TEXT_VERTICAL_ALIGN = 1035, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * @@ -2687,6 +2717,19 @@ typedef enum { * */ NODE_IMAGE_RESIZABLE, + /** + * @brief Defines the synchronous image loading attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to load the image synchronously. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to load the image synchronously. \n + * + * @since 20 + */ + NODE_IMAGE_SYNC_LOAD = 4012, /** * @brief Defines the color of the component when it is selected. * This attribute can be set, reset, and obtained as required through APIs. @@ -3638,6 +3681,34 @@ typedef enum { */ NODE_TEXT_AREA_LINE_SPACING = 8028, + /** + * @brief Set the min lines of the node. This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: min lines count. + * \n + * Format of the return value {@link ArkUI_AttributeItem}: \n + * .value[0].i32: min line count.\n + * + * @since 20 + * + */ + NODE_TEXT_AREA_MIN_LINES = 8029, + + /** + * @brief Set the max lines of the node with scroll. This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: max lines count with scroll. + * \n + * Format of the return value {@link ArkUI_AttributeItem}: \n + * .value[0].i32: max line count with scroll.\n + * + * @since 20 + * + */ + NODE_TEXT_AREA_MAX_LINES_WITH_SCROLL = 8030, + /** * @brief Set the line height of the node. This attribute can be set, reset, and obtained as required through APIs. * @@ -4082,6 +4153,20 @@ typedef enum { * @since 18 */ NODE_DATE_PICKER_ENABLE_HAPTIC_FEEDBACK = 13008, + /** + * @brief Defines whether to support scroll looping for the date picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to support scroll looping. The value true means to support scroll looping, and + * false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: The value 1 means to support scroll looping, and 0 means the opposite. \n + * + * @since 20 + */ + NODE_DATE_PICKER_CAN_LOOP = 13009, /** * @brief Defines the time of the selected item. in the timer picker. * This attribute can be set, reset, and obtained as required through APIs. @@ -4753,6 +4838,32 @@ typedef enum { */ NODE_SLIDER_ENABLE_HAPTIC_FEEDBACK = 17013, + /** + * @brief Sets a custom component on the leading side of the Slider component. + * + * Attribute setting method {@link ArkUI_AttributeItem} parameter format:\n + * .object: Parameter type {@link ArkUI_NodeHandle}. + * + * The prefix component will be placed at the start position of the Slider, + * typically on the left side in LTR layouts. + * + * @since 20 + */ + NODE_SLIDER_PREFIX, + + /** + * @brief Sets a custom component on the trailing side of the Slider component. + * + * Attribute setting method {@link link ArkUI_AttributeItem} parameter format:\n + * .object: Parameter type {@link ArkUI_NodeHandle}. + * + * The suffix component will be placed at the end position of the Slider, + * typically on the right side in LTR layouts. + * + * @since 20 + */ + NODE_SLIDER_SUFFIX, + /** * @brief Set the selection status of an option button. Attribute setting, * attribute resetting, and attribute obtaining are supported. @@ -5582,6 +5693,22 @@ typedef enum { * @since 19 */ NODE_LIST_STACK_FROM_END = 1003014, + + /** + * @brief Defines the focus wrap mode for the List component. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: focus wrap mode of the List component. + * The parameter type is {@link ArkUI_FocusWrapMode}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: focus wrap mode of the List component. + * The parameter type is {@link ArkUI_FocusWrapMode}. \n + * + * @since 20 + */ + NODE_LIST_FOCUS_WRAP_MODE = 1003015, /** * @brief Defines whether to enable loop playback for the swiper. @@ -8143,6 +8270,16 @@ typedef enum { ARKUI_NODE_CUSTOM_EVENT_ON_FOREGROUND_DRAW = 1 << 3, /** Overlay type. */ ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW = 1 << 4, + /** + * Draw front type. + * @since 20 + */ + ARKUI_NODE_CUSTOM_EVENT_ON_DRAW_FRONT = 1 << 5, + /** + * Draw behind type. + * @since 20 + */ + ARKUI_NODE_CUSTOM_EVENT_ON_DRAW_BEHIND = 1 << 6, } ArkUI_NodeCustomEventType; /** @@ -9604,6 +9741,32 @@ ArkUI_ErrorCode OH_ArkUI_RemoveSupportedUIStates(ArkUI_NodeHandle node, int32_t */ int32_t OH_ArkUI_RunTaskInScope(ArkUI_ContextHandle uiContext, void* userData, void(*callback)(void* userData)); +/** + * @brief Get the node handle by uniqueId. + * + * @param uniqueId The uniqueId of the target node handle. + * @param node The handle of target node handle. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error. + * @since 20 + */ +int32_t OH_ArkUI_NodeUtils_GetNodeHandleByUniqueId(const uint32_t uniqueId, ArkUI_NodeHandle* node); + +/** + * @brief Get the uniqueId of the target node handle. + * + * @param node The ArkUI-NodeHandle pointer. + * @param uniqueId The uniqueId of the target node handle, default value is -1. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error. + * @since 20 + */ +int32_t OH_ArkUI_NodeUtils_GetNodeUniqueId(ArkUI_NodeHandle node, int32_t* uniqueId); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 828ba5b7d30727b121c7536c4bc4bf9731f6fec9..92126f66d37869788db81eb6fd7ffa705b37e039 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -389,6 +389,22 @@ typedef enum { ARKUI_TEXT_ALIGNMENT_JUSTIFY, } ArkUI_TextAlignment; +/** + * @brief Enumerates text vertical alignment styles. + * + * @since 20 + */ +typedef enum { + /** Aligned to the baseline. */ + ARKUI_TEXT_VERTICAL_ALIGNMENT_BASELINE = 0, + /** Bottom aligned. */ + ARKUI_TEXT_VERTICAL_ALIGNMENT_BOTTOM, + /** Center aligned. */ + ARKUI_TEXT_VERTICAL_ALIGNMENT_CENTER, + /** Top aligned. */ + ARKUI_TEXT_VERTICAL_ALIGNMENT_TOP, +} ArkUI_TextVerticalAlignment; + /** * @brief Enumerates the types of the Enter key for a single-line text box. * @@ -1273,6 +1289,12 @@ typedef enum { ARKUI_IMAGE_SPAN_ALIGNMENT_CENTER, /** The image is top aligned with the text. */ ARKUI_IMAGE_SPAN_ALIGNMENT_TOP, + /** + * The image alignment mode follows the text component's alignment mode. + * + * @since 20 + */ + ARKUI_IMAGE_SPAN_ALIGNMENT_FOLLOW_PARAGRAPH, } ArkUI_ImageSpanAlignment; /** @@ -2263,6 +2285,11 @@ typedef enum { * @since 15 */ ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT = 180005, + /** + * @error Input event type not supported. + * @since 20 + */ + ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED = 180006, /** * @error invalid styled string. * @since 14 diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index b8c6b17d73aad0a599b1da75cabc6a6f1c43ee8f..fac4d040d1a31ca20eb17f5dc256ca37526d3917 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -1272,6 +1272,25 @@ int32_t OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex( */ int32_t OH_ArkUI_PointerEvent_PostClonedEvent(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event); +/** + * @brief Use this method to obtain the execution status of the latest UI input related method. + * + * In most cases, this method is unnecessary unless you need to determine if the return value indicates an error. + * Here's an example of usage: For return values like float (where 0.0 doesn't indicate an error), use GetLatestStatus + * to confirm if an error occurred. + * float x = OH_ArkUI_PointerEvent_GetX(event); + * if (ARKUI_ERROR_CODE_NO_ERROR != OH_ArkUI_UIInputEvent_GetLatestStatus()) { + * // error + * return; + * } + * Note: The system clears the status of the previous function call each time a UIInput-related function is executed, + * ensuring you always get the latest status. + * + * @return Returns the ArkUI_ErrorCode. + * @since 20 + */ +ArkUI_ErrorCode OH_ArkUI_UIInputEvent_GetLatestStatus(); + #ifdef __cplusplus }; #endif diff --git a/arkui/napi/libnapi.ndk.json b/arkui/napi/libnapi.ndk.json index 7460d98aed06b385f9036a8fe808bafaa9ddad7d..5bdd52c3319ed72b1336febe33d107efccf6a98d 100644 --- a/arkui/napi/libnapi.ndk.json +++ b/arkui/napi/libnapi.ndk.json @@ -247,6 +247,10 @@ "first_introduced": "20", "name": "napi_create_ark_context" }, + { + "first_introduced": "20", + "name": "napi_switch_ark_context" + }, { "first_introduced": "20", "name": "napi_destroy_ark_context" diff --git a/arkui/napi/native_api.h b/arkui/napi/native_api.h index 332995c92cb80ba89252dfdafc64689d39b164bb..d1dc1c45c882003315bf1882a8f288f42ba8ddfe 100644 --- a/arkui/napi/native_api.h +++ b/arkui/napi/native_api.h @@ -1653,6 +1653,18 @@ NAPI_EXTERN napi_status napi_define_class(napi_env env, */ NAPI_EXTERN napi_status napi_create_ark_context(napi_env env, napi_env *newEnv); +/** + * @brief To switch a virtual machine context which is expected to be used later. + * @param env Designated Virtual machine context which is expected to be used as the current virtual machine context. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If the param env is nullptr.\n + * {@link napi_pending_exception } If have uncaught exception, or exception occurs in execution.\n + * @since 20 + */ +NAPI_EXTERN napi_status napi_switch_ark_context(napi_env env); + /** * @brief To destroy a virtual machine context which will not be used again. * @param env Virtual machine context expected to be destroyed. diff --git a/arkui/window_manager/libwm.ndk.json b/arkui/window_manager/libwm.ndk.json index 53d45ba82333b7ffa112fc80dbfff290f61d0ff6..c7b330e107a8fa95811f825c86ea47d339fcfa3c 100644 --- a/arkui/window_manager/libwm.ndk.json +++ b/arkui/window_manager/libwm.ndk.json @@ -93,7 +93,11 @@ }, { "first_instroduced":"20", - "name":"OH_PictureInPicture_CreatePip" + "name":"OH_PictureInPicture_CreatePipConfig" + }, + { + "first_instroduced":"20", + "name":"OH_PictureInPicture_DestroyPipConfig" }, { "first_instroduced":"20", @@ -115,6 +119,10 @@ "first_instroduced":"20", "name":"OH_PictureInPicture_SetPipNapiEnv" }, + { + "first_instroduced":"20", + "name":"OH_PictureInPicture_CreatePip" + }, { "first_instroduced":"20", "name":"OH_PictureInPicture_DeletePip" @@ -127,6 +135,10 @@ "first_instroduced":"20", "name":"OH_PictureInPicture_StopPip" }, + { + "first_instroduced":"20", + "name":"OH_PictureInPicture_UpdatePipContentSize" + }, { "first_instroduced":"20", "name":"OH_PictureInPicture_UpdatePipControlStatus" @@ -149,15 +161,15 @@ }, { "first_instroduced":"20", - "name":"OH_PictureInPicture_RegisterLifeCycleListener" + "name":"OH_PictureInPicture_RegisterLifecycleListener" }, { "first_instroduced":"20", - "name":"OH_PictureInPicture_UnregisterLifeCycleListener" + "name":"OH_PictureInPicture_UnregisterLifecycleListener" }, { "first_instroduced":"20", - "name":"OH_PictureInPicture_UnregisterAllLifeCycleListeners" + "name":"OH_PictureInPicture_UnregisterAllLifecycleListeners" }, { "first_instroduced":"20", diff --git a/arkui/window_manager/oh_window_pip.h b/arkui/window_manager/oh_window_pip.h index 15260f9ea2077cfcd64ea6a13f56e8839c90f779..d4e9de86f88fcd74b2710e4063a9375f99c10f6d 100644 --- a/arkui/window_manager/oh_window_pip.h +++ b/arkui/window_manager/oh_window_pip.h @@ -36,6 +36,12 @@ extern "C" { #endif +/** + * @brief Picture in picture config. + * @since 20 + */ +typedef void* PictureInPicture_PipConfig; + /** * @brief Enumerates picture in picture template type. * @since 20 @@ -105,8 +111,6 @@ typedef enum { CAMERA_SWITCH = 7, /** mute switch. */ MUTE_SWITCH = 8, - /** end. */ - END, } PictureInPicture_PipControlType; /** @@ -159,7 +163,7 @@ typedef void (*WebPipStartPipCallback)(uint32_t controllerId, uint8_t requestId, * @param errcode The picture-in-picture error code * @since 20 */ -typedef void (*WebPipLifeCycleCallback)(uint32_t controllerId, PictureInPicture_PipState state, int32_t errcode); +typedef void (*WebPipLifecycleCallback)(uint32_t controllerId, PictureInPicture_PipState state, int32_t errcode); /** * @brief The picture-in-picture control event callback @@ -182,21 +186,29 @@ typedef void (*WebPipControlEventCallback)(uint32_t controllerId, PictureInPictu typedef void (*WebPipResizeCallback)(uint32_t controllerId, uint32_t width, uint32_t height, double scale); /** - * @brief Create picture-in-picture controller. - * @param controllerId The picture-in-picture controller ID + * @brief Create picture-in-picture config. + * @param pipConfig The picture-in-picture config * @return Return the result code. * {@link OK} the function call is successful. * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. - * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. - * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * @since 20 */ -int32_t OH_PictureInPicture_CreatePip(uint32_t* controllerId); +int32_t OH_PictureInPicture_CreatePipConfig(PictureInPicture_PipConfig* pipConfig); + +/** + * @brief Destroy picture-in-picture config. + * @param pipConfig The picture-in-picture config + * @return Return the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. + * @since 20 + */ +int32_t OH_PictureInPicture_DestroyPipConfig(PictureInPicture_PipConfig* pipConfig); /** * @brief Set picture-in-picture mainWindowId. * - * @param controllerId The picture-in-picture controller ID + * @param pipConfig The picture-in-picture config * @param mainWindowId WindowId of corresponding mainWindow * @return Return the result code. * {@link OK} the function call is successful. @@ -204,12 +216,12 @@ int32_t OH_PictureInPicture_CreatePip(uint32_t* controllerId); * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. * @since 20 */ -int32_t OH_PictureInPicture_SetPipMainWindowId(uint32_t controllerId, uint32_t mainWindowId); +int32_t OH_PictureInPicture_SetPipMainWindowId(PictureInPicture_PipConfig pipConfig, uint32_t mainWindowId); /** * @brief Set picture-in-picture templateType. * - * @param controllerId The picture-in-picture controller ID + * @param pipConfig The picture-in-picture config * @param pipTemplateType The picture-in-picture template type * @return Return the result code. * {@link OK} the function call is successful. @@ -217,12 +229,13 @@ int32_t OH_PictureInPicture_SetPipMainWindowId(uint32_t controllerId, uint32_t m * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. * @since 20 */ -int32_t OH_PictureInPicture_SetPipTemplateType(uint32_t controllerId, PictureInPicture_PipTemplateType pipTemplateType); +int32_t OH_PictureInPicture_SetPipTemplateType(PictureInPicture_PipConfig pipConfig, + PictureInPicture_PipTemplateType pipTemplateType); /** * @brief Set picture-in-picture rect. * - * @param controllerId The picture-in-picture controller ID + * @param pipConfig The picture-in-picture config * @param width The picture-in-picture window width * @param height The picture-in-picture window height * @return Return the result code. @@ -231,12 +244,12 @@ int32_t OH_PictureInPicture_SetPipTemplateType(uint32_t controllerId, PictureInP * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. * @since 20 */ -int32_t OH_PictureInPicture_SetPipRect(uint32_t controllerId, uint32_t width, uint32_t height); +int32_t OH_PictureInPicture_SetPipRect(PictureInPicture_PipConfig pipConfig, uint32_t width, uint32_t height); /** * @brief Set picture-in-picture control group. * - * @param controllerId The picture-in-picture controller ID + * @param pipConfig The picture-in-picture config * @param controlGroup The picture-in-picture control group * @param controlGroupLength The length of picture-in-picture control group * @return Return the result code. @@ -245,13 +258,13 @@ int32_t OH_PictureInPicture_SetPipRect(uint32_t controllerId, uint32_t width, ui * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. * @since 20 */ -int32_t OH_PictureInPicture_SetPipControlGroup(uint32_t controllerId, PictureInPicture_PipControlGroup* controlGroup, - uint8_t controlGroupLength); +int32_t OH_PictureInPicture_SetPipControlGroup(PictureInPicture_PipConfig pipConfig, + PictureInPicture_PipControlGroup* controlGroup, uint8_t controlGroupLength); /** * @brief Set picture-in-picture napi env. * - * @param controllerId The picture-in-picture controller ID + * @param pipConfig The picture-in-picture config * @param env The picture-in-picture napi env * @return Return the result code. * {@link OK} the function call is successful. @@ -259,7 +272,20 @@ int32_t OH_PictureInPicture_SetPipControlGroup(uint32_t controllerId, PictureInP * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. * @since 20 */ -int32_t OH_PictureInPicture_SetPipNapiEnv(uint32_t controllerId, void* env); +int32_t OH_PictureInPicture_SetPipNapiEnv(PictureInPicture_PipConfig pipConfig, void* env); + +/** + * @brief Create picture-in-picture controller. + * @param pipConfig The picture-in-picture config + * @param controllerId The picture-in-picture controller ID + * @return Return the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. + * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. + * @since 20 + */ +int32_t OH_PictureInPicture_CreatePip(PictureInPicture_PipConfig pipConfig, uint32_t* controllerId); /** * @brief Delete picture-in-picture controller. @@ -282,6 +308,7 @@ int32_t OH_PictureInPicture_DeletePip(uint32_t controllerId); * {@link WINDOW_MANAGER_ERRORCODE_PIP_CREATE_FAILED} failed to create the PiP window. * {@link WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * {@link WINDOW_MANAGER_ERRORCODE_PIP_REPEATED_OPERATION} repeated PiP operation. + * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. * @since 20 */ int32_t OH_PictureInPicture_StartPip(uint32_t controllerId); @@ -296,6 +323,7 @@ int32_t OH_PictureInPicture_StartPip(uint32_t controllerId); * {@link WINDOW_MANAGER_ERRORCODE_PIP_STATE_ABNORMAL} the PiP window state is abnormal. * {@link WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * {@link WINDOW_MANAGER_ERRORCODE_PIP_REPEATED_OPERATION} repeated PiP operation. + * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. * @since 20 */ int32_t OH_PictureInPicture_StopPip(uint32_t controllerId); @@ -306,9 +334,13 @@ int32_t OH_PictureInPicture_StopPip(uint32_t controllerId); * @param controllerId The picture-in-picture controller ID * @param width The picture-in-picture content width * @param height The picture-in-picture content height + * @return Return the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * @since 20 */ -void OH_PictureInPicture_UpdatePipContentSize(uint32_t controllerId, uint32_t width, uint32_t height); +int32_t OH_PictureInPicture_UpdatePipContentSize(uint32_t controllerId, uint32_t width, uint32_t height); /** * @brief Update picture-in-picture control status. @@ -316,9 +348,13 @@ void OH_PictureInPicture_UpdatePipContentSize(uint32_t controllerId, uint32_t wi * @param controllerId The picture-in-picture controller ID * @param controlType The picture-in-picture control type. * @param status The picture-in-picture control status. - * @since 20 + * @return Return the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. + * @since 20 */ -void OH_PictureInPicture_UpdatePipControlStatus(uint32_t controllerId, PictureInPicture_PipControlType controlType, +int32_t OH_PictureInPicture_UpdatePipControlStatus(uint32_t controllerId, PictureInPicture_PipControlType controlType, PictureInPicture_PipControlStatus status); /** @@ -327,9 +363,13 @@ void OH_PictureInPicture_UpdatePipControlStatus(uint32_t controllerId, PictureIn * @param controllerId The picture-in-picture controller ID * @param controlType The picture-in-picture control type. * @param enabled Indicate the picture-in-picture control is enabled. + * @return Return the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * @since 20 */ -void OH_PictureInPicture_SetPipControlEnabled(uint32_t controllerId, PictureInPicture_PipControlType controlType, +int32_t OH_PictureInPicture_SetPipControlEnabled(uint32_t controllerId, PictureInPicture_PipControlType controlType, bool enabled); /** @@ -374,7 +414,7 @@ int32_t OH_PictureInPicture_UnregisterStartPipCallback(uint32_t controllerId, We int32_t OH_PictureInPicture_UnregisterAllStartPipCallbacks(uint32_t controllerId); /** - * @brief Register picture-in-picture life cycle listener callback. + * @brief Register picture-in-picture lifecycle listener callback. * * @param controllerId The picture-in-picture controller ID * @param callback The picture-in-picture lifecycle callback. @@ -385,10 +425,10 @@ int32_t OH_PictureInPicture_UnregisterAllStartPipCallbacks(uint32_t controllerId * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * @since 20 */ -int32_t OH_PictureInPicture_RegisterLifeCycleListener(uint32_t controllerId, WebPipLifeCycleCallback callback); +int32_t OH_PictureInPicture_RegisterLifecycleListener(uint32_t controllerId, WebPipLifecycleCallback callback); /** - * @brief Unregister picture-in-picture life cycle listener callback. + * @brief Unregister picture-in-picture lifecycle listener callback. * * @param controllerId The picture-in-picture controller ID * @param callback The picture-in-picture lifecycle callback. @@ -399,10 +439,10 @@ int32_t OH_PictureInPicture_RegisterLifeCycleListener(uint32_t controllerId, Web * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * @since 20 */ -int32_t OH_PictureInPicture_UnregisterLifeCycleListener(uint32_t controllerId, WebPipLifeCycleCallback callback); +int32_t OH_PictureInPicture_UnregisterLifecycleListener(uint32_t controllerId, WebPipLifecycleCallback callback); /** - * @brief Unregister all picture-in-picture life cycle listener callbacks. + * @brief Unregister all picture-in-picture lifecycle listener callbacks. * * @param controllerId The picture-in-picture controller ID * @return Return the result code. @@ -412,7 +452,7 @@ int32_t OH_PictureInPicture_UnregisterLifeCycleListener(uint32_t controllerId, W * {@link WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR} pip internal error. * @since 20 */ -int32_t OH_PictureInPicture_UnregisterAllLifeCycleListeners(uint32_t controllerId); +int32_t OH_PictureInPicture_UnregisterAllLifecycleListeners(uint32_t controllerId); /** * @brief Register picture-in-picture control event listener callback. diff --git a/backgroundtasks/transient/include/transient_task_api.h b/backgroundtasks/transient/include/transient_task_api.h index f6ce7b65929ee41f1a59318c332a5edaeb01b555..2182d6c8b84e20a3816f952f19d04432caad097c 100644 --- a/backgroundtasks/transient/include/transient_task_api.h +++ b/backgroundtasks/transient/include/transient_task_api.h @@ -101,7 +101,7 @@ int32_t OH_BackgroundTaskManager_GetRemainingDelayTime(int32_t requestId, int32_ int32_t OH_BackgroundTaskManager_CancelSuspendDelay(int32_t requestId); /** - * @brief Obtains all the transient task. + * @brief Obtains transient task info. * * @param transientTaskInfo Indicates the transient task info of an application. * @return {@link ERR_TRANSIENT_TASK_OK} 0 - Success. @@ -111,7 +111,7 @@ int32_t OH_BackgroundTaskManager_CancelSuspendDelay(int32_t requestId); * @since 20 * @version 1.0 */ -int32_t OH_BackgroundTaskManager_GetAllTransientTasks(TransientTask_TransientTaskInfo *transientTaskInfo); +int32_t OH_BackgroundTaskManager_GetTransientTaskInfo(TransientTask_TransientTaskInfo *transientTaskInfo); #ifdef __cplusplus } diff --git a/backgroundtasks/transient/libtransient_task.ndk.json b/backgroundtasks/transient/libtransient_task.ndk.json index 5d777b0199821083afb17eec109e90fe93bcb50e..1702643bae76c1cc7a540a8a1704149589c2b599 100644 --- a/backgroundtasks/transient/libtransient_task.ndk.json +++ b/backgroundtasks/transient/libtransient_task.ndk.json @@ -13,6 +13,6 @@ }, { "first_introduced": "20", - "name": "OH_BackgroundTaskManager_GetAllTransientTasks" + "name": "OH_BackgroundTaskManager_GetTransientTaskInfo" } ] \ No newline at end of file diff --git a/distributeddatamgr/udmf/include/udmf.h b/distributeddatamgr/udmf/include/udmf.h index 5e4b93caba7730a28c8961a40cd00c36019dc3fe..595301e03b0b9497d1e83d3d31d3a0142a307ddd 100644 --- a/distributeddatamgr/udmf/include/udmf.h +++ b/distributeddatamgr/udmf/include/udmf.h @@ -146,6 +146,23 @@ typedef enum Udmf_ProgressIndicator { UDMF_DEFAULT = 1 } Udmf_ProgressIndicator; +/** + * @brief Describe the visibility range of data + * + * @since 20 + */ +typedef enum Udmf_Visibility { + /** + * @brief The visibility level that specifies that any hap or native can be obtained. + */ + UDMF_ALL, + + /** + * @brief The visibility level that specifies that only data providers can be obtained. + */ + UDMF_OWN_PROCESS +} Udmf_Visibility; + /** * @brief Describes the unified data type. * @@ -910,6 +927,29 @@ int OH_UdmfOptions_SetIntention(OH_UdmfOptions* pThis, Udmf_Intention intention) */ int OH_UdmfOptions_Reset(OH_UdmfOptions* pThis); +/** + * @brief Get visibility from the {@link OH_UdmfOptions}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdmfOptions}. + * @return Returns {@link Udmf_Visibility} value. + * @see OH_UdmfOptions Udmf_Visibility + * @since 20 + */ +Udmf_Visibility OH_UdmfOptions_GetVisibility(OH_UdmfOptions* pThis); + +/** + * @brief Set visibility value to {@link OH_UdmfOptions}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdmfOptions}. + * @param visibility Represents new {@link Udmf_Visibility} param. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdmfOptions Udmf_Visibility Udmf_ErrCode. + * @since 20 + */ +int OH_UdmfOptions_SetVisibility(OH_UdmfOptions* pThis, Udmf_Visibility visibility); + /** * @brief Get {@link OH_UdmfData} data from udmf database. * @@ -1007,9 +1047,9 @@ int OH_Udmf_UpdateUnifiedData(OH_UdmfOptions* options, OH_UdmfData* unifiedData) int OH_Udmf_DeleteUnifiedData(OH_UdmfOptions* options, OH_UdmfData** dataArray, unsigned int* dataSize); /** - * @brief Destory data array memory. + * @brief Destroy data array memory. * - * @param dataArray Represents a pointer to {@link OH_UdmfData}. + * @param dataArray Represents a point to {@link OH_UdmfData}. * @param dataSize Represents data size in list. * @see OH_UdmfData * @since 20 diff --git a/distributeddatamgr/udmf/libudmf.ndk.json b/distributeddatamgr/udmf/libudmf.ndk.json index 27336bceb3ece67a30f87fed92fb10e208ceba22..7b8eed1feb372bfd02a72cbe31e8f13f958b02d8 100644 --- a/distributeddatamgr/udmf/libudmf.ndk.json +++ b/distributeddatamgr/udmf/libudmf.ndk.json @@ -650,5 +650,13 @@ { "first_introduced": "20", "name": "OH_UdmfDataLoadInfo_SetRecordCount" + }, + { + "first_introduced": "20", + "name": "OH_UdmfOptions_GetVisibility" + }, + { + "first_introduced": "20", + "name": "OH_UdmfOptions_SetVisibility" } ] \ No newline at end of file diff --git a/drivers/external_device_manager/usb/BUILD.gn b/drivers/external_device_manager/usb/BUILD.gn index 1729e897005913abbd141b0e619bcf88a366a735..d20a1208686e760879e9cebf52dbdb71e32d0c94 100644 --- a/drivers/external_device_manager/usb/BUILD.gn +++ b/drivers/external_device_manager/usb/BUILD.gn @@ -30,6 +30,5 @@ ohos_ndk_library("libusb_ndk") { system_capability_headers = [ "usb/usb_ddk_api.h", "usb/usb_ddk_types.h", - "base/ddk_types.h", ] } diff --git a/graphic/graphic_2d/native_drawing/drawing_brush.h b/graphic/graphic_2d/native_drawing/drawing_brush.h index d677d9aece287b7ae8621ffe19e86cf1d0ee2627..08677fec0f2b0f2d73fcce46de47e6dc988ed248 100644 --- a/graphic/graphic_2d/native_drawing/drawing_brush.h +++ b/graphic/graphic_2d/native_drawing/drawing_brush.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -40,12 +40,19 @@ #ifndef C_INCLUDE_DRAWING_BRUSH_H #define C_INCLUDE_DRAWING_BRUSH_H +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus extern "C" { #endif +/** + * @brief Defines a colorspace manager. Introduces the color space information defined by ColorManager. + * @since 20 + */ +typedef struct OH_NativeColorSpaceManager OH_NativeColorSpaceManager; + /** * @brief Creates an OH_Drawing_Brush object. * @@ -148,6 +155,83 @@ uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush* brush); */ void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush* brush, uint8_t alpha); +/** + * @brief Sets the color for a brush. The color will be used by the brush to fill in a shape. + * The color is an ARGB structure described by floating point numbers and interpreted as being in the colorSpaceManager. + * If colorSpaceManager is nullptr, then color is assumed to be in the sRGB color space. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param a Indicates the alpha component of color, represented as a floating point number between 0 and 1. + * @param r Indicates the red component of color, represented as a floating point number between 0 and 1. + * @param g Indicates the green component of color, represented as a floating point number between 0 and 1. + * @param b Indicates the blue component of color, represented as a floating point number between 0 and 1. + * @param colorSpaceManager Indicates the pointer to an OH_NativeColorSpaceManager object. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if brush is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_BrushSetColor4f(OH_Drawing_Brush* brush, float a, float r, float g, float b, + OH_NativeColorSpaceManager* colorSpaceManager); + +/** + * @brief Obtains the alpha component of a brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param a Indicates the alpha component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if brush or a is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_BrushGetAlphaFloat(const OH_Drawing_Brush* brush, float* a); + +/** + * @brief Obtains the red component of a brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param r Indicates the red component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if brush or r is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_BrushGetRedFloat(const OH_Drawing_Brush* brush, float* r); + +/** + * @brief Obtains the green component of a brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param g Indicates the green component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if brush or g is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_BrushGetGreenFloat(const OH_Drawing_Brush* brush, float* g); + +/** + * @brief Obtains the blue component of a brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param b Indicates the blue component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if brush or b is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_BrushGetBlueFloat(const OH_Drawing_Brush* brush, float* b); + /** * @brief Sets the shaderEffect for a brush. * diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h index 81cb70dc035b8d94b015cf22cf033d68f4dfbe3c..cf187736558372d7ca3989b87fdfab5c0ec065d0 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_font.h @@ -300,7 +300,7 @@ OH_Drawing_ErrorCode OH_Drawing_FontMeasureText(const OH_Drawing_Font* font, con * @version 1.0 */ OH_Drawing_ErrorCode OH_Drawing_FontMeasureTextWithBrushOrPen(const OH_Drawing_Font* font, const void* text, - size_t byteLength, OH_Drawing_TextEncoding encoding, const OH_Drawing_Brush* brush, const OH_Drawing_Brush* pen, + size_t byteLength, OH_Drawing_TextEncoding encoding, const OH_Drawing_Brush* brush, const OH_Drawing_Pen* pen, OH_Drawing_Rect* bounds, float* textWidth); /** @@ -322,7 +322,7 @@ OH_Drawing_ErrorCode OH_Drawing_FontMeasureTextWithBrushOrPen(const OH_Drawing_F * @version 1.0 */ OH_Drawing_ErrorCode OH_Drawing_FontGetWidthsBounds(const OH_Drawing_Font* font, const uint16_t* glyphs, int count, - const OH_Drawing_Brush* brush, const OH_Drawing_Brush* pen, float* widths, OH_Drawing_Array* bounds); + const OH_Drawing_Brush* brush, const OH_Drawing_Pen* pen, float* widths, OH_Drawing_Array* bounds); /** * @brief Retrieves the positions for each glyph, beginning at the specified origin. @@ -332,7 +332,7 @@ OH_Drawing_ErrorCode OH_Drawing_FontGetWidthsBounds(const OH_Drawing_Font* font, * @param glyphs Indicates the array of glyph indices to be measured. * @param count Indicates the number of glyphs. * @param origin Indicates the location of the first glyph. - * @param points Indicates the relative position for each glyph returned to tha caller. + * @param points Indicates the relative position for each glyph returned to the caller. * @return Returns the error code. * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of font, glyphs and points is nullptr or @@ -341,7 +341,7 @@ OH_Drawing_ErrorCode OH_Drawing_FontGetWidthsBounds(const OH_Drawing_Font* font, * @version 1.0 */ OH_Drawing_ErrorCode OH_Drawing_FontGetPos(const OH_Drawing_Font* font, const uint16_t* glyphs, int count, - const OH_Drawing_Point* origin, OH_Drawing_Point2D* bounds); + const OH_Drawing_Point* origin, OH_Drawing_Point2D* points); /** * @brief Returns the recommended spacing between lines. diff --git a/graphic/graphic_2d/native_drawing/drawing_path.h b/graphic/graphic_2d/native_drawing/drawing_path.h index 713456d67c7d1256b241f24c6ec811b4841129ae..1f4e18a2f17b7c4730a780a539dd4665a6de7a2d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_path.h +++ b/graphic/graphic_2d/native_drawing/drawing_path.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -761,6 +761,66 @@ bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_D bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag); +/** + * @brief Approximates the path with a series of line segments. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param acceptableError Indicates the acceptable error for a line on the path. Should be no less than 0. + * @param vals Indicates the storage for the computed array containing point components. + * There are three components for each point: + * 1.Fraction along the length of the path that the point resides. + * 2.The x coordinate of the point. + * 3.The y coordinate of the point. + * @param count Returns with the size of array. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if path, vals or count is nullptr, or acceptableError is + * less than 0. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathApproximate(OH_Drawing_Path* path, float acceptableError, float* vals, + uint32_t* count); + +/** + * @brief Performs interpolation between the current path and another path based on a given weight, and stores the + * result in the target path object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param other Indicates the pointer to an OH_Drawing_Path object to be interpolated with path. + * @param weight Indicates the interpolation weight, which must be in the range [0, 1]. + * @param success Indicates the interpolation is success or not. + * @param interpolatedPath Indicates the pointer to an OH_Drawing_Path object to store the result. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if eiter path, other, success or interpolatedPath is + * nullptr, or weight is outside the range [0, 1]. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other, + float weight, bool* success, OH_Drawing_Path* interpolatedPath); + +/** + * @brief Checks whether the current path is compatible with another path (other) for interpolation, which means + * they have exactly the same structure, both paths must have the same operations, in the same order. + * If any of the operations are of type CONIC, then the weights of those conics must also match. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param other Indicates the pointer to an OH_Drawing_Path object to be interpolated with path. + * @param result Indicates whether the current path and the other path are compatible for interpolation. + * The value is true if the paths are compatible, and false otherwise. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if eiter path, other or result is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathIsInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other, bool* result); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_pen.h b/graphic/graphic_2d/native_drawing/drawing_pen.h index 7465f4ebafab88b6f35210b83fa11910015328ba..0446d7d1132a0457a1572c8e04537baefcc091e5 100644 --- a/graphic/graphic_2d/native_drawing/drawing_pen.h +++ b/graphic/graphic_2d/native_drawing/drawing_pen.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -40,12 +40,19 @@ #ifndef C_INCLUDE_DRAWING_PEN_H #define C_INCLUDE_DRAWING_PEN_H +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus extern "C" { #endif +/** + * @brief Defines a colorspace manager. Introduces the color space information defined by ColorManager. + * @since 20 + */ +typedef struct OH_NativeColorSpaceManager OH_NativeColorSpaceManager; + /** * @brief Creates an OH_Drawing_Pen object. * @@ -148,6 +155,83 @@ uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen* pen); */ void OH_Drawing_PenSetAlpha(OH_Drawing_Pen* pen, uint8_t alpha); +/** + * @brief Sets the color for a pen. The color will be used by the pen to fill in a shape. + * The color is an ARGB structure described by floating point numbers and interpreted as being in the colorSpaceManager. + * If colorSpaceManager is nullptr, then color is assumed to be in the sRGB color space. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param a Indicates the alpha component of color, represented as a floating point number between 0 and 1. + * @param r Indicates the red component of color, represented as a floating point number between 0 and 1. + * @param g Indicates the green component of color, represented as a floating point number between 0 and 1. + * @param b Indicates the blue component of color, represented as a floating point number between 0 and 1. + * @param colorSpaceManager Indicates the pointer to an OH_NativeColorSpaceManager object. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if pen is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PenSetColor4f(OH_Drawing_Pen* pen, float a, float r, float g, float b, + OH_NativeColorSpaceManager* colorSpaceManager); + +/** + * @brief Obtains the alpha component of a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param a Indicates the alpha component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if pen or a is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PenGetAlphaFloat(OH_Drawing_Pen* pen, float* a); + +/** + * @brief Obtains the red component of a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param r Indicates the red component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if pen or r is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PenGetRedFloat(OH_Drawing_Pen* pen, float* r); + +/** + * @brief Obtains the green component of a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param g Indicates the green component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if pen or g is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PenGetGreenFloat(OH_Drawing_Pen* pen, float* g); + +/** + * @brief Obtains the blue component of a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param b Indicates the blue component of color. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if pen or b is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PenGetBlueFloat(OH_Drawing_Pen* pen, float* b); + /** * @brief Obtains the thickness of a pen. This thickness determines the width of the outline of a shape. * diff --git a/graphic/graphic_2d/native_drawing/drawing_register_font.h b/graphic/graphic_2d/native_drawing/drawing_register_font.h index 2ffdbbfec66f1ff8bdee46f3aa5969d7e6aef0ba..c2b6bcc3aeb294daded6ca80484eda8446b0d323 100644 --- a/graphic/graphic_2d/native_drawing/drawing_register_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_register_font.h @@ -75,6 +75,19 @@ uint32_t OH_Drawing_RegisterFont(OH_Drawing_FontCollection*, const char* fontFam uint32_t OH_Drawing_RegisterFontBuffer(OH_Drawing_FontCollection*, const char* fontFamily, uint8_t* fontBuffer, size_t length); +/** + * @brief Unregister a customized font by the font family. + * Unregistering a font that is currently in use by UI components may lead to text rendering anomalies, + * including garbled characters or missing glyphs. + * All typography using the unregistered font family should be destroyed and re-created. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param fontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @param fontFamily Indicates the family-name of the font which need to be unregistered. + * @return error code. + * @since 20 + */ +uint32_t OH_Drawing_UnregisterFont(OH_Drawing_FontCollection* fontCollection, const char* fontFamily); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_global.h b/graphic/graphic_2d/native_drawing/drawing_text_global.h index 7a7493c9445b39e8ab696f87d49f98b25bda81e2..39c9f8bc59adc4e0a9256aad7dbd3a8d6b50d822 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_global.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_global.h @@ -58,6 +58,18 @@ typedef enum { TEXT_APP_ENABLE_HIGH_CONTRAST } OH_Drawing_TextHighContrast; +/** + * @brief Visual representations for undefined (.notdef) glyphs. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 20 + */ +typedef enum { + /** Uses the glyph defined in the font file, which could be an empty box, blank space, or custom symbol etc. */ + TEXT_NO_GLYPH_USE_DEFAULT = 0, + /** Always render tofu blocks for missing glyphs. */ + TEXT_NO_GLYPH_USE_TOFU = 1, +} OH_Drawing_TextUndefinedGlyphDisplay; /** * @brief Sets high contrast mode of text rendering. @@ -68,6 +80,14 @@ typedef enum { */ void OH_Drawing_SetTextHighContrast(OH_Drawing_TextHighContrast action); +/** + * @brief Controls how undefined glyphs are visually presented, affects all text rendered after this call. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param undefinedGlyphDisplay Indicates a OH_Drawing_TextUndefinedGlyphDisplay to be set. + * @since 20 + */ +void OH_Drawing_SetTextUndefinedGlyphDisplay(OH_Drawing_TextUndefinedGlyphDisplay undefinedGlyphDisplay); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_run.h b/graphic/graphic_2d/native_drawing/drawing_text_run.h index 8873eaaf23e7389d04a20395f7281ebdd6a0ba39..cd9dff6ea2fdb187fd1547507b679bf408314914 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_run.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_run.h @@ -41,6 +41,7 @@ #define C_INCLUDE_DRAWING_TEXT_RUN_H #include "drawing_text_declaration.h" +#include "drawing_text_typography.h" #include "drawing_types.h" #ifdef __cplusplus @@ -208,6 +209,59 @@ void OH_Drawing_DestroyRunPositions(OH_Drawing_Array* positions); * @since 18 */ uint32_t OH_Drawing_GetRunGlyphCount(OH_Drawing_Run* run); + +/** + * @brief Gets the Font Object of run. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @return The Font Object of run. + * @since 20 + * @version 1.0 + */ +OH_Drawing_Font* OH_Drawing_GetRunFont(OH_Drawing_Run* run); + +/** + * @brief Get the text direction. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @return Return the text direction of an OH_Drawing_TextDirection object. + * @since 20 + */ +OH_Drawing_TextDirection OH_Drawing_GetRunTextDirection(OH_Drawing_Run* run); + +/** + * @brief Gets the glyph advance array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @param start The run of start index. + * @param length The run of length, if start and length are set to 0, then get all of the current run. + * @return Indicates the pointer to the glyph advance array object OH_Drawing_Array. + * @since 20 + */ +OH_Drawing_Array* OH_Drawing_GetRunGlyphAdvances(OH_Drawing_Run* run, uint32_t start, uint32_t length); + +/** + * @brief Gets the glyph advance by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param advances The glyph advance array object OH_Drawing_Array. + * @param index The run of glyph index. + * @return Run of glyph advance pointer to an OH_Drawing_Point object. + * @since 20 + */ +OH_Drawing_Point* OH_Drawing_GetRunGlyphAdvanceByIndex(OH_Drawing_Array* advances, size_t index); + +/** + * @brief Releases the memory of glyph advance array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param advances The run of glyph advance array object OH_Drawing_Array. + * @since 20 + */ +void OH_Drawing_DestroyRunGlyphAdvances(OH_Drawing_Array* advances); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 8a704ced57b0a924345ff14edaf9a85fba79c2ad..7e66d405e791b2726904fe24fd5d2219aa034f55 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -196,6 +196,11 @@ typedef enum { ALIGNMENT_BOTTOM_OF_ROW_BOX, /** Center of Row Box */ ALIGNMENT_CENTER_OF_ROW_BOX, + /** + * Follow paragraph setting + * @since 20 + */ + ALIGNMENT_FOLLOW_PARAGRAPH, } OH_Drawing_PlaceholderVerticalAlignment; /** @@ -592,6 +597,23 @@ typedef enum OH_Drawing_TextBadgeType { TEXT_SUBSCRIPT, } OH_Drawing_TextBadgeType; +/** + * @brief Type of vertical alignment. + * + * @since 20 + * @version 1.0 + */ +typedef enum OH_Drawing_TextVerticalAlignment { + /** Baseline of text line */ + TEXT_VERTICAL_ALIGNMENT_BASELINE, + /** Bottom of text line */ + TEXT_VERTICAL_ALIGNMENT_BOTTOM, + /** Center of text line */ + TEXT_VERTICAL_ALIGNMENT_CENTER, + /** Top of text line */ + TEXT_VERTICAL_ALIGNMENT_TOP +} OH_Drawing_TextVerticalAlignment; + /** * @brief Defines the font style struct. * @@ -2360,6 +2382,19 @@ double OH_Drawing_TextStyleGetFontHeight(OH_Drawing_TextStyle* style); */ bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle* style); +/** + * @brief Sets the typography vertical alignment mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param align Indicates the typography vertical alignment mode. For details, + * see the enum OH_Drawing_TextVerticalAlignment. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_SetTypographyVerticalAlignment(OH_Drawing_TypographyStyle* style, + OH_Drawing_TextVerticalAlignment align); + /** * @brief Gets the locale. * @@ -2683,6 +2718,17 @@ void OH_Drawing_TypographyUpdateDecorationThicknessScale(OH_Drawing_Typography* void OH_Drawing_TypographyUpdateDecorationStyle(OH_Drawing_Typography* typography, OH_Drawing_TextDecorationStyle decorationStyle); +/** + * @brief Updates the decoration color of the paragraph. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param color Indicates the text decoration color to update. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateDecorationColor(OH_Drawing_Typography* typography, uint32_t color); + /** * @brief Get whether the text layout enables line styles. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index cd1b53c1f7bb7eb8770b6dd0710b07bb72a65d1e..eded3082f6f426afea36ac6b244746e9119eefba 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -29,12 +29,32 @@ }, { "name": "OH_Drawing_BrushDestroy" }, { "name": "OH_Drawing_BrushGetAlpha" }, + { + "first_introduced": "20", + "name": "OH_Drawing_BrushGetAlphaFloat" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_BrushGetRedFloat" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_BrushGetGreenFloat" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_BrushGetBlueFloat" + }, { "name": "OH_Drawing_BrushSetAlpha" }, { "name": "OH_Drawing_BrushSetBlendMode" }, { "name": "OH_Drawing_BrushIsAntiAlias" }, { "name": "OH_Drawing_BrushSetAntiAlias" }, { "name": "OH_Drawing_BrushGetColor" }, { "name": "OH_Drawing_BrushSetColor" }, + { + "first_introduced": "20", + "name": "OH_Drawing_BrushSetColor4f" + }, { "name": "OH_Drawing_BrushSetFilter" }, { "first_introduced": "12", @@ -567,6 +587,18 @@ "first_introduced": "20", "name": "OH_Drawing_PathSetPath" }, + { + "first_introduced": "20", + "name": "OH_Drawing_PathApproximate" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PathInterpolate" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PathIsInterpolate" + }, { "first_introduced": "12", "name": "OH_Drawing_PenCopy" @@ -575,11 +607,31 @@ { "name": "OH_Drawing_PenDestroy" }, { "name": "OH_Drawing_PenGetAlpha" }, { "name": "OH_Drawing_PenSetAlpha" }, + { + "first_introduced": "20", + "name": "OH_Drawing_PenGetAlphaFloat" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PenGetRedFloat" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PenGetGreenFloat" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PenGetBlueFloat" + }, { "name": "OH_Drawing_PenSetBlendMode" }, { "name": "OH_Drawing_PenIsAntiAlias" }, { "name": "OH_Drawing_PenSetAntiAlias" }, { "name": "OH_Drawing_PenGetColor" }, { "name": "OH_Drawing_PenSetColor" }, + { + "first_introduced": "20", + "name": "OH_Drawing_PenSetColor4f" + }, { "name": "OH_Drawing_PenGetWidth" }, { "name": "OH_Drawing_PenSetWidth" }, { "name": "OH_Drawing_PenGetMiterLimit" }, @@ -1034,6 +1086,10 @@ "first_introduced": "11", "name": "OH_Drawing_RegisterFontBuffer" }, + { + "first_introduced": "20", + "name": "OH_Drawing_UnregisterFont" + }, { "first_introduced": "12", "name": "OH_Drawing_TypographyGetLineTextRange" @@ -1554,6 +1610,10 @@ "first_introduced": "20", "name": "OH_Drawing_TypographyUpdateDecorationStyle" }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateDecorationColor" + }, { "first_introduced": "12", "name": "OH_Drawing_TypographyTextGetLineStyle" @@ -1854,10 +1914,30 @@ "first_introduced": "18", "name":"OH_Drawing_GetRunGlyphCount" }, + { + "first_introduced": "20", + "name":"OH_Drawing_GetRunTextDirection" + }, + { + "first_introduced": "20", + "name":"OH_Drawing_GetRunGlyphAdvances" + }, + { + "first_introduced": "20", + "name":"OH_Drawing_GetRunGlyphAdvanceByIndex" + }, + { + "first_introduced": "20", + "name":"OH_Drawing_DestroyRunGlyphAdvances" + }, { "first_introduced": "14", "name":"OH_Drawing_GetFontCollectionGlobalInstance" }, + { + "first_introduced": "20", + "name":"OH_Drawing_GetRunFont" + }, { "first_introduced": "18", "name":"OH_Drawing_CanvasQuickRejectPath" @@ -1897,5 +1977,13 @@ { "first_introduced": "20", "name": "OH_Drawing_SetTextHighContrast" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_SetTextUndefinedGlyphDisplay" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_SetTypographyVerticalAlignment" } ] \ No newline at end of file diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 8ea6331c1ec187318c181a78a2f75c1d26b9d4c0..6e41ae61a964e2c11718042081c58d57b14072a8 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -740,6 +740,21 @@ int OH_HiAppEvent_SetCustomConfig(HiAppEvent_Processor* processor, const char* k */ int OH_HiAppEvent_SetConfigId(HiAppEvent_Processor* processor, int configId); +/** + * @brief The interface to set config Name for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param configName The configName of processor. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE_LENGTH} Invalid param value length. + * @since 20 + */ +int OH_HiAppEvent_SetConfigName(HiAppEvent_Processor* processor, const char* configName); + /** * @brief The interface to set user info for processor. * diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h index 63dc8cf01461d7d464400904b94cff1dfc51f386..06f186ed5ad34d88e25247429d918dc164c83242 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h @@ -160,6 +160,14 @@ extern "C" { */ #define EVENT_APP_HICOLLIE "APP_HICOLLIE" +/** + * @brief app killed event. + * + * @since 20 + * @version 1.0 + */ +#define EVENT_APP_KILLED "APP_KILLED" + /** * @brief OS domain. * diff --git a/hiviewdfx/hiappevent/libhiappevent.ndk.json b/hiviewdfx/hiappevent/libhiappevent.ndk.json index 98c62ebeb65bc817b449d7317bca0ced0b136539..23733dddea6a5c4cc23a05e62cef08ec49b5a5d7 100644 --- a/hiviewdfx/hiappevent/libhiappevent.ndk.json +++ b/hiviewdfx/hiappevent/libhiappevent.ndk.json @@ -158,5 +158,9 @@ { "first_introduced": "18", "name": "OH_HiAppEvent_RemoveProcessor" + }, + { + "first_introduced": "20", + "name": "OH_HiAppEvent_SetConfigName" } ] diff --git a/multimedia/audio_framework/audio_capturer/native_audiocapturer.h b/multimedia/audio_framework/audio_capturer/native_audiocapturer.h index f2f256e49b492c8895f44798b638091ec5336a7a..9f1644a90b9ca449eea68c8a0d9e2b416e13fcbb 100644 --- a/multimedia/audio_framework/audio_capturer/native_audiocapturer.h +++ b/multimedia/audio_framework/audio_capturer/native_audiocapturer.h @@ -296,7 +296,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetOverflowCount(OH_AudioCapturer* captur * @param audioData Audio data pointer, where user should read. * @param audioDataSize Size of audio data that user should read. * @see OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnReadData - * @since 19 + * @since 20 */ typedef void (*OH_AudioCapturer_OnReadDataCallback)(OH_AudioCapturer* capturer, void* userData, void* audioData, int32_t audioDataSize); @@ -310,7 +310,7 @@ typedef void (*OH_AudioCapturer_OnReadDataCallback)(OH_AudioCapturer* capturer, * @param userData User data which is passed by user. * @param deviceArray Array of AudioDeviceDescriptor where the capturing data from. * @see OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnStreamEvent - * @since 19 + * @since 20 */ typedef void (*OH_AudioCapturer_OnDeviceChangeCallback)(OH_AudioCapturer* capturer, void* userData, OH_AudioDeviceDescriptorArray* deviceArray); @@ -325,7 +325,7 @@ typedef void (*OH_AudioCapturer_OnDeviceChangeCallback)(OH_AudioCapturer* captur * @param type Force type of this interrupt event. * @param hint Hint of this interrupt event. * @see OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnInterruptEvent. - * @since 19 + * @since 20 */ typedef void (*OH_AudioCapturer_OnInterruptCallback)(OH_AudioCapturer* capturer, void* userData, OH_AudioInterrupt_ForceType type, OH_AudioInterrupt_Hint hint); @@ -339,11 +339,39 @@ typedef void (*OH_AudioCapturer_OnInterruptCallback)(OH_AudioCapturer* capturer, * @param userData User data which is passed by user. * @param error Error while using AudioCapturer. * @see OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnError - * @since 19 + * @since 20 */ typedef void (*OH_AudioCapturer_OnErrorCallback)(OH_AudioCapturer* renderer, void* userData, OH_AudioStream_Result error); +/** + * @brief Gets audio capturer running status, check if it works in fast status. + * + * @param capturer Reference created by OH_AudioStreamBuilder_GenerateCapturer. + * @param status Pointer to a variable to receive the status. + * @return + * {@link AUDIOSTREAM_SUCCESS} if the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} the param of capturer is nullptr. + * {@link AUDIOSTREAM_ERROR_ILLEGAL_STATE} function called in invalid state, only available before release state. + * @since 20 + */ +OH_AudioStream_Result OH_AudioCapturer_GetFastStatus(OH_AudioCapturer* capturer, + OH_AudioStream_FastStatus* status); + +/** + * @brief Callback function of fast status change event for audio capturer. + * + * @param capturer Pointer to an audio capturer instance for which this callback occurs. + * @param userData Userdata which is passed by register. + * @param status Current fast status. + * @since 20 + */ +typedef void (*OH_AudioCapturer_OnFastStatusChange)( + OH_AudioCapturer* capturer, + void* userData, + OH_AudioStream_FastStatus status +); + #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/audio_manager/native_audio_stream_manager.h b/multimedia/audio_framework/audio_manager/native_audio_stream_manager.h index 34b4af643f192d43887a5e06814ac2c8b46e7c17..4069e64394a547f571e187c4bb6384ddc10fd8d3 100644 --- a/multimedia/audio_framework/audio_manager/native_audio_stream_manager.h +++ b/multimedia/audio_framework/audio_manager/native_audio_stream_manager.h @@ -110,6 +110,34 @@ OH_AudioCommon_Result OH_AudioStreamManager_IsAcousticEchoCancelerSupported( OH_AudioStream_SourceType sourceType, bool *supported); +/** + * @brief Return if fast playback is supported for the specific audio stream info and usage type + * in current device situation. + * + * @param streamManager {@link OH_AudioStreamManager} handle + * provided by {@link OH_AudioManager_GetAudioStreamManager}. + * @param streamInfo reference of stream info structure to describe basic audio format. + * @param usage stream usage type used to decide the audio device and pipe type selection result. + * @return {@code true} if fast playback is supported in this situation. + * @since 20 + */ +bool OH_AudioStreamManager_IsFastPlaybackSupported( + OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_Usage usage); + +/** + * @brief Return if fast recording is supported for the specific audio stream info and source type + * in current device situation. + * + * @param streamManager {@link OH_AudioStreamManager} handle + * provided by {@link OH_AudioManager_GetAudioStreamManager}. + * @param streamInfo reference of stream info structure to describe basic audio format. + * @param source stream source type used to decide the audio device and pipe type selection result. + * @return {@code true} if fast recording is supported in this situation. + * @since 20 + */ +bool OH_AudioStreamManager_IsFastRecordingSupported( + OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_SourceType source); + #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/audio_renderer/native_audiorenderer.h b/multimedia/audio_framework/audio_renderer/native_audiorenderer.h index f048de6e57e0434b425da0c569508e18077185b9..a2b5dff7d94bb3a890bc911f763c0e16a4f5682d 100644 --- a/multimedia/audio_framework/audio_renderer/native_audiorenderer.h +++ b/multimedia/audio_framework/audio_renderer/native_audiorenderer.h @@ -243,6 +243,10 @@ OH_AudioStream_Result OH_AudioRenderer_GetFramesWritten(OH_AudioRenderer* render /** * Query the the time at which a particular frame was presented. * + * It is recommended to use new api {@link OH_AudioRenderer_GetAudioTimestampInfo} + * because it adapts to playback speed change, but current api does not. The + * increasing speed for position will not change when speed become fast. + * * @since 10 * * @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer() @@ -517,6 +521,9 @@ OH_AudioStream_Result OH_AudioRenderer_SetDefaultOutputDevice( * This interface also adapts to playback speed change. For example, the increseing speed for * position will be double for 2x speed playback. * + * For video synchronization usage, there is a best practice document for developer to refer + * **AV Synchronization**. + * * @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer() * @param framePosition Pointer to a variable to receive the position * @param timestamp Pointer to a variable to receive the timestamp @@ -545,7 +552,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetAudioTimestampInfo(OH_AudioRenderer* r * @param type Force type of this interrupt event. * @param hint Hint of this interrupt event. * @see OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnInterruptEvent. - * @since 19 + * @since 20 */ typedef void (*OH_AudioRenderer_OnInterruptCallback)(OH_AudioRenderer* renderer, void* userData, OH_AudioInterrupt_ForceType type, OH_AudioInterrupt_Hint hint); @@ -559,11 +566,39 @@ typedef void (*OH_AudioRenderer_OnInterruptCallback)(OH_AudioRenderer* renderer, * @param userData User data which is passed by user. * @param error Error while using AudioRenderer. * @see OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnError - * @since 19 + * @since 20 */ typedef void (*OH_AudioRenderer_OnErrorCallback)(OH_AudioRenderer* renderer, void* userData, OH_AudioStream_Result error); +/** + * @brief Gets audio renderer running status, check if it works in fast status. + * + * @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer. + * @param status Pointer to a variable to receive the status. + * @return + * {@link AUDIOSTREAM_SUCCESS} if the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} the param of renderer is nullptr. + * {@link AUDIOSTREAM_ERROR_ILLEGAL_STATE} function called in invalid state, only available before release state. + * @since 20 + */ +OH_AudioStream_Result OH_AudioRenderer_GetFastStatus(OH_AudioRenderer* renderer, + OH_AudioStream_FastStatus* status); + +/** + * @brief Callback function of fast status change event for audio renderer. + * + * @param renderer Pointer to an audio renderer instance for which this callback occurs. + * @param userData Userdata which is passed by register. + * @param status Current fast status. + * @since 20 + */ +typedef void (*OH_AudioRenderer_OnFastStatusChange)( + OH_AudioRenderer* renderer, + void* userData, + OH_AudioStream_FastStatus status +); + #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/common/native_audio_device_base.h b/multimedia/audio_framework/common/native_audio_device_base.h index beb3a54559f23dea6559396ca0f19c567053d112..6654ae3209c905afa660b751f94669125d815732 100644 --- a/multimedia/audio_framework/common/native_audio_device_base.h +++ b/multimedia/audio_framework/common/native_audio_device_base.h @@ -168,6 +168,12 @@ typedef enum { */ AUDIO_DEVICE_TYPE_LINE_DIGITAL = 28, + /** + * @brief Nearlink device. + * @since 20 + */ + AUDIO_DEVICE_TYPE_NEARLINK = 31, + /** * @brief Default device type. */ diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index 28643a2469467b7917a896712d932200b6ee3083..9b763054bc9bff2e1bf5b9b4490f33b99a52fbce 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -350,7 +350,7 @@ typedef enum { /** * @brief Define the audio event. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioRenderer_OutputDeviceChangeCallback. * @since 10 */ @@ -358,7 +358,7 @@ typedef enum { /** * The routing of the audio has changed. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioRenderer_OutputDeviceChangeCallback. * @since 10 */ @@ -591,6 +591,22 @@ typedef enum { EFFECT_DEFAULT = 1, } OH_AudioStream_AudioEffectMode; +/** + * @brief Defines the fast status. + * + * @since 20 + */ +typedef enum { + /** + * normal status + */ + AUDIOSTREAM_FASTSTATUS_NORMAL = 0, + /** + * fast status + */ + AUDIOSTREAM_FASTSTATUS_FAST = 1 +} OH_AudioStream_FastStatus; + /** * @brief Declaring the audio stream builder. * The instance of builder is used for creating audio stream. @@ -618,7 +634,7 @@ typedef struct OH_AudioCapturerStruct OH_AudioCapturer; /** * @brief Declaring the callback struct for renderer stream. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead Use the callback type: OH_AudioRenderer_OnWriteDataCallback, OH_AudioRenderer_OutputDeviceChangeCallback, * OH_AudioRenderer_OnInterruptEvent, OH_AudioRenderer_OnErrorCallback separately. * @since 10 @@ -628,7 +644,7 @@ typedef struct OH_AudioRenderer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to write audio data * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioRenderer_OnWriteDataCallback. * @since 10 */ @@ -642,7 +658,7 @@ typedef struct OH_AudioRenderer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to handle audio renderer stream events. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioRenderer_OutputDeviceChangeCallback. * @since 10 */ @@ -655,7 +671,7 @@ typedef struct OH_AudioRenderer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to handle audio interrupt events. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioRenderer_OnInterruptCallback. * @since 10 */ @@ -669,7 +685,7 @@ typedef struct OH_AudioRenderer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to handle audio error result. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioRenderer_OnErrorCallback. * @since 10 */ @@ -682,7 +698,7 @@ typedef struct OH_AudioRenderer_Callbacks_Struct { /** * @brief Declaring the callback struct for capturer stream. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead Use the callback type: OH_AudioCapturer_OnReadDataCallback, OH_AudioCapturer_OnDeviceChangeCallback, * OH_AudioCapturer_OnInterruptCallback and OH_AudioCapturer_OnErrorCallback separately. * @since 10 @@ -692,7 +708,7 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to read audio data. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioCapturer_OnReadDataCallback * @since 10 */ @@ -706,7 +722,7 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to handle audio capturer stream events. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioRenderer_OutputDeviceChangeCallback * @since 10 */ @@ -719,7 +735,7 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to handle audio interrupt events. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioCapturer_OnInterruptCallback * @since 10 */ @@ -733,7 +749,7 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { * This function pointer will point to the callback function that * is used to handle audio error result. * - * @deprecated since 19 + * @deprecated since 20 * @useinstead OH_AudioCapturer_OnErrorCallback * @since 10 */ diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index dd84c6e4678d0b64b9b1cfea1fcf0b44fcd50c3a..a557a9342e477a1dcc481e38bd5b34d74a7dccaf 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -197,7 +197,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInfo(OH_AudioStreamBuilde /** * Set the callbacks for the renderer client * - * @deprecated since 19 + * @deprecated since 20 * @useinstead Set the callback functions separately using OH_AudioStreamBuilder_SetRendererWriteDataCallback, * OH_AudioStreamBuilder_SetRendererInterruptCallback, OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback * and OH_AudioStreamBuilder_SetRendererErrorCallback. @@ -251,7 +251,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererPrivacy(OH_AudioStreamBui /** * Set the callbacks for the capturer client * - * @deprecated since 19 + * @deprecated since 20 * @useinstead Set the callback functions separately using OH_AudioStreamBuilder_SetCapturerReadDataCallback, * OH_AudioStreamBuilder_SetCapturerDeviceChangeCallback, OH_AudioStreamBuilder_SetCapturerInterruptCallback * and OH_AudioStreamBuilder_SetCapturerErrorCallback. @@ -276,17 +276,16 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerCallback(OH_AudioStreamBu * When using AudioRenderer apis, there are many instructions for application * to achieve better performance and lower power consumption: * In music or audiobook background playback situation, you can have low power - * consumption by following this best practices document [Low-Power Rules in Music Playback Scenarios]{@link - * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-music-playback-scenarios}. - * And for navigation situation, you can follow [Low-Power Rules in Navigation and Positioning Scenarios]{@link - * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-navigation-scenarios}. + * consumption by following this best practices document **Low-Power Rules in Music Playback Scenarios**. + * And for navigation situation, you can follow **Low-Power Rules in Navigation and Positioning Scenarios**. * * Application developer should also be careful when app goes to background, please check if your audio playback - * is still needed, see [Audio Resources]{@link - * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-reasonable-audio-use}. + * is still needed, see **Audio Resources** in best practices document. * And avoiding to send silence audio data continuously to waste system resources, otherwise system will take - * control measures when this behavior is detected, see [Audio Playback]{@link - * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-reasonable-audio-playback-use}. + * control measures when this behavior is detected, see **Audio Playback** in best practices document. + * + * If you want to use AudioRenderer api to implement a music playback application, there are also many interactive + * scenes to consider, see **Developing an Audio Application** in best practices document. * * @since 10 * @@ -414,7 +413,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetVolumeMode(OH_AudioStreamBuilder* * @return Result code. * {@link AUDIOSTREAM_SUCCESS} Success. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} Parameter is invalid, e.g. builder is nullptr, e.t.c. - * @since 19 + * @since 20 */ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererInterruptCallback(OH_AudioStreamBuilder* builder, OH_AudioRenderer_OnInterruptCallback callback, void* userData); @@ -431,7 +430,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererInterruptCallback(OH_Audi * @return Result code. * {@link AUDIOSTREAM_SUCCESS} Success. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} Parameter is invalid, e.g. builder is nullptr, e.t.c. - * @since 19 + * @since 20 */ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererErrorCallback(OH_AudioStreamBuilder* builder, OH_AudioRenderer_OnErrorCallback callback, void* userData); @@ -448,7 +447,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererErrorCallback(OH_AudioStr * @return Result code. * {@link AUDIOSTREAM_SUCCESS} Success. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} Parameter is invalid, e.g. builder is nullptr, e.t.c. - * @since 19 + * @since 20 */ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerReadDataCallback(OH_AudioStreamBuilder* builder, OH_AudioCapturer_OnReadDataCallback callback, void* userData); @@ -465,7 +464,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerReadDataCallback(OH_Audio * @return Result code. * {@link AUDIOSTREAM_SUCCESS} Success. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} Parameter is invalid, e.g. builder is nullptr, e.t.c. - * @since 19 + * @since 20 */ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerDeviceChangeCallback(OH_AudioStreamBuilder* builder, OH_AudioCapturer_OnDeviceChangeCallback callback, void* userData); @@ -482,7 +481,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerDeviceChangeCallback(OH_A * @return Result code. * {@link AUDIOSTREAM_SUCCESS} Success. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} Parameter is invalid, e.g. builder is nullptr, e.t.c. - * @since 19 + * @since 20 */ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInterruptCallback(OH_AudioStreamBuilder* builder, OH_AudioCapturer_OnInterruptCallback callback, void* userData); @@ -499,7 +498,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInterruptCallback(OH_Audi * @return Result code. * {@link AUDIOSTREAM_SUCCESS} Success. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} Parameter is invalid, e.g. builder is nullptr, e.t.c. - * @since 19 + * @since 20 */ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerErrorCallback(OH_AudioStreamBuilder* builder, OH_AudioCapturer_OnErrorCallback callback, void* userData); @@ -517,6 +516,35 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerErrorCallback(OH_AudioStr OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerWillMuteWhenInterrupted(OH_AudioStreamBuilder* builder, bool muteWhenInterrupted); +/** + * @brief Set the callback of fast status change event for audio renderer. + * + * @param builder Builder provided by OH_AudioStreamBuilder_Create() + * @param callback Callback function that will recevie the fast status change event. + * @param userData Pointer to an application data structure that will be passed to the callback functions. + * @return + * {@link AUDIOSTREAM_SUCCESS} if the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} the param of builder or callback is nullptr. + * @since 20 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererFastStatusChangeCallback(OH_AudioStreamBuilder* builder, + OH_AudioRenderer_OnFastStatusChange callback, void* userData); + +/** + * @brief Set the callback of fast status change event for audio capturer. + * + * @param builder Builder provided by OH_AudioStreamBuilder_Create() + * @param callback Callback function that will recevie the fast status change event. + * @param userData Pointer to an application data structure that will be passed to the callback functions. + * @return + * {@link AUDIOSTREAM_SUCCESS} if the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} the param of builder or callback is nullptr. + * @since 20 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerFastStatusChangeCallback(OH_AudioStreamBuilder* builder, + OH_AudioCapturer_OnFastStatusChange callback, void* userData); + + #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/ohaudio.ndk.json b/multimedia/audio_framework/ohaudio.ndk.json index 048a15b035fb726b4e9b022855a27b3c461726a3..73e3be08e86836e8e8812bff4ed8b606c5574574 100644 --- a/multimedia/audio_framework/ohaudio.ndk.json +++ b/multimedia/audio_framework/ohaudio.ndk.json @@ -389,36 +389,36 @@ }, { "first_introduced": "19", - "name": "OH_AudioStreamBuilder_SetRendererInterruptCallback" + "name": "OH_AudioManager_GetAudioStreamManager" }, { "first_introduced": "19", + "name": "OH_AudioStreamManager_GetDirectPlaybackSupport" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamBuilder_SetRendererInterruptCallback" + }, + { + "first_introduced": "20", "name": "OH_AudioStreamBuilder_SetRendererErrorCallback" }, { - "first_introduced": "19", + "first_introduced": "20", "name": "OH_AudioStreamBuilder_SetCapturerReadDataCallback" }, { - "first_introduced": "19", + "first_introduced": "20", "name": "OH_AudioStreamBuilder_SetCapturerDeviceChangeCallback" }, { - "first_introduced": "19", + "first_introduced": "20", "name": "OH_AudioStreamBuilder_SetCapturerInterruptCallback" }, { - "first_introduced": "19", + "first_introduced": "20", "name": "OH_AudioStreamBuilder_SetCapturerErrorCallback" }, - { - "first_introduced": "19", - "name": "OH_AudioManager_GetAudioStreamManager" - }, - { - "first_introduced": "19", - "name": "OH_AudioStreamManager_GetDirectPlaybackSupport" - }, { "first_introduced": "20", "name": "OH_AudioStreamManager_IsAcousticEchoCancelerSupported" @@ -474,5 +474,29 @@ { "first_introduced": "20", "name": "OH_AudioVolumeManager_UnregisterRingerModeChangeCallback" + }, + { + "first_introduced": "20", + "name": "OH_AudioRenderer_GetFastStatus" + }, + { + "first_introduced": "20", + "name": "OH_AudioCapturer_GetFastStatus" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamManager_IsFastPlaybackSupported" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamManager_IsFastRecordingSupported" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamBuilder_SetRendererFastStatusChangeCallback" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamBuilder_SetCapturerFastStatusChangeCallback" } ] diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index 8077a4119567a7bc3f9a471c6a9ffd51076c841b..5da23bba59a24e8a472940a550bea99942e1d151 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -423,6 +423,18 @@ "first_introduced": "18", "name": "OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT" }, + { + "first_introduced": "20", + "name": "OH_MD_KEY_VIDEO_ENCODER_ROI_PARAMS" + }, + { + "first_introduced": "20", + "name": "OH_MD_KEY_SQR_FACTOR" + }, + { + "first_introduced": "20", + "name": "OH_MD_KEY_MAX_BITRATE" + }, { "first_introduced": "10", "name": "OH_AVCodec_GetCapability" diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 609dc238e0af050156bd7952e9cbb0237a1cc935..705b0d651d53c8ce94987ad8876f725ebb211faf 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -1031,6 +1031,38 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER; * @since 18 */ extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT; +/** + * @brief Key to set the region of interest(ROI) as QpOffset-Rects, value type is string in the format + * "Top1,Left1-Bottom1,Right1=Offset1;Top2,Left2-Bottom2,Right2=Offset2;". Each "Top,Left-Bottom,Right=Offset" + * represents the coordinate information and quantization parameter of one ROI. Each "=Offset" in the string + * can be omitted, like "Top1,Left1-Bottom1,Right1;Top2,Left2-Bottom2,Right2=Offset2;", the encoder + * will use the default quantization parameter to perform the ROI encoding on the first ROI and + * use Offset2 on the second ROI. + * + * This is an optional key that applies only to video encoder. + * It is used in running process and is set with each frame. + * In surface mode, it is used in {@link OH_VideoEncoder_OnNeedInputParameter}. + * In buffer mode, it is configured via {@link OH_AVBuffer_SetParameter}. + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 20 + */ +extern const char *OH_MD_KEY_VIDEO_ENCODER_ROI_PARAMS; +/** + * @brief Key for the desired encoding quality, value type is int32_t, this key is only + * supported for encoders that are configured in Stable Quality RateControl, the higher + * values generally result in more efficient(smaller-sized) encoding. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 20 + */ +extern const char *OH_MD_KEY_SQR_FACTOR; +/** + * @brief Key for maximum bitrate, value type is int64_t. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 20 + */ +extern const char *OH_MD_KEY_MAX_BITRATE; /** * @brief Media type. @@ -1562,7 +1594,11 @@ typedef enum OH_BitrateMode { /** Variable Bit rate mode. */ BITRATE_MODE_VBR = 1, /** Constant Quality mode. */ - BITRATE_MODE_CQ = 2 + BITRATE_MODE_CQ = 2, + /** Stable Quality Rate Control mode. + * @since 20 + */ + BITRATE_MODE_SQR = 3 } OH_BitrateMode; #ifdef __cplusplus diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h index 274390abd1f8e5c21d6699f604f0454fb2ccba0f..5dace12f1ffeb111228510ab4835efd27798f999 100644 --- a/multimedia/camera_framework/camera.h +++ b/multimedia/camera_framework/camera.h @@ -1152,6 +1152,49 @@ typedef struct Camera_ConcurrentInfo { uint32_t modeAndCapabilitySize; } Camera_ConcurrentInfo; +/** + * @brief Enumerates the white balance modes. + * + * @since 20 + * @version 1.0 + */ +typedef enum Camera_WhiteBalanceMode { + /** + * Auto white balance mode. + */ + CAMERA_WHITE_BALANCE_MODE_AUTO = 0, + + /** + * Cloudy white balance mode. + */ + CAMERA_WHITE_BALANCE_MODE_CLOUDY = 1, + + /** + * Incandescent white balance mode. + */ + CAMERA_WHITE_BALANCE_MODE_INCANDESCENT = 2, + + /** + * Fluorescent white balance mode. + */ + CAMERA_WHITE_BALANCE_MODE_FLUORESCENT = 3, + + /** + * Daylight white balance mode. + */ + CAMERA_WHITE_BALANCE_MODE_DAYLIGHT = 4, + + /** + * Manual white balance mode. + */ + CAMERA_WHITE_BALANCE_MODE_MANUAL = 5, + + /** + * Locked white balance mode. + */ + CAMERA_WHITE_BALANCE_MODE_LOCKED = 6 +} Camera_WhiteBalanceMode; + #ifdef __cplusplus } #endif diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index e92a2841fea73cf29949a8c360cd504a751e337d..5bb71a86e196c8a5e8a3dae1e1ec126fbda71d0f 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -670,5 +670,29 @@ { "first_introduced": "19", "name": "OH_CaptureSession_EnableMacro" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_IsWhiteBalanceModeSupported" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_GetWhiteBalanceMode" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_GetWhiteBalanceRange" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_GetWhiteBalance" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_SetWhiteBalance" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_SetWhiteBalanceMode" } ] diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h index 93e77e11881b41895cb9d56b4ba5141c5056c2e1..34ea4d17f5288707b307bb5394703ced8186b0b6 100644 --- a/multimedia/camera_framework/capture_session.h +++ b/multimedia/camera_framework/capture_session.h @@ -956,6 +956,90 @@ Camera_ErrorCode OH_CaptureSession_IsMacroSupported(Camera_CaptureSession* sessi */ Camera_ErrorCode OH_CaptureSession_EnableMacro(Camera_CaptureSession* session, bool enabled); +/** + * @brief Checks whether the specified white balance mode is supported. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param whiteBalanceMode White balance mode. + * @param isSupported Pointer to the check result. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if the input parameter is missing or the parameter type is incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} is returned if the camera session is not configured. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_IsWhiteBalanceModeSupported( + Camera_CaptureSession *session, Camera_WhiteBalanceMode whiteBalanceMode, bool *isSupported); + +/** + * @brief Obtains the white balance mode in use. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param whiteBalanceMode Pointer to the white balance mode. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if the input parameter is missing or the parameter type is incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} is returned if the camera session is not configured. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_GetWhiteBalanceMode( + Camera_CaptureSession *session, Camera_WhiteBalanceMode *whiteBalanceMode); + +/** + * @brief Obtains the supported white balance color temperature range. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param minColorTemperature Pointer to the minimum color temperature. + * @param maxColorTemperature Pointer to the maximum color temperature. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if the input parameter is missing or the parameter type is incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} is returned if the camera session is not configured. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_GetWhiteBalanceRange( + Camera_CaptureSession *session, int32_t *minColorTemperature, int32_t *maxColorTemperature); + +/** + * @brief Obtains the white balance color temperature. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param colorTemperature Pointer to the color temperature. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if the input parameter is missing or the parameter type is incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} is returned if the camera session is not configured. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_GetWhiteBalance(Camera_CaptureSession *session, int32_t *colorTemperature); + +/** + * @brief Sets the white balance color temperature. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param colorTemperature Color temperature. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if the input parameter is missing or the parameter type is incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} is returned if the camera session is not configured. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_SetWhiteBalance(Camera_CaptureSession *session, int32_t colorTemperature); + +/** + * @brief Sets a white balance mode. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param whiteBalanceMode White balance mode. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if the input parameter is missing or the parameter type is incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} is returned if the camera session is not configured. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_SetWhiteBalanceMode( + Camera_CaptureSession *session, Camera_WhiteBalanceMode whiteBalanceMode); + #ifdef __cplusplus } #endif diff --git a/multimedia/image_effect/image_effect.h b/multimedia/image_effect/image_effect.h index db65c16e4f0dd1adefa49191e099835b530cb2cb..225906bd6d43e6be2b4d7f8da74c0a862a072d33 100644 --- a/multimedia/image_effect/image_effect.h +++ b/multimedia/image_effect/image_effect.h @@ -343,6 +343,36 @@ ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect */ ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture); +/** + * @brief Sets the ID of the input texture that contains the image information. + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @param { OH_ImageEffect } imageEffect Pointer to an instance of the OH_ImageEffect struct. + * @param textureId ID of the texture that contains the image information. This ID must be valid and have been + * bound bound to a texture of a GL_TEXTURE_2D type. + * @param colorSpace Color space of the image. + * @return Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the + * parameter parameter is missing or incorrect. + * @since 20 + */ +ImageEffect_ErrorCode OH_ImageEffect_SetInputTextureId(OH_ImageEffect *imageEffect, int32_t textureId, + int32_t colorSpace); + +/** + * @brief Sets the ID of the output texture that contains the rendered image information. + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @param imageEffect Pointer to an instance of the OH_ImageEffect struct. + * @param textureId ID of the texture that contains the rendered image information. This ID must be valid. If + * it it is not bound to a texture, it will automatically be bound to a GL_TEXTURE_2D type. If the texture is + * already already bound and the size is inappropriate, the rendered result may be cropped or partially filled + * into into this texture. + * @return Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the + * parameter parameter is missing or incorrect. + * @since 20 + */ +ImageEffect_ErrorCode OH_ImageEffect_SetOutputTextureId(OH_ImageEffect *imageEffect, int32_t textureId); + /** * @brief Render the filter effects that can be a single filter or a chain of filters * diff --git a/multimedia/image_effect/image_effect_filter.h b/multimedia/image_effect/image_effect_filter.h index d42de85d79a133d034657731d24c0339bdd72839..9307189da155784f3c9332b7a7d335cb6b80ec6e 100644 --- a/multimedia/image_effect/image_effect_filter.h +++ b/multimedia/image_effect/image_effect_filter.h @@ -534,6 +534,30 @@ ImageEffect_ErrorCode OH_EffectBufferInfo_SetTimestamp(OH_EffectBufferInfo *info */ ImageEffect_ErrorCode OH_EffectBufferInfo_GetTimestamp(OH_EffectBufferInfo *info, int64_t *timestamp); +/** + * @brief Sets the texture ID of the image for an OH_EffectBufferInfo struct. + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @param info Pointer to an instance of the OH_EffectBufferInfo struct. + * @param textureId Pointer to the texture ID of the image. + * @return Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the + * parameter parameter is missing. + * @since 20 + */ +ImageEffect_ErrorCode OH_EffectBufferInfo_SetTextureId(OH_EffectBufferInfo *info, int32_t textureId); + +/** + * @brief Obtains the texture ID of an image from an OH_EffectBufferInfo struct. + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @param info Pointer to an instance of the OH_EffectBufferInfo struct. + * @param textureId Texture ID of the image. + * @return Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the + * parameter parameter is missing. + * @since 20 + */ +ImageEffect_ErrorCode OH_EffectBufferInfo_GetTextureId(OH_EffectBufferInfo *info, int32_t *textureId); + /** * @brief Clear the internal resources of the OH_EffectBufferInfo and destroy the OH_EffectBufferInfo instance * @@ -765,6 +789,25 @@ ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo(const char *name, OH_Effe ImageEffect_ErrorCode OH_EffectFilter_Render(OH_EffectFilter *filter, OH_PixelmapNative *inputPixelmap, OH_PixelmapNative *outputPixelmap); +/** + * @brief Applies the filter effect using texture IDs. This function does not support using the same texture + * for for both input and output. + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @param filter Pointer to an instance of the OH_EffectFilter struct. + * @param inputTextureId ID of the input texture. This ID must be valid and bound to a texture of the + * GL_TEXTURE_2D GL_TEXTURE_2D type. + * @param outputTextureId ID of the output texture. This ID must be valid. If it is not bound to a texture, it + * will will automatically be bound to a GL_TEXTURE_2D type. If the texture is already bound and the size is + * inappropriate, inappropriate, the rendered result may be cropped or partially filled into this texture. + * @param colorSpace Color space of the image. + * @return Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the + * parameter parameter is missing. + * @since 20 + */ +ImageEffect_ErrorCode OH_EffectFilter_RenderWithTextureId(OH_EffectFilter *filter, int32_t inputTextureId, + int32_t outputTextureId, int32_t colorSpace); + /** * @brief Clear the internal resources of the OH_EffectFilter and destroy the OH_EffectFilter instance * diff --git a/multimedia/image_effect/libimage_effect.ndk.json b/multimedia/image_effect/libimage_effect.ndk.json index 16f31e29f19a30b0443d3c5c819da543c176fcbe..abaca9dcbe23271a4bac92648fb267104145e107 100644 --- a/multimedia/image_effect/libimage_effect.ndk.json +++ b/multimedia/image_effect/libimage_effect.ndk.json @@ -83,6 +83,14 @@ "first_introduced": "12", "name": "OH_EffectBufferInfo_GetTimestamp" }, + { + "first_introduced": "20", + "name": "OH_EffectBufferInfo_SetTextureId" + }, + { + "first_introduced": "20", + "name": "OH_EffectBufferInfo_GetTextureId" + }, { "first_introduced": "12", "name": "OH_EffectBufferInfo_Release" @@ -119,6 +127,10 @@ "first_introduced": "12", "name": "OH_EffectFilter_Render" }, + { + "first_introduced": "20", + "name": "OH_EffectFilter_RenderWithTextureId" + }, { "first_introduced": "12", "name": "OH_EffectFilter_Release" @@ -211,6 +223,14 @@ "first_introduced": "13", "name": "OH_ImageEffect_SetOutputPicture" }, + { + "first_introduced": "20", + "name": "OH_ImageEffect_SetInputTextureId" + }, + { + "first_introduced": "20", + "name": "OH_ImageEffect_SetOutputTextureId" + }, { "first_introduced": "12", "name": "OH_ImageEffect_Start" diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index 05662665f7622428f79b631d69dbd92d62918bd0..da856df52a9446447127398237c7c82134962e86 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -184,6 +184,12 @@ typedef enum { * @since 15 */ IMAGE_LOCK_UNLOCK_FAILED = 7600303, + /** + * @error unsupported allocator mode, e.g., use share memory to create a HDR image as only + * DMA supported hdr metadata. + * @since 20 + */ + IMAGE_ALLOCATOR_MODE_UNSUPPORTED = 7600501, /** unknown error */ IMAGE_UNKNOWN_ERROR = 7600901, /** decode data source exception */ @@ -227,6 +233,11 @@ typedef enum { IMAGE_PACKER_INVALID_PARAMETER = 7800202, /** encode failed */ IMAGE_ENCODE_FAILED = 7800301, + /** + * @error Invalid parameter for ImageReceiver. + * @since 20 + */ + IMAGE_RECEIVER_INVALID_PARAMETER = 7900201, } Image_ErrorCode; /** @@ -245,6 +256,32 @@ typedef enum { FRAGMENT_METADATA = 2, } Image_MetadataType; +/** + * @brief Type of allocator used to allocate memory of a PixelMap. + * + * @since 20 + */ +typedef enum { + /** + * The system determines which memory to use to create the PixelMap. + * + * @since 20 + */ + IMAGE_ALLOCATOR_MODE_AUTO = 0, + /** + * Use DMA buffer to create the PixelMap. + * + * @since 20 + */ + IMAGE_ALLOCATOR_MODE_DMA = 1, + /** + * Use share memory to create the PixelMap. + * + * @since 20 + */ + IMAGE_ALLOCATOR_MODE_SHARED_MEMORY = 2, +} IMAGE_ALLOCATOR_MODE; + /** * @brief Creates a PictureMetadata object. * diff --git a/multimedia/image_framework/include/image/image_receiver_native.h b/multimedia/image_framework/include/image/image_receiver_native.h index 09fef3b1bf4b489e1d845f9f49922c2b175ccf33..526cd49ed865873b955e2b08f34fe999404da2a8 100644 --- a/multimedia/image_framework/include/image/image_receiver_native.h +++ b/multimedia/image_framework/include/image/image_receiver_native.h @@ -76,6 +76,13 @@ typedef struct OH_ImageReceiverOptions OH_ImageReceiverOptions; */ typedef void (*OH_ImageReceiver_OnCallback)(OH_ImageReceiverNative *receiver); +/** + * @brief Defines the callback for the ImageArrive event. + * + * @since 20 + */ +typedef void (*OH_ImageReceiver_ImageArriveCallback)(OH_ImageReceiverNative *receiver, void *userData); + /** * @brief Creates an OH_ImageReceiverOptions object at the application layer. * @@ -223,6 +230,32 @@ Image_ErrorCode OH_ImageReceiverNative_On(OH_ImageReceiverNative* receiver, OH_I */ Image_ErrorCode OH_ImageReceiverNative_Off(OH_ImageReceiverNative* receiver); +/** + * Registers an {@link OH_ImageReceiver_ImageArriveCallback} callback. + * + * @param receiver Pointer to an OH_ImageReceiverNative object that processes the callback. + * @param callback OH_ImageReceiver_ImageArriveCallback to register. + * @param userData Pointer to the user data passed to the callback. + * @return Result code. {@link Image_ErrorCode} IMAGE_SUCCESS is returned if the operation is successful. + * {@link Image_ErrorCode} IMAGE_RECEIVER_INVALID_PARAMETER is returned if receiver or callback is null. + * @since 20 + */ +Image_ErrorCode OH_ImageReceiverNative_OnImageArrive(OH_ImageReceiverNative *receiver, + OH_ImageReceiver_ImageArriveCallback callback, void *userData); + +/** + * Unregisters an {@link OH_ImageReceiver_ImageArriveCallback} callback. + * + * @param receiver Pointer to an OH_ImageReceiverNative object that processes the callback. + * @param callback OH_ImageReceiver_ImageArriveCallback callback to unregister. + * @return {@link Image_ErrorCode} IMAGE_SUCCESS - Operation succeeded. + * {@link Image_ErrorCode} IMAGE_RECEIVER_INVALID_PARAMETER - receiver is empty or callback is not + * registered. + * @since 20 +*/ +Image_ErrorCode OH_ImageReceiverNative_OffImageArrive(OH_ImageReceiverNative *receiver, + OH_ImageReceiver_ImageArriveCallback callback); + /** * @brief Obtains the size of the image receiver through an {@link OH_ImageReceiverNative} object. * diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index 9d3f1075ec4b584992f03308a5933bc5538e137f..6c7507067e1cc24f45bbeb1997791a2bf01914b9 100644 --- a/multimedia/image_framework/include/image/pixelmap_native.h +++ b/multimedia/image_framework/include/image/pixelmap_native.h @@ -571,6 +571,18 @@ Image_ErrorCode OH_PixelmapImageInfo_GetWidth(OH_Pixelmap_ImageInfo *info, uint3 */ Image_ErrorCode OH_PixelmapImageInfo_GetHeight(OH_Pixelmap_ImageInfo *info, uint32_t *height); +/** + * @brief Get alphaMode number for imageinfo struct. + * + * @param info The imageinfo pointer will be operated. + * @param alphaMode The number of imageinfo alphaMode. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or alphaMode is nullptr. + * @since 20 + */ +Image_ErrorCode OH_PixelmapImageInfo_GetAlphaMode(OH_Pixelmap_ImageInfo *info, int32_t *alphaMode); + /** * @brief Get rowStride number for imageinfo struct. * @@ -634,6 +646,30 @@ Image_ErrorCode OH_PixelmapImageInfo_Release(OH_Pixelmap_ImageInfo *info); Image_ErrorCode OH_PixelmapNative_CreatePixelmap(uint8_t *data, size_t dataLength, OH_Pixelmap_InitializationOptions *options, OH_PixelmapNative **pixelmap); +/** + * @brief Creates a pixelmap based on options {@link OH_Pixelmap_InitializationOptions}, the memory type used by the + * pixelmap can be specified by allocatorType {@link IMAGE_ALLOCATOR_MODE}. By default, the system selects the memory + * type based on the image type, image size, platform capability, etc. When processing the pixelmap returned by this + * interface, please always consider the impact of stride. + * + * @param data Input color buffer in BGRA_8888 format by default. + * @param dataLength Length of input buffer in bytes. + * @param options Pixelmap initialization properties including size, pixel format, alpha type, and editable flags. + * @param allocator Indicate which memory type will be used by the returned pixelmap. + * @param pixelmap Output parameter receiving the created pixelmap object pointer. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the operation is successful. + * {@link IMAGE_BAD_PARAMETER} If the param is nullptr or invalid. + * {@link IMAGE_TOO_LARGE} too large data or image. + * {@link IMAGE_UNSUPPORTED_OPERATION} unsupported operations. + * {@link IMAGE_DMA_OPERATION_FAILED} DMA operation failed. + * {@link IMAGE_ALLOCATOR_MODE_UNSUPPROTED} unsupported allocator mode, e.g., + * use share memory to create a HDR image as only DMA supported hdr metadata. + * @since 20 + */ +Image_ErrorCode OH_PixelmapNative_CreatePixelmapUsingAllocator(uint8_t *data, size_t dataLength, + OH_Pixelmap_InitializationOptions *options, IMAGE_ALLOCATOR_MODE allocator, OH_PixelmapNative **pixelmap); + /** * @brief Convert a native PixelMap object to PixelMap napi object. * @@ -881,6 +917,27 @@ Image_ErrorCode OH_PixelmapNative_ConvertAlphaFormat(OH_PixelmapNative* srcpixel Image_ErrorCode OH_PixelmapNative_CreateEmptyPixelmap( OH_Pixelmap_InitializationOptions *options, OH_PixelmapNative **pixelmap); +/** + * @brief Creates a empty pixelmap based on options {@link OH_Pixelmap_InitializationOptions}, the memory type used by the + * pixelmap can be specified by allocatorType {@link IMAGE_ALLOCATOR_MODE}. By default, the system selects the memory + * type based on the image type, image size, platform capability, etc. When processing the pixelmap returned by this + * interface, please always consider the impact of stride. + * + * @param options Pixelmap initialization properties including size, pixel format, alpha type, and editable flags. + * @param allocator Indicate which memory type will be used by the returned pixelmap. + * @param pixelmap Output parameter receiving the created pixelmap object pointer. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the operation is successful. + * {@link IMAGE_BAD_PARAMETER} If the param is nullptr or invalid. + * {@link IMAGE_TOO_LARGE} too large data or image. + * {@link IMAGE_UNSUPPORTED_OPERATION} unsupported operations. + * {@link IMAGE_ALLOCATOR_MODE_UNSUPPROTED} unsupported allocator mode, e.g., use + * share memory to create a HDR image as only DMA supported hdr metadata. + * @since 20 + */ +Image_ErrorCode OH_PixelmapNative_CreateEmptyPixelmapUsingAllocator( + OH_Pixelmap_InitializationOptions *options, IMAGE_ALLOCATOR_MODE allocator, OH_PixelmapNative **pixelmap); + /** * @brief Get metadata. * diff --git a/multimedia/image_framework/libimage_receiver.ndk.json b/multimedia/image_framework/libimage_receiver.ndk.json index 95058723f5c2455b4ffd8eb1c03ccd6f1a6d1ee9..2ff42d64319862310faa9044a89b6aae267067b6 100644 --- a/multimedia/image_framework/libimage_receiver.ndk.json +++ b/multimedia/image_framework/libimage_receiver.ndk.json @@ -47,6 +47,14 @@ "first_introduced": "12", "name": "OH_ImageReceiverNative_Off" }, + { + "first_introduced": "20", + "name": "OH_ImageReceiverNative_OnImageArrive" + }, + { + "first_introduced": "20", + "name": "OH_ImageReceiverNative_OffImageArrive" + }, { "first_introduced": "12", "name": "OH_ImageReceiverNative_GetSize" diff --git a/multimedia/image_framework/libpixelmap.ndk.json b/multimedia/image_framework/libpixelmap.ndk.json index 68d85046276151ae05e2923ec77bb88316355363..f52699ef6d0da891a2527337596a9dc8098f80ab 100644 --- a/multimedia/image_framework/libpixelmap.ndk.json +++ b/multimedia/image_framework/libpixelmap.ndk.json @@ -15,6 +15,10 @@ "first_introduced": "12", "name": "OH_PixelmapInitializationOptions_GetHeight" }, + { + "first_introduced": "20", + "name": "OH_PixelmapImageInfo_GetAlphaMode" + }, { "first_introduced": "12", "name": "OH_PixelmapInitializationOptions_SetHeight" @@ -99,6 +103,10 @@ "first_introduced": "12", "name": "OH_PixelmapNative_CreatePixelmap" }, + { + "first_introduced": "20", + "name": "OH_PixelmapNative_CreatePixelmapUsingAllocator" + }, { "first_introduced": "12", "name": "OH_PixelmapNative_ReadPixels" @@ -171,6 +179,10 @@ "first_introduced": "12", "name": "OH_PixelmapNative_CreateEmptyPixelmap" }, + { + "first_introduced": "20", + "name": "OH_PixelmapNative_CreateEmptyPixelmapUsingAllocator" + }, { "first_introduced": "12", "name": "OH_PixelmapNative_GetMetadata" diff --git a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json index 48aa9a0d410a24e264c62d7adf781a29da55bbee..7229854286eaca809f9ecab1d45265599474ec73 100644 --- a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json +++ b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json @@ -134,5 +134,21 @@ { "first_introduced": "20", "name": "OH_AVScreenCapture_SetCaptureArea" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_StrategyForPrivacyMaskMode" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_SetSelectionCallback" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_GetCaptureTypeSelected" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_GetDisplayIdSelected" } ] \ No newline at end of file diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index 5bf1e8487f6e1160e1e74fcc7dd1130e05057679..091e3ccf863bf3553911868f96f192da7a690338 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -540,6 +540,65 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureContentChangedCallback( */ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureArea(struct OH_AVScreenCapture *capture, uint64_t displayId, OH_Rect* area); + +/** + * @brief Set the fill mode for screen capture when a privacy window exists + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture_CaptureStrategy*} strategy Pointer to an OH_AVScreenCapture_CaptureStrategy instance + * @param {int32_t} value + * If set to 0, it means that when there is a privacy window interface, the output screen image is completely black. + * If set to 1, it means that when there is a privacy window interface, only the privacy window area of the output + * screen becomes black, and other values returns an error. + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} strategy is nullptr or value is invalid. + * @since 20 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StrategyForPrivacyMaskMode( + OH_AVScreenCapture_CaptureStrategy *strategy, int32_t value); + +/** + * @brief Register user selection notification callback function + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture*} capture Pointer to OH_AVScreenCapture which want to handle user selection info + * @param {OH_AVScreenCapture_OnUserSelected} callback user selection callback function, see + * {@link OH_AVScreenCapture_OnUserSelected} + * @param {void*} userData The control block pointer passed by the application is carried to the application when it + * is returned + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr. + * @since 20 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetSelectionCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnUserSelected callback, void *userData); + +/** + * @brief Get the recording content type selected by the user in the confirmation interface + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture_UserSelectionInfo*} selection Pointer to an OH_AVScreenCapture_UserSelectionInfo instance + * @param {int32_t*} type The capture object type selected by the user, 0: represents the screen, 1: represents the + * window. + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} if selections is nullptr. + * @since 20 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_GetCaptureTypeSelected(OH_AVScreenCapture_UserSelectionInfo *selection, + int32_t* type); + +/** + * @brief Get the Display ID of user selections in the confirmation interface + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture_UserSelectionInfo*} selection Pointer to an OH_AVScreenCapture_UserSelectionInfo instance + * @param {uint64_t*} displayId Returns the screen ID value selected by the user + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} if selections is nullptr. + * @since 20 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_GetDisplayIdSelected(OH_AVScreenCapture_UserSelectionInfo *selection, + uint64_t* displayId); #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/native_avscreen_capture_base.h b/multimedia/player_framework/native_avscreen_capture_base.h index 7b00c4201ecc631bd3d84d656d9cafc3089280de..966a09b4eabc013ae6d7d9667ec1935b3822ca76 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -569,6 +569,27 @@ typedef struct OH_AVScreenCapture_CaptureStrategy OH_AVScreenCapture_CaptureStra typedef void (*OH_AVScreenCapture_OnCaptureContentChanged)(OH_AVScreenCapture* capture, OH_AVScreenCaptureContentChangedEvent event, OH_Rect* area, void *userData); +/** + * @brief Initialization of OH_AVScreenCapture_UserSelectionInfo + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 20 + */ +typedef struct OH_AVScreenCapture_UserSelectionInfo OH_AVScreenCapture_UserSelectionInfo; + +/** +* @brief When the user selects parameters in the authorization interface (selection interface), +* the function interface returns the parameters to the application. +* @syscap SystemCapability.Multimedia.Media.AVScreenCapture +* @param {OH_AVScreenCapture*} capture Pointer to an OH_AVScreenCapture instance +* @param {OH_AVScreenCapture_UserSelectionInfo*} selections The recording parameter information +* selected by the user on the authorization interface +* @param {void*} userData Pointer to user specific data +* +* @since 20 +*/ +typedef void (*OH_AVScreenCapture_OnUserSelected)(OH_AVScreenCapture* capture, + OH_AVScreenCapture_UserSelectionInfo* selections, void *userData); #ifdef __cplusplus } #endif diff --git a/network/netssl/BUILD.gn b/network/netssl/BUILD.gn index a561b30af7b8f4d2829f6dd12b5cdd03f3ef112c..3f3a388fe1fa03641bc618efceb8f98df93f750a 100644 --- a/network/netssl/BUILD.gn +++ b/network/netssl/BUILD.gn @@ -19,7 +19,7 @@ ohos_ndk_library("libnet_ssl_ndk") { output_extension = "so" ndk_description_file = "./libnet_ssl_c.json" min_compact_version = "1" - system_capability = "SystemCapability.Communication.Netstack" + system_capability = "SystemCapability.Communication.NetStack" system_capability_headers = [ "network/netstack/net_ssl/net_ssl_c.h", diff --git a/network/netstack/net_http/libnet_http.ndk.json b/network/netstack/net_http/libnet_http.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..5a00aa6f2e8511bf6bc1cffefff8260590a71d2c --- /dev/null +++ b/network/netstack/net_http/libnet_http.ndk.json @@ -0,0 +1,38 @@ +[ + { + "first_introduced":"20", + "name": "OH_Http_CreateHeaders" + }, + { + "first_introduced":"20", + "name": "OH_Http_DestroyHeaders" + }, + { + "first_introduced":"20", + "name": "OH_Http_SetHeaderValue" + }, + { + "first_introduced":"20", + "name": "OH_Http_CreateRequest" + }, + { + "first_introduced":"20", + "name": "OH_Http_Request" + }, + { + "first_introduced":"20", + "name": "OH_Http_Destroy" + }, + { + "first_introduced":"20", + "name": "OH_Http_GetHeaderValue" + }, + { + "first_introduced":"20", + "name": "OH_Http_GetHeaderEntries" + }, + { + "first_introduced":"20", + "name": "OH_Http_DestroyHeaderEntries" + } +] \ No newline at end of file diff --git a/network/netstack/net_http/net_http.h b/network/netstack/net_http/net_http.h new file mode 100644 index 0000000000000000000000000000000000000000..24878f4da63d389fe98b71b811af5b6a2c64675c --- /dev/null +++ b/network/netstack/net_http/net_http.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup netstack + * @{ + * + * @brief Defines the APIs for http. + * + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ + +/** + * @file net_http.h + * @brief Defines the APIs for http. + * + * @library libnet_http.so + * @kit NetworkKit + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ + +#ifndef NET_HTTP_H +#define NET_HTTP_H + +#include +#include + +#include "net_http_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates headers for a request or response. + * + * @return Http_Headers* Pointer to {@link Http_Headers}. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +Http_Headers *OH_Http_CreateHeaders(void); + +/** + * @brief Destroys the headers of a request or response. + * + * @param headers Pointer to the {@link Http_Headers} to be destroyed, headers ends with null. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +void OH_Http_DestroyHeaders(Http_Headers **headers); + +/** + * @brief Sets the key-value pair of the request or response header. + * + * @param headers Pointer to the {@link Http_Headers} to be set. + * @param name Key. + * @param value Value. + * @return uint32_t 0 - success. 401 - Parameter error. 2300027 - Out of memory. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +uint32_t OH_Http_SetHeaderValue(struct Http_Headers *headers, const char *name, const char *value); + +/** + * @brief Obtains the value of a request or response header by key. + * + * @param headers Pointer to {@link Http_Headers}. + * @param name Key. + * @return Http_HeaderValue* Pointer to the obtained {@link Http_HeaderValue}. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +Http_HeaderValue *OH_Http_GetHeaderValue(Http_Headers *headers, const char *name); + +/** + * @brief Obtains all the key-value pairs of a request or response header. + * + * @param headers Pointer to {@link Http_Headersaders}. + * @return Http_HeaderEntry* Pointers to all obtained key-value pairs {@link Http_HeaderEntry}. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +Http_HeaderEntry *OH_Http_GetHeaderEntries(Http_Headers *headers); + +/** + * @brief Destroys all key-value pairs obtained in {@link OH_Http_GetHeaderEntries}. + * + * @param headerEntry Pointer to the {@link Http_HeaderEntry} to be destroyed, headerEntry ends with null. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +void OH_Http_DestroyHeaderEntries(Http_HeaderEntry **headerEntry); + +/** + * @brief Create a http request. + * + * @param url Http request url. + * @return Pointer of HttpRequest if success; Null otherwise. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +Http_Request *OH_Http_CreateRequest(const char *url); + +/** + * @brief Initiates an HTTP request. + * + * @param request Pointer to {@link Http_Request}. + * @param callback Http response info, pointer to {@link Http_ResponseCallback} + * @param handler Callbacks to watch different events, pointer to {@link Http_EventsHandler}. + * @return 0 if success; non-0 otherwise. For details about error codes, see {@link Http_ErrCode}. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +int OH_Http_Request(Http_Request *request, Http_ResponseCallback callback, Http_EventsHandler handler); + +/** + * @brief Destroy the HTTP request. + * + * @param request Pointer to the http request {@link Http_Request}. + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ +void OH_Http_Destroy(struct Http_Request **request); +#ifdef __cplusplus +} +#endif +#endif // NET_HTTP_H + +/** @} */ \ No newline at end of file diff --git a/network/netstack/net_http/net_http_type.h b/network/netstack/net_http/net_http_type.h new file mode 100644 index 0000000000000000000000000000000000000000..f02019792b4646bfbc8e0cd235b857bf65e51da0 --- /dev/null +++ b/network/netstack/net_http/net_http_type.h @@ -0,0 +1,572 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup netstack + * @{ + * + * @brief Provides C APIs for the Http client module. + * + * @since 20 + */ + +/** + * @file net_http_type.h + * @brief Defines the data structure for the C APIs of the http module. + * + * @library libnet_http.so + * @kit NetworkKit + * @syscap SystemCapability.Communication.NetStack + * @since 20 + */ + +#ifndef NET_HTTP_TYPE_H +#define NET_HTTP_TYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define OHOS_HTTP_MAX_PATH_LEN 128 +#define OHOS_HTTP_MAX_STR_LEN 256 +#define OHOS_HTTP_DNS_SERVER_NUM_MAX 3 + +/** + * @brief Defines http error code. + * + * @since 20 + */ +typedef enum Http_ErrCode { + /** Operation success. */ + OH_HTTP_RESULT_OK = 0, + /** @brief Parameter error. */ + OH_HTTP_PARAMETER_ERROR = 401, + /** @brief Permission denied. */ + OH_HTTP_PERMISSION_DENIED = 201, + /** @brief Error code base. */ + OH_HTTP_NETSTACK_E_BASE = 2300000, + /** @brief Unsupported protocol. */ + OH_HTTP_UNSUPPORTED_PROTOCOL = (OH_HTTP_NETSTACK_E_BASE + 1), + /** @brief Invalid URL format or missing URL. */ + OH_HTTP_INVALID_URL = (OH_HTTP_NETSTACK_E_BASE + 3), + /** @brief Failed to resolve the proxy name. */ + OH_HTTP_RESOLVE_PROXY_FAILED = (OH_HTTP_NETSTACK_E_BASE + 5), + /** @brief Failed to resolve the host name. */ + OH_HTTP_RESOLVE_HOST_FAILED = (OH_HTTP_NETSTACK_E_BASE + 6), + /** @brief Failed to connect to the server. */ + OH_HTTP_CONNECT_SERVER_FAILED = (OH_HTTP_NETSTACK_E_BASE + 7), + /** @brief Invalid server response. */ + OH_HTTP_INVALID_SERVER_RESPONSE = (OH_HTTP_NETSTACK_E_BASE + 8), + /** @brief Access to the remote resource denied. */ + OH_HTTP_ACCESS_REMOTE_DENIED = (OH_HTTP_NETSTACK_E_BASE + 9), + /** @brief Error in the HTTP2 framing layer. */ + OH_HTTP_HTTP2_FRAMING_ERROR = (OH_HTTP_NETSTACK_E_BASE + 16), + /** @brief Transferred a partial file. */ + OH_HTTP_TRANSFER_PARTIAL_FILE = (OH_HTTP_NETSTACK_E_BASE + 18), + /** @brief Failed to write the received data to the disk or application. */ + OH_HTTP_WRITE_DATA_FAILED = (OH_HTTP_NETSTACK_E_BASE + 23), + /** @brief Upload failed. */ + OH_HTTP_UPLOAD_FAILED = (OH_HTTP_NETSTACK_E_BASE + 25), + /** @brief Failed to open or read local data from the file or application. */ + OH_HTTP_OPEN_LOCAL_DATA_FAILED = (OH_HTTP_NETSTACK_E_BASE + 26), + /** @brief Out of memory. */ + OH_HTTP_OUT_OF_MEMORY = (OH_HTTP_NETSTACK_E_BASE + 27), + /** @brief Operation timeout. */ + OH_HTTP_OPERATION_TIMEOUT = (OH_HTTP_NETSTACK_E_BASE + 28), + /** @brief The number of redirections reaches the maximum allowed. */ + OH_HTTP_TOO_MANY_REDIRECTIONS = (OH_HTTP_NETSTACK_E_BASE + 47), + /** @brief The server returned nothing (no header or data). */ + OH_HTTP_SERVER_RETURNED_NOTHING = (OH_HTTP_NETSTACK_E_BASE + 52), + /** @brief Failed to send data to the peer. */ + OH_HTTP_SEND_DATA_FAILED = (OH_HTTP_NETSTACK_E_BASE + 55), + /** @brief Failed to receive data from the peer. */ + OH_HTTP_RECEIVE_DATA_FAILED = (OH_HTTP_NETSTACK_E_BASE + 56), + /** @brief Local SSL certificate error. */ + OH_HTTP_SSL_CERTIFICATE_ERROR = (OH_HTTP_NETSTACK_E_BASE + 58), + /** @brief The specified SSL cipher cannot be used. */ + OH_HTTP_SSL_CIPHER_USED_ERROR = (OH_HTTP_NETSTACK_E_BASE + 59), + /** @brief Invalid SSL peer certificate or SSH remote key. */ + OH_HTTP_INVALID_SSL_PEER_CERT = (OH_HTTP_NETSTACK_E_BASE + 60), + /** @brief Invalid HTTP encoding format. */ + OH_HTTP_INVALID_ENCODING_FORMAT = (OH_HTTP_NETSTACK_E_BASE + 61), + /** @brief Maximum file size exceeded. */ + OH_HTTP_FILE_TOO_LARGE = (OH_HTTP_NETSTACK_E_BASE + 63), + /** @brief Remote disk full. */ + OH_HTTP_REMOTE_DISK_FULL = (OH_HTTP_NETSTACK_E_BASE + 70), + /** @brief Remote file already exists. */ + OH_HTTP_REMOTE_FILE_EXISTS = (OH_HTTP_NETSTACK_E_BASE + 73), + /** @brief The SSL CA certificate does not exist or is inaccessible. */ + OH_HTTP_SSL_CA_NOT_EXIST = (OH_HTTP_NETSTACK_E_BASE + 77), + /** @brief Remote file not found. */ + OH_HTTP_REMOTE_FILE_NOT_FOUND = (OH_HTTP_NETSTACK_E_BASE + 78), + /** @brief Authentication error. */ + OH_HTTP_AUTHENTICATION_ERROR = (OH_HTTP_NETSTACK_E_BASE + 94), + /** @brief It is not allowed to access this domain. */ + OH_HTTP_ACCESS_DOMAIN_NOT_ALLOWED = (OH_HTTP_NETSTACK_E_BASE + 998), + /** @brief Unknown error. */ + OH_HTTP_UNKNOWN_ERROR = (OH_HTTP_NETSTACK_E_BASE + 999) +} Http_ErrCode; + +/** + * @brief Defines http response code. + * + * @since 20 + */ +typedef enum Http_ResponseCode { + /** @brief The request was successful. */ + OH_HTTP_OK = 200, + /** @brief Successfully requested and created a new resource. */ + OH_HTTP_CREATED = 201, + /** @brief The request has been accepted but has not been processed completely. */ + OH_HTTP_ACCEPTED = 202, + /** @brief Unauthorized information. The request was successful. */ + OH_HTTP_NOT_AUTHORITATIVE = 203, + /** @brief No content. The server successfully processed, but did not return content. */ + OH_HTTP_NO_CONTENT = 204, + /** @brief Reset the content. */ + OH_HTTP_RESET = 205, + /** @brief Partial content. The server successfully processed some GET requests. */ + OH_HTTP_PARTIAL = 206, + /** @brief Multiple options. */ + OH_HTTP_MULT_CHOICE = 300, + /** + * @brief Permanently move. The requested resource has been permanently moved to a new URI, + * and the returned information will include the new URI. The browser will automatically redirect to the new URI. + */ + OH_HTTP_MOVED_PERM = 301, + /** @brief Temporary movement. */ + OH_HTTP_MOVED_TEMP = 302, + /** @brief View other addresses. */ + OH_HTTP_SEE_OTHER = 303, + /** @brief Not modified. */ + OH_HTTP_NOT_MODIFIED = 304, + /** @brief Using proxies. */ + OH_HTTP_USE_PROXY = 305, + /** @brief The server cannot understand the syntax error error requested by the client. */ + OH_HTTP_BAD_REQUEST = 400, + /** @brief Request for user authentication. */ + OH_HTTP_UNAUTHORIZED = 401, + /** @brief Reserved for future use. */ + OH_HTTP_PAYMENT_REQUIRED = 402, + /** @brief The server understands the request from the requesting client, but refuses to execute it. */ + OH_HTTP_FORBIDDEN = 403, + /** @brief The server was unable to find resources (web pages) based on the client's request. */ + OH_HTTP_NOT_FOUND = 404, + /** @brief The method in the client request is prohibited. */ + OH_HTTP_BAD_METHOD = 405, + /** @brief The server unabled to complete request based on the content characteristics requested by the client. */ + OH_HTTP_NOT_ACCEPTABLE = 406, + /** @brief Request authentication of the proxy's identity. */ + OH_HTTP_PROXY_AUTH = 407, + /** @brief The request took too long and timed out. */ + OH_HTTP_CLIENT_TIMEOUT = 408, + /** + * @brief The server may have returned this code when completing the client's PUT request, + * as there was a conflict when the server was processing the request. + */ + OH_HTTP_CONFLICT = 409, + /** @brief The resource requested by the client no longer exists. */ + OH_HTTP_GONE = 410, + /** @brief The server is unable to process request information sent by the client without Content Length. */ + OH_HTTP_LENGTH_REQUIRED = 411, + /** @brief The prerequisite for requesting information from the client is incorrect. */ + OH_HTTP_PRECON_FAILED = 412, + /** @brief The request was rejected because the requested entity was too large for the server to process. */ + OH_HTTP_ENTITY_TOO_LARGE = 413, + /** @brief The requested URI is too long (usually a URL) and the server cannot process it. */ + OH_HTTP_REQ_TOO_LONG = 414, + /** @brief The server is unable to process the requested format. */ + OH_HTTP_UNSUPPORTED_TYPE = 415, + /** @brief Requested Range not satisfiable. */ + OH_HTTP_RANGE_NOT_SATISFIABLE = 416, + /** @brief Internal server error, unable to complete the request. */ + OH_HTTP_INTERNAL_ERROR = 500, + /** @brief The server does not support the requested functionality and cannot complete the request. */ + OH_HTTP_NOT_IMPLEMENTED = 501, + /** @brief The server acting as a gateway or proxy received an invalid request from the remote server. */ + OH_HTTP_BAD_GATEWAY = 502, + /** @brief Due to overload or system maintenance, the server is temporarily unable to process client requests. */ + OH_HTTP_UNAVAILABLE = 503, + /** @brief The server acting as gateway did not obtain requests from the remote server in a timely manner. */ + OH_HTTP_GATEWAY_TIMEOUT = 504, + /** @brief The version of the HTTP protocol requested by the server. */ + OH_HTTP_VERSION = 505 +} Http_ResponseCode; + +/** + * @brief Buffer. + * + * @since 20 + */ +typedef struct Http_Buffer { + /** Content. Buffer will not be copied. */ + const char *buffer; + /** Buffer length. */ + uint32_t length; +} Http_Buffer; + +/** + * @brief Defines the address Family. + * + * @since 20 + */ +typedef enum Http_AddressFamilyType { + /** Default, The system automatically selects the IPv4 or IPv6 address of the domain name. */ + HTTP_ADDRESS_FAMILY_DEFAULT = 0, + /** IPv4, Selects the IPv4 address of the domain name. */ + HTTP_ADDRESS_FAMILY_ONLY_V4 = 1, + /** IPv6, Selects the IPv4 address of the domain name. */ + HTTP_ADDRESS_FAMILY_ONLY_V6 = 2 +} Http_AddressFamilyType; + +/** + * @brief HTTP get method. + * + * @since 20 + */ +#define NET_HTTP_METHOD_GET "GET" + +/** + * @brief HTTP head method. + * + * @since 20 + */ +#define NET_HTTPMETHOD_HEAD "HEAD" + +/** + * @brief HTTP options method. + * + * @since 20 + */ +#define NET_HTTPMETHOD_OPTIONS "OPTIONS" + +/** + * @brief HTTP trace method. + * + * @since 20 + */ +#define NET_HTTPMETHOD_TRACE "TRACE" +/** + * @brief HTTP delete method. + * @since 20 + */ +#define NET_HTTPMETHOD_DELETE "DELETE" + +/** + * @brief HTTP post method. + * + * @since 20 + */ +#define NET_HTTP_METHOD_POST "POST" + +/** + * @brief HTTP put method. + * + * @since 20 + */ +#define NET_HTTP_METHOD_PUT "PUT" + +/** + * @brief HTTP connect method. + * + * @since 20 + */ +#define NET_HTTP_METHOD_PATCH "CONNECT" + +/** + * @brief Defines the HTTP version. + * + * @since 20 + */ +typedef enum Http_HttpProtocol { + /** Default choose by curl. */ + OH_HTTP_NONE = 0, + /** HTTP 1.1 version. */ + OH_HTTP1_1, + /** HTTP 2 version. */ + OH_HTTP2, + /** HTTP 3 version. */ + OH_HTTP3 +} Http_HttpProtocol; + +/** + * @brief Defines the Cert Type. + * + * @since 20 + */ +typedef enum Http_CertType { + /** PEM Cert Type. */ + OH_HTTP_PEM = 0, + /** DER Cert Type. */ + OH_HTTP_DER = 1, + /** P12 Cert Type. */ + OH_HTTP_P12 = 2 +} Http_CertType; + +/** + * @brief Headers of the request or response. + * + * @since 20 + */ +typedef struct Http_Headers Http_Headers; + +/** + * @brief The value type of the header map of the request or response. + * + * @since 20 + */ +typedef struct Http_HeaderValue { + /** Value. */ + char *value; + /** Point to the next {@link Http_HeaderValue}. */ + struct Http_HeaderValue *next; +} Http_HeaderValue; + +/** + * @brief All key-value pairs of the headers of the request or response. + * + * @since 20 + */ +typedef struct Http_HeaderEntry { + /** Key. */ + char *key; + /** Value, see {@link Http_HeaderValue}. */ + Http_HeaderValue *value; + /** Points to the next key-value pair {@link Http_HeaderEntry} */ + struct Http_HeaderEntry *next; +} Http_HeaderEntry; + +/** + * @brief Client certificate which is sent to the remote server, the the remote server will use it to verify the + * client's identification. + * + * @since 20 + */ +typedef struct Http_ClientCert { + /** A path to a client certificate. */ + char *certPath; + /** Client certificate type, see {@link Http_CertType}. */ + Http_CertType type; + /** File path of your client certificate private key. */ + char *keyPath; + /** Password for your client certificate private key. */ + char *keyPassword; +} Http_ClientCert; + +/** + * @brief Proxy type. Used to distinguish different proxy configurations. + * + * @since 20 + */ +typedef enum Http_ProxyType { + /** No proxy */ + HTTP_PROXY_NOT_USE, + /** System proxy */ + HTTP_PROXY_SYSTEM, + /** Use custom proxy */ + HTTP_PROXY_CUSTOM +} Http_ProxyType; + +/** + * @brief Custom proxy configuration. + * + * @since 20 + */ +typedef struct Http_CustomProxy { + /** Indicates the URL of the proxy server. If you do not set port explicitly, port will be 1080. */ + const char *host; + int32_t port; + const char *exclusionLists; +} Http_CustomProxy; + +/** + * @brief Proxy configuration. + * + * @since 20 + */ +typedef struct Http_Proxy { + /** Distinguish the proxy type used by the request, see {@link Http_ProxyType}. */ + Http_ProxyType proxyType; + /** Custom proxy configuration, see {@link Http_CustomProxy}. */ + Http_CustomProxy customProxy; +} Http_Proxy; + +/** + * @brief Response timing information. It will be collected in {@link Http_Response.performanceTiming}. + * + * @since 20 + */ +typedef struct Http_PerformanceTiming { + /** The total time in milliseconds for the HTTP transfer, including name resolving, TCP connect etc. */ + double dnsTiming; + /** The time in milliseconds from the start until the remote host name was resolved. */ + double tcpTiming; + /** The time in milliseconds from the start until the connection to the remote host (or proxy) was completed. */ + double tlsTiming; + /** The time in milliseconds, it took from the start until the transfer is just about to begin. */ + double firstSendTiming; + /** The time in milliseconds from last modification time of the remote file. */ + double firstReceiveTiming; + /** The time in milliseconds, it took from the start until the first byte is received. */ + double totalFinishTiming; + /** The time in milliseconds it took for all redirection steps including name lookup, connect, etc.*/ + double redirectTiming; +} Http_PerformanceTiming; + +/** + * @brief Defines the parameters for http request options. + * + * @since 20 + */ +typedef struct Http_RequestOptions { + /** Request method. */ + const char *method; + /** Priority of http requests. A larger value indicates a higher priority. */ + uint32_t priority; + /** Header of http requests, see {@link Http_Headers}. */ + Http_Headers *headers; + /** Read timeout interval. */ + uint32_t readTimeout; + /** Connection timeout interval. */ + uint32_t connectTimeout; + /** Use the protocol. The default value is automatically specified by the system, see {@link Http_HttpProtocol}. */ + Http_HttpProtocol httpProtocol; + /** + * Indicates whether to use the HTTP proxy. The default value is false, + * and http proxy config, see {@link Http_Proxy}. + */ + Http_Proxy *httpProxy; + /** CA certificate of the user-specified path. */ + const char *caPath; + /** Set the download start position. This parameter can be used only in the GET method. */ + int64_t resumeFrom; + /** Set the download end position. This parameter can be used only in the GET method. */ + int64_t resumeTo; + /** Client certificates can be transferred, see {@link Http_ClientCert}. */ + Http_ClientCert *clientCert; + /** Set the DNS resolution for the https server. */ + const char *dnsOverHttps; + /** Maximum number of bytes in a response message. */ + uint32_t maxLimit; + /** The address family can be specified when target domain name is resolved, see {@link Http_AddressFamilyType}. */ + Http_AddressFamilyType addressFamily; +} Http_RequestOptions; + +/** + * @brief Defines the parameters for http response. + * + * @since 20 + */ +typedef struct Http_Response { + /** Response body, see {@link Http_Buffer}. */ + Http_Buffer body; + /** Server status code, see {@link Http_ResponseCode}. */ + Http_ResponseCode responseCode; + /** Header of http response, see {@link Http_Headers}. */ + Http_Headers *headers; + /** Cookies returned by the server. */ + char *cookies; + /** The time taken of various stages of HTTP request, see {@link Http_PerformanceTiming}. */ + Http_PerformanceTiming *performanceTiming; + /** + * @brief Response deletion function. + * + * @param response Indicates the response to be deleted. It is a pointer that points to {@link Http_Response}. + * @since 20 + */ + void (*destroyResponse)(struct Http_Response **response); +} Http_Response; + +/** + * @brief Http request. + * + * @since 20 + */ +typedef struct Http_Request { + /** The request id for every single request. Generated by system. */ + uint32_t requestId; + /** Request url. */ + char *url; + /** Request options, see {@link Http_RequestOptions}. */ + Http_RequestOptions *options; +} Http_Request; + +/** + * @brief Callback function that is invoked when response is received. + * + * @param response Http response struct, see {@link Http_Response}. + * @param errCode Response error code. + * @since 20 + */ +typedef void (*Http_ResponseCallback)(struct Http_Response *response, uint32_t errCode); + +/** + * @brief Callback function that is invoked when a response body is received. + * + * @param data Response body. + * @return size_t the length of response body. + * @since 20 + */ +typedef size_t (*Http_OnDataReceiveCallback)(const char *data); + +/** + * @brief Callback function invoked during request/response data transmission. + * + * @param totalSize total size. + * @param transferredSize transferred size. + * @since 20 + */ +typedef void (*Http_OnProgressCallback)(uint64_t totalSize, uint64_t transferredSize); + +/** + * @brief Callback called when header are received. + * + * @param headers Headers of the received requests, which points to the pointer of {@link Http_Headers}. + * @since 20 + */ +typedef void (*Http_OnHeaderReceiveCallback)(Http_Headers *headers); + +/** + * @brief Empty callback function for requested DataEnd or Canceled event callback + * + * @since 20 + */ +typedef void (*Http_OnVoidCallback)(void); + +/** + * @brief Callbacks to watch different events. + * + * @since 20 + */ +typedef struct Http_EventsHandler { + /** Callback function when the response body is received */ + Http_OnDataReceiveCallback onDataReceive; + /** Callback function during uploading */ + Http_OnProgressCallback onUploadProgress; + /** Callback function during downloading */ + Http_OnProgressCallback onDownloadProgress; + /** Callback function when a header is received */ + Http_OnHeaderReceiveCallback onHeadersReceive; + /** Callback function at the end of the transfer */ + Http_OnVoidCallback onDataEnd; + /** Callback function when a request is canceled */ + Http_OnVoidCallback onCanceled; +} Http_EventsHandler; +#ifdef __cplusplus +} +#endif +#endif // NET_HTTP_TYPE_H + +/** @} */ \ No newline at end of file diff --git a/startup/init/syscap/include/deviceinfo.h b/startup/init/syscap/include/deviceinfo.h index 9e7dc927b7c9b373ecfff3f8cc581ec12d31c418..f1c9e15770431d8a909c3612e106421f2e54f481 100644 --- a/startup/init/syscap/include/deviceinfo.h +++ b/startup/init/syscap/include/deviceinfo.h @@ -162,7 +162,7 @@ int OH_GetSdkApiVersion(void); * @syscap SystemCapability.Startup.SystemInfo * @return 0 ~ 999 - the sdk minor api version * -1 - not found the sdk minor api version number, or failed to invoke the internal interface. - * @since 19 + * @since 20 */ int OH_GetSdkMinorApiVersion(void); @@ -171,7 +171,7 @@ int OH_GetSdkMinorApiVersion(void); * @syscap SystemCapability.Startup.SystemInfo * @return 0 ~ 999 - the sdk patch api version * -1 - not found the sdk patch api version number, or failed to invoke the internal interface. - * @since 19 + * @since 20 */ int OH_GetSdkPatchApiVersion(void); diff --git a/startup/init/syscap/include/syscap_ndk.h b/startup/init/syscap/include/syscap_ndk.h index 023107e51debc4806ad0d94cc62eea8ee98fec1f..e6045e8553f3d2b0dc81e811cb00816b404b37b4 100644 --- a/startup/init/syscap/include/syscap_ndk.h +++ b/startup/init/syscap/include/syscap_ndk.h @@ -47,15 +47,15 @@ bool canIUse(const char *cap); /** * @brief determine whether the current operating system version is greater than or equal to the given value. * - * @param majorVersion The major version number which betwen 1 and 999, such as 19 in api version 19.1.2 - * @param minorVersion The minor version number which betwen 0 and 999, such as 1 in api version 19.1.2 - * @param patchVersion The patch version number which betwen 0 and 999, such as 2 in api version 19.1.2 + * @param majorVersion The major version number which betwen 1 and 999, such as 20 in api version 20.1.2 + * @param minorVersion The minor version number which betwen 0 and 999, such as 1 in api version 20.1.2 + * @param patchVersion The patch version number which betwen 0 and 999, such as 2 in api version 20.1.2 * @return true - operating system version is greater than or equal to the given value * false - operating system version is less than the given value or invalid api version - * @since 19 - * @example given version is "19.1" - * if (OH_IsApiVersionGreaterOrEqual(19, 1, 0)) { - * // Use 19.1 APIs. + * @since 20 + * @example given version is "20.1" + * if (OH_IsApiVersionGreaterOrEqual(20, 1, 0)) { + * // Use 20.1 APIs. * } else { * // Alternative code for earlier versions. * } diff --git a/third_party/musl/ndk_script/adapter/libc.ndk.json b/third_party/musl/ndk_script/adapter/libc.ndk.json index f9a52a2fd1d89ea1af4c48096b2131dff8643d22..14cb1dc8553712a7339abb0a3af6d4dd7cf43e21 100644 --- a/third_party/musl/ndk_script/adapter/libc.ndk.json +++ b/third_party/musl/ndk_script/adapter/libc.ndk.json @@ -758,11 +758,11 @@ { "name": "malloc" }, { "name": "mallopt" }, { - "first_introduced":"19", + "first_introduced":"20", "name": "mallinfo" }, { - "first_introduced":"19", + "first_introduced":"20", "name": "mallinfo2" }, { "name": "malloc_usable_size" },