By means of sharing, users can quickly access atomic services and use their features.
## How to Develop
## How to Develop
In the sharing scenario, there are two parties involved: a target application that shares data and an application that obtains the shared data. The two can be physically the same. The target application uses the **onShare()** lifecycle callback to set the data to share. After the target application is started, you can run the **hdc shell aa dump -a** command to check the started services and processes and find its mission ID. After the current application is started, call the **abilityManager.acquireShareData()** API with the mission ID passed in to obtain the shared data.
> **NOTE**
>
> The mission ID of the target application can also be obtained by calling [missionManager.getMissionInfos()](../reference/apis/js-apis-app-ability-missionManager.md#getmissioninfos).
1.The target application calls **UIAbility.onShare()** provided by the UIAbility component to set the data to share.**ohos.extra.param.key.contentTitle** indicates the title of the content to share in the sharing box, **ohos.extra.param.key.shareAbstract** provides an abstract description of the content, and **ohos.extra.param.key.shareUrl** indicates the online address of the service. You need to set these three items as objects, with the key set to **title**, **abstract**, and **url**, respectively.
1.An application calls [UIAbility.onShare()](../reference/apis/js-apis-app-ability-uiAbility.md#onshare), a lifecycle callback provided by the UIAbility component, to set the data to share. In this lifecycle callback,**ohos.extra.param.key.contentTitle** indicates the title of the content to share in the sharing box, **ohos.extra.param.key.shareAbstract** provides an abstract description of the content, and **ohos.extra.param.key.shareUrl** indicates the online address of the service. You need to set these three items as objects, with the key set to **title**, **abstract**, and **url**, respectively.
2.The current application calls **abilityManager.acquireShareData()** to obtain the data shared by the target application. **missionId** indicates the target application's mission ID, which can be obtained by running the **hdc shell aa dump -a** command or calling the **missionManager.getMissionInfos()** API after the target application is started. **wantParam** indicates the data shared by the target application through the **UIAbility.onShare()** lifecycle callback.
2.A system dialog box calls [abilityManager.acquireShareData()](../reference/apis/js-apis-app-ability-abilityManager.md#acquiresharedata) to obtain data shared through atomic service sharing. Specifically, the system finds the UIAbility based on the mission ID and calls the **OnShare()** lifecycle of the UIAbility to obtain the shared data.
@@ -18,8 +18,85 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
...
@@ -18,8 +18,85 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
| ohos.vibrator | stopVibration(stopMode: VibratorStopMode, callback: AsyncCallback<void>): void | Stops vibration in the specified mode. This API uses an asynchronous callback to return the result. |
| ohos.vibrator | stopVibration(stopMode: VibratorStopMode, callback: AsyncCallback<void>): void | Stops vibration in the specified mode. This API uses an asynchronous callback to return the result. |
| ohos.vibrator | stopVibration(): Promise<void> | Stops vibration in all modes. This API uses a promise to return the result. |
| ohos.vibrator | stopVibration(): Promise<void> | Stops vibration in all modes. This API uses a promise to return the result. |
| ohos.vibrator | stopVibration(callback: AsyncCallback<void>): void | Stops vibration in all modes. This API uses an asynchronous callback to return the result. |
| ohos.vibrator | stopVibration(callback: AsyncCallback<void>): void | Stops vibration in all modes. This API uses an asynchronous callback to return the result. |
| ohos.vibrator | isSupportEffect(effectId: string): Promise<boolean> | Checks whether the passed effect ID is supported. This API uses a promise to return the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite. |
| ohos.vibrator | isSupportEffect(effectId: string): Promise<boolean> | Checks whether the passed effect ID is supported. This API uses a promise to return the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite.|
| ohos.vibrator | isSupportEffect(effectId: string, callback: AsyncCallback<boolean>): void | Checks whether the passed effect ID is supported. This API uses an asynchronous callback to return the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite. |
| ohos.vibrator | isSupportEffect(effectId: string, callback: AsyncCallback<boolean>): void | Checks whether the passed effect ID is supported. This API uses an asynchronous callback to return the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite.|
## Custom Vibration Format
Custom vibration enables you to design desired vibration effects by customizing a vibration configuration file and orchestrating vibration forms based on the corresponding rules.
The custom vibration configuration file is in JSON format. An example file is as follows:
```json
{
"MetaData":{
"Create":"2023-01-09",
"Description":"a haptic case",
"Version":1.0,
"ChannelNumber":1
},
"Channels":[
{
"Parameters":{
"Index":1
},
"Pattern":[
{
"Event":{
"Type":"transient",
"StartTime":0,
"Parameters":{
"Intensity":100,
"Frequency":31
}
}
},
{
"Event":{
"Type":"continuous",
"StartTime":100,
"Duration":54,
"Parameters":{
"Intensity":38,
"Frequency":30
}
}
}
]
}
]
}
```
This JSON file contains two attributes: **MetaData** and **Channels**.
-**MetaData** contains information about the file header. You can add the following attributes under **MetaData**:
-**Version**: version number of the file format, which is forward compatible. Currently, only version 1.0 is supported. This parameter is mandatory.
-**ChannelNumber**: number of channels for vibration. Currently, only one channel is supported, and the value is fixed at **1**. This parameter is mandatory.
-**Create**: time when the file was created. This parameter is optional.
-**Description**: additional information such as the vibration effect and creation information. This parameter is optional.
-**Channels** provides information about the vibration channel. It is a JSON array that holds information about each channel. It contains two attributes: **Parameters** and **Pattern**.
-**Parameters** provides parameters related to the channel. Under it, **Index** indicates the channel ID. The value is fixed at **1** for a single channel. This parameter is mandatory.
-**Pattern** indicates the vibration sequence. It is a JSON array. Under it, **Event** indicates a vibration event, which can be either of the following types:
-**transient**: short vibration
-**continuous**: long vibration
The table below describes the parameters under **Event**.
| Parameter| Description| Value or Value Range|
| --- | ------------------------ | ---|
| Type | Type of the vibration event. This parameter is mandatory.| **transient** or **continuous**|
| StartTime | Start time of the vibration. This parameter is mandatory.| [0, 1800 000], in ms, without overlapping|
| Duration | Duration of the vibration. This parameter is valid only when **Type** is **continuous**.| (10, 1600), in ms|
| Intensity | Intensity of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration strength.|
| Frequency | Frequency of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration frequency|
The following requirements must be met:
| Item| Description |
| -------- | ------------------------ |
| Number of vibration events| No more than 128|
| Length of the vibration configuration file| Not greater than 64 KB|
## How to Develop
## How to Develop
...
@@ -135,3 +212,63 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
...
@@ -135,3 +212,63 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
console.error('Exception in, error:'+JSON.stringify(error));
console.error('Exception in, error:'+JSON.stringify(error));
@@ -40,159 +40,56 @@ For details about the APIs, see [Image API Reference](../reference/native-apis/i
...
@@ -40,159 +40,56 @@ For details about the APIs, see [Image API Reference](../reference/native-apis/i
Obtain the JS resource object from the **hello.cpp** file and convert it to a native resource object. Then you can call native APIs. The sample code is as follows:
Obtain the JS resource object from the **hello.cpp** file and convert it to a native resource object. Then you can call native APIs. The sample code is as follows:
1. Create a **PixelMap** object based on a pixel array.
1. Obtain the **PixelMap** information and store the information to the **OhosPixelMapInfo** struct.
Acquires the shared data of the target application. This API uses an asynchronous callback to return the result. **missionId** indicates the target application's mission ID, which can be obtained by running the **hdc shell aa dump -a** command or calling the [missionManager.getMissionInfos()](js-apis-app-ability-missionManager.md#getmissioninfos) API after the target application is started. **callback** indicates the data shared by the target application through the [UIAbility.onShare()](js-apis-app-ability-uiAbility.md#onshare) lifecycle callback.
Called by a system dialog box to obtain shared data, which is set by the target UIAbility through **onShare()**. This API uses an asynchronous callback to return the result.
Acquires the shared data of the target application. This API uses a promise to return the result. **missionId** indicates the target application's mission ID, which can be obtained by running the **hdc shell aa dump -a** command or calling the [missionManager.getMissionInfos()](js-apis-app-ability-missionManager.md#getmissioninfos) API after the target application is started. **Promise<{[key: string]: Object}>** indicates the data shared by the target application through the [UIAbility.onShare()](js-apis-app-ability-uiAbility.md#onshare) lifecycle callback.
Called by a system dialog box to obtain shared data, which is set by the target UIAbility through **onShare()**. This API uses a promise to return the result.
The **FormBindingData** module provides APIs for widget data binding. You can use the APIs to create a **FormBindingData** object and obtain related information.
The **FormBindingData** module provides APIs for widget data binding. You can use the APIs to create a **FormBindingData** object and obtain related information.
...
@@ -12,6 +12,19 @@ The **FormBindingData** module provides APIs for widget data binding. You can us
...
@@ -12,6 +12,19 @@ The **FormBindingData** module provides APIs for widget data binding. You can us
| key | string | Yes| Subscriber ID of the widget update by proxy. The value is the same as that of the data publisher.|
| subscriberId | string | No| Subscription condition of the widget update by proxy. The default value is the current widget ID (specified by **formId**).|
## FormBindingData
## FormBindingData
Describes a **FormBindingData** object.
Describes a **FormBindingData** object.
...
@@ -21,7 +34,7 @@ Describes a **FormBindingData** object.
...
@@ -21,7 +34,7 @@ Describes a **FormBindingData** object.
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| data | Object | Yes| Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format.|
| data | Object | Yes| Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format.|
| proxies<sup>10+</sup> | Array<[ProxyData](#proxydata)> | No| Subscription information of the widget update by proxy. The default value is an empty array.|
@@ -611,7 +611,7 @@ Defines the reminder to publish.
...
@@ -611,7 +611,7 @@ Defines the reminder to publish.
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.|
| reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.|
| actionButton<sup>10+</sup> | [ActionButton](#actionbutton) | No| Button displayed for the reminder in the notification panel. For common applications, a maximum of two buttons are supported. For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions.|
| actionButton<sup></sup> | [ActionButton](#actionbutton) | No| Buttons displayed for the reminder in the notification panel.<br>- For common applications, a maximum of two buttons are supported.<br>- For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions.|
| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the reminder is clicked.|
| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the reminder is clicked.|
| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed.|
| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed.|
| ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.|
| ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.|
A device enters standby mode if it is unused for a long period of time or after the Power button is pressed. The standby mode prolongs the battery life without affecting the use of applications. The **deviceStandby** module provides APIs for you to check whether a device is in standby mode and request or cancel standby resource control for an application.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Obtains the list of applications that can still use resources of the specified types when the device is in standby mode. This API uses an asynchronous callback to return the result.
Obtains the list of applications that can still use resources of the specified type when the device is in standby mode. This API uses a promise to return the result.
Sends an event to the screen lock service. This API uses an asynchronous callback to return the result.
Sends an event to the screen lock service. This API can be called only by screen lock applications. It uses an asynchronous callback to return the result.
| type | string | Yes | The value **file** means vibration according to a vibration configuration file.|
| hapticFd | [HapticFileDescriptor](#hapticfiledescriptor10) | Yes| File descriptor (FD) of the vibration configuration file.|
## HapticFileDescriptor<sup>10+</sup>
Describes the FD of a custom vibration configuration file. Ensure that the file is available, and the parameters in it can be obtained from the sandbox path through the [file management API](js-apis-file-fs.md#fsopen) or from the HAP resource through the [resource management API](js-apis-resource-manager.md#getrawfd9). The use case is as follows: The system triggers vibration according to the sequence set in a configuration file, based on the specified offset and length. For details about the storage format of the vibration sequence, see [Custom Vibration Format](../../device/vibrator-guidelines.md#custom-vibration-format).
| fd | number | Yes | FD of the custom vibration configuration file. |
| offset | number | No | Offset from the start position of the file, in bytes. The default value is the start position of the file, and the value cannot exceed the valid range of the file.|
| length | number | No | Resource length, in bytes. The default value is the length from the offset position to the end of the file, and the value cannot exceed the valid range of the file.|
## VibrateAttribute<sup>9+</sup>
## VibrateAttribute<sup>9+</sup>
...
@@ -492,10 +516,10 @@ Describes the vibration attribute.
...
@@ -492,10 +516,10 @@ Describes the vibration attribute.
@@ -26,7 +26,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
...
@@ -26,7 +26,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| ----------- | ---------- | ------------------ |
| ----------- | ---------- | ------------------ |
| vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.<br>**true**: A vertical divider is used.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.<br>**true**: A vertical divider is used.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.<br>Default value: **'\#33182431'**<br>Since API version 9, this API is supported in ArkTS widgets.|
| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.<br>Default value: **'\#33182431'**<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeWidth | number \| string | Width of the divider.<br>Default value: **1**<br>Unit: vp<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute cannot be set to a percentage. The priority of this attribute is lower than that of the universal attribute [height](ts-universal-attributes-size.md). If the value of this attribute is greater than that of the universal attribute, cropping is performed based on the universal attribute settings.|
| strokeWidth | number \| string | Width of the divider.<br>Default value: **1px**<br>Unit: vp<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute cannot be set to a percentage. The priority of this attribute is lower than that of the universal attribute [height](ts-universal-attributes-size.md). If the value of this attribute is greater than that of the universal attribute, cropping is performed based on the universal attribute settings.|
| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.<br>Default value: **LineCapStyle.Butt**<br>Since API version 9, this API is supported in ArkTS widgets.|
| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.<br>Default value: **LineCapStyle.Butt**<br>Since API version 9, this API is supported in ArkTS widgets.|
@@ -46,9 +46,11 @@ Adhere to the following constraints and rules when using transient tasks:
...
@@ -46,9 +46,11 @@ Adhere to the following constraints and rules when using transient tasks:
-**Quota mechanism**: To prevent abuse of the keepalive, each application has a certain quota every day (dynamically adjusted based on user habits). The default quota for a single day is 10 minutes, and the maximum quota for each request is 3 minutes. After using up the quota, an application cannot request transient tasks. Therefore, applications should cancel their request immediately after the transient tasks are complete, to avoid quota consumption. (Note: The quota refers to the requested duration and does not include the time when the application runs in the background.)
-**Quota mechanism**: To prevent abuse of the keepalive, each application has a certain quota every day (dynamically adjusted based on user habits). The default quota for a single day is 10 minutes, and the maximum quota for each request is 3 minutes. After using up the quota, an application cannot request transient tasks. Therefore, applications should cancel their request immediately after the transient tasks are complete, to avoid quota consumption. (Note: The quota refers to the requested duration and does not include the time when the application runs in the background.)
## Continuous Tasks
## Continuous Tasks
Continuous tasks provide background running lifecycle support for services that can be directly perceived by users and need to run in the background. For example, if a service needs to play audio or continue with navigation and positioning in the background, which can be perceived by users, it can execute a continuous task in the respective background mode.
Continuous tasks provide background running lifecycle support for services that can be directly perceived by users and need to run in the background. For example, if a service needs to play audio or continue with navigation and positioning in the background, which can be perceived by users, it can execute a continuous task in the respective background mode.
### Background Mode Classification
### Background Mode Classification
OpenHarmony provides 9 background modes for services that require continuous task execution.
OpenHarmony provides 9 background modes for services that require continuous task execution.
**Table 1** Background modes for continuous tasks
**Table 1** Background modes for continuous tasks
...
@@ -66,6 +68,7 @@ OpenHarmony provides 9 background modes for services that require continuous tas
...
@@ -66,6 +68,7 @@ OpenHarmony provides 9 background modes for services that require continuous tas
| taskKeeping | Computing task | A computing task is running | Effective only for specific devices |
| taskKeeping | Computing task | A computing task is running | Effective only for specific devices |
### Restrictions on Using Continuous Tasks
### Restrictions on Using Continuous Tasks
- If a user triggers a perceivable task, such as broadcasting and navigation, the corresponding background mode is triggered. When the task is started, the system forcibly displays a notification to the user.
- If a user triggers a perceivable task, such as broadcasting and navigation, the corresponding background mode is triggered. When the task is started, the system forcibly displays a notification to the user.
- If the task is complete, the application should exit the background mode. If the system detects that an application is not using the resources in the corresponding background mode when the application is running in the background, the application is suspended.
- If the task is complete, the application should exit the background mode. If the system detects that an application is not using the resources in the corresponding background mode when the application is running in the background, the application is suspended.
- Ensure that the requested continuous task background mode matches the application type. If the background mode does not match the application type, the system will suspend the task once it detects the issue.
- Ensure that the requested continuous task background mode matches the application type. If the background mode does not match the application type, the system will suspend the task once it detects the issue.
...
@@ -73,6 +76,7 @@ OpenHarmony provides 9 background modes for services that require continuous tas
...
@@ -73,6 +76,7 @@ OpenHarmony provides 9 background modes for services that require continuous tas
- An ability can request only one continuous task at a time. If an application has multiple abilities, you can request a continuous task for each ability.
- An ability can request only one continuous task at a time. If an application has multiple abilities, you can request a continuous task for each ability.
## Work Scheduler Tasks
## Work Scheduler Tasks
The Work Scheduler provides a mechanism for an application to execute a non-real-time task, for example, data learning, when the system is idle. The system places the Work Scheduler tasks requested by applications in a queue and determines the optimal scheduling time of each task based on the storage space, power consumption, temperature, and more. Persistence is supported. This means that a requested Work Scheduler task can be triggered when the application exits or the device restarts.
The Work Scheduler provides a mechanism for an application to execute a non-real-time task, for example, data learning, when the system is idle. The system places the Work Scheduler tasks requested by applications in a queue and determines the optimal scheduling time of each task based on the storage space, power consumption, temperature, and more. Persistence is supported. This means that a requested Work Scheduler task can be triggered when the application exits or the device restarts.
### Restrictions on Using Work Scheduler Tasks
### Restrictions on Using Work Scheduler Tasks
...
@@ -103,6 +107,7 @@ The use of the Work Scheduler must comply with the following restrictions and ru
...
@@ -103,6 +107,7 @@ The use of the Work Scheduler must comply with the following restrictions and ru
- The carried parameters can be of the number, string, or boolean type.
- The carried parameters can be of the number, string, or boolean type.
## Efficiency Resources
## Efficiency Resources
Efficiency resources are classified into software (WORK_SCHEDULER, COMMON_EVENT, and TIMER) and hardware resources (CPU, GPS, BLUETOOTH, and AUDIO).
Efficiency resources are classified into software (WORK_SCHEDULER, COMMON_EVENT, and TIMER) and hardware resources (CPU, GPS, BLUETOOTH, and AUDIO).
An application can perform different operations based on the requested efficiency resources.
An application can perform different operations based on the requested efficiency resources.
...
@@ -126,6 +131,7 @@ An application can perform different operations based on the requested efficienc
...
@@ -126,6 +131,7 @@ An application can perform different operations based on the requested efficienc
| AUDIO | 64 | AUDIO resources, which prevent audio resources from being proxied when the application is suspended. |
| AUDIO | 64 | AUDIO resources, which prevent audio resources from being proxied when the application is suspended. |
### Restrictions on Using Efficiency Resources
### Restrictions on Using Efficiency Resources
- Applications or processes are responsible for requesting and releasing efficiency resources. A process can release the resources requested by itself, whereas an application can release the resources requested by both itself and its processes. For example, an application requests CPU resources, and its process requests CPU and WORK_SCHEDULER resources. If the application initiates CPU resource release, the CPU resources requested by the process are also released. However, the WORK_SCHEDULER resources are not released. If the process initiates CPU resource release, the CPU resources requested by the application are retained until being released by the application.
- Applications or processes are responsible for requesting and releasing efficiency resources. A process can release the resources requested by itself, whereas an application can release the resources requested by both itself and its processes. For example, an application requests CPU resources, and its process requests CPU and WORK_SCHEDULER resources. If the application initiates CPU resource release, the CPU resources requested by the process are also released. However, the WORK_SCHEDULER resources are not released. If the process initiates CPU resource release, the CPU resources requested by the application are retained until being released by the application.
- If persistent resources and non-persistent resources of the same type are requested, the persistent resources overwrite the non-persistent resources and they will not be released upon a timeout. For example, if an application first requests 10-second CPU resources and then requests persistent CPU resources at the 5th second, the CPU resources become persistent and will not be released at the tenth second. If the application releases the CPU resources at the 8th second, both types of CPU resources are released.
- If persistent resources and non-persistent resources of the same type are requested, the persistent resources overwrite the non-persistent resources and they will not be released upon a timeout. For example, if an application first requests 10-second CPU resources and then requests persistent CPU resources at the 5th second, the CPU resources become persistent and will not be released at the tenth second. If the application releases the CPU resources at the 8th second, both types of CPU resources are released.
- The WORK_SCHEDULER resources can be requested and released by applications, but not by processes.
- The WORK_SCHEDULER resources can be requested and released by applications, but not by processes.
The packing tool packs compiled files for installation and release. The packing tool supports the generation of application packages (HAP), application sets (APP) to launch to the application market, quick fix packages (HQF), quick fix packages (APPQF) to launch to the application market, static shared libraries (HAR), and dynamic shared libraries (HSP). The unpacking tool is used to unpack the HAP, APP, HQF, APPQF, HAR, and HSP files and parse the HAP, HSP, APP, and APPQF files. Generally, the packing process is automatically carried out in DevEco Studio. However, you can also use the JAR package of the packing tool to pack files. The JAR package is stored in the **toolchains** directory in the SDK path.
The packing tool packs compiled files for installation and release. The packing tool supports the generation of HAP (an application package), APP (application set to launch to the application market), HQF (quick fix package), APPQF (quick fix package to launch to the application market ), HAR (static shared library), and HSP (dynamic shared library) files. The unpacking tool is used to unpack the HAP, APP, HQF, APPQF, HAR, and HSP files and parse the HAP, HSP, APP, and APPQF files. Generally, the packing process is automatically carried out in DevEco Studio. However, you can also use the JAR package of the packing tool to pack files. The JAR package is stored in the **toolchains** directory in the SDK path.
## Packing Commands
## Packing Commands
...
@@ -15,7 +15,7 @@ You can use the JAR package of the packing tool to generate an HAP file by impor
...
@@ -15,7 +15,7 @@ You can use the JAR package of the packing tool to generate an HAP file by impor
| --hap-path | Yes | NA | Path of the HAP file. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored.|
| --hap-path | Yes | NA | Path of the HAP file. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored.|
| --hsp-path | No | NA | Path of the HSP file. The file name extension must be .hsp. If there are multiple HSP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HSP file is stored.|
| --hsp-path | No | NA | Path of the HSP file. The file name extension must be .hsp. If there are multiple HSP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HSP file is stored.|
| --pack-info-path | Yes | NA | Path of the **pack.info** file. The file name must be **pack.info**. |
| --pack-info-path | Yes | NA | Path of the **pack.info** file. The file name must be **pack.info**. |
| --out-path | No | NA | Path of the target file. The file name extension must be .app. |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .app. |
| --signature-path | No | NA | Path of the signature file. |
| --signature-path | No | NA | Path of the signature file. |
| --certificate-path | No | NA | Path of the certificate file. |
| --certificate-path | No | NA | Path of the certificate file. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
#### HAP Validity Check During APP Packing
#### HAP Validity Check During APP Packing
When packing the HAP files in a project to generate an APP file, ensure that the values of **bundleName**, **versionCode**, **versionName**, **minCompatibleVersionCode**, **minAPIVersion**, **targetAPIVersion**, and **apiReleaseType** configured in each JSON file of the HAP are the same, and the value of **moduleName** is unique in all the JSON files. For the FA model, you must also ensure that the value of **package** is unique in all the JSON files.
When packing the HAP files in a project to generate an APP file, ensure that the values of **bundleName**, **versionCode**, **versionName**, **minCompatibleVersionCode**, **debug**, **minAPIVersion**, **targetAPIVersion**, and **apiReleaseType** configured in each JSON file of the HAP are the same, and the value of **moduleName** is unique in all the JSON files. For the FA model, you must also ensure that the value of **package** is unique in all the JSON files.
### Multi-project Packing
### Multi-project Packing
...
@@ -105,7 +105,7 @@ If multiple teams develop the same application but it is inconvenient to share c
...
@@ -105,7 +105,7 @@ If multiple teams develop the same application but it is inconvenient to share c
| --hap-list | No | Path of the HAP files | Path of the HAP files. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored. |
| --hap-list | No | Path of the HAP files | Path of the HAP files. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored. |
| --hsp-list | No | Path of the HSP files | Path of the HSP files. The file name extension must be .hsp. If there are multiple HSP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HSP file is stored. |
| --hsp-list | No | Path of the HSP files | Path of the HSP files. The file name extension must be .hsp. If there are multiple HSP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HSP file is stored. |
| --app-list | No | Path of the APP files | Path of the APP files. The file name extension must be .app. If there are multiple APP files, separate them with commas (,).<br>The value can also be the directory (folder) where the APP file is stored.<br>You must specify **--hap-list**, **--hsp-list**, or **--app-list**, or any of their combinations.|
| --app-list | No | Path of the APP files | Path of the APP files. The file name extension must be .app. If there are multiple APP files, separate them with commas (,).<br>The value can also be the directory (folder) where the APP file is stored.<br>You must specify **--hap-list**, **--hsp-list**, or **--app-list**, or any of their combinations.|
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hqf.|
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
#### HAP Validity Check During Multi-project Packing
#### HAP Validity Check During Multi-project Packing
Ensure that the values of **bundleName**, **versionCode**, **versionName**, **minCompatibleVersionCode**, **minAPIVersion**, **targetAPIVersion**, and **apiReleaseType** configured in each JSON file of the HAP are the same, the value of **moduleName** is unique in all the JSON files, and the value of **entry** is unique for the same device. For the FA model, you must also ensure that the value of **package** is unique in all the JSON files.
Ensure that the values of **bundleName**, **versionCode**, **versionName**, **minCompatibleVersionCode**, **debug**, **minAPIVersion**, **targetAPIVersion**, **apiReleaseType**, **compileSdkVersion**, and **compileSdkType** configured in each JSON file of the HAP are the same, the value of **moduleName** is unique in all the JSON files, and the value of **entry** is unique for the same device. For the FA model, you must also ensure that the value of **package** is unique in all the JSON files.
### Packing Commands for HQF Files
### Packing Commands for HQF Files
...
@@ -129,7 +130,7 @@ If you find detects in the application and want to rectify the defects quickly,
...
@@ -129,7 +130,7 @@ If you find detects in the application and want to rectify the defects quickly,
| --json-path | Yes | NA | Path of the JSON file. The file name must be **patch.json**. |
| --json-path | Yes | NA | Path of the JSON file. The file name must be **patch.json**. |
| --lib-path | No | NA | Path of the library file. |
| --lib-path | No | NA | Path of the library file. |
| --ets-path | No | NA | Path of the ETS file. |
| --ets-path | Yes | NA | Path of the ETS file. |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hqf. |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hqf. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing.|
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing.|
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hsp. |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hsp. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
## Unpacking Commands
### Unpacking Commands for HAP Files
You can use the JAR package of the unpacking tool to unpack an HAP file by importing unpacking options and file paths.
| --rpcid | No | true or false| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking. |
### Unpacking Commands for HAR Files
You can use the JAR package of the unpacking tool to unpack an HAR file by importing unpacking options and file paths.
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Unpacking Commands for APP Files
You can use the JAR package of the unpacking tool to unpack an APP file by importing unpacking options and file paths.
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Obtaining the rpcid File from the HAP File
You can use the JAR package of the unpacking tool to unpack an HAP file to obtain the rpcid file by importing unpacking options and file paths.
| --rpcid | No | true or false| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --hap-path | Yes | NA | Path of the HAP file. |
| --out-path | Yes | NA | Path of the target rpcid file. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking. |
### Unpacking Commands for HSP Files
You can use the JAR package of the unpacking tool to unpack an HSP file by importing unpacking options and file paths.
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Unpacking Commands for APPQF Files
You can use the JAR package of the unpacking tool to unpack an APPQF file by importing unpacking options and file paths.
| --appqf-path | Yes | NA | Path of the APPQF file. |
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
## Package Parsing APIs
The package parsing APIs are used to parse an HAP file and obtain information such as the configuration file.
| UncompressEntrance | UncomperssResult parseApp(String appPath,String parseMode,String deviceType,String hapName) | Java| Function: Parses **pack.info** in the APP file.<br>Input parameters: **appPath**, which specifies the path of the APP file.<br>Return value: **UncomperssResult**.|
| UncompressEntrance | UncomperssResult parseApp(InputStream input,String parseMode,String deviceType,String hapName,String outPath) | Java| Function: Parses **pack.info** in the APP file.<br>Input parameters: **input**, which specifies the stream of the APP file.<br>Return value: **UncomperssResult**.|
| UncompressEntrance | UncomperssResult parseHap(String hapPath) | Java| Function: Parses the JSON file in the APP file.<br>Input parameters: **hapPath**, which specifies the path of the HAP file.<br>Return value: **UncomperssResult**. |
| UncompressEntrance | UncomperssResult parseHap(InputStream input) | Java| Function: Parses the JSON file in the APP file.<br>Input parameters: **input**, which specifies the stream of the HAP file.<br>Return value: **UncomperssResult**. |
| hapName | String | Name of the HAP file that is being parsed. | NA |
| appInfo | AppInfo struct (see **AppInfo Struct** below)| Struct of the application information. For details, see **AppInfo Struct** below. | NA |
| deviceConfig | Map\<String,DeviceConfig> | Device information. | The storage type is Map\<String,String>, which indicates the device type name and device type value, respectively. In the stage model, this field is stored in the **app** struct.|
| hapInfo | HapInfo struct (see **HapInfo Struct** below)| Module information in the HAP file. For details, see **HapInfo Struct** below.| NA |
| bundleName | String | Bundle name of the application. | NA |
| bundleType | String | Bundle type.<br>- **app**: The bundle is used for a common application.<br>- **atomicService**: The bundle is used for an atomic service.<br>- **shared**: The bundle is used for a shared library.| NA |
| vendor | String | Vendor of the application. | NA |
| releatedBundleName | String | Related bundle name of the application. | NA |
| versionName | String | Version name of the application. | NA |
| versionCode | String | Version code of the application. | NA |
| targetApiVersion | int | Target API version required for running the application. | NA |
| compatibleApiVersion | int | API version compatible with the application. | NA |
| appName | String | Label of the ability displayed on the home screen. | NA |
| releaseType | String | Release type of the target API version required for running the application. | NA |
| shellVersionCode | String | API version in HarmonyOS. | NA |
| shellVersionName | String | API version name in HarmonyOS. | NA |
| multiFrameworkBundle | String | Bundle name of the application in the dual-framework scenario. | NA |
| debug | boolean | Whether the application can be debugged. | NA |
| icon | String | Path of the application icon. | NA |
| label | String | Label of the application. | NA |
| description | String | Description of the application. | This field is newly added to the stage model.|
| minCompatibleVersionCode | int | Earliest compatible version of the application. | NA |
| distributedNotificationEnabled | boolean | Whether the distributed notification feature is enabled for the application. | This field is newly added to the stage model.|
| jointUserid | String | Shared user ID. | This field is unique to the FA model. |
| process | String | Process name of the application. | This field is unique to the FA model. |
| directLaunch | String | Whether the application can be started when the screen is locked. | NA |
| distributedNotificationEnabled | boolean | Whether the distributed notification feature is enabled for the application. | This field is unique to the stage model.|
| packageStr | String | Package information about the application. | This field is unique to the FA model. |
| name | String | Name of the module. | NA |
| description | String | Description of the HAP file. | This field is unique to the FA model. |
| supporteModes | List\<String> | Mode supported by the HAP file. | NA |
| abilities | Array of AbilityInfo | Ability information of the HAP file. | NA |
| distro | Distro Struct | Distro description of the HAP file. | NA |
| deviceType | List\<String> | Type of devices on which the HAP can run. | This field corresponds to **deviceTypes** in the stage model. |
| metadata | metaData struct (see **metaData Struct** below) | Custom metadata of the HAP. | NA |
| isJs | boolean | Whether the application is a JS application. | This field is unique to the FA model. |
| reqPermissions | ReqPermission struct array (see **ReqPermission** below) | Permissions requested by the application. | This field corresponds to **requestPermissions** in the stage model. |
| commonEvents | CommonEvent struct (see **CommonEvent Struct** below) | Static event. | NA |
| shortcuts | Shortcut struct array (see **Shortcut** below) | Shortcuts information of the application. | NA |
| distrofilter | DistroFilter struct | Information distributed by the application market by device form. | NA |
| srcEntrance | String | Entry code path of the application. | This field is newly added to the stage model. |
| process | String | Process name of the HAP. | This field is newly added to the stage model. |
| mainElement | String | Entry ability name or ExtensionAbility name of the HAP file.| This field is newly added to the stage model. In the FA model , the value of **mainAbility** is automatically assigned to **mainElement**.|
| unSyntax | String | Syntax type of a JS component. | This field is newly added to the stage model. |
| pages | List\<String> | Information about each page in a JS component. | This field is newly added to the stage model. |
| extensionAbilities | List\<ExtensionAbilityInfo> | ExtensionAbility information. | This field is newly added to the stage model. |
| abilityFormInfos | List\<AbilityFormInfo> | Widget information. | NA |
| moduleAtomicService| ModuleAtomicService struct (see **ModuleAtomicService Struct** below)| Atomic service information of the HAP. | NA |
| moduleName | String | Name of the module. | This field corresponds to the **moduleName** field under the **module** struct in the stage model. |
| moduleType | String | Type of the module. | This field corresponds to the **moduleType** field under the **module** struct in the stage model. |
| deliveryWithInstall | boolean | Whether the HAP is installed when the user installs the application. | This field corresponds to the **deliveryWithInstall** field under the **module** struct in the stage model. |
| installationFree | int | Whether the HAP supports the installation-free feature. | This parameter corresponds to the **installationFree** field under the **module** struct in the stage model. In the JSON file, if this parameter is set to **true**, **1** is returned; if this parameter is set to **false**, **0** is returned; if this parameter is not set, **2** is returned.|
| virtualMachine | String | Type of the target virtual machine (VM) where the HAP is running. It is used for cloud distribution, such as the application market and distribution center.| This field corresponds to the **virtualMachine** field under the **module** struct in the stage model. |
| name | String | Name of the **ReqPermission** struct. | NA |
| reason | String | Reason for requesting the permission. This field is mandatory for a user_grant permission. | NA |
| usedScene | UsedScene struct (see **UsedScene Struct** below)| Application scenario of the permission. The value can be **ability** or **when**. Multiple abilities can be configured.| NA |
| ability | List\<String> | Abilities that use the permission. The value is an array. | NA |
| when | String | Time when the permission is used. The value can be **inuse** (the permission can be used only in the foreground) or **always** (the permission can be used in foreground and background).| NA |
| shortcutId | String | ID of the **ShortCut** struct. | NA |
| label | String | Label of the **ShortCut** struct. | NA |
| icon | String | Icon of the **ShortCut** struct. | NA |
| intents | List of IntentInfo structs| Intents to which the shortcut points. The attribute consists of the **targetClass** and **targetBundle** sub-attributes.| NA |
| name | String | Logical name of the ExtensionAbility. | This field is supported only in the stage model. |
| srcEntrance | String | JS code path of the ExtensionAbility. | This field is supported only in the stage model. |
| icon | String | Icon ID of the ExtensionAbility. | This field is supported only in the stage model. |
| label | String | ExtensionAbility name visible to users. | This field is supported only in the stage model. |
| description | String | Description of the ExtensionAbility. | This field is supported only in the stage model. |
| type | String | Type of the ExtensionAbility, which can be **form**, **workScheduler**, **inputMethod**, **service**, **accessibility**, **dataShare**, **fileShare**, **wallpaper**, or **backup**.| This field is supported only in the stage model. Currently, only **form** and **staticSubscriber** information is parsed. The information of other types is not parsed.|
| permissions | List\<String> | Permissions required when the ExtensionAbility is called by the ability of another application. | This field is supported only in the stage model. |
| readPermission | String | Permission required for reading data in the ExtensionAbility. | This field is supported only in the stage model. |
| writePermission | String | Permission required for writing data to the ExtensionAbility. | This field is supported only in the stage model. |
| visible | boolean | Whether the ExtensionAbility can be called by other applications. | This field is supported only in the stage model. |
| skills | SkillInfo array | Skills of the Want that the extensionAbility can receive. | This field is supported only in the stage model. |
| metadata | CustomizeData information| Metadata of the ExtensionAbility. | The information in **metadata** is assigned to **CustomizeData**. |
| uri | String | URI of the data provided by the ExtensionAbility. | This field is supported only in the stage model. |
| description | String | Description of the widget. | This field is newly added to the stage model.|
| type | String | Type of the widget. | NA |
| src | String | JS code of the widget. | NA |
| isDefault | boolean | Whether the widget is a default one. Each HAP has only one default widget. | NA |
| colorMode | String | Color mode of the widget, which can be **auto**, **dark**, or **light**. | NA |
| updateEnabled | boolean | Whether the widget supports scheduled refresh. | NA |
| scheduledUpdateTime | String | Scheduled time to update the widget. The value is in 24-hour format and accurate to the minute. | NA |
| updateDuration | int | Interval to update the widget. The unit is 30 minutes. The value is a multiple of 30. | NA |
| supportDimensions | List\<String> | Dimensions supported by the widget, which can be **1 * 2**, **2 * 2**, **2 * 4**, or **4 * 4**. | NA |
| defaultDimension | String | Default dimensions of the widget. The value must be available in the **supportDimensions** array of the widget.| NA |
| formConfigAbility | String | Ability name for widget adjustment. | NA |
| formVisibleNotify | String | Whether the widget is allowed to use the visibility notification. | NA |
| MetaData | MetaData | Custom data of the widget. | NA |
| providerAbility | String | Ability or ExtensionAbility name of the widget.<br>1. FA model: If the widget is configured in an ability of the Service type, set **providerAbility** to **mainAbility**.<br>2. FA model: If the widget is configured in an ability of the Page type, set **providerAbility** to the current ability.<br>3. FA model: If **mainAbility** is not configured, set **providerAbility** to the ability that preferentially uses **system.home** in the current HAP. Otherwise, set **providerAbility** to the ability of the first page.<br>4. Stage model: Set **providerAbility** to **mainElement**.| NA |
| name | String | Name of the class corresponding to the current static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| permission | String | Permissions required to implement the static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| data | List\<String> | Additional data array to be carried in the static common event.| In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| type | List\<String> | Type array for configuring the static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| events | List\<String> | Events of the Want that the ExtensionAbility can receive. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
### DependencyItem Struct
| Field | Type | Description | Remarks|
|--------------| ------ |--------------| ---- |
| bundleName | String | Bundle name of the shared package.| NA |
| moduleName | String | Module name of the shared package.| NA |
| versionCode | String | Version number of the shared bundle. | NA |
The unpacking tool is a commissioning tool provided by OpenHarmony. It can split a HAP file into folders or split an App Pack into HAP files in command line mode.
The unpacking tool is a commissioning tool used to unpack HAP (an application package), HAR (static shared library), HSP (dynamic shared library), and APP (application set to launch to the application market) files. It also provides Java APIs to parse the HAP, APP, and HSP files.
The **app_unpacking_tool.jar** package can be found in the OpenHarmony SDK downloaded locally.
The **app_unpacking_tool.jar** package can be found in the OpenHarmony SDK downloaded locally.
You can use the JAR package of the unpacking tool to unpack an HAP file by importing unpacking options and file paths.
| Name| Mandatory| Description|
#### Example
| -------- | -------- | -------- |
| --mode | Yes| Unpacking mode. In this scenario, set this parameter to **hap**.|
| --hap-path | Yes| Path of the HAP file.|
| --rpcid | No| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --out-path | Yes| Path of the target file.|
| --force | No| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
| --rpcid | No | true or false| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking. |
| Name| Mandatory| Description|
### Unpacking Commands for HAR Files
| -------- | -------- | -------- |
| --mode | Yes| Unpacking mode. In this scenario, set this parameter to **hap**.|
| --app-path | Yes| Path of the App Pack.|
| --out-path | Yes| Path of the target file.|
| --force | No| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
- Extracting the rpcid File from a HAP file
You can use the JAR package of the unpacking tool to unpack an HAR file by importing unpacking options and file paths.
| --mode | Yes| Unpacking mode. In this scenario, set this parameter to **hap**.|
| Name | Mandatory| Option | Description |
| --rpcid | No| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Unpacking Commands for APP Files
You can use the JAR package of the unpacking tool to unpack an APP file by importing unpacking options and file paths.
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Obtaining the rpcid File from the HAP File
You can use the JAR package of the unpacking tool to unpack an HAP file to obtain the rpcid file by importing unpacking options and file paths.
| --rpcid | No | true or false| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --hap-path | Yes | NA | Path of the HAP file. |
| --out-path | Yes | NA | Path of the target rpcid file. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking. |
### Unpacking Commands for HSP Files
You can use the JAR package of the unpacking tool to unpack an HSP file by importing unpacking options and file paths.
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Unpacking Commands for APPQF Files
You can use the JAR package of the unpacking tool to unpack an APPQF file by importing unpacking options and file paths.
| --appqf-path | Yes | NA | Path of the APPQF file. |
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
## Package Parsing APIs
The package parsing APIs are used to parse an HAP, APP, or HSP file and obtain information such as the configuration file.
| UncompressEntrance | UncomperssResult parseApp(String appPath,String parseMode,String deviceType,String hapName) | Java| Function: Parses **pack.info** in the APP file.<br>Input parameters: **appPath**, which specifies the path of the APP file.<br>Return value: **UncomperssResult**.|
| UncompressEntrance | UncomperssResult parseApp(InputStream input,String parseMode,String deviceType,String hapName,String outPath) | Java| Function: Parses **pack.info** in the APP file.<br>Input parameters: **input**, which specifies the stream of the APP file.<br>Return value: **UncomperssResult**.|
| UncompressEntrance | UncomperssResult parseHap(String hapPath) | Java| Function: Parses the JSON file in the APP file.<br>Input parameters: **hapPath**, which specifies the path of the HAP file.<br>Return value: **UncomperssResult**. |
| UncompressEntrance | UncomperssResult parseHap(InputStream input) | Java| Function: Parses the JSON file in the APP file.<br>Input parameters: **input**, which specifies the stream of the HAP file.<br>Return value: **UncomperssResult**. |
| hapName | String | Name of the HAP file that is being parsed. | NA |
| appInfo | AppInfo struct (see **AppInfo Struct** below)| Struct of the application information. For details, see **AppInfo Struct** below. | NA |
| deviceConfig | Map\<String,DeviceConfig> | Device information. | The storage type is Map\<String,String>, which indicates the device type name and device type value, respectively. In the stage model, this field is stored in the **app** struct.|
| hapInfo | HapInfo struct (see **HapInfo Struct** below)| Module information in the HAP file. For details, see **HapInfo Struct** below.| NA |
| bundleName | String | Bundle name of the application. | NA |
| vendor | String | Vendor of the application. | NA |
| relatedBundleName | String | Related bundle name of the application. | NA |
| versionName | String | Version name of the application. | NA |
| versionCode | String | Version code of the application. | NA |
| targetApiVersion | int | Target API version required for running the application. | NA |
| compatibleApiVersion | int | API version compatible with the application. | NA |
| appName | String | Label of the ability displayed on the home screen. | NA |
| appNameEN | String | Label of the ability displayed on the home screen. | NA |
| releaseType | String | Release type of the target API version required for running the application. | NA |
| shellVersionCode | String | API version in HarmonyOS. | NA |
| shellVersionName | String | API version name in HarmonyOS. | NA |
| multiFrameworkBundle | String | Bundle name of the application in the dual-framework scenario. | NA |
| debug | boolean | Whether the application can be debugged. | NA |
| icon | String | Path of the application icon. | NA |
| label | String | Label of the application. | NA |
| description | String | Description of the application. | This field is newly added to the stage model. |
| minCompatibleVersionCode | int | Earliest compatible version of the application. | NA |
| distributedNotificationEnabled | boolean | Whether the distributed notification feature is enabled for the application. | This field is newly added to the stage model. |
| bundleType | String | Bundle type.<br>- **app**: The bundle is used for a common application.<br>- **atomicService**: The bundle is used for an atomic service.<br>- **shared**: The bundle is used for a shared library.| NA |
| compileSdkVersion | String | SDK version used for compiling the application. | This field is valid only for API version 10 and later. |
| compileSdkType | String | SDK type used for compiling the application. | This field is valid only for API version 10 and later. |
| labels | HashMap\<String, String> | Labels of the application in multiple languages.| NA |
| descriptions | HashMap\<String, String> | Descriptions of the application in multiple languages.| NA |
| appModel | AppModel enumerated value | Application framework model.<br>- FA: FA model<br>- STAGE: stage model| NA |
| packageStr | String | Package information about the application. | This field is unique to the FA model. |
| name | String | Name of the module. | NA |
| description | String | Description of the HAP. | This field is unique to the FA model. |
| supportedModes | List\<String> | Modes supported by the HAP. | NA |
| abilities | List\<AbilityInfo> | Ability information of the HAP file. | NA |
| defPermissions | List\<DefPermission> | Default permissions of the HAP. | NA |
| definePermissions | List\<DefinePermission> | Defined permissions of the HAP. | NA |
| defPermissionsGroups | List\<DefPermissionsGroups> | Default permission groups of the HAP. | NA |
| distro | Distro struct | Distro description of the HAP file. | NA |
| reqCapabilities | List\<String> | Required capabilities of the HAP. | NA |
| deviceType | List\<String> | Type of devices on which the HAP can run. | This field corresponds to **deviceTypes** in the stage model. |
| metaData | metaData struct (see **metaData Struct** below) | Custom metadata of the HAP. | NA |
| dependencies | List\<DependencyItem> | Dependencies of the HAP. | NA |
| isJs | boolean | Whether the application is a JS application. | This field is unique to the FA model. |
| reqPermissions | list\<ReqPermission> | Permissions requested by the application. | This field corresponds to **requestPermissions** in the stage model.|
| commonEvents | CommonEvent struct (see **CommonEvent Struct** below) | Static event. | NA |
| shortcuts | list\<Shortcut> | Shortcuts used by the application. | NA |
| distroFilter | DistroFilter struct | Information distributed by the application market by device form. | NA |
| srcEntrance | String | Entry code path of the application. | This field is newly added to the stage model. |
| process | String | Process name of the HAP. | This field is newly added to the stage model. |
| mainElement | String | Entry ability name or ExtensionAbility name of the HAP file.| This field is newly added to the stage model. In the FA model , the value of **mainAbility** is automatically assigned to **mainElement**.|
| uiSyntax | String | Syntax type of a JS component. | This field is newly added to the stage model. |
| pages | List\<String> | Information about each page in a JS component. | This field is newly added to the stage model. |
| extensionAbilityInfos| List\<ExtensionAbilityInfo> | Information about the ExtensionAbility. | This field is newly added to the stage model. |
| moduleAtomicService | ModuleAtomicService struct (see **ModuleAtomicService Struct** below)| Atomic service information of the HAP. | NA |
| formInfos | List\<AbilityFormInfo> | Widget information. | NA |
| descriptions | HashMap\<String, String> | Description of the HAP. | NA |
| moduleName | String | Name of the module. | This field corresponds to the **moduleName** field under the **module** struct in the stage model. |
| moduleType | String | Type of the HAP. | This field corresponds to the **moduleType** field under the **module** struct in the stage model. |
| deliveryWithInstall | boolean | Whether the HAP is installed when the user installs the application.| This field corresponds to the **deliveryWithInstall** field under the **module** struct in the stage model. |
| installationFree | int | Whether the HAP supports the installation-free feature. | This parameter corresponds to the **installationFree** field under the **module** struct in the stage model. In the JSON file, if this parameter is set to **true**, **1** is returned; if this parameter is set to **false**, **0** is returned; if this parameter is not set, **2** is returned.|
| virtualMachine | String | Type of the target virtual machine (VM) where the HAP is running. It is used for cloud distribution, such as the application market and distribution center.| This field corresponds to the **virtualMachine** field under the **module** struct in the stage model.|
| name | String | Name of the requested permission. | NA |
| reason | String | Reason for requesting the permission. This field is mandatory for a user_grant permission.| NA |
| usedScene | UsedScene struct (see **UsedScene Struct** below)| Application scenario of the permission. The value can be **ability** or **when**. Multiple abilities can be configured.| NA |
| reasons | HashMap\<String, String> | Reason for requesting the permission. This field is mandatory for a user_grant permission.| NA |
| ability | List\<String> | Abilities that use the permission. The value is an array. | NA |
| when | String | Time when the permission is used. The value can be **inuse** (the permission can be used only in the foreground) or **always** (the permission can be used in foreground and background).| NA |
| shortcutId | String | ID of the **ShortCut** struct. | NA |
| label | String | Label of the **ShortCut** struct. | NA |
| icon | String | Icon of the **ShortCut** struct. | NA |
| intents | List\<IntentInfo> | Intents to which the shortcut points. The attribute consists of the **targetClass** and **targetBundle** sub-attributes.| NA |
| labels | HashMap\<String, String> | Shortcut names displayed to users in multiple languages. | NA |
| name | String | Logical name of the ExtensionAbility. | This field is supported only in the stage model. |
| srcEntrance | String | JS code path of the ExtensionAbility. | This field is supported only in the stage model. |
| icon | String | Icon ID of the ExtensionAbility. | This field is supported only in the stage model. |
| label | String | ExtensionAbility name visible to users. | This field is supported only in the stage model. |
| description | String | Description of the ExtensionAbility. | This field is supported only in the stage model. |
| type | String | Type of the ExtensionAbility, which can be **form**, **workScheduler**, **inputMethod**, **service**, **accessibility**, **dataShare**, **fileShare**, **wallpaper**, or **backup**.| This field is supported only in the stage model. Currently, only **form** and **staticSubscriber** information is parsed. The information of other types is not parsed. |
| permissions | List\<String> | Permissions required when the ExtensionAbility is called by the ability of another application. | This field is supported only in the stage model. |
| readPermission | String | Permission required for reading data in the ExtensionAbility. | This field is supported only in the stage model. |
| writePermission | String | Permission required for writing data to the ExtensionAbility. | This field is supported only in the stage model. |
| visible | boolean | Whether the ExtensionAbility can be called by other applications. | This field is supported only in the stage model. |
| skills | List\<SkillInfo> | Skills of the Want that the extensionAbility can receive. | This field is supported only in the stage model. |
| metadataInfos | List\<ModuleMetadataInfo>| Metadata that the ExtensionAbility can receive. | This field is supported only in the stage model. |
| metadata | MetaData Struct | Metadata of the ExtensionAbility. | The information in **metadata** is assigned to **CustomizeData**.|
| uri | String | URI of the data provided by the ExtensionAbility. | This field is supported only in the stage model. |
| descriptions | HashMap\<String, String> | Descriptions of the ExtensionAbility in multiple languages. | NA |
| labels | HashMap\<String, String> | Names of the ExtensionAbility displayed to users in multiple languages. | NA |
| updateEnabled | boolean | Whether the widget supports scheduled refresh. | NA |
| scheduledUpdateTime | String | Scheduled time to update the widget. The value is in 24-hour format and accurate to the minute. | NA |
| updateDuration | int | Interval to update the widget. The unit is 30 minutes. The value is a multiple of 30. | NA |
| supportDimensions | List\<String> | Dimensions supported by the widget, which can be **1 * 2**, **2 * 2**, **2 * 4**, or **4 * 4**. | NA |
| defaultDimension | String | Default dimensions of the widget. The value must be available in the **supportDimensions** array of the widget.| NA |
| MetaData | MetaData | Custom data of the widget. | NA |
| description | String | Description of the widget. | This field is newly added to the stage model.|
| src | String | JS code of the widget. | NA |
| windowInfo | ModuleWindowInfo struct | Window information of the ability. | NA |
| isDefault | boolean | Whether the widget is a default one. Each HAP has only one default widget. | NA |
| colorMode | String | Color mode of the widget, which can be **auto**, **dark**, or **light**. | NA |
| formConfigAbility | String | Ability name for widget adjustment. | NA |
| formVisibleNotify | String | Whether the widget is allowed to use the visibility notification. | NA |
| providerAbility | String | Ability or ExtensionAbility name of the widget provider.<br>- FA model: If the widget is configured in an ability of the Service type, set **providerAbility** to **mainAbility**.<br/>- FA model: If the widget is configured in an ability of the Page type, set **providerAbility** to the current ability.<br/>- FA model: If **mainAbility** is not configured, set **providerAbility** to the ability that preferentially uses **system.home** in the current HAP. Otherwise, set **providerAbility** to the ability of the first page.<br/>- Stage model: Set **providerAbility** to **mainElement**. | NA |
| descriptions | HashMap\<String, String> | Descriptions of the ability in multiple languages. | NA |
| name | String | Name of the class corresponding to the current static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| permission | String | Permissions required to implement the static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| data | List\<String> | Additional data array to be carried in the static common event.| In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| type | List\<String> | Type array for configuring the static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| events | List\<String> | Events of the Want that the ExtensionAbility can receive. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
### DependencyItem Struct
| Field | Type | Description | Remarks|
|--------------| ------ |--------------| ---- |
| bundleName | String | Bundle name of the shared package.| NA |
| moduleName | String | Module name of the shared package.| NA |
| versionCode | String | Version number of the shared bundle. | NA |
> *1. This template provides the recommended development guide document framework and writing instructions for typical knowledge points. In your writing, complete the development task scenario analysis and development guide outline design based on the specific **solution/feature/function/module**, and then write the content based on this template.*
> _1. This template provides the recommended development guide document framework and writing instructions for typical knowledge points. In your writing, complete the development task scenario analysis and development guide outline design based on the specific **solution/feature/function/module**, and then write the content based on this template._
>
>
> *2. Do not add any content between level-1 title (marked with #) and level-2 title (marked with ##).*
> _2. Do not add any content between level-1 title (marked with #) and level-2 title (marked with ##)._
>
>
> *3. Delete all the writing instructions in italics from your formal documents.*
> _3. Delete all the writing instructions in italics from your formal documents._
## *Example* Overview
**_[General Instructions for Writing the Development Guide]_**
_**1. Target audience**: internal and external developers (including product managers). Guidelines for UX designers are usually carried by UX design specifications and are not covered in the development guide. If UX design specifications need to be mentioned in the development guide, use hyperlinks._
*Mandatory. Based on the scenario division of the solution/feature/function/module, you need to provide either "Example Overview" or "Example Task Scenario Overview", or both of them.*
_**2. Content positioning**: Introduce what the solution/feature/function/module is, why it is required, and how to design, develop, and release related applications/devices. The development guide aims to help developers learn necessary knowledge and achieve specified task objectives in actual development activities._
*1. "Example Overview" provides an overview that is common to all task scenarios of this solution/feature/function/module and that developers need to understand. If there is nothing in common, delete it.*
_**3. User-oriented**: Always provide developer-concerned, perceptible, and useful content from the perspective of developers._
*2. "Example Task Scenario Overview" describes the contents directly related to a task scenario. The knowledge points and key writing points are the same as those in "Example Overview". In this section, you need to introduce this specific task scenario and describe basic concepts, working principles, constraints, and samples that are directly related to the task scenario. If there is no specific task scenario, delete it.*
_**4. Task-oriented**: Focus on actual tasks of developers, and provide complete, correct guidance that is easy to follow._
***[General Instructions for Writing the Development Guide]***
_**5. Reference purposes**: This template only provides the basic document framework. You can adjust the content based on the actual requirements._
***1. Target audience**: internal and external developers (including product managers). Guidelines for UX designers are usually carried by UX design specifications and are not covered in the development guide. If UX design specifications need to be mentioned in the development guide, use hyperlinks.*
***2. Content positioning**: Introduce what the solution/feature/function/module is, why it is required, and how to design, develop, and release related applications/devices. The development guide aims to help developers learn necessary knowledge and achieve specified task objectives in actual development activities.*
## *Example* Overview
***3. User-oriented****: Always provide developer-concerned, perceptible, and useful content from the perspective of developers.*
_Mandatory. Based on the scenario division of the solution/feature/function/module, you need to provide either "Example Overview" or "Example Task Scenario Overview", or both of them._
***4. Task-oriented****: Focus on actual tasks of developers, and provide complete, correct guidance that is easy to follow.*
_1. "Example Overview" provides an overview that is common to all task scenarios of this solution/feature/function/module and that developers need to understand. If there is nothing in common, delete it._
*5. This template only provides the basic document framework. You can adjust the content based on the actual requirements.*
_2. "Example Task Scenario Overview" describes the contents directly related to a task scenario. The knowledge points and key writing points are the same as those in "Example Overview". In this section, you need to introduce this specific task scenario and describe basic concepts, working principles, constraints, and samples that are directly related to the task scenario. If there is no specific task scenario, delete it._
### Introduction
### Introduction
*Mandatory.*
_Mandatory._
***[Developers' Concerns]***
_**[Developers' Concerns]**_
*What is the solution/feature/function/module (definition)? What problems can it solve or what benefits can it bring (purpose/customer benefits - why)? *
_What is the solution/feature/function/module (definition)? What problems can it solve or what benefits can it bring (purpose/customer benefits - why)?_
***[Key Writing Points]***
_**[Key Writing Points]**_
-*Provide easy-to-understand and scenario-specific descriptions. Refer to the SCQA method below to introduce the scenarios and characteristics of the solution/feature/function/module.*
-_Provide easy-to-understand and scenario-specific descriptions. Refer to the SCQA method below to introduce the scenarios and characteristics of the solution/feature/function/module._
-*S: situation. Introduce a familiar scenario.*
-_S: situation. Introduce a familiar scenario._
-*C: complication. Describe the conflict between the situation and requirement.*
-_C: complication. Describe the conflict between the situation and requirement._
-*Q: question. Ask a question. What can I do in such a case?*
-_Q: question. Ask a question. What can I do in such a case?_
-*A: answer. Describe the solution.*
-_A: answer. Describe the solution.
-*Visualize abstract concepts. You can provide content from the perspective of consumers for better understanding, for example, scenario effect in UX.*
-_Visualize abstract concepts. You can provide content from the perspective of consumers for better understanding, for example, scenario effect in UX._
***[Writing Requirements]***
_**[Writing Requirements]**_
-*Provide clear content. Avoid vague, obscure, and ambiguous expressions.*
-_Provide clear content. Avoid vague, obscure, and ambiguous expressions._
-*Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary.*
-_Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary._
-*Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document.*
-_Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document._
### Basic Concepts
### Basic Concepts
*Optional. Describe the basic concepts that are common to all task scenarios.*
_Optional. Describe the basic concepts that are common to all task scenarios._
***[Developers' Concerns]***
_**[Developers' Concerns]**_
*What are the unique concepts that I need to know when using the solution/feature/function/module?*
_What are the unique concepts that I need to know when using the solution/feature/function/module?_
***[Key Writing Points]***
_**[Key Writing Points]**_
-*Provide only the concepts that are mandatory in development tasks.*
-_Provide only the concepts that are mandatory in development tasks._
-*Describe here concepts used in multiple chapters such as the operation mechanism, restrictions, and development process. If a concept is used only in a chapter, describe the concept in that chapter only.*
-_Describe here concepts used in multiple chapters such as the operation mechanism, restrictions, and development process. If a concept is used only in a chapter, describe the concept in that chapter only._
-*Do not describe common concepts in the industry. Use common terms in the industry instead of jargon.*
-_Do not describe common concepts in the industry. Use common terms in the industry instead of jargon._
-*If there are logical relationships between concepts, you are advised to use figures to describe the relationships.*
-_If there are logical relationships between concepts, you are advised to use figures to describe the relationships._
***[Writing Requirements]***
_**[Writing Requirements]**_
-*Provide clear content. Avoid vague, obscure, and ambiguous expressions.*
-_Provide clear content. Avoid vague, obscure, and ambiguous expressions._
-*Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary.*
-_Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary._
-*Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document.*
-_Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document._
***[Example]***
***[Example]***
...
@@ -90,7 +91,7 @@ Before developing relational databases, you must understand the following basic
...
@@ -90,7 +91,7 @@ Before developing relational databases, you must understand the following basic
-**RDB**
-**RDB**
A type of database based on the relational model of data. The RDB stores data in rows and columns. An RDB is also called RDB store.
A type of database based on the relational model of data. The RDB stores data in rows and columns. An RDB is also called RDB store.
-**Predicate**
-**Predicate**
...
@@ -103,29 +104,29 @@ A type of database based on the relational model of data. The RDB stores data in
...
@@ -103,29 +104,29 @@ A type of database based on the relational model of data. The RDB stores data in
### Working Principles
### Working Principles
*Optional. Describe the working principles that are common to all task scenarios.*
_Optional. Describe the working principles that are common to all task scenarios._
***[Developers' Concerns]***
_**[Developers' Concerns]**_
*How does the solution/feature/function/module work? What are the API calling and triggering time of key steps? I want to understand its principles for better use and debugging.*
_How does the solution/feature/function/module work? What are the API calling and triggering time of key steps? I want to understand its principles for better use and debugging._
***[Key Writing Points]***
_**[Key Writing Points]**_
-*If the principle is simple and can be understood from the content under "Basic Concepts", do not provide this section.*
-_If the principle is simple and can be understood from the content under "Basic Concepts", do not provide this section._
-*Describe only the mechanisms and principles that are visible in the development tasks (use or access). Do not provide internal implementation that is invisible to developers.*
-_Describe only the mechanisms and principles that are visible in the development tasks (use or access). Do not provide internal implementation that is invisible to developers._
-*If necessary, use sequence diagrams and flowcharts. Ensure that the text description matches the figure description.*
-_If necessary, use sequence diagrams and flowcharts. Ensure that the text description matches the figure description._
-*Be careful not to disclose internal information.*
-_Be careful not to disclose internal information._
***[Writing Requirements]***
_**[Writing Requirements]**_
-*Provide clear content. Avoid vague, obscure, and ambiguous expressions.*
-_Provide clear content. Avoid vague, obscure, and ambiguous expressions._
-*Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary.*
-_Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary._
-*Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document.*
-_Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document._
***[Example]***
***[Example]***
...
@@ -138,23 +139,23 @@ The distributed data objects are encapsulated into JS objects in distributed in-
...
@@ -138,23 +139,23 @@ The distributed data objects are encapsulated into JS objects in distributed in-
### Constraints
### Constraints
*Optional. Describe constraints that are common to all task scenarios.*
_Optional. Describe constraints that are common to all task scenarios._
***[Developers' Concerns]***
_**[Developers' Concerns]**_
*What are the constraints for using the solution/feature/function/module? How well is the solution/feature/function/module implemented? Can it meet my requirements?*
_What are the constraints for using the solution/feature/function/module? How well is the solution/feature/function/module implemented? Can it meet my requirements?_
***[Key Writing Points]***
_**[Key Writing Points]**_
-*Describe perceptible constraints that affect development activities, including but not limited to the following:*
-_Describe perceptible constraints that affect development activities, including but not limited to the following:_
-***Function constraints***
-_Function constraints_
-*Application scope of the solution/feature/function/module (Specify scenarios that are not supported.)*
-_Application scope of the solution/feature/function/module (Specify scenarios that are not supported.)_
-*Specification constraints*
-_Specification constraints_
-***Operation constraints***
-_**Operation constraints**_
-*Operations on known issues*
-_Operations on known issues_
-*Potentially risky operations (such as performance deterioration)*
-_Potentially risky operations (such as performance deterioration)_
-*Describe operations that are prone to errors in the procedure, but not in this section.*
-_Describe operations that are prone to errors in the procedure, but not in this section._
***[Example]***
***[Example]***
...
@@ -167,45 +168,45 @@ The distributed data objects are encapsulated into JS objects in distributed in-
...
@@ -167,45 +168,45 @@ The distributed data objects are encapsulated into JS objects in distributed in-
### Samples
### Samples
*Optional. Provide samples that are common to all task scenarios.*
_Optional. Provide samples that are common to all task scenarios._
***[Developers' Concerns]***
_**[Developers' Concerns]**_
*What sample code, codelabs, and demo projects are available?*
_What sample code, codelabs, and demo projects are available?_
***[Key Writing Points]***
_**[Key Writing Points]**_
*Provide links (generally Gitee links) to the released sample code, codelabs, and demo projects. Do not include project packages into the document as an attachment.*
_Provide links (generally Gitee links) to the released sample code, codelabs, and demo projects. Do not include project packages into the document as an attachment._
***[Example]***
***[Example]***
The following sample is provided to help you better understand how to develop abilities:
The following sample is provided to help you better understand how to develop abilities:
-[Intra- and Inter-page Navigation](https://gitee.com/openharmony/codelabs/tree/master/Ability/StageAbility)
-[Intra-UIAbility and Inter-UIAbility Page Redirection (ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/Ability/StageAbility)
## Setting Up the Environment
## Setting Up the Environment
*Optional.*
_Optional._
*Based on the analysis and breakdown of a specific task scenario, you can place the environment setup content under "Prerequisites" or "Preparations" and close to the "How to Develop" of the specific scenario.*
_Based on the analysis and breakdown of a specific task scenario, you can place the environment setup content under "Prerequisites" or "Preparations" and close to the "How to Develop" of the specific scenario._
*Specify how to prepare the development environment, including software and hardware configuration requirements, tool requirements, and device requirements.*
_Specify how to prepare the development environment, including software and hardware configuration requirements, tool requirements, and device requirements._
*Delete this section if no special requirements are involved.*
_Delete this section if no special requirements are involved._
### Environment Requirements
### Environment Requirements
***[Writing Requirements]***
_**[Writing Requirements]**_
*Describe the software and hardware configurations required by the development environment so that developers can prepare the environment in advance. You can use subtitles if there is a large amount of content.*
_Describe the software and hardware configurations required by the development environment so that developers can prepare the environment in advance. You can use subtitles if there is a large amount of content._
***[Example]***
***[Example]***
The following table describes the environment configuration requirements specific to the Hi3861 development board.
The following table describes the environment configuration requirements specific to the Hi3861 development board.
**Table 1** Hi3861 development environment-specific requirements
**Table 1** Hi3861 development environment-specific requirements
| Platform Type| Development Tool| Function| How to Obtain|
| Platform Type| Development Tool| Function| How to Obtain|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -215,9 +216,9 @@ The following table describes the environment configuration requirements specifi
...
@@ -215,9 +216,9 @@ The following table describes the environment configuration requirements specifi
### Setting Up the Environment
### Setting Up the Environment
***[Writing Requirements]***
_**[Writing Requirements]**_
*Describe the procedure for setting up the development environment. If there is a large amount of content, use subtitles, for example, "Setting Up the Basic Build Environment" and "Setting Up the Compilation Tool Environment".*
_Describe the procedure for setting up the development environment. If there is a large amount of content, use subtitles, for example, "Setting Up the Basic Build Environment" and "Setting Up the Compilation Tool Environment"._
***[Example]***
***[Example]***
...
@@ -238,53 +239,53 @@ The following table describes the environment configuration requirements specifi
...
@@ -238,53 +239,53 @@ The following table describes the environment configuration requirements specifi
### Verifying the Environment
### Verifying the Environment
***[Writing Requirements]***
_**[Writing Requirements]**_
*Optional. Provide the criteria for checking whether the environment is set up successfully. You can also provide the criteria along with the environment setup procedure, as provided in the preceding example.*
_Optional. Provide the criteria for checking whether the environment is set up successfully. You can also provide the criteria along with the environment setup procedure, as provided in the preceding example._
## *Example Task Scenario* Development (Use a specific scenario name. If there is only one scenario, use the solution/feature/function/module name.)
## *Example Task Scenario* Development (Use a specific scenario name. If there is only one scenario, use the solution/feature/function/module name.)
*Mandatory.*
_Mandatory._
***[Developers' Concerns]***
_**[Developers' Concerns]**_
*How do I use or access the solution/feature/function/module?*
_How do I use or access the solution/feature/function/module?_
***[Key Writing Points]***
_**[Key Writing Points]**_
*Provide scenarios that are close to actual development scenarios.*
_Provide scenarios that are close to actual development scenarios._
-*Task scenarios are what developers need to use to achieve development objectives.*
-_Task scenarios are what developers need to use to achieve development objectives._
-*There can be one or more task scenarios. You can use multiple "Development Guidelines" sections. Follow the hierarchical logic when writing the guidelines, that is, a task scenario -> a subtask scenario -> task logic ("Development Process") -> operation procedure ("How to Develop").*
-_There can be one or more task scenarios. You can use multiple "Development Guidelines" sections. Follow the hierarchical logic when writing the guidelines, that is, a task scenario -> a subtask scenario -> task logic ("Development Process") -> operation procedure ("How to Develop")._
### *Example Task Scenario* Overview
### *Example Task Scenario* Overview
*Based on the scenario division of the solution/feature/function/module, you can provide either "Example Task Scenario Overview" or "Example Overview", or both of them.*
_Based on the scenario division of the solution/feature/function/module, you can provide either "Example Task Scenario Overview" or "Example Overview", or both of them._
*1. "Example Overview" provides an overview that is common to all task scenarios of this solution/feature/function/module and that developers need to understand. If there is nothing in common, delete it.*
_1. "Example Overview" provides an overview that is common to all task scenarios of this solution/feature/function/module and that developers need to understand. If there is nothing in common, delete it._
*2. "Example Task Scenario Overview" describes the contents directly related to a task scenario. The knowledge points and key writing points are the same as those in "Example Overview". In this section, you need to introduce this specific task scenario and describe basic concepts, working principles, constraints, and samples that are directly related to the task scenario. If there is no specific task scenario, delete it.*
_2. "Example Task Scenario Overview" describes the contents directly related to a task scenario. The knowledge points and key writing points are the same as those in "Example Overview". In this section, you need to introduce this specific task scenario and describe basic concepts, working principles, constraints, and samples that are directly related to the task scenario. If there is no specific task scenario, delete it._
### Development Process
### Development Process
***[Key Writing Points]***
_**[Key Writing Points]**_
-*Optional. If there are many development steps (five or more core operations) or complex logical relationships between steps, provide the development process so that developers can have a panoramic view of the operations to be performed.*
-_Optional. If there are many development steps (five or more core operations) or complex logical relationships between steps, provide the development process so that developers can have a panoramic view of the operations to be performed._
-*Provide flowcharts and tables if necessary.*
-_Provide flowcharts and tables if necessary._
### Available APIs
### Available APIs
***[Writing Requirements]***
_**[Writing Requirements]**_
-*Optional. Describe the key APIs in the development steps and provide the API introduction, so that developers can have a general understanding of development.*
-_Optional. Describe the key APIs in the development steps and provide the API introduction, so that developers can have a general understanding of development._
-*If there are more than 10 APIs, provide the main APIs only.*
-_If there are more than 10 APIs, provide the main APIs only._
-*Ensure that the APIs and their functions of the corresponding version are supported when the document is released.*
-_Ensure that the APIs and their functions of the corresponding version are supported when the document is released._
***[Example]***
***[Example]***
...
@@ -300,19 +301,19 @@ Certain APIs can be called only by system applications that have been granted th
...
@@ -300,19 +301,19 @@ Certain APIs can be called only by system applications that have been granted th
### How to Develop
### How to Develop
***[Writing Requirements]***
_**[Writing Requirements]**_
*Mandatory.*
_Mandatory._
-*Completeness and Correctness*
-_Completeness and Correctness_
-*Describe the complete development process (for example, steps related to the code, resources, third-party libraries, and application configuration files in the HAP) so that developers can correctly complete the development. Do not omit key configuration operations.*
-_Describe the complete development process (for example, steps related to the code, resources, third-party libraries, and application configuration files in the HAP) so that developers can correctly complete the development. Do not omit key configuration operations._
-*Ensure that the code snippet provided in the document can be built with the context in DevEco Studio.*
-_Ensure that the code snippet provided in the document can be built with the context in DevEco Studio._
-*Ensure that the complete sample code provided in the document can be run in DevEco Studio, and the execution result is the same as that described in the document.*
-_Ensure that the complete sample code provided in the document can be run in DevEco Studio, and the execution result is the same as that described in the document._
-*Clarity*
-_Clarity_
-*Provide a clear execution owner (who), operation purpose (why), operation content (what/how), and scenario (when/where) for each step. Use imperative sentence to describe steps.*
-_Provide a clear execution owner (who), operation purpose (why), operation content (what/how), and scenario (when/where) for each step. Use imperative sentence to describe steps._
-*Clearly provide the APIs (if involved) in steps, as well as their usage description and sample code.*
-_Clearly provide the APIs (if involved) in steps, as well as their usage description and sample code._
-*Provide development suggestions or precautions for key steps and sample code (comments for sample code).*
-_Provide development suggestions or precautions for key steps and sample code (comments for sample code)._
*Think about what questions may be raised when developers are performing the operations.**These problems are obstacles to developers.**Provide support information in the document to help them handle these obstacles.**Examples of support information:*
*Think about what questions may be raised when developers are performing the operations.**These problems are obstacles to developers.**Provide support information in the document to help them handle these obstacles.**Examples of support information:*
-*Branch selection principle. Provide principles or suggestions for selecting branches and parameters.*
-*Branch selection principle. Provide principles or suggestions for selecting branches and parameters.*
...
@@ -322,9 +323,9 @@ Certain APIs can be called only by system applications that have been granted th
...
@@ -322,9 +323,9 @@ Certain APIs can be called only by system applications that have been granted th
-*Error prevention/correction information. Provide guidance for preventing, locating, or rectifying typical problems that may occur in the development process.**This type of information can be provided in "How to Develop" or "FAQs", depending on the content amount.*
-*Error prevention/correction information. Provide guidance for preventing, locating, or rectifying typical problems that may occur in the development process.**This type of information can be provided in "How to Develop" or "FAQs", depending on the content amount.*
-*Standardization*
-_Standardization_
-*Provide both logically and syntactically correct sample code and write it in a standard manner. Anonymize sensitive information, such as mobile numbers, ID cards, and account names, for example, 186\*\*\*\*\*\*\*\*. Use private IP addresses or a corresponding format, for example, xx.xx.xx.xx and www.example.com, rather than real IP addresses and domain names.*
-_Provide both logically and syntactically correct sample code and write it in a standard manner. Anonymize sensitive information, such as mobile numbers, ID cards, and account names, for example, 186\*\*\*\*\*\*\*\*. Use private IP addresses or a corresponding format, for example, xx.xx.xx.xx and www.example.com, rather than real IP addresses and domain names._
-*Provide code that complies with the code indentation requirements. Do not use the **Tab** key to indent code. Instead, use four spaces, to avoid incorrect display.*
-_Provide code that complies with the code indentation requirements. Do not use the Tab key to indent code. Instead, use four spaces, to avoid incorrect display._
**[Example (Excerpt)]**
**[Example (Excerpt)]**
...
@@ -360,28 +361,28 @@ Certain APIs can be called only by system applications that have been granted th
...
@@ -360,28 +361,28 @@ Certain APIs can be called only by system applications that have been granted th
### Verification
### Verification
***[Writing Requirements]***
_**[Writing Requirements]**_
-*Optional. After the development is complete, provide a guide to check whether the operation is successful if there is an independent commissioning and verification operation. The operation procedure is the same as that described in "How to Develop."*
-_Optional. After the development is complete, provide a guide to check whether the operation is successful if there is an independent commissioning and verification operation. The operation procedure is the same as that described in "How to Develop."_
-*Provide only the final service commissioning. You are advised to verify the operation result of each subtask after the development is complete.*
-_Provide only the final service commissioning. You are advised to verify the operation result of each subtask after the development is complete._
## FAQs
## FAQs
*Optional.*
_Optional._
***[Developers' Concerns]***
_**[Developers' Concerns]**_
*What are the typical problems that may occur in the development process of the solution/feature/function/module? How do I locate and solve these problems?*
_What are the typical problems that may occur in the development process of the solution/feature/function/module? How do I locate and solve these problems?_
***[Key Writing Points]***
_**[Key Writing Points]**_
*Describe the problems that may occur during the development and the solutions to them.*
_Describe the problems that may occur during the development and the solutions to them._
-*Delete this section if there are no common problems.*
-_Delete this section if there are no common problems._
-*It is recommended that common problems in each task scenario be described in a separate chapter. Common problems related to a single task scenario be described in the corresponding chapter.*
-_It is recommended that common problems in each task scenario be described in a separate chapter. Common problems related to a single task scenario be described in the corresponding chapter._
## cl.vibrator.1 Added Attributes Related to Custom Vibration
The attributes **VibrateFromFile** (custom vibration effect) and **HapticFileDescriptor** (file descriptor of the custom vibration configuration file) are added. The vibration effect supported by **startVibration** is extended from **VibrateEffect = VibrateTime | VibratePreset** to **VibrateEffect = VibrateTime | VibratePreset | VibrateFromFile**.
**Change Impact**
When developing applications based on OpenHarmony4.0.8.2 and later SDK versions, you can use the **VibrateFromFile** attribute to enable devices that support custom vibration to trigger vibration according to the vibration sequence configured in the custom vibration configuration file.
**Key API/Component Changes**
Added the **VibrateFromFile** and **HapticFileDescriptor** attributes to **@ohos.vibrator.d.ts**.