diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index 1ba53503d9f1b6ace7fece3f3d6e004221835186..4ac78aa5a4406453e0b7bcf9de16219814d2b047 100644 --- a/AbilityKit/ability_runtime/application_context.h +++ b/AbilityKit/ability_runtime/application_context.h @@ -92,6 +92,125 @@ 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 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 239f84f6151aab58f4d1fd3177870b80af428f59..fcde96f6cbfed4f407a3adadbf2afffd700dc4ca 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -10,5 +10,33 @@ { "first_introduced": "13", "name": "OH_AbilityRuntime_ApplicationContextGetBundleName" + }, + { + "first_introduced": "16", + "name": "OH_AbilityRuntime_ApplicationContextGetTempDir" + }, + { + "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 diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 3f47366b4e021dcd9f8861a3fb9d136619b31d81..88d4d4010ac26d76f11865656a26afaf5fa861f9 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. * @@ -131,6 +143,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. * @@ -2314,6 +2381,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. @@ -3045,6 +3134,258 @@ 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); + +/** + * @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 1141b051f8d71e2590a0ded319cf722d8fef7f0b..d61367a4b6bae204e86b708687bdf716441035e0 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; /** @@ -770,5 +774,41 @@ 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; + +/** + * @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 e0157b7722ff66f925d17ba0a0367d2a0c5e5fe8..a21c03271b10da3f67b6f4e82e2d9b293c60ee1d 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -734,5 +734,97 @@ { "first_introduced": "12", "name": "OH_JSVM_ReleaseCache" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_PromiseRegisterHandler" + }, + { + "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" + }, + { + "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" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_SetMicrotaskPolicy" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_TraceStart" + }, + { + "first_introduced": "16", + "name": "OH_JSVM_TraceStop" } ] diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 98b4908b78ef5f64d2b123c7984caada10f5da9e..9861c72265fee7dd260fea054d0db37f69424e1b 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 957b003fdc55dff9fcd7953cf845637ce200dd85..a4bd8a2889a47e11c5f65ab80cad9cbb45f6c2d3 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. * @@ -4343,12 +4395,17 @@ 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 + * .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}. This parameter is supported since API version 16. \n * */ NODE_SCROLL_EDGE_EFFECT, @@ -5443,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. * @@ -5955,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. * @@ -6107,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. * @@ -6653,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. * diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index ca825e62b3ed462bf02dd2886573ec9a3f8bd720..fd11e1ef346610561067e21eabe55d2624711afe 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. * diff --git a/distributeddatamgr/preferences/include/oh_preferences.h b/distributeddatamgr/preferences/include/oh_preferences.h index 944fa9dffcdcd8024127548ed3994bf5f8de406d..837891ae77c612ee52a3301288e9d36e7aa26f88 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 a8a25af9f55287456e3595803981a3c727390acf..82a6d7a310d0da483c974dd363d5ac04b4a70329 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. * diff --git a/graphic/graphic_2d/native_drawing/drawing_font_collection.h b/graphic/graphic_2d/native_drawing/drawing_font_collection.h index a6097dad1954a1643bfa5307eca7fb0fa3f780dd..e6ac9f49424f699c6c830f9788619ca8093dec78 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 353ce3f539771d30cdac90947de31c81c38d3c4d..a0ac4408f00acea04529f56f80c20fd22e1b4101 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 diff --git a/hiviewdfx/hicollie/include/hicollie/hicollie.h b/hiviewdfx/hicollie/include/hicollie/hicollie.h index 8ad4bddcfdb0647d3ffc83239af86294712e4069..ddf579d30092dc69a5a7811f3c7a570e67d942d0 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 4684c9899bea60c0b7c796029f251dac8e8b8479..bec806ac1a822c8ff0955194033c9c500e7dc9b9 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" } ] diff --git a/third_party/musl/ndk_script/BUILD.gn b/third_party/musl/ndk_script/BUILD.gn index a71e33565ab354dd49bfb34bdfa2de31e336bbe8..c62a9b6325a0f86f30afdcd618fb080a2d3bd589 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", ]