deviceInfoListOnline = DeviceManager.getDmsDeviceList(DeviceInfo.FLAG_GET_ONLINE_DEVICE);
- String remote_device_id;
- if (deviceInfoListOnline.size() > 0)
- {
- remote_device_id = deviceInfoListOnline[0].GetDeviceId(); // Obtain the ID of the first device in the online device list.
- }
- ```
-
-3. Create a **Want** instance. You should first create an **ElementName** object with **deviceId**, **bundleName**, **abilityName** specified and add this object to the **Want** instance. Then, set the multi-device startup flag **Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE** to the **Want** instance to enable remote FA startup.
-
- ```
- // Import related header files.
- import ohos.aafwk.ability.Ability;
- import ohos.aafwk.content.Want;
- import ohos.bundle.ElementName;
-
- // Start the remote FA on the secondary device.
- Want want = new Want(); // Create a Want instance that encapsulates information about the remote FA to start.
- // Use the device ID obtained in step 2 and specify the FA information.
- ElementName name = new ElementName(remote_device_id, "com.huawei.remote_package_name", "remote_class_name");
- want.setElement(name); // Add information about the target FA for startup to the Want instance.
- want.setFlags(Want.FLAG_ABILITYSLICE_MULTI_DEVICE); // Set the multi-device startup flag. If this flag is not set, remote FA startup will be unavailable.
- startAbility(want); // Start the specified FA based on the want parameter. If the name and type of the want parameter are different from those used in the IDE, use the parameter name and type in the IDE.
- ```
-
-
diff --git a/en/device-dev/subsystems/subsys-security-huks-guide.md b/en/device-dev/subsystems/subsys-security-huks-guide.md
index 3f315b54ce4e2b57b03b89c1a4b9828ba2b0932a..d9cd48403f47fda888f4c27ab43cc96a36ad87e6 100644
--- a/en/device-dev/subsystems/subsys-security-huks-guide.md
+++ b/en/device-dev/subsystems/subsys-security-huks-guide.md
@@ -1,159 +1,213 @@
-# Development on HUKS
+# HUKS Development
## Overview
-### Introduction
+### HUKS
-OpenHarmony Universal KeyStore (HUKS) provides system-level key management capabilities, ensuring secure management and use of keys throughout their lifecycle (generation, storage, use, and destruction). The environment where a key is stored and used is of the most importance to key security. For example, the key in plaintext must be used in a secure environment, such as a Trusted Execution Environment (TEE) or security chip. This document describes how to configure a secure environment based on the HUKS architecture and how to verify the configuration.
+OpenHarmony Universal KeyStore (HUKS) provides lifecycle key management from key generation, storage, use to destruction and attestation for the keys stored in the HUKS. In the HUKS hierarchical architecture, the HUKS core layer (HUKS Core) at the bottom implements key management functions and runs in a secure hardware environment, such as a Trusted Execution Environment (TEE) or secure chipset. The implementation of the HUKS core layer varies depending on the secure hardware environment of the vendor. To ensure consistency of the architecture and interfaces between the service layer and application layer, the HUKS core layer defines a set of Hardware Device Interface (HDI) APIs.
-HUKS supports key lifecycle management, which covers the following:
+This document describes how to develop the HUKS core layer functions using the HUKS HDI APIs.
-- Key generation and import
+The HUKS core layer is supposed to support the following functions:
-- Key storage
+- Generation of keys.
-- Key use (including encryption and decryption, signing and verification, key derivation and agreement, hash, and key access control)
+- Import of keys.
-- Key destruction
+- Key operations, including encryption and decryption, signing and signature verification, key derivation, key agreement, and generation of message authentication codes (MACs).
-### Basic Concepts
+- Key access control.
+
+- Key attestation.
-- HUKS Service
+- Export of the public key from a chipset.
- An independent OpenHarmony service that supports key management. It belongs to the huks_service process. Instead of handling key calculation, the HUKS Service depends on the HUKS Core to provide services for the upper layer.
+### Basic Concepts
- HUKS Core
+
+ HUKS Core is a core component that implements functions, including cryptographic calculation of keys, encryption and decryption, and key access control. Generally, it runs in a secure environment (such as a TEE or secure chipset) of a device to ensure that the keys in plaintext are never exposed outside the HUKS Core.
+
+- Key session
+
+ A key session holds the key information, including the key operation data, key properties, and access control attributes, when a key is used. You need to pass in a key alias to create a session for the key. The HUKS generates a globally unique handle for each session. A general key operation involves creating a session, passing in data and parameters, and finishing the session (or aborting the session).
- A functional module that provides the key management service. This module must run in a secure environment, and the keys in plaintext must be kept inside the HUKS Core module throughout the lifecycle.
- TEE
- A secure area created by isolating software and hardware resources to protect the applications and data in the secure area from unauthorized access. This isolation mechanism yields two execution environments: TEE and Rich Execution Environment (REE). Each execution environment has independent internal data path and memory, protecting the data inside the TEEs from being disclosed. The applications in an REE cannot access resources in a TEE. The applications in a TEE cannot access resources in another TEE without authorization.
+ A TEE is a secure area created by isolating software and hardware resources to protect the applications and data in the secure area from unauthorized access. This isolation mechanism yields two execution environments: TEE and Rich Execution Environment (REE). Each execution environment has independent internal data path and memory, protecting the data inside the TEE from being disclosed. The applications in an REE cannot access resources in a TEE. The applications in a TEE cannot access resources in another TEE without authorization.
+
+
+## Working Principles
+
+The HUKS is divided into the following layers:
+
+- Application layer: provides APIs for applications.
+- Service layer: processes key management requests from applications and performs key ciphertext management, identity verification, and key session management.
+- Core layer: implements core functions, such as key generation, key operations, key access control, and key attestation.
+
+**Figure 1** HUKS architecture
-- Init-Update-Finish
+
- **Init**: initializes data for a key operation.
+## Constraints
- **Update**: operates data by segment and returns the result, or appends data.
+ - Keys in a secure environment in lifecycle
- **Finish**: finalizes the **Update** operation, and returns the result.
+ In the lifecycle of a key, the plaintext will never be exposed outside the HUKS Core. For the devices with a TEE or secure chipset, the HUKS Core runs in the TEE or secure chipset. This prevents the key plaintext from being disclosed even if the REE is cracked. That is why the key materials used in all HUKS passthrough HDI APIs are in ciphertext.
-### Working Principles
+- Encrypted keys for storage
-The following uses the key generation process as an example to describe the communication between the HUKS Service and HUKS Core. Other key operations are similar.
-The upper-layer application invokes the HUKS Service through the key management SDK. The HUKS Service invokes the HUKS Core, which invokes the key management module to generate a key. The HUKS Core uses a work key derived from the root key to encrypt the generated key and sends the encrypted key to the HUKS Service. The HUKS Service stores the encrypted key in a file.
+ The service keys are encrypted based on the device root key. If supported by the device, certain keys can be further protected by a password.
-
+- Strict access control over keys
-### Constraints
+ Only authorized services can access keys. For security-critical services, user identity authentication can be enabled for key access.
+
+- Key attestation
-* HUKS must be implemented in a TEE for security purposes.
+ The HUKS provides attestation for hardware-backed key storage. It proves that the key has not been tampered with, is stored in the hardware-backed HUKS Core, and has correct key properties.
-* The certificate chain returned by **HuksHdiAttestKey** must be in the sequence of the application certificate, device certificate, CA certificate, and root certificate, with the certificate length added before each certificate. The certificate chain and its length are assembled in the binary large object (BLOB) format. If you want to define the certificate format, the format must be the same as that parsed by the server.
+- Key material format
+
+ When a key (key pair, public key, or private key) is imported or exported, the key material format must meet HUKS requirements. For details, see [Key Material Formats](../../application-dev/security/huks-appendix.md#key-material-formats).
-
+- Certificate chain format
-* The key returned by the API must be assembled into a **KeyBlob** based on the key storage status. For details about the APIs that must comply with this constraint, see [Available APIs](#available-apis).
+ The certificate chain returned by **AttestKey()** must be assembled in the sequence of the application certificate, device certificate, CA certificate, and root certificate, with the certificate length added before each certificate. The certificate chain and its length are in the binary large object (BLOB) format. If you want to define the certificate format, the format must be the same as that parsed by the server.
- The **KeyBlob** stores both the key and its attributes. The figure below shows the **KeyBlob** structure. For details about how to construct a **KeyBlob**, see [hks_keyblob.c/HksBuildKeyBlob](https://gitee.com/openharmony/security_huks/blob/master/services/huks_standard/huks_engine/main/core/src/hks_keyblob.c).
+ 
-
+- KeyBlob
+
-## Development Guidelines
+The key returned by the APIs must be assembled into a **KeyBlob** based on the key storage status. For details about the APIs that must comply with this constraint, see [Available APIs](#available-apis).
+
+ 
+
+## How to Develop
### When to Use
-The HUKS Core provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations. If you want to replace the HUKS Core with your own implementation, you need to implement the following APIs:
+The HUKS Core provides KeyStore capabilities for applications, including key management and cryptographic operations. If you want to replace the HUKS Core with your own implementation, you need to implement the following APIs.
### Available APIs
**Table 1** Available APIs
-| API | Description | Constraints | Corresponding JS API |
+| API | Description | Constraints | JS API |
| ------------------------------------------------------------ | ---------------------------------------- | ----------------------------- | ------------------------------------------------------------ |
-| [HuksHdiModuleInit()](#hukshdimoduleinit) | Initializes the HUKS Core. | – | –|
-| [HuksHdiRefresh()](#hukshdirefresh) | Refreshes the root key. | – | –|
-| [HuksHdiGenerateKey()](#hukshdigeneratekey) | Generates a key. | The key generated must be in the **KeyBlob** format. |generateKey(keyAlias: string, options: HuksOptions)|
-| [HuksHdiImportKey()](#hukshdiimportkey) | Imports a key in plaintext. | The output parameter must be in the **KeyBlob** format. | importKey(keyAlias: string, options: HuksOptions)|
-| [HuksHdiImportWrappedKey()](#hukshdiimportwrappedkey) |Imports an encrypted key. | The output parameter must be in the **KeyBlob** format. | importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions)|
-| [HuksHdiExportPublicKey()](#hukshdiexportpublickey) | Exports a public key. |– | exportKey(keyAlias: string, options: HuksOptions) |
-| [HuksHdiInit()](#hukshdiinit) | Initializes data for a key operation. This API is of the Init-Update-Final model. |– | init(keyAlias: string, options: HuksOptions) |
-| [HuksHdiUpdate()](#hukshdiupdate) | Operates data by segment or appends data for the key operation. This API is of the Init-Update-Final model. |The input parameter for signing and signature verification must be the raw data. | update(handle: number, token?: Uint8Array, options: HuksOptions) |
-| [HuksHdiFinish()](#hukshdifinish) | Finalizes the key operation. This API is of the Init-Update-Final model. |The input parameter for signing and signature verification must be the signed data. | finish(handle: number, options: HuksOptions) |
-| [HuksHdiAbort()](#hukshdiabort) | Aborts Init-Update-Finish. |– | abort(handle: number, options: HuksOptions) |
-| [HuksHdiGetKeyProperties()](#hukshdigetkeyproperties) | Obtains key properties. |– | getKeyProperties(keyAlias: string, options: HuksOptions)|
-| [HuksHdiAttestKey()](#hukshdiattestkey) | Obtains the key certificate. |The output parameter must be in the **certChain** format. | attestKey(keyAlias: string, options: HuksOptions)|
-| [HuksHdiExportChipsetPlatformPublicKey()](#hukshdiexportchipsetplatformpublickey) | Exports the public key of a chipset key pair. | The output parameters are the raw data of ECC P-256 x-axis and y-axis values, each of which are of 32 bytes. | –|
-| [HuksHdiUpgradeKey()](#hukshdiupgradekey) | Updates the key file. | – | –|
+| [ModuleInit()](#moduleinit) | Initializes the HUKS Core. | N/A | N/A|
+| [ModuleDestroy()](#moduledestroy) | Destroys the HUKS Core. | N/A | N/A|
+| [GenerateKey()](#generatekey) | Generates a key based on the cryptographic algorithm parameters. | The key output must be in the **KeyBlob** format. |generateKey(keyAlias: string, options: HuksOptions)|
+| [ImportKey()](#importkey) | Imports a key in plaintext. | The key output must be in the **KeyBlob** format. | importKey(keyAlias: string, options: HuksOptions)|
+| [ImportWrappedKey()](#importwrappedkey) |Imports a wrapped (encrypted) key. | The key output must be in the **KeyBlob** format. | importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions)|
+| [ExportPublicKey()](#exportpublickey) | Exports the public key of a key pair. |N/A | exportKey(keyAlias: string, options: HuksOptions) |
+| [Init()](#init) | Initializes a key session. This API returns a key session handle and an authentication token (optional). |N/A | init(keyAlias: string, options: HuksOptions) |
+| [Update()](#update) | Updates key operation data. |The input parameters for signature verification must be the raw data. | update(handle: number, token?: Uint8Array, options: HuksOptions) |
+| [Finish()](#finish) | Finishes a key session. |The input parameter for signature verification must be the signed data. | finish(handle: number, options: HuksOptions) |
+| [Abort()](#abort) | Aborts a key session. |N/A | abort(handle: number, options: HuksOptions) |
+| [CheckKeyValidity()](#checkkeyvalidity) | Checks the key material (ciphertext) validity. |N/A | N/A|
+| [AttestKey()](#attestkey) | Attests a key. |The output parameter must be in the certificate chain format. | attestKey(keyAlias: string, options: HuksOptions)|
+| [ExportChipsetPlatformPublicKey()](#exportchipsetplatformpublickey) | Exports the public key of a chipset key pair. | The output parameters are the raw data of ECC P-256 x-axis and y-axis values, each of which are of 32 bytes. | N/A|
+| [UpgradeKey()](#upgradekey) | Updates the key file. | N/A | N/A|
+| [GenerateRandom()](#generaterandom) | Generates a random number. | N/A | N/A|
+| [Encrypt()](#encrypt) | Encrypts data. | N/A | N/A|
+| [Decrypt()](#decrypt) | Decrypts data. | N/A | N/A|
+| [Sign()](#sign) | Signs data. | N/A | N/A|
+| [Verify()](#verify) | Verifies a signature. | N/A | N/A|
+| [AgreeKey()](#agreekey) | Performs key agreement. | N/A | N/A|
+| [DeriveKey()](#derivekey) | Derives a key. | N/A | N/A|
+| [Mac()](#mac) | Generates a MAC. | N/A | N/A|
- - -
-#### HuksHdiModuleInit
+#### ModuleInit
**API Description**
-Initializes the HUKS Core, including the lock, encryption algorithm library, authtoken key, and root key.
+Initializes the HUKS Core. You can use this API to initialize global variables, such as the global thread locks, algorithm library, and the AuthToken key and root key used for access control.
**Prototype**
-int32_t HuksHdiModuleInit();
+int32_t ModuleInit(struct IHuks *self);
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+
Return Value
- - **HKS_SUCCESS**: The operation is successful.
+ - **HKS_SUCCESS** (the value is **0**): The operation is successful.
- - Other value: The operation failed.
+ - Other values (negative number): The operation fails. For details, see HksErrorCode.
- - -
-#### HuksHdiRefresh
+
+#### ModuleDestroy
**API Description**
-Refreshes the root key.
+Destroys the HUKS Core. You can use this API to release global variables including the locks and destroy the AuthToken key and root key in the memory.
**Prototype**
-int32_t HuksHdiRefresh();
+int32_t ModuleDestroy(struct IHuks *self);
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+
Return Value
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiGenerateKey
+#### GenerateKey
**API Description**
-Generates a key based on **paramSet**.
+Generate a key based on the **paramSet**.
**Prototype**
-int32_t HuksHdiGenerateKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, const struct HksBlob *keyIn, struct HksBlob *keyOut);
+int32_t GenerateKey(struct IHuks *self, const struct HuksBlob *keyAlias, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *keyIn, struct HuksBlob *encKeyOut);
Parameters
- const struct HksBlob *keyAlias
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *keyAlias
Pointer to the alias of the key to generate. The value must meet the following requirements:
1. keyAlias != null
2. keyAlias -> data != null
- 3. keyAlias -> size != 0
+ 3. keyAlias -> dataLen != 0
- const struct HksParamSet *paramSet
+ const struct HuksParamSet *paramSet
Pointer to the parameters for generating the key.
- const struct HksBlob *keyIn
- This parameter is used in key agreement.
+ const struct HuksBlob *keyIn
+ Pointer to the original key material to be passed in if the key is generated through key agreement or key derivation. This parameter is optional.
- struct HksBlob *keyOut
- Pointer to the output parameter, which holds **paramSet** and the key generated.
+ struct HuksBlob *encKeyOut
+ Pointer to the key generated in ciphertext. It holds the **paramSet** and the key ciphertext in the KeyBlob format.
+
@@ -171,41 +225,44 @@ Generates a key based on **paramSet**.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiImportKey
+#### ImportKey
**API Description**
Imports a key in plaintext.
**Prototype**
-int32_t HuksHdiImportKey(const struct HksBlob *keyAlias, const struct HksBlob *key, const struct HksParamSet *paramSet, struct HksBlob *keyOut);
+int32_t ImportKey(struct IHuks *self, const struct HuksBlob *keyAlias, const struct HuksBlob *key,
+ const struct HuksParamSet *paramSet, struct HuksBlob *encKeyOut);
Parameters
- const struct HksBlob *msg
- Pointer to the alias of the key to import. The value must meet the following requirements:
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *keyAlias
+ Pointer to the alias of the key to import. The alias must meet the following requirements:
1. keyAlias != null
2. keyAlias -> data != null
- 3. keyAlias -> size != 0
+ 3. keyAlias -> dataLen != 0
- const struct HksBlob *key
- Pointer to the key to import. The value must meet the following requirements:
+ const struct HuksBlob *key
+ Pointer to the plaintext key material to import. For details about the key material format, see Key Material Formats. The value must meet the following requirements:
1. key != null
2. key -> data != null
- 3. key -> size != 0
-
- const struct HksParamSet *paramSet
- Pointer to the parameters for importing the key.
+ 3. key -> dataLen != 0
- struct HksBlob *keyOut
- Pointer to the output parameter, which holds **paramSet** and the key imported.
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters of the key to import.
+ struct HuksBlob *encKeyOut
+ Pointer to the imported key in ciphertext. It holds the **paramSet** and the imported key ciphertext in the KeyBlob format.
@@ -215,7 +272,7 @@ Imports a key in plaintext.
1. Check parameters in the API. For example, check for null pointers and whether the key algorithm is supported.
- 2. **keyOut** must be in the **KeyBlob** format.
+ 2. Check that **encKeyOut** is in the KeyBlob format.
@@ -225,48 +282,54 @@ Imports a key in plaintext.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiImportWrappedKey
+#### ImportWrappedKey
**API Description**
-Imports an encrypted key.
+Imports a wrapped key.
**Prototype**
-int32_t HuksHdiImportWrappedKey(const struct HksBlob *keyAlias, const struct HksBlob *wrappingUsedkey, const struct HksBlob *wrappedKeyData, const struct HksParamSet *paramSet, struct HksBlob *keyOut);
+int32_t ImportWrappedKey(struct IHuks *self, const struct HuksBlob *wrappingKeyAlias,
+ const struct HuksBlob *wrappingEncKey, const struct HuksBlob *wrappedKeyData, const struct HuksParamSet *paramSet,
+ struct HuksBlob *encKeyOut);
Parameters
- const struct HksBlob *KeyAlias
- Pointer to the alias of the key to import. The value must meet the following requirements:
- 1. keyAlias != null
- 2. keyAlias -> data != null
- 3. keyAlias -> size != 0
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *wrappingKeyAlias
+ Pointer to the alias of the key used to encrypt the key to import (it is not the alias of the key to import). The value must meet the following requirements:
+ 1. wrappingKeyAlias != null
+ 2. wrappingKeyAlias -> data != null
+ 3. wrappingKeyAlias -> dataLen != 0
- const struct HksBlob *key
+ const struct HuksBlob *wrappingEncKey
Pointer to the key used to encrypt the key to import. The value must meet the following requirements:
- 1. wrappingUsedkey != null
- 2. wrappingUsedkey -> data != null
- 3. wrappingUsedkey -> size != 0
+ 1. wrappingEncKey != null
+ 2. wrappingEncKey -> data != null
+ 3. wrappingEncKey -> dataLen != 0
- const struct HksBlob *wrappedKeyData
- Pointer to the encrypted data of the key to import. The value must meet the following requirements:
+ const struct HuksBlob *wrappedKeyData
+ Pointer to the key material of the key to import. For details abut the key material format, see Importing a Key Securely. The value must meet the following requirements:
1. wrappedKeyData != null
2. wrappedKeyData -> data != null
- 3. wrappedKeyData -> size != 0
+ 3. wrappedKeyData -> dataLen != 0
- const struct HksParamSet *paramSet
- Pointer to the parameters for importing the key.
+ const struct HuksParamSet *paramSet
+ Pointer to the properties of the key to import.
- struct HksBlob *keyOut
- Pointer to the output parameter, which holds **paramSet** and the key imported.
+ struct HuksBlob *encKeyOut
+ Pointer to the imported key material (ciphertext) in the KeyBlob format.
+
@@ -274,7 +337,7 @@ Imports an encrypted key.
1. Check parameters in the API. For example, check for null pointers and whether the key algorithm is supported.
- 2. **keyOut** must be in the **KeyBlob** format.
+ 2. Check that **encKeyOut** is in the KeyBlob format.
@@ -284,34 +347,38 @@ Imports an encrypted key.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiExportPublicKey
+#### ExportPublicKey
**API Description**
-Exports a public key.
+Exports the public key of a key pair.
**Prototype**
-int32_t HuksHdiExportPublicKey(const struct HksBlob *key, const struct HksParamSet *paramSet, struct HksBlob *keyOut);
+int32_t ExportPublicKey(struct IHuks *self, const struct HuksBlob *encKey,
+ const struct HuksParamSet *paramSet, struct HuksBlob *keyOut);
Parameters
- const struct HksBlob *key
- Pointer to the private key corresponding to the public key to export. The value must meet the following requirements:
- 1. key != null
- 2. key -> data != null
- 3. key -> size != 0
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *encKey
+ Pointer to the key pair material. The value must meet the following requirements:
+ 1. encKey != null
+ 2. encKey -> data != null
+ 3. encKey -> dataLen != 0
- const struct HksParamSet *paramSet
- Pointer to the parameter set, which is empty.
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for exporting the public key. By default, this parameter is left blank.
- struct HksBlob *keyOut
- Pointer to the output parameter, which holds the public key exported.
+ struct HuksBlob *keyOut
+ Pointer to the public key exported.
@@ -321,39 +388,51 @@ Exports a public key.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiInit
+#### Init
**API Description**
-Initializes data for a key operation. This API is of the Init-Update-Final model.
+Initializes a key session. You need to pass in the key material in ciphertext. The HUKS Core decrypts the ciphertext and generates a key session handle and an authentication token (if required).
**Prototype**
-int32_t HuksHdiInit(const struct HksBlob *key, const struct HksParamSet *paramSet, struct HksBlob *handle, struct HksBlob *token);
+int32_t Init(struct IHuks *self, const struct HuksBlob *encKey, const struct HuksParamSet *paramSet,
+ struct HuksBlob *handle, struct HuksBlob *token);
Parameters
- const struct HksBlob *key
- Pointer to the key, on which the **Init** operation is to perform. The value must meet the following requirements:
- 1. key != null
- 2. key -> data != null
- 3. key -> size != 0
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
- const struct HksParamSet *paramSet
- Pointer to the parameters of the **Init** operation.
+ const struct HuksBlob *encKey
+ Pointer to the ciphertext material of the key to be operated. The value must meet the following requirements:
+ 1. encKey != null
+ 2. encKey -> data != null
+ 3. encKey -> dataLen != 0
- struct HksBlob *handle
- Pointer to the handle of Init-Update-Finish.
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for initializing the key session.
- struct HksBlob *token
- Pointer to the challenge used for secure access control.
+ struct HuksBlob *handle
+ Pointer to the key session handle generated, which identifies the key session in Update(), Finish(), and Abort().
+
+ struct HuksBlob *token
+ Pointer to the authentication token generated for key access control (if required).
+
+
+
+
+ Constraints
+This API must be used with **Update()**, **Finish()**, and **Abort()** together.
+
+
@@ -361,34 +440,38 @@ Initializes data for a key operation. This API is of the Init-Update-Final model
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiUpdate
+#### Update
**API Description**
-Operates data by segment or appends data for the key operation. This API is of the Init-Update-Final model.
+Updates data for the key operation by segment according to the cryptographic algorithm requirements.
**Prototype**
-int32_t HuksHdiUpdate(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData, struct HksBlob *outData);
+int32_t Update(struct IHuks *self, const struct HuksBlob *handle, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *inData, struct HuksBlob *outData);
Parameters
- const struct HksBlob *handle
- Pointer to the handle of Init-Update-Finish.
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
- const struct HksParamSet *paramSet
- Pointer to the parameters of the **Update** operation.
+ const struct HuksBlob *handle
+ Pointer to the handle of the key session.
- const struct HksBlob *inData
- Pointer to the input of the **Update** operation.
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for the update operation.
- struct HksBlob *outData
- Pointer to the result of the **Update** operation.
+ const struct HuksBlob *inData
+ Pointer to the data to be passed in.
+
+ struct HuksBlob *outData
+ Pointer to the result of the update operation.
@@ -396,7 +479,9 @@ Operates data by segment or appends data for the key operation. This API is of t
Constraints
- 1. **inData** must pass in the raw data when signing and signature verification are performed.
+ 1. This API must be used with **Init()**, **Finish()**, and **Abort()** together.
+
+ 2. **inData** must pass in the raw data when signature verification is performed.
@@ -406,34 +491,38 @@ Operates data by segment or appends data for the key operation. This API is of t
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiFinish
+#### Finish
**API Description**
-Finalizes the key operation. This API is of the Init-Update-Final model.
+Finishes the key session.
**Prototype**
-int32_t HuksHdiFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData, struct HksBlob *outData);
+int32_t Finish(struct IHuks *self, const struct HuksBlob *handle, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *inData, struct HuksBlob *outData);
Parameters
- const struct HksBlob *handle
- Pointer to the handle of Init-Update-Finish.
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
- const struct HksParamSet *paramSet
- Pointer to the parameters of the **Finish** operation.
+ const struct HuksBlob *handle
+ Pointer to the handle of the key session.
- const struct HksBlob *inData
- Pointer to the input of the **Finish** operation.
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for the last operation.
- struct HksBlob *outData
- Pointer to the result of the **Finish** operation.
+ const struct HuksBlob *inData
+ Pointer to the last data to be passed in.
+
+ struct HuksBlob *outData
+ Pointer to the result of the key operation.
@@ -441,7 +530,9 @@ Finalizes the key operation. This API is of the Init-Update-Final model.
Constraints
- 1. In signing and signature verification, **inData** must pass in the signature data to be verified. The return value indicates whether the operation is successful.
+ 1. This API must be used with **Init()**, **Update()**, and **Abort()** together.
+
+ 2. In signature verification, **inData** must pass in the signature data to be verified. The return value indicates whether the signature has passed the verification.
@@ -451,30 +542,40 @@ Finalizes the key operation. This API is of the Init-Update-Final model.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiAbort
+#### Abort
**API Description**
-Aborts Init-Update-Finish. When an error occurs in any of the **Init**, **Update**, and **Finish** operations, call this API to terminate the use of the key.
+Aborts the key session. When an error occurs in any of the **Init**, **Update**, and **Finish** operations, call this API to terminate the key session.
**Prototype**
-int32_t HuksHdiAbort(const struct HksBlob *handle, const struct HksParamSet *paramSet);
-
+int32_t Abort(struct IHuks *self, const struct HuksBlob *handle, const struct HuksParamSet *paramSet);
Parameters
- const struct HksBlob *handle
- Pointer to the handle of Init-Update-Finish.
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
- const struct HksParamSet *paramSet
- Pointer to the parameters of the **Abort** operation.
+ const struct HuksBlob *handle
+ Pointer to the handle of the key session.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters of the Abort() operation.
+
+
+
+
+ Constraints
+This API must be used with **Init()**, **Update()**, and **Finish()** together.
+
+
@@ -482,28 +583,32 @@ Aborts Init-Update-Finish. When an error occurs in any of the **Init**, **Update
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiGetKeyProperties
+#### CheckKeyValidity
**API Description**
-Obtains key properties.
+Checks key validity.
**Prototype**
-int32_t HuksHdiGetKeyProperties(const struct HksParamSet *paramSet, const struct HksBlob *key);
+int32_t CheckKeyValidity(struct IHuks *self, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *encKey);
Parameters
- const struct HksParamSet *paramSet
- Pointer to the parameter set, which is empty.
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for checking the key integrity. By default, this parameter is left empty.
- const struct HksBlob *key
- Pointer to the target key.
+ const struct HuksBlob *encKey
+ Pointer to the key material (ciphertext) to be checked.
@@ -513,39 +618,42 @@ Obtains key properties.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiAttestKey
+#### AttestKey
**API Description**
-Obtains the key certificate.
+Attests a key.
**Prototype**
-int32_t (*HuksHdiAttestKey)(const struct HksBlob *key, const struct HksParamSet *paramSet, struct HksBlob *certChain);
+int32_t AttestKey(struct IHuks *self, const struct HuksBlob *encKey, const struct HuksParamSet *paramSet,
+ struct HuksBlob *certChain);
Parameters
- const struct HksBlob *key
- Pointer to the target key.
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
- const struct HksParamSet *paramSet
- Pointer to the parameters for the operation.
+ const struct HuksBlob *encKey
+ Pointer to the key pair material in ciphertext.
- struct HksBlob *certChain
- Pointer to the output parameter, which holds the certificate obtained.
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters (such as the challenge) for obtaining the key certificate chain.
+
+ struct HuksBlob *certChain
+ Pointer to the certificate chain obtained.
Constraints
-
- 1. **certChain** must comply with the certificate chain described in [Constraints](#constraints).
+**certChain** must comply with the certificate chain described in [Constraints](#constraints).
@@ -555,40 +663,44 @@ Obtains the key certificate.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiExportChipsetPlatformPublicKey
+#### ExportChipsetPlatformPublicKey
**API Description**
Exports the public key of a chipset key pair.
**Prototype**
-int32_t (*HuksHdiExportChipsetPlatformPublicKey)(const struct HksBlob *salt, enum HksChipsetPlatformDecryptScene scene, struct HksBlob *publicKey);
+int32_t ExportChipsetPlatformPublicKey(struct IHuks *self, const struct HuksBlob *salt,
+ enum HuksChipsetPlatformDecryptScene scene, struct HuksBlob *publicKey);
Parameters
- const struct HksBlob *salt
- Factor used to derive the chipset key pair.
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
- enum HksChipsetPlatformDecryptScene scene
- Expected chipset platform decryption scenario.
+ const struct HuksBlob *salt
+ Pointer to the factor used to derive the chipset key pair.
- struct HksBlob *publicKey
- The output parameters are the raw data of ECC P-256 x-axis and y-axis values, each of which are of 32 bytes.
+ enum HuksChipsetPlatformDecryptScene scene
+ Expected chipset decryption scenario.
+
+ struct HuksBlob *publicKey
+ Pointer to the raw data of ECC P-256 x-axis and y-axis values, each of which are of 32 bytes.
+
Constraints
-
- 1. The input parameter **salt** must be of 16 bytes, and the content of the last byte will be ignored and filled by HUKS based on **scene**.
- Currently, the chipset key pairs of HUKS are implemented by software. An ECC P-256 key pair is hard-coded, and the **salt** value is ignored. That is, the derived keys are the same regardless of the **salt**. In the hardware-based implementation of chipset key pairs, **salt** is a factor used to derive the key. That is, the key pair derived varies with the **salt** value.
+The input parameter **salt** must be of 16 bytes, and the content of the last byte will be ignored and filled by HUKS based on **scene**.
+Currently, the chipset key pairs of HUKS are implemented by software. An ECC P-256 key pair is hard-coded, and the **salt** value is ignored. That is, the derived keys are the same regardless of the **salt**. In the hardware-based implementation of chipset key pairs, **salt** is a factor used to derive the key. That is, the key pair derived varies with the **salt** value.
@@ -598,31 +710,35 @@ Exports the public key of a chipset key pair.
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
-#### HuksHdiUpgradeKey
+#### UpgradeKey
**API Description**
Updates the key file when the key file version is earlier than the latest version.
**Prototype**
-int32_t (*HuksHdiUpgradeKey)(const struct HksBlob *oldKey, const struct HksParamSet *paramSet, struct HksBlob *newKey);
+int32_t UpgradeKey(struct IHuks *self, const struct HuksBlob *encOldKey, const struct HuksParamSet *paramSet,
+ struct HuksBlob *encNewKey);
Parameters
- const struct HksBlob *oldKey
- Key file data to update.
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
- const struct HksParamSet *paramSet
- Parameters for updating the key file data.
+ const struct HuksBlob *encOldKey
+ Pointer to the key file data to update.
- struct HksBlob *newKey
- New key file data.
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for updating the key file data.
+
+ struct HuksBlob *newKey
+ Pointer to the new key file data.
@@ -632,40 +748,396 @@ Updates the key file when the key file version is earlier than the latest versio
- **HKS_SUCCESS**: The operation is successful.
- - Other value: The operation failed.
+ - Other values: The operation fails.
- - -
+#### GenerateRandom
+
+**API Description**
+
+Generates a random number.
+
+**Prototype**
+
+int32_t GenerateRandom(struct IHuks *self, const struct HuksParamSet *paramSet, struct HuksBlob *random);
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters of the random number to generate, such as the length.
+
+ struct HuksBlob *random
+ Pointer to the random number generated.
+
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
+
+#### Sign
+
+**API Description**
+
+Signs data.
+
+**Prototype**
+int32_t Sign(struct IHuks *self, const struct HuksBlob *encKey, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *srcData, struct HuksBlob *signature);
+
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *encKey
+ Pointer to the key pair material (ciphertext) used for signing.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters used for signing, such as the digest mode.
+
+ const struct HuksBlob *srcData
+ Pointer to the data to be signed.
+
+ struct HuksBlob *signature
+ Pointer to the signature generated.
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
+
+#### Verify
+
+**API Description**
+
+Verifies a digital signature.
+
+**Prototype**
+int32_t Verify(struct IHuks *self, const struct HuksBlob *encKey, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *srcData, const struct HuksBlob *signature);
+
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *encKey
+ Pointer to the key pair material (ciphertext) used for signature verification.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for signature verification, such as the digest mode.
+
+ const struct HuksBlob *srcData
+ Pointer to the data with the signature to be verified.
+
+ const struct HuksBlob *signature
+ Pointer to the signature to verify.
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
+
+#### Encrypt
+
+**API Description**
+
+Encrypts data. Different from the key session APIs that must be used together, this API completes data encryption in a single call.
+
+**Prototype**
+int32_t Encrypt(struct IHuks *self, const struct HuksBlob *encKey, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *plainText, struct HuksBlob *cipherText);
+
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *encKey
+ Pointer to the key material (ciphertext) used for encryption.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the key parameters for encryption, such as the key working mode and padding mode.
+
+ const struct HuksBlob *plainText
+ Pointer to the plaintext data to encrypt.
+
+ const struct HuksBlob *cipherText
+ Pointer to the encrypted data (data in ciphertext).
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
+
+#### Decrypt
+
+**API Description**
+
+Decrypts data. Different from the key session APIs that must be used together, this API completes data decryption in a single call.
+
+**Prototype**
+int32_t Decrypt(struct IHuks *self, const struct HuksBlob *encKey, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *cipherText, struct HuksBlob *plainText);
+
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *encKey
+ Pointer to the key material (ciphertext) used for decryption.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the key parameters for decryption, such as the key working mode and padding mode.
+
+ const struct HuksBlob *cipherText
+ Pointer to the data to decrypt.
+
+ const struct HuksBlob *plainText
+ Pointer to the encrypted data in plaintext.
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
+
+#### AgreeKey
+
+**API Description**
+
+Performs key agreement. Different from the key session APIs that must be used together, this API returns an agreed key in a single call.
+
+**Prototype**
+int32_t AgreeKey(struct IHuks *self, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *encPrivateKey, const struct HuksBlob *peerPublicKey, struct HuksBlob *agreedKey);
+
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for key agreement, such as the length of the agreed key.
+
+ const struct HuksBlob *encPrivateKey
+ Pointer to the private key material (ciphertext) used for key agreement.
+
+ const struct HuksBlob *peerPublicKey
+ Pointer to the public key (plaintext) used for key agreement.
+
+ struct HuksBlob *agreedKey
+ Pointer to the agreed key in plaintext.
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
+
+#### DeriveKey
+
+**API Description**
+
+Derives a key. Different from the key session APIs that must be used together, this API derives a key in a single call.
+
+**Prototype**
+int32_t DeriveKey(struct IHuks *self, const struct HuksParamSet *paramSet, const struct HuksBlob *encKdfKey,
+ struct HuksBlob *derivedKey);
+
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for key derivation, such as the length of the derived key.
+
+ const struct HuksBlob *encKdfKey
+ Pointer to the key material (ciphertext) used for deriving a key.
+
+ struct HuksBlob *derivedKey
+ Pointer to the derived key in plaintext.
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
+
+#### Mac
+
+**API Description**
+
+Generates a MAC based on the given key.
+
+**Prototype**
+int32_t Mac(struct IHuks *self, const struct HuksBlob *encKey, const struct HuksParamSet *paramSet,
+ const struct HuksBlob *srcData, struct HuksBlob *mac);
+
+
+ Parameters
+
+ struct IHuks *self
+ Pointer to the HUKS HDI struct.
+
+ const struct HuksBlob *encKey
+ Pointer to the key material (ciphertext) used to generate the MAC.
+
+ const struct HuksParamSet *paramSet
+ Pointer to the parameters for generating the MAC.
+
+ const struct HuksBlob *srcData
+ Pointre to the source data for which the MAC is to be generated.
+
+ struct HuksBlob *mac
+ Pointer to the MAC generated.
+
+
+
+
+
+ Return Value
+
+ - **HKS_SUCCESS**: The operation is successful.
+
+ - Other values: The operation fails.
+
+
+- - -
### Development Procedure
-The directory structure is as follows:
+#### Directory Structure
+
+The code for HDI adaptation is in the following directory.
+
+```undefined
+//drivers_peripheral/huks
+├── BUILD.gn # Build script.
+├── hdi_service # Dependency loaded from libhuks_engine_core_standard.z.so (software implementation of the HUKS Core for reference only) by using dlopen().
+ ├── huks_sa_type.h # Defines the data structs used in the HUKS service layer.
+ ├── huks_sa_hdi_struct.h # Defines the function pointer structs in libhuks_engine_core_standard.z.so.
+ ├── huks_hdi_template.h # Defines the conversion between the data structs of the HUKS service layer and the HDI.
+ ├── huks_hdi_service.c # Implementation of the HUKS passthrough HDI APIs.
+ └── huks_hdi_passthrough_adapter.c # Adaptation of HUKS passthrough HDI APIs to the HUKS Core.
+└── test # Test code for the HUKS HDI APIs.
+ ├── BUILD.gn # Build script.
+ ├── fuzztest # Fuzz test.
+ └── unittest # Unit test.
+```
+
+The code of the HUKS Core software implementation is in the following directory.
```undefined
-// base/security/user_auth/services/huks_standard/huks_engine/main
-├── BUILD.gn # Build script
-├── core_dependency # Dependencies of the implementation
-└── core # Software implementation of the HUKS Core
- ├── BUILD.gn # Build script
+//base/security/huks/services/huks_standard/huks_engine
+├── BUILD.gn # Build script.
+├── core_dependency # HUKS Core dependency.
+└── core # Software implementation of the HUKS Core.
+ ├── BUILD.gn # Build script.
├── include
└── src
- ├── hks_core_interfaces.c # Adaptation of the HDI to the HUKS Core
- └── hks_core_service.c # Specific implementation
- └── ... # Other function code
+ ├── hks_core_interfaces.c # Adaptation of the HDI to the HUKS Core.
+ └── hks_core_service.c # HUKS Core implementation.
+ └── ... # Code of other functions.
```
+**CAUTION**
+
+The software implementation of the HUKS Core contains hard-coded sensitive data, including the root key, AuthToken key for access control, key used to encrypt AuthToken, and certificate. You need to replace these code with your own implementation. /summary>
+
+ - Root key
+
+ The root key is used to encrypt the HUKS service key and is generally derived from the device root key. It is hard-coded in the HUKS Core software implementation. For details, see hks_openssl_get_main_key.c.
+
+ - Key for generating an HMAC on AuthToken
+
+ The key is used to generate an HMAC on AuthToken by the UserIAM for access control. The value is **huks_default_user_auth_token_key** and hard-coded in the HUKS Core software implementation. For details about the code, see hks_keyblob.c.
+
+ - Key for encrypting sensitive fields of AuthToken
+
+ The key is used to encrypt sensitive fields of AuthToken in access control. The value is **huks_default_user_auth_token_key** and hard-coded in the HUKS Core software implementation. For details about the code, see hks_keyblob.c.
+
+ - Root certificate, device CA, and device certificate
+
+ The root certificate, device CA, and device certificate are used for key attestation and preset in the secure storage of the hardware device by the device certificate management module. These certificates are hard-coded in the HUKS Core software implementation. For details about the code, see dcm_certs_and_key.h.
-Init-Update-Finish must be used to implement HUKS Core APIs. The following provides the development procedure of Init-Update-Finish and sample code of the HUKS Core. You can refer to the following code to implement all HDI APIs.
+#### Example
-For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com/openharmony/security_huks/blob/master/services/huks_standard/huks_engine/main/core/src/hks_core_service.c).
+The following uses the adaptation of the key session APIs **Init**, **Update**, and **Finish** in the HUKS Core as an example. The sample code is for reference only and cannot be used directly. For details about the executable code, see [HUKS source code](https://gitee.com/openharmony/security_huks).
-1. Create a handle to enable the information about the operations on a key to be stored in a session. With this handle, multiple operations on the same key can be performed.
+1. Create a handle to identify information about key operations in a session. With this handle, multiple operations on the same key can be performed.
```c
- // Implement Init().
+ // Initialize the key session.
- int32_t HksCoreInit(const struct HksBlob *key, const struct HksParamSet *paramSet, struct HksBlob *handle,
- struct HksBlob *token)
+ int32_t HksCoreInit(const struct HuksBlob *key, const struct HuksParamSet *paramSet, struct HuksBlob *handle,
+ struct HuksBlob *token)
{
HKS_LOG_D("HksCoreInit in Core start");
uint32_t pur = 0;
@@ -686,7 +1158,7 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
HKS_LOG_E("the pointer param entered is invalid");
return HKS_ERROR_BAD_STATE;
}
- // Store information in a session based on the handle. The information stored can be used for the Update and Finish operations on the key.
+ // Store information in a session based on the handle. The information stored can be used for the Update() and Finish() operations on the key.
handle->size = sizeof(uint64_t);
(void)memcpy_s(handle->data, handle->size, &(keyNode->handle), handle->size);
// Obtain the algorithm from the parameters.
@@ -695,14 +1167,14 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
HksDeleteKeyNode(keyNode->handle);
return ret;
}
- // Check the key parameters.
+ // Check key parameters.
ret = HksCoreSecureAccessInitParams(keyNode, paramSet, token);
if (ret != HKS_SUCCESS) {
HKS_LOG_E("init secure access params failed");
HksDeleteKeyNode(keyNode->handle);
return ret;
}
- // Obtain the initialization handler from the algorithm library based on the usage of the key.
+ // Obtain the initialization handler from the algorithm library based on the key purpose.
uint32_t i;
uint32_t size = HKS_ARRAY_SIZE(g_hksCoreInitHandler);
for (i = 0; i < size; i++) {
@@ -730,12 +1202,12 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
}
```
-2. Obtain the context based on the handle, and pass in data by segment or append data to obtain the operation result.
+2. Obtain the context based on the handle, and pass in data by segment to obtain the operation result or append data.
```c
- // Implement Update().
- int32_t HksCoreUpdate(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData,
- struct HksBlob *outData)
+ // Update data by segment.
+ int32_t HksCoreUpdate(const struct HuksBlob *handle, const struct HuksParamSet *paramSet, const struct HuksBlob *inData,
+ struct HuksBlob *outData)
{
HKS_LOG_D("HksCoreUpdate in Core start");
uint32_t pur = 0;
@@ -748,7 +1220,7 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
uint64_t sessionId;
struct HuksKeyNode *keyNode = NULL;
- // Obtain the context based on the handle.
+ // Obtain the context required for the key session operation based on the handle.
int32_t ret = GetParamsForUpdateAndFinish(handle, &sessionId, &keyNode, &pur, &alg);
if (ret != HKS_SUCCESS) {
HKS_LOG_E("GetParamsForCoreUpdate failed");
@@ -766,7 +1238,7 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
uint32_t size = HKS_ARRAY_SIZE(g_hksCoreUpdateHandler);
for (i = 0; i < size; i++) {
if (g_hksCoreUpdateHandler[i].pur == pur) {
- struct HksBlob appendInData = { 0, NULL };
+ struct HuksBlob appendInData = { 0, NULL };
ret = HksCoreAppendAuthInfoBeforeUpdate(keyNode, pur, paramSet, inData, &appendInData);
if (ret != HKS_SUCCESS) {
HKS_LOG_E("before update: append auth info failed");
@@ -796,12 +1268,12 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
}
```
-3. Finalize the key operation to obtain the result, and destroy the handle.
+3. Finish the key operation to obtain the result, and destroy the handle.
```c
- // Implement Finish().
- int32_t HksCoreFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData,
- struct HksBlob *outData)
+ // Finish the key session operation.
+ int32_t HksCoreFinish(const struct HuksBlob *handle, const struct HuksParamSet *paramSet, const struct HuksBlob *inData,
+ struct HuksBlob *outData)
{
HKS_LOG_D("HksCoreFinish in Core start");
uint32_t pur = 0;
@@ -814,7 +1286,7 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
uint64_t sessionId;
struct HuksKeyNode *keyNode = NULL;
- // Obtain the context based on the handle.
+ // Obtain the context required for the key session operation based on the handle.
int32_t ret = GetParamsForUpdateAndFinish(handle, &sessionId, &keyNode, &pur, &alg);
if (ret != HKS_SUCCESS) {
HKS_LOG_E("GetParamsForCoreUpdate failed");
@@ -833,7 +1305,7 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
for (i = 0; i < size; i++) {
if (g_hksCoreFinishHandler[i].pur == pur) {
uint32_t outDataBufferSize = (outData == NULL) ? 0 : outData->size;
- struct HksBlob appendInData = { 0, NULL };
+ struct HuksBlob appendInData = { 0, NULL };
ret = HksCoreAppendAuthInfoBeforeFinish(keyNode, pur, paramSet, inData, &appendInData);
if (ret != HKS_SUCCESS) {
HKS_LOG_E("before finish: append auth info failed");
@@ -863,15 +1335,15 @@ For the code of other HUKS Core APIs, see [hks_core_service.c](https://gitee.com
}
```
-### Verification
+### Debugging
-Use the [HUKS JS APIs](https://gitee.com/openharmony/security_huks/blob/master/interfaces/kits/js/@ohos.security.huks.d.ts) to develop a JavaScript application to verify HUKS capabilities.
+Use [HUKS JS APIs](https://gitee.com/openharmony/security_huks/blob/master/interfaces/kits/js/@ohos.security.huks.d.ts) to develop a JavaScript application to verify HUKS capabilities.
-The JS API corresponding to each HDI API is provided in [Available APIs](#available-apis). You can invoke the JS APIs to verify the capabilities of the corresponding HDI APIs or perform complete key operations to verify the capabilities of the APIs.
+The JS APIs corresponding to HDI APIs are provided in [Available APIs](#available-apis). You can use the JS APIs to verify the capabilities of the corresponding HDI APIs or perform complete key operations to verify the capabilities of the APIs.
-The JS test code is as follows. If the entire process is successful, the HDI APIs are functioning. For more information about key operations, see [HUKS Development](../../application-dev/security/huks-guidelines.md).
+The following JS test code is for reference only. If the entire process goes properly, the HDI APIs are functioning. For more key operation types and samples, see [huks-guidelines.md](../../application-dev/security/huks-guidelines.md).
-**Generating and Encrypting an AES Key**
+**Generating an AES Key and Encrypting Data**
1. Import the HUKS module.
@@ -879,102 +1351,109 @@ The JS test code is as follows. If the entire process is successful, the HDI API
import huks from '@ohos.security.huks'
```
-2. Call **generateKey()** to generate a key.
+2. Use **generateKey()** to generate a key.
```js
- var alias = 'testAlias';
- var properties = new Array();
- properties[0] = {
- tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
- value: huks.HuksKeyAlg.HUKS_ALG_ECC
- };
- properties[1] = {
- tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
- value: huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224
- };
- properties[2] = {
- tag: huks.HuksTag.HUKS_TAG_PURPOSE,
- value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
- };
- properties[3] = {
- tag: huks.HuksTag.HUKS_TAG_DIGEST,
- value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
- };
- var options = {
- properties: properties
- }
- var resultA = huks.generateKey(alias, options);
- ```
+
+ let aesKeyAlias = 'test_aesKeyAlias';
+ let handle;
+ let IV = '001122334455';
+ let cipherData:Uint8Array;
+ let plainData:Uint8Array;
-3. Call **Init()** to perform initialization.
+
+ function GetAesGenerateProperties() {
+ var properties = new Array();
+ var index = 0;
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_AES
+ };
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
+ value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
+ };
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT |
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
+ }
+ return properties;
+ }
- ```js
- var alias = 'test001'
- var properties = new Array();
- properties[0] = {
- tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
- value: huks.HuksKeyAlg.HUKS_ALG_DH
- };
- properties[1] = {
- tag: huks.HuksTag.HUKS_TAG_PURPOSE,
- value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
- };
- properties[2] = {
- tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
- value: huks.HuksKeySize.HUKS_DH_KEY_SIZE_4096
- };
- var options = {
- properties: properties
- };
- huks.init(alias, options, function(err, data) {
- if (err.code !== 0) {
- console.log("test init err information: " + JSON.stringify(err));
- } else {
- console.log(`test init data: ${JSON.stringify(data)}`);
- }
- })
+
+ async function GenerateAesKey() {
+ var genProperties = GetAesGenerateProperties();
+ var options = {
+ properties: genProperties
+ }
+ await huks.generateKeyItem(aesKeyAlias, options).then((data) => {
+ console.log("generateKeyItem success");
+ }).catch((err)=>{
+ console.log("generateKeyItem failed");
+ })
+ }
```
-
-4. Call **update()** to perform the **Update** operation.
- ```js
- var properties = new Array();
- properties[0] = {
- tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
- value: huks.HuksKeyAlg.HUKS_ALG_DH
- };
- properties[1] = {
- tag: huks.HuksTag.HUKS_TAG_PURPOSE,
- value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
- };
- properties[2] = {
- tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
- value: huks.HuksKeySize.HUKS_DH_KEY_SIZE_4096
- };
- var options = {
- properties: properties
- };
- var result = huks.update(handle, options)
- ```
-
-5. Call **finish()** to finalize the operation.
+3. Use **huks.initSession** and **huks.finishSession** to encrypt data.
```js
- var properties = new Array();
- properties[0] = {
- tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
- value: huks.HuksKeyAlg.HUKS_ALG_DH
- };
- properties[1] = {
- tag: huks.HuksTag.HUKS_TAG_PURPOSE,
- value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
- };
- properties[2] = {
- tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
- value: huks.HuksKeySize.HUKS_DH_KEY_SIZE_4096
- };
- var options = {
- properties: properties
- };
- var result = huks.finish(handle, options)
+ let plainText = '123456';
+
+ function StringToUint8Array(str) {
+ let arr = [];
+ for (let i = 0, j = str.length; i < j; ++i) {
+ arr.push(str.charCodeAt(i));
+ }
+ return new Uint8Array(arr);
+ }
+
+ function GetAesEncryptProperties() {
+ var properties = new Array();
+ var index = 0;
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_AES
+ };
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
+ value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
+ };
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT
+ }
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_PADDING,
+ value: huks.HuksKeyPadding.HUKS_PADDING_PKCS7
+ }
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
+ value: huks.HuksCipherMode.HUKS_MODE_CBC
+ }
+ properties[index++] = {
+ tag: huks.HuksTag.HUKS_TAG_IV,
+ value: StringToUint8Array(IV)
+ }
+ return properties;
+ }
+
+ async function EncryptData() {
+ var encryptProperties = GetAesEncryptProperties();
+ var options = {
+ properties:encryptProperties,
+ inData: StringToUint8Array(plainText)
+ }
+ await huks.initSession(aesKeyAlias, options).then((data) => {
+ handle = data.handle;
+ }).catch((err)=>{
+ console.log("initSession failed");
+ })
+ await huks.finishSession(handle, options).then((data) => {
+ console.log("finishSession success");
+ cipherData = data.outData
+ }).catch((err)=>{
+ console.log("finishSession failed");
+ })
+ }
```
diff --git a/en/device-dev/website.md b/en/device-dev/website.md
index 6aad5f8a458451105fb5bfbb7657d35856304e58..3f979d4879c640e0e363ae7c3b3acea7914f2f8d 100644
--- a/en/device-dev/website.md
+++ b/en/device-dev/website.md
@@ -388,15 +388,22 @@
- [Configuring Parameters for Accelerating Local Build](subsystems/subsys-build-reference.md)
- [Viewing Ninja Build Information](subsystems/subsys-build-reference.md)
- [HAP Build Guide](subsystems/subsys-build-gn-hap-compilation-guide.md)
+ - Rust Compilation and Building
+ - [Rust Module Configuration Rules and Guide](subsystems/subsys-build-rust-compilation.md)
+ - [Interactive Tool User Guide](subsystems/subsys-build-bindgen-cxx-guide.md)
+ - [Using Cargo2gn](subsystems/subsys-build-cargo2gn-guide.md)
- [FAQs](subsystems/subsys-build-FAQ.md)
- [ArkCompiler Development](subsystems/subsys-arkcompiler-guide.md)
- - [Distributed Remote Startup](subsystems/subsys-remote-start.md)
+ - ArkUI
+ - [Custom Window Title Bar Development](subsystems/subsys-arkui-customize_titlebar.md)
- Graphics
- [Graphics Overview](subsystems/subsys-graphics-overview.md)
+ - [Common Component Development](subsystems/subsys-graphics-common-guide.md)
- [Container Component Development](subsystems/subsys-graphics-container-guide.md)
- [Development of Layout Container Components](subsystems/subsys-graphics-layout-guide.md)
- - [Common Component Development](subsystems/subsys-graphics-common-guide.md)
- [Animator Development](subsystems/subsys-graphics-animation-guide.md)
+ - [Using Qt Creator on Windows](subsystems/subsys-graphics-simulator-guide.md)
+ - [Small-System Graphics Framework Integration](subsystems/subsys-graphics-porting-guide.md)
- Multimedia
- Camera
- [Camera Overview](subsystems/subsys-multimedia-camera-overview.md)
@@ -532,6 +539,7 @@
- Debugging
- [Development Self-Test Framework User Guide](device-test/developer_test.md)
- [xDevice User Guide](device-test/xdevice.md)
+ - [Smartperf-Host User Guide](device-test/smartperf-host.md)
- R&D Tools
- [bytrace](subsystems/subsys-toolchain-bytrace-guide.md)
- [hdc](subsystems/subsys-toolchain-hdc-guide.md)
diff --git a/en/release-notes/OpenHarmony-v3.2-release.md b/en/release-notes/OpenHarmony-v3.2-release.md
index fed75e671895a0b6f6efc8d3f44465c44443efb3..f36be4f1d81c756222f7700096f8a5b1051d8263 100644
--- a/en/release-notes/OpenHarmony-v3.2-release.md
+++ b/en/release-notes/OpenHarmony-v3.2-release.md
@@ -125,7 +125,7 @@ Abilities and widgets can be queried, added, refreshed, and deleted across devic
- The distributed camera supports video recording.
-- Users can import account authentication information to the device security authentication system. Devices with the same login account can automatically complete authentication and networking.
+- Users can use the device management native APIs to import account authentication information to the device security authentication system. Devices with the same login account can automatically complete authentication and networking.
#### Distributed data management
diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.8.1/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_4.0.8.1/changelogs-arkui.md
new file mode 100644
index 0000000000000000000000000000000000000000..b155f52a104a047255cf904c09478e51b4169a84
--- /dev/null
+++ b/en/release-notes/changelogs/OpenHarmony_4.0.8.1/changelogs-arkui.md
@@ -0,0 +1,21 @@
+# ArkUI Subsystem Changelog
+
+## cl.arkui.1 Change of Certain Predicates of uiAppearance from Public APIs to System APIs
+
+Changed the namespace **uiAppearance** and its internal **DarkMode** enum predicates from public APIs to system APIs.
+
+**Change Impact**
+
+None. The namespace **uiAppearance** and its internal **DarkMode** enum are used only by system APIs before and after the change.
+
+**Key API/Component Changes**
+
+The system API description is added to the following APIs:
+
+- declare namespace uiAppearance
+
+- enum DarkMode
+
+- ALWAYS_DARK = 0
+
+- ALWAYS_LIGHT = 1
diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-arkui.md
index 85f6aebf03beb604a61c7be18c293507b8415eab..089253f0e410425b26d4b7c99b15c933957e5440 100644
--- a/en/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-arkui.md
+++ b/en/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-arkui.md
@@ -97,3 +97,117 @@ N/A
When building a child component, do not assign values to the variables by **@LocalStorageLink** and **@LocalStorageProp** in the child component.
To change these variables from the parent component, use the API provided by the **LocalStorage** (such as the **set** API) to assign values to them.
+
+## cl.arkui.3 Change of the bottom Definition in Toast Options in the PromptAction Module
+
+Changed the definition of the **bottom** attribute in toast options from distance between the top of the toast and the bottom of the screen to distance between the bottom of the toast and the bottom of the screen.
+
+**Example**
+
+```ts
+import promptAction from '@ohos.promptAction';
+@Entry
+@Component
+struct Index {
+ build() {
+ Row() {
+ Button()
+ .onClick(() => {
+ try {
+ promptAction.showToast({
+ message: 'Message Info',
+ duration: 2000
+ });
+ } catch (error) {
+ console.error(`showToast args error code is ${error.code}, message is ${error.message}`);
+ };
+ })
+ }
+ }
+}
+```
+
+**Change Impacts**
+
+In the **PromptAction** module, the same value for the **bottom** attribute may result in different toast appearances, depending on whether the API version used by the compiler is earlier than 10 or not.
+
+**Key API/Component Changes**
+
+N/A
+
+**Adaptation Guide**
+
+When setting the **bottom** attribute, account for the definition change.
+
+## cl.arkui.4 Content Layout Change of AlertDialog
+
+The content layout of the alert dialog box varies according to the following conditions: 1. whether there is a title. 2. whether the text is on a single line.
+
+Currently, only the single-line text without a title is centered. In other cases, the text is left-aligned.
+
+**Example**
+
+```ts
+// xxx.ets
+@Entry
+@Component
+struct AlertDialogExample {
+ build() {
+ Column({ space: 5 }) {
+ Button('one button dialog')
+ .onClick(() => {
+ AlertDialog.show(
+ {
+ title: 'title',
+ message: 'text'.repeat(20),
+ autoCancel: true,
+ alignment: DialogAlignment.Bottom,
+ offset: { dx: 0, dy: -20 },
+ gridCount: 3,
+ confirm: {
+ value: 'button',
+ action: () => {
+ console.info('Button-clicking callback')
+ }
+ },
+ cancel: () => {
+ console.info('Closed callbacks')
+ }
+ }
+ )
+ })
+ .backgroundColor(0x317aff)
+ }.width('100%').margin({ top: 5 })
+ }
+}
+```
+
+**Change Impacts**
+
+The layout for the text specified by the **message** attribute of the alert dialog box is subject to the title and number of lines of the text.
+
+**Key API/Component Changes**
+
+N/A
+
+**Adaptation Guide**
+
+No proactive adaptation is required. You can also use **customDialog** for related implementation.
+
+## cl.arkui.5 Avoidance Behavior Optimization of Popup
+
+Before the change, the popup preferentially uses the lower area for avoidance. As a result, it cannot be displayed in the upper area even if the space is sufficient.
+
+After the change: The popup preferentially uses the upper area for avoidance when it is configured to show above the target component; it preferentially uses the upper or lower area for avoidance when it is configured to show below the target component.
+
+**Change Impacts**
+
+The optimized popup avoidance behavior occurs when the **bindpopup** attribute is used.
+
+**Key API/Component Changes**
+
+N/A
+
+**Adaptation Guide**
+
+If the popup position is not as expected, you can adjust the **placement** settings.
diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md b/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md
index 0706c71bb7683308cd657f170b197a1d36b346cf..00fd9772a0edcf712b71caedb84507089a7fa913 100644
--- a/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md
+++ b/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md
@@ -1,43 +1,71 @@
-# App Access Control Subsystem ChangeLog
+# Application Access Control Subsystem Changelog
-## cl.accessToken.1 Change of the Media and File Permission Group
+## cl.accessToken.1 Change of the Media and Files Permission Group
The original Media and File permission group contains the following permissions:
- ohos.permission.MEDIA_LOCATION
- ohos.permission.READ_MEDIA
- ohos.permission.WRITE_MEDIA
Changed the permission group as follows:
-- Added **ohos.permission.MEDIA_LOCATION** to the Image and Video permission group.
-- Added **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** to the File permission group.
+- Added **ohos.permission.MEDIA_LOCATION** to the Images and Video permission group.
+- Added **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** to the Documents permission group.
**Change Impact**
-The permission dialog boxes are displayed by permission group.
+The dialog box for requesting permissions is displayed by permission group.
-- Before the change, if the three permissions are applied for an application, a dialog box for applying for the media and file permissions will be displayed only once.
-- After the change, if the three permissions are applied for an application, a dialog box for applying for the image and video permissions and a dialog box for applying for the file permission will be displayed.
+- Before the change, if the three permissions are applied for an application, a dialog box for requesting the media and file permissions will be displayed only once.
+- After the change, if the three permissions are applied for an application, a dialog box for requesting the image and video permissions and a dialog box for requesting the document permission will be displayed.
**Key API/Component Changes**
-Permission group before the change:
+Permission groups before the change:
| Permission | Permission Group |
| -------- | ---------------------------- |
-| ohos.permission.MEDIA_LOCATION | Media and File|
-| ohos.permission.READ_MEDIA | Media and File|
-| ohos.permission.WRITE_MEDIA | Media and File|
+| ohos.permission.MEDIA_LOCATION | Media and file|
+| ohos.permission.READ_MEDIA | Media and file|
+| ohos.permission.WRITE_MEDIA | Media and file|
Permission groups after the change:
| Permission | Permission Group |
| -------- | ---------------------------- |
-| ohos.permission.MEDIA_LOCATION | Image and Video|
-| ohos.permission.READ_MEDIA | File|
-| ohos.permission.WRITE_MEDIA | File|
+| ohos.permission.MEDIA_LOCATION | Images and videos |
+| ohos.permission.READ_MEDIA | Documents |
+| ohos.permission.WRITE_MEDIA | Documents |
**Adaptation Guide**
N/A
+## cl.accessToken.2 Change of the Permission Requesting Modes of the Telephony, Messaging, and Call Logs Permission Groups
+The permissions of the Telephony, Messaging, and Call Logs permission groups are available only to system applications. The three permission groups contain the following permissions:
+- ohos.permission.ANSWER_CALL
+- ohos.permission.MANAGE_VOICEMAIL
+- ohos.permission.READ_CELL_MESSAGES
+- ohos.permission.READ_MESSAGES
+- ohos.permission.RECEIVE_MMS
+- ohos.permission.RECEIVE_SMS
+- ohos.permission.RECEIVE_WAP_MESSAGES
+- ohos.permission.SEND_MESSAGES
+- ohos.permission.READ_CALL_LOG
+- ohos.permission.WRITE_CALL_LOG
+- ohos.permission.MEDIA_LOCATION
+
+To enable third-party application developers to apply for these permissions, the method for requesting these permissions is changed to pre-authorization mode.
+
+
+**Change Impact**
+
+The system applications can obtain these permissions only in pre-authorization mode, rather than requesting these permissions through a pop-up window, .
+
+**Key API/Component Changes**
+
+N/A
+
+**Adaptation Guide**
+
+Apply for the preceding permissions in pre-authorization mode for system applications.
diff --git a/zh-cn/application-dev/IDL/idl-guidelines.md b/zh-cn/application-dev/IDL/idl-guidelines.md
index f2f89c45fe75c039447ce53593ccaa98b0c51dcd..8d124c2f0e91c74864a6af12879818269fc59e75 100644
--- a/zh-cn/application-dev/IDL/idl-guidelines.md
+++ b/zh-cn/application-dev/IDL/idl-guidelines.md
@@ -343,11 +343,10 @@ export default {
#### 客户端调用IPC方法
-客户端调用connectAbility()以连接服务时,客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例。由于客户端和服务在不同应用内,所以客户端应用的目录内必须包含.idl文件(SDK工具会自动生成Proxy代理类)的副本。客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例,使用IRemoteObject创建IdlTestServiceProxy类的实例对象testProxy,然后调用相关IPC方法。示例代码如下:
+客户端调用connectServiceExtensionAbility()以连接服务时,客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例。由于客户端和服务在不同应用内,所以客户端应用的目录内必须包含.idl文件(SDK工具会自动生成Proxy代理类)的副本。客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例,使用IRemoteObject创建IdlTestServiceProxy类的实例对象testProxy,然后调用相关IPC方法。示例代码如下:
```ts
import IdlTestServiceProxy from './idl_test_service_proxy'
-import featureAbility from '@ohos.ability.featureAbility';
function callbackTestIntTransaction(result: number, ret: number): void {
if (result == 0 && ret == 124) {
@@ -392,13 +391,13 @@ var onAbilityConnectDone = {
}
};
-function connectAbility: void {
+function connectAbility(): void {
let want = {
bundleName: 'com.example.myapplicationidl',
abilityName: 'com.example.myapplicationidl.ServiceAbility'
};
let connectionId = -1;
- connectionId = featureAbility.connectAbility(want, onAbilityConnectDone);
+ connectionId = this.context.connectServiceExtensionAbility(want, onAbilityConnectDone);
}
diff --git a/zh-cn/application-dev/application-dev-guide.md b/zh-cn/application-dev/application-dev-guide.md
index 40b528f30b0dcbd37c5eb314bde88622ae283b42..7bf78e9180a883b5839126646023e7695f41d70c 100644
--- a/zh-cn/application-dev/application-dev-guide.md
+++ b/zh-cn/application-dev/application-dev-guide.md
@@ -32,7 +32,7 @@
- [WebGL](webgl/webgl-overview.md)
- [媒体](media/media-application-overview.md)
- [安全](security/userauth-overview.md)
-- [AI](ai/mindspore-lite-js-guidelines.md)
+- [AI](ai/ai-overview.md)
- [网络与连接](connectivity/ipc-rpc-overview.md)
- [电话服务](telephony/telephony-overview.md)
- [数据管理](database/data-mgmt-overview.md)
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md b/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md
index 71c48410fea0aee1420ae1dab44b9dfa81ff1e63..248c23ea425fb67ad814d1402d100d799d0c5a34 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md
@@ -1,16 +1,23 @@
# 创建一个ArkTS卡片
-在已有的应用工程中,创建ArkTS卡片,具体的操作方式如下。
+创建卡片当前有两种入口:
-1. 创建卡片。
+- 创建工程时,选择Application,默认不带卡片,可以在创建工程后右键新建卡片。
+- 创建工程时,选择Atomic Service,默认自带卡片,也可以在创建工程后右键新建卡片。
+
+
+
+在已有的应用工程中,可以通过右键新建ArkTS卡片,具体的操作方式如下。
+
+1. 右键新建卡片。

2. 根据实际业务场景,选择一个卡片模板。

-
+
3. 在选择卡片的开发语言类型(Language)时,选择ArkTS选项,然后单击“Finish”,即可完成ArkTS卡片创建。

-
+
ArkTS卡片创建完成后,工程中会新增如下卡片相关文件:卡片生命周期管理文件(EntryFormAbility.ets)、卡片页面文件(WidgetCard.ets)和卡片配置文件(form_config.json)。

diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md b/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
index dd1c84a41983ed354da06789357626beb1d3126a..776b129a1fabf15885e43d19f5949878acf9be02 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
@@ -11,12 +11,19 @@
@Entry(storage)
@Component
struct WidgetCard {
- @LocalStorageProp('title') title: string = 'init';
- @LocalStorageProp('detail') detail: string = 'init';
+ @LocalStorageProp('title') title: string = 'Title default';
+ @LocalStorageProp('detail') detail: string = 'Description default';
build() {
Column() {
- Button('刷新')
+ Column() {
+ Text(`${this.title}`)
+ .margin(5).fontWeight(FontWeight.Medium).fontSize('14fp')
+ Text(`${this.detail}`)
+ .margin(5).fontColor(Color.Gray).fontSize('12fp').height('25%')
+ }.width('100%').alignItems(HorizontalAlign.Start)
+ Button('UPDATE')
+ .margin(15).width('90%')
.onClick(() => {
postCardAction(this, {
'action': 'message',
@@ -25,11 +32,7 @@
}
});
})
- Text(`${this.title}`)
- Text(`${this.detail}`)
- }
- .width('100%')
- .height('100%')
+ }.width('90%').height('90%').margin('5%')
}
}
```
@@ -46,8 +49,8 @@
// Called when a specified message event defined by the form provider is triggered.
console.info(`FormAbility onEvent, formId = ${formId}, message: ${JSON.stringify(message)}`);
let formData = {
- 'title': 'Title Update Success.', // 和卡片布局中对应
- 'detail': 'Detail Update Success.', // 和卡片布局中对应
+ 'title': 'Title Update.', // 和卡片布局中对应
+ 'detail': 'Description update success.', // 和卡片布局中对应
};
let formInfo = formBindingData.createFormBindingData(formData)
formProvider.updateForm(formId, formInfo).then((data) => {
@@ -61,5 +64,8 @@
}
```
- 运行效果如下图所示。
- 
+ 运行效果如下图所示。
+
+ | 初始状态 | 点击刷新 |
+ | ------------------------------------------------------- | ----------------------------------------------------- |
+ |  |  |
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md b/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md
index f32017a7ed10f405f292bd6ad26139df5613d189..e54036d3971d65b2a12cf45baec3640f079e6337 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md
@@ -1,7 +1,7 @@
# 使用router事件跳转到指定UIAbility
-
在卡片中使用**postCardAction**接口的router能力,能够快速拉起卡片提供方应用的指定UIAbility,因此UIAbility较多的应用往往会通过卡片提供不同的跳转按钮,实现一键直达的效果。例如相机卡片,卡片上提供拍照、录像等按钮,点击不同按钮将拉起相机应用的不同UIAbility,从而提高用户的体验。
+

diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md b/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md
index fffa5ca955827d9a76caa12c79bf74c095268bd1..219bdf5e85bb32edb9969c0f91ea464a0616c3ad 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md
@@ -15,7 +15,7 @@
- [formBindingData](../reference/apis/js-apis-app-form-formBindingData.md):提供卡片数据绑定的能力,包括FormBindingData对象的创建、相关信息的描述。
-- [页面布局(Card.ets)](arkts-ui-widget-page-overview.md):提供声明式范式的UI接口能力。
+- [页面布局(WidgetCard.ets)](arkts-ui-widget-page-overview.md):提供声明式范式的UI接口能力。
- [ArkTS卡片特有能力](arkts-ui-widget-event-overview.md):postCardAction用于卡片内部和提供方应用间的交互,仅在卡片中可以调用。
- [ArkTS卡片能力列表](arkts-ui-widget-page-overview.md#arkts卡片支持的页面能力):列举了能在ArkTS卡片中使用的API、组件、事件、属性和生命周期调度。
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md
index 12030b09d65dda9f8bcc970cd9d6aed8827cb3f9..1630e686e1cddd466e859c66e9f17e720744df8f 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md
@@ -32,7 +32,7 @@
1. 数据提供方以`key + subscriberId`作为数据的标识,将数据存储到数据库。
2. 数据管理服务感知到数据库变化,将新的数据发布给当前注册的所有订阅实例。
3. 卡片管理服务从订阅实例中解析出数据,发送给卡片渲染服务。
-4. 卡片渲染服务运行卡片页面代码widgets.abc,widgets.abc按新数据进行渲染,并将渲染后的数据发送至卡片使用方对应的[卡片组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md)。
+4. 卡片渲染服务运行卡片页面代码widgets.abc,widgets.abc按新数据进行渲染,并将渲染后的数据发送至卡片使用方对应的[卡片组件](../reference/arkui-ts/ts-basic-components-formcomponent.md)。
数据提供方提供的共享数据有两种类型:
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md b/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md
index e40413e81bc389fd857b19081dc3b7bdd17159de..7585bbc02e566a5747acb8ba75acab6f8e224929 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md
@@ -26,7 +26,7 @@
- 统一开发范式,提升开发体验和开发效率。
- OpenHarmony在2022年发布了声明式范式的UI开发框架,而卡片还延续了css/hml/json三段式类Web范式的开发方式,提高了开发者的学习成本,提供ArkTS卡片能力后,统一了卡片和页面的开发范式,页面的布局可以直接复用到卡片布局中,提升开发体验和开发效率。
+ 提供ArkTS卡片能力后,统一了卡片和页面的开发范式,页面的布局可以直接复用到卡片布局中,提升开发体验和开发效率。
**图3** 卡片工程结构对比

diff --git a/zh-cn/application-dev/application-models/context-switch.md b/zh-cn/application-dev/application-models/context-switch.md
index d6128dfadc468b2d1b011d8a3a6881979812691e..7afa990d780227c94149610baed51abd09953e86 100644
--- a/zh-cn/application-dev/application-models/context-switch.md
+++ b/zh-cn/application-dev/application-models/context-switch.md
@@ -10,7 +10,7 @@
| [getBundleName(callback : AsyncCallback<string>): void;](../reference/apis/js-apis-inner-app-context.md#contextgetbundlename7)
[getBundleName(): Promise<string>;](../reference/apis/js-apis-inner-app-context.md#contextgetbundlename7-1) | application\UIAbilityContext.d.ts | [abilityInfo.bundleName: string;](../reference/apis/js-apis-inner-application-uiAbilityContext.md#属性) |
| [getDisplayOrientation(callback : AsyncCallback<bundle.DisplayOrientation>): void;](../reference/apis/js-apis-inner-app-context.md#contextgetdisplayorientation7)
[getDisplayOrientation(): Promise<bundle.DisplayOrientation>;](../reference/apis/js-apis-inner-app-context.md#contextgetdisplayorientation7-1) | \@ohos.screen.d.ts | [readonly orientation: Orientation;](../reference/apis/js-apis-screen.md#orientation) |
| [setDisplayOrientation(orientation:bundle.DisplayOrientation, callback:AsyncCallback<void>):void;](../reference/apis/js-apis-inner-app-context.md#contextsetdisplayorientation7)
[setDisplayOrientation(orientation:bundle.DisplayOrientation):Promise<void>;](../reference/apis/js-apis-inner-app-context.md#contextsetdisplayorientation7-1) | \@ohos.screen.d.ts | [setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void;](../reference/apis/js-apis-screen.md#setorientation)
[setOrientation(orientation: Orientation): Promise<void>;](../reference/apis/js-apis-screen.md#setorientation-1) |
-| [setShowOnLockScreen(show:boolean, callback:AsyncCallback<void>):void;](../reference/apis/js-apis-inner-app-context.md#contextsetshowonlockscreen7)
[setShowOnLockScreen(show:boolean):Promise<void>;](../reference/apis/js-apis-inner-app-context.md#contextsetshowonlockscreen7-1) | \@ohos.window.d.ts | [setShowOnLockScreen(showOnLockScreen: boolean): void;](../reference/apis/js-apis-window.md#setshowonlockscreen9) |
+| [setShowOnLockScreen(show:boolean, callback:AsyncCallback<void>):void;](../reference/apis/js-apis-inner-app-context.md#contextsetshowonlockscreendeprecated)
[setShowOnLockScreen(show:boolean):Promise<void>;](../reference/apis/js-apis-inner-app-context.md#contextsetshowonlockscreendeprecated-1) | \@ohos.window.d.ts | [setShowOnLockScreen(showOnLockScreen: boolean): void;](../reference/apis/js-apis-window.md#setshowonlockscreen9) |
| [setWakeUpScreen(wakeUp:boolean, callback:AsyncCallback<void>):void;](../reference/apis/js-apis-inner-app-context.md#contextsetwakeupscreen7)
[setWakeUpScreen(wakeUp:boolean):Promise<void>;](../reference/apis/js-apis-inner-app-context.md#contextsetwakeupscreen7-1) | \@ohos.window.d.ts | [setWakeUpScreen(wakeUp: boolean): void;](../reference/apis/js-apis-window.md#setwakeupscreen9) |
| [getProcessInfo(callback:AsyncCallback<ProcessInfo>):void;](../reference/apis/js-apis-inner-app-context.md#contextgetprocessinfo7)
[getProcessInfo():Promise<ProcessInfo>;](../reference/apis/js-apis-inner-app-context.md#contextgetprocessinfo7-1) | \@ohos.app.ability.abilityManager.d.ts | [getAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void;](../reference/apis/js-apis-app-ability-abilityManager.md#getabilityrunninginfos)
[getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>;](../reference/apis/js-apis-app-ability-abilityManager.md#getabilityrunninginfos-1) |
| [getElementName(callback:AsyncCallback<ElementName>):void;](../reference/apis/js-apis-inner-app-context.md#contextgetelementname7)
[getElementName():Promise<ElementName>;](../reference/apis/js-apis-inner-app-context.md#contextgetelementname7-1) | application\UIAbilityContext.d.ts | [abilityInfo.name: string;](../reference/apis/js-apis-inner-application-uiAbilityContext.md#属性)
[abilityInfo.bundleName: string;](../reference/apis/js-apis-inner-application-uiAbilityContext.md#属性) |
diff --git a/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md b/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md
index 31e35a31aeabed1da53d70e0ba58fb38990e1175..fc285a97f12eef0c1b677a5ddfe98b7692bd47e1 100644
--- a/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md
+++ b/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md
@@ -18,7 +18,7 @@
| action | string | 否 | 否 | 系统匹配时将忽略该参数,但仍可作为参数传递给目标应用组件。 |
| entities | Array<string> | 否 | 否 | 系统匹配时将忽略该参数,但仍可作为参数传递给目标应用组件。 |
| flags | number | 否 | 否 | 不参与匹配,直接传递给系统处理,一般用来设置运行态信息,例如URI数据授权等。 |
-| parameters | {[key: string]: any} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
+| parameters | {[key: string]: Object} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
## 隐式Want匹配原理
@@ -35,7 +35,7 @@
| action | string | 是 | 否 | |
| entities | Array<string> | 是 | 否 | |
| flags | number | 否 | 否 | 不参与匹配,直接传递给系统处理,一般用来设置运行态信息,例如URI数据授权等。 |
-| parameters | {[key: string]: any} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
+| parameters | {[key: string]: Object} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
从隐式Want的定义,可得知:
diff --git a/zh-cn/application-dev/application-models/figures/WidgetCreateProject.png b/zh-cn/application-dev/application-models/figures/WidgetCreateProject.png
new file mode 100644
index 0000000000000000000000000000000000000000..2372e68a25c116ace77374eba86a8ea7a0680988
Binary files /dev/null and b/zh-cn/application-dev/application-models/figures/WidgetCreateProject.png differ
diff --git a/zh-cn/application-dev/application-models/figures/WidgetModules.png b/zh-cn/application-dev/application-models/figures/WidgetModules.png
index e9a91b92b7ff81b5ab8a014aeeb779eb0653f25a..970a4a93159f697e505efbfa6fc7563b0d3c822a 100644
Binary files a/zh-cn/application-dev/application-models/figures/WidgetModules.png and b/zh-cn/application-dev/application-models/figures/WidgetModules.png differ
diff --git a/zh-cn/application-dev/application-models/figures/WidgetProjectView.png b/zh-cn/application-dev/application-models/figures/WidgetProjectView.png
index 9d1c06e47502131983b0b7cd56e66269b5be6d88..a1c8b42becc089b6b69f58c362569faeaf84f06f 100644
Binary files a/zh-cn/application-dev/application-models/figures/WidgetProjectView.png and b/zh-cn/application-dev/application-models/figures/WidgetProjectView.png differ
diff --git a/zh-cn/application-dev/application-models/figures/WidgetUpdatePage.png b/zh-cn/application-dev/application-models/figures/WidgetUpdatePage.png
deleted file mode 100644
index 24ba6ae125dac0acf426e61d6a9dd71630f55294..0000000000000000000000000000000000000000
Binary files a/zh-cn/application-dev/application-models/figures/WidgetUpdatePage.png and /dev/null differ
diff --git a/zh-cn/application-dev/application-models/figures/widget-update-after.PNG b/zh-cn/application-dev/application-models/figures/widget-update-after.PNG
new file mode 100644
index 0000000000000000000000000000000000000000..fddb9f651685332324af9a4d065c29638a58c0ba
Binary files /dev/null and b/zh-cn/application-dev/application-models/figures/widget-update-after.PNG differ
diff --git a/zh-cn/application-dev/application-models/figures/widget-update-before.PNG b/zh-cn/application-dev/application-models/figures/widget-update-before.PNG
new file mode 100644
index 0000000000000000000000000000000000000000..6355f1b66707af8073a2e1dea7f05e839f3a9818
Binary files /dev/null and b/zh-cn/application-dev/application-models/figures/widget-update-before.PNG differ
diff --git a/zh-cn/application-dev/application-models/hop-cross-device-migration.md b/zh-cn/application-dev/application-models/hop-cross-device-migration.md
index f8e215e21f9661168291de9d3222ef2aada3aa91..855da0ff4beb9feda0e159841923800a5a274645 100644
--- a/zh-cn/application-dev/application-models/hop-cross-device-migration.md
+++ b/zh-cn/application-dev/application-models/hop-cross-device-migration.md
@@ -46,7 +46,7 @@
| **接口名** | **描述** |
| -------- | -------- |
-| onContinue(wantParam : {[key: string]: any}): OnContinueResult | 迁移发起端在该回调中保存迁移所需要的数据,同时返回是否同意迁移:
- AGREE:表示同意。
- REJECT:表示拒绝:如应用在onContinue中异常可以直接REJECT。
- MISMATCH:表示版本不匹配:迁移发起端应用可以在onContinue中获取到迁移接收端应用的版本号,进行协商后,如果版本不匹配导致无法迁移,可以返回该错误。 |
+| onContinue(wantParam : {[key: string]: Object}): OnContinueResult | 迁移发起端在该回调中保存迁移所需要的数据,同时返回是否同意迁移:
- AGREE:表示同意。
- REJECT:表示拒绝:如应用在onContinue中异常可以直接REJECT。
- MISMATCH:表示版本不匹配:迁移发起端应用可以在onContinue中获取到迁移接收端应用的版本号,进行协商后,如果版本不匹配导致无法迁移,可以返回该错误。 |
| onCreate(want: Want, param: AbilityConstant.LaunchParam): void; | 应用迁移接收端为冷启动或多实例应用热启动时,在该回调中完成数据恢复,并触发页面恢复。详见[应用组件启动模式](uiability-launch-type.md) |
| onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | 迁移接收端为单实例应用热启动时,在该回调中完成数据恢复,并触发页面恢复。详见[应用组件启动模式](uiability-launch-type.md) |
diff --git a/zh-cn/application-dev/application-models/js-ui-widget-development.md b/zh-cn/application-dev/application-models/js-ui-widget-development.md
index 85be9e3325327ce6ae69da98e88a909c167757be..24a6abb2d41705f9b7c76141f79f5ad2c1d0c2fb 100644
--- a/zh-cn/application-dev/application-models/js-ui-widget-development.md
+++ b/zh-cn/application-dev/application-models/js-ui-widget-development.md
@@ -55,7 +55,7 @@ FormExtensionAbility类拥有如下API接口,具体的API介绍详见[接口
| onFormEvent(formId: string, message: string): void | 卡片提供方接收处理卡片事件的通知接口。 |
| onRemoveForm(formId: string): void | 卡片提供方接收销毁卡片的通知接口。 |
| onConfigurationUpdate(config: Configuration): void | 当系统配置更新时调用。 |
-| onShareForm?(formId: string): { [key: string]: any } | 卡片提供方接收卡片分享的通知接口。 |
+| onShareForm?(formId: string): { [key: string]: Object } | 卡片提供方接收卡片分享的通知接口。 |
formProvider类有如下API接口,具体的API介绍详见[接口文档](../reference/apis/js-apis-app-form-formProvider.md)。
diff --git a/zh-cn/application-dev/application-models/lifecycleapp-switch.md b/zh-cn/application-dev/application-models/lifecycleapp-switch.md
index d1d37d01d3f44ed1c86ccb53a461ac20bfafed32..55eb8d71971f8cc80ef26719257e8db4f761c172 100644
--- a/zh-cn/application-dev/application-models/lifecycleapp-switch.md
+++ b/zh-cn/application-dev/application-models/lifecycleapp-switch.md
@@ -9,11 +9,11 @@
| onCreate?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) |
| onWindowDisplayModeChanged?(isShownInMultiWindow: boolean, newConfig: resourceManager.Configuration): void; | Stage模型无对应接口 | 暂时未提供对应接口 |
| onStartContinuation?(): boolean; | Stage模型无对应接口 | Stage模型上,应用无需感知迁移是否成功(由应用发起迁移请求时感知),onStartContinuation废弃 |
-| onSaveData?(data: Object): boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
+| onSaveData?(data: Object): boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam : {[key: string]: Object}): AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
| onCompleteContinuation?(result: number): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
| onRestoreData?(data: Object): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)
[onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant)
多实例模式Ability迁移目标端在onCreate回调中完成数据恢复,单实例模式应用迁移目标端在onCreate回调中完成数据恢复,回调中通过判断launchParam.launchReason可获取迁移启动的场景,从而可以从Want中获取迁移前保存的数据 |
| onRemoteTerminated?(): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
-| onSaveAbilityState?(outState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
+| onSaveAbilityState?(outState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
| onRestoreAbilityState?(inState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)
应用重启后会触发Ability的onCreate方法,通过判断launchParam.launchReason可获取自恢复的场景,从而可以从Want中获取重启前保存的数据 |
| onInactive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onBackground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonbackground) |
| onActive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onForeground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonforeground) |
diff --git a/zh-cn/application-dev/application-models/lifecycleform-switch.md b/zh-cn/application-dev/application-models/lifecycleform-switch.md
index fbe5ac639ba698dd5ec967a2f1983b8e9f2da32f..7b0414b44e6ea43cdd9891f31b83aae1d48120b2 100644
--- a/zh-cn/application-dev/application-models/lifecycleform-switch.md
+++ b/zh-cn/application-dev/application-models/lifecycleform-switch.md
@@ -10,4 +10,4 @@
| onEvent?(formId: string, message: string): void; | \@ohos.app.form.FormExtensionAbility.d.ts | [onFormEvent(formId: string, message: string): void;](../reference/apis/js-apis-app-form-formExtensionAbility.md#onformevent) |
| onDestroy?(formId: string): void; | \@ohos.app.form.FormExtensionAbility.d.ts | [onRemoveForm(formId: string): void;](../reference/apis/js-apis-app-form-formExtensionAbility.md#onremoveform) |
| onAcquireFormState?(want: Want): formInfo.FormState; | \@ohos.app.form.FormExtensionAbility.d.ts | [onAcquireFormState?(want: Want): formInfo.FormState;](../reference/apis/js-apis-app-form-formExtensionAbility.md#onacquireformstate) |
-| onShare?(formId: string): {[key: string]: any}; | \@ohos.app.form.FormExtensionAbility.d.ts | [onShareForm?(formId: string): { [key: string]: any };](../reference/apis/js-apis-app-form-formExtensionAbility.md#onshareform) |
+| onShare?(formId: string): {[key: string]: Object}; | \@ohos.app.form.FormExtensionAbility.d.ts | [onShareForm?(formId: string): { [key: string]: Object };](../reference/apis/js-apis-app-form-formExtensionAbility.md#onshareform) |
diff --git a/zh-cn/application-dev/application-models/particleability-switch.md b/zh-cn/application-dev/application-models/particleability-switch.md
index 8e85eb0d1789e958433d9cdfc50643dfc988dc1c..60f54af98a2109502b9eaf90377719b8bd8e7bbe 100644
--- a/zh-cn/application-dev/application-models/particleability-switch.md
+++ b/zh-cn/application-dev/application-models/particleability-switch.md
@@ -8,5 +8,5 @@
| [connectAbility(request: Want, options:ConnectOptions ): number;](../reference/apis/js-apis-ability-particleAbility.md#particleabilityconnectability) | application\ServiceExtensionContext.d.ts | [connectAbility(want: Want, options: ConnectOptions): number;](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextconnectserviceextensionability)
[connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextconnectserviceextensionability) |
| [disconnectAbility(connection: number, callback:AsyncCallback<void>): void;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitydisconnectability)
[disconnectAbility(connection: number): Promise<void>;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitydisconnectability-1) | application\ServiceExtensionContext.d.ts | [disconnectAbility(connection: number, callback:AsyncCallback<void>): void; ](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextdisconnectserviceextensionability)
[disconnectAbility(connection: number): Promise<void>;](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextdisconnectserviceextensionability-1)
[disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextdisconnectserviceextensionability)
[disconnectServiceExtensionAbility(connection: number): Promise<void>;](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextdisconnectserviceextensionability-1) |
| [acquireDataAbilityHelper(uri: string): DataAbilityHelper;](../reference/apis/js-apis-ability-particleAbility.md#particleabilityacquiredataabilityhelper) | \@ohos.data.dataShare.d.ts
[\@ohos.data.fileAccess.d.ts | [createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void;](../reference/apis/js-apis-data-dataShare.md#datasharecreatedatasharehelper)
[createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper>;](../reference/apis/js-apis-data-dataShare.md#datasharecreatedatasharehelper-1)
[createFileAccessHelper(context: Context): FileAccessHelper;](../reference/apis/js-apis-fileAccess.md#fileaccesscreatefileaccesshelper-1)
[createFileAccessHelper(context: Context, wants: Array<Want>): FileAccessHelper;](../reference/apis/js-apis-fileAccess.md#fileaccesscreatefileaccesshelper) |
-| [startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback<void>): void;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitystartbackgroundrunning)
[startBackgroundRunning(id: number, request: NotificationRequest): Promise<void>;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitystartbackgroundrunning-1) | \@ohos.resourceschedule.backgroundTaskManager.d.ts | [startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstartbackgroundrunningcallback)
[startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise<void>;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstartbackgroundrunningpromise) |
-| [cancelBackgroundRunning(callback: AsyncCallback<void>): void;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitycancelbackgroundrunning)
[cancelBackgroundRunning(): Promise<void>;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitycancelbackgroundrunning-1) | \@ohos.resourceschedule.backgroundTaskManager.d.ts | [stopBackgroundRunning(context: Context, callback: AsyncCallback): void;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstopbackgroundrunningcallback)
[stopBackgroundRunning(context: Context): Promise<void>;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstopbackgroundrunningpromise) |
+| [startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback<void>): void;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitystartbackgroundrunning)
[startBackgroundRunning(id: number, request: NotificationRequest): Promise<void>;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitystartbackgroundrunning-1) | \@ohos.resourceschedule.backgroundTaskManager.d.ts | [startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstartbackgroundrunning)
[startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise<void>;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstartbackgroundrunning-1) |
+| [cancelBackgroundRunning(callback: AsyncCallback<void>): void;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitycancelbackgroundrunning)
[cancelBackgroundRunning(): Promise<void>;](../reference/apis/js-apis-ability-particleAbility.md#particleabilitycancelbackgroundrunning-1) | \@ohos.resourceschedule.backgroundTaskManager.d.ts | [stopBackgroundRunning(context: Context, callback: AsyncCallback): void;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstopbackgroundrunning)
[stopBackgroundRunning(context: Context): Promise<void>;](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#backgroundtaskmanagerstopbackgroundrunning-1) |
diff --git a/zh-cn/application-dev/arkts-utils/xml-conversion.md b/zh-cn/application-dev/arkts-utils/xml-conversion.md
index dfaa9db3f6d5ad6c53a06c400fbb3acd1a3e6a23..a47c733357337a7d2d52714df8d8c2bf160fa186 100644
--- a/zh-cn/application-dev/arkts-utils/xml-conversion.md
+++ b/zh-cn/application-dev/arkts-utils/xml-conversion.md
@@ -4,7 +4,7 @@
将XML文本转换为JavaScript对象可以更轻松地处理和操作数据,并且更适合在JavaScript应用程序中使用。
-语言基础类库提供ConvertXML类将xml文本转换为JavaScript对象,输入为待转换的XML字符串及转换选项,输出为转换后的JavaScript对象。具体转换选项可见[API参考@ohos.convertxml](../reference/apis/js-apis-convertxml.md)。
+语言基础类库提供ConvertXML类将XML文本转换为JavaScript对象,输入为待转换的XML字符串及转换选项,输出为转换后的JavaScript对象。具体转换选项可见[API参考@ohos.convertxml](../reference/apis/js-apis-convertxml.md)。
## 注意事项
diff --git a/zh-cn/application-dev/dfx/cppcrash-guidelines.md b/zh-cn/application-dev/dfx/cppcrash-guidelines.md
index 33e34e3c0caee52f25231bf3e3aeeae40425686d..e4a18bdd91431ded5f42e4ca753e64ba1556b8ee 100644
--- a/zh-cn/application-dev/dfx/cppcrash-guidelines.md
+++ b/zh-cn/application-dev/dfx/cppcrash-guidelines.md
@@ -96,8 +96,10 @@ Thread name:crasher <- 异常线程名
使用addr2line工具根据偏移地址解析行号:
+ [product name]为具体设备名。
+
```
- root:~/OpenHarmony/out/rk3568/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 0000332c
+ root:~/OpenHarmony/out/[product name]/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 0000332c
base/hiviewdfx/faultloggerd/tools/crasher/dfx_crasher.c:57
```
diff --git a/zh-cn/application-dev/faqs/Readme-CN.md b/zh-cn/application-dev/faqs/Readme-CN.md
index 5124f23cbedb7a8d44e567c070e24ba936a351a4..aaea1d7dcd0db10cf4ede3d40a8d2302bb76ec57 100644
--- a/zh-cn/application-dev/faqs/Readme-CN.md
+++ b/zh-cn/application-dev/faqs/Readme-CN.md
@@ -2,7 +2,7 @@
- [如何编译full-SDK](full-sdk-compile-guide.md)
- [如何替换full-SDK](full-sdk-switch-guide.md)
-- [如何在CMake工程中使用OpenHarmony SDK的Native API(NDK)](howto-migrate-cmake-with-ohosndk.md)
+- [如何在CMake工程中使用NDK](cmake-with-ndk.md)
- [应用模型常见问题](faqs-ability.md)
- ArkUI框架开发常见问题(ArkTS)
- [ArkTS语法使用常见问题](faqs-arkui-arkts.md)
diff --git a/zh-cn/application-dev/faqs/howto-migrate-cmake-with-ohosndk.md b/zh-cn/application-dev/faqs/cmake-with-ndk.md
similarity index 79%
rename from zh-cn/application-dev/faqs/howto-migrate-cmake-with-ohosndk.md
rename to zh-cn/application-dev/faqs/cmake-with-ndk.md
index 18cbb9628113b1794e78d2ea7f5358e6637c5b6c..21bab6240e263c1211ce0318a2381c1056773c7d 100644
--- a/zh-cn/application-dev/faqs/howto-migrate-cmake-with-ohosndk.md
+++ b/zh-cn/application-dev/faqs/cmake-with-ndk.md
@@ -6,55 +6,55 @@
## 如何下载Native API开发包(NDK)
-1. 推荐OpenHarmony正式发布的SDK包 ,下载链接可以从OpenHarmony正式发布版本的[release-notes](../../release-notes/OpenHarmony-v3.2-release.md)中获取,点击release notes中【从站点镜像获取】章节下载。
+1. 推荐使用OpenHarmony正式发布的SDK包 ,下载链接可以从OpenHarmony正式发布版本的[release-notes](../../release-notes/OpenHarmony-v3.2-release.md)中获取,点击release notes中【从站点镜像获取】章节下载。
-2. IDE OpenHarmony SDK Manager中下载
+2. IDE OpenHarmony SDK Manager中下载。
-3. 从每日构建中下载,下载地址 http://ci.openharmony.cn/workbench/cicd/dailybuild/dailylist ,形态组件选择ohos-sdk
+3. 从每日构建中下载,下载地址 http://ci.openharmony.cn/workbench/cicd/dailybuild/dailylist ,形态组件选择ohos-sdk。

## 解压Native API开发包
-下载完成之后,将压缩包放入自己创建好的文件夹下解压,解压完成效果如下图所示:
+下载完成之后,将压缩包放入创建好的文件夹下解压,解压完成效果如下图所示:

配置Linux下的环境,如果只是在IDE中使用,跳过下面几步:
-将NDK自带的cmake编译工具添加到环境变量中
+将NDK自带的CMake编译工具添加到环境变量中。
```
#打开.bashrc文件
vim ~/.bashrc
- #在文件最后添加cmake路径,该路径是自己的放置文件的路径,之后保存退出
+ #在文件最后添加CMake路径,具体路径用实际放置SDK路径代替
export PATH=~/ohos-sdk/ohos-sdk/linux/native/build-tools/cmake/bin:$PATH
#在命令行执行source ~/.bashrc使环境变量生效
source ~/.bashrc
```
-查看cmake默认路径
+查看CMake默认路径。
```
- #在命令行输入which cmake
+ #在命令行输入which命令查询当前CMake所在路径
which cmake
- #结果,和自己设置的路径一样
+ #结果路径与.bashrc中设置一致
~/ohos-sdk/ohos-sdk/linux/native/build-tools/cmake/bin/cmake
```
## 如何使用Native API开发包编译一个native程序
-应用开发者可以通过Native API开发包快速的开发出native动态库,静态库与可执行文件,ArkUI应用程序框架可以通过NAPI框架调用到native的动态库中。开发包提供CMake作为官方的编译构建工具。下面通过自己编写一个C/C++ demo工程来演示如何使用Native API开发包来编译C/C++动态库。
+应用开发者可以通过Native API开发包快速的开发出native动态库,静态库与可执行文件,ArkUI应用程序框架可以通过NAPI框架调用到native的动态库中。开发包提供CMake作为官方的编译构建工具。下面通过编写一个C/C++ demo工程来演示如何使用Native API开发包来编译C/C++动态库。
### NDK中的文件夹简介
#### build目录中工具链文件ohos.toolchain.cmake
-cmake编译时需要读取该文件中的默认值,比如编译器架构、C++库链接方式等,这个需要在编译时通过CMAKE_TOOLCHAIN_FILE指出该文件的路径,便于cmake在编译时定位到该文件。在编译的时候需要为cmake指定参数来控制编译目标的属性,具体要指定的参数在下面的[命令行构建](#命令行构建)会具体介绍。
+CMake编译时需要读取该文件中的默认值,比如编译器架构、C++库链接方式等,这个需要在编译时通过CMAKE_TOOLCHAIN_FILE指出该文件的路径,便于CMake在编译时定位到该文件。在编译的时候需要为CMake指定参数来控制编译目标的属性,具体要指定的参数在下面的[命令行构建](#命令行构建)会具体介绍。
#### build-tools文件夹放的是NDK提供的编译工具
```
- #键入下一行命令查看cmake的版本
+ #键入下一行命令查看CMake的版本
cmake -version
#结果
cmake version 3.16.5
@@ -84,7 +84,7 @@ cmake编译时需要读取该文件中的默认值,比如编译器架构、C++
#### CMakeLists.txt内容
```
- # 指定cmake的最小版本
+ # 指定CMake的最小版本
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
# 工程名称,这里我们就叫HELLO
@@ -118,7 +118,7 @@ cmake编译时需要读取该文件中的默认值,比如编译器架构、C++
TARGET_LINK_LIBRARIES(Hello PUBLIC sum)
```
-详细CMake手册参考 https://cmake.org/cmake/help/v3.16/guide/tutorial/
+详细CMake手册参考 https://cmake.org/cmake/help/v3.16/guide/tutorial/ 。
#### 源码内容
@@ -166,9 +166,9 @@ sum.cpp源码
### 命令行构建
-在工程目录下,创建build目录,用来放置cmake构建时产生的中间文件。注意: ohos-sdk是下载下来的SDK的根目录,开发者需要自行替换成实际的下载目录。
+在工程目录下,创建build目录,用来放置CMake构建时产生的中间文件。注意: ohos-sdk是下载下来的SDK的根目录,开发者需要自行替换成实际的下载目录。
-1. 采用OHOS_STL=c++_shared动态编译
+1. 采用OHOS_STL=c++_shared动态编译。
```
>mkdir build && cd build
@@ -176,7 +176,7 @@ sum.cpp源码
>cmake --build .
```
-2. 采用OHOS_STL=c++_static静态编译
+2. 采用OHOS_STL=c++_static静态编译。
```
>mkdir build && cd build
diff --git a/zh-cn/application-dev/faqs/faqs-ability.md b/zh-cn/application-dev/faqs/faqs-ability.md
index e69186419239818a9ba9a966899e71fadf1234d1..8f82923f076a2c144b52ddbd544e45f3ffd5d190 100644
--- a/zh-cn/application-dev/faqs/faqs-ability.md
+++ b/zh-cn/application-dev/faqs/faqs-ability.md
@@ -221,7 +221,7 @@ Failure\[INSTALL\_FAILED\_SIZE\_TOO\_LARGE\] error while deploying hap?
**参考链接**
-[cacheDir](../application-models/application-context-stage.md#获取应用开发路径)
+[cacheDir](../application-models/application-context-stage.md#获取应用文件路径)
## 服务卡片生命周期回调函数在哪个js文件中调用
@@ -266,7 +266,7 @@ DevEco Studio默认下载是public-sdk。
**参考链接**
-[获取应用开发路径](../application-models/application-context-stage.md#获取应用开发路径)
+[获取应用文件路径](../application-models/application-context-stage.md#获取应用文件路径)
## terminateSelf方法销毁当前应用之后并没有在后台任务列表中删除
@@ -486,7 +486,7 @@ struct AbilityContextTest {
[长时任务权限](../security/permission-list.md#ohospermissionkeep_background_running)
-[长时任务开发指导](../task-management/continuous-task-dev-guide.md#基于stage模型)
+[长时任务开发指导](../task-management/continuous-task.md)
## FA卡片如何进行数据交互
diff --git a/zh-cn/application-dev/faqs/faqs-arkui-animation-interactive-event.md b/zh-cn/application-dev/faqs/faqs-arkui-animation-interactive-event.md
index 4860a20ecd34c00ba7d3d385123df465b9c61831..705dee0c10cd44b320c951a2bef8f608209b730d 100644
--- a/zh-cn/application-dev/faqs/faqs-arkui-animation-interactive-event.md
+++ b/zh-cn/application-dev/faqs/faqs-arkui-animation-interactive-event.md
@@ -194,7 +194,7 @@ struct PageTransition2 {
**参考链接**
-[页面转场动画](https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/ui/arkts-page-transition-animation.md/)
+[页面转场动画](../reference/arkui-ts/ts-page-transition-animation.md)
## 自定义组件间如何实现从底部滑入滑出的效果
@@ -269,5 +269,5 @@ struct ComponentChild2 {
**参考链接**
-[组件内转场动画](https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/ui/arkts-transition-animation-within-component.md/)
+[组件内转场动画](../ui/arkts-enter-exit-transition.md)
diff --git a/zh-cn/application-dev/faqs/faqs-multimedia.md b/zh-cn/application-dev/faqs/faqs-multimedia.md
index f22280c5696d4dfaf74e72ded586c69597d07ad9..06383db8238371a594b39842e8b6fd6a1404c2d4 100644
--- a/zh-cn/application-dev/faqs/faqs-multimedia.md
+++ b/zh-cn/application-dev/faqs/faqs-multimedia.md
@@ -98,7 +98,7 @@ AVSession对媒体播放做了管控,当三方应用从前台切入后台或
**参考链接**
-[后台任务管理的长时任务开发指导参考](../task-management/continuous-task-dev-guide.md)
+[后台任务管理的长时任务开发指导参考](../task-management/continuous-task.md)
[AVSession开发指导参考](../media/using-avsession-developer.md)
diff --git a/zh-cn/application-dev/file-management/app-file-access.md b/zh-cn/application-dev/file-management/app-file-access.md
index e974394d85fb090deb66210fa3dd66a3958421af..e7924858d1033f6231df862bade0a22de13c673a 100644
--- a/zh-cn/application-dev/file-management/app-file-access.md
+++ b/zh-cn/application-dev/file-management/app-file-access.md
@@ -34,7 +34,7 @@
## 开发示例
-在对应用文件开始访问前,开发者需要[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。以从UIAbilityContext获取HAP级别的文件路径为例进行说明,UIAbilityContext的获取方式请参见[获取UIAbility的上下文信息](../application-models/uiability-usage.md#获取uiability的上下文信息)。
+在对应用文件开始访问前,开发者需要[获取应用文件路径](../application-models/application-context-stage.md#获取应用文件路径)。以从UIAbilityContext获取HAP级别的文件路径为例进行说明,UIAbilityContext的获取方式请参见[获取UIAbility的上下文信息](../application-models/uiability-usage.md#获取uiability的上下文信息)。
下面介绍几种常用操作示例。
diff --git a/zh-cn/application-dev/file-management/share-app-file.md b/zh-cn/application-dev/file-management/share-app-file.md
index e3424cdb36636dfaa409068559842bf45ec8ba10..2d93e836d3387cbcbe2f1f18ce7741ad4bdc4aab 100644
--- a/zh-cn/application-dev/file-management/share-app-file.md
+++ b/zh-cn/application-dev/file-management/share-app-file.md
@@ -22,7 +22,7 @@
## 分享文件给其他应用
-在分享文件给其他应用前,开发者需要先[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。
+在分享文件给其他应用前,开发者需要先[获取应用文件路径](../application-models/application-context-stage.md#获取应用文件路径)。
1. 获取文件在应用沙箱中的路径,并转换为文件URI。
diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md b/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md
index 0d9e8cfe73c3b13cfd09f3611dc0faa569e4fdc6..7f7cf3786f62b95754f79d066dd083db0a893039 100644
--- a/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md
+++ b/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md
@@ -58,8 +58,6 @@ DevEco Studio的基本使用,请参考[DevEco Studio使用指南](../../quick-
> **说明:**
> - 在一个工程中同一个设备类型只支持一个Entry类型的模块。
>
-> - 当前的DevEco Studio(3.1.1 Release)在创建工程时,设备类型仅能选择phone和tablet,默认该模块已经选择了entry类型,那么在创建wearable这个模块,只能选择feature类型。
->
> - 在下一个小节,我们将介绍如何修改Module的配置,包括Module的类型以及其支持的设备类型等。
@@ -115,7 +113,7 @@ DevEco Studio的基本使用,请参考[DevEco Studio使用指南](../../quick-
同样的,修改feature1和feature2模块中的oh-package.json文件,使其可以使用common模块中的代码。
-修改oh-package.json文件后,一定要点击右上角的“Sync Now”,否则改动不会生效!
+修改oh-package.json文件后,请点击右上角的“Sync Now”,否则改动不会生效。
## 引用ohpm包中的代码
diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md
index 78e8fced82673e71ce3a09a726d46a10124a7621..0817e2f588d3b5400ba5684aa5f80566d51a5997 100644
--- a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md
+++ b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md
@@ -354,16 +354,10 @@ struct MultiLaneList {
struct SideBarSample {
@StorageLink('currentBreakpoint') private currentBreakpoint: string = "md";
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
- @State showSideBar: boolean = false
@State selectIndex: number = 0;
aboutToAppear() {
- this.breakpointSystem.register()
- if (this.currentBreakpoint === 'sm') {
- this.showSideBar = false
- } else {
- this.showSideBar = true
- }
+ this.breakpointSystem.register()
}
aboutToDisappear() {
@@ -382,9 +376,6 @@ struct SideBarSample {
.height(36)
.onClick(() => {
this.selectIndex = index
- if (this.currentBreakpoint === 'sm') {
- this.showSideBar = false
- }
})
}
@@ -412,9 +403,8 @@ struct SideBarSample {
.maxSideBarWidth(this.currentBreakpoint === 'sm' ? '100%' : '33.33%')
.showControlButton(this.currentBreakpoint === 'sm')
.autoHide(false)
- .showSideBar(this.showSideBar)
.onChange((isBarShow: boolean) => {
- this.showSideBar = isBarShow
+
})
}
}
diff --git a/zh-cn/application-dev/media/Readme-CN.md b/zh-cn/application-dev/media/Readme-CN.md
index 5b3d92fad526aed9daaf7202ef0cc267e59f4d63..863a030c1944ff138d1e0ec10f5ea49bc1318c2e 100755
--- a/zh-cn/application-dev/media/Readme-CN.md
+++ b/zh-cn/application-dev/media/Readme-CN.md
@@ -31,6 +31,7 @@
- [开发音频通话功能](audio-call-development.md)
- [视频播放](video-playback.md)
- [视频录制](video-recording.md)
+ - [屏幕录制](avscreen-capture.md)
- 音视频编解码
- [获取支持的编解码能力](obtain-supported-codecs.md)
- [音频编码](audio-encoding.md)
diff --git a/zh-cn/application-dev/media/audio-playback-overview.md b/zh-cn/application-dev/media/audio-playback-overview.md
index 779bde89fd1dafa86bf9c528ffdb2cf870968aa5..d2d0fd340d2161f15bde2fd380b6ac40a9370cef 100644
--- a/zh-cn/application-dev/media/audio-playback-overview.md
+++ b/zh-cn/application-dev/media/audio-playback-overview.md
@@ -20,6 +20,6 @@
1. 使用媒体会话功能注册到系统内统一管理,否则在应用进入后台时,播放将被强制停止。具体参考[媒体会话开发指导](avsession-overview.md)。
-2. 申请长时任务避免进入挂起(Suspend)状态。具体参考[长时任务开发指导](../task-management/continuous-task-dev-guide.md)。
+2. 申请长时任务避免进入挂起(Suspend)状态。具体参考[长时任务开发指导](../task-management/continuous-task.md)。
当应用进入后台,播放被中断,如果被媒体会话管控,将打印日志“pause id”;如果没有该日志,则说明被长时任务管控。
diff --git a/zh-cn/application-dev/media/avscreen-capture.md b/zh-cn/application-dev/media/avscreen-capture.md
new file mode 100644
index 0000000000000000000000000000000000000000..b1614258308d05aeb6d5d0a957aa3fabaec6c071
--- /dev/null
+++ b/zh-cn/application-dev/media/avscreen-capture.md
@@ -0,0 +1,237 @@
+# 屏幕录制
+
+屏幕录制主要为主屏幕录屏功能。
+
+开发者可以调用录屏(AVScreenCapture)模块的Native API接口,完成屏幕录制,采集设备内、麦克风等的音视频源数据。当开发直播、办公等应用时,可以调用录屏模块获取音视频原始码流,然后通过流的方式流转到其他模块处理,达成直播时共享桌面的场景。
+
+录屏模块和窗口(Window)、图形(Graphic)等模块完成整个视频采集的流程。
+
+当前在进行屏幕录制时默认使用主屏,图形默认根据主屏生产录屏帧数据到显示数据缓冲队列,录屏框架从显示数据缓冲队列获取数据进行相应消费处理。
+
+## 开发指导
+
+使用AVScreenCapture录制屏幕涉及到AVScreenCapture实例的创建、音视频采集参数的配置、采集的开始与停止、资源的释放等。本开发指导将以一次录制屏幕数据的过程为例,向开发者讲解如何使用AVScreenCapturer进行屏幕录制,详细的API声明请参考[AVScreenCapture API参考](../reference/native-apis/_a_v_screen_capture.md)。
+
+使用AVScreenCapture时要明确其状态的变化,在创建实例后,调用对应的方法可以进入指定的状态实现对应的行为。
+在确定的状态下执行不合适的方法会导致AVScreenCapture发生错误,开发者需要在调用状态转换的方法前进行状态检查,避免程序运行异常。
+
+### 权限说明
+
+在开发前,请根据应用实际需求,参考[访问控制授权申请指导](../security/accesstoken-guidelines.md)申请以下权限:
+
+| 权限名 | 说明 | 授权方式 | 权限级别 |
+| ------ | ----- | --------| ------- |
+| ohos.permission.CAPTURE_SCREEN | 允许应用截取屏幕图像。| system_grant | system_core |
+| ohos.permission.MICROPHONE | 允许应用使用麦克风(可选)。
+如需录制麦克风源的音频,需要申请该权限。| user_grant | normal |
+
+### 开发步骤及注意事项
+
+开发者可以通过以下几个步骤来实现一个简单的屏幕录制功能。
+
+1. 创建AVScreenCapture实例capture。
+
+ ```c++
+ OH_AVScreenCapture* capture = AVScreenCapture_Create();
+ ```
+
+2. 配置屏幕录制参数。
+ 创建AVScreenCapture实例capture后,可以设置屏幕录制所需要的参数。
+
+ ```c++
+ OH_AudioCaptureInfo miccapinfo = {
+ .audioSampleRate = 16000,
+ .audioChannels = 2,
+ .audioSource = OH_MIC
+ };
+
+ OH_VideoCaptureInfo videocapinfo = {
+ .videoFrameWidth = display->GetWidth(),
+ .videoFrameHeight = display->Height(),
+ .videoSource = OH_VIDEO_SOURCE_SURFACE_RGBA
+ };
+
+ OH_AudioInfo audioinfo = {
+ .micCapInfo = miccapinfo,
+ };
+
+ OH_VideoInfo videoinfo = {
+ .videoCapInfo = videocapinfo
+ };
+
+ OH_RecorderInfo recorderinfo = {
+ .url = name
+ };
+
+ OH_AVScreenCaptureConfig config = {
+ .captureMode = OH_CAPTURE_HOME_SCREEN,
+ .dataType = OH_ORIGINAL_STREAM,
+ .audioInfo = audioinfo,
+ .videoInfo = videoinfo,
+ .recorderInfo = recorderinfo
+ };
+
+ OH_AVScreenCapture_Init(capture, config);
+ ```
+
+3. 设置麦克风开关。
+
+ ```c++
+ bool isMic = true;
+ OH_AVScreenCapture_SetMicrophoneEnabled(capture, isMic);
+ ```
+
+4. 回调函数的设置,主要监听录屏过程中的错误事件的发生,音频流和视频流数据的产生事件。
+
+ ```c++
+ OH_AVScreenCaptureCallback callback;
+ callback.onAudioBufferAvailable = OnAudioBufferAvailable;
+ callback.onVideoBufferAvailable = OnVideoBufferAvailable;
+ OH_AVScreenCapture_SetCallback(capture, callback);
+ ```
+
+5. 调用StartScreenCapture方法开始进行屏幕录制。
+
+ ```c++
+ OH_AVScreenCapture_StartScreenCapture(capture);
+ ```
+
+6. 调用StopScreenCapture()方法停止录制。
+
+ ```c++
+ OH_AVScreenCapture_StopScreenCapture(capture_);
+ ```
+
+7. 调用AcquireAudioBuffer()获取音频原始码流数据
+
+ ```c++
+ OH_AVScreenCapture_AcquireAudioBuffer(capture, &audiobuffer, type);
+ ```
+
+8. 调用AcquireVideoBuffer()获取音频原始码流数据。
+
+ ```c++
+ OH_NativeBuffer* buffer = OH_ScreenCapture_AcquireVideoBuffer(capture, &fence, ×tamp, &damage);
+ ```
+
+9. 调用ReleaseAudioBuffer方法释放音频buffer。
+
+ ```c++
+ OH_ScreenCapture_ReleaseAudioBuffer(capture, type);
+ ```
+
+10. 调用ReleaseVideoBuffer()释放视频数据。
+
+ ```c++
+ OH_ScreenCapture_ReleaseVideoBuffer(capture);
+ ```
+
+11. 调用release()方法销毁实例,释放资源。
+
+ ```c++
+ OH_AVScreenCapture_Release(capture);
+ ```
+
+### 完整示例
+
+下面展示了使用AVScreenCapture屏幕录制的完整示例代码。
+目前阶段流程结束后返回的buffer为原始码流,针对原始码流可以进行编码并以mp4等文件格式保存以供播放。编码格式与文件格式当前阶段仅作预留,待后续版本实现。
+
+```c++
+
+#include "multimedia/player_framework/native_avscreen_capture.h"
+#include "multimedia/player_framework/native_avscreen_capture_base.h"
+#include "multimedia/player_framework/native_avscreen_capture_errors.h"
+
+void OnError(struct OH_AVScreenCapture *capture, int32_t errorCode)
+{
+ (void) capture;
+ (void) errorCode;
+}
+
+void OnAudioBufferAvailable(struct OH_AVScreenCapture *capture, bool isReady, OH_AudioCapSourceType type)
+{
+ if (isReady) {
+ OH_AudioBuffer *audiobuffer = (struct OH_AudioBuffer*) malloc (sizeof(OH_AudioBuffer));
+ //获取音频流
+ int32_t ret = OH_AVScreenCapture_AcquireAudioBuffer(capture, &audiobuffer, type);
+ /* get buffer */
+ (void)audiobuffer->buf;
+ /* getbuffer size */
+ (void)audiobuffer->size;
+ /* get audiobuffer timestampe */
+ (void)audiobuffer->timestamp;
+ free(audiobuffer);
+ audiobuffer = nullptr;
+ //释放音频流
+ int32_t ret = OH_ScreenCapture_ReleaseAudioBuffer(capture, type);
+ }
+}
+
+void OnVideoBufferAvailable(struct OH_ScreenCapture *capture, bool isReady)
+{
+ if (isReady) {
+ int32_t fence = 0;
+ int64_t timestamp = 0;
+ struct OH_Rect damage;
+ //获取视频流
+ OH_NativeBuffer* buffer = OH_ScreenCapture_AcquireVideoBuffer(capture, &fence, ×tamp, &damage);
+ void *virAddr = nullptr;
+ OH_NativeBuffer_Map(buffer, &virAddr); //获取buffer
+ OH_NativeBuffer_Config config;
+ OH_NativeBuffer_GetNativeBufferConfig(buffer, config); //获取config信息 宽,高,format
+ // fence, timestampe, damage 获取fence,时间戳,坐标信息
+ OH_NativeBuffer_UnMap(buffer); //释放buffer
+ //释放视频流
+ int32_t ret = OH_ScreenCapture_ReleaseVideoBuffer(capture);
+ }
+}
+
+int main()
+{
+ //实例化ScreenCapture
+ struct OH_AVScreenCapture* capture = OH_AVScreenCapture_Create(void);
+ //设置回调
+ struct OH_AVScreenCaptureCallback callback;
+ callback.onError = OnError;
+ callack.onAudioBufferAvailable = OnAudioBufferAvailable ;
+ callack.onVideoBufferAvailable = OnVideoBufferAvailable;
+ int32_t ret = OH_AVScreenCapture_SetCallback(capture, callback);
+ //初始化录屏,传入配置信息OH_AVScreenRecorderConfig
+ OH_AudioCaptureInfo miccapinfo = {
+ .audioSampleRate = 16000,
+ .audioChannels = 2,
+ .audioSource = OH_MIC
+ };
+ OH_VideoCaptureInfo videocapinfo = {
+ .videoFrameWidth = 720,
+ .videoFrameHeight = 1280,
+ .videoSource = OH_VIDEO_SOURCE_SURFACE_RGBA
+ };
+ OH_AudioInfo audioinfo = {
+ .micCapInfo = miccapinfo,
+ };
+ OH_VideoInfo videoinfo = {
+ .videoCapInfo = videocapinfo
+ };
+ OH_AVScreenCaptureConfig config = {
+ .captureMode = OH_CAPTURE_HOME_SCREEN,
+ .dataType = OH_ORIGINAL_STREAM,
+ .audioInfo = audioinfo,
+ .videoInfo = videoinfo,
+ .recorderInfo = recorderinfo
+ };
+ OH_AVScreenCapture_Init(capture, config);
+ int32_t ret = OH_AVScreenCapture_Init(capture, &config);
+ //开始录屏
+ int32_t ret = OH_AVScreenCapture_StartScreenCapture(capture);
+ //mic开关设置
+ int32_t ret = OH_ScreenCapture_SetMicrophoneEnable(capture, true);
+ sleep(10); //录制10s
+ //结束录屏
+ int32_t ret = OH_ScreenCapture_StopScreenCapture(capture);
+ //释放ScreenCapture
+ int32_t ret = OH_ScreenCapture_Realease(capture);
+ return 0;
+}
+```
diff --git a/zh-cn/application-dev/media/avsession-overview.md b/zh-cn/application-dev/media/avsession-overview.md
index 446e027ad0d8c1d745c7941ee47d4a371cf7bbfe..148ae02a01b2f16189579fdf04feefa9c9948b34 100644
--- a/zh-cn/application-dev/media/avsession-overview.md
+++ b/zh-cn/application-dev/media/avsession-overview.md
@@ -4,7 +4,7 @@
音视频类应用接入媒体会话后,可以发送应用的数据(比如正在播放的歌曲、歌曲的播放状态等),用户可以通过系统播控中心、语音助手等应用切换多个应用、多个设备播放。音视频类应用如果不接入媒体会话,将无法在后台播放,在应用进入后台时,会被强制停止播放。
-实现后台播放,还需申请长时任务避免进入挂起(Suspend)状态。具体参考[长时任务开发指导](../task-management/continuous-task-dev-guide.md)。
+实现后台播放,还需申请长时任务避免进入挂起(Suspend)状态。具体参考[长时任务开发指导](../task-management/continuous-task.md)。
## 基础概念
diff --git a/zh-cn/application-dev/media/camera-preview.md b/zh-cn/application-dev/media/camera-preview.md
index ec2f45a39cc887d96551acbb6c33a65dfcb1c9e3..2836389c3b3db5ed27629f249bbf333e3ec7caaf 100644
--- a/zh-cn/application-dev/media/camera-preview.md
+++ b/zh-cn/application-dev/media/camera-preview.md
@@ -34,7 +34,7 @@
}
```
-2. 通过CameraOutputCapability类中的previewProfiles()方法获取当前设备支持的预览能力,返回previewProfilesArray数组 。通过createPreviewOutput()方法创建预览输出流,其中,createPreviewOutput()方法中的而两个参数分别是previewProfilesArray数组中的第一项和步骤一中获取的surfaceId。
+2. 通过CameraOutputCapability类中的previewProfiles()方法获取当前设备支持的预览能力,返回previewProfilesArray数组 。通过createPreviewOutput()方法创建预览输出流,其中,createPreviewOutput()方法中的两个参数分别是previewProfilesArray数组中的第一项和步骤一中获取的surfaceId。
```ts
let previewProfilesArray = cameraOutputCapability.previewProfiles;
diff --git a/zh-cn/application-dev/media/using-avplayer-for-playback.md b/zh-cn/application-dev/media/using-avplayer-for-playback.md
index 95edec4d34a45afc308a10cc216ae38e6914b011..9806dae07b64c72166f388bef40f343746a2f5a5 100644
--- a/zh-cn/application-dev/media/using-avplayer-for-playback.md
+++ b/zh-cn/application-dev/media/using-avplayer-for-playback.md
@@ -2,7 +2,7 @@
使用AVPlayer可以实现端到端播放原始媒体资源,本开发指导将以完整地播放一首音乐作为示例,向开发者讲解AVPlayer音频播放相关功能。
-以下指导仅介绍如何实现媒体资源播放,如果要实现后台播放或熄屏播放,需要使用[AVSession(媒体会话)](avsession-overview.md)和[申请长时任务](../task-management/continuous-task-dev-guide.md),避免播放被系统强制中断。
+以下指导仅介绍如何实现媒体资源播放,如果要实现后台播放或熄屏播放,需要使用[AVSession(媒体会话)](avsession-overview.md)和[申请长时任务](../task-management/continuous-task.md),避免播放被系统强制中断。
播放的全流程包含:创建AVPlayer,设置播放资源,设置播放参数(音量/倍速/焦点模式),播放控制(播放/暂停/跳转/停止),重置,销毁资源。
@@ -40,7 +40,7 @@
>
> 下面代码示例中的url仅作示意使用,开发者需根据实际情况,确认资源有效性并设置:
>
- > - 如果使用本地资源播放,必须确认资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。
+ > - 如果使用本地资源播放,必须确认资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用文件路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。
>
> - 如果使用网络播放路径,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。
>
diff --git a/zh-cn/application-dev/media/video-playback.md b/zh-cn/application-dev/media/video-playback.md
index da324f48191e3ca2a66506bb3650363ad56255ab..229bbbc3e2d12f2bacc596403252c84e0b9f5e3f 100644
--- a/zh-cn/application-dev/media/video-playback.md
+++ b/zh-cn/application-dev/media/video-playback.md
@@ -6,7 +6,7 @@
- Video组件:封装了视频播放的基础能力,需要设置数据源以及基础信息即可播放视频,但相对扩展能力较弱。Video组件由ArkUI提供能力,相关指导请参考UI开发文档-[Video组件](../ui/arkts-common-components-video-player.md)。
-本开发指导将介绍如何使用AVPlayer开发视频播放功能,以完整地播放一个视频作为示例,实现端到端播放原始媒体资源。如果要实现后台播放或熄屏播放,需要使用[AVSession(媒体会话)](avsession-overview.md)和[申请长时任务](../task-management/continuous-task-dev-guide.md),避免播放过程中音频模块被系统强制中断。
+本开发指导将介绍如何使用AVPlayer开发视频播放功能,以完整地播放一个视频作为示例,实现端到端播放原始媒体资源。如果要实现后台播放或熄屏播放,需要使用[AVSession(媒体会话)](avsession-overview.md)和[申请长时任务](../task-management/continuous-task.md),避免播放过程中音频模块被系统强制中断。
## 开发指导
@@ -46,7 +46,7 @@
>
> 下面代码示例中的url仅作示意使用,开发者需根据实际情况,确认资源有效性并设置:
>
- > - 如果使用本地资源播放,必须确认资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。
+ > - 如果使用本地资源播放,必须确认资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用文件路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。
>
> - 如果使用网络播放路径,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。
>
diff --git a/zh-cn/application-dev/napi/Readme-CN.md b/zh-cn/application-dev/napi/Readme-CN.md
index ba6b1f29271ff7493ffd828c11f1713deea332f5..64e7a67ce018243582afb87f5988521e32056d8d 100644
--- a/zh-cn/application-dev/napi/Readme-CN.md
+++ b/zh-cn/application-dev/napi/Readme-CN.md
@@ -19,3 +19,7 @@
- [Purgeable memory开发指导](purgeable-memory-guidelines.md)
- 设备管理
- [USB DDK开发指导](usb-ddk-guidelines.md)
+
+- 数据管理
+ - [RelationalStore开发指导](native-relational-store-guidelines.md)
+
diff --git a/zh-cn/application-dev/napi/native-buffer-guidelines.md b/zh-cn/application-dev/napi/native-buffer-guidelines.md
index 7feff7533d16ceca5ca35ff81e678323b8ab73a0..63c7f769a6b2c70ac6ad7b3d32fde0f6c5019d0d 100644
--- a/zh-cn/application-dev/napi/native-buffer-guidelines.md
+++ b/zh-cn/application-dev/napi/native-buffer-guidelines.md
@@ -25,6 +25,13 @@ NativeBuffer是`OpenHarmony`提供**共享内存**的模块。开发者可以通
以下步骤描述了在**OpenHarmony**中如何使用`NativeBuffer`提供的Native API接口,创建`OH_NativeBuffer`实例获取内存的属性信息,并把对应的ION内存映射到进程空间。
+**添加动态链接库**
+
+CMakeLists.txt中添加以下lib。
+```txt
+libnative_buffer.so
+```
+
**头文件**
```c++
#include
diff --git a/zh-cn/application-dev/napi/native-image-guidelines.md b/zh-cn/application-dev/napi/native-image-guidelines.md
index 1f200277b2ccc1285b42338268e9a38dc4e262f5..a8d1d01f68ed2dd5cfee99922c34bde977e7d8e2 100644
--- a/zh-cn/application-dev/napi/native-image-guidelines.md
+++ b/zh-cn/application-dev/napi/native-image-guidelines.md
@@ -26,6 +26,17 @@ NativeImage是`OpenHarmony`提供**Surface关联OpenGL外部纹理**的模块,
以下步骤描述了在**OpenHarmony**中如何使用`NativeImage`提供的Native API接口,创建`OH_NativeImage`实例作为消费者端,将数据内容更新到OpenGL外部纹理上。
+**添加动态链接库**
+
+CMakeLists.txt中添加以下lib。
+```txt
+libEGL.so
+libGLESv3.so
+libnative_image.so
+libnative_window.so
+libnative_buffer.so
+```
+
**头文件**
```c++
#include
diff --git a/zh-cn/application-dev/napi/native-relational-store-guidelines.md b/zh-cn/application-dev/napi/native-relational-store-guidelines.md
new file mode 100644
index 0000000000000000000000000000000000000000..ff4a3aaeaa80a4c8f4db2901d16d1e3ee1370f97
--- /dev/null
+++ b/zh-cn/application-dev/napi/native-relational-store-guidelines.md
@@ -0,0 +1,176 @@
+# RelationalStore开发指导
+
+
+## 场景介绍
+
+RelationalStore提供了一套完整的对本地数据库进行管理的机制,对外提供了一系列的增、删、改、查等接口,也可以直接运行用户输入的SQL语句来满足复杂的场景需要。
+
+
+## 基本概念
+
+- **谓词**:数据库中用来代表数据实体的性质、特征或者数据实体之间关系的词项,主要用来定义数据库的操作条件。
+
+- **结果集**:指用户查询之后的结果集合,可以对数据进行访问。结果集提供了灵活的数据访问方式,可以更方便地拿到用户想要的数据。
+
+
+## 约束限制
+
+- 系统默认日志方式是WAL(Write Ahead Log)模式,系统默认落盘方式是FULL模式。
+
+- 数据库中连接池的最大数量是4个,用以管理用户的读操作。
+
+- 为保证数据的准确性,数据库同一时间只能支持一个写操作。
+
+- 当应用被卸载完成后,设备上的相关数据库文件及临时文件会被自动清除。
+
+
+## 接口说明
+
+详细的接口说明请参考[RDB](../reference/native-apis/_r_d_b.md)。
+
+| 接口名称 | 描述 |
+| -------- | -------- |
+| OH_Rdb_GetOrOpen(const OH_Rdb_Config *config, int *errCode) | 获得一个相关的OH_Rdb_Store实例,操作关系型数据库。 |
+| OH_Rdb_Execute(OH_Rdb_Store *store, const char *sql) | 执行包含指定参数但不返回值的SQL语句。 |
+| OH_Rdb_Insert(OH_Rdb_Store *store, const char *table, OH_VBucket *valuesBucket) | 向目标表中插入一行数据。 |
+| OH_Rdb_Update(OH_Rdb_Store *store, OH_VBucket *valuesBucket, OH_Predicates *predicates); | 根据OH_Predicates的指定实例对象更新数据库中的数据。 |
+| OH_Rdb_Delete(OH_Rdb_Store *store, OH_Predicates *predicates) | 根据OH_Predicates的指定实例对象从数据库中删除数据。 |
+| OH_Rdb_Query(OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length) | 根据指定条件查询数据库中的数据。 |
+| OH_Rdb_DeleteStore(const OH_Rdb_Config *config) | 删除数据库。 |
+
+
+## 开发步骤
+
+1. 获取OH_Rdb_Store实例,创建数据库文件。示例代码如下所示:
+
+ ```c
+ // 创建OH_Rdb_Config对象
+ OH_Rdb_Config config;
+ // 该路径为应用沙箱路径
+ config.dataBaseDir = "xxx";
+ // 数据库文件名
+ config.storeName = "RdbTest.db";
+ // 应用包名
+ config.bundleName = "xxx";
+ // 应用模块名
+ config.moduleName = "xxx";
+ // 数据库文件安全等级
+ config.securityLevel = OH_Rdb_SecurityLevel::S1;
+ // 数据库是否加密
+ config.isEncrypt = false;
+ // config所占内存大小
+ config.selfSize = sizeof(OH_Rdb_Config);
+
+ int errCode = 0;
+ // 获取获取OH_Rdb_Store实例
+ OH_Rdb_Store *store_ = OH_Rdb_GetOrOpen(&config, &errCode);
+ ```
+
+2. 获取到OH_Rdb_Store后,调用OH_Rdb_Execute接口创建表,并调用OH_Rdb_Insert接口插入数据。示例代码如下所示:
+
+ ```c
+ char createTableSql[] = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, "
+ "AGE INTEGER, SALARY REAL, CODES BLOB)";
+ // 执行建表语句
+ OH_Rdb_Execute(store_, createTableSql);
+
+ // 创建键值对实例
+ OH_VBucket *valueBucket = OH_Rdb_CreateValuesBucket();
+ valueBucket->putText(valueBucket, "NAME", "Lisa");
+ valueBucket->putInt64(valueBucket, "AGE", 18);
+ valueBucket->putReal(valueBucket, "SALARY", 100.5);
+ uint8_t arr[] = {1, 2, 3, 4, 5};
+ int len = sizeof(arr) / sizeof(arr[0]);
+ valueBucket->putBlob(valueBucket, "CODES", arr, len);
+ // 插入数据
+ int rowId = OH_Rdb_Insert(store_, "EMPLOYEE", valueBucket);
+ // 销毁键值对实例
+ valueBucket->destroy(valueBucket);
+ ```
+
+ > **说明:**
+ >
+ > 关系型数据库没有显式的flush操作实现持久化,数据插入即保存在持久化文件。
+
+3. 根据谓词指定的实例对象,对数据进行修改或删除。
+
+ 调用OH_Rdb_Update方法修改数据,调用OH_Rdb_Delete方法删除数据。示例代码如下所示:
+
+ ```c
+ // 修改数据
+ OH_VBucket *valueBucket = OH_Rdb_CreateValuesBucket();
+ valueBucket->putText(valueBucket, "NAME", "Rose");
+ valueBucket->putInt64(valueBucket, "AGE", 22);
+ valueBucket->putReal(valueBucket, "SALARY", 200.5);
+ uint8_t arr[] = {1, 2, 3, 4, 5};
+ int len = sizeof(arr) / sizeof(arr[0]);
+ valueBucket->putBlob(valueBucket, "CODES", arr, len);
+
+ OH_Predicates *predicates = OH_Rdb_CreatePredicates("EMPLOYEE");
+ OH_VObject *valueObject = OH_Rdb_CreateValueObject();
+ const char *name = "Lisa";
+ valueObject->putText(valueObject, name);
+ predicates->equalTo(predicates, "NAME", valueObject)->andOperate(predicates);
+ uint32_t count = 1;
+ double salary = 100.5;
+ valueObject->putDouble(valueObject, &salary, count);
+ predicates->equalTo(predicates, "SALARY", valueObject);
+
+ int changeRows = OH_Rdb_Update(store_, valueBucket, predicates);
+ valueObject->destroy(valueObject);
+ valueBucket->destroy(valueBucket);
+ predicates->destroy(predicates);
+ ```
+
+ ```c
+ // 删除数据
+ OH_Predicates *predicates = OH_Rdb_CreatePredicates("EMPLOYEE");
+ OH_VObject *valueObject = OH_Rdb_CreateValueObject();
+ const char *name = "Lisa";
+ valueObject->putText(valueObject, name);
+ predicates->equalTo(predicates, "NAME", valueObject);
+ int deleteRows = OH_Rdb_Delete(store_, predicates);
+ valueObject->destroy(valueObject);
+ predicates->destroy(predicates);
+ ```
+
+4. 根据谓词指定的查询条件查找数据。
+
+ 调用OH_Rdb_Query方法查找数据,返回一个OH_Cursor结果集。示例代码如下所示:
+
+ ```c
+ OH_Predicates *predicates = OH_Rdb_CreatePredicates("EMPLOYEE");
+
+ const char *columnNames[] = {"NAME", "AGE"};
+ int len = sizeof(columnNames) / sizeof(columnNames[0]);
+ OH_Cursor *cursor = OH_Rdb_Query(store_, predicates, columnNames, len);
+
+ int columnCount = 0;
+ cursor->getColumnCount(cursor, &columnCount);
+
+ // OH_Cursor是一个数据集合的游标,默认指向第-1个记录,有效的数据从0开始
+ int64_t age;
+ while (cursor->goToNextRow(cursor) == OH_Rdb_ErrCode::RDB_OK) {
+ cursor->getInt64(cursor, 1, &age);
+ }
+
+ // 释放谓词实例
+ predicates->destroy(predicates);
+ // 释放结果集
+ cursor->destroy(cursor);
+ ```
+
+5. 删除数据库。
+
+ 调用OH_Rdb_DeleteStore方法,删除数据库及数据库相关文件。示例代码如下:
+
+
+ ```c
+ // 释放数据库实例
+ OH_Rdb_CloseStore(store_);
+ // 删除数据库文件
+ OH_Rdb_DeleteStore(&config);
+ ```
+
+
+
diff --git a/zh-cn/application-dev/napi/native-vsync-guidelines.md b/zh-cn/application-dev/napi/native-vsync-guidelines.md
index 63da1350b96d2d4603dacf90da13db4ca485c145..0261621db13cf1e36772e7ef2bb1732cfba346a0 100644
--- a/zh-cn/application-dev/napi/native-vsync-guidelines.md
+++ b/zh-cn/application-dev/napi/native-vsync-guidelines.md
@@ -19,6 +19,13 @@ NativeVsync模块用来获取系统VSync信号,提供了OH_NativeVSync实例
以下步骤描述了在**OpenHarmony**中如何使用`NativeVsync`提供的Native API接口,创建和销毁`OH_NativeVsync`实例,以及如何设置VSync回调函数。
+**添加动态链接库**
+
+CMakeLists.txt中添加以下lib。
+```txt
+libnative_vsync.so
+```
+
**头文件**
```c++
#include
diff --git a/zh-cn/application-dev/napi/native-window-guidelines.md b/zh-cn/application-dev/napi/native-window-guidelines.md
index 6ed367948c2be42737efa31bca8966fc9bfd756c..4e191da6e2e5a8256c338d489d8efb906df0cb6f 100644
--- a/zh-cn/application-dev/napi/native-window-guidelines.md
+++ b/zh-cn/application-dev/napi/native-window-guidelines.md
@@ -23,6 +23,7 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生
以下步骤描述了在**OpenHarmony**中如何使用`NativeWindow`提供的Native API接口,申请图形`Buffer`,并将生产图形内容写入图形`Buffer`后,最终提交`Buffer`到图形队列。
**添加动态链接库**
+
CMakeLists.txt中添加以下lib。
```txt
libace_ndk.z.so
diff --git a/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md b/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md
index 4fa36ff1f15e23b4d8d1a311384fcf7e42ba2bea..bdde437188c2cc9a9da8ddbdcb2b2eec1056c61b 100644
--- a/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md
+++ b/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md
@@ -19,13 +19,14 @@ Neural Network Runtime部件的环境要求如下:
- 开发环境:Ubuntu 18.04及以上。
- 接入设备:OpenHarmony定义的标准设备,并且系统中内置的硬件加速器驱动,已通过HDI接口对接Neural Network Runtime。
-由于Neural Network Runtime通过OpenHarmony Native API对外开放,需要通过OpenHarmony的Native开发套件编译Neural Network Runtime应用。在社区的[每日构建](http://ci.openharmony.cn/dailys/dailybuilds)下载对应系统版本的ohos-sdk压缩包,从压缩包中提取对应平台的Native开发套件。以Linux为例,Native开发套件的压缩包命名为`native-linux-{版本号}.zip`。
+由于Neural Network Runtime通过OpenHarmony Native API对外开放,需要通过OpenHarmony的Native开发套件编译Neural Network Runtime应用。
### 环境搭建
1. 打开Ubuntu编译服务器的终端。
-2. 把下载好的Native开发套件压缩包拷贝至当前用户根目录下。
+2. 把Native开发套件压缩包拷贝至当前用户根目录下。
3. 执行以下命令解压Native开发套件的压缩包。
+
```shell
unzip native-linux-{版本号}.zip
```
@@ -470,16 +471,19 @@ Neural Network Runtime的开发流程主要包含**模型构造**、**模型编
> 模型的IR需要传递到硬件驱动层,由HDI服务将统一的IR图,编译成硬件专用的计算图,编译的过程非常耗时。Neural Network Runtime支持计算图缓存的特性,可以将HDI服务编译生成的计算图,缓存到设备存储中。当下一次在同一个加速芯片上编译同一个模型时,通过指定缓存的路径,Neural Network Runtime可以直接加载缓存文件中的计算图,减少编译消耗的时间。
检查缓存目录下的缓存文件:
+
```shell
ls /data/local/tmp
```
以下为打印结果:
+
```text
# 0.nncache cache_info.nncache
```
如果缓存不再使用,需要手动删除缓存,可以参考以下命令,删除缓存文件。
+
```shell
rm /data/local/tmp/*nncache
```
@@ -487,5 +491,5 @@ Neural Network Runtime的开发流程主要包含**模型构造**、**模型编
## 相关实例
第三方AI推理框架对接Neural Network Runtime的流程,可以参考以下相关实例:
-- [Tensorflow Lite接入NNRt Delegate开发指南](https://gitee.com/openharmony/neural_network_runtime/tree/master/example/deep_learning_framework)
-
+
+- [Tensorflow Lite接入NNRt Delegate开发指南](https://gitee.com/openharmony/ai_neural_network_runtime/tree/master/example/deep_learning_framework)
diff --git a/zh-cn/application-dev/napi/vulkan-guidelines.md b/zh-cn/application-dev/napi/vulkan-guidelines.md
index d8331926f4e3664362ba63cd825f935d2ce85632..f0bf36a0225106d05611f4526c7c2031d7fcf220 100644
--- a/zh-cn/application-dev/napi/vulkan-guidelines.md
+++ b/zh-cn/application-dev/napi/vulkan-guidelines.md
@@ -18,6 +18,15 @@ Vulkan是一套用来做2D和3D渲染的图形应用程序接口,其中创建V
以下步骤说明了如何在OpenHarmony平台创建一个VkSurfaceKHR对象。
+**添加动态链接库**
+
+CMakeLists.txt中添加以下lib。
+```txt
+libace_ndk.z.so
+libnative_window.so
+libvulkan.so
+```
+
**头文件**
```c++
#include
diff --git a/zh-cn/application-dev/napi/xcomponent-guidelines.md b/zh-cn/application-dev/napi/xcomponent-guidelines.md
index 179fca2339061e6d98bc73fdd130befbc8aaea99..14d176da8269fbaa801ad4f46f7ce301b64cabd6 100644
--- a/zh-cn/application-dev/napi/xcomponent-guidelines.md
+++ b/zh-cn/application-dev/napi/xcomponent-guidelines.md
@@ -81,7 +81,7 @@ XComponent({ id: 'xcomponentId1', type: 'surface', libraryname: 'nativerender' }
// ...
```
-2. **Napi模块注册**,具体使用请参考[Native API在应用工程中的使用指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/napi/napi-guidelines.md)。
+2. **Napi模块注册**,具体使用请参考[Native API在应用工程中的使用指导](napi-guidelines.md)。
```c++
// 在napi_init.cpp文件中,Init方法注册接口函数,从而将封装的C++方法传递出来,供JS侧调用
diff --git a/zh-cn/application-dev/quick-start/arkts-builder.md b/zh-cn/application-dev/quick-start/arkts-builder.md
index b3c1e91eb13e3796404520ff096c01d077f14211..6b151dab926c7407ff3360029c3fccf87fff1b8a 100644
--- a/zh-cn/application-dev/quick-start/arkts-builder.md
+++ b/zh-cn/application-dev/quick-start/arkts-builder.md
@@ -21,14 +21,14 @@
```ts
-@Builder myBuilderFunction({ ... })
+@Builder MyBuilderFunction({ ... })
```
使用方法:
```ts
-this.myBuilderFunction({ ... })
+this.MyBuilderFunction({ ... })
```
- 允许在自定义组件内定义一个或多个自定义构建函数,该函数被认为是该组件的私有、特殊类型的成员函数。
diff --git a/zh-cn/application-dev/quick-start/arkts-localstorage.md b/zh-cn/application-dev/quick-start/arkts-localstorage.md
index a9b76cf6ddf4d079295a5087cd059a61b6cc4eae..8b658b0d12cd99bad49ee2874866acb5289a2f37 100644
--- a/zh-cn/application-dev/quick-start/arkts-localstorage.md
+++ b/zh-cn/application-dev/quick-start/arkts-localstorage.md
@@ -36,7 +36,7 @@ LocalStorage根据与\@Component装饰的组件的同步类型不同,提供了
## 限制条件
- LocalStorage创建后,命名属性的类型不可更改。后续调用Set时必须使用相同类型的值。
-- LocalStorage是页面级存储,[GetShared](../reference/arkui-ts/ts-state-management.md#getshared9)接口仅能获取当前stage,通过[windowStage.loadContent](../reference/apis/js-apis-window.md#loadcontent9)传入的LocalStorage实例,否则返回undefined。例子可见[将LocalStorage实例从UIAbility共享到一个或多个视图](#将localstorage实例从uiability共享到一个或多个视图)。
+- LocalStorage是页面级存储,[GetShared](../reference/arkui-ts/ts-state-management.md#getshared10)接口仅能获取当前stage,通过[windowStage.loadContent](../reference/apis/js-apis-window.md#loadcontent9)传入的LocalStorage实例,否则返回undefined。例子可见[将LocalStorage实例从UIAbility共享到一个或多个视图](#将localstorage实例从uiability共享到一个或多个视图)。
## \@LocalStorageProp
diff --git a/zh-cn/application-dev/quick-start/arkts-mvvm.md b/zh-cn/application-dev/quick-start/arkts-mvvm.md
index 6185ed8d6574e2083605b4d2a4171ca768918106..8f0a9b1fb98430d34f544c8cc7f0b98b71333ca7 100644
--- a/zh-cn/application-dev/quick-start/arkts-mvvm.md
+++ b/zh-cn/application-dev/quick-start/arkts-mvvm.md
@@ -775,7 +775,7 @@ struct ViewA {
开发一个电话簿应用,实现功能如下:
-- 显示联系人和本机("Me")电话号码 。
+- 显示联系人和设备("Me")电话号码 。
- 选中联系人时,进入可编辑态”Edit“,可以更新该联系人详细信息,包括电话号码,住址。
@@ -788,8 +788,8 @@ ViewModel需要包括:
- AddressBook(class)
- - me (本机): 存储一个Person类。
- - contacts(本机联系人):存储一个Person类数组。
+ - me (设备): 存储一个Person类。
+ - contacts(设备联系人):存储一个Person类数组。
AddressBook类声明如下:
@@ -936,11 +936,11 @@ export class ObservedArray extends Array {
@Component
struct PageEntry {
@Provide addrBook: AddressBook = new AddressBook(
- new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["+358441234567", "+35891234567", "+49621234567889"]),
+ new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********", "18*********"]),
[
- new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["+358449876543", "+3589456789"]),
- new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["+358509876543", "+358910101010"]),
- new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["+358400908070", "+35894445555"]),
+ new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
]);
build() {
@@ -1099,236 +1099,236 @@ export class ObservedArray extends Array {
完整应用代码如下:
- ```ts
- // ViewModel classes
- let nextId = 0;
-
- @Observed
- export class ObservedArray extends Array {
- constructor(args?: any[]) {
- console.log(`ObservedArray: ${JSON.stringify(args)} `)
- if (Array.isArray(args)) {
- super(...args);
- } else {
- super(args)
- }
- }
- }
-
- @Observed
- export class Address {
- street: string;
- zip: number;
- city: string;
-
- constructor(street: string,
- zip: number,
- city: string) {
- this.street = street;
- this.zip = zip;
- this.city = city;
- }
- }
-
- @Observed
- export class Person {
- id_: string;
- name: string;
- address: Address;
- phones: ObservedArray;
-
- constructor(name: string,
- street: string,
- zip: number,
- city: string,
- phones: string[]) {
- this.id_ = `${nextId}`;
- nextId++;
- this.name = name;
- this.address = new Address(street, zip, city);
- this.phones = new ObservedArray(phones);
- }
+```ts
+
+ // ViewModel classes
+ let nextId = 0;
+
+ @Observed
+ export class ObservedArray extends Array {
+ constructor(args?: any[]) {
+ console.log(`ObservedArray: ${JSON.stringify(args)} `)
+ if (Array.isArray(args)) {
+ super(...args);
+ } else {
+ super(args)
}
-
-
- export class AddressBook {
- me: Person;
- contacts: ObservedArray;
-
- constructor(me: Person, contacts: Person[]) {
- this.me = me;
- this.contacts = new ObservedArray(contacts);
+ }
+ }
+
+ @Observed
+ export class Address {
+ street: string;
+ zip: number;
+ city: string;
+
+ constructor(street: string,
+ zip: number,
+ city: string) {
+ this.street = street;
+ this.zip = zip;
+ this.city = city;
+ }
+ }
+
+ @Observed
+ export class Person {
+ id_: string;
+ name: string;
+ address: Address;
+ phones: ObservedArray;
+
+ constructor(name: string,
+ street: string,
+ zip: number,
+ city: string,
+ phones: string[]) {
+ this.id_ = `${nextId}`;
+ nextId++;
+ this.name = name;
+ this.address = new Address(street, zip, city);
+ this.phones = new ObservedArray(phones);
+ }
+ }
+
+ export class AddressBook {
+ me: Person;
+ contacts: ObservedArray;
+
+ constructor(me: Person, contacts: Person[]) {
+ this.me = me;
+ this.contacts = new ObservedArray(contacts);
+ }
+ }
+
+ //渲染出Person对象的名称和Observed数组中的第一个号码
+ //为了更新电话号码,这里需要@ObjectLink person和@ObjectLink phones,
+ //不能使用this.person.phones,内部数组的更改不会被观察到。
+ // 在AddressBookView、PersonEditView中的onClick更新selectedPerson
+ @Component
+ struct PersonView {
+ @ObjectLink person: Person;
+ @ObjectLink phones: ObservedArray;
+ @Link selectedPerson: Person;
+
+ build() {
+ Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
+ Text(this.person.name)
+ if (this.phones.length) {
+ Text(this.phones[0])
}
}
-
- //渲染出Person对象的名称和手机Observed数组中的第一个号码
- //为了更新电话号码,这里需要@ObjectLink person和@ObjectLink phones,
- //不能使用this.person.phones,内部数组的更改不会被观察到。
- // 在AddressBookView、PersonEditView中的onClick更新selectedPerson
- @Component
- struct PersonView {
- @ObjectLink person: Person;
- @ObjectLink phones: ObservedArray;
- @Link selectedPerson: Person;
-
- build() {
- Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
- Text(this.person.name)
- if (this.phones.length) {
- Text(this.phones[0])
- }
- }
- .height(55)
- .backgroundColor(this.selectedPerson.name == this.person.name ? "#ffa0a0" : "#ffffff")
- .onClick(() => {
- this.selectedPerson = this.person;
+ .height(55)
+ .backgroundColor(this.selectedPerson.name == this.person.name ? "#ffa0a0" : "#ffffff")
+ .onClick(() => {
+ this.selectedPerson = this.person;
+ })
+ }
+ }
+
+ // 渲染Person的详细信息
+ // @Prop装饰的变量从父组件AddressBookView深拷贝数据,将变化保留在本地, TextInput的变化只会在本地副本上进行修改。
+ // 点击 "Save Changes" 会将所有数据的复制通过@Prop到@Link, 同步到其他组件
+ @Component
+ struct PersonEditView {
+ @Consume addrBook: AddressBook;
+
+ /* 指向父组件selectedPerson的引用 */
+ @Link selectedPerson: Person;
+
+ /*在本地副本上编辑,直到点击保存*/
+ @Prop name: string;
+ @Prop address: Address;
+ @Prop phones: ObservedArray;
+
+ selectedPersonIndex(): number {
+ return this.addrBook.contacts.findIndex((person) => person.id_ == this.selectedPerson.id_);
+ }
+
+ build() {
+ Column() {
+ TextInput({ text: this.name })
+ .onChange((value) => {
+ this.name = value;
})
- }
- }
-
- // 渲染Person的详细信息
- // @Prop装饰的变量从父组件AddressBookView深拷贝数据,将变化保留在本地, TextInput的变化只会在本地副本上进行修改。
- // 点击 "Save Changes" 会将所有数据的复制通过@Prop到@Link, 同步到其他组件
- @Component
- struct PersonEditView {
- @Consume addrBook: AddressBook;
-
- /* 指向父组件selectedPerson的引用 */
- @Link selectedPerson: Person;
-
- /*在本地副本上编辑,直到点击保存*/
- @Prop name: string;
- @Prop address: Address;
- @Prop phones: ObservedArray;
-
- selectedPersonIndex(): number {
- return this.addrBook.contacts.findIndex((person) => person.id_ == this.selectedPerson.id_);
- }
-
- build() {
- Column() {
- TextInput({ text: this.name })
- .onChange((value) => {
- this.name = value;
- })
- TextInput({ text: this.address.street })
- .onChange((value) => {
- this.address.street = value;
- })
-
- TextInput({ text: this.address.city })
- .onChange((value) => {
- this.address.city = value;
- })
-
- TextInput({ text: this.address.zip.toString() })
- .onChange((value) => {
- const result = parseInt(value);
- this.address.zip = isNaN(result) ? 0 : result;
- })
-
- if (this.phones.length > 0) {
- ForEach(this.phones,
- (phone, index) => {
- TextInput({ text: phone })
- .width(150)
- .onChange((value) => {
- console.log(`${index}. ${value} value has changed`)
- this.phones[index] = value;
- })
- },
- (phone, index) => `${index}-${phone}`
- )
- }
-
- Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
- Text("Save Changes")
- .onClick(() => {
- // 将本地副本更新的值赋值给指向父组件selectedPerson的引用
- // 避免创建新对象,在现有属性上进行修改
- this.selectedPerson.name = this.name;
- this.selectedPerson.address.street = this.address.street
- this.selectedPerson.address.city = this.address.city
- this.selectedPerson.address.zip = this.address.zip
- this.phones.forEach((phone: string, index: number) => {
- this.selectedPerson.phones[index] = phone
- });
+ TextInput({ text: this.address.street })
+ .onChange((value) => {
+ this.address.street = value;
+ })
+
+ TextInput({ text: this.address.city })
+ .onChange((value) => {
+ this.address.city = value;
+ })
+
+ TextInput({ text: this.address.zip.toString() })
+ .onChange((value) => {
+ const result = parseInt(value);
+ this.address.zip = isNaN(result) ? 0 : result;
+ })
+
+ if (this.phones.length > 0) {
+ ForEach(this.phones,
+ (phone, index) => {
+ TextInput({ text: phone })
+ .width(150)
+ .onChange((value) => {
+ console.log(`${index}. ${value} value has changed`)
+ this.phones[index] = value;
})
- if (this.selectedPersonIndex() != -1) {
- Text("Delete Contact")
- .onClick(() => {
- let index = this.selectedPersonIndex();
- console.log(`delete contact at index ${index}`);
-
- // 删除当前联系人
- this.addrBook.contacts.splice(index, 1);
-
- // 删除当前selectedPerson,选中态前移一位
- index = (index < this.addrBook.contacts.length) ? index : index - 1;
-
- // 如果contract被删除完,则设置me为选中态
- this.selectedPerson = (index >= 0) ? this.addrBook.contacts[index] : this.addrBook.me;
- })
- }
- }
-
- }
+ },
+ (phone, index) => `${index}-${phone}`
+ )
}
- }
-
- @Component
- struct AddressBookView {
- @ObjectLink me: Person;
- @ObjectLink contacts: ObservedArray;
- @State selectedPerson: Person = undefined;
-
- aboutToAppear() {
- this.selectedPerson = this.me;
- }
-
- build() {
- Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) {
- Text("Me:")
- PersonView({ person: this.me, phones: this.me.phones, selectedPerson: this.$selectedPerson })
-
- Divider().height(8)
-
- ForEach(this.contacts,
- contact => {
- PersonView({ person: contact, phones: contact.phones, selectedPerson: this.$selectedPerson })
- },
- contact => contact.id_
- )
-
- Divider().height(8)
-
- Text("Edit:")
- PersonEditView({
- selectedPerson: this.$selectedPerson,
- name: this.selectedPerson.name,
- address: this.selectedPerson.address,
- phones: this.selectedPerson.phones
+
+ Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
+ Text("Save Changes")
+ .onClick(() => {
+ // 将本地副本更新的值赋值给指向父组件selectedPerson的引用
+ // 避免创建新对象,在现有属性上进行修改
+ this.selectedPerson.name = this.name;
+ this.selectedPerson.address.street = this.address.street
+ this.selectedPerson.address.city = this.address.city
+ this.selectedPerson.address.zip = this.address.zip
+ this.phones.forEach((phone: string, index: number) => {
+ this.selectedPerson.phones[index] = phone
+ });
})
+ if (this.selectedPersonIndex() != -1) {
+ Text("Delete Contact")
+ .onClick(() => {
+ let index = this.selectedPersonIndex();
+ console.log(`delete contact at index ${index}`);
+
+ // 删除当前联系人
+ this.addrBook.contacts.splice(index, 1);
+
+ // 删除当前selectedPerson,选中态前移一位
+ index = (index < this.addrBook.contacts.length) ? index : index - 1;
+
+ // 如果contract被删除完,则设置me为选中态
+ this.selectedPerson = (index >= 0) ? this.addrBook.contacts[index] : this.addrBook.me;
+ })
}
- .borderStyle(BorderStyle.Solid).borderWidth(5).borderColor(0xAFEEEE).borderRadius(5)
}
+
}
-
- @Entry
- @Component
- struct PageEntry {
- @Provide addrBook: AddressBook = new AddressBook(
- new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["+358441234567", "+35891234567", "+49621234567889"]),
- [
- new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["+358449876543", "+3589456789"]),
- new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["+358509876543", "+358910101010"]),
- new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["+358400908070", "+35894445555"]),
- ]);
-
- build() {
- Column() {
- AddressBookView({ me: this.addrBook.me, contacts: this.addrBook.contacts, selectedPerson: this.addrBook.me })
- }
- }
+ }
+ }
+
+ @Component
+ struct AddressBookView {
+ @ObjectLink me: Person;
+ @ObjectLink contacts: ObservedArray;
+ @State selectedPerson: Person = undefined;
+
+ aboutToAppear() {
+ this.selectedPerson = this.me;
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) {
+ Text("Me:")
+ PersonView({ person: this.me, phones: this.me.phones, selectedPerson: this.$selectedPerson })
+
+ Divider().height(8)
+
+ ForEach(this.contacts,
+ contact => {
+ PersonView({ person: contact, phones: contact.phones, selectedPerson: this.$selectedPerson })
+ },
+ contact => contact.id_
+ )
+
+ Divider().height(8)
+
+ Text("Edit:")
+ PersonEditView({
+ selectedPerson: this.$selectedPerson,
+ name: this.selectedPerson.name,
+ address: this.selectedPerson.address,
+ phones: this.selectedPerson.phones
+ })
}
- ```
\ No newline at end of file
+ .borderStyle(BorderStyle.Solid).borderWidth(5).borderColor(0xAFEEEE).borderRadius(5)
+ }
+ }
+
+ @Entry
+ @Component
+ struct PageEntry {
+ @Provide addrBook: AddressBook = new AddressBook(
+ new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********", "18*********"]),
+ [
+ new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ ]);
+
+ build() {
+ Column() {
+ AddressBookView({ me: this.addrBook.me, contacts: this.addrBook.contacts, selectedPerson: this.addrBook.me })
+ }
+ }
+ }
+```
\ No newline at end of file
diff --git a/zh-cn/application-dev/quick-start/arkts-page-custom-components-lifecycle.md b/zh-cn/application-dev/quick-start/arkts-page-custom-components-lifecycle.md
index 9a27960acb511a7f413ae331ab862193f9b2abf1..4a2397a02a144d9965c9d6c1e452311412cd97c0 100644
--- a/zh-cn/application-dev/quick-start/arkts-page-custom-components-lifecycle.md
+++ b/zh-cn/application-dev/quick-start/arkts-page-custom-components-lifecycle.md
@@ -180,7 +180,9 @@ struct Child {
- 如果调用的是router.replaceUrl,则当前Index页面被销毁,执行的生命周期流程将变为:Index onPageHide --> MyComponent aboutToDisappear --> Child aboutToDisappear。上文已经提到,组件的销毁是从组件树上直接摘下子树,所以先调用父组件的aboutToDisappear,再调用子组件的aboutToDisAppear,然后执行初始化新页面的生命周期流程。
-- 点击返回按钮,触发页面生命周期Index onBackPress。最小化应用或者应用进入后台,触发Index onPageHide。这两个状态下应用都没有被销毁,所以并不会执行组件的aboutToDisappear 。应用回到前台,执行Index onPageShow。
+- 点击返回按钮,触发页面生命周期Index onBackPress,且触发返回一个页面后会导致当前Index页面被销毁。
+
+- 最小化应用或者应用进入后台,触发Index onPageHide。当前Index页面没有被销毁,所以并不会执行组件的aboutToDisappear。应用回到前台,执行Index onPageShow。
- 退出应用,执行Index onPageHide --> MyComponent aboutToDisappear --> Child aboutToDisappear。
diff --git a/zh-cn/application-dev/quick-start/arkts-prop.md b/zh-cn/application-dev/quick-start/arkts-prop.md
index acea773b145bcb930519ae0ed4ab1f32da28a5fc..341ab9509d03acfce605e8f6dfa29906bfb46e6c 100644
--- a/zh-cn/application-dev/quick-start/arkts-prop.md
+++ b/zh-cn/application-dev/quick-start/arkts-prop.md
@@ -374,7 +374,7 @@ struct Index {
如果图书馆有一本图书和两位用户,每位用户都可以将图书标记为已读,此标记行为不会影响其它读者用户。从代码角度讲,对\@Prop图书对象的本地更改不会同步给图书馆组件中的\@State图书对象。
-在此示例中,图书类可以使用\@Observed装饰器,但不是必须的,只有在嵌套结构时需要此装饰器。这一点我们会在[从父组件中的\@State数组项到\@Prop class类型的同步](#从父组件中的\@State数组项到\@Prop class类型的同步)说明。
+在此示例中,图书类可以使用\@Observed装饰器,但不是必须的,只有在嵌套结构时需要此装饰器。这一点我们会在[从父组件中的@State数组项到@Prop class类型的同步](#从父组件中的state数组项到prop-class类型的同步)说明。
```ts
diff --git a/zh-cn/application-dev/quick-start/figures/chooseStageModel.png b/zh-cn/application-dev/quick-start/figures/chooseStageModel.png
index b7dd96b6b7c5d2afd241e0c6fd9ee91977692115..dffb66f40999c09e20edfa1b094aee8e62952f61 100644
Binary files a/zh-cn/application-dev/quick-start/figures/chooseStageModel.png and b/zh-cn/application-dev/quick-start/figures/chooseStageModel.png differ
diff --git a/zh-cn/application-dev/quick-start/figures/deleteRuntimeOS.png b/zh-cn/application-dev/quick-start/figures/deleteRuntimeOS.png
index 8087b03be057d646ae6e3348abae73c1e840b781..c75770635cb1bb3ab927968afe97664ff8c2ebde 100644
Binary files a/zh-cn/application-dev/quick-start/figures/deleteRuntimeOS.png and b/zh-cn/application-dev/quick-start/figures/deleteRuntimeOS.png differ
diff --git a/zh-cn/application-dev/quick-start/figures/project.png b/zh-cn/application-dev/quick-start/figures/project.png
new file mode 100644
index 0000000000000000000000000000000000000000..e1f2db2da30489fa3c4b64587db203a2ef173533
Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/project.png differ
diff --git a/zh-cn/application-dev/quick-start/figures/secondPage.png b/zh-cn/application-dev/quick-start/figures/secondPage.png
index 2c08d85c610336a71b06407800603ed5c101606d..efca1a48d38136c2a09c3d36e6b4a8b54785cf70 100644
Binary files a/zh-cn/application-dev/quick-start/figures/secondPage.png and b/zh-cn/application-dev/quick-start/figures/secondPage.png differ
diff --git a/zh-cn/application-dev/quick-start/start-with-ets-stage.md b/zh-cn/application-dev/quick-start/start-with-ets-stage.md
index abdbd30f2daaa8a3e70878246c8660d832f48638..adc7bbb143679b67904b1a0050659f06e203969f 100644
--- a/zh-cn/application-dev/quick-start/start-with-ets-stage.md
+++ b/zh-cn/application-dev/quick-start/start-with-ets-stage.md
@@ -1,11 +1,11 @@
# 构建第一个ArkTS应用(Stage模型)
-> **说明:**
->
-> 请使用**DevEco Studio V3.0.0.900 Beta3**及更高版本。
->
-> 为确保运行效果,本文以使用**DevEco Studio 4.0 Beta1**版本为例,点击[此处](../../release-notes/OpenHarmony-v4.0-beta1.md#配套关系)获取下载链接。
+> **说明:**
+>
+> 请使用**DevEco Studio V3.0.0.900 Beta3**及更高版本。
+>
+> 为确保运行效果,本文以使用**DevEco Studio 4.0 Beta2**版本为例,点击[此处](../../release-notes/OpenHarmony-v4.0-beta2.md#配套关系)获取下载链接。
## 创建ArkTS工程
@@ -23,6 +23,8 @@
3. 进入配置工程界面,**Compile SDK**选择“**3.1.0(API 9)**”,其他参数保持默认设置即可。
+ 其中**Node**用来配置当前工程运行的Node.js版本,可选择使用已有的Node.js或下载新的Node.js版本。
+

> **说明:**
@@ -42,11 +44,12 @@

-7. 将其他各模块级别的build-profile.json5文件中targets字段下的runtimeOS配置删除。
+7. 在模块级**entry > build-profile.json5**文件中,将targets字段下的runtimeOS配置删除。

-8. 单击Sync Now完成同步。此时工程对应为API 10的OpenHarmony工程。
+8. 单击**Sync Now**完成同步。此时工程对应为API 10的OpenHarmony工程。
+
### 创建API 9的OpenHarmony工程
@@ -58,6 +61,8 @@
3. 进入配置工程界面,**Compile SDK**选择“**3.1.0(API 9)**”,其他参数保持默认设置即可。
+ 其中**Node**用来配置当前工程运行的Node.js版本,可选择使用已有的Node.js或下载新的Node.js版本。
+

> **说明:**
@@ -69,18 +74,18 @@
4. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。
-5. 在模块级**entry > build-profile.json5**文件中,将targets中的**runtimeOS**配置为“**OpenHarmony**”。
+5. 在模块级**entry > build-profile.json5**文件中,将targets中的runtimeOS配置为“OpenHarmony”。
-6. 单击Sync Now完成同步。此时工程对应为API 9的OpenHarmony工程。
+6. 单击**Sync Now**完成同步。此时工程对应为API 9的OpenHarmony工程。
## ArkTS工程目录结构(Stage模型)(API 10)
-
+
- **AppScope > app.json5**:应用的全局配置信息。
-- **entry**:OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。
+- **entry**:OpenHarmony工程模块,编译构建生成一个HAP包。
- **src > main > ets**:用于存放ArkTS源码。
- **src > main > ets > entryability**:应用/服务的入口。
@@ -101,13 +106,14 @@
- **hvigorfile.ts**:应用级编译构建任务脚本。
+
## ArkTS工程目录结构(Stage模型)(API 9)
-
+
- **AppScope > app.json5**:应用的全局配置信息。
-- **entry**:OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。
+- **entry**:OpenHarmony工程模块,编译构建生成一个HAP包。
- **src > main > ets**:用于存放ArkTS源码。
- **src > main > ets > entryability**:应用/服务的入口。
diff --git a/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md b/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
index 083638d33287c0464b22dac0ee85808b92a95ef8..0d4553fa5cd806134a393ca02af5e895a864e760 100644
--- a/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
+++ b/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
@@ -651,7 +651,7 @@ interface Identity {
interface Contact {
email: string
- phone: string
+ phoneNumber: string
}
type Employee = Identity & Contact
@@ -667,7 +667,7 @@ interface Identity {
interface Contact {
email: string
- phone: string
+ phoneNumber: string
}
interface Employee extends Identity, Contact {}
@@ -3174,8 +3174,8 @@ class Person {
const person: Person = {
name: "John",
age: 30,
- email: "john@example.com",
- phone: 1234567890,
+ email: "***@example.com",
+ phoneNumber: 18*********,
}
```
@@ -3186,18 +3186,18 @@ class Person {
name: string
age: number
email: string
- phone: number
+ phoneNumber: number
- constructor(name: string, age: number, email: string, phone: number) {
+ constructor(name: string, age: number, email: string, phoneNumber: number) {
this.name = name
this.age = age
this.email = email
- this.phone = phone
+ this.phoneNumber = phoneNumber
}
}
function main(): void {
- const person: Person = new Person("John", 30, "john@example.com", 1234567890)
+ const person: Person = new Person("John", 30, "***@example.com", 18*********)
}
```
diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md
index 9597a88ad7f29b3c919f72c3fb29206e9e086167..2508b074a9c31fbc6b451e30074990d2afc0d880 100644
--- a/zh-cn/application-dev/reference/apis/Readme-CN.md
+++ b/zh-cn/application-dev/reference/apis/Readme-CN.md
@@ -198,22 +198,23 @@
- UI界面
- [@ohos.animator (动画)](js-apis-animator.md)
- [@ohos.arkui.componentSnapshot (组件截图)](js-apis-arkui-componentSnapshot.md)
+ - [@ohos.arkui.componentUtils (componentUtils)](js-apis-arkui-componentUtils.md)
- [@ohos.arkui.dragController (DragController)](js-apis-arkui-dragController.md)
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](js-apis-arkui-drawableDescriptor.md)
- [@ohos.arkui.inspector (布局回调)](js-apis-arkui-inspector.md)
+ - [ @ohos.arkui.performanceMonitor (性能监测)](js-apis-arkui-performancemonitor.md)
- [@ohos.arkui.UIContext (UIContext)](js-apis-arkui-UIContext.md)
- [@ohos.arkui.componentUtils (componentUtils)](js-apis-arkui-componentUtils.md)
- [@ohos.curves (插值计算)](js-apis-curve.md)
- [@ohos.font (注册自定义字体)](js-apis-font.md)
- [@ohos.matrix4 (矩阵变换)](js-apis-matrix4.md)
+ - [@ohos.measure (文本计算)](js-apis-measure.md)
- [@ohos.mediaquery (媒体查询)](js-apis-mediaquery.md)
- [@ohos.pluginComponent (PluginComponentManager)](js-apis-plugincomponent.md)
- [@ohos.promptAction (弹窗)](js-apis-promptAction.md)
- [@ohos.router (页面路由)](js-apis-router.md)
- - [@ohos.measure (文本计算)](js-apis-measure.md)
- [@ohos.uiAppearance (用户界面外观)](js-apis-uiappearance.md)
- - [ @ohos.arkui.performanceMonitor (性能监测)](js-apis-arkui-performancemonitor.md)
-
+
- 图形图像
- [@ohos.animation.windowAnimationManager (窗口动画管理)](js-apis-windowAnimationManager.md)
- [@ohos.application.WindowExtensionAbility (窗口扩展能力)](js-apis-application-windowExtensionAbility.md)
@@ -228,12 +229,15 @@
- [webgl2 (WebGL2)](js-apis-webgl2.md)
- 媒体
+ - [@ohos.app.ability.MediaControlExtensionAbility (播控扩展能力)](js-apis-app-ability-MediaControlExtensionAbility.md)
- [@ohos.multimedia.audio (音频管理)](js-apis-audio.md)
- [@ohos.multimedia.avsession (媒体会话管理)](js-apis-avsession.md)
- [@ohos.multimedia.camera (相机管理)](js-apis-camera.md)
- [@ohos.multimedia.image (图片处理)](js-apis-image.md)
- [@ohos.multimedia.media (媒体服务)](js-apis-media.md)
- [@ohos.multimedia.systemSoundManager (系统声音管理)](js-apis-systemSoundManager.md)
+ - application
+ - [MediaControlExtensionContext (播控扩展能力上下文)](js-apis-inner-application-MediaControlExtensionContext.md)
- multimedia
- [ringtonePlayer (铃声播放器)](js-apis-inner-multimedia-ringtonePlayer.md)
diff --git a/zh-cn/application-dev/reference/apis/common_event/commonEvent-account.md b/zh-cn/application-dev/reference/apis/common_event/commonEvent-account.md
index d054bd8600f056a764d5a5872d212e153ec045d2..8874a4e86d322e2fdebabdc33575b13aecf08747 100644
--- a/zh-cn/application-dev/reference/apis/common_event/commonEvent-account.md
+++ b/zh-cn/application-dev/reference/apis/common_event/commonEvent-account.md
@@ -64,23 +64,23 @@
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGIN
(预留事件,暂未支持)表示分布式帐号登录成功的动作。
-- 值: usual.event.DISTRIBUTED_ACCOUNT_LOGIN
+- 值: common.event.DISTRIBUTED_ACCOUNT_LOGIN
- 订阅者所需权限: 无
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOUT
(预留事件,暂未支持)表示分布式帐号登出成功的动作。
-- 值: usual.event.DISTRIBUTED_ACCOUNT_LOGOUT
+- 值: common.event.DISTRIBUTED_ACCOUNT_LOGOUT
- 订阅者所需权限: 无
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_TOKEN_INVALID
(预留事件,暂未支持)表示分布式帐号token令牌无效的动作。
-- 值: usual.event.DISTRIBUTED_ACCOUNT_TOKEN_INVALID
+- 值: common.event.DISTRIBUTED_ACCOUNT_TOKEN_INVALID
- 订阅者所需权限: 无
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOFF
(预留事件,暂未支持)表示分布式帐号注销的动作。
-- 值: usual.event.DISTRIBUTED_ACCOUNT_LOGOFF
+- 值: common.event.DISTRIBUTED_ACCOUNT_LOGOFF
- 订阅者所需权限: 无
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-animator.md b/zh-cn/application-dev/reference/apis/js-apis-animator.md
index b8c7db9204ff2d698da536c69a1836e33300b1fa..12c3103acfdc89c237cad32d6125caaa6ab350c6 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-animator.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-animator.md
@@ -257,7 +257,7 @@ animatorResult.onrepeat = function() {
| 名称 | 类型 | 必填 | 说明 |
| ---------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| duration | number | 是 | 动画播放的时长,单位毫秒。 |
-| easing | string | 是 | 动画插值曲线,仅支持以下可选值:
"linear":动画线性变化。
"ease":动画开始和结束时的速度较慢,cubic-bezier(0.25、0.1、0.25、1.0)。
"ease-in":动画播放速度先慢后快,cubic-bezier(0.42, 0.0, 1.0, 1.0)。
"ease-out":动画播放速度先快后慢,cubic-bezier(0.0, 0.0, 0.58, 1.0)。
"ease-in-out":动画播放速度先加速后减速,cubic-bezier(0.42, 0.0, 0.58, 1.0)。
"fast-out-slow-in":标准曲线,cubic-bezier(0.4,0.0,0.2,1.0)。
"linear-out-slow-in":减速曲线,cubic-bezier(0.0,0.0,0.2,1.0)。
"friction":阻尼曲线,cubic-bezier(0.2, 0.0, 0.2, 1.0)。
"extreme-deceleration":急缓曲线,cubic-bezier(0.0, 0.0, 0.0, 1.0)。
"rhythm":节奏曲线,cubic-bezier(0.7, 0.0, 0.2, 1.0)。
"sharp":锐利曲线,cubic-bezier(0.33, 0.0, 0.67, 1.0)。
"smooth":平滑曲线,cubic-bezier(0.4, 0.0, 0.4, 1.0)。
cubic-bezier(x1, y1, x2, y2):在三次贝塞尔函数中定义动画变化过程,入参的值必须处于0-1之间。
steps(number, step-position):阶梯曲线。number必须设置,支持的类型为int。step-position参数可选,支持设置start或end,默认值为end。 |
+| easing | string | 是 | 动画插值曲线,仅支持以下可选值:
"linear":动画线性变化。
"ease":动画开始和结束时的速度较慢,cubic-bezier(0.25、0.1、0.25、1.0)。
"ease-in":动画播放速度先慢后快,cubic-bezier(0.42, 0.0, 1.0, 1.0)。
"ease-out":动画播放速度先快后慢,cubic-bezier(0.0, 0.0, 0.58, 1.0)。
"ease-in-out":动画播放速度先加速后减速,cubic-bezier(0.42, 0.0, 0.58, 1.0)。
"fast-out-slow-in":标准曲线,cubic-bezier(0.4,0.0,0.2,1.0)。
"linear-out-slow-in":减速曲线,cubic-bezier(0.0,0.0,0.2,1.0)。
"friction":阻尼曲线,cubic-bezier(0.2, 0.0, 0.2, 1.0)。
"extreme-deceleration":急缓曲线,cubic-bezier(0.0, 0.0, 0.0, 1.0)。
"rhythm":节奏曲线,cubic-bezier(0.7, 0.0, 0.2, 1.0)。
"sharp":锐利曲线,cubic-bezier(0.33, 0.0, 0.67, 1.0)。
"smooth":平滑曲线,cubic-bezier(0.4, 0.0, 0.4, 1.0)。
"cubic-bezier(x1,y1,x2,y2)":三次贝塞尔曲线,x1、x2的值必须处于0-1之间。例如"cubic-bezier(0.42,0.0,0.58,1.0)"。
"steps(number,step-position)":阶梯曲线,number必须设置,为正整数,step-position参数可选,支持设置start或end,默认值为end。例如"steps(3,start)"。 |
| delay | number | 是 | 动画延时播放时长,单位毫秒,设置为0时,表示不延时。 |
| fill | "none" \| "forwards" \| "backwards" \| "both" | 是 | 动画执行后是否恢复到初始状态,动画执行后,动画结束时的状态(在最后一个关键帧中定义)将保留。
"none":在动画执行之前和之后都不会应用任何样式到目标上。
"forwards":在动画结束后,目标将保留动画结束时的状态(在最后一个关键帧中定义)。
"backwards":动画将在animation-delay期间应用第一个关键帧中定义的值。当animation-direction为"normal"或"alternate"时应用from关键帧中的值,当animation-direction为"reverse"或"alternate-reverse"时应用to关键帧中的值。
"both":动画将遵循forwards和backwards的规则,从而在两个方向上扩展动画属性。 |
| direction | "normal" \| "reverse" \| "alternate" \| "alternate-reverse" | 是 | 动画播放模式。
"normal": 动画正向循环播放。
"reverse": 动画反向循环播放。
"alternate":动画交替循环播放,奇数次正向播放,偶数次反向播放。
"alternate-reverse":动画反向交替循环播放,奇数次反向播放,偶数次正向播放。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md
new file mode 100644
index 0000000000000000000000000000000000000000..1661fe67effbfaa8ff976ce97974f527350b9e18
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md
@@ -0,0 +1,17 @@
+# @ohos.app.ability.MediaControlExtensionAbility (播控扩展能力)
+
+MediaControlExtensionAbility模块提供播放控制的扩展能力,继承自[UIExtensionAbility](js-apis-app-ability-uiExtensionAbility.md),无其他新增接口。在实际开发时,需要开发者实现父类中的接口,使用UIExtensiton的生命周期和能力,不支持直接调用基类。
+
+**系统能力:** SystemCapability.Multimedia.AVSession.Core
+
+> **说明:**
+>
+> - 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> - 本模块接口仅可在Stage模型下使用。
+> - 本模块接口为系统接口。
+
+## 导入模块
+
+```js
+import MediaControlExtensionAbility from @ohos.app.ability.MediaControlExtensionAbility;
+```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
index 48bf88b532e925535f83eac60ac14ebb54b91d7a..35a26c0cbbfc5ef6343808250471d7ca7ff7c2e4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
@@ -202,7 +202,7 @@ onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResu
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
-| wantParam | {[key: string]: any} | 是 | want相关参数。 |
+| wantParam | {[key: string]: Object} | 是 | want相关参数。 |
**返回值:**
@@ -289,7 +289,7 @@ onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Objec
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| reason | [AbilityConstant.StateType](js-apis-app-ability-abilityConstant.md#abilityconstantstatetype) | 是 | 回调保存状态的原因。 |
-| wantParam | {[key: string]: any} | 是 | want相关参数。 |
+| wantParam | {[key: string]: Object} | 是 | want相关参数。 |
**返回值:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionAbility.md
new file mode 100644
index 0000000000000000000000000000000000000000..2b2332422f59af67c269335da4894a7f42f4af26
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionAbility.md
@@ -0,0 +1,84 @@
+# @ohos.app.ability.UIExtensionAbility (带界面扩展能力基类)
+
+UIExtensionAbility是特定场景下带界面扩展能力的基类,继承自[ExtensionAbility](js-apis-app-ability-extensionAbility.md),新增带界面扩展能力相关的属性和方法。不支持开发者直接继承该基类。
+
+> **说明:**
+>
+> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> 本模块接口仅可在Stage模型下使用。
+
+## 导入模块
+
+```ts
+import UIExtensionAbility from '@ohos.app.ability.UIExtensionAbility';
+```
+
+## 属性
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| context | [UIExtensionContext](js-apis-inner-application-uiExtensionContext.md) | 是 | 否 | 上下文。 |
+
+## UIExtensionAbility.onCreate
+
+onCreate(): void
+
+UIExtensionAbility创建时回调,执行初始化业务逻辑操作。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+## UIExtensionAbility.onSessionCreate
+
+onSessionCreate(want: Want, session: UIExtensionContentSession): void
+
+当UIExtensionAbility界面内容对象创建后调用。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-app-ability-want.md) | 是 | 当前UIExtensionAbility的Want类型信息,包括ability名称、bundle名称等。 |
+| session | [UIExtensionContentSession](js-apis-app-ability-uiExtensionContentSession.md) | 是 | UIExtensionAbility界面内容相关信息。 |
+
+## UIExtensionAbility.onSessionDestroy
+
+onSessionDestroy(session: UIExtensionContentSession): void
+
+当UIExtensionAbility界面内容对象销毁后调用。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| session | [UIExtensionContentSession](js-apis-app-ability-uiExtensionContentSession.md) | 是 | UIExtensionAbility界面内容相关信息。 |
+
+## UIExtensionAbility.onForeground
+
+onForeground(): void;
+
+UIExtensionAbility生命周期回调,当UIExtensionAbility从后台转到前台时触发。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+## UIExtensionAbility.onBackground
+
+onBackground(): void;
+
+UIExtensionAbility生命周期回调,当UIExtensionAbility从前台转到后台时触发。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+## UIExtensionAbility.onDestroy
+
+onDestroy(): void | Promise<void>;
+
+UIExtensionAbility生命周期回调,在销毁时回调,执行资源清理等操作。
+在执行完onDestroy生命周期回调后,应用可能会退出,从而可能导致onDestroy中的异步函数未能正确执行,比如异步写入数据库。可以使用异步生命周期,以确保异步onDestroy完成后再继续后续的生命周期。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionContentSession.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionContentSession.md
new file mode 100644
index 0000000000000000000000000000000000000000..ea086e8f5f5c8587372f655f002c75654ae7d225
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionContentSession.md
@@ -0,0 +1,211 @@
+# @ohos.app.ability.UIExtensionContentSession (带界面扩展能力界面操作类)
+
+UIExtensionContentSession是[UIExtensionAbility](js-apis-app-ability-uiExtensionAbility.md)加载界面内容时创建的实例对象,当UIExtensionComponent控件拉起指定的UIExtensionAbility时,UIExtensionAbility会创建UIExtensionContentSession对象,并通过[onSessionCreate](js-apis-app-ability-uiExtensionAbility.md#uiextensionabilityonsessioncreate)回调传递给开发者。一个UIExtensionComponent控件对应一个UIExtensionContentSession对象,提供界面加载,结果通知等方法。每个UIExtensionAbility的UIExtensionContentSession之间互不影响,可以各自进行操作。
+
+> **说明:**
+>
+> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> 本模块接口仅可在Stage模型下使用。
+
+## 导入模块
+
+```ts
+import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
+```
+
+## UIExtensionContentSession.sendData
+
+sendData(data: { [key: string]: Object }): void
+
+发送数据给UIExtensionComponent控件。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**系统API**:此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| data | {[key: string]: Object} | 是 | 发送给UIExtensionComponent控件的数据参数。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.setReceiveDataCallback
+
+setReceiveDataCallback(callback: (data: { [key: string]: Object }) => void): void
+
+设置从UIExtensionComponent控件接收数据的回调方法。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**系统API**:此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | (data: { [key: string]: Object }) => void | 是 | 接收数据的回调方法。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.loadContent
+
+loadContent(path: string, storage?: LocalStorage): Promise<void>
+
+为当前UIExtensionComponent控件对应的窗口加载与LocalStorage相关联的具体页面内容。
+
+**系统能力:** SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
+| path | string | 是 | 设置加载页面的路径。 |
+| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | 否 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.terminateSelf
+
+terminateSelf(callback: AsyncCallback<void>): void;
+
+停止UIExtensionContentSession对应的窗口界面对象(callback形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<void> | 是 | 停止UIExtensionContentSession对应的窗口界面对象的回调函数。 |
+
+## UIExtensionContentSession.terminateSelf
+
+terminateSelf(): Promise<void>;
+
+停止UIExtensionContentSession对应的窗口界面对象(promise形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 停止UIExtensionContentSession对应的窗口界面对象的回调函数。 |
+
+## UIExtensionContentSession.terminateSelfWithResult
+
+terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
+
+停止UIExtensionContentSession对应的窗口界面对象,并将结果返回给UIExtensionComponent控件(callback形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 是 | 返回给UIExtensionComponent控件的信息。 |
+| callback | AsyncCallback<void> | 是 | callback形式返回停止结果。 |
+
+## UIExtensionContentSession.terminateSelfWithResult
+
+terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
+
+停止UIExtensionContentSession对应的窗口界面对象,并将结果返回给UIExtensionComponent控件(promise形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 是 | 返回给UIExtensionComponent控件的信息。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | promise形式返回停止结果。 |
+
+## UIExtensionContentSession.setWindowBackgroundColor
+
+setWindowBackgroundColor(color: string): void
+
+设置UIExtensionAbility加载界面的背景色。该接口需要在[loadContent()](#uiextensioncontentsessionloadcontent)调用生效后使用。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**系统API**:此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| color | string | 是 | 需要设置的背景色,为十六进制RGB或ARGB颜色,不区分大小写,例如`#00FF00`或`#FF00FF00`。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.setWindowPrivacyMode
+
+setWindowPrivacyMode(isPrivacyMode: boolean): Promise<void>
+
+设置窗口是否为隐私模式,使用Promise异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。
+
+**系统能力:** SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**需要权限:** ohos.permission.PRIVACY_WINDOW
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------------- | ------- | -- | ----------------------------------------------------- |
+| isPrivacyMode | boolean | 是 | 窗口是否为隐私模式。true表示模式开启;false表示模式关闭。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------------------ |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+## UIExtensionContentSession.setWindowPrivacyMode
+
+setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): void
+
+设置窗口是否为隐私模式,使用callback异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。
+
+**系统能力:** SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**需要权限:** ohos.permission.PRIVACY_WINDOW
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------------- | ------------------------- | -- | ------------------------------------------------------ |
+| isPrivacyMode | boolean | 是 | 窗口是否为隐私模式。true表示模式开启;false表示模式关闭。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md b/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md
index 6fa259689307bde652829c8f2bb91c0643dc6952..c2983efcd2fe9963b150a5bcd53ab9bae5ffc760 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md
@@ -1202,95 +1202,6 @@ try {
}
```
-## getRunningFormInfos10+
-
-getRunningFormInfos(callback: AsyncCallback<Array<formInfo.RunningFormInfo>>, hostBundleName?: string): void
-
-获取设备上正在运行的所有非临时卡片信息。使用callback异步回调。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ------- |
-| callback | AsyncCallback<Array<formInfo.RunningFormInfo>> | 是 | 回调函数。获取设备上指定应用为卡片使用方的当前卡片信息成功,error为undefined,data为查询到的卡片信息。|
-| hostBundleName | string | 否 | 指定要查询的卡片使用方名称,指定后会仅返回该卡片使用方下正在运行的非临时卡片信息。
缺省时,返回设备上所有正在运行的非临时卡片信息。 |
-
-**错误码:**
-以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
-
-| 错误码ID | 错误信息 |
-| -------- | -------- |
-| 16500050 | An IPC connection error happened. |
-| 16500060 | A service connection error happened, please try again later. ||
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-try {
- formHost.getRunningFormInfos((error, data) => {
- if (error) {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- } else {
- console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}');
- }
- }, 'com.example.ohos.formjsdemo');
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfos10+
-
-getRunningFormInfos(hostBundleName?: string): Promise<Array<formInfo.RunningFormInfo>>
-
-获取设备上正在运行的所有非临时卡片信息。使用Promise异步回调。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ------- |
-| hostBundleName | string | 否 | 指定要查询的卡片使用方名称,指定后会仅返回该卡片使用方下正在运行的非临时卡片信息。
缺省时,返回设备上所有正在运行的非临时卡片信息。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| :----------------------------------------------------------- | :---------------------------------- |
-| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Promise对象,返回查询到的卡片信息。 |
-
-**错误码:**
-以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
-
-| 错误码ID | 错误信息 |
-| -------- | -------- |
-| 16500050 | An IPC connection error happened. |
-| 16500060 | A service connection error happened, please try again later. ||
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-try {
- formHost.getRunningFormInfos('com.example.ohos.formjsdemo').then((data) => {
- console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}');
- }).catch((error) => {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
## deleteInvalidForms
deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<number>): void
@@ -1583,138 +1494,6 @@ let callback = function(formId) {
formHost.off('formUninstall', callback);
```
-## on('formAdd')10+
-
- on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-订阅卡片新增事件。使用callback异步回调,返回当前新增卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ------- |
-| type | string | 是 | 填写'formAdd',表示卡片新增事件。 |
-| callback | Callback<formInfo.RunningFormInfo> | 是 | 回调函数。返回新增卡片的RunningFormInfo。 |
-| bundleName | string | 否 | 指定订阅卡片使用方包的bundleName。缺省则订阅所有卡片使用方的卡片新增事件。 |
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.on('formAdd', callback);
-formHost.on('formAdd', callback, bundleName);
-```
-
-## off('formAdd')10+
-
- off(type: "formAdd", observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-取消订阅卡片新增事件。使用callback异步回调,返回当前新增卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ------- |
-| type | string | 是 | 填写'formAdd',表示卡片新增事件。 |
-| callback | Callback<formInfo.RunningFormInfo> | 否 | 回调函数。返回卡片RunningFormInfo。缺省时,表示注销对应已注册事件回调。
需与对应on('formAdd')的callback一致。|
-| bundleName | string | 否 | 指定订阅卡片使用方包的bundleName。
填写该参数时,与注册时填写bundleName的on接口对应。
缺省则订阅所有卡片使用方的卡片删除事件,与注册时未填写bundleName的on接口相对应。 |
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.off('formAdd', callback);
-formHost.off('formAdd', callback, bundleName);
-```
-> **说明:**
-> on('formAdd', callback)与off('formAdd', callback)相对应;
-> on('formAdd', callback, bundleName)与off('formAdd', callback, bundleName)相对应;
-> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
-
-## on('formRemove')10+
-
- on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-订阅卡片删除事件。使用callback异步回调,返回当前删除卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ------- |
-| type | string | 是 | 填写'formRemove',表示卡片删除事件。 |
-| callback | Callback<formInfo.RunningFormInfo> | 是 | 回调函数。返回删除卡片的RunningFormInfo。 |
-| bundleName | string | 否 | 指定订阅卡片使用方包的bundleName。缺省则订阅所有卡片使用方的卡片删除事件。 |
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.on('formRemove', callback);
-formHost.on('formRemove', callback, bundleName);
-```
-
-## off('formRemove')10+
-
-off(type: "formRemove", observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-取消订阅卡片删除事件。使用callback异步回调,返回当前删除卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ------- |
-| type | string | 是 | 填写'formRemove',表示卡片删除事件。 |
-| callback | Callback<formInfo.RunningFormInfo> | 否 | 回调函数。返回卡片RunningFormInfo。缺省时,表示注销对应已注册事件回调。
需与对应on('formRemove')的callback一致。|
-| bundleName | string | 否 | 指定订阅卡片使用方包的bundleName。
填写该参数时,与注册时填写bundleName的on接口对应。
缺省则订阅所有卡片使用方的卡片删除事件,与注册时未填写bundleName的on接口相对应。 |
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.off('formRemove', callback);
-formHost.off('formRemove', callback, bundleName);
-```
-> **说明:**
-> on('formRemove', callback)与off('formRemove', callback)相对应;
-> on('formRemove', callback, bundleName)与off('formRemove', callback, bundleName)相对应;
-> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
-
## notifyFormsVisible
notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: AsyncCallback<void>): void
@@ -2221,350 +2000,3 @@ try {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
-
-## getRunningFormInfosByFilter10+
-
-getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise<Array<formInfo.RunningFormInfo>>
-
-根据提供方信息查询卡片已有的使用方列表信息。使用Promise异步回调。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | 是 | 卡片提供方应用信息。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------------------- | ------------------------- |
-| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md#RunningFormInfo)>> | Promise对象,返回查询到的使用方列表信息。 |
-
-**错误码:**
-
-以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
-
-| 错误码ID | 错误信息 |
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-let formInstanceFilter = {
- bundleName: "com.example.formprovide",
- abilityName: "EntryFormAbility",
- formName: "widget",
- moduleName: "entry"
-}
-try {
- formHost.getRunningFormInfosByFilter(formInstanceFilter).then(data1 => {
- console.info('formHost getRunningFormInfosByFilter return err :');
- }).catch((error) => {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfosByFilter10+
-
-getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback<Array<formInfo.RunningFormInfo>>): void
-
-根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | 是 | 卡片提供方应用信息。 |
-| callback | AsyncCallback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 |
-
-**错误码:**
-
-以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
-
-| 错误码ID | 错误信息 |
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-let formInstanceFilter = {
- bundleName: "com.example.formprovide",
- abilityName: "EntryFormAbility",
- formName: "widget",
- moduleName: "entry"
-}
-try {
- formHost.getRunningFormInfosByFilter(formInstanceFilter,(error, data) => {
- if (error) {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- } else {
- console.log('formHost getRunningFormInfosByFilter, data: ${JSON.stringify(data)}');
- }
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfoById10+
-
-getRunningFormInfoById(formId: string): Promise<formInfo.RunningFormInfo>
-
-
-根据formId查询卡片已有的使用方列表信息。使用Promise异步回调。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formId | string | 是 | 卡片标识。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------------------- | ------------------------- |
-| Promise<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | Promise对象,返回查询到的使用方列表信息。 |
-
-**错误码:**
-
-以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
-
-| 错误码ID | 错误信息 |
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let formId = '12400633174999288';
-try {
- formHost.getRunningFormInfoById(formId).then(data1 => {
- console.info('formHost getRunningFormInfoById return err :');
- }).catch((error) => {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfoById10+
-
-getRunningFormInfoById(formId: string, callback: AsyncCallback<formInfo.RunningFormInfo>): void
-
-根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formId | string | 是 | 卡片标识。 |
-| callback | AsyncCallback<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 |
-
-**错误码:**
-
-以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
-
-| 错误码ID | 错误信息 |
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-let formId = '12400633174999288';
-try {
- formHost.getRunningFormInfoById(formId,(error, data) => {
- if (error) {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- } else {
- console.log('formHost getRunningFormInfoById, data: ${JSON.stringify(data)}');
- }
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## on('notifyVisible')10+
-
- on(type: 'notifyVisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-订阅通知卡片可见的事件。
-
-触发通知卡片可见场景为:调用notifyVisibleForms接口通知对应卡片可见性变更为可见状态
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 仅允许填写'notifyVisible',表示订阅通知卡片可见的事件。 |
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回订阅通知卡片可见的RunningFormInfo。 |
-| bundleName | string | 否 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。 |
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change visibility, data: ${JSON.stringify(data)');
-}
-
-formHost.on('notifyVisible', callback);
-formHost.on('notifyVisible', callback, bundleName);
-```
-
-## off('notifyVisible')10+
-
- off(type: "notifyVisible", observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-取消订阅通知卡片可见的事件。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 仅允许填写'notifyVisible',表示取消订阅通知卡片为可见的事件。 |
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 否 | 入参,注册时注册进去的callback。缺省时,表示注销对应已注册订阅的回调。
需与对应on('notifyVisible')的callback一致。 |
-| bundleName | string | 否 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。
填写该参数时,与注册时填写bundleName的on接口对应。 |
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change visibility, data: ${JSON.stringify(data)');
-}
-
-formHost.off('notifyVisible', callback);
-formHost.off('notifyVisible', callback, bundleName);
-```
-
-> **说明:**
-> on('notifyVisible', callback)与off('notifyVisible', callback)相对应;
-> on('notifyVisible', callback, bundleName)与off('notifyVisible', callback, bundleName)相对应;
-> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
-
-
-
-## on('notifyInvisible')10+
-
- on(type: 'notifyInvisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-订阅通知卡片不可见的事件。
-
-触发通知卡片不可见场景为:调用notifyInvisibleForms接口通知对应卡片可见性变更为不可见状态
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 仅允许填写'notifyInvisible',表示订阅卡片不可见的事件。 |
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回订阅通知卡片不可见的RunningFormInfo。 |
-| bundleName | string | 否 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。 |
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change invisibility, data: ${JSON.stringify(data)');
-}
-
-formHost.on('notifyInvisible', callback);
-formHost.on('notifyInvisible', callback, bundleName);
-```
-
-## off('notifyInvisible')10+
-
- off(type: "notifyInvisible", observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-取消订阅通知卡片不可见事件。
-
-**需要权限**:ohos.permission.REQUIRE_FORM
-
-**系统能力**:SystemCapability.Ability.Form
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 仅允许填写'notifyInvisible',表示卡片可见性变更为不可见。 |
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 否 | 入参,注册时注册进去的callback。缺省时,表示注销对应已注册事件回调。
需与对应on('notifyInvisible')的callback一致。 |
-| bundleName | string | 否 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。
填写该参数时,与注册时填写bundleName的on接口对应。
|
-
-**示例:**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change invisibility, data: ${JSON.stringify(data)');
-}
-
-formHost.off('notifyInvisible', callback);
-formHost.off('notifyInvisible', callback, bundleName);
-```
-
-> **说明:**
-> on('notifyInvisible', callback)与off('notifyInvisible', callback)相对应;
-> on('notifyInvisible', callback, bundleName)与off('notifyInvisible', callback, bundleName)相对应;
-> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-form-formObserver.md b/zh-cn/application-dev/reference/apis/js-apis-app-form-formObserver.md
new file mode 100644
index 0000000000000000000000000000000000000000..7a3ed1f4cd871af1563f3c97d046cd1ad8d49f10
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-form-formObserver.md
@@ -0,0 +1,699 @@
+# @ohos.app.form.formObserver (formObserver)
+
+formObserver模块提供了卡片监听方相关接口的能力,包括对同一用户下安装的卡片新增、删除、可见性变化事件的订阅和取消订阅,获取正在运行的卡片信息等。
+
+> **说明:**
+>
+> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> 本模块接口均为系统接口。
+
+## 导入模块
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+```
+
+## on('formAdd')
+
+ on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+订阅卡片新增事件。使用callback异步回调,返回当前新增卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| type | string | 是 | 填写'formAdd',表示卡片新增事件。 |
+| callback | Callback<formInfo.RunningFormInfo> | 是 | 回调函数。返回新增卡片的RunningFormInfo。 |
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formAdd', callback);
+```
+
+## on('formAdd')
+
+ on(type: 'formAdd', bundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+订阅卡片新增事件。使用callback异步回调,返回指定卡片使用方应用新增卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| type | string | 是 | 填写'formAdd',表示卡片新增事件。 |
+| bundleName | string | 是 | 指定订阅卡片使用方包的bundleName。缺省则订阅所有卡片使用方的卡片新增事件。 |
+| callback | Callback<formInfo.RunningFormInfo> | 是 | 回调函数。返回新增卡片的RunningFormInfo。 |
+
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formAdd', bundleName, callback);
+```
+
+## off('formAdd')
+
+ off(type: "formAdd", bundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void
+
+取消订阅卡片新增事件。使用callback异步回调,返回当前新增卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| type | string | 是 | 填写'formAdd',表示卡片新增事件。 |
+| bundleName | string | 否 | 指定订阅卡片使用方包的bundleName。
填写该参数时,与注册时填写bundleName的on接口对应。
缺省则订阅所有卡片使用方的卡片删除事件,与注册时未填写bundleName的on接口相对应。 |
+| callback | Callback<formInfo.RunningFormInfo> | 否 | 回调函数。返回卡片RunningFormInfo。缺省时,表示注销对应已注册事件回调。
需与对应on('formAdd')的callback一致。|
+
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('formAdd', callback);
+formObserver.off('formAdd', bundleName, callback);
+```
+> **说明:**
+> on('formAdd', callback)与off('formAdd', callback)相对应;
+> on('formAdd', bundleName, callback)与off('formAdd', bundleName, callback)相对应;
+> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
+
+## on('formRemove')
+
+ on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+订阅卡片删除事件。使用callback异步回调,返回当前删除卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| type | string | 是 | 填写'formRemove',表示卡片删除事件。 |
+| callback | Callback<formInfo.RunningFormInfo> | 是 | 回调函数。返回删除卡片的RunningFormInfo。 |
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('form deleted, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formRemove', callback);
+```
+
+## on('formRemove')
+
+ on(type: 'formRemove', bundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+订阅卡片删除事件。使用callback异步回调,返回指定卡片使用方应用被删除卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| type | string | 是 | 填写'formRemove',表示卡片删除事件。 |
+| bundleName | string | 是 | 指定订阅卡片使用方包的bundleName。缺省则订阅所有卡片使用方的卡片删除事件。 |
+| callback | Callback<formInfo.RunningFormInfo> | 是 | 回调函数。返回删除卡片的RunningFormInfo。 |
+
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form deleted, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formRemove', bundleName, callback);
+```
+
+## off('formRemove')
+
+off(type: "formRemove", bundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void
+
+取消订阅卡片删除事件。使用callback异步回调,返回当前删除卡片的[RunningFormInfo](js-apis-app-form-formInfo.md)。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| type | string | 是 | 填写'formRemove',表示卡片删除事件。 |
+| bundleName | string | 否 | 指定订阅卡片使用方包的bundleName。
填写该参数时,与注册时填写bundleName的on接口对应。
缺省则订阅所有卡片使用方的卡片删除事件,与注册时未填写bundleName的on接口相对应。 |
+| callback | Callback<formInfo.RunningFormInfo> | 否 | 回调函数。返回卡片RunningFormInfo。缺省时,表示注销对应已注册事件回调。
需与对应on('formRemove')的callback一致。|
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('formRemove', callback);
+formObserver.off('formRemove', bundleName, callback);
+```
+> **说明:**
+> on('formRemove', callback)与off('formRemove', callback)相对应;
+> on('formRemove', bundleName, callback)与off('formRemove', bundleName, callback)相对应;
+> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
+
+## on('notifyVisible')
+
+ on(type: 'notifyVisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+订阅通知卡片可见的事件。
+
+触发通知卡片可见场景为:调用notifyVisibleForms接口通知对应卡片可见性变更为可见状态
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 仅允许填写'notifyVisible',表示订阅通知卡片可见的事件。 |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回订阅通知卡片可见的RunningFormInfo。 |
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('form change visibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyVisible', callback);
+```
+
+## on('notifyVisible')
+
+ on(type: 'notifyVisible', bundleName: string, observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+订阅通知卡片可见的事件。
+
+触发通知卡片可见场景为:调用notifyVisibleForms接口通知对应卡片可见性变更为可见状态
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 仅允许填写'notifyVisible',表示订阅通知卡片可见的事件。 |
+| bundleName | string | 是 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。 |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回订阅通知卡片可见的RunningFormInfo。 |
+
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change visibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyVisible', bundleName, callback);
+```
+
+## off('notifyVisible')
+
+ off(type: "notifyVisible", bundleName?: string, observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+取消订阅通知卡片可见的事件。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 仅允许填写'notifyVisible',表示取消订阅通知卡片为可见的事件。 |
+| bundleName | string | 否 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。
填写该参数时,与注册时填写bundleName的on接口对应。 |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 否 | 入参,注册时注册进去的callback。缺省时,表示注销对应已注册订阅的回调。
需与对应on('notifyVisible')的callback一致。 |
+
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change visibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('notifyVisible', callback);
+formObserver.off('notifyVisible', bundleName, callback);
+```
+
+> **说明:**
+> on('notifyVisible', callback)与off('notifyVisible', callback)相对应;
+> on('notifyVisible', bundleName, callback)与off('notifyVisible', bundleName, callback)相对应;
+> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
+
+## on('notifyInvisible')
+
+ on(type: 'notifyInvisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+订阅通知卡片不可见的事件。
+
+触发通知卡片不可见场景为:调用notifyInvisibleForms接口通知对应卡片可见性变更为不可见状态
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 仅允许填写'notifyInvisible',表示订阅卡片不可见的事件。 |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回订阅通知卡片不可见的RunningFormInfo。 |
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('form change invisibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyInvisible', callback);
+```
+
+
+## on('notifyInvisible')
+
+ on(type: 'notifyInvisible', bundleName: string, observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+订阅通知卡片不可见的事件。
+
+触发通知卡片不可见场景为:调用notifyInvisibleForms接口通知对应卡片可见性变更为不可见状态
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 仅允许填写'notifyInvisible',表示订阅卡片不可见的事件。 |
+| bundleName | string | 是 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。 |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回订阅通知卡片不可见的RunningFormInfo。 |
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change invisibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyInvisible', bundleName, callback);
+```
+
+## off('notifyInvisible')
+
+ off(type: "notifyInvisible", bundleName?: string, observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+取消订阅通知卡片不可见事件。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 仅允许填写'notifyInvisible',表示卡片可见性变更为不可见。 |
+| bundleName | string | 否 | 指定卡片使用方的bundleName,用于订阅卡片在该使用方的可见状态变更事件。
填写该参数时,与注册时填写bundleName的on接口对应。
|
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 否 | 入参,注册时注册进去的callback。缺省时,表示注销对应已注册事件回调。
需与对应on('notifyInvisible')的callback一致。 |
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change invisibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('notifyInvisible', callback);
+formObserver.off('notifyInvisible', bundleName, callback);
+```
+
+> **说明:**
+> on('notifyInvisible', callback)与off('notifyInvisible', callback)相对应;
+> on('notifyInvisible', bundleName, callback)与off('notifyInvisible', bundleName, callback)相对应;
+> 订阅(on)只能由自己对应的取消订阅接口(off)取消。
+
+
+## getRunningFormInfos
+
+getRunningFormInfos(callback: AsyncCallback<Array<formInfo.RunningFormInfo>>, hostBundleName?: string): void
+
+获取设备上正在运行的所有非临时卡片信息。使用callback异步回调。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| callback | AsyncCallback<Array<formInfo.RunningFormInfo>> | 是 | 回调函数。获取设备上指定应用为卡片使用方的当前卡片信息成功,error为undefined,data为查询到的卡片信息。|
+| hostBundleName | string | 否 | 指定要查询的卡片使用方名称,指定后会仅返回该卡片使用方下正在运行的非临时卡片信息。
缺省时,返回设备上所有正在运行的非临时卡片信息。 |
+
+**错误码:**
+以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------- |
+| 16500050 | An IPC connection error happened. |
+| 16500060 | A service connection error happened, please try again later. ||
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+try {
+ formObserver.getRunningFormInfos((error, data) => {
+ if (error) {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ } else {
+ console.log('formObserver getRunningFormInfos, data: ${JSON.stringify(data)}');
+ }
+ }, 'com.example.ohos.formjsdemo');
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfos
+
+getRunningFormInfos(hostBundleName?: string): Promise<Array<formInfo.RunningFormInfo>>
+
+获取设备上正在运行的所有非临时卡片信息。使用Promise异步回调。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| hostBundleName | string | 否 | 指定要查询的卡片使用方名称,指定后会仅返回该卡片使用方下正在运行的非临时卡片信息。
缺省时,返回设备上所有正在运行的非临时卡片信息。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| :----------------------------------------------------------- | :---------------------------------- |
+| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Promise对象,返回查询到的卡片信息。 |
+
+**错误码:**
+以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------- |
+| 16500050 | An IPC connection error happened. |
+| 16500060 | A service connection error happened, please try again later. ||
+
+**示例:**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+try {
+ formObserver.getRunningFormInfos('com.example.ohos.formjsdemo').then((data) => {
+ console.log('formObserver getRunningFormInfos, data: ${JSON.stringify(data)}');
+ }).catch((error) => {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfosByFilter
+
+getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise<Array<formInfo.RunningFormInfo>>
+
+根据提供方信息查询卡片已有的使用方列表信息。使用Promise异步回调。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | 是 | 卡片提供方应用信息。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------------------- |
+| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md#RunningFormInfo)>> | Promise对象,返回查询到的使用方列表信息。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+let formInstanceFilter = {
+ bundleName: "com.example.formprovide",
+ abilityName: "EntryFormAbility",
+ formName: "widget",
+ moduleName: "entry"
+}
+try {
+ formObserver.getRunningFormInfosByFilter(formInstanceFilter).then(data1 => {
+ console.info('formObserver getRunningFormInfosByFilter return err :');
+ }).catch((error) => {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfosByFilter
+
+getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback<Array<formInfo.RunningFormInfo>>): void
+
+根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | 是 | 卡片提供方应用信息。 |
+| callback | AsyncCallback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+let formInstanceFilter = {
+ bundleName: "com.example.formprovide",
+ abilityName: "EntryFormAbility",
+ formName: "widget",
+ moduleName: "entry"
+}
+try {
+ formObserver.getRunningFormInfosByFilter(formInstanceFilter,(error, data) => {
+ if (error) {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ } else {
+ console.log('formObserver getRunningFormInfosByFilter, data: ${JSON.stringify(data)}');
+ }
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfoById
+
+getRunningFormInfoById(formId: string): Promise<formInfo.RunningFormInfo>
+
+
+根据formId查询卡片已有的使用方列表信息。使用Promise异步回调。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formId | string | 是 | 卡片标识。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------------------- |
+| Promise<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | Promise对象,返回查询到的使用方列表信息。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let formId = '12400633174999288';
+try {
+ formObserver.getRunningFormInfoById(formId).then(data1 => {
+ console.info('formObserver getRunningFormInfoById return err :');
+ }).catch((error) => {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfoById
+
+getRunningFormInfoById(formId: string, callback: AsyncCallback<formInfo.RunningFormInfo>): void
+
+根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。
+
+**需要权限**:ohos.permission.OBSERVE_FORM_RUNNING
+
+**系统能力**:SystemCapability.Ability.Form
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formId | string | 是 | 卡片标识。 |
+| callback | AsyncCallback<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+let formId = '12400633174999288';
+try {
+ formObserver.getRunningFormInfoById(formId,(error, data) => {
+ if (error) {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ } else {
+ console.log('formObserver getRunningFormInfoById, data: ${JSON.stringify(data)}');
+ }
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-arkui-UIContext.md b/zh-cn/application-dev/reference/apis/js-apis-arkui-UIContext.md
index 6eca3fc7b20924a6f6af6db1cd42a385a89606cc..f483bde4cbcf7d38e91f6a05814d31db24dd3690 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-arkui-UIContext.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-arkui-UIContext.md
@@ -610,7 +610,7 @@ getRectangleById(id: string): componentUtils.ComponentInfo
| 类型 | 说明 |
| -------------------------------------------------------- | ------------------------------------------------ |
-| [ComponentInfo](js-apis-componentUtils.md#componentinfo) | 组件大小、位置、平移缩放旋转及仿射矩阵属性信息。 |
+| [ComponentInfo](js-apis-arkui-componentUtils.md#componentinfo) | 组件大小、位置、平移缩放旋转及仿射矩阵属性信息。 |
**示例:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-avsession.md b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
index ff43b8196f407b4362f434c84766af1f614be8ed..ccd28aba9b7daf8f3aedda65d7e0063950588415 100755
--- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
@@ -1038,7 +1038,7 @@ startCastDeviceDiscovery(callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功并开始搜索,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1057,7 +1057,7 @@ avSession.startCastDeviceDiscovery(function (err) {
startCastDeviceDiscovery(filter: number, callback: AsyncCallback\): void
-开始设备搜索发现。结果通过callback异步回调方式返回。
+指定过滤条件,开始设备搜索发现。结果通过callback异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -1068,7 +1068,7 @@ startCastDeviceDiscovery(filter: number, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| filter | number | 是 | 进行设备发现的过滤条件,由ProtocolType的组合而成 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功并开始搜索,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1103,7 +1103,7 @@ startCastDeviceDiscovery(filter?: number): Promise\
**返回值:**
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当开始设备搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当命令发送成功并开始搜索,无返回结果,否则返回错误对象。 |
**示例:**
@@ -1130,7 +1130,7 @@ stopCastDeviceDiscovery(callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当成功停止搜索,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1159,7 +1159,7 @@ stopCastDeviceDiscovery(): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当成功停止搜索,无返回结果,否则返回错误对象。 |
**示例:**
@@ -1186,7 +1186,7 @@ setDiscoverable(enable: boolean, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| enable | boolean | 是 | 是否允许本设备被发现. true: 允许被发现, false:不允许被发现 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当设置成功,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1221,7 +1221,7 @@ setDiscoverable(enable: boolean): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当设置成功,无返回结果,否则返回错误对象。 |
**示例:**
@@ -1247,7 +1247,7 @@ on(type: 'deviceAvailable', callback: (device: OutputDeviceInfo) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持事件`'deviceAvailable'`,有设备更新时触发回调。 |
+| type | string | 是 | 事件回调类型,支持事件`'deviceAvailable'`,有设备被发现时触发回调。 |
| callback | (device: OutputDeviceInfo) => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则返回错误对象。 |
**错误码:**
@@ -1432,8 +1432,8 @@ startCasting(session: SessionToken, device: OutputDeviceInfo, callback: AsyncCal
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| session | [SessionToken](#sessiontoken) | 是 | 会话令牌。SessionToken表示单个token。 |
-| device | [OutputDeviceInfo](#outputdeviceinfo10) | 是 | 设备相关信息 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| device | [OutputDeviceInfo](#outputdeviceinfo10) | 是 | 设备相关信息 |
+| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功并启动投播,err为undefined,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1503,7 +1503,7 @@ startCasting(session: SessionToken, device: OutputDeviceInfo): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当命令发送成功并启动投播,无返回结果,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1563,7 +1563,7 @@ stopCasting(session: SessionToken, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| session | [SessionToken](#sessiontoken) | 是 | 会话令牌。SessionToken表示单个token。 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当成功结束投播,err为undefined,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1624,7 +1624,7 @@ stopCasting(session: SessionToken): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当成功结束投播,无返回结果,否则返回错误对象。 |
**错误码:**
错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -2917,7 +2917,7 @@ on(type:'playNext', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持的事件是` 'playNext'`,当播放下一首命令被发送到会话时,触发该事件回调。 |
+| type | string | 是 | 事件回调类型,支持的事件是`'playNext'`,当播放下一首命令被发送到会话时,触发该事件回调。 |
| callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 |
**错误码:**
@@ -2948,7 +2948,7 @@ on(type:'playPrevious', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持的事件是` 'playPrevious'`当播放上一首命令被发送到会话时,触发该事件回调。 |
+| type | string | 是 | 事件回调类型,支持的事件是`'playPrevious'`当播放上一首命令被发送到会话时,触发该事件回调。 |
| callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 |
**错误码:**
@@ -3010,7 +3010,7 @@ on(type:'rewind', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持的事件是` 'rewind'`,当快退命令被发送到会话时,触发该事件回调。 |
+| type | string | 是 | 事件回调类型,支持的事件是`'rewind'`,当快退命令被发送到会话时,触发该事件回调。 |
| callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 |
**错误码:**
@@ -3318,7 +3318,7 @@ off(type: 'pause', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'pause'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'pause'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3405,7 +3405,7 @@ off(type: 'playPrevious', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'playPrevious'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'playPrevious'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3434,7 +3434,7 @@ off(type: 'fastForward', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'fastForward'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'fastForward'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3463,7 +3463,7 @@ off(type: 'rewind', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'rewind'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'rewind'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3758,7 +3758,7 @@ stopCasting(): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止投播索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当成功结束投播,无返回结果,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -3881,7 +3881,7 @@ aVCastController.setDisplaySurface(function (err, value) {
getAVPlaybackState(callback: AsyncCallback\): void
-设备建立连接后,获取投播控制器。结果通过callback异步回调方式返回。
+获取当前的远端播放状态。结果通过callback异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -3889,7 +3889,7 @@ getAVPlaybackState(callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10))\> | 是 | 回调函数,返回投播控制器实例。 |
+| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10)\> | 是 | 回调函数,返回远端播放状态。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -3922,7 +3922,7 @@ getAVPlaybackState(): Promise\;
| 类型 | 说明 |
| --------- | ------------------------------------------------------------ |
-| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回投播控制器实例。 |
+| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回远端播放状态。。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -4289,7 +4289,7 @@ aVCastController.getCurrentItem(function (err, value) {
getCurrentItem(): Promise\
-结束投播。结果通过Promise异步回调方式返回。
+获取当前投播的资源信息。结果通过Promise异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -4392,8 +4392,8 @@ on(type: 'mediaItemChange', callback: Callback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持事件`'mediaItemChange'`:当播放状态变化时,触发该事件。 |
-| callback | (state: [AVQueueItem](#avqueueitem10)) => void | 是 | 回调函数,参数AVQueueItem是d当前正在播放的媒体内容。 |
+| type | string | 是 | 事件回调类型,支持事件`'mediaItemChange'`:当播放的媒体内容变化时,触发该事件。 |
+| callback | (state: [AVQueueItem](#avqueueitem10)) => void | 是 | 回调函数,参数AVQueueItem是当前正在播放的媒体内容。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -4506,7 +4506,7 @@ on(type: 'playPrevious', callback: Callback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持事件`'playPrevious'`:当播放下一首状态变化时,触发该事件。 |
+| type | string | 是 | 事件回调类型,支持事件`'playPrevious'`:当播放上一首状态变化时,触发该事件。 |
| callback | Callback\ | 是 | 回调函数 |
**错误码:**
@@ -4671,7 +4671,7 @@ on(type: 'error', callback: ErrorCallback): void
**错误码:**
-以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-media.md)。
+以下错误码的详细介绍请参见[媒体服务错误码](../errorcodes/errorcode-media.md)。
| 错误码ID | 错误信息 |
| -------- | --------------------- |
@@ -4707,7 +4707,7 @@ off(type: 'error'): void
**错误码:**
-以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-media.md)。
+以下错误码的详细介绍请参见[媒体服务错误码](../errorcodes/errorcode-media.md)。
| 错误码ID | 错误信息 |
| -------- | --------------------- |
@@ -4726,7 +4726,7 @@ aVCastController.off('error')
## ConnectionState10+
-播放设备的类别枚举。
+连接状态枚举。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4831,7 +4831,7 @@ aVCastController.off('error')
## AVCastCategory10+
-播放设备的类别枚举。
+投播的类别枚举。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -4861,7 +4861,7 @@ aVCastController.off('error')
| 名称 | 类型 | 必填 | 说明 |
| ---------- | -------------- | ---- | ---------------------- |
-| castCategory | AVCastCategory | 是 | 播放设备的类别 |
+| castCategory | AVCastCategory | 是 | 投播的类别。 |
| deviceId | string | 是 | 播放设备的ID。 |
| deviceName | string | 是 | 播放设备的名称。 |
| deviceType | DeviceType | 是 | 播放设备的类型。 |
@@ -4955,7 +4955,7 @@ avSession.createController(currentAVSession.sessionId).then((controller) => {
getAVPlaybackState(callback: AsyncCallback\): void
-设备建立连接后,获取投播控制器。结果通过callback异步回调方式返回。
+获取当前的远端播放状态。结果通过callback异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4963,7 +4963,7 @@ getAVPlaybackState(callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10))\> | 是 | 回调函数,返回投播控制器实例。 |
+| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10)\> | 是 | 回调函数,返回远端播放状态。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -4990,7 +4990,7 @@ avsessionController.getAVPlaybackState(function (err, state) {
getAVPlaybackState(): Promise\;
-获取当前的远端播放状态。结果通过callback异步回调方式返回。
+获取当前的远端播放状态。结果通过Promise异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4998,7 +4998,7 @@ getAVPlaybackState(): Promise\;
| 类型 | 说明 |
| --------- | ------------------------------------------------------------ |
-| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回投播控制器实例。 |
+| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回远端播放状态。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-base.md b/zh-cn/application-dev/reference/apis/js-apis-base.md
index 5524b1852b829c838b29798a47b0c15974bd7044..7aed8b1614ce6d14af6dc976212b3598097428a8 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-base.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-base.md
@@ -40,7 +40,7 @@ ErrorCallback\ {
通用回调函数,携带错误参数。
-回调返回的信息为[BusinessError](https://gitee.com/openharmony/docs/pulls/20172/files#businesserror)类型的信息。
+回调返回的信息为[BusinessError](#businesserror)类型的信息。
**系统能力**:SystemCapability.Base
@@ -60,7 +60,7 @@ AsyncCallback\ {
通用回调函数,携带错误参数和异步返回值。
-错误参数为[BusinessError](https://gitee.com/openharmony/docs/pulls/20172/files#businesserror)类型的信息。
+错误参数为[BusinessError](#businesserror)类型的信息。
异步返回值的类型由开发者自定义,回调将返回对应类型的信息。
@@ -68,7 +68,7 @@ AsyncCallback\ {
| 名称 | 类型 | 必填 | 说明 |
| ---- | ------------------------------------------------------------ | ---- | ---------------------------- |
-| err | [BusinessError](https://gitee.com/openharmony/docs/pulls/20172/files#businesserror) | 是 | 接口调用失败的公共错误信息。 |
+| err | [BusinessError](#businesserror) | 是 | 接口调用失败的公共错误信息。 |
| data | T | 是 | 接口调用时的公共回调信息。 |
## BusinessError
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth-baseProfile.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth-baseProfile.md
index 7c8c593a3f36b33d18921666fb3f811fdd03a04c..3035de8a699c537f713d47ef716980a172f82867 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth-baseProfile.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth-baseProfile.md
@@ -358,7 +358,7 @@ try {
off(type: 'connectionStateChange', callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
-取消订阅a2dp连接状态变化事件。
+取消订阅连接状态变化事件。
**需要权限**:ohos.permission.ACCESS_BLUETOOTH
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth-ble.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth-ble.md
index d8e3fee736112202464cc18c2b4007f603c6a76d..a9875e133df4292bd4d7108ebc632e75f1151744 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth-ble.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth-ble.md
@@ -1,6 +1,6 @@
# @ohos.bluetooth.ble (蓝牙ble模块)
-ble模块提供了访问蓝牙个人区域网相关功能的方法。
+ble模块提供了对蓝牙操作和管理的方法。
> **说明:**
>
@@ -19,7 +19,7 @@ import ble from '@ohos.bluetooth.ble';
createGattServer(): GattServer
-创建Gatt profile实例。
+创建GattServer实例。
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
@@ -27,7 +27,7 @@ createGattServer(): GattServer
| 类型 | 说明 |
| ----------------------------- | ---------- |
-| GattServer | 返回一个JavaScript Gatt服务的实例。 |
+| GattServer | 返回一个Gatt服务的实例。 |
**示例:**
@@ -2210,7 +2210,7 @@ try {
off(type: 'BLEMtuChange', callback?: Callback<number>): void
-订阅Mtu状态变化事件。
+取消订阅Mtu状态变化事件。
**需要权限**:ohos.permission.ACCESS_BLUETOOTH
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth-pan.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth-pan.md
index 4147424f19186f84e1d3f6610c80ed7a721a63d7..6d9586058b46a8a0238c912130e78ef3be9a25e3 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth-pan.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth-pan.md
@@ -1,4 +1,4 @@
-# @ohos.bluetooth.pan (蓝牙socket模块)
+# @ohos.bluetooth.pan (蓝牙pan模块)
pan模块提供了访问蓝牙个人区域网相关功能的方法。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md
index bfe37ba4628f2cc6a74d066251539ebc71781e8a..083fa52fcdb9e85fd007497856702e1bc1f157c6 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md
@@ -4,7 +4,7 @@
> **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
-> 从API Version 9开始,该接口不再维护,推荐使用新接口[bluetoothManager](js-apis-bluetoothManager.md)。
+> 从API Version 9 开始,该接口不再维护,推荐使用[`@ohos.bluetooth.ble`](js-apis-bluetooth-ble.md)等相关profile接口。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md
index a594e5145f5d5cbdd8913e8ed58c30fd1f4b2d07..caa21c0ebe5057b4d301cf6cbf60e1db202f3129 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md
@@ -5,6 +5,7 @@
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> 从API Version 10 开始,该接口不再维护,推荐使用[`@ohos.bluetooth.ble`](js-apis-bluetooth-ble.md)等相关profile接口。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
index 672f5d26a695a14975c4350b1be5a616e8d87ed5..96c49aecb7488c3f6157fa8fdb44544d0acfa6ef 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
@@ -99,7 +99,7 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。
| 名称 | 值 | 说明 |
|:----------------:|:---:|-----|
| FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md):卡片扩展能力,提供卡片开发能力。 |
-| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md):延时任务扩展能力,允许应用在系统闲时执行实时性不高的任务。 |
+| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler.md):延时任务扩展能力,允许应用在系统闲时执行实时性不高的任务。 |
| INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md):输入法扩展能力,用于开发输入法应用。 |
| SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md):后台服务扩展能力,提供后台运行并对外提供相应能力。 |
| ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md):无障碍服务扩展能力,支持访问与操作前台界面。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-curve.md b/zh-cn/application-dev/reference/apis/js-apis-curve.md
index 9172b5325d79a8137dbda13292f3d81b3e2c0c7b..8b4bc5f92e324a09621a44792bb51901577fc3a5 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-curve.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-curve.md
@@ -78,7 +78,7 @@ stepsCurve(count: number, end: boolean): ICurve
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ----| ------------------------------------------------------------ |
-| count | number | 是 | 阶梯的数量,需要为正整数。
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按值为0处理。 |
+| count | number | 是 | 阶梯的数量,需要为正整数。
取值范围:[1, +∞)
**说明:**
设置小于1的值时,按值为1处理。 |
| end | boolean | 是 | 在每个间隔的起点或是终点发生阶跃变化。
-true:在终点发生阶跃变化。
-false:在起点发生阶跃变化。 |
**返回值:**
@@ -174,7 +174,7 @@ springMotion(response?: number, dampingFraction?: number, overlapDuration?: numb
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ----- |
| response | number | 否 | 弹簧自然振动周期,决定弹簧复位的速度。
默认值:0.55
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.55处理。 |
-| dampingFraction | number | 否 | 阻尼系数。
0表示无阻尼,一直处于震荡状态;
大于0小于1的值为欠阻尼,运动过程中会超出目标值;
等于1为临界阻尼;
大于1为过阻尼,运动过程中逐渐趋于目标值。
默认值:0.825
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.55处理。 |
+| dampingFraction | number | 否 | 阻尼系数。
0表示无阻尼,一直处于震荡状态;
大于0小于1的值为欠阻尼,运动过程中会超出目标值;
等于1为临界阻尼;
大于1为过阻尼,运动过程中逐渐趋于目标值。
默认值:0.825
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.825处理。 |
| overlapDuration | number | 否 | 弹性动画衔接时长。发生动画继承时,如果前后两个弹性动画response不一致,response参数会在overlapDuration时间内平滑过渡。
默认值:0
单位:秒
取值范围:[0, +∞)。
**说明:**
设置小于0的值时,按默认值0处理。
弹性动画曲线为物理曲线,[animation](../arkui-ts/ts-animatorproperty.md)、[animateTo](../arkui-ts/ts-explicit-animation.md)中的duration参数不生效,动画持续时间取决于springMotion动画曲线参数和之前的速度。时间不能归一,故不能通过该曲线的interpolate函数获得插值。 |
@@ -237,10 +237,10 @@ interpolatingSpring(velocity: number, mass: number, stiffness: number, damping:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ----- |
-| velocity | number | 是 | 初始速度。外部因素对弹性动效产生的影响参数,目的是保证对象从之前的运动状态平滑地过渡到弹性动效。该速度是归一化速度,其值等于动画开始时的实际速度除以动画属性改变值。 |
-| mass | number | 是 | 质量。弹性系统的受力对象,会对弹性系统产生惯性影响。质量越大,震荡的幅度越大,恢复到平衡位置的速度越慢。 |
-| stiffness | number | 是 | 刚度。表示物体抵抗施加的力而形变的程度。刚度越大,抵抗变形的能力越强,恢复到平衡位置的速度越快。 |
-| damping | number | 是 | 阻尼。是一个纯数,无真实的物理意义,用于描述系统在受到扰动后震荡及衰减的情形。阻尼越大,弹性运动的震荡次数越少、震荡幅度越小。 |
+| velocity | number | 是 | 初始速度。外部因素对弹性动效产生的影响参数,目的是保证对象从之前的运动状态平滑地过渡到弹性动效。该速度是归一化速度,其值等于动画开始时的实际速度除以动画属性改变值。
取值范围:(-∞, +∞) |
+| mass | number | 是 | 质量。弹性系统的受力对象,会对弹性系统产生惯性影响。质量越大,震荡的幅度越大,恢复到平衡位置的速度越慢。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 |
+| stiffness | number | 是 | 刚度。表示物体抵抗施加的力而形变的程度。刚度越大,抵抗变形的能力越强,恢复到平衡位置的速度越快。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 |
+| damping | number | 是 | 阻尼。是一个纯数,无真实的物理意义,用于描述系统在受到扰动后震荡及衰减的情形。阻尼越大,弹性运动的震荡次数越少、震荡幅度越小。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 |
**返回值:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md
index cf36172ac70f9180f241988cbfd2ef3468d9f056..dedb6a0dcb8d5c590ca43c0e805be64156e851c1 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md
@@ -1392,90 +1392,6 @@ getFileInfoFromRelativePath(relativePath: string, callback: AsyncCallback\10+
-
-getThumbnail(uri: string, size: image.Size) : Promise<image.PixelMap>
-
-通过指定uri和尺寸获取媒体文件的Pixelmap对象,使用Promise异步回调。
-
-**系统能力**:SystemCapability.FileManagement.UserFileService
-
-**需要权限**:ohos.permission.FILE_ACCESS_MANAGER
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------ | ----------------------------------- | ---- | ----------- |
-| uri | string | 是 | 媒体文件uri |
-| size | [image.Size](js-apis-image.md#size) | 是 | 缩略图尺寸 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| :---------------------------- | :----------------- |
-| Promise<[image.PixelMap](js-apis-image.md#pixelmap7)> | 返回的Pixelmap对象 |
-
-**示例:**
-
-```js
-// 以媒体库uri为例
-// 示例代码targetUri表示Download目录下某个媒体文件(图片、音频、视频),该uri是对应的fileInfo中uri
-// 开发者应根据自己实际获取的uri进行开发
-let targetUri = "file://media/image/100";
-let size = { width: 128, height: 128 };
-try {
- // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取
- let pixelMap = await fileAccessHelper.getThumbnail(targetUri, size);
- let imageInfo = await pixelMap.getImageInfo();
- console.log("getThumbnail sucess, pixelMap.width: " + imageInfo.size.width);
- console.log("getThumbnail sucess, pixelMap.height: " + imageInfo.size.height);
-} catch (error) {
- console.error("getThumbnail failed, errCode:" + error.code + ", errMessage:" + error.message);
-};
-```
-
-### getThumbnail