diff --git a/en/application-dev/reference/Readme-EN.md b/en/application-dev/reference/Readme-EN.md index 8234a9c65b9c06e0a36001746393585c27cd3060..b54770f9907674640a2d688482f389ce62628c51 100644 --- a/en/application-dev/reference/Readme-EN.md +++ b/en/application-dev/reference/Readme-EN.md @@ -1,5 +1,5 @@ # Development References -- [API Reference Document Description](development-intro.md) +- [Development Description](development-intro.md) - [SystemCapability](syscap.md) - [SystemCapability List](syscap-list.md) - [Universal Error Codes](errorcode-universal.md) diff --git a/en/application-dev/reference/development-intro.md b/en/application-dev/reference/development-intro.md index 1f59f3fb4cfca63f6a6fe739384828eeab273f4f..730864ee202f8c665f34cb49f0260c5636e95c21 100644 --- a/en/application-dev/reference/development-intro.md +++ b/en/application-dev/reference/development-intro.md @@ -1,4 +1,4 @@ -# API Reference Document Description +# Document Description API references provide the description of APIs used for application development. This topic describes common fields in the API references to help you better use the reference document. diff --git a/en/application-dev/reference/litewearable-syscap-list.md b/en/application-dev/reference/litewearable-syscap-list.md new file mode 100644 index 0000000000000000000000000000000000000000..43369b135f706f6395e0596ce9663764e7a3313d --- /dev/null +++ b/en/application-dev/reference/litewearable-syscap-list.md @@ -0,0 +1,28 @@ +# SystemCapability List + +SystemCapability (SysCap) is a standalone feature in the operating system. + +Before using an API for development, you are advised to familiarize yourself with [SysCap](syscap.md), and then consult the following tables to see whether the SysCap set required for the API is supported by the target device type. + +> **NOTE** +> +> This list outlines the minimum system capabilities supported by the current version of lite wearables. You can refer to the **liteWearable.json** file in the SDK for details. +> When developing applications for the current version of lite wearables using the APIs corresponding to the system capabilities listed, you can call these APIs directly without needing to perform a **canIUse()** check beforehand. + +- SystemCapability.ArkUI.ArkUI.Lite +- SystemCapability.Base +- SystemCapability.Location.Location.Lite +- SystemCapability.PowerManager.BatteryManager.Lite +- SystemCapability.FileManagement.File.FileIO.Lite +- SystemCapability.Startup.SystemInfo.Lite +- SystemCapability.PowerManager.DisplayPowerManager.Lite +- SystemCapability.Communication.NFC.CardEmulation +- SystemCapability.Security.Huks.Core +- SystemCapability.DistributedDataManager.Preferences.Core.Lite +- SystemCapability.Sensors.Sensor.Lite +- SystemCapability.Sensors.MiscDevice.Lite +- SystemCapability.Communication.NetStack +- SystemCapability.MiscServices.ScreenLock +- SystemCapability.Security.CryptoFramework +- SystemCapability.Security.CryptoFramework.MessageDigest +- SystemCapability.Security.CryptoFramework.Rand diff --git a/en/application-dev/reference/native-lib/Readme-EN.md b/en/application-dev/reference/native-lib/Readme-EN.md index b70470c71d702cc898d547d0325d445123fa16c5..8b1b6fe4800d34869ab61c953e7d0f50686e7af5 100644 --- a/en/application-dev/reference/native-lib/Readme-EN.md +++ b/en/application-dev/reference/native-lib/Readme-EN.md @@ -1,4 +1,4 @@ -# Native API Standard Libraries +# Native API Standard Libraries - [libc](musl.md) - [libc++](cpp.md) @@ -9,10 +9,10 @@ - [EGL](egl.md) - [ICU4C](icu4c.md) - [Zlib](zlib.md) -- Vulkan +- Vulkan - [Vulkan Development](vulkan-guidelines.md) - [Vulkan Capabilities](vulkan.md) - - Vulkan Extensions + - Vulkan Extensions - [Vulkan Module](_vulkan.md) - [vulkan_ohos.h](vulkan__ohos_8h.md) - [VkExternalFormatOHOS](_vk_external_format_o_h_o_s.md) @@ -22,9 +22,9 @@ - [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) - [VkNativeBufferUsageOHOS](_vk_native_buffer_usage_o_h_o_s.md) - [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) -- Appendix - - [libc Symbols Not Exported](musl-peculiar-symbol.md) - - [Restricted musl libc APIs](guidance-on-ndk-libc-interfaces-affected-by-permissions.md) +- Appendix + - [Native API Symbols Not Exported](musl-peculiar-symbol.md) + - [NDK-Related musl libc Interface Usage Restrictions](guidance-on-ndk-libc-interfaces-affected-by-permissions.md) - [EGL Symbols Exported from Native APIs](egl-symbol.md) - [ICU4C Symbols Exported from Native APIs](icu4c-symbol.md) - [OpenGL ES 3.2 Symbols Exported from Native APIs](openglesv3-symbol.md) diff --git a/en/application-dev/reference/native-lib/_vulkan.md b/en/application-dev/reference/native-lib/_vulkan.md index 786fd5028a8a92dedb3027dd38ae61d642eafa5a..84bca30f51684ab66206ff03e83a7614a9403fd1 100644 --- a/en/application-dev/reference/native-lib/_vulkan.md +++ b/en/application-dev/reference/native-lib/_vulkan.md @@ -69,9 +69,12 @@ The **Vulkan** module provides Vulkan capabilities extended by OpenHarmony. It p | Name| Description| | -------- | -------- | -| [vkCreateSurfaceOHOS](#vkcreatesurfaceohos) (VkInstance instance, const VkSurfaceCreateInfoOHOS \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Creates a Vulkan surface.| -| [vkGetNativeBufferPropertiesOHOS](#vkgetnativebufferpropertiesohos) (VkDevice device, const struct OH_NativeBuffer \*buffer, VkNativeBufferPropertiesOHOS \*pProperties) | Obtains the properties of an **OH_NativeBuffer** instance.| -| [vkGetMemoryNativeBufferOHOS](#vkgetmemorynativebufferohos) (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Obtains an **OH_NativeBuffer** instance.| +| VKAPI_ATTR VkResult VKAPI_CALL [vkCreateSurfaceOHOS](#vkcreatesurfaceohos) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Creates a Vulkan surface.| +| VKAPI_ATTR VkResult VKAPI_CALL [vkGetNativeBufferPropertiesOHOS](#vkgetnativebufferpropertiesohos) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Obtains the properties of an **OH_NativeBuffer** instance.| +| VKAPI_ATTR VkResult VKAPI_CALL [vkGetMemoryNativeBufferOHOS](#vkgetmemorynativebufferohos) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Obtains an **OH_NativeBuffer** instance.| +| VKAPI_ATTR VkResult VKAPI_CALL [vkGetSwapchainGrallocUsageOHOS](#vkgetswapchaingrallocusageohos) (VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t \*grallocUsage) | Returns the appropriate gralloc usage flag based on the given Vulkan device, image format, and image usage flag.| +| VKAPI_ATTR VkResult VKAPI_CALL [vkAcquireImageOHOS](#vkacquireimageohos) (VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence) | Obtains the ownership of the swap chain image and imports the fence of the external signal to the VkSemaphore and VkFence objects.| +| VKAPI_ATTR VkResult VKAPI_CALL [vkQueueSignalReleaseImageOHOS](#vkqueuesignalreleaseimageohos) (VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore \*pWaitSemaphores, VkImage image, int32_t \*pNativeFenceFd) | Sends a signal to the system hardware buffer to release an image once it is no longer needed so that other components can access it.| ### Variables @@ -378,6 +381,35 @@ Defines the parameters required for creating a Vulkan surface. ## Function Description +### vkAcquireImageOHOS() + +``` +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageOHOS (VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence ) +``` + +**Description** + +Obtains the ownership of the swap chain image and imports the fence of the external signal to the VkSemaphore and VkFence objects. + +**System capability**: SystemCapability.Graphic.Vulkan + +**Since**: 10 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| device | **VkDevice** instance.| +| image | Vulkan image to obtain.| +| nativeFenceFd | File descriptor of the native fence.| +| semaphore | Vulkan semaphore indicating that the image is available.| +| fence | Vulkan fence used for synchronization when the image acquisition is complete.| + +**Returns** + +Returns an error code of the VkResult type. +- Returns **VK_SUCCESS** if the operation is successful. +- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the host memory is insufficient. ### vkCreateSurfaceOHOS() @@ -402,7 +434,10 @@ Creates a Vulkan surface. **Returns** -Returns **VK_SUCCESS** if the execution is successful; returns an error code of the VkResult type otherwise. +Returns an error code of the VkResult type. +- Returns **VK_SUCCESS** if the operation is successful. +- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the VkSurfaceKHR memory fails to be allocated. +- Returns **VK_ERROR_SURFACE_LOST_KHR** if the NativeWindow operation fails. ### vkGetMemoryNativeBufferOHOS() @@ -428,8 +463,9 @@ Obtains an **OH_NativeBuffer** instance. **Returns** -Returns **VK_SUCCESS** if the execution is successful; returns an error code of the VkResult type otherwise. - +Returns an error code of the VkResult type. +- Returns **VK_SUCCESS** if the operation is successful. +- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the input parameter **pInfo** is abnormal or the obtained **pBuffer** is abnormal. ### vkGetNativeBufferPropertiesOHOS() @@ -454,8 +490,71 @@ Obtains the properties of an **OH_NativeBuffer** instance. **Returns** -Returns **VK_SUCCESS** if the execution is successful; returns an error code of the VkResult type otherwise. +Returns an error code of the VkResult type. +- Returns **VK_SUCCESS** if the operation is successful. +- Returns **VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR** if an input parameter is abnormal. +- Returns **VK_ERROR_OUT_OF_DEVICE_MEMORY** if the device memory is insufficient. + + +### vkGetSwapchainGrallocUsageOHOS() + +``` +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageOHOS (VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t* grallocUsage ) +``` + +**Description** + +Returns the appropriate gralloc usage flag based on the given Vulkan device, image format, and image usage flag. + +**System capability**: SystemCapability.Graphic.Vulkan + +**Since**: 10 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| device | **VkDevice** instance.| +| format | Image format.| +| imageUsage | Image use flag.| +| grallocUsage | Pointer to the gralloc usage flag.| + +**Returns** + +Returns an error code of the VkResult type. +- Returns **VK_SUCCESS** if the operation is successful. +- Returns **VK_ERROR_INITIALIZATION_FAILED** if an input parameter is abnormal. + +### vkQueueSignalReleaseImageOHOS() + +``` +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageOHOS (VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd ) +``` + +**Description** + +Sends a signal to the system hardware buffer to release an image once it is no longer needed so that other components can access it. + +**System capability**: SystemCapability.Graphic.Vulkan + +**Since**: 10 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| queue | Handle to the Vulkan queue.| +| waitSemaphoreCount | Number of semaphores to wait on.| +| pWaitSemaphores | Pointer to the array of semaphores to wait on.| +| images | Handle to the Vulkan image to be released.| +| pNativeFenceFd | Pointer to the file descriptor of the fence.| + +**Returns** +Returns an error code of the VkResult type. +- Returns **VK_SUCCESS** if the operation is successful. +- Returns **VK_ERROR_DEVICE_LOST** if the Vulkan device link is lost. +- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the host memory is insufficient. ## Variable Description diff --git a/en/application-dev/reference/native-lib/cpp.md b/en/application-dev/reference/native-lib/cpp.md index 799bdfdfb82030e2abfe4b95f1431f3eae11d8bf..166cf29befccb8776039c000b06002baebf4261b 100644 --- a/en/application-dev/reference/native-lib/cpp.md +++ b/en/application-dev/reference/native-lib/cpp.md @@ -4,7 +4,7 @@ OpenHarmony uses [libc++](https://libcxx.llvm.org/) of the open-source LLVM proj ## libc++ Version -- Clang/LLVM 15.0.4 from OpenHarmony 4.0 to OpenHarmony 5.0 +- Clang/LLVM 15.0.4 for OpenHarmony 4.0 to OpenHarmony 6.0 - Clang/LLVM 12.0.1 from OpenHarmony 3.2 diff --git a/en/application-dev/reference/native-lib/egl-symbol.md b/en/application-dev/reference/native-lib/egl-symbol.md index 6a06663495b03a721515c890f6d9d7d307f7f24f..7534064a3e63bac1cdfb4a37f5faf726cad3522a 100644 --- a/en/application-dev/reference/native-lib/egl-symbol.md +++ b/en/application-dev/reference/native-lib/egl-symbol.md @@ -1,7 +1,7 @@ # EGL Symbols Exported from Native APIs |Type|Symbol| -| --- | --- | +| --- | --- | |FUNC|eglChooseConfig| |FUNC|eglCopyBuffers| |FUNC|eglCreateContext| diff --git a/en/application-dev/reference/native-lib/egl.md b/en/application-dev/reference/native-lib/egl.md index 8d8ebc61fbfb171f96325e37013d2545d7a9b44d..24908961108a76996828afdbb6cf8d274bd5b52d 100644 --- a/en/application-dev/reference/native-lib/egl.md +++ b/en/application-dev/reference/native-lib/egl.md @@ -1,7 +1,6 @@ - # EGL -EGL is an interface between Khronos rendering APIs (such as OpenGL ES and OpenVG) and the underlying native window system. OpenHarmony supports EGL. +[EGL](https://registry.khronos.org/EGL/sdk/docs/man/) is an interface between Khronos rendering APIs (such as [OpenGLES](https://registry.khronos.org/OpenGL-Refpages/es3/) or OpenVG) and the underlying window system. OpenHarmony supports EGL. ## Introducing EGL diff --git a/en/application-dev/reference/native-lib/figures/libuv-ffrt.jpg b/en/application-dev/reference/native-lib/figures/libuv-ffrt.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a4ab28f4c6fcca26ba883b296fdacfdc8ab93b5e Binary files /dev/null and b/en/application-dev/reference/native-lib/figures/libuv-ffrt.jpg differ diff --git a/en/application-dev/reference/native-lib/figures/libuv-ffrt.png b/en/application-dev/reference/native-lib/figures/libuv-ffrt.png deleted file mode 100644 index e42328bb321561e71fcff452fcc62b9dbd42e1e2..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/native-lib/figures/libuv-ffrt.png and /dev/null differ diff --git a/en/application-dev/reference/native-lib/figures/libuv-image-1.jpg b/en/application-dev/reference/native-lib/figures/libuv-image-1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6dcc6886bda43880812b73814b671567c69f24e6 Binary files /dev/null and b/en/application-dev/reference/native-lib/figures/libuv-image-1.jpg differ diff --git a/en/application-dev/reference/native-lib/figures/libuv-image-3.jpg b/en/application-dev/reference/native-lib/figures/libuv-image-3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8cf204ebfe8e5c7fdb6a94f4ff8b04f78b99ed1f Binary files /dev/null and b/en/application-dev/reference/native-lib/figures/libuv-image-3.jpg differ diff --git a/en/application-dev/reference/native-lib/figures/libuv-inter-thread-communication.png b/en/application-dev/reference/native-lib/figures/libuv-inter-thread-communication.png deleted file mode 100644 index 4f8b466cc311c7fd02a4ff3d16fd5156d1eb672b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/native-lib/figures/libuv-inter-thread-communication.png and /dev/null differ diff --git a/en/application-dev/reference/native-lib/figures/libuv-thread-pool.png b/en/application-dev/reference/native-lib/figures/libuv-thread-pool.png deleted file mode 100644 index d5ee093c62c77fcc2e548197a0e474b05ce43e80..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/native-lib/figures/libuv-thread-pool.png and /dev/null differ diff --git a/en/application-dev/reference/native-lib/guidance-on-ndk-libc-interfaces-affected-by-permissions.md b/en/application-dev/reference/native-lib/guidance-on-ndk-libc-interfaces-affected-by-permissions.md index d6ed272ec5978506c1ea9e21ed0c767ef8e9bdcc..3a3459a8bf01d9fb76f15528ec62f1cae6815d89 100644 --- a/en/application-dev/reference/native-lib/guidance-on-ndk-libc-interfaces-affected-by-permissions.md +++ b/en/application-dev/reference/native-lib/guidance-on-ndk-libc-interfaces-affected-by-permissions.md @@ -1,128 +1,261 @@ -# Restricted musl libc APIs +# NDK-Related musl libc Interface Usage Restrictions ## Overview -You may need to use musl libc APIs when developing your app with the NDK. However, some musl libc APIs cannot be used due to system or environment restrictions. Errors may occur when some musl libc APIs are used with DevEco Studio. This topic helps you learn about the musl libc APIs that cannot be used with the NDK. +When developing an application using DevEco Studio or NDK, you may need to use the interface capabilities of musl libc. However, some interfaces of musl libc may be unavailable due to restrictions of multiple systems and environments. In this case, you can refer to this document to troubleshoot interface issues. -## Scenarios + -The use of musl libc APIs may be restricted by the following factors: +## Seccomp-Affected musl Interfaces + For details about the secure computing mode (Seccomp) mechanism, see [Seccomp Policy Development](../../../device-dev/subsystems/subsys-boot-init-seccomp.md). -1. The use of the musl libc API is restricted by the secure computing (seccomp) mechanism. - For details about the seccomp mechanism, see [Seccomp Policy Development](../../../device-dev/subsystems/subsys-boot-init-seccomp.md). +### Determining Process Termination Due to Seccomp - A common error caused by seccomp is as follows: - - Top function is the musl function in stacktrace. - - The reason is "signal:SIGSYS", as shown in the following example: - ``` - Process name:com.example.myapplication - Reason:Signal:SIGSYS(UNKNOWN) - Fault thread Info: - Tid:13893, Name:e.myapplication - #00 pc 000a5d30 /system/lib/ld-musl-arm.so.1(sethostname+16)(584c9d0a0e9000497bb0d66799a9526a) - #01 pc 00002f68 /data/storage/el1/bundle/libs/arm/libentry.so(test()+64) - ``` +- Check the process fault logs. If the error cause is **signal:SIGSYS** and the stack top is in the ld-musl-{architecture}.so.1 library, the process termination may be caused by the Seccomp mechanism. + ``` + cat /data/log/faultlog/faultlogger/cppcrash-xxxx + ``` + Incorrect example: + ``` + Process name:com.example.myapplication + Reason:Signal:SIGSYS(UNKNOWN) + Fault thread Info: + Tid:13893, Name:e.myapplication + #00 pc 000a5d30 /system/lib/ld-musl-arm.so.1(sethostname+16)(584c9d0a0e9000497bb0d66799a9526a) + #01 pc 00002f68 /data/storage/el1/bundle/libs/arm/libentry.so(test()+64) + ``` + +- Disable the Seccomp mechanism. If the process runs properly, the termination is caused by the Seccomp mechanism. + + When the device system version is an ENG version and the system is in root mode, execute the shell command to set the system parameter to disable the Seccomp mechanism. + ```shell + # Set the system parameter to disable Seccomp and restart the process. + param set persist.init.debug.seccomp.enable 0 + reboot + # Set the system parameter to enable Seccomp and restart the process. + param set persist.init.debug.seccomp.enable 1 + reboot + ``` + -2. The API cannot be used because it is a kernel API that is not exposed. +### Common Seccomp-Affected Interfaces -3. The use of the musl libc API is restricted by SELinux. +| Header File | musl Interface | +| ------------ | ----------------- | +| fcntl.h | name_to_handle_at | +| fcntl.h | open_by_handle_at | +| grp.h | initgroups | +| grp.h | setgroups | +| sched.h | setns | +| sched.h | unshare | +| sys/fanotify.h | fanotify_init | +| sys/fanotify.h | fanotify_mark | +| sys/fsuid.h | setfsgid | +| sys/fsuid.h | setfsuid | +| sys/klog.h | klogctl | +| sys/mount.h | mount | +| sys/mount.h | umount2 | +| sys/mount.h | umount | +| sys/msg.h | msgctl | +| sys/msg.h | msgget | +| sys/msg.h | msgrcv | +| sys/msg.h | msgsnd | +| sys/reboot.h | reboot | +| sys/sem.h | semctl | +| sys/sem.h | semget | +| sys/sem.h | semop | +| sys/sem.h | semtimedop | +| sys/shm.h | shmat | +| sys/shm.h | shmctl | +| sys/shm.h | shmdt | +| sys/shm.h | shmget | +| sys/stat.h | mkfifo | +| sys/stat.h | mkfifoat | +| sys/stat.h | mknod | +| sys/stat.h | mknodat | +| sys/swap.h | swapoff | +| sys/swap.h | swapon | +| time.h | clock_settime | +| sys/time.h | settimeofday | +| sys/timex.h | adjtimex | +| sys/timex.h | clock_adjtime | +| unistd.h | acct | +| unistd.h | chroot | +| unistd.h | pause | +| unistd.h | setdomainname | +| unistd.h | setegid | +| unistd.h | setgid | +| unistd.h | sethostname | +| unistd.h | setregid | +| unistd.h | setresgid | +| unistd.h | setreuid | +| unistd.h | setuid | +| None | pivot_root | +| None | init_module | +| None | delete_module | + + +## Kernel-Related musl Interfaces Not Opened to the Public + +| Header File | musl Interface | +| -------------- | -------------- | +| sys/fanotify.h | fanotify_init | +| sys/fanotify.h | fanotify_mark | +| unistd.h | acct | + +## SELinux-Affected musl Interfaces For details about SELinux, see [OpenHarmony SELinux Overview](../../../device-dev/subsystems/subsys-security-selinux-overview.md). -4. The use of the musl libc API is restricted by the sandbox mechanism. For details about the sandbox mechanism, see [Application Sandbox](../../file-management/app-sandbox-directory.md). - -5. The musl libc API is a null implementation or failed by default. - -6. The API can be executed after special permissions are granted. - -## Restricted musl libc APIs - -The following table lists the musl libc APIs that cannot be used. - -| Restricted By | Header File | Symbol | -| -------------------- | ------------ | ---------------- | -| seccomp | sys/fsuid.h | setfsgid | -| seccomp | sys/fsuid.h | setfsuid | -| seccomp | unistd.h | setgid | -| seccomp | unistd.h | setegid | -| seccomp | unistd.h | setreuid | -| seccomp | unistd.h | setregid | -| seccomp | unistd.h | setresgid | -| seccomp | unistd.h | setgroups | -| seccomp | unistd.h | chroot | -| seccomp | unistd.h | sethostname | -| seccomp | unistd.h | setdomainname | -| seccomp | unistd.h | acct | -| seccomp | sys/xattr.h | setxattr | -| seccomp | time.h | clock_settime | -| seccomp | time.h | settimeofday | -| seccomp | sys/stat.h | mknod | -| seccomp | sys/stat.h | mknodat | -| seccomp | sys/stat.h | mkfifo | -| seccomp | fcntl.h | name_to_handle_at | -| seccomp | fcntl.h | open_by_handle_at | -| seccomp | sys/klog.h | klogctl | -| seccomp | sys/swap.h | swapon | -| seccomp | sys/swap.h | swapoff | -| seccomp | sys/sem.h | semctl | -| seccomp | sys/sem.h | semop | -| seccomp | sys/sem.h | semtimedop | -| seccomp | sys/mount.h | mount | -| seccomp | sys/mount.h | umount2 | -| seccomp | sys/mount.h | umount | -| seccomp | sys/msg.h | msgctl | -| seccomp | sys/msg.h | msgget | -| seccomp | sys/msg.h | msgrcv | -| seccomp | sys/msg.h | msgsnd | -| seccomp | grp.h | initgroups | -| seccomp | grp.h | init_module | -| seccomp | sched.h | unshare | -| seccomp | sched.h | setns | -| seccomp | None | pivot_root | -| Kernel API not exposed| sys/fanotify.h | fanotify_init | -| Kernel API not exposed| sys/fanotify.h | fanotify_mark | -| Kernel API not exposed| syslog.h | syslog | -| Kernel API not exposed| syslog.h | vsyslog | -| SELinux | pty.h | forkpty | -| SELinux | pty.h | openpty | -| SELinux | stdlib.h | ptsname | -| SELinux | stdlib.h | ptsname_r | -| SELinux | stdlib.h | posix_openpt | -| SELinux | stdlib.h | unlockpt | -| SELinux | sys/shm.h | shmget | -| SELinux | sys/shm.h | shmat | -| SELinux | sys/shm.h | shmdt | -| SELinux | sys/shm.h | shmctl | -| SELinux | sys/sem.h | semget | -| SELinux | stdio.h | popen | -| SELinux | stdio.h | pclose | -| SELinux | unistd.h | tcgetpgrp | -| SELinux | unistd.h | tcsetpgrp | -| SELinux | unistd.h | link | -| SELinux | unistd.h | linkat | -| SELinux | unistd.h | readlink | -| SELinux | unistd.h | readlinkat | -| SELinux | unistd.h | symlink | -| SELinux | unistd.h | symlinkat | -| SELinux | sys/stat.h | mkfifoat | -| SELinux | termios | tcgetattr | -| SELinux | termios | tcsetattr | -| SELinux | termios | tcsendbreak | -| SELinux | termios | tcdrain | -| SELinux | termios | tcflush | -| SELinux | termios | tcflow | -| SELinux | termios | tcgetsid | -| SELinux | net/if.h | if_indextoname | -| SELinux | net/if.h | if_nametoindex | -| Sandbox | stdio.h | tmpfile | -| Sandbox | stdio.h | tmpfile64 | -| Sandbox | nl_type.h | catgets | -| Sandbox | nl_type.h | catclose | -| Null implementation or failed by default | utmp.h | setutent | -| Null implementation or failed by default | utmp.h | pututline | -| Null implementation or failed by default | utmp.h | getutent | -| Null implementation or failed by default | utmp.h | utmpname | -| Null implementation or failed by default | unistd.h | brk | -| Null implementation or failed by default | stdio_ext.h | __fsetlocking | -| Null implementation or failed by default | netdb.h | getnetbyaddr | -| Null implementation or failed by default | netdb.h | getnetbyname | -| **CAP_SYS_ADMIN** permission required| None | pivot_root | +### Determining Interface Errors Caused by SELinux +- Include the **errno.h** header file and check the errno error status code. If the error status code is EACCES, the interface error may be caused by the SELinux mechanism. + +- Check the kernel AVC logs for SELinux interception logs with type=1400 to determine whether the interface error is caused by the SELinux mechanism. + + ```shell + # Search for type=1400 kernel Selinux logs (Note: Due to execution efficiency, the kernel may discard some logs.) + dmesg -w | grep "pid=2854" | grep "type=1400" + # Example of a log affected by the SELinux mechanism + audit: type=1400 audit(1502785908.269:47562): avc: denied { ioctl } for pid=2854 comm="sh" path="/dev/tty" dev="tmpfs" ino=40 ioctlcmd=0x5403 scontext=u:r:su:s0 tcontext=u:object_r:tty_device:s0 tclass=chr_file permissive=0 + # Log interpretation + ioctl # Operation performed on the object + pid=2854 # Process ID of the subject + comm="sh" # Process name of the subject + path="/dev/tty" # Object being accessed + dev="tmpfs" # File system of the object + ino=40 # Inode number of the object + ioctlcmd=0x5403 # ioctl command + scontext=u:r:su:s0 # SELinux context of the subject + tcontext=u:object_r:tty_device:s0 # SELinux context of the object + tclass=chr_file # Permission category (character device file) + permissive=0 # 0: enforcing mode; 1: permissive mode + # Log conclusion + The process (2854) attempted to perform an ioctl operation on /dev/tty. Due to a lack of permission for the ioctlcmd=0x5403 command and SELinux being in enforcing mode, the kernel blocked the process operation and set errno to EACCES. + ``` + +- Disable the SELinux mechanism. If the interface call succeeds, the error is caused by the SELinux mechanism. + + When the device is in root mode, execute the shell command to set the system parameter to temporarily disable the SELinux mechanism. + ```shell + # Set the system parameter to disable the SELinux mechanism. + setenforce 0 + # Set the system parameter to enable the SELinux mechanism. + setenforce 1 + ``` + + +### Common SELinux-Affected Interfaces + +| Header File | musl Interface | +| -------------- | -------------- | +| net/if.h | if_indextoname | +| net/if.h | if_nametoindex | +| pty.h | forkpty | +| pty.h | openpty | +| semaphore.h | sem_open | +| semaphore.h | sem_unlink | +| stdlib.h | ptsname | +| stdlib.h | ptsname_r | +| stdlib.h | posix_openpt | +| stdlib.h | unlockpt | +| stdio.h | popen | +| stdio.h | pclose | +| sys/ioctl.h | ioctl | +| sys/mman.h | shm_open | +| sys/mman.h | shm_unlink | +| sys/mount.h | mount | +| sys/mount.h | umount | +| sys/mount.h | umount2 | +| sys/msg.h | msgctl | +| sys/msg.h | msgget | +| sys/msg.h | msgrcv | +| sys/msg.h | msgsnd | +| sys/sem.h | semget | +| sys/sem.h | semctl | +| sys/sem.h | semop | +| sys/sem.h | semtimedop | +| sys/shm.h | shmget | +| sys/shm.h | shmat | +| sys/shm.h | shmdt | +| sys/shm.h | shmctl | +| sys/stat.h | mkfifo | +| sys/stat.h | mkfifoat | +| sys/stat.h | mknod | +| sys/stat.h | mknodat | +| termios.h | tcgetattr | +| termios.h | tcsetattr | +| termios.h | tcsendbreak | +| termios.h | tcdrain | +| termios.h | tcflush | +| termios.h | tcflow | +| termios.h | tcgetsid | +| unistd.h | link | +| unistd.h | linkat | +| unistd.h | readlink | +| unistd.h | readlinkat | +| unistd.h | symlink | +| unistd.h | symlinkat | +| unistd.h | tcgetpgrp | +| unistd.h | tcsetpgrp | +| utmp.h | login_tty | + + +## Sandbox-Affected musl Interfaces + +For details about the sandbox mechanism, see [Application Sandbox](../../file-management/app-sandbox-directory.md). + +Include the **errno.h** header file and check the errno error status code. If the error status code is ENOENT, the interface error may be caused by the sandbox mechanism. + +### Common Sandbox-Affected Interfaces + +| Header File | musl Interface| +| -------------- | ----------- | +| fcntl.h | open | +| fcntl.h | openat | +| nl_types.h | catopen | +| stdio.h | fopen | +| stdio.h | freopen | +| stdio.h | rename | +| stdio.h | renameat | +| stdio.h | renameat2 | +| stdio.h | tmpfile | +| stdio.h | tmpfile64 | + + +## No-Op or Default-Failure musl Interfaces + +| Header File | musl Interface | +| -------------- | ------------- | +| netdb.h | getnetbyaddr | +| netdb.h | getnetbyname | +| stdio_ext.h | __fsetlocking | +| unistd.h | brk | +| utmp.h | getutent | +| utmp.h | pututline | +| utmp.h | setutent | +| utmp.h | pututline | +| utmp.h | utmpname | + + +## musl Interfaces Requiring Special Permissions + +Include the **errno.h** header file and check the errno error status code. If the error status code is EPERM, the interface error may be caused by the system capabilities security mechanism or other kernel security controls. + +### Common Capabilities-Affected Interfaces + +| Header File | musl Interface | Capabilities Permission | +| -------------- | ----------------- | -------------------- | +| None | pivot_root | CAP_SYS_ADMIN | +| None | init_module | CAP_SYS_MODULE | +| None | delete_module | CAP_SYS_MODULE | +| fcntl.h | open_by_handle_at | CAP_DAC_READ_SEARCH | +| sys/klog.h | klogctl | CAP_SYS_ADMIN | +| sys/mount.h | mount | CAP_SYS_ADMIN | +| sys/mount.h | umount | CAP_SYS_ADMIN | +| sys/mount.h | umount2 | CAP_SYS_ADMIN | +| sys/reboot.h | reboot | CAP_SYS_BOOT | +| sys/swap.h | swapon | CAP_SYS_ADMIN | +| sys/swap.h | swapoff | CAP_SYS_ADMIN | +| sys/time.h | settimeofday | CAP_SYS_TIME | +| unistd.h | setdomainname | CAP_SYS_ADMIN | +| unistd.h | sethostname | CAP_SYS_ADMIN | +| unistd.h | chroot | CAP_SYS_CHROOT | diff --git a/en/application-dev/reference/native-lib/libuv.md b/en/application-dev/reference/native-lib/libuv.md index 65c74b1d1725daaba0aeca6c63cd051e24bed6d9..f69d948b6132be9bfd7e2cffd70b6216bcd2434a 100644 --- a/en/application-dev/reference/native-lib/libuv.md +++ b/en/application-dev/reference/native-lib/libuv.md @@ -34,17 +34,17 @@ OpenHarmony introduced Node-API of Node.js in its earlier versions to facilitate To address the scheduling issues caused when the application main thread has an event loop that contains **uvloop**, we plan to normalize the event loops in the application model to allow only one task queue in the application main loop with task priorities controlled. -Avoid using the libuv NDK to perform operations on the application main loop obtained by **napi_get_uv_event_loop** (deprecated in API version 12). This may cause various problems and increase the workload required to address compatibility issues. +You are advised not to use libuv NDK on the main loop of the application obtained by calling napi_get_uv_event_loop. Otherwise, various problems may occur, and a large amount of workload will be brought to future compatibility changes. If you want to implement interaction with the main thread cyclically, for example, insert a task, use [Node-API](../../napi/napi-data-types-interfaces.md). -We will continue to provide capabilities of interacting with the main thread and extend JS APIs through Node-API in the future for a long period of time, but shield the event loops in the implementation layer. Although **napi_get_uv_event_loop** is deprecated in API version 12, the main functional APIs of Node-API will be maintained for a long time and provide the same behaviors as native Node-API, so that the developers who are familiar with the node.js extension mechanism can easily use their code with OpenHarmony. +We will continue to provide capabilities of interacting with the main thread and extend JS APIs through Node-API in the future for a long period of time, but shield the event loops in the implementation layer. the main functional APIs of Node-API will be maintained for a long time and provide the same native behavior of Node-API, so that the developers who are familiar with the node.js extension mechanism can easily expand their code to OpenHarmony. If you are familiar with libuv and can handle memory management and multithreading problems, you can still use libuv to develop your services on OpenHarmony. Unless otherwise required, you do not need to import the libuv library to your application project. ### Current Problems and Solutions -According to the existing mechanism, only one event loop can exist in a thread. To ensure proper running of the main event loop of the system application, the main event loop listens for the FD events in the JS environment and executes `uv_run` only when an FD event is reported. As a result, certain functions that depend on **uvloop** cannot take effect. +According to the existing mechanism, only one event loop can exist in a thread. To ensure proper running of the main event loop of the system application, the main event loop listens for the FD events in the JS environment and executes uv_run only when an FD event is reported. As a result, certain functions that depend on the **uvloop** event cannot take effect. Common scenarios and solutions are as follows: @@ -54,31 +54,52 @@ Common scenarios and solutions are as follows: Call **napi_get_uv_event_loop()** to obtain the system loop, and use libuv NDK APIs to implement related functions. +ArkTS side: +```typescript +import { hilog } from '@kit.PerformanceAnalysisKit'; +import testNapi from 'libentry.so' + +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Button("test") + .width('40%') + .fontSize('14fp') + .onClick(() => { + testNapi.test(); + }).margin(20) + }.width('100%') + }.height('100%') + } +} +``` +Native side: ```cpp #include "napi/native_api.h" #include "uv.h" #define LOG_DOMAIN 0X0202 #define LOG_TAG "MyTag" #include -#include -#include -#include -static void execute(uv_work_t *work) { +static void execute(uv_work_t* work) +{ OH_LOG_INFO(LOG_APP, "ohos in execute"); } -static void complete(uv_work_t *work, int status) { +static void complete(uv_work_t* work, int status) +{ OH_LOG_INFO(LOG_APP, "ohos in complete"); delete work; } -static napi_value Add(napi_env env, napi_callback_info info) +static napi_value Test(napi_env env, napi_callback_info info) { - napi_value work_name; - uv_loop_s *loop = nullptr; + uv_loop_s* loop = nullptr; /* Obtain the uv_loop of the application JS main thread. */ napi_get_uv_event_loop(env, &loop); - uv_work_t *work = new uv_work_t; + uv_work_t* work = new uv_work_t; int ret = uv_queue_work(loop, work, execute, complete); if (ret != 0) { OH_LOG_INFO(LOG_APP, "delete work"); @@ -88,8 +109,9 @@ static napi_value Add(napi_env env, napi_callback_info info) } EXTERN_C_START -static napi_value Init(napi_env env, napi_value exports){ - napi_property_descriptor desc[] = {{"add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr}}; +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = {{"test", nullptr, Test, nullptr, nullptr, nullptr, napi_default, nullptr}}; napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); return exports; } @@ -105,49 +127,77 @@ static napi_module demoModule = { .reserved = {0}, }; -extern "C" __attribute__((constructor)) void RegisterEntryModule(void){ +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ napi_module_register(&demoModule); } ``` +Add the following code to the **index.d.ts** file: +``` +export const test:() => number; +``` + **Example (correct)**: Use **napi_create_async_work** and **napi_queue_async_work** together. +ArkTS side: +```typescript +import { hilog } from '@kit.PerformanceAnalysisKit'; +import testNapi from 'libentry.so' + +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Button("test") + .width('40%') + .fontSize('14fp') + .onClick(() => { + testNapi.test(); + }).margin(20) + }.width('100%') + }.height('100%') + } +} +``` +Native side: ```cpp #include "napi/native_api.h" #include "uv.h" #define LOG_DOMAIN 0X0202 #define LOG_TAG "MyTag" #include -#include -#include -#include -uv_loop_t *loop; +uv_loop_t* loop = nullptr; napi_value jsCb; int fd = -1; -static napi_value Add(napi_env env, napi_callback_info info) +static napi_value Test(napi_env env, napi_callback_info info) { napi_value work_name; napi_async_work work; napi_create_string_utf8(env, "ohos", NAPI_AUTO_LENGTH, &work_name); /* The fourth parameter specifies the work task of the asynchronous thread, and the fifth parameter is the callback of the main thread. */ - napi_create_async_work(env, nullptr, work_name, [](napi_env env, void* data){ - OH_LOG_INFO(LOG_APP, "ohos in execute"); - }, [](napi_env env, napi_status status, void *data){ - /* The specific implementation is skipped. */ - OH_LOG_INFO(LOG_APP, "ohos in complete"); - napi_delete_async_work(env, (napi_async_work)data); - }, nullptr, &work); + napi_create_async_work( + env, nullptr, work_name, [](napi_env env, void* data){OH_LOG_INFO(LOG_APP, "ohos in execute"); }, + [](napi_env env, napi_status status, void* data){ + /* The specific implementation is skipped. */ + OH_LOG_INFO(LOG_APP, "ohos in complete"); + napi_delete_async_work(env, (napi_async_work)data); + }, + nullptr, &work); /* Call napi_queue_async_work to trigger an async task. */ napi_queue_async_work(env, work); return 0; } EXTERN_C_START -static napi_value Init(napi_env env, napi_value exports){ - napi_property_descriptor desc[] = {{"add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr}}; +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = {{"test", nullptr, Test, nullptr, nullptr, nullptr, napi_default, nullptr}}; napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); return exports; } @@ -163,10 +213,15 @@ static napi_module demoModule = { .reserved = {0}, }; -extern "C" __attribute__((constructor)) void RegisterEntryModule(void){ +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ napi_module_register(&demoModule); } ``` +Add the following code to the **index.d.ts** file: +```index.d.ts +export const test:() => number; +``` #### Scenario 2: The libuv API does not work when throwing an FD event to the main loop of the application from the native side. @@ -176,6 +231,29 @@ The main loop of the application receives only FD events, and executes **uv_run* In the following example, calling **uv_poll_start** in the same way as in native libuv on HarmonyOS does not take effect. +ArkTS side: +```typescript +import { hilog } from '@kit.PerformanceAnalysisKit'; +import testNapi from 'libentry.so' + +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Button("testClose") + .width('40%') + .fontSize('14fp') + .onClick(() => { + testNapi.testClose(); + }).margin(20) + }.width('100%') + }.height('100%') + } +} +``` +Native side: ```cpp #include "napi/native_api.h" #include "uv.h" @@ -184,16 +262,20 @@ In the following example, calling **uv_poll_start** in the same way as in native #include #include #include -#include -uv_loop_t *loop; + +uv_loop_t* loop = nullptr; napi_value jsCb; int fd = -1; -void poll_handler(uv_poll_t* handle,int status, int events){ + +void poll_handler(uv_poll_t* handle,int status, int events) +{ OH_LOG_INFO(LOG_APP, "ohos poll print"); } -static napi_value TestClose(napi_env env, napi_callback_info info){ + +static napi_value TestClose(napi_env env, napi_callback_info info) +{ std::thread::id this_id = std::this_thread::get_id(); - OH_LOG_INFO(LOG_APP, "ohos thread id : %{public}ld\n", this_id); + OH_LOG_INFO(LOG_APP, "ohos thread id : %{public}ld", this_id); size_t argc = 1; napi_value workBname; @@ -204,7 +286,7 @@ static napi_value TestClose(napi_env env, napi_callback_info info){ napi_get_uv_event_loop(env, &loop); // Create an eventfd. fd = eventfd(0, 0); - OH_LOG_INFO(LOG_APP, "fd is %{public}d\n",fd); + OH_LOG_INFO(LOG_APP, "fd is %{public}d",fd); uv_poll_t* poll_handle = new uv_poll_t; // Initialize a poll handle and associate it with eventfd. uv_poll_init(loop, poll_handle, fd); @@ -216,7 +298,7 @@ static napi_value TestClose(napi_env env, napi_callback_info info){ int value = 10; int ret = eventfd_write(fd, value); if (ret == -1){ - OH_LOG_INFO(LOG_APP, "write failed!\n"); + OH_LOG_INFO(LOG_APP, "write failed!"); continue; } } @@ -224,8 +306,10 @@ static napi_value TestClose(napi_env env, napi_callback_info info){ mythread.detach(); return 0; } + EXTERN_C_START -static napi_value Init(napi_env env, napi_value exports){ +static napi_value Init(napi_env env, napi_value exports) +{ napi_property_descriptor desc[] = {{"testClose", nullptr, TestClose, nullptr, nullptr, nullptr, napi_default, nullptr}}; napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); return exports; @@ -242,11 +326,18 @@ static napi_module demoModule = { .reserved = {0}, }; -extern "C" __attribute__((constructor)) void RegisterEntryModule(void){ +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ napi_module_register(&demoModule); } ``` +Add the following code to **index.d.ts**: + +``` +export const testClose:() => number; +``` + The process is as follows: 1. Call **napi_get_uv_event_loop** to obtain **uvloop** of the application main thread. @@ -262,6 +353,29 @@ In the current system version, do not use **napi_get_uv_event_loop** to obtain * Modify the code as follows: +ArkTS side: +```typescript +import { hilog } from '@kit.PerformanceAnalysisKit'; +import testNapi from 'libentry.so' + +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Button("testClose") + .width('40%') + .fontSize('14fp') + .onClick(() => { + testNapi.testClose(); + }).margin(20) + }.width('100%') + }.height('100%') + } +} +``` +Native side: ```cpp #include "napi/native_api.h" #include "uv.h" @@ -270,16 +384,20 @@ Modify the code as follows: #include #include #include -#include -uv_loop_t *loop; + +uv_loop_t* loop = nullptr; napi_value jsCb; int fd = -1; -void poll_handler(uv_poll_t* handle,int status, int events){ + +void poll_handler(uv_poll_t* handle,int status, int events) +{ OH_LOG_INFO(LOG_APP, "ohos poll print"); } -static napi_value TestClose(napi_env env, napi_callback_info info){ + +static napi_value TestClose(napi_env env, napi_callback_info info) +{ std::thread::id this_id = std::this_thread::get_id(); - OH_LOG_INFO(LOG_APP, "ohos thread id : %{public}ld\n", this_id); + OH_LOG_INFO(LOG_APP, "ohos thread id : %{public}ld", this_id); size_t argc = 1; napi_value workBName; @@ -290,7 +408,7 @@ static napi_value TestClose(napi_env env, napi_callback_info info){ napi_get_uv_event_loop(env, &loop); fd = eventfd(0, 0); - OH_LOG_INFO(LOG_APP, "fd is %{public}d\n",fd); + OH_LOG_INFO(LOG_APP, "fd is %{public}d",fd); uv_poll_t* poll_handle = new uv_poll_t; uv_poll_init(loop, poll_handle, fd); uv_poll_start(poll_handle, UV_READABLE, poll_handler); @@ -303,7 +421,7 @@ static napi_value TestClose(napi_env env, napi_callback_info info){ int value = 10; int ret = eventfd_write(fd, value); if (ret == -1){ - OH_LOG_INFO(LOG_APP, "write failed!\n"); + OH_LOG_INFO(LOG_APP, "write failed!"); continue; } } @@ -313,7 +431,8 @@ static napi_value TestClose(napi_env env, napi_callback_info info){ } EXTERN_C_START -static napi_value Init(napi_env env, napi_value exports){ +static napi_value Init(napi_env env, napi_value exports) +{ napi_property_descriptor desc[] = {{"testClose", nullptr, TestClose, nullptr, nullptr, nullptr, napi_default, nullptr}}; napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); return exports; @@ -330,16 +449,22 @@ static napi_module demoModule = { .reserved = {0}, }; -extern "C" __attribute__((constructor)) void RegisterEntryModule(void){ +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ napi_module_register(&demoModule); } ``` +Add the following code to **index.d.ts**: + +``` +export const testClose:() => number; +``` ## Using libuv -In the libuv NDK, all the APIs that depend on **uv_run** do not work as expected in the application main loop of the current system, and may cause freezing or loss of frames. You are advised not to use libuv NDK APIs in the JS main thread. You can use Node-API to implement asynchronous task execution and communication with the main thread via thread-safe functions. +In the libuv NDK, all the APIs that depend on **uv_run** do not work as expected in the application main loop of the current system, and may cause freezing or loss of frames. You are advised not to directly use libuv NDK APIs in the JS main thread. You can use Node-API to implement asynchronous task execution and communication with the main thread via thread-safe functions. -### Mappings Between libuv APIs and Node-API APIs +### Mappings Between libuv APIs and Node-APIs Instead of using libuv APIs, you can use the equivalent Node-API provided by OpenHarmony, which includes asynchronous work APIs and thread-safe APIs. @@ -352,36 +477,45 @@ You can use [napi_async_work](../../napi/use-napi-asynchronous-task.md) APIs of The related Node-API interfaces are as follows: ```cpp -// Creates a work object that executes logic asynchronously. -// env: pointer to the current execution environment. -// async_resource: (optional) resource object used to trace asynchronous operations. -// async_resource_name: (optional) name of the resource object. The value is a string. -// execute: callback invoked to perform an asynchronous operation in another thread. -// complete: callback to be invoked when the asynchronous operation is complete. -// data: pointer to the customized data to be passed to the execute() and complete() callbacks. -// result: pointer to the asynchronous work object created. +/** +* @brief Creates a work object that executes logic asynchronously. +* +* @param env Pointer to the current execution environment. +* @param async_resource (Optional) Resource object used to trace asynchronous operations. +* @param async_resource_name (Optional) Name of the resource object. The value is a string. +* @param execute Callback invoked to perform an asynchronous operation in another thread. +* @param execute Callback to be invoked when the asynchronous operation is complete. +* @param data Pointer to the customized data to be passed to the execute() and complete() callbacks. +* @param result Pointer to the asynchronous work object created. +*/ napi_status napi_create_async_work(napi_env env, napi_value async_resource, napi_value async_resource_name, - napi_async_execute_callback execute, - napi_async_complete_callback complete, + napi_async_execute_callback execute, + napi_async_complete_callback complete, void* data, napi_async_work* result); -// Adds an asynchronous work object to the queue so that it can be scheduled for execution. -// env: pointer to the current execution environment. -// work: pointer to the asynchronous work object to add. +/** +* @brief Adds an asynchronous work object to the queue so that it can be scheduled for execution. +* +* @param env Pointer to the current execution environment. +* @param work Pointer to the asynchronous work object to add. +*/ napi_status napi_queue_async_work(napi_env env, napi_async_work work); -// Deletes an asynchronous work object. -// env: pointer to the current execution environment. -// work: pointer to the asynchronous work object to delete. +/** +* @brief Deletes an asynchronous work object. +* +* @param env Pointer to the current execution environment. +* @param work Pointer to the asynchronous work object to delete. +*/ napi_status napi_delete_async_work(napi_env env, napi_async_work work); ``` #### Thread-safe APIs for Cross-Thread Sharing and Invocation -When you want to pass a callback to the application main thread, you can use the libuv **uv_async_t** handle for inter-thread communication, and the following functions: +When you want to pass a callback from any child thread to the application main thread for execution, you can use the libuv **uv_async_t** handle for inter-thread communication, and the following functions: - uv_async_init() - uv_async_send() @@ -391,53 +525,72 @@ The equivalent Node-API interfaces are [napi_threadsafe_function](../../napi/use The related Node-API interfaces are as follows: ```cpp -// Creates a thread-safe function, which can be called in multiple threads without causing data contention or other thread-safe issues. -// env: pointer to the Node-API environment. It is used to create and operate JS values. -// func: pointer to the JavaScript function to create. -// resource_name: pointer to the resource name, which is used for logging and debugging. -// max_queue_size: an integer specifying the maximum size of a queue. When the queue is full, new calls will be discarded. -// initial_thread_count: an integer specifying the number of initial threads. These threads will be started when the function is created. -// context: pointer to the context, which is passed to call_js_func(). -// call_js_func: pointer to the callback to be invoked when the JS function is called. -// finalize: Pointer to the finalize() function to be called when the thread-safe function is destroyed. -// result: pointer to the napi_threadsafe_function struct, which will be constructed as the newly created thread-safe function. +/** +* @brief Creates a thread-safe function, which can be called in multiple threads without causing data contention or other thread-safe issues. +* +* @param env Pointer to the Node-API environment. It is used to create and operate JS values. +* @param func Pointer to the JavaScript function to create. +* @param async_resource Asynchronous resource, which is usually an object that indicates an asynchronous operation. +* @param async_resource_name Pointer to the resource name, which is used for logging and debugging. +* @param max_queue_size An integer specifying the maximum size of a queue. When the queue is full, new calls will be discarded. +* @param initial_thread_count An unsigned integer indicating the initial number of threads when a thread-safe function is created. +* @param thread_finalize_data Data to be cleared before all threads are created. +* @param napi_finalize Callback function thread_finalize_cb, which is called when all threads are complete and is used to clear resources +* @param context Pointer to the context, which is passed to call_js_func(). +* @param call_js_cb Pointer to the callback to be invoked when the JS function is called. +* @param result Pointer to the napi_threadsafe_function struct, which will be constructed as the thread-safe function created. +*/ napi_status napi_create_threadsafe_function(napi_env env, - napi_value func, - const char* resource_name, - size_t max_queue_size, - size_t initial_thread_count, - void* context, - napi_threadsafe_function_call_js call_js_func, - napi_threadsafe_function_finalize finalize, - napi_threadsafe_function* result); - -// Acquires a thread-safe function. -// function: pointer to the thread-safe function to acquire. -napi_status napi_acquire_threadsafe_function(napi_threadsafe_function function); + napi_value func, + napi_value async_resource, + napi_value async_resource_name, + size_t max_queue_size, + size_t initial_thread_count, + void* thread_finalize_data, + napi_finalize thread_finalize_cb, + void* context, + napi_threadsafe_function_call_js call_js_cb, + napi_threadsafe_function* result); -// Calls a thread-safe function. -// function: pointer to the thread-safe function to call. -// data: pointer to the user data. -napi_status napi_call_threadsafe_function(napi_threadsafe_function function, void* data); +/** +* @brief Acquires a thread-safe function. +* +* @param function Pointer to the thread-safe function to release. +*/ +napi_status napi_acquire_threadsafe_function(napi_threadsafe_function function); -// Releases a thread-safe function. -// function: pointer to the thread-safe function to release. -napi_status napi_release_threadsafe_function(napi_threadsafe_function function); +/** +* @brief Calls a thread-safe function. +* @param function Pointer to the thread-safe function to release. +* @param data Pointer to the user data. +* @param is_blocking Enumerated value that determines whether the JavaScript function call is blocking or non-blocking. +*/ +napi_status napi_call_threadsafe_function(napi_threadsafe_function function, + void* data, + napi_threadsafe_function_call_mode is_blocking); +/** +* @brief Releases a thread-safe function. +* +* @param function Pointer to the thread-safe function to release. +* @param is_blocking Enumerated value that determines whether the JavaScript function call is blocking or non-blocking. +*/ +napi_status napi_release_threadsafe_function(napi_threadsafe_function function, + napi_threadsafe_function_call_mode is_blocking); ``` -If you need to use other libuv APIs to implement service functions, read on to discover basic libuv concepts and common APIs to be used in OpenHarmony, which are helpful to prevent application crashes when using libuv APIs. The following also provides information about the APIs that can be used in the application main thread and those cannot. +If you need to use other libuv APIs to implement service functions, read on to discover basic libuv concepts and common APIs to be used in OpenHarmony, which are helpful to prevent application crashes when using libuv APIs. The following also provides information about the APIs that can be used in the application main thread and those cannot. ### Available APIs | API Type | API | | ---- | ---- | -| [Loop](#event-loops-in-libuv) | uv_loop_init | -| [Loop](#event-loops-in-libuv) | uv_loop_close | -| [Loop](#event-loops-in-libuv) | uv_default_loop | -| [Loop](#event-loops-in-libuv) | uv_run | -| [Loop](#event-loops-in-libuv) | uv_loop_alive | -| [Loop](#event-loops-in-libuv) | uv_stop | +| [Loop](#event-loops-in-libuv) | uv_loop_init | +| [Loop](#event-loops-in-libuv) | uv_loop_close | +| [Loop](#event-loops-in-libuv) | uv_default_loop | +| [Loop](#event-loops-in-libuv) | uv_run | +| [Loop](#event-loops-in-libuv) | uv_loop_alive | +| [Loop](#event-loops-in-libuv) | uv_stop | | [Handle](#handles-and-requests-in-libuv) | uv_poll\_\* | | [Handle](#handles-and-requests-in-libuv) | uv_timer\_\* | | [Handle](#handles-and-requests-in-libuv) | uv_async\_\* | @@ -465,9 +618,42 @@ The constraints vary depending on the source of the loop. Specifically, you can ##### Creating a Loop -You can call **uv_loop_new** to create a loop or call **uv_loop_init** to initialize a loop. (You need to manage the lifecycle of the loop.) In this case, ensure that **uv_run** is executed on the loop thread, that is, the thread where the loop is created or initialized. In addition, non-thread-safe operations, such as operations related to the timer and handle, must be performed on the loop thread. +You can call **uv_loop_new** to create a loop or call **uv_loop_init** to initialize a loop. You need to manage the lifecycle of the loop. In this case, ensure that **uv_run** is executed on the loop thread, that is, the thread where the loop is created or initialized. In addition, non-thread-safe operations, such as operations related to the timer, must be performed on the loop thread. + +If tasks have to be thrown from other threads to the loop thread, use **uv_async_send**. Specifically, register a callback when the async handle is initialized, and implement the corresponding operation in the callback. When **uv_async_send** is called, execute the registered callback on the main thread. + +ArkTS: + +```typescript +import { hilog } from '@kit.PerformanceAnalysisKit'; +import testNapi from 'libentry.so' + +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Button("TestTimerAsync") + .width('40%') + .fontSize('14fp') + .onClick(() => { + testNapi.testTimerAsync(); // Initialize the async handle. + }).margin(20) + + Button("TestTimerAsyncSend") + .width('40%') + .fontSize('14fp') + .onClick(() => { + testNapi.testTimerAsyncSend(); // Call uv_async_send from a child thread to submit the timer task. + }).margin(20) + }.width('100%') + }.height('100%') + } +} +``` -If tasks have to be thrown from other threads to the loop thread, use **uv_async_send**. Specifically, register a callback when the **async** handle is initialized. When **uv_async_send** is called, execute the registered callback on the main thread.
Example: +Native side: ```cpp #include @@ -476,65 +662,112 @@ If tasks have to be thrown from other threads to the loop thread, use **uv_async #define LOG_TAG "MyTag" #include "hilog/log.h" #include -#include + uv_async_t* async = new uv_async_t; +bool cond1 = false; +bool cond2 = false; + +// Tips: When using a loop, pay special attention to the uv_stop function. Before calling uv_stop, +// instruct all threads associated with the loop to close their handles. For details, see the implementation of the stop_loop function. +int stop_loop(uv_loop_t* loop) +{ + uv_stop(loop); + auto const ensure_close = [](uv_handle_t* handle, void*) { + if (uv_is_closing(handle)) { + return; + } else { + uv_close(handle, nullptr); + } + }; + // Iterate through all handles. If a handle is active, call ensure_close on it. + uv_walk(loop, ensure_close, nullptr); + // Continue to run uv_run until there is no active handle or request in the loop. + while(true) { + if (uv_run(loop, UV_RUN_DEFAULT) == 0) { + break; + } + } + + // Check the loop status. + if (uv_loop_alive(loop) != 0) { + return -1; + } + return 0; +} // Create a timer. -void timer_cb(uv_async_t* handle) { +void async_cb(uv_async_t* handle) { auto loop = handle->loop; uv_timer_t* timer = new uv_timer_t; uv_timer_init(loop, timer); - - uv_timer_start(timer, [](uv_timer_t* timer){ - uv_timer_stop(timer); - }, 1000, 0); + // Close the async handle at appropriate time. - if (cond) { + if (cond2) { uv_close((uv_handle_t*)handle, [](uv_handle_t* handle){ delete (uv_async_t*)handle; - }) + }); + return; } + + uv_timer_start(timer, + [](uv_timer_t* timer){ + // Do something. + // Stop the timer at the right time. + if (cond1) { + uv_timer_stop(timer); + uv_close((uv_handle_t*)timer, [](uv_handle_t* handle){ + delete(uv_timer_t*)handle; + }); + } + }, + 100, 100); } // Initialize the async handle and bind the corresponding callback. static napi_value TestTimerAsync(napi_env env, napi_callback_info info) { - std::thread t ([] () { // Thread A, loop thread - uv_loop_t* loop = new uv_lppo_t; + std::thread t([](){ // Thread A, loop thread + uv_loop_t* loop = new uv_loop_t; // Create a loop and manage the loop lifecycle. uv_loop_init(loop); // Initialize an async handle and register a callback. - uv_async_init(loop, async, timer_cb); + uv_async_init(loop, async, async_cb); // Start the loop. uv_run(loop, UV_RUN_DEFAULT); // Close all handles. - uv_walk( - loop, - [](uv_handle_t* handle, void* args) { - if (!uv_is_closing(handle)) { - uv_close(hendle, [](uv_handle_t* handle){delete handle;}); - } - }, - nullptr; - ); - while (uv_run(loop, UV_RUN_DEFAULT) != 0); + stop_loop(loop); // Release the loop. - uv_loop_delete(loop); - }) + uv_loop_close(loop); + delete loop; + }); t.detach(); return 0; } // Call uv_async_send on another thread. -static napi_value TestTimerAsyncSend(napi_env env, napi_callback_info info) { - std::thread t ([] () { // Thread B +static napi_value TestTimerAsyncSend(napi_env env, napi_callback_info info) +{ + std::thread t1([](){ // Thread B. uv_async_send (async); // Call uv_async_send to instruct the loop thread to call timer_cb bound to the async handle. + uv_sleep(500); + // Modify cond1 and disable the timer handle. + cond1 = true; }); - t.detach(); + + std::thread t2([](){ // Thread B. + uv_sleep(1000); + // Modify cond2 and disable the async handle. + cond2 = true; + uv_async_send(async); + }); + + t1.detach(); + t2.detach(); return 0; } EXTERN_C_START -static napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) +{ napi_property_descriptor desc[] = { {"testTimerAsync", nullptr, TestTimerAsync, nullptr, nullptr, nullptr, napi_default, nullptr}, {"testTimerAsyncSend", nullptr, TestTimerAsyncSend, nullptr, nullptr, nullptr, napi_default, nullptr}, @@ -554,18 +787,24 @@ static napi_module demoModule = { .reserved = {0}, }; -extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ napi_module_register(&demoModule); } ``` -In this example, a global task queue is used and tasks are submitted to the task queue from a non-loop thread. Then, **uv_async_send** is called at appropriate time to return to the loop thread to execute **async_cb**, which traverses and executes all tasks in the task queue. Note that the task queue operations must be thread-safe. A lock-free queue can be used in C++ implementation, and locks must be added in C implementation. +Add the following code to **index.d.ts**: + +``` +export const testTimerAsync:() => number; +export const testTimerAsyncSend:() => number; +``` ##### Obtaining a Loop from env -Generally, the loop obtained from **env** using **napi_get_uv_event_loop** is an event loop of a JS thread created by the system. Therefore, avoid calling non-thread-safe functions on its child threads. +Generally, the loop obtained from **env** by using **napi_get_uv_event_loop** is an event loop of a JS main thread created by the system. Therefore, avoid calling non-thread-safe functions on its child threads. -If a non-thread-safe function has to be called on a non-loop thread due to service requirements, use the thread-safe function **uv_async_send**. Specifically, define a handle of the **uv_async_t*** type. When initializing the handle, add the non-thread-safe function that needs to be called on a child thread in **async_cb**. Then, call **uv_async_send** in a non-loop thread, and execute **async_cb** on the loop thread. For details, see case 2 in [Correct Example](#correct-example). +If a non-thread-safe function has to be called on a non-loop thread due to service requirements, use the thread-safe function **uv_async_send** to submit the task to the loop thread. Specifically, define a handle of the **uv_async_t*** type. When initializing the handle, add the non-thread-safe function that needs to be called on a child thread in **async_cb**. Then, call **uv_async_send** in a non-loop thread, and execute **async_cb** on the loop thread. For details, see case 2 in [Correct Example](#correct-example). ### Thread-safe Functions @@ -608,9 +847,7 @@ As a core concept in libuv, an event loop manages all resources of the entire ev int uv_loop_init(uv_loop_t* loop); ``` - Initializes a loop. - - +Initializes a loop. ```cpp int uv_loop_close(uv_loop_t* loop); @@ -618,8 +855,6 @@ int uv_loop_close(uv_loop_t* loop); Closes a loop. The operation is successful only after all handles and requests in the loop are closed. Otherwise, **UV_EBUSY** is returned. - - ```cpp int uv_loop_delete(uv_loop_t* loop); ``` @@ -629,16 +864,11 @@ Releases a loop. This API calls **uv_loop_close** to release all internal resour > **NOTE** > > Exercise caution when using this API. You are advised not to use this API unless necessary. - - - ```cpp uv_loop_t* uv_default_loop(void); ``` -Creates a process-level loop. In OpenHarmony, libuv loops still exist in the application main loop and other JS worker threads. You are not advised to use this API to create loops and implement service functions. When the loop mechanism normalization is complete, you can use this API to create loops. - - +Creates a process-level loop. In OpenHarmony, libuv loops still exist in the application main loop and other JS worker threads. You are not advised to use this API to create loops and implement service functions. ```cpp int uv_run(uv_loop_t* loop, uv_run_mode mode); @@ -646,56 +876,18 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode); Runs an event loop. For details about the running mode, see [Event Loop Running Modes](#event-loop-running-modes). - - ```cpp int uv_loop_alive(uv_loop_t loop); ``` Checks whether a loop is active. - - ```cpp void uv_stop(uv_loop_t* loop); ``` Stops an event loop. The event loop stops only in the next iteration of the loop. If this API is called before an I/O operation, **uv__io_poll** will be skipped instead of being blocked. -> **Tips** -> -> Pay special attention to the use of **uv_stop**. Before **uv_stop** is called, ensure that the handles of all threads related to the loop are closed. - -Example: - -```cpp -int stop_loop(uv_loop_t* loop) -{ - uv_stop(loop); - auto const ensure_close = [](uv_handle_t* handle, void*) { - if (uv_is_closing(handle)) { - return; - } else { - uv_close(handle, nullptr); - } - }; - // Traverse all handles. Call ensure_close to close the active handle. - uv_walk(loop, ensure_close, nullptr); - - // Continue to run uv_run until there is no active handle or request in the loop. - while(true) { - if (uv_run(loop, UV_RUN_DEFAULT) == 0) { - break; - } - } - - // Check the loop status. - if (uv_loop_alive(loop) != 0) { - return -1; - } - return 0; -} -``` ### Handles and Requests in libuv @@ -741,7 +933,7 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) After **uv_close** is called, the handle to be closed is added to the **closing_handles** queue in the loop, and waits for the loop thread to run **uv__run_closing_handles**. Finally, the **close_cb** callback is executed in the next iteration of the loop. Therefore, operations such as memory release should be performed in **close_cb**. Improper use of the **close** API that is executed asynchronously may cause multithreading issues. You need to ensure correct timing of **uv_close** and ensure that all the handles are closed before **close_cb** is executed. -> **Tips**
The following rule of thumb in the official libuv documentation (http://libuv.org/) needs to be observed.
If a handle of type **uv_foo_t** has a **uv_foo_start()** function, then it's active from the moment that function is called. Likewise, **uv_foo_stop()** deactivates the handle again. +> **Tips**
The following rule of thumb in the official libuv documentation (http://libuv.org/) needs to be observed.
If a handle of type **uv_foo_t** has a **uv_foo_start()** function, then it is active from the moment that function is called. Likewise, **uv_foo_stop()** deactivates the handle again. > **NOTE** > @@ -749,8 +941,6 @@ After **uv_close** is called, the handle to be closed is added to the **closing_ > > - All handle operations cannot be called on non-loop threads by obtaining the loop of other threads. -#### Submitting Asynchronous Tasks - When asynchronous tasks are submitted, the libuv requests that are dynamically acquired must be released in the **complete()** callback executed on the loop thread. The following uses **uv_work_t** as an example. ```cpp @@ -763,43 +953,6 @@ uv_queue_work(loop, work, [](uv_work_t* req) { }); ``` -In special cases, for example, in memory-sensitive cases, the same request can be used repeatedly when: - -- The sequence of the same type of tasks is ensured. -- The request can be successfully released when **uv_queue_work** is called the last time. - -```C -uv_work_t* work = new uv_work_t; -uv_queue_work(loop, work, [](uv_work_t* work) { - // Do something. - }, - [](uv_work_t* work, int status) { - // Do something. - uv_queue_work(loop, work, [](...) {/* do something*/}, [](...) { - // Do something. - if (last_task) { // Release the request after the last task is executed. - delete work; - } - }); - }, - ) -``` - -#### Precautions for Submitting Asynchronous Tasks -##### uv_queue_work process -In libuv, **uv_queue_work()** in a UI thread works as follows: - -1. Throw **work_cb** to the thread pool of the related priority of Function Flow Runtime (FFRT) and wait for FFRT to schedule and execute the task. -2. Throw **after_work_cb** to the event queue of **eventhandler**, wait for **eventhandler** to schedule, and return to the loop thread for execution. - -> **NOTE**
After **uv_queue_work()** is called, it does not mean any task is complete. It only means **work_cb()** is inserted into the thread pool of the related priority of FFRT. The workflow of the taskpool and jsworker threads is the same as that of libuv. - -##### Constraints on Using uv_queue_work() - -**uv_queue_work()** is only used to throw asynchronous tasks. The **execute()** callback of an asynchronous task added to the thread pool will be scheduled and executed. Therefore, the task execution sequence may be different from the task submission sequence. - -**uv_queue_work()** can be called only on the loop thread. This prevents multi-threading issues. Do not use **uv_queue_work()** as a means for inter-thread communication. Specifically, do not use **uv_queue_work** to throw an asynchronous task from thread A to thread B, setting the **execute()** callback to an empty task and executing the **complete()** callback on thread B. This approach is not only inefficient but increases the difficulty in locating faults. To avoid inefficient task submission, use [napi_threadsafe_function](#thread-safe-apis-for-cross-thread-sharing-and-invocation). - #### Using libuv Timers Observe the following when using the libuv timers: @@ -856,7 +1009,8 @@ Native C++: #include #include -static napi_value TestTimer(napi_env env, napi_callback_info info) { +static napi_value TestTimer(napi_env env, napi_callback_info info) +{ uv_loop_t* loop = nullptr; uv_timer_t* timer = new uv_timer_t; @@ -873,7 +1027,8 @@ static napi_value TestTimer(napi_env env, napi_callback_info info) { } EXTERN_C_START -static napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) +{ napi_property_descriptor desc[] = { {"testTimer", nullptr, TestTimer, nullptr, nullptr, nullptr, napi_default, nullptr}, }; @@ -892,7 +1047,8 @@ static napi_module demoModule = { .reserved = {0}, }; -extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ napi_module_register(&demoModule); } ``` @@ -905,10 +1061,11 @@ export const testTimer:() => number; ##### Correct Example -**Case 1**: Ensure that timer-related operations are performed on the native main thread. Modify the **TestTimer()** function used in the previous example as follows: +**Case 1**: Ensure that timer-related operations are performed on the JS main thread. Modify the **TestTimer()** function used in the previous example as follows: ```cpp -static napi_value TestTimer(napi_env env, napi_callback_info info) { +static napi_value TestTimer(napi_env env, napi_callback_info info) +{ uv_loop_t* loop = nullptr; uv_timer_t* timer = new uv_timer_t; @@ -925,17 +1082,10 @@ static napi_value TestTimer(napi_env env, napi_callback_info info) { **Case 2**: To throw a timer to a child thread, use the thread-safe function **uv_async_send**. ArkTS: - ```typescript import { hilog } from '@kit.PerformanceAnalysisKit'; import testNapi from 'libentry.so' -function waitforRunner(): number { - "use concurrent" - hilog.info(0xff, "testTag", "executed"); - return 0; -} - @Entry @Component struct Index { @@ -946,14 +1096,14 @@ struct Index { .width('40%') .fontSize('14fp') .onClick(() => { - testNapi.testTimerAsync (); // Initialize the async handle. + testNapi.testTimerAsync(); // Initialize the async handle. }).margin(20) Button("TestTimerAsyncSend") .width('40%') .fontSize('14fp') .onClick(() => { - testNapi.testTimerAsyncSend (); // The child thread calls uv_async_send to execute timer_cb. + testNapi.testTimerAsyncSend(); // Call uv_async_send from a child thread to submit the timer task. }).margin(20) }.width('100%') }.height('100%') @@ -961,7 +1111,7 @@ struct Index { } ``` -Native C++: +Native side: ```c++ #include @@ -974,7 +1124,8 @@ Native C++: uv_async_t* async = new uv_async_t; // Create a timer. -void timer_cb(uv_async_t* handle) { +void async_cb(uv_async_t* handle) +{ auto loop = handle->loop; uv_timer_t* timer = new uv_timer_t; uv_timer_init(loop, timer); @@ -985,23 +1136,26 @@ void timer_cb(uv_async_t* handle) { } // Initialize the async handle and bind the corresponding callback. -static napi_value TestTimerAsync(napi_env env, napi_callback_info info) { +static napi_value TestTimerAsync(napi_env env, napi_callback_info info) +{ uv_loop_t* loop = nullptr; napi_get_uv_event_loop(env, &loop); - uv_async_init(loop, async, timer_cb); + uv_async_init(loop, async, async_cb); return 0; } -static napi_value TestTimerAsyncSend(napi_env env, napi_callback_info info) { +static napi_value TestTimerAsyncSend(napi_env env, napi_callback_info info) +{ std::thread t([](){ - uv_async_send (async); // Call uv_async_send in any child thread to instruct the main thread to call timer_cb associated with async. + uv_async_send (async); // Call uv_async_send in a child thread to instruct the main thread to call timer_cb associated with async. }); t.detach(); return 0; } EXTERN_C_START -static napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) +{ napi_property_descriptor desc[] = { {"testTimerAsync", nullptr, TestTimerAsync, nullptr, nullptr, nullptr, napi_default, nullptr}, {"testTimerAsyncSend", nullptr, TestTimerAsyncSend, nullptr, nullptr, nullptr, napi_default, nullptr}, @@ -1021,14 +1175,22 @@ static napi_module demoModule = { .reserved = {0}, }; -extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ napi_module_register(&demoModule); } ``` +Add the following code to **index.d.ts**: + +``` +export const testTimerAsync:() => number; +export const testTimerAsyncSend:() => number; +``` + ### Inter-Thread Communication -So far, you have learnt about the basic concepts of libuv. Now let's dive into the inter-thread communication in libuv. +So far, you have acquainted yourself with the basic concepts of libuv. Now let's dive into the inter-thread communication in libuv. The inter-thread communication of libuv is implemented based on the **uv_async_t** handle. The related APIs are as follows: @@ -1036,64 +1198,47 @@ The inter-thread communication of libuv is implemented based on the **uv_async_t int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) ``` -**Description** - -Initializes a handle. - -**Parameters** - -- **loop**: pointer to the event loop. -- **handle**: pointer to the handle for inter-thread communication. - -- **async_cb**: callback to be invoked. - + Initializes a handle.
**loop**: pointer to the event loop. -**Return value** - -This API returns **0** if the operation is successful; returns an error code if the operation fails. + **handle**: pointer to the handle for inter-thread communication. + **async_cb**: callback to be invoked. + This API returns **0** if the operation is successful; returns an error code if the operation fails. ```cpp int uv_async_send(uv_async_t* handle) ``` -**Description** - -Wakes up the event loop and calls the async handle's callback. - -**Parameters** - -**handle**: pointer to the handle for inter-thread communication. - -**Return value** - -This API returns **0** if the operation is successful; returns an error code if the operation fails. + Wakes up the event loop and calls the async handle's callback.
**handle**: pointer to the handle for inter-thread communication. + This API returns **0** if the operation is successful; returns an error code if the operation fails. > **NOTE** > > - **uv_async_t** remains active after **uv_async_init** is called till it is closed by **uv_close**. > > - **uv_async_t** is executed in the sequence defined by **uv_async_init** instead of **uv_async_send**. Therefore, it is necessary to manage the timing according to the initialization sequence. -![](./figures/libuv-inter-thread-communication.png) +![Inter-thread communication principle](./figures/libuv-image-1.jpg) Example: ```cpp -#include +#include +#include #include "uv.h" uv_loop_t* loop = nullptr; uv_async_t* async = nullptr; int g_counter = 10; + void async_handler(uv_async_t* handle) { - printf("ohos async print\n"); + std::cout << "ohos async print" << std::endl; if (--g_counter == 0) { // Call uv_close to close the async handle and release the memory in the main loop. uv_close((uv_handle_t*)async, [](uv_handle_t* handle) { - printf("delete async\n"); + std::cout << "delete async" << std::endl; delete (uv_async_t*)handle; }); } @@ -1107,7 +1252,7 @@ int main() std::thread subThread([]() { for (int i = 0; i < 10; i++) { usleep (100); // Avoid multiple calls to uv_async_send being executed only once. - printf("%dth: subThread triggered\n", i); + std::cout << i << "th: subThread triggered" << std::endl; uv_async_send(async); } }); @@ -1159,20 +1304,47 @@ int uv_queue_work(uv_loop_t* loop, uv_after_work_cb after_work_cb) ``` -**Description** +Initializes a work request which will run the given **work_cb** in a thread from the thread pool.
**work_cb**: task submitted to the worker thread. + +**after_work_cb**: callback to be executed by the loop thread. + +**NOTE**
**after work_cb** is called after **work_cb** is complete. It is triggered by an FD event triggered by **uv_async_send(loop->wq_async)** and executed in the next iteration of the loop thread. The **uv_work_t** lifecycle ends only when **after_work_cb** is executed. + +#### Submitting Asynchronous Tasks + +The following figure illustrates a simplified workflow of the native libuv thread pool. The default pending flag of the handle is 1. The number of worker threads is an example only. + +![Working principle of the libuv thread pool](./figures/libuv-image-3.jpg) -Initializes a work request which will run the given **work_cb** in a thread from the thread pool. +#### Precautions for Submitting Asynchronous Tasks +##### Workflow of uv_queue_work + +In OpenHarmony, **uv_queue_work()** in a UI thread works as follows: Throw **work_cb** to the thread pool of the related priority of Function Flow Runtime (FFRT) and wait for FFRT to schedule and execute the task; throw **after_work_cb** to the event queue of **eventhandler** with the corresponding priority, wait for **eventhandler** to schedule, and return to the loop thread for execution.
**NOTE**
After **uv_queue_work()** is called, it does not mean any task is complete. It only means **work_cb()** is inserted into the thread pool of the related priority of FFRT. The workflow of the taskpool and jsworker threads is the same as that of native libuv. -**Parameters** +In special cases, for example, in memory-sensitive cases, the same request can be used repeatedly when:
- The sequence of the same type of tasks is ensured.
-The request can be successfully released when **uv_queue_work** is called the last time. -- **work_cb**: task submitted to the worker thread. -- **after_work_cb**: callback to be executed by the loop thread. +```C +uv_work_t* work = new uv_work_t; +uv_queue_work(loop, work, [](uv_work_t* work) { + // Do something. + }, + [](uv_work_t* work, int status) { + // Do something. + uv_queue_work(loop, work, [](...) {/* do something*/}, [](...) { + // Do something. + if (last_task) { // Release the request after the last task is executed. + delete work; + } + }); + }, + ) +``` -> **NOTE**
**after work_cb** is called after **work_cb** is complete. It is triggered by an FD event triggered by **uv_async_send(loop->wq_async)** and executed in the next iteration of the loop thread. The **uv_work_t** lifecycle ends only when **after_work_cb** is executed. +##### Constraints of Using uv_queue_work() -The following figure illustrates a simplified workflow of the libuv thread pool. The default pending flag of the handle is 1. The number of worker threads is an example only. +**uv_queue_work()** is only used to throw asynchronous tasks. The **execute()** callback of an asynchronous task added to the thread pool will be scheduled and executed. Therefore, it does not guarantee that tasks and their callbacks submitted multiple times will be executed in the order they were submitted. -![](./figures/libuv-thread-pool.png) +**uv_queue_work()** can be called only on the loop thread. This prevents multi-threading issues. Do not use **uv_queue_work()** as a means for inter-thread communication. Specifically, do not use **uv_queue_work** to throw an asynchronous task from thread A to thread B, setting **execute()** to an empty task and executing the **complete()** callback on thread B. This approach is not only inefficient but increases the difficulty in locating faults. To avoid inefficient task submission, use [napi_threadsafe_function](#thread-safe-apis-for-cross-thread-sharing-and-invocation). ### Use of libuv in OpenHarmony @@ -1180,9 +1352,9 @@ Currently, libuv threads are used in the main thread, JS Worker thread, TaskWork As a result, all the uv APIs that are not triggered by an FD event in the main thread are not responded in a timely manner. The uv APIs on the JS worker threads work as expected. -In addition, in the application main thread, all asynchronous tasks are eventually executed through libuv. However, in the current system, [the libuv thread pool has been incorporated to the FFRT](https://gitee.com/openharmony/third_party_libuv/wikis/06-Wiki- %E6%8A %80%E6%9C %AF %E8%B5%84%E6%BA %90/ %20libuv %E5%B7%A5%E4%BD %9C %E7%BA %BF %E7%A8%8B %E6%8E %A5%E5%85%A5FFRT %E6%96%B9%E6%A1%88%E5%88%86%E6%9E %90). Any asynchronous task thrown to the libuv thread will be scheduled by the FFRT thread. The callbacks of the application main thread are also inserted into the **eventhandler** queue by **PostTask()**. This means that after the asynchronous task in an FFRT thread is complete, the callback of the main thread is not triggered by **uv_async_send**. The following figure shows the process. +In addition, in the application main thread, all asynchronous tasks are eventually executed through libuv. However, in the current system, [the libuv thread pool has been incorporated to the FFRT](https://gitee.com/openharmony/third_party_libuv/wikis/06-Wiki- %E6%8A %80%E6%9C %AF %E8%B5%84%E6%BA %90/ %20libuv %E5%B7%A5%E4%BD %9C %E7%BA %BF %E7%A8%8B %E6%8E %A5%E5%85%A5FFRT %E6%96%B9%E6%A1%88%E5%88%86%E6%9E %90). Any asynchronous task thrown to the libuv thread will be scheduled by the FFRT thread. The callbacks of the application main thread are also inserted into the **eventhandler** queue by **PostTask()**. This means that after the async task in an FFRT thread is complete, the callback of the main thread is not triggered by **uv_async_send**. The following figure shows the process. -![](./figures/libuv-ffrt.png) +![Usage of the libuv asynchronous thread pool in OpenHarmony](./figures/libuv-ffrt.jpg) The following types of requests can be processed as expected in the application main loop: @@ -1192,14 +1364,14 @@ The following types of requests can be processed as expected in the application ```cpp /** -* Adds a work request to an event loop queue. +* @brief Adds a work request to an event loop queue. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the request. -* @param buf indicates the buffer for storing the random number. -* @param buflen indicates the length of the buffer. -* @param flags Indicates the options for generating a random number. The value is an unsigned integer. -* @param cb indicates the callback used to return the random number generated. +* @param loop Pointer to the event loop. +* @param req Pointer to the request. +* @param buf Buffer for storing the random number. +* @param buflen Length of the buffer. +* @param flags Options for generating a random number. The value is an unsigned integer. +* @param cb Callback used to return the random number generated. * * @return Returns 0 if the operation is successful; returns an error code otherwise. */ @@ -1217,15 +1389,12 @@ int uv_random(uv_loop_t* loop, ```cpp /** -* Adds a work request to an event loop queue. -* -* work_cb will be called by a new thread in the next iteration of the event loop. -* When work_cb is complete, after_work_cb will be called on the event loop thread. +* @brief Adds a work request to an event loop queue. **work_cb** will be called by a new thread in the next iteration of the event loop. When **work_cb** is complete, **after_work_cb** will be called on the event loop thread. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the work request. -* @param work_cb indicates the callback to be executed on a new thread. -* @param after_work_cb indicates the callback to be invoked on the event loop thread. +* @param loop Pointer to the event loop. +* @param req Pointer to the work request. +* @param work_cb Callback to be executed on a new thread. +* @param after_work_cb Callback to be invoked on the event loop thread. * * @return Returns 0 if the operation is successful; returns -1 otherwise. */ @@ -1241,15 +1410,15 @@ int uv_queue_work(uv_loop_t* loop, ```cpp /** -* Reads a file asynchronously. +* @brief Reads a file asynchronously. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the file operation request. -* @param file indicates the file descriptor. -* @param bufs indicates an array of buffers for storing the data read. -* @param nbufs indicates the number of buffers. -* @param off indicates the offset in the file from which data is read. -* @param cb indicates the callback to be invoked when the read operation is complete. +* @param loop Pointer to the event loop. +* @param req Pointer to the file operation request. +* @param file File descriptor. +* @param bufs An array of buffers for storing the data read. +* @param nbufs Number of buffers. +* @param off Offset in the file from which data is read. +* @param cb Callback to be invoked when the read operation is complete. * @return Returns 0 if the operation is successful; returns -1 otherwise. */ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, @@ -1260,14 +1429,14 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_fs_cb cb); /** -* Opens a file asynchronously. +* @brief Opens a file asynchronously. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the file operation request. -* * @param path indicates the pointer to the path of the file to open. -* @param flags indicates the modes for opening the file. -* * @param mode indicates the permission on the file. -* @param cb indicates the callback to be invoked when the file is opened. +* @param loop Pointer to the event loop. +* @param req Pointer to the file operation request. +* @param path Pointer to the path of the file to open. +* @param flags Modes for opening the file. +* @param mode Permission on the file. +* @param cb Callback to be invoked when the file is opened. * * @return Returns 0 if the operation is successful; returns -1 otherwise. */ @@ -1279,15 +1448,15 @@ int uv_fs_open(uv_loop_t* loop, uv_fs_cb cb); /** -* Sends data from a file to another asynchronously. +* @brief Sends data from a file to another asynchronously. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the file operation request. -* @param out_fd indicates the file descriptor of the destination file. -* @param in_fd indicates the file descriptor of the source file. -* @param off indicates the offset in the source file from which data is sent. -* @param len indicates the length of the data to be sent. -* @param cb indicates the callback to be invoked when the data is sent. +* @param loop Pointer to the event loop. +* @param req Pointer to the file operation request. +* @param out_fd File descriptor of the destination file. +* @param in_fd File descriptor of the source file. +* @param off Offset in the source file from which data is sent. +* @param len Length of the data to be sent. +* @param cb Callback to be invoked when the data is sent. * * @return Returns 0 if the operation is successful; returns -1 otherwise. */ @@ -1300,15 +1469,15 @@ int uv_fs_sendfile(uv_loop_t* loop, uv_fs_cb cb); /** -* Writes data to a file asynchronously. +* @brief Writes data to a file asynchronously. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the file operation request. -* @param file indicates the file descriptor. -* * @param data indicates an array of buffers for storing the data to be written. -* @param nbufs indicates the number of buffers. -* @param off indicates the offset in the file from which data is written. -* @param cb indicates the callback to be invoked when the read operation is complete. +* @param loop Pointer to the event loop. +* @param req Pointer to the file operation request. +* @param file File descriptor. +* * @param data An array of buffers for storing the data to be written. +* @param nbufs Number of buffers. +* @param off Offset in the file from which data is written. +* @param cb Callback to be invoked when the read operation is complete. * * @return Returns 0 if the operation is successful; returns -1 otherwise. */ @@ -1321,14 +1490,14 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_cb cb); /** -* Copies a file asynchronously. +* @brief Copies a file asynchronously. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the file operation request. -* @param path indicates the pointer to the path of the file to copy. -* @param new_path indicates the pointer to the destination path. -* @param flags indicates the options for the copy operation. -* @param cb indicates the callback to be invoked when the copy operation is complete. +* @param loop Pointer to the event loop. +* @param req Pointer to the file operation request. +* @param path Pointer to the path of the file to copy. +* @param new_path Pointer to the destination path. +* @param flags Options for the copy operation. +* @param cb Callback to be invoked when the copy operation is complete. * * @return Returns 0 if the operation is successful; returns -1 otherwise. */ @@ -1346,14 +1515,14 @@ int uv_fs_copyfile(uv_loop_t* loop, ```cpp /** -* Obtains address information asynchronously. +* @brief Obtains address information asynchronously. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the request for obtaining address information. -* @param cb indicates the callback to be invoked when the address information is obtained. -* @param hostname indicates the pointer to the host name to resolve. -* @param service indicates the pointer to the service name. -* @param hints indicates the pointer to the address information with additional address type constraints. +* @param loop Pointer to the event loop. +* @param req Pointer to the request for obtaining address information. +* @param cb Callback to be invoked when the address information is obtained. +* @param hostname Pointer to the host name to resolve. +* @param service Pointer to the service name. +* @param hints Pointer to the address information with additional address type constraints. * * @return Returns 0 if the operation is successful; returns -1 otherwise. */ @@ -1371,13 +1540,13 @@ int uv_getaddrinfo(uv_loop_t* loop, ```cpp /** -* Obtains name information asynchronously. +* @brief Obtains name information asynchronously. * -* @param loop indicates the pointer to the event loop. -* @param req indicates the pointer to the request. -* @param cb indicates the callback to be invoked when the name information is obtained. -* @param addr indicates the pointer to the address information to resolve. -* @param flags indicates the flags for controlling the behavior of the lookup. +* @param loop Pointer to the event loop. +* @param req Pointer to the request. +* @param cb Callback to be invoked when the name information is obtained. +* @param addr Pointer to the address information to resolve. +* @param flags Flags for controlling the behavior of the lookup. * * @return Returns 0 if the operation is successful; returns -1 otherwise. */ diff --git a/en/application-dev/reference/native-lib/musl.md b/en/application-dev/reference/native-lib/musl.md index fad289d318ac13c3005fe2f4380e74f8d65ca664..5094f607e54fdef390fcdc610d44e5744071a6bf 100644 --- a/en/application-dev/reference/native-lib/musl.md +++ b/en/application-dev/reference/native-lib/musl.md @@ -132,7 +132,7 @@ The following lists the character encoding formats and aliases supported by musl [Native API Symbols Not Exported](musl-peculiar-symbol.md) -[Restricted musl libc APIs](guidance-on-ndk-libc-interfaces-affected-by-permissions.md) - +[NDK-Related musl libc Interface Usage Restrictions](guidance-on-ndk-libc-interfaces-affected-by-permissions.md) +[NDK musl-libc Supplementary APIs](https://gitee.com/openharmony/third_party_musl/tree/master/docs) diff --git a/en/application-dev/reference/native-lib/napi.md b/en/application-dev/reference/native-lib/napi.md index 9e0bf069ae81f55fc50e361d2c38bace73cfad65..00a9fd3d220104d97cbbeb7f3d8c825983a6c341 100644 --- a/en/application-dev/reference/native-lib/napi.md +++ b/en/application-dev/reference/native-lib/napi.md @@ -256,7 +256,7 @@ The APIs exported from the native Node-API library feature usage and behaviors b **NOTE** -- In OpenHarmory, if the **napi_finalize** callback is registered when a strong reference is created, calling this API will trigger the **napi_finalize** callback. +- In OpenHarmony, if the **napi_finalize** callback is registered when a strong reference is created, calling this API will trigger the **napi_finalize** callback. ### napi_create_symbol @@ -714,7 +714,7 @@ The APIs exported from the native Node-API library feature usage and behaviors b |FUNC|napi_wrap_sendable | Wraps a native instance into an ArkTS object.|12| |FUNC|napi_wrap_sendable_with_size | Wraps a native instance into an ArkTS object with the specified size.|12| |FUNC|napi_unwrap_sendable | Unwraps the native instance from an ArkTS object.|12| -|FUNC|napi_remove_wrap_sendable | Removes the native instance from an ArkTS object.|12| +|FUNC|napi_remove_wrap_sendable | Removes and obtains the native instance wrapped by an ArkTS object. After removal, the callback will no longer be triggered and must be manually deleted to free memory.|12| |FUNC|napi_wrap_enhance | Wraps a Node-API instance into an ArkTS object and specifies the instance size. You can specify whether to execute the registered callback asynchronously (if asynchronous, it must be thread-safe).|18| > **NOTE** @@ -739,7 +739,7 @@ Enumerates the QoS levels, which determine the priority of thread scheduling. ```cpp typedef enum { - napi_event_mode_default = 0, // Run the underlying event loop while blocking the current thread, and exit the event loop only when there is no task in the loop. + napi_event_mode_default = 0, // Run the underlying event loop while blocking the current thread, and exit the event loop only when there is no task in the loop. napi_event_mode_nowait = 1, // Run the underlying event loop without blocking the current thread. Process a task and exit the event loop after the task is complete. If there is no task in the event loop, exit the event loop immediately. } napi_event_mode; ``` @@ -919,7 +919,7 @@ napi_status napi_create_ark_runtime(napi_env *env) **Description** -Creates an ArkTS runtime environment. A process allows up to 64 instances, and the total number of subthreads, including those created by [Worker](../../arkts-utils/worker-introduction.md), cannot exceed 80. +Creates a runtime environment. A process allows up to 64 instances, and the total number of child threads, including those created by [Worker](../../arkts-utils/worker-introduction.md), cannot exceed 80. **Parameters** @@ -1196,7 +1196,7 @@ Creates a sendable object with the given **napi_property_descriptor**. - **property_count**: number of properties of the class. This parameter is of the size_t type. -- **properties**: pointer to the properties of the sendable object to create. +- **properties**: pointer to the descriptors of the properties. This parameter of the const napi_property_descriptor* type. - **result**: pointer to the sendable class created. This parameter is of the napi_value type. @@ -1396,7 +1396,7 @@ napi_status napi_remove_wrap_sendable(napi_env env, napi_value js_object, void** **Description** -Removes the native instance from an ArkTS object. +Removes and obtains the native instance wrapped by an ArkTS object. After removal, the callback will no longer be triggered and must be manually deleted to free memory. **Parameters** @@ -1435,7 +1435,7 @@ Wraps a Node-API instance into an ArkTS object and specifies the instance size. - **native_object**: pointer to the native instance to be wrapped in the ArkTS object. -- **finalize_cb**: (optional) callback to be called when the ArkTS object is destroyed. For details, see [napi_finalize](#napi_finalize-description). +- **finalize_cb**: (optional) callback to be called when the ArkTS object is destroyed. For details, see [napi_finalize](#napi_finalize callback function description). - **async_finalizer**: a Boolean value used to indicate whether to execute the **finalize_cb** callback asynchronously. The value **true** means to execute the callback asynchronously. In this case, thread safety must be ensured. The value **false** means to execute the callback synchronously. diff --git a/en/application-dev/reference/native-lib/opengles.md b/en/application-dev/reference/native-lib/opengles.md index ccec72b13e89b22f8974ecdae7805ba6785e4569..caba8a93e55cd010b473967967efc6e5bd90a24f 100644 --- a/en/application-dev/reference/native-lib/opengles.md +++ b/en/application-dev/reference/native-lib/opengles.md @@ -232,7 +232,7 @@ EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id); The **eglGetDisplay** function returns an **EGLDisplay** object, which represents the connection to an EGL display. If no connection is available, **EGL_NO_DISPLAY** is returned. -The **display_id** parameter indicates the local display type of the display. The **EGLNativeDisplayType** parameter is the native window display type, which has different definitions on different platforms. If you just want to use the default display, use **EGL_DEFAULT_DISPLAY** without explicitly specifying **display_id**. +The **display_id** parameter indicates the local display type of the display. The **EGLNativeDisplayType** parameter is the window display type, which has different definitions on different platforms. If you just want to use the default display, use **EGL_DEFAULT_DISPLAY** without explicitly specifying **display_id**. ### Using eglInitialize to Initialize the EGL Display Connection Call **eglInitialize** to initialize the EGL display connection obtained. @@ -263,14 +263,14 @@ Generally, you can use this method because it is easier to obtain the optimal co ```cpp // Here, the following attributes are used: - EGLint attribs[] = {EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, -// The renderable type is OpenGL ES 3. + EGLint attribs[] = {EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, // The renderable type is OpenGL ES 3. EGL_BLUE_SIZE, 6, // The number of bits in the blue buffer is 6. EGL_GREEN_SIZE, 8, // The number of bits in the green buffer is 8. EGL_RED_SIZE, 8, // The number of bits in the red buffer is 8. EGL_NONE}; eglChooseConfig(display, attribs, &config, 1, &numConfigs); ``` - In this example, the number of bits in the blue buffer is 6. To use six bits to represent the blue value 200 in the case of 8-bit RGB (ranging from 0 to 255), use the following formula for calculation: 64 x 200/256, where 64 is the maximum value that can be represented by six bits (2^6 = 64). After **eglChooseConfig** is called, the configurations that match the attributes are returned and stored in the **config** array. In the sample code, **config_size** is set to **1**, indicating that the size of the **config** array is 1. Only one set of configurations can be stored, but that's enough. **numconfigs** specifies the number of configurations that match the attributes. In this way, the desired **config** array is obtained. + In this example, the number of bits in the blue buffer is 6. To use six bits to represent the blue value 200 in the case of 8-bit RGB (ranging from 0 to 255), use the following formula for calculation: 64 x 200/256, where 64 is the maximum value that can be represented by six bits (2^6 = 64). After **eglChooseConfig** is called, the configurations that match the attributes are returned and stored in the **config** array. In the sample code, **config_size** is set to **1**, indicating that the size of the **config** array is 1. Only one set of configurations can be stored, but that's enough. **numconfigs** specifies the number of configurations that match the attributes. In this way, the desired **config** array is obtained. - Use **eglGetConfigs** to query all supported configurations and use **eglGetConfigAttrib** to filter the desired ones. The following describes how to use this method to obtain the desired configurations. @@ -355,7 +355,7 @@ After obtaining the EGL configurations that meet the rendering requirements, use ```cpp EGLSurface eglCreateWindowSurface(EGLDisplay dpy, // EGL display connection to be associated with the window surface. EGLConfig config, // EGL configuration of the window surface to create. - EGLNativeWindowType win, // Parameter of the EGLNativeWindowType type. It is the handle or identifier of the native window and is used to associate with the EGL surface. + EGLNativeWindowType win, // Parameter of the EGLNativeWindowType type. It is the handle or identifier of the window and is used to associate with the EGL surface. const EGLint *attrib_list); // Pointer to the EGL attribute list. It specifies the attributes of the window surface. It is an integer array terminating with EGL_NONE. ``` The following values can be passed in to **attrib_list** of **eglCreateWindowSurface**: @@ -368,13 +368,15 @@ EGL_BACK_BUFFER // There are a front buffer and a back buffer. After the renderi ``` The possible causes of a failure to call **eglCreateWindowSurface** are as follows: -- **EGL_BAD_MATCH**: The native window attributes do not match the EGL configuration. This may be because the EGL configuration does not support rendering to the window (the **EGL_SURFACE_TYPE** attribute is not set to **EGL_WINDOW_BIT**). +- **EGL_BAD_MATCH**: The window attributes do not match the EGL configuration. This may be because the EGL configuration does not support rendering to the window (the **EGL_SURFACE_TYPE** attribute is not set to **EGL_WINDOW_BIT**). - **EGL_BAD_CONFIG**: The EGL configuration is not supported by the system. -- **EGL_BAD_NATIVE_WINDOW**: The native window handle is invalid. +- **EGL_BAD_NATIVE_WINDOW**: The window handle is invalid. + +- **EGL_BAD_ALLOC**: Resources cannot be created for a new EGL window or there is already an EGL configuration associated with the window. + -- **EGL_BAD_ALLOC**: Resources cannot be created for a new EGL window or there is already an EGL configuration associated with the native window. ```cpp EGLint attribList[] = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER, EGL_NONE }; @@ -400,61 +402,54 @@ if (surface == EGL_NO_SURFACE) { } ``` The process of using the **XComponent** to obtain a native window is as follows: -1. Define the **XComponent** and set the **XComponentController** in ArkTS. The **XComponent** is used to embed native rendering elements, such as OpenGL or Vulkan, into the UI. - - ```typescript - Column() { - XComponent({ - id: 'myXComponent', - type: XComponentType.SURFACE, - controller: this.xComponentController - }) - } - ``` - +1. Define the **XComponent** and set the **XComponentController** in ArkTS. The **XComponent** is used to embed rendering elements, such as OpenGL or Vulkan, into the UI. +```typescript +Column() { + XComponent({ + id: 'myXComponent', + type: XComponentType.SURFACE, + controller: this.xComponentController + }) +} +``` 2. Create an **XComponentController** subclass and implement its callbacks. +```typescript +class MyXComponentController extends XComponentController { + onSurfaceCreated(surfaceId: string): void { + console.log(`onSurfaceCreated surfaceId: ${surfaceId}`); + nativeRender.SetSurfaceId(BigInt(surfaceId)); + // The surface ID will be used to associate with the native window. + } - ```typescript - class MyXComponentController extends XComponentController { - onSurfaceCreated(surfaceId: string): void { - console.log(`onSurfaceCreated surfaceId: ${surfaceId}`); - nativeRender.SetSurfaceId(BigInt(surfaceId)); - // The surface ID will be used to associate with the native window. - } - - onSurfaceChanged(surfaceId: string, rect: SurfaceRect): void { - console.log(`onSurfaceChanged surfaceId: ${surfaceId}`); - } - - onSurfaceDestroyed(surfaceId: string): void { - console.log(`onSurfaceDestroyed surfaceId: ${surfaceId}`); - } - } - ``` - + onSurfaceChanged(surfaceId: string, rect: SurfaceRect): void { + console.log(`onSurfaceChanged surfaceId: ${surfaceId}`); + } + + onSurfaceDestroyed(surfaceId: string): void { + console.log(`onSurfaceDestroyed surfaceId: ${surfaceId}`); + } +} +``` 3. Use the surface ID to obtain a native window. - - The surface ID is generated during the creation of the **XComponent**. In the **onSurfaceCreated** callback, you can use **OH_NativeWindow_CreateNativeWindowFromSurfaceId** to obtain a native window based on the surface ID. - - ```cpp - napi_value PluginManager::SetSurfaceId(napi_env env, napi_callback_info info) - { - int64_t surfaceId = ParseId(env, info); - OHNativeWindow *nativeWindow; - PluginRender *pluginRender; - if (windowMap_.find(surfaceId) == windowMap_.end()) { - OH_NativeWindow_CreateNativeWindowFromSurfaceId(surfaceId, &nativeWindow); - windowMap_[surfaceId] = nativeWindow; - } - if (pluginRenderMap_.find(surfaceId) == pluginRenderMap_.end()) { - pluginRender = new PluginRender(surfaceId); - pluginRenderMap_[surfaceId] = pluginRender; - } - pluginRender->InitNativeWindow(nativeWindow); - return nullptr; - } - ``` - +The surface ID is generated during the creation of the **XComponent**. In the **onSurfaceCreated** callback, you can use **OH_NativeWindow_CreateNativeWindowFromSurfaceId** to obtain a native window based on the surface ID. +```cpp +napi_value PluginManager::SetSurfaceId(napi_env env, napi_callback_info info) +{ + int64_t surfaceId = ParseId(env, info); + OHNativeWindow *nativeWindow; + PluginRender *pluginRender; + if (windowMap_.find(surfaceId) == windowMap_.end()) { + OH_NativeWindow_CreateNativeWindowFromSurfaceId(surfaceId, &nativeWindow); + windowMap_[surfaceId] = nativeWindow; + } + if (pluginRenderMap_.find(surfaceId) == pluginRenderMap_.end()) { + pluginRender = new PluginRender(surfaceId); + pluginRenderMap_[surfaceId] = pluginRender; + } + pluginRender->InitNativeWindow(nativeWindow); + return nullptr; +} +``` For details about how to use the **XComponent**, see [ArkTS XComponent Usage Example](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Native/XComponent). ### Using eglCreateContext to Create a Rendering Context @@ -632,7 +627,7 @@ In the OpenGL ES rendering pipeline, the following steps describe the entire pro 6. Writing the frame to the buffer - After all the preceding tests and processing, the final fragment data is written into the frame buffer and displayed as an image on the screen. + After all the preceding tests and processing, the final fragment data is written into the frame buffer and displayed as an image on the screen. ### Creating and Using a Shader Program diff --git a/en/application-dev/reference/native-lib/openglesv3-symbol.md b/en/application-dev/reference/native-lib/openglesv3-symbol.md index 9d084add12c6ce8cac8318d70ee23c521290a628..cf11ed4761a74125462daa2eba3c2da6c5e0a4e8 100644 --- a/en/application-dev/reference/native-lib/openglesv3-symbol.md +++ b/en/application-dev/reference/native-lib/openglesv3-symbol.md @@ -1,7 +1,7 @@ # OpenGL ES 3.2 Symbols Exported from Native APIs -|Type|Symbol|Remarks| -| --- | --- | --- | +|Type|Symbol| +| --- | --- | |FUNC|glActiveShaderProgram| |FUNC|glActiveTexture| |FUNC|glAttachShader| diff --git a/en/application-dev/reference/native-lib/opensles.md b/en/application-dev/reference/native-lib/opensles.md index 3654b4dcb414861d9b9d9f37f4d86dacdc48abdb..d3c1c4485937a26d5ac259e3916643317230b588 100644 --- a/en/application-dev/reference/native-lib/opensles.md +++ b/en/application-dev/reference/native-lib/opensles.md @@ -1,8 +1,8 @@ # OpenSL ES > **NOTE** -> -> OpenHarmony provides the OpenSL ES APIs for audio development at the native layer since SDK 8. As the version evolves, these APIs fail to meet the capability expansion requirements of the audio system and therefore are no longer recommended. [Switch from OpenSL ES to OHAudio](../../media/audio/replace-opensles-by-ohaudio.md). +> OpenHarmony provides the OpenSL ES APIs for audio development at the native layer since SDK 8. As the version evolves, these APIs fail to meet the capability expansion requirements of the audio system and therefore are no longer recommended. +> [Switch from OpenSL ES to OHAudio](../../media/audio/replace-opensles-by-ohaudio.md). ## Introduction diff --git a/en/application-dev/reference/native-lib/vulkan-guidelines.md b/en/application-dev/reference/native-lib/vulkan-guidelines.md index 1f16ab6e42d1f69bc6d79a195d75c433f8e070af..c05263122337a0440947d3ea67fe2921ee2f7d6f 100644 --- a/en/application-dev/reference/native-lib/vulkan-guidelines.md +++ b/en/application-dev/reference/native-lib/vulkan-guidelines.md @@ -34,6 +34,10 @@ libnative_window.so libvulkan.so ``` +> **NOTE** +> +> When the **dlopen** function is used to link the **libvulkan.so** dynamic library in a program, you do not need to add dependencies in CMake. Otherwise, symbol conflicts occur. + **Including Header Files** ```c++ diff --git a/en/application-dev/reference/native-lib/vulkan.md b/en/application-dev/reference/native-lib/vulkan.md index 035436ca8f322eb51562077b86fecaa33eaf1d7d..1e8da80226541a162eaaba8533f7109c46e49381 100644 --- a/en/application-dev/reference/native-lib/vulkan.md +++ b/en/application-dev/reference/native-lib/vulkan.md @@ -1,10 +1,10 @@ # Vulkan Capabilities -[Vulkan](https://www.vulkan.org/) is a set of 2D and 3D rendering APIs that feature cross-platform and high-performance. OpenHarmony now supports Vulkan v1.3.231. +[Vulkan](https://www.vulkan.org/) is a set of 2D and 3D rendering APIs that feature cross-platform and high-performance. OpenHarmony now supports Vulkan v1.3.275. ## Supported Standard APIs -The table below lists the supported APIs of Vulkan v1.3.231. +The table below lists the supported APIs of Vulkan v1.3.275. |Type|Symbol| | --- | --- | @@ -261,5 +261,8 @@ In addition to the standard APIs, OpenHarmony provides extended APIs for creatin |FUNC|vkCreateSurfaceOHOS| |FUNC|vkGetNativeBufferPropertiesOHOS| |FUNC|vkGetMemoryNativeBufferOHOS| +|FUNC|vkGetSwapchainGrallocUsageOHOS| +|FUNC|vkAcquireImageOHOS| +|FUNC|vkQueueSignalReleaseImageOHOS| For details about the extended APIs, see [Vulkan Module](_vulkan.md). diff --git a/en/application-dev/reference/native-lib/vulkan__ohos_8h.md b/en/application-dev/reference/native-lib/vulkan__ohos_8h.md index 1db4566634040df4c0672dad0f35d1dd3a1c5fe4..3a55f32c3f5f892ad55caa33fb17bc8eaaee8720 100644 --- a/en/application-dev/reference/native-lib/vulkan__ohos_8h.md +++ b/en/application-dev/reference/native-lib/vulkan__ohos_8h.md @@ -3,7 +3,9 @@ ## Overview -The **vulkan_ohos.h** file declares the Vulkan interfaces extended by OpenHarmony. File to include: <vulkan/vulkan.h> +The **vulkan_ohos.h** file declares the Vulkan interfaces extended by OpenHarmony. + +**File to include**: <vulkan/vulkan.h> **Since** @@ -64,6 +66,9 @@ The **vulkan_ohos.h** file declares the Vulkan interfaces extended by OpenHarmon | Name| Description| | -------- | -------- | -| [vkCreateSurfaceOHOS](_vulkan.md#vkcreatesurfaceohos) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Creates a Vulkan surface.| -| [vkGetNativeBufferPropertiesOHOS](_vulkan.md#vkgetnativebufferpropertiesohos) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Obtains the properties of an **OH_NativeBuffer** instance.| -| [vkGetMemoryNativeBufferOHOS](_vulkan.md#vkgetmemorynativebufferohos) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Obtains an **OH_NativeBuffer** instance.| +| VKAPI_ATTR VkResult VKAPI_CALL [vkCreateSurfaceOHOS](_vulkan.md#vkcreatesurfaceohos) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Creates a Vulkan surface. | +| VKAPI_ATTR VkResult VKAPI_CALL [vkGetNativeBufferPropertiesOHOS](_vulkan.md#vkgetnativebufferpropertiesohos) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Obtains the properties of an **OH_NativeBuffer** instance. | +| VKAPI_ATTR VkResult VKAPI_CALL [vkGetMemoryNativeBufferOHOS](_vulkan.md#vkgetmemorynativebufferohos) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Obtains an **OH_NativeBuffer** instance. | +| VKAPI_ATTR VkResult VKAPI_CALL [vkGetSwapchainGrallocUsageOHOS](_vulkan.md#vkgetswapchaingrallocusageohos) (VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t \*grallocUsage) | Returns the appropriate gralloc usage flag based on the given Vulkan device, image format, and image usage flag. | +| VKAPI_ATTR VkResult VKAPI_CALL [vkAcquireImageOHOS](_vulkan.md#vkacquireimageohos) (VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence) | Obtains the ownership of the swap chain image and imports the fence of the external signal to the VkSemaphore and VkFence objects. | +| VKAPI_ATTR VkResult VKAPI_CALL [vkQueueSignalReleaseImageOHOS](_vulkan.md#vkqueuesignalreleaseimageohos) (VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore \*pWaitSemaphores, VkImage image, int32_t \*pNativeFenceFd) | Sends a signal to the system hardware buffer to release an image once it is no longer needed so that other components can access it. | diff --git a/en/application-dev/reference/phone-syscap-list.md b/en/application-dev/reference/phone-syscap-list.md new file mode 100644 index 0000000000000000000000000000000000000000..d9e62cdf2846b353a68fc85c1ef1a7be30090f8b --- /dev/null +++ b/en/application-dev/reference/phone-syscap-list.md @@ -0,0 +1,246 @@ +# SystemCapability List + +SystemCapability (SysCap) is a standalone feature in the operating system. + +Before using an API for development, you are advised to familiarize yourself with [SysCap](syscap.md), and then consult the following tables to see whether the SysCap set required for the API is supported by the target device type. + +> **NOTE** +> +> This list outlines the minimum system capabilities supported by the current version of phones. You can refer to the **default.json** file in the SDK for details. +> When developing applications for the current version of phones using the APIs corresponding to the system capabilities listed, you can call these APIs directly without needing to perform a **canIUse()** check beforehand. + +- SystemCapability.ArkUI.ArkUI.Full +- SystemCapability.ArkUI.ArkUI.Napi +- SystemCapability.ArkUI.ArkUI.Libuv +- SystemCapability.ArkUI.ArkUI.Lite +- SystemCapability.ArkUI.UiAppearance +- SystemCapability.Base +- SystemCapability.BundleManager.BundleFramework +- SystemCapability.BundleManager.BundleFramework.Overlay +- SystemCapability.BundleManager.DistributedBundleFramework +- SystemCapability.BundleManager.Zlib +- SystemCapability.Graphic.Graphic2D.EGL +- SystemCapability.Graphic.Graphic2D.GLES2 +- SystemCapability.Graphic.Graphic2D.GLES3 +- SystemCapability.Graphic.Graphic2D.WebGL +- SystemCapability.Graphic.Graphic2D.WebGL2 +- SystemCapability.Window.SessionManager +- SystemCapability.WindowManager.WindowManager.Core +- SystemCapability.Notification.CommonEvent +- SystemCapability.Notification.Notification +- SystemCapability.Notification.ReminderAgent +- SystemCapability.Notification.NotificationSettings +- SystemCapability.Notification.Emitter +- SystemCapability.Communication.IPC.Core +- SystemCapability.Communication.SoftBus.Core +- SystemCapability.Communication.NetManager.Core +- SystemCapability.Communication.NetManager.Ethernet +- SystemCapability.Communication.NetManager.NetSharing +- SystemCapability.Communication.NetManager.MDNS +- SystemCapability.Communication.NetManager.Vpn +- SystemCapability.Communication.NetStack +- SystemCapability.Communication.WiFi.Core +- SystemCapability.Communication.WiFi.STA +- SystemCapability.Communication.WiFi.AP.Core +- SystemCapability.Communication.WiFi.P2P +- SystemCapability.Communication.Bluetooth.Core +- SystemCapability.Location.Location.Core +- SystemCapability.Location.Location.Geocoder +- SystemCapability.Location.Location.Geofence +- SystemCapability.Location.Location.Gnss +- SystemCapability.MultimodalInput.Input.Core +- SystemCapability.MultimodalInput.Input.InputDevice +- SystemCapability.MultimodalInput.Input.InputMonitor +- SystemCapability.MultimodalInput.Input.InputConsumer +- SystemCapability.MultimodalInput.Input.InputSimulator +- SystemCapability.MultimodalInput.Input.Pointer +- SystemCapability.MultimodalInput.Input.ShortKey +- SystemCapability.MultimodalInput.Input.InfraredEmitter +- SystemCapability.PowerManager.BatteryManager.Extension +- SystemCapability.PowerManager.DisplayPowerManager +- SystemCapability.PowerManager.ThermalManager +- SystemCapability.PowerManager.PowerManager.Core +- SystemCapability.PowerManager.BatteryManager.Core +- SystemCapability.PowerManager.PowerManager.Extension +- SystemCapability.Multimedia.Media.Core +- SystemCapability.Multimedia.Media.AudioPlayer +- SystemCapability.Multimedia.Media.AudioRecorder +- SystemCapability.Multimedia.Media.VideoPlayer +- SystemCapability.Multimedia.Media.VideoRecorder +- SystemCapability.Multimedia.Media.CodecBase +- SystemCapability.Multimedia.Media.AudioCodec +- SystemCapability.Multimedia.Media.AudioDecoder +- SystemCapability.Multimedia.Media.AudioEncoder +- SystemCapability.Multimedia.Media.VideoDecoder +- SystemCapability.Multimedia.Media.VideoEncoder +- SystemCapability.Multimedia.Media.Spliter +- SystemCapability.Multimedia.Media.Muxer +- SystemCapability.Multimedia.Media.AVPlayer +- SystemCapability.Multimedia.Media.AVRecorder +- SystemCapability.Multimedia.Media.AVMetadataExtractor +- SystemCapability.Multimedia.Media.AVImageGenerator +- SystemCapability.Multimedia.Media.AVTranscoder +- SystemCapability.Multimedia.AVSession.Core +- SystemCapability.Multimedia.AVSession.Manager +- SystemCapability.Multimedia.AVSession.AVCast +- SystemCapability.Multimedia.Audio.Core +- SystemCapability.Multimedia.Audio.Renderer +- SystemCapability.Multimedia.Audio.Capturer +- SystemCapability.Multimedia.Audio.Device +- SystemCapability.Multimedia.Audio.Volume +- SystemCapability.Multimedia.Audio.Communication +- SystemCapability.Multimedia.Audio.Interrupt +- SystemCapability.Multimedia.Audio.Tone +- SystemCapability.Multimedia.Audio.PlaybackCapture +- SystemCapability.Multimedia.Camera.Core +- SystemCapability.Multimedia.Drm.Core +- SystemCapability.Multimedia.Image.Core +- SystemCapability.Multimedia.Image.ImageSource +- SystemCapability.Multimedia.Image.ImagePacker +- SystemCapability.Multimedia.Image.ImageReceiver +- SystemCapability.Multimedia.ImageEffect.Core +- SystemCapability.Multimedia.MediaLibrary.Core +- SystemCapability.Multimedia.MediaLibrary.DistributedCore +- SystemCapability.Multimedia.SystemSound.Core +- SystemCapability.Telephony.CoreService +- SystemCapability.Telephony.CallManager +- SystemCapability.Telephony.CellularCall +- SystemCapability.Telephony.CellularData +- SystemCapability.Telephony.SmsMms +- SystemCapability.Telephony.StateRegistry +- SystemCapability.Global.I18n +- SystemCapability.Global.ResourceManager +- SystemCapability.Customization.ConfigPolicy +- SystemCapability.Customization.CustomConfig +- SystemCapability.Customization.EnterpriseDeviceManager +- SystemCapability.BarrierFree.Accessibility.Core +- SystemCapability.BarrierFree.Accessibility.Vision +- SystemCapability.BarrierFree.Accessibility.Hearing +- SystemCapability.ResourceSchedule.WorkScheduler +- SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask +- SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask +- SystemCapability.ResourceSchedule.UsageStatistics.App +- SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +- SystemCapability.Utils.Lang +- SystemCapability.HiviewDFX.HiLog +- SystemCapability.HiviewDFX.HiTrace +- SystemCapability.HiviewDFX.Hiview.FaultLogger +- SystemCapability.HiviewDFX.Hiview.LogLibrary +- SystemCapability.HiviewDFX.HiChecker +- SystemCapability.HiviewDFX.HiDumper +- SystemCapability.HiviewDFX.HiAppEvent +- SystemCapability.HiviewDFX.HiSysEvent +- SystemCapability.HiviewDFX.HiProfiler.HiDebug +- SystemCapability.HiviewDFX.HiCollie +- SystemCapability.Update.UpdateService +- SystemCapability.DistributedHardware.DeviceManager +- SystemCapability.Security.DeviceAuth +- SystemCapability.Security.DataTransitManager +- SystemCapability.Security.DeviceSecurityLevel +- SystemCapability.Security.Huks.Core +- SystemCapability.Security.Huks.Extension +- SystemCapability.Security.Asset +- SystemCapability.Security.AccessToken +- SystemCapability.Security.SecurityGuard +- SystemCapability.Security.ScreenLockFileManager +- SystemCapability.Account.OsAccount +- SystemCapability.Account.AppAccount +- SystemCapability.UserIAM.UserAuth.Core +- SystemCapability.UserIAM.UserAuth.PinAuth +- SystemCapability.MiscServices.InputMethodFramework +- SystemCapability.MiscServices.Pasteboard +- SystemCapability.MiscServices.Time +- SystemCapability.MiscServices.Wallpaper +- SystemCapability.MiscServices.ScreenLock +- SystemCapability.MiscServices.Upload +- SystemCapability.MiscServices.Download +- SystemCapability.FileManagement.StorageService.Backup +- SystemCapability.FileManagement.StorageService.SpatialStatistics +- SystemCapability.FileManagement.StorageService.Volume +- SystemCapability.FileManagement.StorageService.Encryption +- SystemCapability.FileManagement.File.FileIO +- SystemCapability.FileManagement.File.Environment +- SystemCapability.FileManagement.File.DistributedFile +- SystemCapability.FileManagement.AppFileService +- SystemCapability.FileManagement.UserFileService +- SystemCapability.FileManagement.UserFileManager.Core +- SystemCapability.FileManagement.PhotoAccessHelper.Core +- SystemCapability.FileManagement.DistributedFileService.CloudSyncManager +- SystemCapability.FileManagement.DistributedFileService.CloudSync.Core +- SystemCapability.USB.USBManager +- SystemCapability.Sensors.Sensor +- SystemCapability.Sensors.MiscDevice +- SystemCapability.Startup.SystemInfo +- SystemCapability.DistributedDataManager.RelationalStore.Core +- SystemCapability.DistributedDataManager.CommonType +- SystemCapability.DistributedDataManager.KVStore.Core +- SystemCapability.DistributedDataManager.KVStore.DistributedKVStore +- SystemCapability.DistributedDataManager.DataObject.DistributedObject +- SystemCapability.DistributedDataManager.Preferences.Core +- SystemCapability.DistributedDataManager.DataShare.Core +- SystemCapability.DistributedDataManager.DataShare.Consumer +- SystemCapability.DistributedDataManager.DataShare.Provider +- SystemCapability.DistributedDataManager.CloudSync.Config +- SystemCapability.DistributedDataManager.CloudSync.Client +- SystemCapability.DistributedDataManager.CloudSync.Server +- SystemCapability.Ability.AbilityBase +- SystemCapability.Ability.AbilityRuntime.Core +- SystemCapability.Ability.AbilityRuntime.FAModel +- SystemCapability.Ability.AbilityRuntime.AbilityCore +- SystemCapability.Ability.AbilityRuntime.Mission +- SystemCapability.Ability.AbilityTools.AbilityAssistant +- SystemCapability.Ability.Form +- SystemCapability.Ability.DistributedAbilityManager +- SystemCapability.Applications.CalendarData +- SystemCapability.Applications.ContactsData +- SystemCapability.Applications.Contacts +- SystemCapability.Applications.Settings.Core +- SystemCapability.Test.UiTest +- SystemCapability.Web.Webview.Core +- SystemCapability.Advertising.OAID +- SystemCapability.Advertising.Ads +- SystemCapability.Security.CertificateManager +- SystemCapability.Security.CertificateManagerDialog +- SystemCapability.Security.CryptoFramework +- SystemCapability.Security.CryptoFramework.Key +- SystemCapability.Security.CryptoFramework.Key.SymKey +- SystemCapability.Security.CryptoFramework.Key.AsymKey +- SystemCapability.Security.CryptoFramework.Signature +- SystemCapability.Security.CryptoFramework.Cipher +- SystemCapability.Security.CryptoFramework.KeyAgreement +- SystemCapability.Security.CryptoFramework.MessageDigest +- SystemCapability.Security.CryptoFramework.Mac +- SystemCapability.Security.CryptoFramework.Kdf +- SystemCapability.Security.CryptoFramework.Rand +- SystemCapability.Security.Cert +- SystemCapability.BundleManager.BundleFramework.Core +- SystemCapability.BundleManager.BundleFramework.FreeInstall +- SystemCapability.BundleManager.BundleFramework.Resource +- SystemCapability.BundleManager.BundleFramework.DefaultApp +- SystemCapability.BundleManager.BundleFramework.Launcher +- SystemCapability.BundleManager.BundleFramework.AppControl +- SystemCapability.BundleManager.AppDomainVerify +- SystemCapability.Ability.AbilityRuntime.QuickFix +- SystemCapability.Graphic.Graphic2D.ColorManager.Core +- SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply +- SystemCapability.XTS.DeviceAttest +- SystemCapability.Request.FileTransferAgent +- SystemCapability.ResourceSchedule.DeviceStandby +- SystemCapability.DistributedDataManager.UDMF.Core +- SystemCapability.Multimedia.Media.AVScreenCapture +- SystemCapability.Multimedia.Media.SoundPool +- SystemCapability.Multimedia.Audio.Spatialization +- SystemCapability.Multimedia.AudioHaptic.Core +- SystemCapability.ArkUi.Graphics3D +- SystemCapability.Graphics.Drawing +- SystemCapability.Graphic.Graphic2D.NativeDrawing +- SystemCapability.Developtools.Syscap +- SystemCapability.Resourceschedule.Ffrt.Core +- SystemCapability.Graphic.Graphic2D.NativeWindow +- SystemCapability.Graphic.Graphic2D.NativeBuffer +- SystemCapability.Graphic.Graphic2D.NativeImage +- SystemCapability.Graphic.Graphic2D.NativeVsync +- SystemCapability.Graphic.Vulkan +- SystemCapability.Multimedia.Image.ImageCreator +- SystemCapability.Ability.AppStartup +- SystemCapability.Ability.AppExtension.PhotoEditorExtension diff --git a/en/application-dev/reference/syscap-list.md b/en/application-dev/reference/syscap-list.md index 5336ba74b760c95db495d7e6b107ad5fe968600c..bd60830f7246c25a1676458462954ad7114f9798 100644 --- a/en/application-dev/reference/syscap-list.md +++ b/en/application-dev/reference/syscap-list.md @@ -1,1881 +1,7 @@ # SystemCapability List -SystemCapability (SysCap) is a standalone feature in the operating system. - -Before using an API for development, you are advised to familiarize yourself with [SysCap](syscap.md), and then consult the following tables to see whether the SysCap set required for the API is supported by the target device type. - -> **NOTE** -> -> The **default** device type represents an OpenHarmony device with comprehensive functionalities and most common capabilities. If you are not sure about the capability set of the target device, you can use the **default** type for development. - -## SystemCapability.ArkUI.ArkUI.Full - -ArkUI component capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ArkUI.ArkUI.Napi - -NAPI functionality - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ArkUI.ArkUI.Libuv - -libuv functionality - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ArkUI.UiAppearance - -Appearance configuration - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Base - -General type - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | Yes | - -## SystemCapability.BundleManager.BundleFramework - -Bundle manager service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.BundleFramework.Overlay - -Overlay capability of bundle management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.DistributedBundleFramework - -Distributed bundle manager service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.Zlib - -zlib compression and decompression tool - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.EGL - -Interface between the rendering API and the bottom-layer platform window system - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.GLES2 - -Capability for rendering advanced 2D and 3D graphics - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.GLES3 - -Capability for rendering advanced 2D and 3D graphics - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.WebGL - -WebGL 1.0 API - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Window.SessionManager - -Enhanced window management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.WindowManager.WindowManager.Core - -Basic window management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Notification.CommonEvent - -Common event - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Notification.Notification - -Notification - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Notification.ReminderAgent - -Agent-powered reminder - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Notification.Emitter - -Event emitter service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.IPC.Core - -Inter-process communication (IPC) - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.SoftBus.Core - -DSoftBus - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.NetManager.Core - -Basic network management service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.NetManager.Ethernet - -Ethernet connectivity - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.NetManager.NetSharing - -Network sharing - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.NetManager.MDNS - -mDNS service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.NetManager.Vpn - -VPN - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.NetStack - -Basic network stack capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | Yes | - -## SystemCapability.Communication.WiFi.Core - -Basic Wi-Fi capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.WiFi.STA - -Wi-Fi STA capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.WiFi.AP.Core - -Wi-Fi AP capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.WiFi.P2P - -Wi-Fi P2P capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Communication.Bluetooth.Core - -Bluetooth service and protocol stack - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Location.Location.Core - -Basic location capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Location.Location.Geocoder - -Geocoding capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Location.Location.Geofence - -Geofencing capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Location.Location.Gnss - -GNSS hardware capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MultimodalInput.Input.Core - -Basic input capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MultimodalInput.Input.InputDevice - -Input device management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MultimodalInput.Input.InputMonitor - -Input event listener - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MultimodalInput.Input.InputConsumer - -Input event consumer - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MultimodalInput.Input.InputSimulator - -Input event simulator - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MultimodalInput.Input.Pointer - -Mouse pointer management module - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MultimodalInput.Input.ShortKey - -Shortcut keys - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.PowerManager.BatteryManager.Extension - -Extended battery management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.PowerManager.DisplayPowerManager - -Power management display - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.PowerManager.ThermalManager - -Temperature control - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.PowerManager.PowerManager.Core - -Basic power management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.PowerManager.BatteryManager.Core - -Basic battery management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.PowerManager.PowerManager.Extension - -Extended capability of the system power management service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.Core - -Basic media capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AudioPlayer - -Audio player capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AudioRecorder - -Media audio recorder capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.VideoPlayer - -Video player capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.VideoRecorder - -Video recorder capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.CodecBase - -Basic media codec capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AudioCodec - -Media audio codec capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AudioDecoder - -Media audio decoding capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AudioEncoder - -Media audio encoding capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.VideoDecoder - -Media video decoding capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.VideoEncoder - -Media video encoding capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.Spliter - -Media splitter capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.Muxer - -Media muxer capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AVPlayer - -Audio and video player capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AVRecorder - -Audio and video recorder capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AVMetadataExtractor - -Capability of obtaining media cloud data - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AVImageGenerator - -Capability of obtaining video thumbnails - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AVTranscoder - -Capability of obtaining video transcoding - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.AVSession.Core - -Basic media session capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.AVSession.Manager - -Media session management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.AVSession.AVCast - -Casting capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.AVSession.ExtendedDisplayDisplay - -Extended media projection capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Core - -Basic audio capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Renderer - -Audio output capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Capturer - -Audio input capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Device - -Audio device management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Volume - -Audio volume management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Communication - -Audio communication capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Interrupt - -Audio focus - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Tone - -Dialing tone and ringback tone playback - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.PlaybackCapture - -System tone recording capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Camera.Core - -Basic camera capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Drm.Core - -Media digital rights management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Image.Core - -Basic image capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Image.ImageSource - -Image source decoding and parsing capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Image.ImagePacker - -Image packaging capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Image.ImageReceiver - -Image receiving capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.MediaLibrary.Core - -Basic media library capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.MediaLibrary.DistributedCore - -Distributed media library capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.SystemSound.Core - -System sound management, covering ringtones, notifications, alarms, and more - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Telephony.CoreService - -Basic cellular service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Telephony.CallManager - -Call management service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Telephony.CellularCall - -Cellular call service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Telephony.CellularData - -Cellular data service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Telephony.SmsMms - -SMS and MMS services - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Telephony.StateRegistry - -Cellular network status registration service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Global.I18n - -Internationalization - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Global.ResourceManager - -Resource management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Customization.ConfigPolicy - -Customization framework - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Customization.CustomConfig - -Custom configurations - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Customization.EnterpriseDeviceManager - -Enterprise device management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BarrierFree.Accessibility.Core - -Basic accessibility capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BarrierFree.Accessibility.Vision - -Visual accessibility capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BarrierFree.Accessibility.Hearing - -Audio accessibility capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ResourceSchedule.WorkScheduler - -Deferred task scheduling - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask - -Continuous task management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask - -Transient task management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ResourceSchedule.UsageStatistics.App - -Application usage statistics - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - -Application activity group - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Utils.Lang - -TS/JS language base library - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.HiLog - -HiLog functionality - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.HiTrace - -HiTrace for distributed tracing - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.Hiview.FaultLogger - -FaultLogger for event recording - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.Hiview.LogLibrary - -Log file management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.HiChecker - -HiChecker mode - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.HiDumper - -HiDumper for system information exporting - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.HiAppEvent - -HiAppEvent for application event logging - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.HiSysEvent - -HiAppEvent for system event logging - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.HiviewDFX.HiProfiler.HiDebug - -Debugging and tuning - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Update.UpdateService - -Update - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedHardware.DeviceManager - -Distributed device management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.DeviceAuth - -Mutual authentication between devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.DataTransitManager - -Library of data transmission management and control policies - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.DeviceSecurityLevel - -Device security level management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.Huks.Core - -Basic capability of device key management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | Yes | - -## SystemCapability.Security.Huks.Extension - -Extended capability of device key management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.Asset - -Key asset storage capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.AccessToken - -Access control - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Account.OsAccount - -System account - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Account.AppAccount - -Application account - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.UserIAM.UserAuth.Core - -Unified user authentication - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.UserIAM.UserAuth.PinAuth - -PIN authentication - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MiscServices.InputMethodFramework - -Input method framework - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MiscServices.Pasteboard - -Pasteboard service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MiscServices.Time - -Time, time zone, and timing service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MiscServices.Wallpaper - -Wallpaper framework - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MiscServices.ScreenLock - -Screen lock service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MiscServices.Upload - -Upload service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.MiscServices.Download - -Download service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.StorageService.Backup - -Backup and restore - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.StorageService.SpatialStatistics - -Spatial statistics - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.StorageService.Volume - -Volume management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.StorageService.Encryption - -File encryption capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.File.FileIO - -Basic file I/O interface - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.File.Environment - -Environment-related interface - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.File.DistributedFile - -Distributed file extension - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.AppFileService - -Application file service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.UserFileService - -User file service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.UserFileManager.Core - -Basic capability of user file management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.PhotoAccessHelper.Core - -Management of images and videos in public directories - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.DistributedFileService.CloudSyncManager - -Device-cloud file synchronization management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.FileManagement.DistributedFileService.CloudSync.Core - -Device-cloud file synchronization capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.USB.USBManager - -USB service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Sensors.Sensor - -Sensor service subscription - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Sensors.MiscDevice - -Miscellaneous devices – sensor - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Startup.SystemInfo - -Basic system information - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.RelationalStore.Core - -Basic relational database capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.CommonType - -Common types of distributed data management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.KVStore.Core - -Basic capability of key-value databases - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - -Distributed key-value database - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.DataObject.DistributedObject - -Distributed data object - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.Preferences.Core - -Basic capability of preferences data storage - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.DataShare.Core - -Basic capability of cross-process data sharing - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.DataShare.Consumer - -Data consumer of cross-process data sharing - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.DataShare.Provider - -Data provider of cross-process data sharing - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.CloudSync.Config - -Device-cloud synchronization status configuration - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.CloudSync.Client - -Device-cloud synchronization API manually invoked by the data side - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.CloudSync.Server - -Interface required by the cloud space service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.AbilityBase - -Definition of basic component running data, including wants and system configuration - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.AbilityRuntime.Core - -Core basic functional modules for component runtime, including application initialization and GUI-less component running - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.AbilityRuntime.FAModel - -Feature Ability (FA) model - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.AbilityRuntime.AbilityCore - -Universal components (with GUIs) - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.AbilityRuntime.Mission - -Task management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.AbilityTools.AbilityAssistant - -CLI tool - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.Form - -Widget management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.DistributedAbilityManager - -continuationManager for starting the device selection module and updating the continuation status - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Applications.CalendarData - -Calendar event management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Applications.ContactsData - -Contacts database - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Applications.Contacts - -Contacts - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | No | No | - -## SystemCapability.Applications.Settings.Core - -API setting - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Test.UiTest - -UI test framework - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Web.Webview.Core - -Webview component - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Advertising.OAID - -OAID management service - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Advertising.Ads - -Advertising - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CertificateManager - -Certificate management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework - -Crypto framework - basics - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | Yes | - -## SystemCapability.Security.CryptoFramework.Key - -Crypto framework - basic key types - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.Key.SymKey - -Crypto framework - symmetric keys - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.Key.AsymKey - -Crypto framework - asymmetric keys - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.Signature - -Crypto framework - signing and signature verification - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.Cipher - -Crypto framework - symmetric and asymmetric encryption and decryption - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.KeyAgreement - -Crypto framework - key agreement - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.MessageDigest - -Crypto framework - message digest - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | Yes | - -## SystemCapability.Security.CryptoFramework.Mac - -Crypto framework - message authentication code - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.Kdf - -Crypto framework - key derivation - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Security.CryptoFramework.Rand - -Crypto framework - random number - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | Yes | - -## SystemCapability.Security.Cert - -Certificate algorithm library framework - certificate capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.BundleFramework.Core - -Core services of bundle management, including bundle information query, bundle installation, and bundle uninstall - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.BundleFramework.FreeInstall - -Installation-free capability provided by bundle management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.BundleFramework.Resource - -Capability of obtaining icons and labels provided by bundle management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.BundleFramework.DefaultApp - -Default application management capability provided by bundle management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.BundleFramework.Launcher - -Query capability provided by bundle management for the home screen - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.BundleManager.BundleFramework.AppControl - -Interception capability provided by bundle management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Ability.AbilityRuntime.QuickFix - -Quick fix - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.ColorManager.Core - -Wide color gamut management - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply - -Efficiency resource application - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.XTS.DeviceAttest - -Device attestation - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Request.FileTransferAgent - -File transfer agent between applications and servers - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ResourceSchedule.DeviceStandby - -Device standby mode when the screen is turned off - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.DistributedDataManager.UDMF.Core - -Distributed data management - basic capability of the Unified Data Management Framework (UDMF) - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.AVScreenCapture - -Screen recording capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Media.SoundPool - -Audio pool capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Audio.Spatialization - -Spatial audio management capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.AudioHaptic.Core - -Audio-haptic playback capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ArkUi.Graphics3D - -3D capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphics.Drawing - -Custom drawing capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.NativeDrawing - -2D drawing capability at the native layer - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Developtools.Syscap - -System capability encoding and decoding - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Resourceschedule.Ffrt.Core - -Concurrent programming framework - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.NativeWindow - -Local windows for custom drawing (2D&3D) - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.NativeBuffer - -Graphics buffer (independent of the local window) - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.NativeImage - -Surface output to the OpenGLES texture - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.NativeVsync - -Capability of providing vertical sync signals for the system - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Vulkan - -Power management display - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Multimedia.Image.ImageCreator - -Image creation capability - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.Graphic.Graphic2D.WebGL2 - -WebGL 2.0 API - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | No | - -## SystemCapability.ArkUI.ArkUI.Lite - -ArkUI component for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| Yes | Yes | Yes | - -## SystemCapability.Location.Location.Lite - -Location service for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | - -## SystemCapability.PowerManager.BatteryManager.Lite - -Battery service for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | - -## SystemCapability.FileManagement.File.FileIO.Lite - -Basic file I/O interface for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | - -## SystemCapability.Startup.SystemInfo.Lite - -Basic system information for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | - -## SystemCapability.PowerManager.DisplayPowerManager.Lite - -Power management display for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | - -## SystemCapability.DistributedDataManager.Preferences.Core.Lite - -Basic capability of preference data storage for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | - -## SystemCapability.Sensors.Sensor.Lite - -Sensor service subscription for mini-system devices - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | - -## SystemCapability.Sensors.MiscDevice.Lite - -Miscellaneous mini-system devices – sensor - -| Default | Tablet | Lite Wearable| -|---------|--------|--------------| -| No | No | Yes | +- [Phone](phone-syscap-list.md) +- [Tablet](tablet-syscap-list.md) +- [LiteWearable](litewearable-syscap-list.md) +- [TV](tv-syscap-list.md) +- [Wearable](wearable-syscap-list.md) diff --git a/en/application-dev/reference/tablet-syscap-list.md b/en/application-dev/reference/tablet-syscap-list.md new file mode 100644 index 0000000000000000000000000000000000000000..60d4847d36a48ac4389831bea7b308e72f8eed66 --- /dev/null +++ b/en/application-dev/reference/tablet-syscap-list.md @@ -0,0 +1,236 @@ +# SystemCapability List + +SystemCapability (SysCap) is a standalone feature in the operating system. + +Before using an API for development, you are advised to familiarize yourself with [SysCap](syscap.md), and then consult the following tables to see whether the SysCap set required for the API is supported by the target device type. + +> **NOTE** +> +> This list outlines the minimum system capabilities supported by the current version of tablets. You can refer to the **tablet.json** file in the SDK for details. +> When developing applications for the current version of tablets using the APIs corresponding to the system capabilities listed, you can call these APIs directly without needing to perform a **canIUse()** check beforehand. + +- SystemCapability.ArkUI.ArkUI.Full +- SystemCapability.ArkUI.ArkUI.Napi +- SystemCapability.ArkUI.ArkUI.Libuv +- SystemCapability.ArkUI.ArkUI.Lite +- SystemCapability.ArkUI.UiAppearance +- SystemCapability.Base +- SystemCapability.BundleManager.BundleFramework +- SystemCapability.BundleManager.BundleFramework.Overlay +- SystemCapability.BundleManager.DistributedBundleFramework +- SystemCapability.BundleManager.Zlib +- SystemCapability.Graphic.Graphic2D.EGL +- SystemCapability.Graphic.Graphic2D.GLES2 +- SystemCapability.Graphic.Graphic2D.GLES3 +- SystemCapability.Graphic.Graphic2D.WebGL +- SystemCapability.Window.SessionManager +- SystemCapability.WindowManager.WindowManager.Core +- SystemCapability.Notification.CommonEvent +- SystemCapability.Notification.Notification +- SystemCapability.Notification.ReminderAgent +- SystemCapability.Notification.NotificationSettings +- SystemCapability.Notification.Emitter +- SystemCapability.Communication.IPC.Core +- SystemCapability.Communication.SoftBus.Core +- SystemCapability.Communication.NetManager.Core +- SystemCapability.Communication.NetManager.Ethernet +- SystemCapability.Communication.NetManager.NetSharing +- SystemCapability.Communication.NetManager.MDNS +- SystemCapability.Communication.NetManager.Vpn +- SystemCapability.Communication.NetStack +- SystemCapability.Communication.WiFi.Core +- SystemCapability.Communication.WiFi.STA +- SystemCapability.Communication.WiFi.AP.Core +- SystemCapability.Communication.WiFi.P2P +- SystemCapability.Communication.Bluetooth.Core +- SystemCapability.Location.Location.Core +- SystemCapability.Location.Location.Geocoder +- SystemCapability.Location.Location.Geofence +- SystemCapability.Location.Location.Gnss +- SystemCapability.MultimodalInput.Input.Core +- SystemCapability.MultimodalInput.Input.InputDevice +- SystemCapability.MultimodalInput.Input.InputMonitor +- SystemCapability.MultimodalInput.Input.InputConsumer +- SystemCapability.MultimodalInput.Input.InputSimulator +- SystemCapability.MultimodalInput.Input.Pointer +- SystemCapability.MultimodalInput.Input.ShortKey +- SystemCapability.PowerManager.BatteryManager.Extension +- SystemCapability.PowerManager.DisplayPowerManager +- SystemCapability.PowerManager.ThermalManager +- SystemCapability.PowerManager.PowerManager.Core +- SystemCapability.PowerManager.BatteryManager.Core +- SystemCapability.PowerManager.PowerManager.Extension +- SystemCapability.Multimedia.Media.Core +- SystemCapability.Multimedia.Media.AudioPlayer +- SystemCapability.Multimedia.Media.AudioRecorder +- SystemCapability.Multimedia.Media.VideoPlayer +- SystemCapability.Multimedia.Media.VideoRecorder +- SystemCapability.Multimedia.Media.CodecBase +- SystemCapability.Multimedia.Media.AudioCodec +- SystemCapability.Multimedia.Media.AudioDecoder +- SystemCapability.Multimedia.Media.AudioEncoder +- SystemCapability.Multimedia.Media.VideoDecoder +- SystemCapability.Multimedia.Media.VideoEncoder +- SystemCapability.Multimedia.Media.Spliter +- SystemCapability.Multimedia.Media.Muxer +- SystemCapability.Multimedia.Media.AVPlayer +- SystemCapability.Multimedia.Media.AVRecorder +- SystemCapability.Multimedia.Media.AVMetadataExtractor +- SystemCapability.Multimedia.Media.AVImageGenerator +- SystemCapability.Multimedia.Media.AVTranscoder +- SystemCapability.Multimedia.AVSession.Core +- SystemCapability.Multimedia.AVSession.Manager +- SystemCapability.Multimedia.AVSession.AVCast +- SystemCapability.Multimedia.Audio.Core +- SystemCapability.Multimedia.Audio.Renderer +- SystemCapability.Multimedia.Audio.Capturer +- SystemCapability.Multimedia.Audio.Device +- SystemCapability.Multimedia.Audio.Volume +- SystemCapability.Multimedia.Audio.Communication +- SystemCapability.Multimedia.Audio.Interrupt +- SystemCapability.Multimedia.Audio.Tone +- SystemCapability.Multimedia.Audio.PlaybackCapture +- SystemCapability.Multimedia.Camera.Core +- SystemCapability.Multimedia.Drm.Core +- SystemCapability.Multimedia.Image.Core +- SystemCapability.Multimedia.Image.ImageSource +- SystemCapability.Multimedia.Image.ImagePacker +- SystemCapability.Multimedia.Image.ImageReceiver +- SystemCapability.Multimedia.ImageEffect.Core +- SystemCapability.Multimedia.MediaLibrary.Core +- SystemCapability.Multimedia.MediaLibrary.DistributedCore +- SystemCapability.Multimedia.SystemSound.Core +- SystemCapability.Global.I18n +- SystemCapability.Global.ResourceManager +- SystemCapability.Customization.ConfigPolicy +- SystemCapability.Customization.CustomConfig +- SystemCapability.Customization.EnterpriseDeviceManager +- SystemCapability.BarrierFree.Accessibility.Core +- SystemCapability.BarrierFree.Accessibility.Vision +- SystemCapability.BarrierFree.Accessibility.Hearing +- SystemCapability.ResourceSchedule.WorkScheduler +- SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask +- SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask +- SystemCapability.ResourceSchedule.UsageStatistics.App +- SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +- SystemCapability.Utils.Lang +- SystemCapability.HiviewDFX.HiLog +- SystemCapability.HiviewDFX.HiTrace +- SystemCapability.HiviewDFX.Hiview.FaultLogger +- SystemCapability.HiviewDFX.Hiview.LogLibrary +- SystemCapability.HiviewDFX.HiChecker +- SystemCapability.HiviewDFX.HiDumper +- SystemCapability.HiviewDFX.HiAppEvent +- SystemCapability.HiviewDFX.HiSysEvent +- SystemCapability.HiviewDFX.HiProfiler.HiDebug +- SystemCapability.HiviewDFX.HiCollie +- SystemCapability.Update.UpdateService +- SystemCapability.DistributedHardware.DeviceManager +- SystemCapability.Security.DeviceAuth +- SystemCapability.Security.DataTransitManager +- SystemCapability.Security.DeviceSecurityLevel +- SystemCapability.Security.Huks.Core +- SystemCapability.Security.Huks.Extension +- SystemCapability.Security.Asset +- SystemCapability.Security.AccessToken +- SystemCapability.Security.SecurityGuard +- SystemCapability.Security.ScreenLockFileManager +- SystemCapability.Account.OsAccount +- SystemCapability.Account.AppAccount +- SystemCapability.UserIAM.UserAuth.Core +- SystemCapability.UserIAM.UserAuth.PinAuth +- SystemCapability.MiscServices.InputMethodFramework +- SystemCapability.MiscServices.Pasteboard +- SystemCapability.MiscServices.Time +- SystemCapability.MiscServices.Wallpaper +- SystemCapability.MiscServices.ScreenLock +- SystemCapability.MiscServices.Upload +- SystemCapability.MiscServices.Download +- SystemCapability.FileManagement.StorageService.Backup +- SystemCapability.FileManagement.StorageService.SpatialStatistics +- SystemCapability.FileManagement.StorageService.Volume +- SystemCapability.FileManagement.StorageService.Encryption +- SystemCapability.FileManagement.File.FileIO +- SystemCapability.FileManagement.File.Environment +- SystemCapability.FileManagement.File.DistributedFile +- SystemCapability.FileManagement.AppFileService +- SystemCapability.FileManagement.UserFileService +- SystemCapability.FileManagement.UserFileManager.Core +- SystemCapability.FileManagement.PhotoAccessHelper.Core +- SystemCapability.FileManagement.DistributedFileService.CloudSyncManager +- SystemCapability.FileManagement.DistributedFileService.CloudSync.Core +- SystemCapability.USB.USBManager +- SystemCapability.Sensors.Sensor +- SystemCapability.Sensors.MiscDevice +- SystemCapability.Startup.SystemInfo +- SystemCapability.DistributedDataManager.RelationalStore.Core +- SystemCapability.DistributedDataManager.CommonType +- SystemCapability.DistributedDataManager.KVStore.Core +- SystemCapability.DistributedDataManager.KVStore.DistributedKVStore +- SystemCapability.DistributedDataManager.DataObject.DistributedObject +- SystemCapability.DistributedDataManager.Preferences.Core +- SystemCapability.DistributedDataManager.DataShare.Core +- SystemCapability.DistributedDataManager.DataShare.Consumer +- SystemCapability.DistributedDataManager.DataShare.Provider +- SystemCapability.DistributedDataManager.CloudSync.Config +- SystemCapability.DistributedDataManager.CloudSync.Client +- SystemCapability.DistributedDataManager.CloudSync.Server +- SystemCapability.Ability.AbilityBase +- SystemCapability.Ability.AbilityRuntime.Core +- SystemCapability.Ability.AbilityRuntime.FAModel +- SystemCapability.Ability.AbilityRuntime.AbilityCore +- SystemCapability.Ability.AbilityRuntime.Mission +- SystemCapability.Ability.AbilityTools.AbilityAssistant +- SystemCapability.Ability.Form +- SystemCapability.Ability.DistributedAbilityManager +- SystemCapability.Applications.CalendarData +- SystemCapability.Applications.Settings.Core +- SystemCapability.Test.UiTest +- SystemCapability.Web.Webview.Core +- SystemCapability.Advertising.OAID +- SystemCapability.Advertising.Ads +- SystemCapability.Security.CertificateManager +- SystemCapability.Security.CertificateManagerDialog +- SystemCapability.Security.CryptoFramework +- SystemCapability.Security.CryptoFramework.Key +- SystemCapability.Security.CryptoFramework.Key.SymKey +- SystemCapability.Security.CryptoFramework.Key.AsymKey +- SystemCapability.Security.CryptoFramework.Signature +- SystemCapability.Security.CryptoFramework.Cipher +- SystemCapability.Security.CryptoFramework.KeyAgreement +- SystemCapability.Security.CryptoFramework.MessageDigest +- SystemCapability.Security.CryptoFramework.Mac +- SystemCapability.Security.CryptoFramework.Kdf +- SystemCapability.Security.CryptoFramework.Rand +- SystemCapability.Security.Cert +- SystemCapability.BundleManager.BundleFramework.Core +- SystemCapability.BundleManager.BundleFramework.FreeInstall +- SystemCapability.BundleManager.BundleFramework.Resource +- SystemCapability.BundleManager.BundleFramework.DefaultApp +- SystemCapability.BundleManager.BundleFramework.Launcher +- SystemCapability.BundleManager.BundleFramework.AppControl +- SystemCapability.Ability.AbilityRuntime.QuickFix +- SystemCapability.Graphic.Graphic2D.ColorManager.Core +- SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply +- SystemCapability.Request.FileTransferAgent +- SystemCapability.ResourceSchedule.DeviceStandby +- SystemCapability.DistributedDataManager.UDMF.Core +- SystemCapability.Multimedia.Media.AVScreenCapture +- SystemCapability.Multimedia.Media.SoundPool +- SystemCapability.Multimedia.Audio.Spatialization +- SystemCapability.Multimedia.AudioHaptic.Core +- SystemCapability.ArkUi.Graphics3D +- SystemCapability.Graphics.Drawing +- SystemCapability.Graphic.Graphic2D.NativeDrawing +- SystemCapability.XTS.DeviceAttest +- SystemCapability.Developtools.Syscap +- SystemCapability.Resourceschedule.Ffrt.Core +- SystemCapability.Graphic.Graphic2D.NativeWindow +- SystemCapability.Graphic.Graphic2D.NativeBuffer +- SystemCapability.Graphic.Graphic2D.NativeImage +- SystemCapability.Graphic.Graphic2D.NativeVsync +- SystemCapability.Graphic.Vulkan +- SystemCapability.Multimedia.Image.ImageCreator +- SystemCapability.Graphic.Graphic2D.WebGL2 +- SystemCapability.Ability.AppStartup +- SystemCapability.Ability.AppExtension.PhotoEditorExtension diff --git a/en/application-dev/reference/tv-syscap-list.md b/en/application-dev/reference/tv-syscap-list.md new file mode 100644 index 0000000000000000000000000000000000000000..a3b2e0f0fb88da56cb039f44a44b66dacb2700ae --- /dev/null +++ b/en/application-dev/reference/tv-syscap-list.md @@ -0,0 +1,206 @@ +# SystemCapability List + +SystemCapability (SysCap) is a standalone feature in the operating system. + +Before using an API for development, you are advised to familiarize yourself with [SysCap](syscap.md), and then consult the following tables to see whether the SysCap set required for the API is supported by the target device type. + +> **NOTE** +> +> This list outlines the minimum system capabilities supported by the current version of TVs. You can refer to the **tv.json** file in the SDK for details. +> When developing applications for the current version of TVs using the APIs corresponding to the system capabilities listed, you can call these APIs directly without needing to perform a **canIUse()** check beforehand. + +- SystemCapability.Ability.AbilityBase +- SystemCapability.Ability.AbilityRuntime.AbilityCore +- SystemCapability.Ability.AbilityRuntime.Core +- SystemCapability.Ability.AbilityRuntime.FAModel +- SystemCapability.Ability.AbilityRuntime.Mission +- SystemCapability.Ability.AbilityRuntime.QuickFix +- SystemCapability.Ability.AbilityTools.AbilityAssistant +- SystemCapability.Ability.AppExtension.PhotoEditorExtension +- SystemCapability.Ability.AppStartup +- SystemCapability.Security.AccessToken +- SystemCapability.Security.ScreenLockFileManager +- SystemCapability.BarrierFree.Accessibility.Core +- SystemCapability.BarrierFree.Accessibility.Hearing +- SystemCapability.BarrierFree.Accessibility.Vision +- SystemCapability.ArkUI.ArkUI.Full +- SystemCapability.FileManagement.AppFileService +- SystemCapability.FileManagement.AppFileService.FolderAuthorization +- SystemCapability.FileManagement.StorageService.Backup +- SystemCapability.Multimedia.Audio.Capturer +- SystemCapability.Multimedia.Audio.Communication +- SystemCapability.Multimedia.Audio.Core +- SystemCapability.Multimedia.Audio.Device +- SystemCapability.Multimedia.Audio.Interrupt +- SystemCapability.Multimedia.Audio.PlaybackCapture +- SystemCapability.Multimedia.Audio.Renderer +- SystemCapability.Multimedia.Audio.Spatialization +- SystemCapability.Multimedia.Audio.Tone +- SystemCapability.Multimedia.Audio.Volume +- SystemCapability.Multimedia.Media.AudioCodec +- SystemCapability.Multimedia.Media.AudioDecoder +- SystemCapability.Multimedia.Media.AudioEncoder +- SystemCapability.Multimedia.Media.CodecBase +- SystemCapability.Multimedia.Media.Muxer +- SystemCapability.Multimedia.Media.Spliter +- SystemCapability.Multimedia.Media.VideoDecoder +- SystemCapability.Multimedia.Media.VideoEncoder +- SystemCapability.Multimedia.AVSession.AVCast +- SystemCapability.Multimedia.AVSession.Core +- SystemCapability.Multimedia.AVSession.ExtendedDisplayCast +- SystemCapability.Multimedia.AVSession.Manager +- SystemCapability.Multimedia.AVSession.AVinputCast +- SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask +- SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply +- SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask +- SystemCapability.BundleManager.BundleFramework +- SystemCapability.BundleManager.BundleFramework.AppControl +- SystemCapability.BundleManager.BundleFramework.Core +- SystemCapability.BundleManager.BundleFramework.DefaultApp +- SystemCapability.BundleManager.BundleFramework.FreeInstall +- SystemCapability.BundleManager.BundleFramework.Launcher +- SystemCapability.BundleManager.BundleFramework.Overlay +- SystemCapability.BundleManager.BundleFramework.Resource +- SystemCapability.BundleManager.Zlib +- SystemCapability.Applications.CalendarData +- SystemCapability.Notification.CommonEvent +- SystemCapability.Customization.ConfigPolicy +- SystemCapability.Customization.CustomConfig +- SystemCapability.Security.CryptoFramework +- SystemCapability.Security.CryptoFramework.Cipher +- SystemCapability.Security.CryptoFramework.Kdf +- SystemCapability.Security.CryptoFramework.Key +- SystemCapability.Security.CryptoFramework.Key.AsymKey +- SystemCapability.Security.CryptoFramework.Key.SymKey +- SystemCapability.Security.CryptoFramework.KeyAgreement +- SystemCapability.Security.CryptoFramework.Mac +- SystemCapability.Security.CryptoFramework.MessageDigest +- SystemCapability.Security.CryptoFramework.Rand +- SystemCapability.Security.CryptoFramework.Signature +- SystemCapability.DistributedDataManager.DataObject.DistributedObject +- SystemCapability.DistributedDataManager.DataShare.Consumer +- SystemCapability.DistributedDataManager.DataShare.Core +- SystemCapability.DistributedDataManager.DataShare.Provider +- SystemCapability.XTS.DeviceAttest +- SystemCapability.DistributedHardware.DeviceManager +- SystemCapability.ResourceSchedule.DeviceStandby +- SystemCapability.ResourceSchedule.UsageStatistics.App +- SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +- SystemCapability.FileManagement.DistributedFileService.CloudSync.Core +- SystemCapability.FileManagement.DistributedFileService.CloudSyncManager +- SystemCapability.Notification.Notification +- SystemCapability.Notification.NotificationSettings +- SystemCapability.Notification.ReminderAgent +- SystemCapability.Multimedia.Drm.Core +- SystemCapability.Utils.Lang +- SystemCapability.Notification.Emitter +- SystemCapability.Resourceschedule.Ffrt.Core +- SystemCapability.Graphic.Graphic2D.ColorManager.Core +- SystemCapability.Graphic.Graphic2D.EGL +- SystemCapability.Graphic.Graphic2D.GLES2 +- SystemCapability.Graphic.Graphic2D.GLES3 +- SystemCapability.Graphic.Graphic2D.HyperGraphicManager +- SystemCapability.Graphic.Graphic2D.NativeBuffer +- SystemCapability.Graphic.Graphic2D.NativeDrawing +- SystemCapability.Graphic.Graphic2D.NativeImage +- SystemCapability.Graphic.Graphic2D.NativeVsync +- SystemCapability.Graphic.Graphic2D.NativeWindow +- SystemCapability.Graphic.Graphic2D.WebGL +- SystemCapability.Graphic.Graphic2D.WebGL2 +- SystemCapability.Graphic.Vulkan +- SystemCapability.Graphics.Drawing +- SystemCapability.HiviewDFX.HiAppEvent +- SystemCapability.HiviewDFX.HiChecker +- SystemCapability.HiviewDFX.HiCollie +- SystemCapability.HiviewDFX.HiDumper +- SystemCapability.HiviewDFX.HiLog +- SystemCapability.HiviewDFX.HiProfiler.HiDebug +- SystemCapability.HiviewDFX.HiSysEvent +- SystemCapability.HiviewDFX.HiTrace +- SystemCapability.HiviewDFX.Hiview.LogLibrary +- SystemCapability.Global.I18n +- SystemCapability.Multimedia.Image.Core +- SystemCapability.Multimedia.Image.ImageCreator +- SystemCapability.Multimedia.Image.ImagePacker +- SystemCapability.Multimedia.Image.ImageReceiver +- SystemCapability.Multimedia.Image.ImageSource +- SystemCapability.MiscServices.InputMethodFramework +- SystemCapability.MultimodalInput.Input.Cooperator +- SystemCapability.MultimodalInput.Input.Core +- SystemCapability.MultimodalInput.Input.InfraredEmitter +- SystemCapability.MultimodalInput.Input.InputConsumer +- SystemCapability.MultimodalInput.Input.InputDevice +- SystemCapability.MultimodalInput.Input.InputMonitor +- SystemCapability.MultimodalInput.Input.InputSimulator +- SystemCapability.MultimodalInput.Input.Pointer +- SystemCapability.MultimodalInput.Input.ShortKey +- SystemCapability.DistributedDataManager.KVStore.Core +- SystemCapability.DistributedDataManager.KVStore.DistributedKVStore +- SystemCapability.ArkUI.ArkUI.Libuv +- SystemCapability.FileManagement.PhotoAccessHelper.Core +- SystemCapability.FileManagement.UserFileManager.Core +- SystemCapability.FileManagement.UserFileManager.DistributedCore +- SystemCapability.Multimedia.MediaLibrary.Core +- SystemCapability.Multimedia.MediaLibrary.DistributedCore +- SystemCapability.Sensors.MiscDevice +- SystemCapability.ArkCompiler.JSVM +- SystemCapability.ArkUI.ArkUI.Napi +- SystemCapability.Communication.NetStack +- SystemCapability.Account.AppAccount +- SystemCapability.Account.OsAccount +- SystemCapability.Multimedia.AudioHaptic.Core +- SystemCapability.Multimedia.Media.AVImageGenerator +- SystemCapability.Multimedia.Media.AVMetadataExtractor +- SystemCapability.Multimedia.Media.AVPlayer +- SystemCapability.Multimedia.Media.AVRecorder +- SystemCapability.Multimedia.Media.AVScreenCapture +- SystemCapability.Multimedia.Media.AVTranscoder +- SystemCapability.Multimedia.Media.AudioPlayer +- SystemCapability.Multimedia.Media.AudioRecorder +- SystemCapability.Multimedia.Media.SoundPool +- SystemCapability.Multimedia.Media.VideoPlayer +- SystemCapability.Multimedia.Media.VideoRecorder +- SystemCapability.Multimedia.SystemSound.Core +- SystemCapability.PowerManager.PowerManager.Core +- SystemCapability.PowerManager.PowerManager.Extension +- SystemCapability.DistributedDataManager.Preferences.Core +- SystemCapability.DistributedDataManager.CloudSync.Client +- SystemCapability.DistributedDataManager.CloudSync.Config +- SystemCapability.DistributedDataManager.CloudSync.Server +- SystemCapability.DistributedDataManager.CommonType +- SystemCapability.DistributedDataManager.RelationalStore.Core +- SystemCapability.MiscServices.Download +- SystemCapability.MiscServices.Upload +- SystemCapability.Request.FileTransferAgent +- SystemCapability.Global.ResourceManager +- SystemCapability.ResourceSchedule.SystemLoad +- SystemCapability.Resourceschedule.BackgroundProcessManager +- SystemCapability.Sensors.Sensor +- SystemCapability.Applications.Settings.Core +- SystemCapability.FileManagement.StorageService.Encryption +- SystemCapability.FileManagement.StorageService.SpatialStatistics +- SystemCapability.FileManagement.StorageService.Volume +- SystemCapability.Developtools.Syscap +- SystemCapability.MiscServices.Time +- SystemCapability.DistributedDataManager.UDMF.Core +- SystemCapability.FileManagement.UserFileService +- SystemCapability.FileManagement.UserFileService.FolderSelection +- SystemCapability.Web.Webview.Core +- SystemCapability.Communication.WiFi.AP.Core +- SystemCapability.Communication.WiFi.AP.Extension +- SystemCapability.Communication.WiFi.Core +- SystemCapability.Communication.WiFi.STA +- SystemCapability.Communication.WiFi.P2P +- SystemCapability.WindowManager.WindowManager.Core +- SystemCapability.ResourceSchedule.WorkScheduler +- SystemCapability.Communication.NetManager.MDNS +- SystemCapability.Communication.NetManager.NetSharing +- SystemCapability.Communication.NetManager.Ethernet +- SystemCapability.Communication.NetManager.Vpn +- SystemCapability.Communication.NetManager.NetFirewall +- SystemCapability.Communication.NetManager.Core +- SystemCapability.Security.Asset +- SystemCapability.Communication.Bluetooth.Core +- SystemCapability.Security.Cert +- SystemCapability.Update.UpdateService +- SystemCapability.Window.SessionManager diff --git a/en/application-dev/reference/wearable-syscap-list.md b/en/application-dev/reference/wearable-syscap-list.md new file mode 100644 index 0000000000000000000000000000000000000000..1491d1aa734515b06769bdbb4e7625c3a0578a0d --- /dev/null +++ b/en/application-dev/reference/wearable-syscap-list.md @@ -0,0 +1,211 @@ +# SystemCapability List + +SystemCapability (SysCap) is a standalone feature in the operating system. + +Before using an API for development, you are advised to familiarize yourself with [SysCap](syscap.md), and then consult the following tables to see whether the SysCap set required for the API is supported by the target device type. + +> **NOTE** +> +> This list outlines the minimum system capabilities supported by the current version of wearables. You can refer to the **wearable.json** file in the SDK for details. +> When developing applications for the current version of wearables using the APIs corresponding to the system capabilities listed, you can call these APIs directly without needing to perform a **canIUse()** check beforehand. + +- SystemCapability.Ability.AbilityBase +- SystemCapability.Ability.AbilityRuntime.AbilityCore +- SystemCapability.Ability.AbilityRuntime.Core +- SystemCapability.Ability.AbilityRuntime.FAModel +- SystemCapability.Ability.AbilityRuntime.Mission +- SystemCapability.Ability.AbilityTools.AbilityAssistant +- SystemCapability.Ability.AppStartup +- SystemCapability.Security.AccessToken +- SystemCapability.BarrierFree.Accessibility.Core +- SystemCapability.BarrierFree.Accessibility.Hearing +- SystemCapability.BarrierFree.Accessibility.Vision +- SystemCapability.ArkUI.ArkUI.Circle +- SystemCapability.ArkUI.ArkUI.Full +- SystemCapability.FileManagement.AppFileService +- SystemCapability.FileManagement.StorageService.Backup +- SystemCapability.Security.Asset +- SystemCapability.Multimedia.Audio.Capturer +- SystemCapability.Multimedia.Audio.Communication +- SystemCapability.Multimedia.Audio.Core +- SystemCapability.Multimedia.Audio.Device +- SystemCapability.Multimedia.Audio.Interrupt +- SystemCapability.Multimedia.Audio.Renderer +- SystemCapability.Multimedia.Audio.Tone +- SystemCapability.Multimedia.Audio.Volume +- SystemCapability.Multimedia.Media.AudioCodec +- SystemCapability.Multimedia.Media.AudioDecoder +- SystemCapability.Multimedia.Media.AudioEncoder +- SystemCapability.Multimedia.Media.CodecBase +- SystemCapability.Multimedia.Media.Muxer +- SystemCapability.Multimedia.Media.Spliter +- SystemCapability.Multimedia.Media.VideoDecoder +- SystemCapability.Multimedia.Media.VideoEncoder +- SystemCapability.Multimedia.AVSession.Core +- SystemCapability.Multimedia.AVSession.Manager +- SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask +- SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply +- SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask +- SystemCapability.PowerManager.BatteryManager.Core +- SystemCapability.PowerManager.BatteryManager.Extension +- SystemCapability.PowerManager.BatteryStatistics +- SystemCapability.Communication.Bluetooth.Core +- SystemCapability.BundleManager.BundleFramework +- SystemCapability.BundleManager.BundleFramework.AppControl +- SystemCapability.BundleManager.BundleFramework.Core +- SystemCapability.BundleManager.BundleFramework.DefaultApp +- SystemCapability.BundleManager.BundleFramework.FreeInstall +- SystemCapability.BundleManager.BundleFramework.Launcher +- SystemCapability.BundleManager.BundleFramework.Overlay +- SystemCapability.BundleManager.BundleFramework.Resource +- SystemCapability.BundleManager.Zlib +- SystemCapability.Applications.CalendarData +- SystemCapability.Applications.Contacts +- SystemCapability.Telephony.CallManager +- SystemCapability.Telephony.CellularCall +- SystemCapability.Telephony.CellularData +- SystemCapability.Security.Cert +- SystemCapability.Notification.CommonEvent +- SystemCapability.Customization.ConfigPolicy +- SystemCapability.Customization.CustomConfig +- SystemCapability.Telephony.CoreService +- SystemCapability.Security.CryptoFramework +- SystemCapability.Security.CryptoFramework.Cipher +- SystemCapability.Security.CryptoFramework.Kdf +- SystemCapability.Security.CryptoFramework.Key +- SystemCapability.Security.CryptoFramework.Key.AsymKey +- SystemCapability.Security.CryptoFramework.Key.SymKey +- SystemCapability.Security.CryptoFramework.KeyAgreement +- SystemCapability.Security.CryptoFramework.Mac +- SystemCapability.Security.CryptoFramework.MessageDigest +- SystemCapability.Security.CryptoFramework.Rand +- SystemCapability.Security.CryptoFramework.Signature +- SystemCapability.DistributedDataManager.DataObject.DistributedObject +- SystemCapability.DistributedDataManager.DataShare.Consumer +- SystemCapability.DistributedDataManager.DataShare.Core +- SystemCapability.DistributedDataManager.DataShare.Provider +- SystemCapability.XTS.DeviceAttest +- SystemCapability.DistributedHardware.DeviceManager +- SystemCapability.ResourceSchedule.DeviceStandby +- SystemCapability.ResourceSchedule.UsageStatistics.App +- SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +- SystemCapability.PowerManager.DisplayPowerManager +- SystemCapability.PowerManager.DisplayPowerManager.Lite +- SystemCapability.BundleManager.DistributedBundleFramework +- SystemCapability.DistributedHardware.DistributedHardwareFWK +- SystemCapability.Notification.Notification +- SystemCapability.Notification.ReminderAgent +- SystemCapability.Ability.DistributedAbilityManager +- SystemCapability.Multimedia.Drm.Core +- SystemCapability.Utils.Lang +- SystemCapability.Notification.Emitter +- SystemCapability.Resourceschedule.Ffrt.Core +- SystemCapability.Ability.Form +- SystemCapability.Graphic.Graphic2D.EGL +- SystemCapability.Graphic.Graphic2D.GLES2 +- SystemCapability.Graphic.Graphic2D.GLES3 +- SystemCapability.Graphic.Graphic2D.NativeBuffer +- SystemCapability.Graphic.Graphic2D.NativeDrawing +- SystemCapability.Graphic.Graphic2D.NativeImage +- SystemCapability.Graphic.Graphic2D.NativeVsync +- SystemCapability.Graphic.Graphic2D.NativeWindow +- SystemCapability.Graphic.Graphic2D.WebGL +- SystemCapability.Graphic.Graphic2D.WebGL2 +- SystemCapability.Graphic.Vulkan +- SystemCapability.Graphics.Drawing +- SystemCapability.ArkUi.Graphics3D +- SystemCapability.HiviewDFX.HiAppEvent +- SystemCapability.HiviewDFX.HiChecker +- SystemCapability.HiviewDFX.HiCollie +- SystemCapability.HiviewDFX.HiDumper +- SystemCapability.HiviewDFX.HiLog +- SystemCapability.HiviewDFX.HiProfiler.HiDebug +- SystemCapability.HiviewDFX.HiSysEvent +- SystemCapability.HiviewDFX.HiTrace +- SystemCapability.HiviewDFX.Hiview.FaultLogger +- SystemCapability.HiviewDFX.Hiview.LogLibrary +- SystemCapability.Global.I18n +- SystemCapability.Multimedia.Image.Core +- SystemCapability.Multimedia.Image.ImageCreator +- SystemCapability.Multimedia.Image.ImagePacker +- SystemCapability.Multimedia.Image.ImageReceiver +- SystemCapability.Multimedia.Image.ImageSource +- SystemCapability.MiscServices.InputMethodFramework +- SystemCapability.MultimodalInput.Input.Core +- SystemCapability.MultimodalInput.Input.InputConsumer +- SystemCapability.MultimodalInput.Input.InputDevice +- SystemCapability.MultimodalInput.Input.InputMonitor +- SystemCapability.MultimodalInput.Input.InputSimulator +- SystemCapability.MultimodalInput.Input.ShortKey +- SystemCapability.DistributedDataManager.KVStore.Core +- SystemCapability.DistributedDataManager.KVStore.DistributedKVStore +- SystemCapability.ArkUI.ArkUI.Libuv +- SystemCapability.Sensors.MiscDevice +- SystemCapability.ArkCompiler.JSVM +- SystemCapability.ArkUI.ArkUI.Napi +- SystemCapability.Communication.NetManager.Core +- SystemCapability.Communication.NetManager.Ethernet +- SystemCapability.Communication.NetManager.MDNS +- SystemCapability.Communication.NetManager.NetSharing +- SystemCapability.Communication.NetManager.Vpn +- SystemCapability.Communication.NetStack +- SystemCapability.Account.AppAccount +- SystemCapability.Account.OsAccount +- SystemCapability.MiscServices.Pasteboard +- SystemCapability.UserIAM.UserAuth.PinAuth +- SystemCapability.Multimedia.AudioHaptic.Core +- SystemCapability.Multimedia.Media.AVImageGenerator +- SystemCapability.Multimedia.Media.AVMetadataExtractor +- SystemCapability.Multimedia.Media.AVPlayer +- SystemCapability.Multimedia.Media.AVRecorder +- SystemCapability.Multimedia.Media.AVScreenCapture +- SystemCapability.Multimedia.Media.AudioPlayer +- SystemCapability.Multimedia.Media.AudioRecorder +- SystemCapability.Multimedia.Media.SoundPool +- SystemCapability.Multimedia.Media.VideoPlayer +- SystemCapability.Multimedia.Media.VideoRecorder +- SystemCapability.Multimedia.SystemSound.Core +- SystemCapability.PowerManager.PowerManager.Core +- SystemCapability.PowerManager.PowerManager.Extension +- SystemCapability.DistributedDataManager.Preferences.Core +- SystemCapability.DistributedDataManager.CloudSync.Client +- SystemCapability.DistributedDataManager.CloudSync.Config +- SystemCapability.DistributedDataManager.CloudSync.Server +- SystemCapability.DistributedDataManager.CommonType +- SystemCapability.DistributedDataManager.RelationalStore.Core +- SystemCapability.MiscServices.Download +- SystemCapability.MiscServices.Upload +- SystemCapability.Request.FileTransferAgent +- SystemCapability.Global.ResourceManager +- SystemCapability.ResourceSchedule.SystemLoad +- SystemCapability.MiscServices.ScreenLock +- SystemCapability.Security.SecurityGuard +- SystemCapability.Sensors.Sensor +- SystemCapability.Applications.Settings.Core +- SystemCapability.Telephony.SmsMms +- SystemCapability.Telephony.StateRegistry +- SystemCapability.FileManagement.StorageService.Encryption +- SystemCapability.FileManagement.StorageService.SpatialStatistics +- SystemCapability.FileManagement.StorageService.Volume +- SystemCapability.Developtools.Syscap +- SystemCapability.PowerManager.ThermalManager +- SystemCapability.MiscServices.Time +- SystemCapability.DistributedDataManager.UDMF.Core +- SystemCapability.ArkUI.UiAppearance +- SystemCapability.Update.UpdateService +- SystemCapability.UserIAM.UserAuth.Core +- SystemCapability.FileManagement.UserFileService +- SystemCapability.Web.Webview.Core +- SystemCapability.WindowManager.WindowManager.Core +- SystemCapability.ResourceSchedule.WorkScheduler +- SystemCapability.Applications.ContactsData +- SystemCapability.Communication.NFC.Core +- SystemCapability.Communication.NFC.CardEmulation +- SystemCapability.Communication.WiFi.STA +- SystemCapability.Communication.WiFi.AP.Core +- SystemCapability.Communication.WiFi.P2P +- SystemCapability.Communication.WiFi.Core +- SystemCapability.Communication.WiFi.AP.Extension +- SystemCapability.Location.Location.Core +- SystemCapability.Location.Location.Gnss +- SystemCapability.Test.UiTest diff --git a/en/application-dev/website.md b/en/application-dev/website.md index ff8b276555ef6bbba4ac8b661c493fa4edcd837b..a1ed68993bf8f04e7fd9d8c5d5108ebae7a43de2 100644 --- a/en/application-dev/website.md +++ b/en/application-dev/website.md @@ -4596,7 +4596,7 @@ - [JSVM_ScriptOrigin](reference/common/_j_s_v_m___script_origin.md) - [JSVM_TypeTag](reference/common/_j_s_v_m___type_tag.md) - [JSVM_VMInfo](reference/common/_j_s_v_m___v_m_info.md) - - Standard Library + - Native API Standard Libraries - [libc](reference/native-lib/musl.md) - [libc++](reference/native-lib/cpp.md) - [Node-API](reference/native-lib/napi.md) @@ -4620,8 +4620,8 @@ - [VkNativeBufferUsageOHOS](reference/native-lib/_vk_native_buffer_usage_o_h_o_s.md) - [VkSurfaceCreateInfoOHOS](reference/native-lib/_vk_surface_create_info_o_h_o_s.md) - Appendix - - [libc Symbols Not Exported](reference/native-lib/musl-peculiar-symbol.md) - - [Restricted musl libc APIs](reference/native-lib/guidance-on-ndk-libc-interfaces-affected-by-permissions.md) - - [EGL Symbols Exported](reference/native-lib/egl-symbol.md) + - [Native API Symbols Not Exported](reference/native-lib/musl-peculiar-symbol.md) + - [NDK-Related musl libc Interface Usage Restrictions](reference/native-lib/guidance-on-ndk-libc-interfaces-affected-by-permissions.md) + - [EGL Symbols Exported from Native APIs](reference/native-lib/egl-symbol.md) - [ICU4C Symbols Exported from Native APIs](reference/native-lib/icu4c-symbol.md) - - [OpenGL ES 3.2 Symbols Exported](reference/native-lib/openglesv3-symbol.md) + - [OpenGL ES 3.2 Symbols Exported from Native APIs](reference/native-lib/openglesv3-symbol.md)