From c7ff20d07293d89b4d1dbc9a4016b02707f55813 Mon Sep 17 00:00:00 2001 From: xwx1135370 Date: Sat, 16 Nov 2024 14:01:51 +0800 Subject: [PATCH 01/14] =?UTF-8?q?cherry=20pick=20fd6c430=20from=20https://?= =?UTF-8?q?gitee.com/xwx1135370/interface=5Fsdk=5Fc/pulls/1757=20=E3=80=90?= =?UTF-8?q?windows=E3=80=91=E5=A2=9E=E5=8A=A0python3=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue:https://gitee.com/openharmony/interface_sdk_c/issues/IB4SU5?from=project-issue Signed-off-by: xwx1135370 --- third_party/musl/ndk_script/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/musl/ndk_script/BUILD.gn b/third_party/musl/ndk_script/BUILD.gn index a71e33565..c62a9b632 100644 --- a/third_party/musl/ndk_script/BUILD.gn +++ b/third_party/musl/ndk_script/BUILD.gn @@ -106,6 +106,7 @@ if (host_os == "mac") { "${windows_x86_64_toolchain_dir}/llvm/include", "${windows_x86_64_toolchain_dir}/llvm/lib", "${windows_x86_64_toolchain_dir}/llvm/libexec", + "${windows_x86_64_toolchain_dir}/llvm/python3", "${windows_x86_64_toolchain_dir}/llvm/script", "${windows_x86_64_toolchain_dir}/llvm/share", ] -- Gitee From ef33b02666d5e2417fdc638402d94868df40b038 Mon Sep 17 00:00:00 2001 From: sunjiakun Date: Wed, 13 Nov 2024 14:34:07 +0800 Subject: [PATCH 02/14] Add ndk interface Signed-off-by: sunjiakun --- .../ability_runtime/application_context.h | 136 ++++++++++++++++++ .../libability_runtime.ndk.json | 32 +++++ 2 files changed, 168 insertions(+) diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index 1ba53503d..6a1266d94 100644 --- a/AbilityKit/ability_runtime/application_context.h +++ b/AbilityKit/ability_runtime/application_context.h @@ -92,6 +92,142 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(Ability AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName( char* buffer, int32_t bufferSize, int32_t* writeLength); +/** + * @brief Obtain the temp directory of the application. + * + * @param buffer A pointer to a buffer that receives the temp directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetTempDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the resource directory of the application. + * + * @param buffer A pointer to a buffer that receives the resource directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetResourceDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the files directory of the application. + * + * @param buffer A pointer to a buffer that receives the files directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the database directory of the application. + * + * @param buffer A pointer to a buffer that receives the database directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDatabaseDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the preferences directory of the application. + * + * @param buffer A pointer to a buffer that receives the preferences directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetPreferencesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the bundle code directory of the application. + * + * @param buffer A pointer to a buffer that receives the bundle code directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleCodeDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the distributed files directory of the application. + * + * @param buffer A pointer to a buffer that receives the distributed files directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the cloud file directory of the application. + * + * @param buffer A pointer to a buffer that receives the cloud file directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + #ifdef __cplusplus } // extern "C" #endif diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index 239f84f61..f761059ab 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -10,5 +10,37 @@ { "first_introduced": "13", "name": "OH_AbilityRuntime_ApplicationContextGetBundleName" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetTempDir" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetResourceDir" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetFilesDir" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetDatabaseDir" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetPreferencesDir" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetBundleCodeDir" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetCloudFileDir" } ] \ No newline at end of file -- Gitee From 2d37039047711f53c5449169db3577720a8edf93 Mon Sep 17 00:00:00 2001 From: sunjiakun Date: Fri, 22 Nov 2024 14:57:04 +0800 Subject: [PATCH 03/14] back GetResourceDir Signed-off-by: sunjiakun --- .../ability_runtime/application_context.h | 17 ----------------- .../ability_runtime/libability_runtime.ndk.json | 4 ---- 2 files changed, 21 deletions(-) diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index 6a1266d94..4ac78aa5a 100644 --- a/AbilityKit/ability_runtime/application_context.h +++ b/AbilityKit/ability_runtime/application_context.h @@ -109,23 +109,6 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName( AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetTempDir( char* buffer, const int32_t bufferSize, int32_t* writeLength); -/** - * @brief Obtain the resource directory of the application. - * - * @param buffer A pointer to a buffer that receives the resource directory of the application. - * @param bufferSize The length of the buffer. - * @param writeLength The string length actually written to the buffer, - * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, - * or the buffer size is less than the minimum buffer size. - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetResourceDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - /** * @brief Obtain the files directory of the application. * diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index f761059ab..fcde96f6c 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -15,10 +15,6 @@ "first_introduced": "16", "name": "OH_AbilityRuntime_ApplicationContextGetTempDir" }, - { - "first_introduced": "16", - "name": "OH_AbilityRuntime_ApplicationContextGetResourceDir" - }, { "first_introduced": "16", "name": "OH_AbilityRuntime_ApplicationContextGetFilesDir" -- Gitee From 50785c5a5a2fd754d4fac7cd9e9627d58d8d37f1 Mon Sep 17 00:00:00 2001 From: zhangjinyu101 Date: Fri, 22 Nov 2024 16:53:39 +0800 Subject: [PATCH 04/14] =?UTF-8?q?SDK-C=E6=94=AF=E6=8C=81EdgeEffectOptions?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E6=96=B0=E5=A2=9E=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjinyu101 --- arkui/ace_engine/native/native_node.h | 23 +++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 12 ++++++++++++ 2 files changed, 35 insertions(+) diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 957b003fd..64e42755c 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -4351,6 +4351,29 @@ typedef enum { * itself. Optional. The value 1 means to enable the scroll effect, and 0 means the opposite. \n * */ + /** + * @brief Defines the effect used at the edges of the component when the boundary of the scrollable content is + * reached. 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: effect used at the edges of the component when the boundary of the scrollable content is reached. + * The parameter type is {@link ArkUI_EdgeEffect}. The default value is ARKUI_EDGE_EFFECT_NONE.\n + * .value[1]?.i32: whether to enable the scroll effect when the component content size is smaller than the component + * itself. Optional. The value 1 means to enable the scroll effect, and 0 means the opposite. + * The default value is 1.\n + * .value[2]?.i32: direction in which the effect takes effect. The parameter type is {@link ArkUI_EffectEdge}. + * The default value is ARKUI_EFFECT_EDGE_START | ARKUI_EFFECT_EDGE_END. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: edge for which the effect takes effect when the boundary of the scrollable content is reached. + * The parameter type is {@link ArkUI_EffectEdge}. \n + * .value[1].i32: whether to enable the scroll effect when the component content size is smaller than the component + * itself. The value 1 means to enable the scroll effect, and 0 means the opposite.\n + * .value[2].i32: edge for which the effect takes effect when the boundary of the scrollable content is reached. + * The parameter type is {@link ArkUI_EffectEdge}. \n + * + * @since 16 + */ NODE_SCROLL_EDGE_EFFECT, /** * @brief Defines whether to support scroll gestures. When this attribute is set to false, scrolling by diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index ca825e62b..fd11e1ef3 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -586,6 +586,18 @@ typedef enum { ARKUI_EDGE_EFFECT_NONE, } ArkUI_EdgeEffect; +/** + * @brief Enumerates the edges for which the effect takes effect when the boundary of the scrollable content is reached. + * + * @since 16 + */ +typedef enum { + /** Start edge. */ + ARKUI_EFFECT_EDGE_START = 1, + /** End edge. */ + ARKUI_EFFECT_EDGE_END = 2, +} ArkUI_EffectEdge; + /** * @brief Enumerates the scroll directions for the component. * -- Gitee From 87d09d2a77066df5d034008f158e35bfb68d4388 Mon Sep 17 00:00:00 2001 From: zhangjinyu101 Date: Tue, 26 Nov 2024 09:33:59 +0800 Subject: [PATCH 05/14] =?UTF-8?q?SDK-C=E6=94=AF=E6=8C=81EdgeEffectOptions?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E6=96=B0=E5=A2=9E=E5=B1=9E=E6=80=A7=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjinyu101 --- arkui/ace_engine/native/native_node.h | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 64e42755c..e16c82915 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -4343,36 +4343,18 @@ typedef enum { * .value[1]?.i32: whether to enable the scroll effect when the component content size is smaller than the * component itself. Optional. The value 1 means to enable the scroll effect, and 0 means the * opposite. The default value is 1. \n + * .value[2]?.i32: direction in which the effect takes effect. The parameter type is {@link ArkUI_EffectEdge}. + * The default value is ARKUI_EFFECT_EDGE_START | ARKUI_EFFECT_EDGE_END. This parameter is supported since + * API version 16. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: effect used at the edges of the component when the boundary of the scrollable content is reached. * The parameter type is {@link ArkUI_EdgeEffect}. \n * .value[1].i32: whether to enable the scroll effect when the component content size is smaller than the component * itself. Optional. The value 1 means to enable the scroll effect, and 0 means the opposite. \n - * - */ - /** - * @brief Defines the effect used at the edges of the component when the boundary of the scrollable content is - * reached. 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: effect used at the edges of the component when the boundary of the scrollable content is reached. - * The parameter type is {@link ArkUI_EdgeEffect}. The default value is ARKUI_EDGE_EFFECT_NONE.\n - * .value[1]?.i32: whether to enable the scroll effect when the component content size is smaller than the component - * itself. Optional. The value 1 means to enable the scroll effect, and 0 means the opposite. - * The default value is 1.\n - * .value[2]?.i32: direction in which the effect takes effect. The parameter type is {@link ArkUI_EffectEdge}. - * The default value is ARKUI_EFFECT_EDGE_START | ARKUI_EFFECT_EDGE_END. \n - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: edge for which the effect takes effect when the boundary of the scrollable content is reached. - * The parameter type is {@link ArkUI_EffectEdge}. \n - * .value[1].i32: whether to enable the scroll effect when the component content size is smaller than the component - * itself. The value 1 means to enable the scroll effect, and 0 means the opposite.\n * .value[2].i32: edge for which the effect takes effect when the boundary of the scrollable content is reached. - * The parameter type is {@link ArkUI_EffectEdge}. \n + * The parameter type is {@link ArkUI_EffectEdge}. This parameter is supported since API version 16. \n * - * @since 16 */ NODE_SCROLL_EDGE_EFFECT, /** -- Gitee From a5f308bdac3f36bbd84309695cdcf853bf7b4afb Mon Sep 17 00:00:00 2001 From: liumingxiang Date: Tue, 19 Nov 2024 22:04:08 +0800 Subject: [PATCH 06/14] Add new FontCollection Global Instance interface Signed-off-by: liumingxiang --- .../native_drawing/drawing_font_collection.h | 10 ++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_collection.h b/graphic/graphic_2d/native_drawing/drawing_font_collection.h index a6097dad1..e6ac9f494 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font_collection.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_collection.h @@ -105,6 +105,16 @@ OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection(void); * @version 1.0 */ void OH_Drawing_ClearFontCaches(OH_Drawing_FontCollection* fontCollection); + +/** + * @brief Get the OH_Drawing_FontCollection global instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Return the pointer to the OH_Drawing_FontCollection global instance. + * @since 14 + * @version 1.0 + */ +OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance(void); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 353ce3f53..a0ac4408f 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1721,5 +1721,9 @@ { "first_introduced": "14", "name":"OH_Drawing_GetRunGlyphCount" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_GetFontCollectionGlobalInstance" } ] \ No newline at end of file -- Gitee From ee14481c5aa53f61c01d6cfc286b8f1e68853efb Mon Sep 17 00:00:00 2001 From: bluhuang Date: Wed, 6 Nov 2024 15:13:04 +0800 Subject: [PATCH 07/14] preferences support CLKV Signed-off-by: bluhuang --- .../preferences/include/oh_preferences.h | 12 +++++++++ .../include/oh_preferences_option.h | 25 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/distributeddatamgr/preferences/include/oh_preferences.h b/distributeddatamgr/preferences/include/oh_preferences.h index 944fa9dff..837891ae7 100644 --- a/distributeddatamgr/preferences/include/oh_preferences.h +++ b/distributeddatamgr/preferences/include/oh_preferences.h @@ -263,6 +263,18 @@ int OH_Preferences_RegisterDataObserver(OH_Preferences *preference, void *contex int OH_Preferences_UnregisterDataObserver(OH_Preferences *preference, void *context, OH_PreferencesDataObserver observer, const char *keys[], uint32_t keyCount); +/** + * @brief Check if a type is supported or not. + * + * @param type the storage type of {@Link Preferences_StorageType}. + * @param isSupported Pointer to the Boolean value obtained. + * @return Returns the status code of the execution. + * {@link PREFERENCES_OK} indicates the operation is successful. + * {@link PREFERENCES_ERROR_INVALID_PARAM} indicates invalid args are passed in. + * @since 16 + */ +int OH_Preferences_IsStorageTypeSupported(Preferences_StorageType type, bool *isSupported); + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/preferences/include/oh_preferences_option.h b/distributeddatamgr/preferences/include/oh_preferences_option.h index a8a25af9f..82a6d7a31 100644 --- a/distributeddatamgr/preferences/include/oh_preferences_option.h +++ b/distributeddatamgr/preferences/include/oh_preferences_option.h @@ -52,6 +52,18 @@ extern "C" { */ typedef struct OH_PreferencesOption OH_PreferencesOption; +/** + * @brief Enumerates the preferences storage types. + * + * @since 16 + */ +typedef enum Preferences_StorageType { + /** XML storage*/ + PREFERENCES_STORAGE_XML = 0, + /** CLKV storage */ + PREFERENCES_STORAGE_CLKV +} Preferences_StorageType; + /** * @brief Creates an {@Link OH_PreferencesOption} instance. * @@ -101,6 +113,19 @@ int OH_PreferencesOption_SetBundleName(OH_PreferencesOption *option, const char */ int OH_PreferencesOption_SetDataGroupId(OH_PreferencesOption *option, const char *dataGroupId); +/** + * @brief Sets the storage type in an {@Link OH_PreferencesOption} instance. + * + * @param option Represents a pointer to an {@link OH_PreferencesOption} instance. + * @param type Represents preferences storage type. + * @return Returns the status code of the execution. + * {@link PREFERENCES_OK} success. + * {@link PREFERENCES_ERROR_INVALID_PARAM} indicates invalid args are passed in. + * @see OH_PreferencesOption. + * @since 16 + */ +int OH_PreferencesOption_SetStorageType(OH_PreferencesOption *option, Preferences_StorageType type); + /** * @brief Destroys an {@Link OH_PreferencesOption} instance. * -- Gitee From 66b17b519b7c64a489a0564af2065df28ae2c10d Mon Sep 17 00:00:00 2001 From: chenraozhong Date: Fri, 15 Nov 2024 14:44:09 +0800 Subject: [PATCH 08/14] Add JSVM Promise API Signed-off-by: wangyimin --- ark_runtime/jsvm/jsvm.h | 22 ++++++++++++++++++++++ ark_runtime/jsvm/libjsvm.ndk.json | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 3f47366b4..905b4edce 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -2314,6 +2314,28 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsPromise(JSVM_Env env, JSVM_Value value, bool* isPromise); +/** + * @brief This API register a resolution/rejection handler with a promise. + * @param env The environment that the API is invoked under. + * @param promise The promise to be handled. + * @param onFulfilled The function to be invoked if promise is resolved. + * @param onRejected The function to be invoked if promise is rejected. + * @param result Another promise returned from promise then/catch method. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the arguments are invalid. \n + * {@link JSVM_INVALID_TYPE } if the arguments are invalid Javascript type. \n + * {@link JSVM_PENDING_EXCEPTION} if an exception occurs. \n + * {@link JSVM_GENERIC_FAILURE} if the API failed. \n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_PromiseRegisterHandler(JSVM_Env env, + JSVM_Value promise, + JSVM_Value onFulfilled, + JSVM_Value onRejected, + JSVM_Value* result); + /** * @brief This API parses a JSON string and returns it as value if successful. * @param env: The environment that the API is invoked under. diff --git a/ark_runtime/jsvm/libjsvm.ndk.json b/ark_runtime/jsvm/libjsvm.ndk.json index e0157b772..6ac3a6d63 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -734,5 +734,9 @@ { "first_introduced": "12", "name": "OH_JSVM_ReleaseCache" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_PromiseRegisterHandler" } ] -- Gitee From 965dc7649d3b7b73aaee4e146eba2e719919ece0 Mon Sep 17 00:00:00 2001 From: chenraozhong Date: Fri, 15 Nov 2024 14:47:15 +0800 Subject: [PATCH 09/14] Add jsvm microtasks API Signed-off-by: wangyimin --- ark_runtime/jsvm/jsvm.h | 12 ++++++++++++ ark_runtime/jsvm/jsvm_types.h | 14 ++++++++++++++ ark_runtime/jsvm/libjsvm.ndk.json | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 3f47366b4..8957632e6 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -121,6 +121,18 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Init(const JSVM_InitOptions* options); JSVM_EXTERN JSVM_Status OH_JSVM_CreateVM(const JSVM_CreateVMOptions* options, JSVM_VM* result); +/** + * @brief This function controls how Microtasks are invoked of the vm. If the method is not + * called, the default microtask policy of vm is JSVM_MicrotaskPolicy::JSVM_MICROTASK_AUTO. + * + * @param vm The VM instance to set mircrotasks policy. + * @param policy Policy for running microtasks. + * @return Returns JSVM_OK if the API succeeded. + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetMicrotaskPolicy(JSVM_VM vm, + JSVM_MicrotaskPolicy policy); + /** * @brief Destroys VM instance. * diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 1141b051f..bca4ab893 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -770,5 +770,19 @@ typedef enum { /** WebAssembly cache, generated by OH_JSVM_CreateWasmCache */ JSVM_CACHE_TYPE_WASM, } JSVM_CacheType; + +/** + * @brief Microtask policies of JSVM. + * + * @since 16 + */ +typedef enum { + /** Microtasks are invoked with the OH_JSVM_PerformMicrotaskCheckpoint() method. */ + JSVM_MICROTASK_EXPLICIT = 0, + /** Microtasks are invoked when the script call depth decrements to zero. + * Default mode. + */ + JSVM_MICROTASK_AUTO, +} JSVM_MicrotaskPolicy; /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */ diff --git a/ark_runtime/jsvm/libjsvm.ndk.json b/ark_runtime/jsvm/libjsvm.ndk.json index e0157b772..a0fa307ed 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -734,5 +734,9 @@ { "first_introduced": "12", "name": "OH_JSVM_ReleaseCache" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_SetMicrotaskPolicy" } ] -- Gitee From a1c8174fac44d3971fa4e18cd951ebbbc5752c42 Mon Sep 17 00:00:00 2001 From: liuweili Date: Thu, 14 Nov 2024 20:30:56 +0800 Subject: [PATCH 10/14] =?UTF-8?q?jsvm=E6=96=B0=E5=A2=9EAPI--WellKnown=20sy?= =?UTF-8?q?mbols=E5=92=8Cwrapper=20object=20=EF=BC=88cherry=20picked=20com?= =?UTF-8?q?mit=20from=20=20Signed-off-by:=20l?= =?UTF-8?q?iuweili=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuweili --- ark_runtime/jsvm/jsvm.h | 224 ++++++++++++++++++++++++++++++ ark_runtime/jsvm/libjsvm.ndk.json | 64 +++++++++ 2 files changed, 288 insertions(+) diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 3f47366b4..d26f813d5 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -3045,6 +3045,230 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateWasmCache(JSVM_Env env, JSVM_EXTERN JSVM_Status OH_JSVM_ReleaseCache(JSVM_Env env, const uint8_t* cacheData, JSVM_CacheType cacheType); + +/** + * @brief Check whether the given JSVM_Value is a BigInt Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a BigInt Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsBigIntObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a Boolean Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a Boolean Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsBooleanObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a String Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a String Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsStringObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a Number Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a Number Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsNumberObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a Symbol Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a Symbol Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsSymbolObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief This API returns the Symbol.asyncIterator of Well-Known Symbols. + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.asyncIterator of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolAsyncIterator(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.hasInstance of Well-Known Symbols. + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.hasInstance of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolHasInstance(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.isConcatSpreadable of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.isConcatSpreadable of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolIsConcatSpreadable(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.match of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.match of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolMatch(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.replace of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.replace of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolReplace(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.search of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.search of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolSearch(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.split of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.split of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolSplit(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.toPrimitive of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.toPrimitive of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolToPrimitive(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.unscopables of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.unscopables of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolUnscopables(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.toStringTag of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.toStringTag of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolToStringTag(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.iterator of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.iterator of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolIterator(JSVM_Env env, JSVM_Value* result); + EXTERN_C_END /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_H */ diff --git a/ark_runtime/jsvm/libjsvm.ndk.json b/ark_runtime/jsvm/libjsvm.ndk.json index e0157b772..726cd4067 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -734,5 +734,69 @@ { "first_introduced": "12", "name": "OH_JSVM_ReleaseCache" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_IsBigIntObject" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_IsBooleanObject" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_IsStringObject" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_IsNumberObject" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_IsSymbolObject" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolAsyncIterator" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolHasInstance" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolIsConcatSpreadable" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolMatch" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolReplace" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolSearch" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolSplit" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolToPrimitive" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolUnscopables" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolToStringTag" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_GetSymbolIterator" } ] -- Gitee From 60159694b61a0a1520d6dd72e9ce3712f141061a Mon Sep 17 00:00:00 2001 From: wangzhongqi5 Date: Thu, 28 Nov 2024 11:17:59 +0800 Subject: [PATCH 11/14] =?UTF-8?q?jsvm=E6=96=B0=E5=A2=9EAPI--OH=5FJSVM=5FTr?= =?UTF-8?q?aceStart=E5=92=8COH=5FJSVM=5FTraceStop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangzhongqi5 --- ark_runtime/jsvm/jsvm.h | 28 ++++++++++++++++++++++++++++ ark_runtime/jsvm/jsvm_types.h | 22 ++++++++++++++++++++++ ark_runtime/jsvm/libjsvm.ndk.json | 8 ++++++++ 3 files changed, 58 insertions(+) diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index d26f813d5..c1beb1f32 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -3269,6 +3269,34 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolToStringTag(JSVM_Env env, JSVM_Value* r */ JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolIterator(JSVM_Env env, JSVM_Value* result); +/** + * @brief Trace start with specified categories for all JSVM VM.(Non-thread-safe) + * + * @param count The count of trace categories. + * @param categories Select internal trace events for tracing by categories. + * @param tag User-defined tag of trace data. + * @param eventsCount Number of trace events. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if categories or count is illegal.\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_TraceStart(size_t count, const JSVM_TraceCategory* categories, + const char* tag, size_t eventsCount); + +/** + * @brief Trace stop for specified categories for all JSVM VM.(Non-thread-safe) + * + * @param stream The output stream callback for receiving the data. + * @param streamData Data passed to the stream callback. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if stream or streamData is NULL\n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_TraceStop(JSVM_OutputStream stream, void* streamData); EXTERN_C_END /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_H */ diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 1141b051f..2214ca5e0 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -770,5 +770,27 @@ typedef enum { /** WebAssembly cache, generated by OH_JSVM_CreateWasmCache */ JSVM_CACHE_TYPE_WASM, } JSVM_CacheType; + +/** + * @brief Trace category for jsvm internal trace events. + * + * @since 16 + */ +typedef enum { + /** Tracing main interface invoking of JSVM, such as run scripts. */ + JSVM_TRACE_VM, + /** Tracing interface invoking about compilation, such as CompileCodeBackground. */ + JSVM_TRACE_COMPILE, + /** Tracing interface invoking about execution status, such as Interrupts and Microtasks. */ + JSVM_TRACE_EXECUTE, + /** Tracing external callback */ + JSVM_TRACE_RUNTIME, + /** Tracing stack trace in JSVM. */ + JSVM_TRACE_STACK_TRACE, + /** Tracing main interface invoking of WASM, such as Compile Wasm Module and Instantiate. */ + JSVM_TRACE_WASM, + /** Tracing more detailed interface invoking of WASM, such as background compilation and wrappers. */ + JSVM_TRACE_WASM_DETAILED +} JSVM_TraceCategory; /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */ diff --git a/ark_runtime/jsvm/libjsvm.ndk.json b/ark_runtime/jsvm/libjsvm.ndk.json index 726cd4067..850f2cf51 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -798,5 +798,13 @@ { "first_introduced": "16", "name": "OH_JSVM_GetSymbolIterator" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_TraceStart" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_TraceStop" } ] -- Gitee From b8d3fa496c497131d1c230e8dd216b77c8ef63eb Mon Sep 17 00:00:00 2001 From: chenraozhong Date: Sat, 30 Nov 2024 18:12:54 +0800 Subject: [PATCH 12/14] Add jsvm proxy API Signed-off-by: chenraozhong --- ark_runtime/jsvm/jsvm.h | 55 +++++++++++++++++++++++++++++++ ark_runtime/jsvm/jsvm_types.h | 4 +++ ark_runtime/jsvm/libjsvm.ndk.json | 12 +++++++ 3 files changed, 71 insertions(+) diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index c1beb1f32..b09f5cfa5 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -131,6 +131,61 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateVM(const JSVM_CreateVMOptions* options, */ JSVM_EXTERN JSVM_Status OH_JSVM_DestroyVM(JSVM_VM vm); +/** + * @brief This API allocates a default JavaScript Proxy. It is the equivalent of + * doing new Proxy(target, handler) in JavaScript. + * + * @param env The environment that the API is invoked under. + * @param target A JSVM_Value representing the JavaScript Object which you want to proxy. + * @param handler A JSVM_Value representing the JavaScript Object that defines which + * operations will be intercepted and how to redefine intercepted operations. + * @param result A JSVM_Value representing a JavaScript Proxy. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the any of the input arguments is NULL. \n + * {@link JSVM_OBJECT_EXPECTED} if target or handler is not Javascript Object. \n + * {@link JSVM_PENDING_EXCEPTION} if an exception occurs. \n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateProxy(JSVM_Env env, + JSVM_Value target, + JSVM_Value handler, + JSVM_Value* result); + +/** + * @brief This API checks if the value passed in is a Proxy. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param isProxy Whether the given value is Proxy. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the any of the input arguments is NULL. \n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsProxy(JSVM_Env env, + JSVM_Value value, + bool* isProxy); + +/** + * @brief This API gets target from proxy. + * + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript Proxy whose target to return. + * @param result Target of the given proxy. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the any of the input arguments is NULL. \n + * {@link JSVM_INVALID_TYPE} if value is not a Javascript Proxy. \n + * + * @since 16 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ProxyGetTarget(JSVM_Env env, + JSVM_Value value, + JSVM_Value* result); + /** * @brief This API open a new VM scope for the VM instance. * diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 2214ca5e0..ed6b6a815 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -327,6 +327,10 @@ typedef enum { JSVM_NO_EXTERNAL_BUFFERS_ALLOWED, /** cannot run +js status. */ JSVM_CANNOT_RUN_JS, + /** invalid input type status. + * @since 16 + */ + JSVM_INVALID_TYPE, } JSVM_Status; /** diff --git a/ark_runtime/jsvm/libjsvm.ndk.json b/ark_runtime/jsvm/libjsvm.ndk.json index 850f2cf51..daae1b99a 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -735,6 +735,18 @@ "first_introduced": "12", "name": "OH_JSVM_ReleaseCache" }, + { + "first_introduced": "16", + "name": "OH_JSVM_CreateProxy" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_IsProxy" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_ProxyGetTarget" + }, { "first_introduced": "16", "name": "OH_JSVM_IsBigIntObject" -- Gitee From 68c71628d4f4dcf329ae34dfde848d4837998ffd Mon Sep 17 00:00:00 2001 From: wanjining Date: Tue, 3 Dec 2024 10:05:55 +0800 Subject: [PATCH 13/14] =?UTF-8?q?TextInput/TextArea=20CAPI=E8=A1=A5?= =?UTF-8?q?=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanjining --- arkui/ace_engine/native/libace.ndk.json | 4 + arkui/ace_engine/native/native_node.h | 103 ++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 98b4908b7..9861c7226 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2478,5 +2478,9 @@ { "first_introduced": "14", "name": "OH_ArkUI_KeyEvent_SetConsumed" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_NodeEvent_GetTextChangeEvent" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index e16c82915..a4bd8a288 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -2966,6 +2966,32 @@ typedef enum { * */ NODE_TEXT_INPUT_NUMBER_OF_LINES, + /** + * @brief Sets the letter spacing of the TextInput 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].f32: letter spacing. The default unit is fp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: letter spacing. The default unit is fp. \n + * + * @since 16 + */ + NODE_TEXT_INPUT_LETTER_SPACING = 7032, + /** + * @brief Sets whether to enable preview text for the TextInput 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: whether to enable preview tex. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable preview tex. \n + * + * @since 16 + */ + NODE_TEXT_INPUT_ENABLE_PREVIEW_TEXT = 7033, /** * @brief Defines the default placeholder text for the multi-line text box. * This attribute can be set, reset, and obtained as required through APIs. @@ -3260,6 +3286,32 @@ typedef enum { * */ NODE_TEXT_AREA_NUMBER_OF_LINES, + /** + * @brief Sets the letter spacing of the TextArea 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].f32: letter spacing. The default unit is fp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: letter spacing. The default unit is fp. \n + * + * @since 16 + */ + NODE_TEXT_AREA_LETTER_SPACING = 8023, + /** + * @brief Sets whether to enable preview text for the TextArea 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: whether to enable preview tex. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable preview tex. \n + * + * @since 16 + */ + NODE_TEXT_AREA_ENABLE_PREVIEW_TEXT = 8024, /** * @brief Defines the button text content. This attribute can be set, reset, and obtained as required through APIs. * @@ -5448,6 +5500,20 @@ typedef struct { const char* pStr; } ArkUI_StringAsyncEvent; +/** + * @brief Defines a hybrid data structure for component events. + * + * @since 16 + */ +typedef struct { + /** String data */ + const char* pStr; + /** Extended string data */ + const char* pExtendStr; + /** Numeric data */ + int32_t number; +} ArkUI_TextChangeEvent; + /** * @brief Enumerates the event types supported by the NativeNode component. * @@ -5960,6 +6026,20 @@ typedef enum { */ NODE_TEXT_INPUT_ON_DID_DELETE = 7012, + /** + * @brief Defines the event triggered when content (including preview text) changes in the TextInput + * component. + * + * When the event callback occurs, the union type {@link ArkUI_NodeEvent} is {@link ArkUI_TextChangeEvent}. \n + * {@link ArkUI_TextChangeEvent} contains the following parameters: \n + * ArkUI_TextChangeEvent.pStr: content in the TextInput component. + * ArkUI_TextChangeEvent.pExtendStr: content of the preview text in the TextInput component. + * ArkUI_TextChangeEvent.number: start position of the preview text in the TextInput component. + * + * @since 16 + */ + NODE_TEXT_INPUT_ON_CHANGE_WITH_PREVIEW_TEXT = 7013, + /** * @brief Defines the event triggered when the input in the text box changes. * @@ -6112,6 +6192,20 @@ typedef enum { */ NODE_TEXT_AREA_ON_DID_DELETE = 8011, + /** + * @brief Defines the event triggered when content (including preview text) changes in the TextArea + * component. + * + * When the event callback occurs, the union type {@link ArkUI_NodeEvent} is {@link ArkUI_TextChangeEvent}. \n + * {@link ArkUI_TextChangeEvent} contains the following parameters: \n + * ArkUI_TextChangeEvent.pStr: content in the TextArea component. + * ArkUI_TextChangeEvent.pExtendStr: content of the preview text in the TextArea component. + * ArkUI_TextChangeEvent.number: start position of the preview text in the TextArea component. + * + * @since 16 + */ + NODE_TEXT_AREA_ON_CHANGE_WITH_PREVIEW_TEXT = 8012, + /** * @brief Defines the event triggered when the selected status of the ARKUI_NODE_CHECKBOX component changes. * @@ -6658,6 +6752,15 @@ ArkUI_NodeComponentEvent* OH_ArkUI_NodeEvent_GetNodeComponentEvent(ArkUI_NodeEve */ ArkUI_StringAsyncEvent* OH_ArkUI_NodeEvent_GetStringAsyncEvent(ArkUI_NodeEvent* event); +/** + * @brief Obtains the ArkUI_TextChangeEvent data from a component event. + * + * @param event Pointer to a component event. It cannot be null. + * @return Returns the pointer to the ArkUI_TextChangeEvent object. + * @since 16 + */ +ArkUI_TextChangeEvent* OH_ArkUI_NodeEvent_GetTextChangeEvent(ArkUI_NodeEvent* event); + /** * @brief Obtains the custom data in a component event. * -- Gitee From 0d24e375d3acf25bc6ef689c765773b682ce5fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E5=86=AC=E5=86=AC=E5=86=AC?= Date: Fri, 6 Dec 2024 15:42:06 +0800 Subject: [PATCH 14/14] Message:fixCodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑冬冬冬 --- .../hicollie/include/hicollie/hicollie.h | 86 +++++++++++++++++++ hiviewdfx/hicollie/libhicollie.ndk.json | 8 ++ 2 files changed, 94 insertions(+) diff --git a/hiviewdfx/hicollie/include/hicollie/hicollie.h b/hiviewdfx/hicollie/include/hicollie/hicollie.h index 8ad4bddcf..ddf579d30 100644 --- a/hiviewdfx/hicollie/include/hicollie/hicollie.h +++ b/hiviewdfx/hicollie/include/hicollie/hicollie.h @@ -62,6 +62,26 @@ typedef enum HiCollie_ErrorCode { HICOLLIE_WRONG_THREAD_CONTEXT = 29800001, /** Remote call failed */ HICOLLIE_REMOTE_FAILED = 29800002, + /** + * Invalid timer name + * @since 16 + */ + HICOLLIE_INVALID_TIMER_NAME = 29800003, + /** + * Invalid timeout value + * @since 16 + */ + HICOLLIE_INVALID_TIMEOUT_VALUE = 29800004, + /** + * Wrong process context + * @since 16 + */ + HICOLLIE_WRONG_PROCESS_CONTEXT = 29800005, + /** + * The pointer used to save returned timer id should not be NULL + * @since 16 + */ + HICOLLIE_WRONG_TIMER_ID_OUTPUT_PARAM = 29800006, } HiCollie_ErrorCode; /** @@ -154,6 +174,72 @@ HiCollie_ErrorCode OH_HiCollie_Init_JankDetection(OH_HiCollie_BeginFunc* beginFu */ HiCollie_ErrorCode OH_HiCollie_Report(bool* isSixSecond); +/** + * @brief When user call {@link OH_HiCollie_SetTimer} and do not call {@link OH_HiCollie_CancelTimer} + * in specific time, the callback function will be executed. + * + * @since 16 + */ +typedef void (*OH_HiCollie_Callback)(void*); + +/** + * @brief Defines the actions that will be executed when timeout happens. + * + * @since 16 + */ +typedef enum HiCollie_Flag { + /** Default action is generate log file and do recovery */ + HICOLLIE_FLAG_DEFAULT = (~0), + /* Do nothing except call the callback function */ + HICOLLIE_FLAG_NOOP = (0), + /* Generate log file */ + HICOLLIE_FLAG_LOG = (1 << 0), + /* Do recovery by call the exit syscall */ + HICOLLIE_FLAG_RECOVERY = (1 << 1) +} HiCollie_Flag; + +/** +* @brief Defines the input parameter for {@link OH_HiCollie_SetTimer} +* +* @since 16 +*/ +typedef struct HiCollie_SetTimerParam { + /** The timer name */ + const char *name; + /** The timeout threshold in seconds */ + unsigned int timeout; + /** The callback function which is excuted when timeout happen */ + OH_HiCollie_Callback func; + /** The callback function's parameter */ + void *arg; + /** The action when timeout happens. Please refer to {@link HiCollie_Flag} */ + HiCollie_Flag flag; +} HiCollie_SetTimerParam; + +/** + * @brief This function should be used before calling a time-consuming function + * + * @param param Define the input parameter. + * @param id The pointer used to save returned timer id, it should not be NULL. + * @return {@link HICOLLIE_SUCCESS} 0 - Success. + * {@link HICOLLIE_INVALID_TIMER_NAME} 29800003 - Invalid timer name, it should not be NULL or empty string. + * {@link HICOLLIE_INVALID_TIMEOUT_VALUE} 29800004 - Invalid timeout value. + * {@link HICOLLIE_WRONG_PROCESS_CONTEXT} 29800005 - Invalid process context, you should not call it + * from appspawn and native process. + * {@link HICOLLIE_WRONG_TIMER_ID_OUTPUT_PARAM} 29800006 - The pointer used to save returned timer id + * should not be NULL. + * @since 16 + */ +HiCollie_ErrorCode OH_HiCollie_SetTimer(HiCollie_SetTimerParam param, int *id); + +/** + * @brief Cancel the timer right after calling the time-consuming function. + * + * @param id The timer id that is return from {@link OH_HiCollie_SetTimer}. + * @since 16 + */ +void OH_HiCollie_CancelTimer(int id); + #ifdef __cplusplus } #endif diff --git a/hiviewdfx/hicollie/libhicollie.ndk.json b/hiviewdfx/hicollie/libhicollie.ndk.json index 4684c9899..bec806ac1 100644 --- a/hiviewdfx/hicollie/libhicollie.ndk.json +++ b/hiviewdfx/hicollie/libhicollie.ndk.json @@ -10,5 +10,13 @@ { "first_introduced": "12", "name": "OH_HiCollie_Report" + }, + { + "first_introduced": "16", + "name": "OH_HiCollie_SetTimer" + }, + { + "first_introduced": "16", + "name": "OH_HiCollie_CancelTimer" } ] -- Gitee