提交 9dd4b300 编写于 作者: J junyi233 提交者: Gitee

修改扫描缺陷

...@@ -2,11 +2,7 @@ ...@@ -2,11 +2,7 @@
The ability assistant enables you to start applications, atomic services, and test cases and debug applications. By using this tool, you can send commands in the hdc shell to perform various system operations, such as starting abilities, forcibly stopping processes, and printing ability information. The ability assistant enables you to start applications, atomic services, and test cases and debug applications. By using this tool, you can send commands in the hdc shell to perform various system operations, such as starting abilities, forcibly stopping processes, and printing ability information.
## Development Guidelines ## Query-related Commands
The ability assistant is pre-installed in the device environment. You can directly invoke the tool using commands.
### Query-related Commands
- **help** - **help**
...@@ -22,7 +18,7 @@ The ability assistant is pre-installed in the device environment. You can direct ...@@ -22,7 +18,7 @@ The ability assistant is pre-installed in the device environment. You can direct
aa help aa help
``` ```
### Ability-related Commands ## Ability-related Commands
- **start** - **start**
...@@ -69,18 +65,18 @@ The ability assistant is pre-installed in the device environment. You can direct ...@@ -69,18 +65,18 @@ The ability assistant is pre-installed in the device environment. You can direct
- **dump** - **dump**
Prints ability-related information. Prints ability related information.
| Name | Level-2 Parameter | Description | | Name | Level-2 Parameter | Description |
| ----------------- | -------------------- | ------------------------------------------------------------ | | ----------------- | -------------------- | ------------------------------------------------------------ |
| -h/--help | - | Prints help information. | | -h/--help | - | Prints help information. |
| -a/--all | - | Prints ability information in all missions. | | -a/--all | - | Prints ability information in all missions. |
| -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Prints mission stack information.<br>The following values are available for **type**:<br>- NORMAL <br>- DEFAULT_STANDARD<br>- DEFAULT_SINGLE<br>- LAUNCHER | | -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Prints mission stack information.<br>The following values are available for **type**:<br>NORMAL <br>DEFAULT_STANDARD<br>DEFAULT_SINGLE<br>LAUNCHER |
| -e/--extension | elementName | Prints extended component information. | | -e/--extension | elementName | Prints extended component information. |
| -u/--userId | UserId | Prints stack information of a specified user ID. This parameter must be used together with other parameters.<br>Example commands: aa **dump -a -u 100** and **aa dump -d -u 100**| | -u/--userId | UserId | Prints stack information of a specified user ID. This parameter must be used together with other parameters. Example commands: aa **dump -a -u 100** and **aa dump -d -u 100**.|
| -d/--data | | Prints Data ability information. | | -d/--data | | Prints Data ability information. |
| -i/--ability | AbilityRecord ID | Prints detailed information about a specified ability. | | -i/--ability | AbilityRecord ID | Prints detailed information about a specified ability. |
| -c/--client | | Prints detailed ability information. This parameter must be used together with other parameters.<br>Example commands: **aa dump -a -c** and **aa dump -i 21 -c**| | -c/--client | | Prints detailed ability information. This parameter must be used together with other parameters. Example commands: **aa dump -a -c** and **aa dump -i 21 -c**.|
**Method** **Method**
......
# Ability Framework Overview # Ability Framework Overview
An ability is the abstraction of a functionality that an application can provide. It is the minimum unit for the system to schedule applications. An application can contain one or more **Ability** instances. An ability is the abstraction of a functionality that an application can provide. It is the minimum unit for the system to schedule applications. An application can contain one or more `Ability` instances.
The ability framework model has two forms. The ability framework model has two forms.
- FA model, which applies to application development using API 8 and earlier versions. In the FA model, there are Feature Ability (FA) and Particle Ability (PA). The FA supports Page abilities, and the PA supports Service, Data, and Form abilities. - FA model, which applies to application development using API version 8 and earlier versions. In the FA model, there are Feature Ability (FA) and Particle Ability (PA). The FA supports Page abilities, and the PA supports Service, Data, and Form abilities.
- Stage model, which is introduced since API 9. In the stage model, there are Ability and ExtensionAbility. The ExtensionAbility is further extended to ServiceExtensionAbility, FormExtensionAbility, DataShareExtensionAbility, and more. - Stage model, which is introduced since API version 9. In the stage model, there are Ability and ExtensionAbility. The ExtensionAbility is further extended to ServiceExtensionAbility, FormExtensionAbility, DataShareExtensionAbility, and more.
The stage model is designed to make it easier to develop complex applications in the distributed environment. The table below lists the design differences between the two models. The stage model is designed to make it easier to develop complex applications in the distributed environment. The table below lists the design differences between the two models.
| Item | FA Model | Stage Model | | Item | FA Model | Stage Model |
| -------------- | ------------------------------------------------------------ | -------------------------------------------------------- | | -------------- | ------------------------------------------------------------ | -------------------------------------------------------- |
| Development mode | Web-like APIs are provided. The UI development is the same as that of the stage model. | Object-oriented development mode is provided. The UI development is the same as that of the FA model. | | Development mode | Web-like APIs are provided. The UI development is the same as that of the stage model. | Object-oriented development mode is provided. The UI development is the same as that of the FA model. |
| Engine instance | Each ability in a process exclusively uses a JS VM engine instance. | Multiple abilities in a process share one JS VM engine instance. | | Engine instance | Each ability in a process exclusively uses a JS VM engine instance. | Multiple abilities in a process share one JS VM engine instance. |
| Intra-process object sharing| Not supported. | Supported. | | Intra-process object sharing| Not supported | Supported |
| Bundle description file | The **config.json** file is used to describe the HAP and component information. The component must use a fixed file name.| The **module.json** file is used to describe the HAP and component information. The entry file name can be specified.| | Bundle description file | The `config.json` file is used to describe the HAP and component information. Each component must use a fixed file name.| The `module.json` file is used to describe the HAP and component information. The entry file name can be specified.|
| Component | Four types of components are provided: Page ability (used for UI page display), Service ability (used to provide services), Data ability (used for data sharing), and Form ability (used to provide widgets).| Two types of components are provided: Ability (used for UI page display) and Extension (scenario-based service extension). | | Component | Four types of components are provided: Page ability (used for UI page display), Service ability (used to provide services), Data ability (used for data sharing), and Form ability (used to provide widgets).| Two types of components are provided: Ability (used for UI page display) and Extension (scenario-based service extension). |
In addition, the following differences exist in the development process: In addition, the following differences exist in the development process:
...@@ -28,4 +28,7 @@ In addition, the following differences exist in the development process: ...@@ -28,4 +28,7 @@ In addition, the following differences exist in the development process:
![lifecycle](figures/lifecycle.png) ![lifecycle](figures/lifecycle.png)
For details about the two models, see [FA Model Overview](fa-brief.md) and [Stage Model Overview](stage-brief.md). For details about the two models, see [FA Model Overview](fa-brief.md) and [Stage Model Overview](stage-brief.md).
\ No newline at end of file ## Samples
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/PageAbility)
...@@ -3,22 +3,15 @@ ...@@ -3,22 +3,15 @@
## Overall Architecture ## Overall Architecture
The development of an OpenHarmony application is essentially the development of one or more abilities. By scheduling abilities and managing their lifecycle, OpenHarmony implements application scheduling. The development of an OpenHarmony application is essentially the development of one or more abilities. By scheduling abilities and managing their lifecycle, OpenHarmony implements application scheduling.
The Feature Ability (FA) model applies to application development using API 8 and earlier versions. In this model, there are Page, Service, Data, and Form abilities. The Feature Ability (FA) model applies to application development using API version 8 and earlier versions. In this model, there are Page, Service, Data, and Form abilities.
- The Page ability implements the ArkUI and provides the capability of interacting with users. - The Page ability implements the ArkUI and provides the capability of interacting with users.
- The Service ability does not have a UI. It runs in the background and provides custom services for other abilities to invoke. - The Service ability does not have a UI. It runs in the background and provides custom services for other abilities to invoke.
- The Data ability does not have a UI. It also runs in the background and enables other abilities to insert, delete, and query data. - The Data ability does not have a UI. It runs in the background and enables other abilities to insert, delete, and query data.
- The Form ability provides a widget, which is a UI display mode. - The Form ability provides a widget, which is a UI display mode.
## Application Package Structure
**The following figure shows the application package structure.**
![fa-package-info](figures/fa-package-info.png)
For details about the application package structure, see [Description of the Application Package Structure Configuration File](../quick-start/package-structure.md).
## Lifecycle ## Lifecycle
Among all abilities, the Page ability has the most complex lifecycle, because it has a UI and is the interaction entry of applications. Among all abilities, the Page ability has the most complex lifecycle, because it has a UI and acts as a touchpoint for interacting with users.
**The following figure shows the lifecycle of the Page ability.** **The following figure shows the lifecycle of the Page ability.**
![fa-pageAbility-lifecycle](figures/fa-pageAbility-lifecycle.png) ![fa-pageAbility-lifecycle](figures/fa-pageAbility-lifecycle.png)
...@@ -30,6 +23,20 @@ Currently, the **app.js** file provides only the **onCreate** and **onDestroy** ...@@ -30,6 +23,20 @@ Currently, the **app.js** file provides only the **onCreate** and **onDestroy**
## Process and Thread Model ## Process and Thread Model
An application exclusively uses an independent process, and an ability exclusively uses an independent thread. An application process is created when an ability is started for the first time, and a thread is created for this ability too. After the application is started, other abilities in the application are started, and a thread is created for every of these started abilities. Each ability is bound to an independent JSRuntime instance. Therefore, abilities are isolated from each other. An application exclusively uses an independent process, and an ability exclusively uses an independent thread. When an ability is started for the first time, an application process as well as a thread for this ability is created. After the application is started, other abilities in the application are started, and a thread is created for every of these started abilities. Each ability is bound to an independent JSRuntime instance. In this way, abilities are isolated from each other.
![fa-threading-model](figures/fa-threading-model.png) ![fa-threading-model](figures/fa-threading-model.png)
## Samples
The following sample is provided to help you better understand how to develop abilities:
- [`DistributeCalc`: Distributed Calculator (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/Preset/DistributeCalc)
- [`DistributeGraffiti`: Distributed Graffiti (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DistributedGraffiti)
- [Remote FA Startup](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteStartFA)
- [Distributed News App](https://gitee.com/openharmony/codelabs/tree/master/Distributed/NewsDemo)
- [Synced Sketchpad (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts)
- [Distributed Authentication (JS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/GameAuthOpenH)
- [Distributed Game Controller (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication)
- [Distributed Mail System (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS)
- [Distributed Jigsaw Puzzle (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame)
- [Distributed Control (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS)
# Stage Model Overview # Stage Model Overview
### Design Ideas ## Design Ideas
The stage model is designed to make it easier to develop complex applications in the distributed environment. The stage model is designed to make it easier to develop complex applications in the distributed environment.
...@@ -8,7 +8,7 @@ The following figure shows the design ideas of the stage model. ...@@ -8,7 +8,7 @@ The following figure shows the design ideas of the stage model.
![stagedesign](figures/stagedesign.png) ![stagedesign](figures/stagedesign.png)
The stage model is designed based on the following considerations: The stage model is designed based on the following considerations:
- **Balance between application capabilities and overall system power consumption** - **Balance between application capabilities and overall system power consumption**
...@@ -20,10 +20,10 @@ The stage model is designed based on the following considerations: ...@@ -20,10 +20,10 @@ The stage model is designed based on the following considerations:
- **Support for multiple device types and window forms** - **Support for multiple device types and window forms**
To support multiple device types and facilitate the implementation of different window forms, the component manager and window manager must be decoupled at the architecture layer for easier tailoring. To achieve this goal, the stage model redefines the ability lifecycle and implements unidirectional dependency of the component manager and window manager. To support multiple device types and facilitate the implementation of different window forms, the component manager and window manager must be decoupled at the architecture layer for easier tailoring. To achieve this goal, the stage model redefines the ability lifecycle and implements unidirectional dependency for the component manager and window manager.
### Basic Concepts ## Basic Concepts
The following figure shows the basic concepts in the stage model. The following figure shows the basic concepts in the stage model.
...@@ -33,24 +33,24 @@ The following figure shows the basic concepts in the stage model. ...@@ -33,24 +33,24 @@ The following figure shows the basic concepts in the stage model.
- **Bundle**: an OpenHarmony application identified by **appid**. A bundle can contain multiple HAP files. Each application has a **bundleName**. However, **bundleName** must be used together with **appid** and other information to uniquely identify an application. - **Bundle**: an OpenHarmony application identified by **appid**. A bundle can contain multiple HAP files. Each application has a **bundleName**. However, **bundleName** must be used together with **appid** and other information to uniquely identify an application.
- **AbilityStage**: runtime class of an HAP. It is created when the HAP is loaded to the process for the first time and is visible to developers in the runtime. - **AbilityStage**: runtime class of an HAP. It is created when the HAP is loaded to the process for the first time and is visible to developers in the runtime.
- **Application**: runtime class of a bundle, which is invisible to developers in the runtime. - **Application**: runtime class of a bundle, which is invisible to developers in the runtime.
- **Context**: provides various capabilities that can be invoked by developers during the runtime. The **Ability** and **ExtensionAbility** classes have their own context classes, which inherit the base class **Context**. The base class provides information such as the bundle name, module name, and path. - **Context**: base class that the context classes of **Ability** and **ExtensionAbility** classes inherit. This class provides various capabilities that can be invoked by developers in the runtime, and various information such as the bundle name, module name, and path.
- **Ability**: provides lifecycle callback, holds the **AbilityContext** class, and supports component continuation and collaboration. - **Ability**: class that provides lifecycle callbacks, holds the **AbilityContext** class, and supports component continuation and collaboration.
- **ExtensionAbility**: general name of scenario-based service extension abilities. The system defines multiple scenario-based **ExtensionAbility** classes, each of which has its own **ExtensionContext**. - **ExtensionAbility**: general name of scenario-based service extension abilities. The system defines multiple scenario-based **ExtensionAbility** classes, each of which has its own **ExtensionContext**.
- **WindowStage**: local window manager. - **WindowStage**: local window manager.
- **Window**: basic unit managed by the window manager. It has an ArkUI engine instance. - **Window**: basic unit managed by the window manager. It has an ArkUI engine instance.
- **ArkUI Page**: displays declarative ArkUI. - **ArkUI Page**: ArkUI development framework page.
### Lifecycle ## Lifecycle
The ability and ability stage lifecycles are the most important concepts in the basic process of an application. The comparison between the FA model lifecycle and stage model lifecycle is provided in [Ability Framework Overview](ability-brief.md). This section focuses on the ability lifecycle transition and the scheduling relationships between the ability, ability stage, and window stage. The ability and ability stage lifecycles are the rudiments of the basic process of an application. For details about how these lifecycles differ from those in the FA model, see [Ability Framework Overview](ability-brief.md). This section focuses on the ability lifecycle transition and the scheduling relationships between the ability, ability stage, and window stage.
![stageabilitylifecyclecallback](figures/stageabilitylifecyclecallback.png) ![stageabilitylifecyclecallback](figures/stageabilitylifecyclecallback.png)
To implement multi-device-form tailoring and multi-window scalability, OpenHarmony decouples the component manager from the window manager. The ability lifecycle defined in the stage model includes only the creation, destruction, foreground, and background states. The gain focus and lose focus states that are closely related to UI content are defined in the window stage. This implements weak coupling between the abilities and windows. On the service side, the window manager notifies the component manager of the foreground and background changes, so the component manager only senses the foreground and background changes but not the focus changes. To implement device-specific tailoring and multi-window scalability, OpenHarmony decouples the component manager from the window manager. The ability lifecycle defined in the stage model includes only the creation, destruction, foreground, and background states. The gain focus and lose focus states that are closely related to UI content are defined in the window stage. This implements weak coupling between the abilities and windows. On the service side, the window manager notifies the component manager of the foreground and background changes, so the component manager only senses the foreground and background changes but not the focus changes.
### Ability Instances and Missions ## Ability Instances and Missions
Abilities can be started in any of the following modes: Abilities can be started in any of the following modes:
...@@ -62,11 +62,11 @@ Abilities can be started in any of the following modes: ...@@ -62,11 +62,11 @@ Abilities can be started in any of the following modes:
Each ability instance corresponds to a mission in **Launcher Recent**. Each ability instance corresponds to a mission in **Launcher Recent**.
The mission corresponding to each ability instance has a snapshot of the ability instance. After the ability instance is destroyed, the ability class information and snapshot are retained in the mission until the user deletes the information or the storage space exceeds the upper limit. The mission corresponding to an ability instance has a snapshot of the ability instance. After the ability instance is destroyed, the ability class information and snapshot are retained in the mission until the user deletes the information or the storage space reaches the upper limit.
![AbilityComponentInstanceMission](figures/AbilityComponentInstanceMission.png) ![AbilityComponentInstanceMission](figures/AbilityComponentInstanceMission.png)
### ExtensionAbility Mechanism ## ExtensionAbility Mechanism
Different from the ability used for page display, the extension ability provides a restricted service running environment. It has the following features: Different from the ability used for page display, the extension ability provides a restricted service running environment. It has the following features:
...@@ -82,9 +82,9 @@ The following figure uses the widget scenario as an example. You can inherit fro ...@@ -82,9 +82,9 @@ The following figure uses the widget scenario as an example. You can inherit fro
![ExtensionAbility](figures/ExtensionAbility.png) ![ExtensionAbility](figures/ExtensionAbility.png)
### Process Model ## Process Model
All OpenHarmony applications are designed to meet the single-process model. In the single-process model, an application is not allowed to configure multiple processes, and all processes in the application are created and managed by the system. Each application supports a maximum of three types of processes: All OpenHarmony applications are designed to meet the single-process model. In the single-process model, all processes in the application are created and managed by the system. Each application supports a maximum of three types of processes:
- Main process: runs all ability components, pages, and service logic. - Main process: runs all ability components, pages, and service logic.
......
# Audio Overview<a name="EN-US_TOPIC_0000001147055469"></a> # Audio Overview
You can use APIs provided by the audio module to implement audio-related features, including audio playback and volume management. You can use APIs provided by the audio module to implement audio-related features, including audio playback and volume management.
>![](../public_sys-resources/icon-note.gif) **NOTE** ## Basic Concepts
>Due to permission issues, the above features are temporarily unavailable for the standard system.
## Basic Concepts<a name="section296512102281"></a> - **Sampling**
Sampling is a process to obtain discrete-time signals by extracting samples from analog signals in a continuous time domain at a specific interval.
- **Sampling** - **Sampling rate**
Sampling rate is the number of samples extracted from a continuous signal per second to form a discrete signal. It is measured in Hz. Generally, human hearing range is from 20 Hz to 20 kHz. Common audio sampling rates include 8 kHz, 11.025 kHz, 22.05 kHz, 16 kHz, 37.8 kHz, 44.1 kHz, 48 kHz, 96 kHz, and 192 kHz.
Sampling is a process to obtain discrete-time signals by extracting samples from analog signals in a continuous time domain at a specific interval. - **Channel**
Channels refer to different spatial positions where independent audio signals are recorded or played. The number of channels is the number of audio sources used during audio recording, or the number of speakers used for audio playback.
- **Sampling rate**
Sampling rate is the number of samples extracted from a continuous signal per second to form a discrete signal. It is measured in Hz. Generally, human hearing range is from 20 Hz to 20 kHz. Common audio sampling rates include 8 kHz, 11.025 kHz, 22.05 kHz, 16 kHz, 37.8 kHz, 44.1 kHz, 48 kHz, 96 kHz, and 192 kHz.
- **Channel**
Channels refer to different spatial positions where independent audio signals are recorded or played. The number of channels is the number of audio sources used during audio recording, or the number of speakers used for audio playback.
- **Audio frame**
Audio data is in stream form. For the convenience of audio algorithm processing and transmission, it is generally agreed that a data amount in a unit of 2.5 to 60 milliseconds is one audio frame. This unit is called sampling time, and its length is specific to codecs and the application requirements.
- **PCM**
Pulse code modulation \(PCM\) is a method used to digitally represent sampled analog signals. It converts continuous-time analog signals into discrete-time digital signal samples.
- **Audio frame**
Audio data is in stream form. For the convenience of audio algorithm processing and transmission, it is generally agreed that a data amount in a unit of 2.5 to 60 milliseconds is one audio frame. This unit is called sampling time, and its length is specific to codecs and the application requirements.
- **PCM**<br>
Pulse code modulation (PCM) is a method used to digitally represent sampled analog signals. It converts continuous-time analog signals into discrete-time digital signal samples.
...@@ -20,8 +20,6 @@ During application development, you are advised to use **on('stateChange')** to ...@@ -20,8 +20,6 @@ During application development, you are advised to use **on('stateChange')** to
To ensure that the UI thread is not blocked, most **AudioRenderer** calls are asynchronous. Each API provides the callback and promise functions. The following examples use the promise functions. For more information, see [AudioRenderer in Audio Management](../reference/apis/js-apis-audio.md#audiorenderer8). To ensure that the UI thread is not blocked, most **AudioRenderer** calls are asynchronous. Each API provides the callback and promise functions. The following examples use the promise functions. For more information, see [AudioRenderer in Audio Management](../reference/apis/js-apis-audio.md#audiorenderer8).
## How to Develop ## How to Develop
1. Use **createAudioRenderer()** to create an **AudioRenderer** instance. 1. Use **createAudioRenderer()** to create an **AudioRenderer** instance.
...@@ -31,7 +29,7 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as ...@@ -31,7 +29,7 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as
var audioStreamInfo = { var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
...@@ -58,49 +56,49 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as ...@@ -58,49 +56,49 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as
In the case of audio interruption, the application may encounter write failures. To avoid such failures, interruption unaware applications can use **audioRenderer.state** to check the renderer state before writing audio data. The applications can obtain more details by subscribing to the audio interruption events. For details, see [InterruptEvent](../reference/apis/js-apis-audio.md#interruptevent9). In the case of audio interruption, the application may encounter write failures. To avoid such failures, interruption unaware applications can use **audioRenderer.state** to check the renderer state before writing audio data. The applications can obtain more details by subscribing to the audio interruption events. For details, see [InterruptEvent](../reference/apis/js-apis-audio.md#interruptevent9).
```js ```js
audioRenderer.on('interrupt', (interruptEvent) => { audioRenderer.on('interrupt', (interruptEvent) => {
console.info('InterruptEvent Received'); console.info('InterruptEvent Received');
console.info('InterruptType: ' + interruptEvent.eventType); console.info('InterruptType: ' + interruptEvent.eventType);
console.info('InterruptForceType: ' + interruptEvent.forceType); console.info('InterruptForceType: ' + interruptEvent.forceType);
console.info('AInterruptHint: ' + interruptEvent.hintType); console.info('AInterruptHint: ' + interruptEvent.hintType);
if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) {
switch (interruptEvent.hintType) { switch (interruptEvent.hintType) {
// Force Pause: Action was taken by framework. // Force Pause: Action was taken by framework.
// Halt the write calls to avoid data loss. // Halt the write calls to avoid data loss.
case audio.InterruptHint.INTERRUPT_HINT_PAUSE: case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
isPlay = false; isPlay = false;
break; break;
// Force Stop: Action was taken by framework. // Force Stop: Action was taken by framework.
// Halt the write calls to avoid data loss. // Halt the write calls to avoid data loss.
case audio.InterruptHint.INTERRUPT_HINT_STOP: case audio.InterruptHint.INTERRUPT_HINT_STOP:
isPlay = false; isPlay = false;
break; break;
// Force Duck: Action was taken by framework, // Force Duck: Action was taken by framework,
// just notifying the app that volume has been reduced. // just notifying the app that volume has been reduced.
case audio.InterruptHint.INTERRUPT_HINT_DUCK: case audio.InterruptHint.INTERRUPT_HINT_DUCK:
break; break;
// Force Unduck: Action was taken by framework, // Force Unduck: Action was taken by framework,
// just notifying the app that volume has been restored. // just notifying the app that volume has been restored.
case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: case audio.InterruptHint.INTERRUPT_HINT_UNDUCK:
break; break;
} }
} else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) {
switch (interruptEvent.hintType) { switch (interruptEvent.hintType) {
// Share Resume: Action is to be taken by App. // Share Resume: Action is to be taken by App.
// Resume the force paused stream if required. // Resume the force paused stream if required.
case audio.InterruptHint.INTERRUPT_HINT_RESUME: case audio.InterruptHint.INTERRUPT_HINT_RESUME:
startRenderer(); startRenderer();
break; break;
// Share Pause: Stream has been interrupted, // Share Pause: Stream has been interrupted,
// It can choose to pause or play concurrently. // It can choose to pause or play concurrently.
case audio.InterruptHint.INTERRUPT_HINT_PAUSE: case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
isPlay = false; isPlay = false;
pauseRenderer(); pauseRenderer();
break; break;
} }
} }
}); });
``` ```
3. Use **start()** to start audio rendering. 3. Use **start()** to start audio rendering.
...@@ -178,38 +176,38 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as ...@@ -178,38 +176,38 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as
5. (Optional) Call **pause()** or **stop()** to pause or stop rendering. 5. (Optional) Call **pause()** or **stop()** to pause or stop rendering.
```js ```js
async function pauseRenderer() { async function pauseRenderer() {
var state = audioRenderer.state; var state = audioRenderer.state;
if (state != audio.AudioState.STATE_RUNNING) { if (state != audio.AudioState.STATE_RUNNING) {
console.info('Renderer is not running'); console.info('Renderer is not running');
return; return;
} }
await audioRenderer.pause(); await audioRenderer.pause();
state = audioRenderer.state; state = audioRenderer.state;
if (state == audio.AudioState.STATE_PAUSED) { if (state == audio.AudioState.STATE_PAUSED) {
console.info('Renderer paused'); console.info('Renderer paused');
} else { } else {
console.error('Renderer pause failed'); console.error('Renderer pause failed');
} }
} }
async function stopRenderer() {
var state = audioRenderer.state;
if (state != audio.AudioState.STATE_RUNNING || state != audio.AudioState.STATE_PAUSED) {
console.info('Renderer is not running or paused');
return;
}
await audioRenderer.stop();
state = audioRenderer.state; async function stopRenderer() {
if (state == audio.AudioState.STATE_STOPPED) { var state = audioRenderer.state;
console.info('Renderer stopped'); if (state != audio.AudioState.STATE_RUNNING || state != audio.AudioState.STATE_PAUSED) {
} else { console.info('Renderer is not running or paused');
console.error('Renderer stop failed'); return;
} }
await audioRenderer.stop();
state = audioRenderer.state;
if (state == audio.AudioState.STATE_STOPPED) {
console.info('Renderer stopped');
} else {
console.error('Renderer stop failed');
}
} }
``` ```
...@@ -218,22 +216,20 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as ...@@ -218,22 +216,20 @@ To ensure that the UI thread is not blocked, most **AudioRenderer** calls are as
**AudioRenderer** uses a large number of system resources. Therefore, ensure that the resources are released after the task is complete. **AudioRenderer** uses a large number of system resources. Therefore, ensure that the resources are released after the task is complete.
```js ```js
async function releaseRenderer() { async function releaseRenderer() {
if (state_ == RELEASED || state_ == NEW) { if (state_ == RELEASED || state_ == NEW) {
console.info('Resourced already released'); console.info('Resourced already released');
return; return;
} }
await audioRenderer.release();
state = audioRenderer.state;
if (state == STATE_RELEASED) {
console.info('Renderer released');
} else {
console.info('Renderer release failed');
}
}
```
await audioRenderer.release();
state = audioRenderer.state;
if (state == STATE_RELEASED) {
console.info('Renderer released');
} else {
console.info('Renderer release failed');
}
}
```
...@@ -54,16 +54,16 @@ await cameraManager.getCameras((err, cameras) => { ...@@ -54,16 +54,16 @@ await cameraManager.getCameras((err, cameras) => {
cameraArray = cameras cameraArray = cameras
}) })
for(let cameraIndex = 0; cameraIndex < cameraArray.length; cameraIndex) { for(let cameraIndex = 0; cameraIndex < cameraArray.length; cameraIndex) {
console.log('cameraId : ' + cameraArray[cameraIndex].cameraId) // Obtain the camera ID. console.log('cameraId : ' + cameraArray[cameraIndex].cameraId) // Obtain the camera ID.
console.log('cameraPosition : ' + cameraArray[cameraIndex].cameraPosition) // Obtain the camera position. console.log('cameraPosition : ' + cameraArray[cameraIndex].cameraPosition) // Obtain the camera position.
console.log('cameraType : ' + cameraArray[cameraIndex].cameraType) // Obtain the camera type. console.log('cameraType : ' + cameraArray[cameraIndex].cameraType) // Obtain the camera type.
console.log('connectionType : ' + cameraArray[cameraIndex].connectionType) // Obtain the camera connection type. console.log('connectionType : ' + cameraArray[cameraIndex].connectionType) // Obtain the camera connection type.
} }
// Create a camera input stream. // Create a camera input stream.
let cameraInput let cameraInput
await cameraManager.createCameraInput(cameraArray[0].cameraId).then((input) => { await cameraManager.createCameraInput(cameraArray[0].cameraId).then((input) => {
console.log('Promise returned with the CameraInput instance'); console.log('Promise returned with the CameraInput instance');
cameraInput = input cameraInput = input
}) })
......
...@@ -8,13 +8,11 @@ You can use video playback APIs to convert video data into visible signals, play ...@@ -8,13 +8,11 @@ You can use video playback APIs to convert video data into visible signals, play
![en-us_image_video_state_machine](figures/en-us_image_video_state_machine.png) ![en-us_image_video_state_machine](figures/en-us_image_video_state_machine.png)
**Figure 2** Layer 0 diagram of video playback **Figure 2** Layer 0 diagram of video playback
![en-us_image_video_player](figures/en-us_image_video_player.png) ![en-us_image_video_player](figures/en-us_image_video_player.png)
Note: Video playback requires hardware capabilities such as display, audio, and codec. *Note: Video playback requires hardware capabilities such as display, audio, and codec.*
1. A third-party application obtains a surface ID from the XComponent. 1. A third-party application obtains a surface ID from the XComponent.
2. The third-party application transfers the surface ID to the VideoPlayer JS. 2. The third-party application transfers the surface ID to the VideoPlayer JS.
...@@ -43,9 +41,7 @@ The full video playback process includes creating an instance, setting the URL, ...@@ -43,9 +41,7 @@ The full video playback process includes creating an instance, setting the URL,
For details about the **url** types supported by **VideoPlayer**, see the [url attribute](../reference/apis/js-apis-media.md#videoplayer_attributes). For details about the **url** types supported by **VideoPlayer**, see the [url attribute](../reference/apis/js-apis-media.md#videoplayer_attributes).
For details about how to create an XComponent, see [XComponent](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/arkui-ts/ts-basic-components-xcomponent.md). For details about how to create an XComponent, see [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md).
*Note: **setSurface** must be called after the URL is set but before **prepare** is called.
```js ```js
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
...@@ -120,7 +116,7 @@ export class VideoPlayerDemo { ...@@ -120,7 +116,7 @@ export class VideoPlayerDemo {
console.info('pause success'); console.info('pause success');
}, this.failureCallback).catch(this.catchCallback); }, this.failureCallback).catch(this.catchCallback);
// Use a promise to obtain the video track information. // Use a promise to obtain the video track information communication_dsoftbus.
let arrayDescription; let arrayDescription;
await videoPlayer.getTrackDescription().then((arrlist) => { await videoPlayer.getTrackDescription().then((arrlist) => {
if (typeof (arrlist) != 'undefined') { if (typeof (arrlist) != 'undefined') {
......
# DataUriUtils Module # DataUriUtils Module
> **NOTE**<br/> > **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
......
...@@ -78,7 +78,7 @@ Starts an ability. This API uses a callback to return the result. ...@@ -78,7 +78,7 @@ Starts an ability. This API uses a callback to return the result.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.| | options | [StartOptions](js-apis-application-StartOptions.md) | Yes| Parameters used for starting the ability.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -111,7 +111,7 @@ Starts an ability. This API uses a promise to return the result. ...@@ -111,7 +111,7 @@ Starts an ability. This API uses a promise to return the result.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | No| Parameters used for starting the ability.| | options | [StartOptions](js-apis-application-StartOptions.md) | No| Parameters used for starting the ability.|
**Return value** **Return value**
...@@ -180,7 +180,7 @@ Starts an ability. This API uses a callback to return the result when the abilit ...@@ -180,7 +180,7 @@ Starts an ability. This API uses a callback to return the result when the abilit
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.| | options | [StartOptions](js-apis-application-StartOptions.md) | Yes| Parameters used for starting the ability.|
| callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.|
...@@ -213,7 +213,7 @@ Starts an ability. This API uses a promise to return the result when the ability ...@@ -213,7 +213,7 @@ Starts an ability. This API uses a promise to return the result when the ability
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | No| Parameters used for starting the ability.| | options | [StartOptions](js-apis-application-StartOptions.md) | No| Parameters used for starting the ability.|
**Return value** **Return value**
......
# ErrorCode # ErrorCode
> **NOTE**
> **NOTE**<br> >
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -17,9 +16,9 @@ Defines the error code used when the ability is started. ...@@ -17,9 +16,9 @@ Defines the error code used when the ability is started.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ------------------------------ | ---- | ---------------------------------------- | | ------------------------------ | ---- | ---------------------------------------- |
| NO_ERROR | 0 | No error occurs. | | NO_ERROR | 0 | No error occurs. |
| INVALID_PARAMETER | -1 | Invalid parameter. | | INVALID_PARAMETER | -1 | Invalid parameter.|
| ABILITY_NOT_FOUND | -2 | The ability is not found. | | ABILITY_NOT_FOUND | -2 | The ability is not found.|
| PERMISSION_DENY | -3 | Permission denied. | | PERMISSION_DENY | -3 | Permission denied. |
# wantConstant # wantConstant
> **NOTE**
> **NOTE**<br> >
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
``` ```
import wantConstant from '@ohos.ability.wantConstant' import wantConstant from '@ohos.ability.wantConstant'
``` ```
## wantConstant.Action ## wantConstant.Action
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
...@@ -20,32 +18,32 @@ Lists the permissions. ...@@ -20,32 +18,32 @@ Lists the permissions.
| Common Event Macro | Common Event Name | Subscriber Permission | | Common Event Macro | Common Event Name | Subscriber Permission |
| ------------ | ------------------ | ---------------------- | | ------------ | ------------------ | ---------------------- |
| ACTION_HOME | ohos.want.action.home | None | | ACTION_HOME | ohos.want.action.home | None |
| ACTION_DIAL | ohos.want.action.dial | None | | ACTION_DIAL | ohos.want.action.dial | None |
| ACTION_SEARCH | ohos.want.action.search | None | | ACTION_SEARCH | ohos.want.action.search | None |
| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None | | ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None |
| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None | | ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None |
| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | | ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None |
| ACTION_SET_ALARM | ohos.want.action.setAlarm | None | | ACTION_SET_ALARM | ohos.want.action.setAlarm | None |
| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None | | ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None |
| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None | | ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None |
| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None | | ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None |
| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None | | ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None |
| ACTION_SEND_SMS | ohos.want.action.sendSms | None | | ACTION_SEND_SMS | ohos.want.action.sendSms | None |
| ACTION_CHOOSE | ohos.want.action.choose | None | | ACTION_CHOOSE | ohos.want.action.choose | None |
| ACTION_IMAGE_CAPTURE<sup>8+</sup> | ohos.want.action.imageCapture | None | | ACTION_IMAGE_CAPTURE<sup>8+</sup> | ohos.want.action.imageCapture | None |
| ACTION_VIDEO_CAPTUR<sup>8+</sup> | ohos.want.action.videoCapture | None | | ACTION_VIDEO_CAPTUR<sup>8+</sup> | ohos.want.action.videoCapture | None |
| ACTION_SELECT | ohos.want.action.select | None | | ACTION_SELECT | ohos.want.action.select | None |
| ACTION_SEND_DATA | ohos.want.action.sendData | None | | ACTION_SEND_DATA | ohos.want.action.sendData | None |
| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None | | ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None |
| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None | | ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None |
| ACTION_VIEW_DATA | ohos.want.action.viewData | None | | ACTION_VIEW_DATA | ohos.want.action.viewData | None |
| ACTION_EDIT_DATA | ohos.want.action.editData | None | | ACTION_EDIT_DATA | ohos.want.action.editData | None |
| INTENT_PARAMS_INTENT | ability.want.params.INTENT | None | | INTENT_PARAMS_INTENT | ability.want.params.INTENT | None |
| INTENT_PARAMS_TITLE | ability.want.params.TITLE | None | | INTENT_PARAMS_TITLE | ability.want.params.TITLE | None |
| ACTION_FILE_SELECT<sup>7+</sup> | ohos.action.fileSelect | None | | ACTION_FILE_SELECT<sup>7+</sup> | ohos.action.fileSelect | None |
| PARAMS_STREAM<sup>7+</sup> | ability.params.stream | None | | PARAMS_STREAM<sup>7+</sup> | ability.params.stream | None |
| ACTION_APP_ACCOUNT_OAUTH <sup>8+</sup> | ohos.account.appAccount.action.oauth | None | | ACTION_APP_ACCOUNT_OAUTH <sup>8+</sup> | ohos.account.appAccount.action.oauth | None |
## wantConstant.Entity ## wantConstant.Entity
...@@ -56,12 +54,12 @@ Lists the permissions. ...@@ -56,12 +54,12 @@ Lists the permissions.
| Common Event Macro | Common Event Name | Subscriber Permission | | Common Event Macro | Common Event Name | Subscriber Permission |
| ------------ | ------------------ | ---------------------- | | ------------ | ------------------ | ---------------------- |
| ENTITY_DEFAULT | entity.system.default | None | | ENTITY_DEFAULT | entity.system.default | None |
| ENTITY_HOME | entity.system.homel | None | | ENTITY_HOME | entity.system.homel | None |
| ENTITY_VOICE | ENTITY_VOICE | None | | ENTITY_VOICE | ENTITY_VOICE | None |
| ENTITY_BROWSABLE | entity.system.browsable | None | | ENTITY_BROWSABLE | entity.system.browsable | None |
| ENTITY_VIDEO | entity.system.video | None | | ENTITY_VIDEO | entity.system.video | None |
| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | | ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None |
## flags ## flags
...@@ -70,19 +68,19 @@ Lists the permissions. ...@@ -70,19 +68,19 @@ Lists the permissions.
| Name | Value | Description | | Name | Value | Description |
| ------------------------------------ | ---------- | ------------------------------------------------------------ | | ------------------------------------ | ---------- | ------------------------------------------------------------ |
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | | FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. |
| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. | | FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. | | FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. |
| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be continued on a remote device. | | FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be continued on a remote device. |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. | | FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. |
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. | | FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. |
| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. | | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. |
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. | | FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. |
| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler.| | FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler. |
| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. | | FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. |
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible. | | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible. |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | | FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | | FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**. | | FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Indicates the operation of creating a mission on the history mission stack. | | FLAG_ABILITY_NEW_MISSION | 0x10000000 | Indicates the operation of creating a mission on the history mission stack. |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists. | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.|
# Ability Access Control # Ability Access Control
> **NOTE**<br/> Provides program permission management capabilities, including authentication, authorization, and revocation.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -96,14 +99,12 @@ Grants a user granted permission to an application. This API uses a promise to r ...@@ -96,14 +99,12 @@ Grants a user granted permission to an application. This API uses a promise to r
var AtManager = abilityAccessCtrl.createAtManager(); var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; let tokenID = 0;
let permissionFlag = 1; let permissionFlag = 1;
let promise = AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag); let promise = AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag);
promise.then(data => { promise.then(data => {
console.log(`promise: data->${JSON.stringify(data)}`); console.log(`promise: data->${JSON.stringify(data)}`);
}); });
``` ```
### grantUserGrantedPermission ### grantUserGrantedPermission
grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback&lt;number&gt;): void grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback&lt;number&gt;): void
...@@ -129,8 +130,12 @@ Grants a user granted permission to an application. This API uses an asynchronou ...@@ -129,8 +130,12 @@ Grants a user granted permission to an application. This API uses an asynchronou
var AtManager = abilityAccessCtrl.createAtManager(); var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; let tokenID = 0;
let permissionFlag = 1; let permissionFlag = 1;
AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => { AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, data) => {
console.log(`callback: data->${JSON.stringify(data)}`); if (err) {
console.log(`callback: err->${JSON.stringify(err)}`);
} else {
console.log(`callback: data->${JSON.stringify(data)}`);
}
}); });
``` ```
...@@ -195,8 +200,12 @@ Revokes a user granted permission given to an application. This API uses an asyn ...@@ -195,8 +200,12 @@ Revokes a user granted permission given to an application. This API uses an asyn
var AtManager = abilityAccessCtrl.createAtManager(); var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; let tokenID = 0;
let permissionFlag = 1; let permissionFlag = 1;
AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => { AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, data) => {
console.log(`callback: data->${JSON.stringify(data)}`); if (err) {
console.log(`callback: err->${JSON.stringify(err)}`);
} else {
console.log(`callback: data->${JSON.stringify(data)}`);
}
}); });
``` ```
......
# AbilityDelegatorRegistry # AbilityDelegatorRegistry
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -9,21 +10,19 @@ ...@@ -9,21 +10,19 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityLifecycleState ## AbilityLifecycleState
Enumerates the ability lifecycle states. Enumerates the ability lifecycle states.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ------------- | ---- | --------------------------- | | ------------- | ---- | --------------------------- |
| UNINITIALIZED | 0 | The ability is in an invalid state. | | UNINITIALIZED | 0 | The ability is in an invalid state. |
| CREATE | 1 | The ability is created. | | CREATE | 1 | The ability is created.|
| FOREGROUND | 2 | The ability is running in the foreground. | | FOREGROUND | 2 | The ability is running in the foreground. |
| BACKGROUND | 3 | The ability is running in the background. | | BACKGROUND | 3 | The ability is running in the background. |
| DESTROY | 4 | The ability is destroyed. | | DESTROY | 4 | The ability is destroyed.|
...@@ -37,9 +36,9 @@ Obtains the **AbilityDelegator** object of the application. ...@@ -37,9 +36,9 @@ Obtains the **AbilityDelegator** object of the application.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework. | | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework.|
**Example** **Example**
...@@ -61,9 +60,9 @@ Obtains the **AbilityDelegatorArgs** object of the application. ...@@ -61,9 +60,9 @@ Obtains the **AbilityDelegatorArgs** object of the application.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters. | | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters.|
**Example** **Example**
......
# AbilityRunningInfo # AbilityRunningInfo
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides ability running information. Provides ability running information.
## Modules to Import ## Modules to Import
...@@ -11,13 +11,11 @@ Provides ability running information. ...@@ -11,13 +11,11 @@ Provides ability running information.
```js ```js
import abilitymanager from '@ohos.application.abilityManager'; import abilitymanager from '@ohos.application.abilityManager';
``` ```
## Usage
## Usage
The ability running information is obtained by using the **getAbilityRunningInfos** API in **abilityManager**. The ability running information is obtained by using the **getAbilityRunningInfos** API in **abilityManager**.
```js ```js
import abilitymanager from '@ohos.application.abilityManager'; import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getAbilityRunningInfos((err,data) => { abilitymanager.getAbilityRunningInfos((err,data) => {
......
# AbilityStageContext # AbilityStageContext
> **NOTE**<br> > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md). Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md).
...@@ -14,11 +15,8 @@ import AbilityStage from '@ohos.application.AbilityStage'; ...@@ -14,11 +15,8 @@ import AbilityStage from '@ohos.application.AbilityStage';
## Usage ## Usage
The ability stage context is obtained through an **AbilityStage** instance. The ability stage context is obtained through an **AbilityStage** instance.
```js ```js
import AbilityStage from '@ohos.application.AbilityStage'; import AbilityStage from '@ohos.application.AbilityStage';
class MyAbilityStage extends AbilityStage { class MyAbilityStage extends AbilityStage {
...@@ -28,7 +26,6 @@ class MyAbilityStage extends AbilityStage { ...@@ -28,7 +26,6 @@ class MyAbilityStage extends AbilityStage {
} }
``` ```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
# StartOptions # StartOptions
> **NOTE**<br> > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
**StartOptions** is the basic communication component of the system. **StartOptions** is the basic communication component of the system.
## Modules to Import ## Modules to Import
``` ```
import StartOptions from '@ohos.application.StartOptions'; import StartOptions from '@ohos.application.StartOptions';
``` ```
...@@ -18,8 +17,8 @@ import StartOptions from '@ohos.application.StartOptions'; ...@@ -18,8 +17,8 @@ import StartOptions from '@ohos.application.StartOptions';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Readable | Writable | Type | Mandatory | Description | | Name| Readable| Writable| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- | -------- |
| [windowMode](js-apis-window.md#windowmode) | Yes| No | number | No | Window mode. | | [windowMode](js-apis-window.md#windowmode) | Yes| No| number | No| Window mode.|
| displayId | Yes| No | number | No | Display ID. | | displayId | Yes| No| number | No| Display ID.|
# AbilityConstant # AbilityConstant
> **NOTE**<br> > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Provides parameters related to ability launch. Provides parameters related to ability launch.
## Modules to Import ## Modules to Import
```js ```js
import AbilityConstant from '@ohos.application.AbilityConstant'; import AbilityConstant from '@ohos.application.AbilityConstant';
``` ```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| launchReason | LaunchReason | Yes | Yes | Ability launch reason. | | launchReason | LaunchReason| Yes| Yes| Ability launch reason.|
| lastExitReason | LastExitReason | Yes | Yes | Reason for the last exit. | | lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.|
## AbilityConstant.LaunchReason ## AbilityConstant.LaunchReason
...@@ -30,12 +28,12 @@ Enumerates ability launch reasons. ...@@ -30,12 +28,12 @@ Enumerates ability launch reasons.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason. | | UNKNOWN | 0 | Unknown reason.|
| START_ABILITY | 1 | Ability startup. | | START_ABILITY | 1 | Ability startup.|
| CALL | 2 | Call. | | CALL | 2 | Call.|
| CONTINUATION | 3 | Ability continuation. | | CONTINUATION | 3 | Ability continuation.|
## AbilityConstant.LastExitReason ## AbilityConstant.LastExitReason
...@@ -44,11 +42,11 @@ Enumerates reasons for the last exit. ...@@ -44,11 +42,11 @@ Enumerates reasons for the last exit.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason. | | UNKNOWN | 0 | Unknown reason.|
| ABILITY_NOT_RESPONDING | 1 | The ability does not respond. | | ABILITY_NOT_RESPONDING | 1 | The ability does not respond.|
| NORMAL | 2 | Normal status. | | NORMAL | 2 | Normal status.|
## AbilityConstant.OnContinueResult ## AbilityConstant.OnContinueResult
...@@ -57,8 +55,8 @@ Enumerates ability continuation results. ...@@ -57,8 +55,8 @@ Enumerates ability continuation results.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| AGREE | 0 | Continuation agreed. | | AGREE | 0 | Continuation agreed.|
| REJECT | 1 | Continuation denied. | | REJECT | 1 | Continuation denied.|
| MISMATCH | 2 | Mismatch. | | MISMATCH | 2 | Mismatch.|
# AbilityDelegator # AbilityDelegator
> **NOTE**<br/> > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityDelegator ## AbilityDelegator
### addAbilityMonitor<sup>9+</sup> ### addAbilityMonitor<sup>9+</sup>
......
# AbilityDelegatorArgs # AbilityDelegatorArgs
> **NOTE**<br/> > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityDelegatorArgs ## AbilityDelegatorArgs
Describes the test parameters. Describes the test parameters.
......
# AbilityLifecycleCallback # AbilityLifecycleCallback
> **NOTE**<br> > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context. A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context.
## Modules to Import
```js
import AbilityLifecycleCallback from "@ohos.application.abilityLifecycleCallback";
```
## AbilityLifecycleCallback.onAbilityCreate ## AbilityLifecycleCallback.onAbilityCreate
......
# AbilityMonitor # AbilityMonitor
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityMonitor ## AbilityMonitor
Describes an ability monitor. Describes an ability monitor.
......
# AbilityStage # AbilityStage
> **NOTE**<br/> > **NOTE**
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads. Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads.
## Modules to Import ## Modules to Import
```js ```js
import AbilityStage from '@ohos.application.AbilityStage'; import AbilityStage from '@ohos.application.AbilityStage';
``` ```
...@@ -22,8 +21,6 @@ Called when the application is created. ...@@ -22,8 +21,6 @@ Called when the application is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Example** **Example**
```js ```js
......
# MissionInfo # MissionInfo
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -9,7 +10,6 @@ ...@@ -9,7 +10,6 @@
import MissionInfo from '@ohos.application.missionInfo' import MissionInfo from '@ohos.application.missionInfo'
``` ```
## MissionInfo ## MissionInfo
Provides the mission information. Provides the mission information.
......
# ShellCmdResult # ShellCmdResult
> **NOTE**<br> > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## ShellCmdResult ## ShellCmdResult
Describes the shell command execution result. Describes the shell command execution result.
......
# StaticSubscriberExtensionAbility # StaticSubscriberExtensionAbility
> **NOTE**
> **NOTE**<br> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
``` ```
...@@ -20,9 +20,9 @@ Callback of the common event of a static subscriber. ...@@ -20,9 +20,9 @@ Callback of the common event of a static subscriber.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | CommonEventData | Yes | Callback of the common event of a static subscriber. | | event | CommonEventData | Yes| Callback of the common event of a static subscriber.|
**Example** **Example**
......
# appManager # appManager
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -25,9 +26,9 @@ Checks whether this application is undergoing a stability test. This API uses an ...@@ -25,9 +26,9 @@ Checks whether this application is undergoing a stability test. This API uses an
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| | callback | AsyncCallback&lt;boolean&gt; | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -49,9 +50,9 @@ Checks whether this application is undergoing a stability test. This API uses a ...@@ -49,9 +50,9 @@ Checks whether this application is undergoing a stability test. This API uses a
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| | Promise&lt;boolean&gt; | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -75,9 +76,9 @@ Checks whether this application is running on a RAM constrained device. This API ...@@ -75,9 +76,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| | Promise&lt;boolean&gt; | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -99,9 +100,9 @@ Checks whether this application is running on a RAM constrained device. This API ...@@ -99,9 +100,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| | callback | AsyncCallback&lt;boolean&gt; | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -122,9 +123,9 @@ Obtains the memory size of this application. This API uses a promise to return t ...@@ -122,9 +123,9 @@ Obtains the memory size of this application. This API uses a promise to return t
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | Size of the application memory.| | Promise&lt;number&gt; | Size of the application memory.|
**Example** **Example**
...@@ -146,9 +147,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb ...@@ -146,9 +147,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;number&gt; | No| Size of the application memory.| | callback | AsyncCallback&lt;number&gt; | No| Size of the application memory.|
**Example** **Example**
......
...@@ -1146,6 +1146,8 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback&lt;void&gt ...@@ -1146,6 +1146,8 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback&lt;void&gt
Sets an audio parameter. This API uses an asynchronous callback to return the result. Sets an audio parameter. This API uses an asynchronous callback to return the result.
This API is used to extend the audio configuration based on the hardware capability. The supported audio parameters vary according to the device and can be obtained from the device manual. The example below is for reference only.
**System capability**: SystemCapability.Multimedia.Audio.Core **System capability**: SystemCapability.Multimedia.Audio.Core
**Parameters** **Parameters**
...@@ -1159,7 +1161,7 @@ Sets an audio parameter. This API uses an asynchronous callback to return the re ...@@ -1159,7 +1161,7 @@ Sets an audio parameter. This API uses an asynchronous callback to return the re
**Example** **Example**
``` ```
audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => { audioManager.setAudioParameter('key_example', 'value_example', (err) => {
if (err) { if (err) {
console.error('Failed to set the audio parameter. ${err.message}'); console.error('Failed to set the audio parameter. ${err.message}');
return; return;
...@@ -1174,6 +1176,8 @@ setAudioParameter(key: string, value: string): Promise&lt;void&gt; ...@@ -1174,6 +1176,8 @@ setAudioParameter(key: string, value: string): Promise&lt;void&gt;
Sets an audio parameter. This API uses a promise to return the result. Sets an audio parameter. This API uses a promise to return the result.
This API is used to extend the audio configuration based on the hardware capability. The supported audio parameters vary according to the device and can be obtained from the device manual. The example below is for reference only.
**System capability**: SystemCapability.Multimedia.Audio.Core **System capability**: SystemCapability.Multimedia.Audio.Core
**Parameters** **Parameters**
...@@ -1192,7 +1196,7 @@ Sets an audio parameter. This API uses a promise to return the result. ...@@ -1192,7 +1196,7 @@ Sets an audio parameter. This API uses a promise to return the result.
**Example** **Example**
``` ```
audioManager.setAudioParameter('PBits per sample', '8 bit').then(() => { audioManager.setAudioParameter('key_example', 'value_example').then(() => {
console.log('Promise returned to indicate a successful setting of the audio parameter.'); console.log('Promise returned to indicate a successful setting of the audio parameter.');
}); });
``` ```
...@@ -1203,6 +1207,8 @@ getAudioParameter(key: string, callback: AsyncCallback&lt;string&gt;): void ...@@ -1203,6 +1207,8 @@ getAudioParameter(key: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the value of an audio parameter. This API uses an asynchronous callback to return the result. Obtains the value of an audio parameter. This API uses an asynchronous callback to return the result.
This API is used to extend the audio configuration based on the hardware capability. The supported audio parameters vary according to the device and can be obtained from the device manual. The example below is for reference only.
**System capability**: SystemCapability.Multimedia.Audio.Core **System capability**: SystemCapability.Multimedia.Audio.Core
**Parameters** **Parameters**
...@@ -1215,7 +1221,7 @@ Obtains the value of an audio parameter. This API uses an asynchronous callback ...@@ -1215,7 +1221,7 @@ Obtains the value of an audio parameter. This API uses an asynchronous callback
**Example** **Example**
``` ```
audioManager.getAudioParameter('PBits per sample', (err, value) => { audioManager.getAudioParameter('key_example', (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the value of the audio parameter. ${err.message}'); console.error('Failed to obtain the value of the audio parameter. ${err.message}');
return; return;
...@@ -1230,6 +1236,8 @@ getAudioParameter(key: string): Promise&lt;string&gt; ...@@ -1230,6 +1236,8 @@ getAudioParameter(key: string): Promise&lt;string&gt;
Obtains the value of an audio parameter. This API uses a promise to return the result. Obtains the value of an audio parameter. This API uses a promise to return the result.
This API is used to extend the audio configuration based on the hardware capability. The supported audio parameters vary according to the device and can be obtained from the device manual. The example below is for reference only.
**System capability**: SystemCapability.Multimedia.Audio.Core **System capability**: SystemCapability.Multimedia.Audio.Core
**Parameters** **Parameters**
...@@ -1247,7 +1255,7 @@ Obtains the value of an audio parameter. This API uses a promise to return the r ...@@ -1247,7 +1255,7 @@ Obtains the value of an audio parameter. This API uses a promise to return the r
**Example** **Example**
``` ```
audioManager.getAudioParameter('PBits per sample').then((value) => { audioManager.getAudioParameter('key_example').then((value) => {
console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value); console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value);
}); });
``` ```
......
# Configuration # Configuration
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides the configuration for the environment where the ability is running. Provides the configuration for the environment where the ability is running.
## Modules to Import ## Modules to Import
```js ```js
import Configuration from '@ohos.application.Configuration'; import Configuration from '@ohos.application.Configuration';
``` ```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name| Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| language | string | Yes | Yes| Language of the application. | | language | string | Yes| Yes| Language of the application.|
| colorMode | [ColorMode](js-apis-configurationconstant.md) | Yes | Yes | Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.| | colorMode | [ColorMode](js-apis-configurationconstant.md) | Yes| Yes| Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.|
| direction<sup>9+</sup> | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**. | | direction<sup>9+</sup> | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.|
| screenDensity<sup>9+</sup> | ScreenDensity | Yes| No | Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640). | | screenDensity<sup>9+</sup> | ScreenDensity | Yes| No| Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640).|
| displayId<sup>9+</sup> | number | Yes| No| ID of the display where the application is located. | | displayId<sup>9+</sup> | number | Yes| No| ID of the display where the application is located.|
# ConfigurationConstant # ConfigurationConstant
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -27,11 +28,11 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT ...@@ -27,11 +28,11 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name | Value | Description | | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| COLOR_MODE_NOT_SET | -1 | Unspecified color mode. | | COLOR_MODE_NOT_SET | -1 | Unspecified color mode.|
| COLOR_MODE_DARK | 0 | Dark mode. | | COLOR_MODE_DARK | 0 | Dark mode.|
| COLOR_MODE_LIGHT | 1 | Light mode. | | COLOR_MODE_LIGHT | 1 | Light mode.|
## ConfigurationConstant.Direction<sup>9+</sup> ## ConfigurationConstant.Direction<sup>9+</sup>
...@@ -46,11 +47,11 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL ...@@ -46,11 +47,11 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name | Value | Description | | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| DIRECTION_NOT_SET | -1 | Unspecified direction. | | DIRECTION_NOT_SET | -1 | Unspecified direction.|
| DIRECTION_VERTICAL | 0 | Vertical direction. | | DIRECTION_VERTICAL | 0 | Vertical direction.|
| DIRECTION_HORIZONTAL | 1 | Horizontal direction. | | DIRECTION_HORIZONTAL | 1 | Horizontal direction.|
## ConfigurationConstant.ScreenDensity<sup>9+</sup> ## ConfigurationConstant.ScreenDensity<sup>9+</sup>
...@@ -65,12 +66,12 @@ ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET ...@@ -65,12 +66,12 @@ ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name | Value | Description | | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution. | | SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.|
| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi. | | SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.|
| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi. | | SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.|
| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi. | | SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.|
| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi. | | SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.|
| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi. | | SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.|
| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi. | | SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.|
# ExtensionContext # ExtensionContext
> **NOTE**<br/> > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Implements the extension context. This module is inherited from **Context**. Implements the extension context. This module is inherited from **Context**.
......
# FormInfo # FormInfo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides widget information. Provides widget information.
......
# FormError # FormError
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides widget-related error codes. Provides widget-related error codes.
......
# Media # Media
> **NOTE** > **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and use media resources. The multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and use media resources.
......
...@@ -635,7 +635,7 @@ Switches a given mission to the foreground, with the startup parameters for the ...@@ -635,7 +635,7 @@ Switches a given mission to the foreground, with the startup parameters for the
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| options | StartOptions | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| | options | [StartOptions](js-apis-application-StartOptions.md) | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -669,7 +669,7 @@ Switches a given mission to the foreground, with the startup parameters for the ...@@ -669,7 +669,7 @@ Switches a given mission to the foreground, with the startup parameters for the
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| options | StartOptions | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| | options | [StartOptions](js-apis-application-StartOptions.md) | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
**Return value** **Return value**
......
# ParticleAbility Module # ParticleAbility
> **NOTE**<br/> > **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the FA model.
## Constraints ## Constraints
......
# PermissionRequestResult # PermissionRequestResult
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Provides the permission request result. Provides the permission request result.
......
# ServiceExtensionAbility # ServiceExtensionAbility
> **NOTE**<br/> > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Provides APIs related to **ServiceExtension**. Provides APIs related to **ServiceExtension**.
## Modules to Import ## Modules to Import
``` ```
import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; import ServiceExtension from '@ohos.application.ServiceExtensionAbility';
``` ```
## Required Permissions ## Required Permissions
None. None.
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.| | context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.|
## ServiceExtensionAbility.onCreate ## ServiceExtensionAbility.onCreate
...@@ -38,9 +36,9 @@ Called when an extension is created to initialize the service logic. ...@@ -38,9 +36,9 @@ Called when an extension is created to initialize the service logic.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.|
**Example** **Example**
...@@ -82,10 +80,10 @@ Called after **onCreate** is invoked when an ability is started by calling **sta ...@@ -82,10 +80,10 @@ Called after **onCreate** is invoked when an ability is started by calling **sta
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.|
| startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.| | startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.|
**Example** **Example**
...@@ -108,15 +106,15 @@ Called after **onCreate** is invoked when an ability is started by calling **con ...@@ -108,15 +106,15 @@ Called after **onCreate** is invoked when an ability is started by calling **con
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| | want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| rpc.RemoteObject | A **RemoteObject** object used for communication with the client.| | rpc.RemoteObject | A **RemoteObject** object used for communication with the client.|
**Example** **Example**
...@@ -148,9 +146,9 @@ Called when the ability is disconnected. ...@@ -148,9 +146,9 @@ Called when the ability is disconnected.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| | want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.|
**Example** **Example**
......
# TestRunner # TestRunner
> **Note** > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
![IDL-interface-description](./figures/IDL-interface-description.png) ![IDL-interface-description](./figures/IDL-interface-description.png)
OpenHarmony IDL接口描述语言主要用于: OpenHarmony IDL接口描述语言主要用于:
- 声明系统服务对外提供的服务接口,根据接口声明在编译时生成跨进程调用(IPC)或跨设备调用(RPC)的代理(Proxy)和桩(Stub)的C/C++代码或JS/TS代码。 - 声明系统服务对外提供的服务接口,根据接口声明在编译时生成跨进程调用(IPC)或跨设备调用(RPC)的代理(Proxy)和桩(Stub)的C/C++代码或JS/TS代码。
...@@ -29,16 +29,16 @@ OpenHarmony IDL接口描述语言主要用于: ...@@ -29,16 +29,16 @@ OpenHarmony IDL接口描述语言主要用于:
#### 2.1.1 基础数据类型 #### 2.1.1 基础数据类型
| IDL基本数据类型 | C++基本数据类型 | TS基本数据类型 | | IDL基本数据类型 | C++基本数据类型 | TS基本数据类型 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
|void | void | void | |void | void | void |
|boolean | bool | boolean | |boolean | bool | boolean |
|byte | int8_t | number | |byte | int8_t | number |
|short | int16_t | number | |short | int16_t | number |
|int | int32_t | number | |int | int32_t | number |
|long | int64_t | number | |long | int64_t | number |
|float | float | number | |float | float | number |
|double | double | number | |double | double | number |
|String | std::string | string | |String | std::string | string |
IDL支持的基本数据类型及其映射到C++、TS上的数据类型的对应关系如上表所示。 IDL支持的基本数据类型及其映射到C++、TS上的数据类型的对应关系如上表所示。
...@@ -47,29 +47,34 @@ sequenceable数据类型是指使用“sequenceable”关键字声明的数据 ...@@ -47,29 +47,34 @@ sequenceable数据类型是指使用“sequenceable”关键字声明的数据
在C++中sequenceable数据类型的声明放在文件的头部,以“sequenceable includedir..namespace.typename”的形式声明。具体而言。声明可以有如下三个形式: 在C++中sequenceable数据类型的声明放在文件的头部,以“sequenceable includedir..namespace.typename”的形式声明。具体而言。声明可以有如下三个形式:
``` ```cpp
sequenceable includedir..namespace.typename sequenceable includedir..namespace.typename
sequenceable includedir...typename sequenceable includedir...typename
sequenceable namespace.typename sequenceable namespace.typename
``` ```
其中,includedir表示该数据类型头文件所在目录,includedir中以“.”作为分隔符。namespace表示该数据类型所在命名空间,namespace中同样以“.”作为分隔符。typename表示数据类型,数据类型中不能包含非英文字符类型的其他符号。includedir与namespace之间通过“..”分割,如果类型声明的表达式中不包含“..”,除去最后一个typename之外的字符都会被解析为命名空间。例如: 其中,includedir表示该数据类型头文件所在目录,includedir中以“.”作为分隔符。namespace表示该数据类型所在命名空间,namespace中同样以“.”作为分隔符。typename表示数据类型,数据类型中不能包含非英文字符类型的其他符号。includedir与namespace之间通过“..”分割,如果类型声明的表达式中不包含“..”,除去最后一个typename之外的字符都会被解析为命名空间。例如:
```
```cpp
sequenceable a.b..C.D sequenceable a.b..C.D
``` ```
上述声明在生成的的C++头文件中将被解析为如下代码: 上述声明在生成的的C++头文件中将被解析为如下代码:
```
```cpp
#include “a/b/d.h” #include “a/b/d.h”
using C::D; using C::D;
``` ```
TS声明放在文件的头部,以 “sequenceable namespace.typename;”的形式声明。具体而言,声明可以有如下形式: TS声明放在文件的头部,以 “sequenceable namespace.typename;”的形式声明。具体而言,声明可以有如下形式:
``` ```ts
sequenceable idl.MySequenceable sequenceable idl.MySequenceable
``` ```
其中,namespace是该类型所属的命名空间,typename是类型名。MySequenceable类型表示可以通过Parcel进行跨进程传递。sequenceable数据类型并不在OpenHarmony IDL文件中定义,而是定义在.ts文件中。因此,OpenHarmony IDL工具将根据声明在生成的.ts代码文件中加入如下语句: 其中,namespace是该类型所属的命名空间,typename是类型名。MySequenceable类型表示可以通过Parcel进行跨进程传递。sequenceable数据类型并不在OpenHarmony IDL文件中定义,而是定义在.ts文件中。因此,OpenHarmony IDL工具将根据声明在生成的.ts代码文件中加入如下语句:
``` ```ts
import MySequenceable from "./my_sequenceable" import MySequenceable from "./my_sequenceable"
``` ```
...@@ -80,19 +85,19 @@ import MySequenceable from "./my_sequenceable" ...@@ -80,19 +85,19 @@ import MySequenceable from "./my_sequenceable"
C++中声明的形式与sequenceable类型相似,具体而言可以有如下形式: C++中声明的形式与sequenceable类型相似,具体而言可以有如下形式:
``` ```cpp
interface includedir..namespace.typename interface includedir..namespace.typename
``` ```
TS中声明的形式,具体而言可以有如下形式: TS中声明的形式,具体而言可以有如下形式:
``` ```ts
interface namespace.interfacename interface namespace.interfacename
``` ```
其中,namespace是该接口所属的命名空间,interfacename是接口名。例如:“interface OHOS.IIdlTestObserver;”声明了在其他OpenHarmony IDL文件定义的IIdlTestObserver接口,该接口可以作为当前定义中方法的参数类型或返回值类型使用。OpenHarmony IDL工具将根据该声明在生成的TS代码文件中加入如下语句: 其中,namespace是该接口所属的命名空间,interfacename是接口名。例如:“interface OHOS.IIdlTestObserver;”声明了在其他OpenHarmony IDL文件定义的IIdlTestObserver接口,该接口可以作为当前定义中方法的参数类型或返回值类型使用。OpenHarmony IDL工具将根据该声明在生成的TS代码文件中加入如下语句:
``` ```ts
import IIdlTestObserver from "./i_idl_test_observer" import IIdlTestObserver from "./i_idl_test_observer"
``` ```
...@@ -100,9 +105,9 @@ import IIdlTestObserver from "./i_idl_test_observer" ...@@ -100,9 +105,9 @@ import IIdlTestObserver from "./i_idl_test_observer"
数组类型使用“T[]”表示,其中T可以是基本数据类型、sequenceable数据类型、interface类型和数组类型。该类型在C++生成代码中将被生成为std::vector&lt;T&gt;类型。 数组类型使用“T[]”表示,其中T可以是基本数据类型、sequenceable数据类型、interface类型和数组类型。该类型在C++生成代码中将被生成为std::vector&lt;T&gt;类型。
OpenHarmony IDL数组数据类型与TS数据类型、C++数据类型的对应关系如下表所示: OpenHarmony IDL数组数据类型与TS数据类型、C++数据类型的对应关系如下表所示:
|OpenHarmony IDL数据类型 | C++数据类型 | TS数据类型 | |OpenHarmony IDL数据类型 | C++数据类型 | TS数据类型 |
| -------- | -------- | -------- | | ------- | -------- | -------- |
|T[] | std::vector&lt;T&gt; | T[] | |T[] | std::vector&lt;T&gt; | T[] |
#### 2.1.5 容器类型 #### 2.1.5 容器类型
IDL支持两种容器类型,即List和Map。其中List类型容器的用法为List&lt;T&gt;;Map容器的用法为Map<KT,VT>,其中T、KT、VT为基本数据类型、sequenceable类型、interface类型、数组类型或容器类型。 IDL支持两种容器类型,即List和Map。其中List类型容器的用法为List&lt;T&gt;;Map容器的用法为Map<KT,VT>,其中T、KT、VT为基本数据类型、sequenceable类型、interface类型、数组类型或容器类型。
...@@ -114,26 +119,32 @@ List类型在TS代码中不支持,Map容器被映射为Map。 ...@@ -114,26 +119,32 @@ List类型在TS代码中不支持,Map容器被映射为Map。
OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关系如下表所示: OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关系如下表所示:
|OpenHarmony IDL数据类型 | C++数据类型 | TS数据类型 | |OpenHarmony IDL数据类型 | C++数据类型 | TS数据类型 |
| -------- | -------- | -------- | | -------- | -------- | ------- |
|List&lt;T&gt; | std::list | 不支持 | |List&lt;T&gt; | std::list | 不支持 |
|Map<KT,VT> | std::map | Map | |Map<KT,VT> | std::map | Map |
### 2.2 IDL文件编写规范 ### 2.2 IDL文件编写规范
一个idl文件只能定义一个interface类型,且该interface名称必须和文件名相同。idl文件的接口定义使用BNF范式描述,其基本定义的形式如下: 一个idl文件只能定义一个interface类型,且该interface名称必须和文件名相同。idl文件的接口定义使用BNF范式描述,其基本定义的形式如下:
``` ```
[<*interface_attr_declaration*>]interface<*interface_name_with_namespace*>{<*method_declaration*>} [<*interface_attr_declaration*>]interface<*interface_name_with_namespace*>{<*method_declaration*>}
``` ```
其中,<*interface_attr_declaration*>表示接口属性声明。当前仅支持“oneway”属性,表示该接口中的接口都是单向方法,即调用方法后不用等待该方法执行即可返回。这个属性为可选项,如果未声明该属性,则默认为同步调用方法。接口名需要包含完整的接口头文件目录及命名空间,且必须包含方法声明,不允许出现空接口。 其中,<*interface_attr_declaration*>表示接口属性声明。当前仅支持“oneway”属性,表示该接口中的接口都是单向方法,即调用方法后不用等待该方法执行即可返回。这个属性为可选项,如果未声明该属性,则默认为同步调用方法。接口名需要包含完整的接口头文件目录及命名空间,且必须包含方法声明,不允许出现空接口。
接口内的方法声明形式为: 接口内的方法声明形式为:
``` ```
[<*method_attr_declaration*>]<*result_type*><*method_declaration*> [<*method_attr_declaration*>]<*result_type*><*method_declaration*>
``` ```
其中,<*method_attr_declaration*>表示接口属性说明。当前仅支持“oneway”属性,表示该方法为单向方法,即调用方法后不用等待该方法执行即可返回。这个属性为可选项,如果未声明该属性,则默认为同步调用方法。<*result_type*>为返回值类型,<*method_declaration*>是方法名和各个参数声明。 其中,<*method_attr_declaration*>表示接口属性说明。当前仅支持“oneway”属性,表示该方法为单向方法,即调用方法后不用等待该方法执行即可返回。这个属性为可选项,如果未声明该属性,则默认为同步调用方法。<*result_type*>为返回值类型,<*method_declaration*>是方法名和各个参数声明。
参数声明的形式为: 参数声明的形式为:
``` ```
[<*formal_param_attr*>]<*type*><*identifier*> [<*formal_param_attr*>]<*type*><*identifier*>
``` ```
其中<*formal_param_attr*>的值为“in”,“out”,“inout”,分别表示该参数是输入参数,输出参数或输入输出参数。需要注意的是,如果一个方法被声明为oneway,则该方法不允许有输出类型的参数(及输入输出类型)和返回值。 其中<*formal_param_attr*>的值为“in”,“out”,“inout”,分别表示该参数是输入参数,输出参数或输入输出参数。需要注意的是,如果一个方法被声明为oneway,则该方法不允许有输出类型的参数(及输入输出类型)和返回值。
## 3.开发步骤 ## 3.开发步骤
...@@ -144,20 +155,20 @@ OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关 ...@@ -144,20 +155,20 @@ OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关
开发者可以使用C++编程语言构建.idl文件。.idl示例如下: 开发者可以使用C++编程语言构建.idl文件。.idl示例如下:
``` ```cpp
interface OHOS.IIdlTestService { interface OHOS.IIdlTestService {
int TestIntTransaction([in] int data); int TestIntTransaction([in] int data);
void TestStringTransaction([in] String data); void TestStringTransaction([in] String data);
} }
``` ```
使用者通过执行命令 “./idl -gen-cpp -d dir -c dir/iTest.idl” (-d为输出目录)在执行环境的dir目录中生成接口文件、Stub文件、Proxy文件。生成的接口类文件名称和.idl文件名称保持一致,区别在于其使用.h和.cpp扩展名。例如,IIdlTestService. idl 生成的文件名是 i_idl_test_service.h、idl_test_service_proxy.h、idl_test_service_stub.h、idl_test_service_proxy.cpp、idl_test_service_stub.cpp。 使用者通过执行命令 “./idl -gen-cpp -d dir -c dir/iTest.idl” (-d为输出目录)在执行环境的dir目录中生成接口文件、Stub文件、Proxy文件。生成的接口类文件名称和.idl文件名称保持一致,区别在于其使用.h和.cpp扩展名。例如,IIdlTestService.idl 生成的文件名是 i_idl_test_service.h、idl_test_service_proxy.h、idl_test_service_stub.h、idl_test_service_proxy.cpp、idl_test_service_stub.cpp。
#### 3.1.2 服务端公开接口 #### 3.1.2 服务端公开接口
OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。 OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。
``` ```cpp
#ifndef OHOS_IDLTESTSERVICESTUB_H #ifndef OHOS_IDLTESTSERVICESTUB_H
#define OHOS_IDLTESTSERVICESTUB_H #define OHOS_IDLTESTSERVICESTUB_H
#include <iremote_stub.h> #include <iremote_stub.h>
...@@ -182,7 +193,7 @@ private: ...@@ -182,7 +193,7 @@ private:
开发者需要继承.idl文件中定义的接口类并实现其中的方法,同时在服务侧初始化时需要将定义的服务注册至SAMGR中,在本示例中,TestService类继承了IdlTestServiceStub接口类并实现了其中的TestIntTransaction和TestStringTransaction方法。具体的示例代码如下: 开发者需要继承.idl文件中定义的接口类并实现其中的方法,同时在服务侧初始化时需要将定义的服务注册至SAMGR中,在本示例中,TestService类继承了IdlTestServiceStub接口类并实现了其中的TestIntTransaction和TestStringTransaction方法。具体的示例代码如下:
``` ```cpp
#ifndef OHOS_IPC_TEST_SERVICE_H #ifndef OHOS_IPC_TEST_SERVICE_H
#define OHOS_IPC_TEST_SERVICE_H #define OHOS_IPC_TEST_SERVICE_H
...@@ -207,7 +218,7 @@ private: ...@@ -207,7 +218,7 @@ private:
注册服务的示例代码如下: 注册服务的示例代码如下:
``` ```cpp
#include "test_service.h" #include "test_service.h"
#include <string_ex.h> #include <string_ex.h>
...@@ -259,12 +270,11 @@ ErrCode TestService::TestStringTransaction(const std::string &data) ...@@ -259,12 +270,11 @@ ErrCode TestService::TestStringTransaction(const std::string &data)
} // namespace OHOS } // namespace OHOS
``` ```
#### 3.1.3 客户端调用IPC方法 #### 3.1.3 客户端调用IPC方法
C++客户端通常通过SAMGR获取系统中定义的服务代理,随后即可正常调用proxy提供的接口。示例代码如下: C++客户端通常通过SAMGR获取系统中定义的服务代理,随后即可正常调用proxy提供的接口。示例代码如下:
``` ```cpp
#include "test_client.h" #include "test_client.h"
#include "if_system_ability_manager.h" #include "if_system_ability_manager.h"
...@@ -316,16 +326,13 @@ void TestClient::StartStringTransaction() ...@@ -316,16 +326,13 @@ void TestClient::StartStringTransaction()
} // namespace OHOS } // namespace OHOS
``` ```
### 3.2 TS开发步骤 ### 3.2 TS开发步骤
#### 3.2.1 创建.idl文件 #### 3.2.1 创建.idl文件
开发者可以使用TS编程语言构建.idl文件。.idl示例如下: 开发者可以使用TS编程语言构建.idl文件。.idl示例如下:
``` ```ts
interface OHOS.IIdlTestService { interface OHOS.IIdlTestService {
int TestIntTransaction([in] int data); int TestIntTransaction([in] int data);
void TestStringTransaction([in] String data); void TestStringTransaction([in] String data);
...@@ -336,9 +343,9 @@ void TestClient::StartStringTransaction() ...@@ -336,9 +343,9 @@ void TestClient::StartStringTransaction()
#### 3.2.2 服务端公开接口 #### 3.2.2 服务端公开接口
OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。 OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。
``` ```ts
import {testIntTransactionCallback} from "./i_idl_test_service"; import {testIntTransactionCallback} from "./i_idl_test_service";
import {testStringTransactionCallback} from "./i_idl_test_service"; import {testStringTransactionCallback} from "./i_idl_test_service";
import IIdlTestService from "./i_idl_test_service"; import IIdlTestService from "./i_idl_test_service";
...@@ -387,7 +394,7 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl ...@@ -387,7 +394,7 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl
开发者需要继承.idl文件中定义的接口类并实现其中的方法。在本示例中,我们继承了IdlTestServiceStub接口类并实现了其中的testIntTransaction和testStringTransaction方法。具体的示例代码如下: 开发者需要继承.idl文件中定义的接口类并实现其中的方法。在本示例中,我们继承了IdlTestServiceStub接口类并实现了其中的testIntTransaction和testStringTransaction方法。具体的示例代码如下:
``` ```ts
import {testIntTransactionCallback} from "./i_idl_test_service" import {testIntTransactionCallback} from "./i_idl_test_service"
import {testStringTransactionCallback} from "./i_idl_test_service" import {testStringTransactionCallback} from "./i_idl_test_service"
import IdlTestServiceStub from "./idl_test_service_stub" import IdlTestServiceStub from "./idl_test_service_stub"
...@@ -408,7 +415,7 @@ class IdlTestImp extends IdlTestServiceStub { ...@@ -408,7 +415,7 @@ class IdlTestImp extends IdlTestServiceStub {
在服务实现接口后,需要向客户端公开该接口,以便客户端进程绑定。如果开发者的服务要公开该接口,请扩展Ability并实现onConnect()从而返回IRemoteObject,以便客户端能与服务进程交互。服务端向客户端公开IRemoteAbility接口的代码示例如下: 在服务实现接口后,需要向客户端公开该接口,以便客户端进程绑定。如果开发者的服务要公开该接口,请扩展Ability并实现onConnect()从而返回IRemoteObject,以便客户端能与服务进程交互。服务端向客户端公开IRemoteAbility接口的代码示例如下:
``` ```ts
export default { export default {
onStart() { onStart() {
console.info('ServiceAbility onStart'); console.info('ServiceAbility onStart');
...@@ -442,7 +449,7 @@ export default { ...@@ -442,7 +449,7 @@ export default {
客户端调用connectAbility()以连接服务时,客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例。由于客户端和服务在不同应用内,所以客户端应用的目录内必须包含.idl文件(SDK工具会自动生成Proxy代理类)的副本。客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例,使用IRemoteObject创建IdlTestServiceProxy类的实例对象testProxy,然后调用相关IPC方法。示例代码如下: 客户端调用connectAbility()以连接服务时,客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例。由于客户端和服务在不同应用内,所以客户端应用的目录内必须包含.idl文件(SDK工具会自动生成Proxy代理类)的副本。客户端的onAbilityConnectDone中的onConnect回调会接收服务的onConnect()方法返回的IRemoteObject实例,使用IRemoteObject创建IdlTestServiceProxy类的实例对象testProxy,然后调用相关IPC方法。示例代码如下:
``` ```ts
import IdlTestServiceProxy from './idl_test_service_proxy' import IdlTestServiceProxy from './idl_test_service_proxy'
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
...@@ -495,7 +502,7 @@ function connectAbility: void { ...@@ -495,7 +502,7 @@ function connectAbility: void {
MySequenceable类的代码示例如下: MySequenceable类的代码示例如下:
``` ```ts
import rpc from '@ohos.rpc'; import rpc from '@ohos.rpc';
export default class MySequenceable { export default class MySequenceable {
constructor(num: number, str: string) { constructor(num: number, str: string) {
...@@ -523,8 +530,6 @@ export default class MySequenceable { ...@@ -523,8 +530,6 @@ export default class MySequenceable {
} }
``` ```
## 4. C++与TS互通开发步骤 ## 4. C++与TS互通开发步骤
### 4.1 TS Proxy与C++ Stub开发步骤 ### 4.1 TS Proxy与C++ Stub开发步骤
...@@ -535,7 +540,7 @@ export default class MySequenceable { ...@@ -535,7 +540,7 @@ export default class MySequenceable {
2. 开发者创建服务对象,并继承C++ Stub文件中定义的接口类并实现其中的方法,例如: 2. 开发者创建服务对象,并继承C++ Stub文件中定义的接口类并实现其中的方法,例如:
``` ```cpp
class IdlTestServiceImpl : public IdlTestServiceStub { class IdlTestServiceImpl : public IdlTestServiceStub {
public: public:
IdlTestServiceImpl() = default; IdlTestServiceImpl() = default;
...@@ -558,7 +563,7 @@ export default class MySequenceable { ...@@ -558,7 +563,7 @@ export default class MySequenceable {
C++需要通过napi的方式,把C++服务对象提供给TS端,例如:C++端提供一个GetNativeObject方法,方法里创建IdlTestServiceImpl实例,通过NAPI_ohos_rpc_CreateJsRemoteObject方法,创建出一个JS远程对象供TS应用使用,如下: C++需要通过napi的方式,把C++服务对象提供给TS端,例如:C++端提供一个GetNativeObject方法,方法里创建IdlTestServiceImpl实例,通过NAPI_ohos_rpc_CreateJsRemoteObject方法,创建出一个JS远程对象供TS应用使用,如下:
``` ```cpp
NativeValue* GetNativeObject(NativeEngine& engine, NativeCallbackInfo& info) NativeValue* GetNativeObject(NativeEngine& engine, NativeCallbackInfo& info)
{ {
sptr<IdlTestServiceImpl> impl = new IdlTestServiceImpl(); sptr<IdlTestServiceImpl> impl = new IdlTestServiceImpl();
...@@ -572,8 +577,7 @@ NativeValue* GetNativeObject(NativeEngine& engine, NativeCallbackInfo& info) ...@@ -572,8 +577,7 @@ NativeValue* GetNativeObject(NativeEngine& engine, NativeCallbackInfo& info)
如上所述TS开发步骤,开发者使用TS编程语言构建.idl文件,通过命令生成接口、Stub文件、Proxy文件。Proxy文件例如: 如上所述TS开发步骤,开发者使用TS编程语言构建.idl文件,通过命令生成接口、Stub文件、Proxy文件。Proxy文件例如:
``` ```ts
import {testIntTransactionCallback} from "./i_idl_test_service"; import {testIntTransactionCallback} from "./i_idl_test_service";
import {testStringTransactionCallback} from "./i_idl_test_service"; import {testStringTransactionCallback} from "./i_idl_test_service";
import IIdlTestService from "./i_idl_test_service"; import IIdlTestService from "./i_idl_test_service";
...@@ -634,7 +638,7 @@ export default class IdlTestServiceProxy implements IIdlTestService { ...@@ -634,7 +638,7 @@ export default class IdlTestServiceProxy implements IIdlTestService {
2. 构建TS Proxy对象,并把C++服务的远程对象传递给它 2. 构建TS Proxy对象,并把C++服务的远程对象传递给它
3. 此时开发者通过TS Proxy对象调用.idl声明的方法,实现TS Proxy与C++ Stub的互通,示例如下: 3. 此时开发者通过TS Proxy对象调用.idl声明的方法,实现TS Proxy与C++ Stub的互通,示例如下:
``` ```ts
import IdlTestServiceProxy from './idl_test_service_proxy' import IdlTestServiceProxy from './idl_test_service_proxy'
import nativeMgr from 'nativeManager'; import nativeMgr from 'nativeManager';
...@@ -659,4 +663,3 @@ function jsProxyTriggerCppStub() ...@@ -659,4 +663,3 @@ function jsProxyTriggerCppStub()
tsProxy.testStringTransaction("test", testIntTransactionCallback); tsProxy.testStringTransaction("test", testIntTransactionCallback);
} }
``` ```
# Ability框架概述 # Ability框架概述
Ability是应用所具备能力的抽象,也是应用程序的重要组成部分。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件。一个应用可以包含一个或多个Ability。 Ability是应用所具备能力的抽象,也是应用程序的重要组成部分。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件。一个应用可以包含一个或多个Ability。
Ability框架模型具有两种形态: Ability框架模型具有两种形态:
- 第一种形态为FA模型。API 8及其更早版本的应用程序只能使用FA模型进行开发。 FA模型将Ability分为FA(Feature Ability)和PA(Particle Ability)两种类型,其中FA支持Page Ability,PA支持Service Ability、Data Ability、以及FormAbility。 - 第一种形态为FA模型。API 8及其更早版本的应用程序只能使用FA模型进行开发。FA模型将Ability分为FA(Feature Ability)和PA(Particle Ability)两种类型,其中FA支持Page Ability,PA支持Service Ability、Data Ability、以及FormAbility。
- 第二种形态为Stage模型。从API 9开始,Ability框架引入了Stage模型作为第二种应用框架形态,Stage模型将Ability分为Ability和ExtensionAbility两大类,其中ExtensionAbility又被扩展为ServiceExtensionAbility、FormExtensionAbility、DataShareExtensionAbility等一系列ExtensionAbility,以便满足更多的使用场景。 - 第二种形态为Stage模型。从API 9开始,Ability框架引入了Stage模型作为第二种应用框架形态,Stage模型将Ability分为Ability和ExtensionAbility两大类,其中ExtensionAbility又被扩展为ServiceExtensionAbility、FormExtensionAbility、DataShareExtensionAbility等一系列ExtensionAbility,以便满足更多的使用场景。
Stage模型的设计,主要是为了开发者更加方便地开发出分布式环境下的复杂应用。下表给出了两种模型在设计上的差异: Stage模型的设计,主要是为了开发者更加方便地开发出分布式环境下的复杂应用。下表给出了两种模型在设计上的差异:
| 对比 | FA模型 | Stage模型 | | 对比 | FA模型 | Stage模型 |
| -------------- | ------------------------------------------------------------ | -------------------------------------------------------- | | -------------- | ------------------------------------------------------------ | -------------------------------------------------------- |
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
| 包描述文件 | 使用config.json描述HAP包和组件信息,组件必须使用固定的文件名。 | 使用module.json描述HAP包和组件信息,可以指定入口文件名。 | | 包描述文件 | 使用config.json描述HAP包和组件信息,组件必须使用固定的文件名。 | 使用module.json描述HAP包和组件信息,可以指定入口文件名。 |
| 组件 | 提供PageAbility(页面展示),ServiceAbility(服务),DataAbility(数据分享)以及FormAbility(卡片)。 | 提供Ability(页面展示)、Extension(基于场景的服务扩展)。 | | 组件 | 提供PageAbility(页面展示),ServiceAbility(服务),DataAbility(数据分享)以及FormAbility(卡片)。 | 提供Ability(页面展示)、Extension(基于场景的服务扩展)。 |
除了上述设计上的差异外,对于开发者而言,两种模型的主要区别在于: 除了上述设计上的差异外,对于开发者而言,两种模型的主要区别在于:
* Ability类型存在差异; * Ability类型存在差异;
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
![lifecycle](figures/lifecycle.png) ![lifecycle](figures/lifecycle.png)
两种模型的基本介绍,详见[FA模型综述](fa-brief.md)[Stage模型综述](stage-brief.md) 两种模型的基本介绍,详见[FA模型综述](fa-brief.md)[Stage模型综述](stage-brief.md)
## 相关实例 ## 相关实例
针对Ability开发,有以下相关实例可供参考: 针对Ability开发,有以下相关实例可供参考:
- [Page内和Page间导航跳转](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) - [Page内和Page间导航跳转](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility)
\ No newline at end of file
...@@ -15,10 +15,10 @@ Data提供方可以自定义数据的增、删、改、查,以及文件打开 ...@@ -15,10 +15,10 @@ Data提供方可以自定义数据的增、删、改、查,以及文件打开
|delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\<number>): void|删除一条或多条数据。| |delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\<number>): void|删除一条或多条数据。|
|normalizeUri?(uri: string, callback: AsyncCallback\<string>): void|对URI进行规范化。一个规范化的URI可以支持跨设备使用、持久化、备份和还原等,当上下文改变时仍然可以引用到相同的数据项。| |normalizeUri?(uri: string, callback: AsyncCallback\<string>): void|对URI进行规范化。一个规范化的URI可以支持跨设备使用、持久化、备份和还原等,当上下文改变时仍然可以引用到相同的数据项。|
|batchInsert?(uri: string, valueBuckets: Array\<rdb.ValuesBucket>, callback: AsyncCallback\<number>): void|向数据库中插入多条数据。| |batchInsert?(uri: string, valueBuckets: Array\<rdb.ValuesBucket>, callback: AsyncCallback\<number>): void|向数据库中插入多条数据。|
|denormalizeUri?(uri: string, callback: AsyncCallback<string>): void|将一个由normalizeUri生产的规范化URI转换成非规范化的URI。| |denormalizeUri?(uri: string, callback: AsyncCallback\<string>): void|将一个由normalizeUri生产的规范化URI转换成非规范化的URI。|
|insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback\<number>): void|向数据中插入一条数据。| |insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback\<number>): void|向数据中插入一条数据。|
|openFile?(uri: string, mode: string, callback: AsyncCallback\<number>): void|打开一个文件。| |openFile?(uri: string, mode: string, callback: AsyncCallback\<number>): void|打开一个文件。|
|getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void|获取文件的MIME类型。| |getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback\<Array\<string>>): void|获取文件的MIME类型。|
|getType?(uri: string, callback: AsyncCallback\<string>): void|获取URI指定数据相匹配的MIME类型。| |getType?(uri: string, callback: AsyncCallback\<string>): void|获取URI指定数据相匹配的MIME类型。|
|executeBatch?(ops: Array\<DataAbilityOperation>, callback: AsyncCallback\<Array\<DataAbilityResult>>): void|批量操作数据库中的数据。| |executeBatch?(ops: Array\<DataAbilityOperation>, callback: AsyncCallback\<Array\<DataAbilityResult>>): void|批量操作数据库中的数据。|
|call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback\<PacMap>): void|自定义方法。| |call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback\<PacMap>): void|自定义方法。|
......
# PageAbility开发指导 # PageAbility开发指导
## 概述 ## 概述
### 功能简介 ### 功能简介
PageAbility是具备ArkUI实现的Ability,是开发者具体可见并可以交互的Ability实例。开发者通过IDE创建Ability时,IDE会自动创建相关模板代码。PageAbility相关能力通过单独的featureAbility实现,生命周期相关回调则通过app.js/app.ets中各个回调函数实现。
PageAbility是具备ArkUI实现的Ability,是开发者具体可见并可以与之交互的Ability实例。开发者通过DevEco Studio创建Ability时,DevEco Studio会自动创建相关模板代码。
PageAbility相关能力通过单独的featureAbility实现,生命周期相关回调则通过`app.js/app.ets`中各个回调函数实现。
### PageAbility的生命周期 ### PageAbility的生命周期
**PageAbility生命周期介绍**(Ability Life Cycle): **PageAbility生命周期介绍**(Ability Lifecycle):
PageAbility生命周期是PageAbility被调度到INACTIVE、ACTIVE、BACKGROUND等各个状态的统称。 PageAbility生命周期是PageAbility被调度到INACTIVE、ACTIVE、BACKGROUND等各个状态的统称。
...@@ -34,28 +38,31 @@ PageAbility生命周期流转如下图所示: ...@@ -34,28 +38,31 @@ PageAbility生命周期流转如下图所示:
PageAbility提供生命周期回调,开发者可以在`app.js/app.ets`中重写生命周期相关回调函数 。目前`app.js`环境中仅支持onCreate和onDestroy回调,`app.ets`环境支持全量生命周期回调。 PageAbility提供生命周期回调,开发者可以在`app.js/app.ets`中重写生命周期相关回调函数 。目前`app.js`环境中仅支持onCreate和onDestroy回调,`app.ets`环境支持全量生命周期回调。
### 启动模式 ### 启动模式
ability支持单实例和多实例两种启动模式。 ability支持单实例和多实例两种启动模式。
在config.json中通过launchType配置项,可以配置具体的启动模式,其中:
`config.json`中通过launchType配置项,可以配置具体的启动模式,其中:
| 启动模式 | 描述 |说明 | | 启动模式 | 描述 |说明 |
| ----------- | ------- |---------------- | | ----------- | ------- |---------------- |
| standard | 多实例 | 每次startAbility都会启动一个新的实例 | | standard | 多实例 | 每次startAbility都会启动一个新的实例 |
| singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 | | singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 |
缺省情况下是singleton模式。 缺省情况下是singleton模式。
## 开发指导 ## 开发指导
### featureAbility接口说明 ### featureAbility接口说明
**表1** featureAbility接口介绍 **表1** featureAbility接口介绍
| 接口名 | 描述 | | 接口名 | 描述 |
| --------------------------------------------------- | --------------- | | --------------------------------------------------- | --------------- |
| void startAbility(parameter: StartAbilityParameter) | 启动Ability | | void startAbility(parameter: StartAbilityParameter) | 启动Ability |
| Context getContext(): | 获取应用Context | | Context getContext(): | 获取应用Context |
| void terminateSelf() | 结束Ability | | void terminateSelf() | 结束Ability |
| bool hasWindowFocus() | 是否获取焦点 | | bool hasWindowFocus() | 是否获取焦点 |
### 启动本地PageAbility ### 启动本地PageAbility
...@@ -87,7 +94,8 @@ ability支持单实例和多实例两种启动模式。 ...@@ -87,7 +94,8 @@ ability支持单实例和多实例两种启动模式。
``` ```
### 启动远程PageAbility(当前仅对系统应用开放) ### 启动远程PageAbility(当前仅对系统应用开放)
>说明:由于DeviceManager的getTrustedDeviceListSync接口仅对系统应用开放,当前启动远程PageAbility仅支持系统应用
>说明:由于DeviceManager的getTrustedDeviceListSync接口仅对系统应用开放,当前启动远程PageAbility仅支持系统应用。
**导入模块** **导入模块**
...@@ -180,7 +188,7 @@ ability支持单实例和多实例两种启动模式。 ...@@ -180,7 +188,7 @@ ability支持单实例和多实例两种启动模式。
| 接口名 | 描述 | | 接口名 | 描述 |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| onShow() | Ability由后台不可见状态切换到前台可见状态调用onShow方法,此时用户在屏幕可以看到该Ability | | onShow() | Ability由后台不可见状态切换到前台可见状态调用onShow方法,此时用户在屏幕可以看到该Ability |
| onHide() | Ability由前台切换到后台不可见状态时调用onHide方法,此时用户在屏幕看不到该Ability。 | | onHide() | Ability由前台切换到后台不可见状态时调用onHide方法,此时用户在屏幕看不到该Ability。 |
| onDestroy() | 应用退出,销毁Ability对象前调用onDestroy方法,开发者可以在该方法里做一些回收资源、清空缓存等应用退出前的准备工作。 | | onDestroy() | 应用退出,销毁Ability对象前调用onDestroy方法,开发者可以在该方法里做一些回收资源、清空缓存等应用退出前的准备工作。 |
| onCreate() | Ability第一次启动创建Ability时调用onCreate方法,开发者可以在该方法里做一些应用初始化工作。 | | onCreate() | Ability第一次启动创建Ability时调用onCreate方法,开发者可以在该方法里做一些应用初始化工作。 |
...@@ -189,7 +197,7 @@ ability支持单实例和多实例两种启动模式。 ...@@ -189,7 +197,7 @@ ability支持单实例和多实例两种启动模式。
**示例** **示例**
开发者需要重写`app.js/app.ets`中相关生命周期回调函数,IDE模板默认生成`onCreate()``onDestroy()`方法,其他方法需要开发者自行实现。 开发者需要重写`app.js/app.ets`中相关生命周期回调函数,DevEco Studio模板默认生成`onCreate()``onDestroy()`方法,其他方法需要开发者自行实现。
```javascript ```javascript
export default { export default {
...@@ -214,6 +222,7 @@ export default { ...@@ -214,6 +222,7 @@ export default {
} }
``` ```
## 相关实例 ## 相关实例
针对PageAbility开发,有以下相关实例可供参考: 针对PageAbility开发,有以下相关实例可供参考:
- [`DMS`:分布式Demo(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DMS) - [`DMS`:分布式Demo(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DMS)
\ No newline at end of file
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
## 接口说明 ## 接口说明
具体分布式数据对象相关功能接口请见[分布式数据对象](../reference/apis/js-apis-data-distributedobject.md)
### 创建数据对象实例 ### 创建数据对象实例
创建一个分布式数据对象实例,用户可以通过source指定分布式对象中的属性。 创建一个分布式数据对象实例,用户可以通过source指定分布式对象中的属性。
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
## 接口说明 ## 接口说明
具体分布式数据相关功能接口请见[分布式数据管理](../reference/apis/js-apis-distributed-data.md)
OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种功能: OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种功能:
......
# 首选项开发指导 # 首选项开发指导
> **说明:**
>
> 该功能特性从API Version 9开始支持。API Version 9之前可使用[轻量级存储](../reference/apis/js-apis-data-storage.md)的相关功能接口。
## 场景介绍 ## 场景介绍
首选项功能通常用于保存应用的一些常用配置信息,并不适合需要存储大量数据和频繁改变数据的场景。应用的数据保存在文件中,这些文件可以持久化地存储在设备上。需要注意的是,应用访问的实例包含文件所有数据,这些数据会一直加载在设备的内存中,直到应用主动从内存中将其移除前,应用都可以通过Preferences API进行相关数据操作。 首选项功能通常用于保存应用的一些常用配置信息,并不适合需要存储大量数据和频繁改变数据的场景。应用的数据保存在文件中,这些文件可以持久化地存储在设备上。需要注意的是,应用访问的实例包含文件所有数据,这些数据会一直加载在设备的内存中,直到应用主动从内存中将其移除前,应用都可以通过Preferences API进行相关数据操作。
## 接口说明 ## 接口说明
首选项为应用提供key-value键值型的文件数据处理能力,支持应用持久化轻量级数据,并对其修改和查询。数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括数字型、字符型、布尔型。 首选项为应用提供key-value键值型的文件数据处理能力,支持应用持久化轻量级数据,并对其修改和查询。数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括数字型、字符型、布尔型。更多首选项相关接口,请见[首选项API](../reference/apis/js-apis-data-preferences.md)
### 创建存储实例 ### 创建存储实例
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
## 接口说明 ## 接口说明
具体关系型数据库相关功能接口请见[关系型数据库](../reference/apis/js-apis-data-rdb.md)
### 数据库的创建和删除 ### 数据库的创建和删除
关系型数据库提供了数据库创建方式,以及对应的删除接口,涉及的API如下所示。 关系型数据库提供了数据库创建方式,以及对应的删除接口,涉及的API如下所示。
......
# 前言 # 前言
本指导的目的是快速及全面地指导读者使用OpenHarmony提供的“一多”(“一次开发,多端部署”在本指导中的简称)能力开发多设备应用。在应用开发前,开发者应尽可能全面考虑应用支持多设备的情况,避免在后期加入新的类型设备时需要对应用架构进行大幅调整。 本指导的目的是快速及全面地指导读者使用OpenHarmony提供的“一次开发,多端部署”(本指导中简称“一多”)能力开发多设备应用。在应用开发前,开发者应尽可能全面考虑应用支持多设备的情况,避免在后期加入新的类型设备时需要对应用架构进行大幅调整。
## 本指导面向的读者 ## 本指导面向的读者
本指导适合开发OpenHarmony应用的UX设计师、应用开发人员,这两个角色我们统称为“应用开发者”。为什么要把两者分开来,是因为这两者是根据开发角色不同而进行区分。当然对于个人或者规模较小的应用,两者角色往往是合并的,但应当从角色上加以区分。本指导中用“应用开发者”进行统称泛指 本指导适合开发OpenHarmony应用的UX设计师、应用开发人员,本指导书统称为“应用开发者”。这两者是根据开发角色不同而进行的区分。对于个人或者规模较小的应用,两者可能是同一个个体,但应当从角色上加以区分
## 如何阅读本指导 ## 如何阅读本指导
应用在需求明确后,开发过程大致分为:应用设计(包含界面UX设计、业务功能设计)-&gt;工程设计和创建-&gt;功能代码实现。本指导也是基于这个流程进行的内容编排。 应用在需求明确后,开发过程大致分为:应用设计(包含界面UX设计、业务功能设计)- 工程设计和创建 - 功能代码实现。本指导也是基于这个流程进行的内容编排。
阅读本文档时,应尽量按照章节顺序进行阅读。如果区分开发角色,那么UX设计师可以直接且仅阅读第3章,而开发人员可以从第4章开始阅读。但无论如何,我们强烈建议阅读第2章。 阅读本文档时,应尽量按照章节顺序进行阅读。如果区分开发角色,那么UX设计师可以仅阅读第3章,而开发人员可以从第4章开始阅读。但无论何种角色,我们强烈建议阅读第2章。
本文档各章节简介如下: 本文档各章节简介如下:
...@@ -22,11 +22,12 @@ ...@@ -22,11 +22,12 @@
- 第2章[简介](introduction.md)简短介绍了“一多”的背景、定义、目标、以及用于指导后续开发的一些基础知识。 - 第2章[简介](introduction.md)简短介绍了“一多”的背景、定义、目标、以及用于指导后续开发的一些基础知识。
- 第3章[应用UX设计](design-principles.md)介绍了应用UX设计理念。主要阐述了应用设计之初UX设计的原则和要点。该章节主要面向应用的UX设计师。 - 第3章[应用UX设计](design-principles.md)介绍了应用UX设计理念。主要阐述了应用设计之初UX设计的原则和要点。该章节主要面向应用的UX设计师。
UX设计原则应该考虑多设备的“差异性” 、“一致性”、“灵活性”、“兼容性”。 UX设计原则应该考虑多设备的“差异性” 、“一致性”、“灵活性”、“兼容性”。
UX设计要点则从6个方面阐述如何进行多设备应用设计,分别是“自适应应用架构”、“响应式界面布局”、“交互归一”、“视觉参数化”、“多态控件”、“针对性优化”。 UX设计要点则从6个方面阐述如何进行多设备应用设计,分别是“自适应应用架构”、“响应式界面布局”、“交互归一”、“视觉参数化”、“多态控件”、“针对性优化”。
最后,给出设计自检表,用于检查应用UX设计是否合理 最后,给出设计自检表,用于检查应用UX设计是否合理。
- 第4章[IDE使用](ide-usage.md)介绍了从工程角度如何开始开发应用,这非常有用,让读者可以直接上手创建多设备应用的工程,是后面学习“一多”能力的上手基础。 - 第4章[IDE使用](ide-usage.md)介绍了从工程角度如何开始开发应用,这非常有用,让读者可以直接上手创建多设备应用的工程,是后面学习“一多”能力的上手基础。
...@@ -34,6 +35,6 @@ ...@@ -34,6 +35,6 @@
- 第7章提供了两个案例应用,阐述了从应用设计到开发这一过程中如何实践前面章节介绍的设计思路或“一多”能力,让读者可以整体上掌握“一多”在应用开发过程中的知识。 - 第7章提供了两个案例应用,阐述了从应用设计到开发这一过程中如何实践前面章节介绍的设计思路或“一多”能力,让读者可以整体上掌握“一多”在应用开发过程中的知识。
- 第8章[常见问题](faqs.md)提供了常见问题(FAQ),方便读者查阅。 - 第8章[常见问题](faqs.md)提供了常见问题(FAQ),方便读者查阅。
本指导在介绍过程中还包括一些“说明”。这些“说明”,表示例外情况或者额外信息的补充。 本指导在介绍过程中还包括一些“说明”。这些“说明”,表示例外情况或者额外信息的补充。
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
**定义**:一套代码工程,一次开发上架,多端按需部署。 **定义**:一套代码工程,一次开发上架,多端按需部署。
**目标**:支撑开发者快速高效开发多设备(多种终端设备形态的简称)应用,实现对不同设备兼容的同时提供跨设备的流转、迁移和协同的分布式体验。 **目标**:支撑开发者快速高效开发多设备(“多种终端设备形态”的简称)应用,实现对不同设备兼容的同时提供跨设备的流转、迁移和协同的分布式体验。
![zh-cn_image_0000001315500981](figures/zh-cn_image_0000001315500981.jpg) ![zh-cn_image_0000001315500981](figures/zh-cn_image_0000001315500981.jpg)
...@@ -52,7 +52,7 @@ HAP是OpenHarmony的安装包,一个HAP在工程目录中对应一个Module, ...@@ -52,7 +52,7 @@ HAP是OpenHarmony的安装包,一个HAP在工程目录中对应一个Module,
OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进行应用UI开发时所必须的能力。 OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进行应用UI开发时所必须的能力。
方舟开发框架提供了两种开发范式,分别是基于JS扩展的类Web开发范式(“类Web开发范式”的简称)和基于TS扩展的声明式开发范式(“声明式开发范式”的简称)。 方舟开发框架提供了两种开发范式,分别是基于JS扩展的类Web开发范式(简称为“类Web开发范式”)和基于TS扩展的声明式开发范式(简称为“声明式开发范式”)。
- **类Web开发范式**:采用经典的HML、CSS、JavaScript三段式开发方式。使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发更新。此种开发方式,更接近Web前端开发者的使用习惯,快速将已有的Web应用改造成方舟开发框架应用。主要适用于界面较为简单的中小型应用开发。 - **类Web开发范式**:采用经典的HML、CSS、JavaScript三段式开发方式。使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发更新。此种开发方式,更接近Web前端开发者的使用习惯,快速将已有的Web应用改造成方舟开发框架应用。主要适用于界面较为简单的中小型应用开发。
...@@ -146,4 +146,5 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进 ...@@ -146,4 +146,5 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进
- product:产品层目录,通过引用common和feature目录中代码的方式做功能和特性的集成,同时也作为主入口。**这一层是两个部署模型主要差异点**,部署模型A可以直接在product目录中做功能和特性集成,部署模型B则需要在product目录下再建一级子目录,在不同的子目录中对不同的产品做差异化的功能和特性集成。 - product:产品层目录,通过引用common和feature目录中代码的方式做功能和特性的集成,同时也作为主入口。**这一层是两个部署模型主要差异点**,部署模型A可以直接在product目录中做功能和特性集成,部署模型B则需要在product目录下再建一级子目录,在不同的子目录中对不同的产品做差异化的功能和特性集成。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 无论是用部署模型A还是部署模型B,在开发阶段,都应考虑**不同类型设备间最大程度的复用代码**,以减少开发及后续维护的工作量。 > 无论是用部署模型A还是部署模型B,在开发阶段,都应考虑**不同类型设备间最大程度的复用代码**,以减少开发及后续维护的工作量。
...@@ -116,7 +116,7 @@ export class VideoPlayerDemo { ...@@ -116,7 +116,7 @@ export class VideoPlayerDemo {
console.info('pause success'); console.info('pause success');
}, this.failureCallback).catch(this.catchCallback); }, this.failureCallback).catch(this.catchCallback);
// 通过promise回调方式获取视频轨道信息ommunication_dsoftbus // 通过promise回调方式获取视频轨道信息communication_dsoftbus
let arrayDescription; let arrayDescription;
await videoPlayer.getTrackDescription().then((arrlist) => { await videoPlayer.getTrackDescription().then((arrlist) => {
if (typeof (arrlist) != 'undefined') { if (typeof (arrlist) != 'undefined') {
......
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
- [Native API在应用工程中的使用指导](napi-guidelines.md) - [Native API在应用工程中的使用指导](napi-guidelines.md)
- [Drawing开发指导](drawing-guidelines.md) - [Drawing开发指导](drawing-guidelines.md)
- [NativeWindow 开发指导](native_window-guidelines.md)
- [Rawfile开发指导](rawfile-guidelines.md) - [Rawfile开发指导](rawfile-guidelines.md)
...@@ -12,18 +12,18 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,包括从`Surface`构建 ...@@ -12,18 +12,18 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,包括从`Surface`构建
| 接口名 | 描述 | | 接口名 | 描述 |
| -------- | -------- | | -------- | -------- |
| OH_NativeWindow_CreateNativeWindowFromSurface&nbsp;(void&nbsp;\*pSurface) | 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例。 | | OH_NativeWindow_CreateNativeWindowFromSurface (void \*pSurface) | 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例。 |
| OH_NativeWindow_DestroyNativeWindow&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window) | 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉。 | | OH_NativeWindow_DestroyNativeWindow (struct NativeWindow \*window) | 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉。 |
| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer&nbsp;(void&nbsp;\*pSurfaceBuffer) | 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例。 | | OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void \*pSurfaceBuffer) | 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例。 |
| OH_NativeWindow_DestroyNativeWindowBuffer&nbsp;(struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉。 | | OH_NativeWindow_DestroyNativeWindowBuffer (struct NativeWindowBuffer \*buffer) | 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉。 |
| OH_NativeWindow_NativeWindowRequestBuffer&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*\*buffer,&nbsp;int&nbsp;\*fenceFd) | 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产。 | | OH_NativeWindow_NativeWindowRequestBuffer (struct NativeWindow \*window struct NativeWindowBuffer \*\*buffer, int \*fenceFd) | 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产。 |
| OH_NativeWindow_NativeWindowFlushBuffer&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*buffer,&nbsp;int&nbsp;fenceFd,&nbsp;Region&nbsp;region) | 通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费。 | | OH_NativeWindow_NativeWindowFlushBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer, int fenceFd, Region region) | 通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费。 |
| OH_NativeWindow_NativeWindowCancelBuffer&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请。 | | OH_NativeWindow_NativeWindowCancelBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer) | 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请。 |
| OH_NativeWindow_NativeWindowHandleOpt&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;int&nbsp;code,...) | 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等。 | | OH_NativeWindow_NativeWindowHandleOpt (struct NativeWindow \*window, int code,...) | 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等。 |
| OH_NativeWindow_GetBufferHandleFromNative&nbsp;(struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | 通过NativeWindowBuffer获取该buffer的BufferHandle指针。 | | OH_NativeWindow_GetBufferHandleFromNative (struct NativeWindowBuffer \*buffer) | 通过NativeWindowBuffer获取该buffer的BufferHandle指针。 |
| OH_NativeWindow_NativeObjectReference&nbsp;(void&nbsp;\*obj) | 增加一个NativeObject的引用计数。 | | OH_NativeWindow_NativeObjectReference (void \*obj) | 增加一个NativeObject的引用计数。 |
| OH_NativeWindow_NativeObjectUnreference&nbsp;(void&nbsp;\*obj) | 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉。 | | OH_NativeWindow_NativeObjectUnreference (void \*obj) | 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉。 |
| OH_NativeWindow_GetNativeObjectMagic&nbsp;(void&nbsp;\*obj) | 获取NativeObject的MagicId。 | | OH_NativeWindow_GetNativeObjectMagic (void \*obj) | 获取NativeObject的MagicId。 |
详细的接口说明请参考[native_window](../reference/native-apis/_native_window.md) 详细的接口说明请参考[native_window](../reference/native-apis/_native_window.md)
......
...@@ -11,7 +11,7 @@ HarmonyAppProvision文件包含version-code对象、version-name对象、uuid对 ...@@ -11,7 +11,7 @@ HarmonyAppProvision文件包含version-code对象、version-name对象、uuid对
| version-name | 表示版本号的文字描述,推荐使用三段数字版本号,如A.B.C。 | 字符串 | 必选 | 不可缺省 | | version-name | 表示版本号的文字描述,推荐使用三段数字版本号,如A.B.C。 | 字符串 | 必选 | 不可缺省 |
| uuid | 表示文件的唯一ID号,用于OEM厂商标识HarmonyAppProvision文件,开源社区版本该属性不做强制要求。 | 字符串 | 必选 | 不可缺省 | | uuid | 表示文件的唯一ID号,用于OEM厂商标识HarmonyAppProvision文件,开源社区版本该属性不做强制要求。 | 字符串 | 必选 | 不可缺省 |
| type | 表示HarmonyAppProvision文件的类型, 系统预定义的文件类型包括:debug(用于应用调试场景)和release(用于应用发布场景) ,开源社区版本该属性值建议为debug。 | 字符串 | 必选 | 不可缺省 | | type | 表示HarmonyAppProvision文件的类型, 系统预定义的文件类型包括:debug(用于应用调试场景)和release(用于应用发布场景) ,开源社区版本该属性值建议为debug。 | 字符串 | 必选 | 不可缺省 |
| issuer | 表示HarmonyAPPProvision签发者。 | 字符串 | 必选 | 不可缺省 | | issuer | 表示HarmonyAppProvision签发者。 | 字符串 | 必选 | 不可缺省 |
| validity | 表示HarmonyAppProvision文件有效期的信息。参考[validity对象内部结构](#validity对象内部结构)。 | 对象 | 必选 | 不可缺省 | | validity | 表示HarmonyAppProvision文件有效期的信息。参考[validity对象内部结构](#validity对象内部结构)。 | 对象 | 必选 | 不可缺省 |
| bundle-info | 表示应用包以及开发者的信息。参考[bundle-info对象内部结构](#bundle-info对象内部结构)。 | 对象 | 必选 | 不可缺省 | | bundle-info | 表示应用包以及开发者的信息。参考[bundle-info对象内部结构](#bundle-info对象内部结构)。 | 对象 | 必选 | 不可缺省 |
| acls | 表示授权的acl权限信息。参考[acls对象内部结构](#acls对象内部结构)。 | 对象 | 可选 | 不可缺省 | | acls | 表示授权的acl权限信息。参考[acls对象内部结构](#acls对象内部结构)。 | 对象 | 可选 | 不可缺省 |
...@@ -71,7 +71,7 @@ HarmonyAppProvision文件示例: ...@@ -71,7 +71,7 @@ HarmonyAppProvision文件示例:
### acls对象内部结构 ### acls对象内部结构
acls对象包含已授权的[acl权限](../security/accesstoken-overview.md)。需要指出的是,开发者仍然需要在应用包配置文件([config.json](package-structure.md))将acls权限信息填写到reqPermissions属性中。 acls对象包含已授权的[acl权限](../security/accesstoken-overview.md)。需要指出的是,开发者仍然需要在应用包配置文件([config.json](package-structure.md))将acls权限信息填写到reqPermissions属性中。
表4 acls对象的内部结构 表4 acls对象的内部结构
| 属性名称 | 含义 | 数据类型 | 是否必选 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否必选 | 是否可缺省 |
......
...@@ -501,11 +501,11 @@ skills示例: ...@@ -501,11 +501,11 @@ skills示例:
表21 reqPermissions权限申请字段说明 表21 reqPermissions权限申请字段说明
| 属性名称 | 含义 | **类型** | **取值范围** | **默认值** | **规则约束** | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| --------- | ------------------------------------------------------------ | -------- | ----------------------------------------------------------- | ---------------------- | ------------------------------------------------------------ | | ---------- | ------------------------------------------------------------ | -------- | ------------------ |
| name | 必须,填写需要使用的权限名称。 | 字符串 | 自定义 | 无 | 未填写时,解析失败。 | | name | 需要使用的权限名称。 | 字符串 | 否 |
| reason | 可选,当申请的权限为user_grant权限时此字段必填。描述申请权限的原因。 | 字符串 | 显示文字长度不能超过256个字节。 | 空 | user_grant权限必填,否则不允许在应用市场上架。需做多语种适配。 | | reason | 描述申请权限的原因。不能超过256个字节。需要做多语种适配。 | 字符串 | 分情况:当申请的权限为user_grant时,必须填写此字段,否则不允许在应用市场上架;其它权限可缺省,缺省为空 |
| usedScene | 可选,当申请的权限为user_grant权限时此字段必填。描述权限使用的场景和时机。场景类型有:ability、when(调用时机)。可配置多个ability。 | 对象 | ability:ability的名称when:inuse(使用时)、always(始终) | ability:空when:inuse | user_grant权限必填ability,可选填when。 | | usedScene | 描述权限使用的场景和时机。场景类型有:ability、when。ability:ability的名称,可配置多个。when:调用时机,可填的值有inuse(使用时)、always(始终) | 对象 | ability分情况:申请的权限有user_grant时,ability必填;没有user_grant时可缺省,缺省值为空。when可缺省,缺省值为“inuse” |
表22 js对象的内部结构说明 表22 js对象的内部结构说明
......
...@@ -17,7 +17,7 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可 ...@@ -17,7 +17,7 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可
- 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。 - 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。
- 在已有工程中,创建visual文件来进行开发。 - 在已有工程中,创建visual文件来进行开发。此种方式的操作可参考[创建visual文件支持低代码开发](#构建第二个页面)
## 创建新工程支持低代码开发 ## 创建新工程支持低代码开发
......
...@@ -15,7 +15,7 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可 ...@@ -15,7 +15,7 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可
- 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。 - 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。
- 在已有工程中,创建visual文件来进行开发。 - 在已有工程中,创建visual文件来进行开发。此种方式的操作可参考[创建visual文件支持低代码开发](#构建第二个页面)
## 创建新工程支持低代码开发 ## 创建新工程支持低代码开发
...@@ -82,10 +82,15 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可 ...@@ -82,10 +82,15 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可
## 构建第二个页面 ## 构建第二个页面
1. 创建第二个页面。 1. 创建第二个页面。
在“**Project**”窗口,打开“**entry &gt; src &gt; main &gt; js &gt; MainAbility**”,右键点击“**pages**”文件夹,选择“**New &gt; Visual**”,命名为“**second**”,单击“**Finish**”,即完成第二个页面的创建。可以看到文件目录结构如下: 在“**Project**”窗口,打开“**entry > src > main > js > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > Visual**”,命名为“**second**”,单击“**Finish**”,即完成第二个页面的创建。
新建visual文件的操作如下:
<img src="figures/zh-cn_image_202206250937.png" alt="create-newVisual" style="zoom: 67%;" />
可以看到文件目录结构如下:
![zh-cn_image_0000001223882030](figures/zh-cn_image_0000001223882030.png) ![zh-cn_image_0000001223882030](figures/zh-cn_image_0000001223882030.png)
2. [删除画布原有模板组件。](#delete_origin_content) 2. [删除画布原有模板组件。](#delete_origin_content)
3. [添加容器,设置Div容器的样式和属性。](#add_container) 3. [添加容器,设置Div容器的样式和属性。](#add_container)
......
...@@ -1610,6 +1610,12 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri ...@@ -1610,6 +1610,12 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri
| abilityName | string | 是 | 表示要获取的配置文件所属的ability。 | | abilityName | string | 是 | 表示要获取的配置文件所属的ability。 |
| metadataName | string | 否 | 表示要获取的配置文件所属的[metadata](js-apis-bundle-Metadata.md)。 | | metadataName | string | 否 | 表示要获取的配置文件所属的[metadata](js-apis-bundle-Metadata.md)。 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------- | ------------------------------ |
| Promise\<Array\<string>> | Promise形式返回配置文件的json字符串数组。 |
**示例:** **示例:**
```js ```js
...@@ -1670,6 +1676,12 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m ...@@ -1670,6 +1676,12 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
| extensionAbilityName | string | 是 | 表示要获取的配置文件所属的extensionAbility。 | | extensionAbilityName | string | 是 | 表示要获取的配置文件所属的extensionAbility。 |
| metadataName | string | 否 | 表示要获取的配置文件所属的metadata。 | | metadataName | string | 否 | 表示要获取的配置文件所属的metadata。 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------- | ------------------------------ |
| Promise\<Array\<string>> | Promise形式返回配置文件的json字符串数组。 |
**示例:** **示例:**
```js ```js
......
...@@ -1146,6 +1146,8 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback&lt;void&gt ...@@ -1146,6 +1146,8 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback&lt;void&gt
音频参数设置,使用callback方式异步返回结果。 音频参数设置,使用callback方式异步返回结果。
本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。
**系统能力:** SystemCapability.Multimedia.Audio.Core **系统能力:** SystemCapability.Multimedia.Audio.Core
**参数:** **参数:**
...@@ -1159,7 +1161,7 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback&lt;void&gt ...@@ -1159,7 +1161,7 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback&lt;void&gt
**示例:** **示例:**
``` ```
audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => { audioManager.setAudioParameter('key_example', 'value_example', (err) => {
if (err) { if (err) {
console.error('Failed to set the audio parameter. ${err.message}'); console.error('Failed to set the audio parameter. ${err.message}');
return; return;
...@@ -1174,6 +1176,8 @@ setAudioParameter(key: string, value: string): Promise&lt;void&gt; ...@@ -1174,6 +1176,8 @@ setAudioParameter(key: string, value: string): Promise&lt;void&gt;
音频参数设置,使用Promise方式异步返回结果。 音频参数设置,使用Promise方式异步返回结果。
本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。
**系统能力:** SystemCapability.Multimedia.Audio.Core **系统能力:** SystemCapability.Multimedia.Audio.Core
**参数:** **参数:**
...@@ -1192,7 +1196,7 @@ setAudioParameter(key: string, value: string): Promise&lt;void&gt; ...@@ -1192,7 +1196,7 @@ setAudioParameter(key: string, value: string): Promise&lt;void&gt;
**示例:** **示例:**
``` ```
audioManager.setAudioParameter('PBits per sample', '8 bit').then(() => { audioManager.setAudioParameter('key_example', 'value_example').then(() => {
console.log('Promise returned to indicate a successful setting of the audio parameter.'); console.log('Promise returned to indicate a successful setting of the audio parameter.');
}); });
``` ```
...@@ -1203,6 +1207,8 @@ getAudioParameter(key: string, callback: AsyncCallback&lt;string&gt;): void ...@@ -1203,6 +1207,8 @@ getAudioParameter(key: string, callback: AsyncCallback&lt;string&gt;): void
获取指定音频参数值,使用callback方式异步返回结果。 获取指定音频参数值,使用callback方式异步返回结果。
本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。
**系统能力:** SystemCapability.Multimedia.Audio.Core **系统能力:** SystemCapability.Multimedia.Audio.Core
**参数:** **参数:**
...@@ -1215,7 +1221,7 @@ getAudioParameter(key: string, callback: AsyncCallback&lt;string&gt;): void ...@@ -1215,7 +1221,7 @@ getAudioParameter(key: string, callback: AsyncCallback&lt;string&gt;): void
**示例:** **示例:**
``` ```
audioManager.getAudioParameter('PBits per sample', (err, value) => { audioManager.getAudioParameter('key_example', (err, value) => {
if (err) { if (err) {
console.error('Failed to obtain the value of the audio parameter. ${err.message}'); console.error('Failed to obtain the value of the audio parameter. ${err.message}');
return; return;
...@@ -1230,6 +1236,8 @@ getAudioParameter(key: string): Promise&lt;string&gt; ...@@ -1230,6 +1236,8 @@ getAudioParameter(key: string): Promise&lt;string&gt;
获取指定音频参数值,使用Promise方式异步返回结果。 获取指定音频参数值,使用Promise方式异步返回结果。
本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。
**系统能力:** SystemCapability.Multimedia.Audio.Core **系统能力:** SystemCapability.Multimedia.Audio.Core
**参数:** **参数:**
...@@ -1247,7 +1255,7 @@ getAudioParameter(key: string): Promise&lt;string&gt; ...@@ -1247,7 +1255,7 @@ getAudioParameter(key: string): Promise&lt;string&gt;
**示例:** **示例:**
``` ```
audioManager.getAudioParameter('PBits per sample').then((value) => { audioManager.getAudioParameter('key_example').then((value) => {
console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value); console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value);
}); });
``` ```
......
...@@ -524,7 +524,7 @@ getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback&lt;Array&lt;Bund ...@@ -524,7 +524,7 @@ getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback&lt;Array&lt;Bund
} }
}); });
// 无maNum参数调用方式 // 无maxNum参数调用方式
bundleState.getRecentlyUsedModules((err, res) => { bundleState.getRecentlyUsedModules((err, res) => {
if(err) { if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
...@@ -1117,9 +1117,9 @@ merge(toMerge: BundleStateInfo): void ...@@ -1117,9 +1117,9 @@ merge(toMerge: BundleStateInfo): void
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| ------------------ | ---- | ----------------- | | ------------------ | ---- | ----------------- |
| ACTIVE_GROUP_ALIVE | 10 | 活跃分组 | | ACTIVE_GROUP_ALIVE | 10 | 活跃分组。 |
| ACTIVE_GROUP_DAILY | 20 | 经常使用,但当前并未在活跃态 | | ACTIVE_GROUP_DAILY | 20 | 经常使用,但当前并未在活跃态。 |
| ACTIVE_GROUP_FIXED | 30 | 常用分组,定期使用,但不是每天使用 | | ACTIVE_GROUP_FIXED | 30 | 常用分组,定期使用,但不是每天使用。 |
| ACTIVE_GROUP_RARE | 40 | 极少使用分组,不经常使用 | | ACTIVE_GROUP_RARE | 40 | 极少使用分组,不经常使用。 |
| ACTIVE_GROUP_LIMIT | 50 | 受限使用分组 | | ACTIVE_GROUP_LIMIT | 50 | 受限使用分组。 |
| ACTIVE_GROUP_NEVER | 60 | 从未使用分组,安装但是从未运行过 | | ACTIVE_GROUP_NEVER | 60 | 从未使用分组,安装但是从未运行过。 |
\ No newline at end of file \ No newline at end of file
# 应用打点 # 应用打点
本模块提供了应用事件打点能力,包括对打点数据的落盘,以及对打点功能的管理配置。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
...@@ -23,7 +23,7 @@ isLoggable(domain: number, tag: string, level: LogLevel) : boolean ...@@ -23,7 +23,7 @@ isLoggable(domain: number, tag: string, level: LogLevel) : boolean
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | --------------------- | ---- | ------------------------------------------------------------ | | ------ | --------------------- | ---- | ------------------------------------------------------------ |
| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | | domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF<br/>建议开发者在应用内根据需要自定义划分。 |
| tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 |
| level | [LogLevel](#loglevel) | 是 | 日志级别。 | | level | [LogLevel](#loglevel) | 是 | 日志级别。 |
...@@ -67,7 +67,7 @@ DEBUG级别的日志在正式发布版本中默认不被打印,只有在调试 ...@@ -67,7 +67,7 @@ DEBUG级别的日志在正式发布版本中默认不被打印,只有在调试
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | | domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF<br/>建议开发者在应用内根据需要自定义划分。 |
| tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 |
| format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 |
| args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 |
...@@ -98,7 +98,7 @@ info(domain: number, tag: string, format: string, ...args: any[]) : void ...@@ -98,7 +98,7 @@ info(domain: number, tag: string, format: string, ...args: any[]) : void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | | domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF<br/>建议开发者在应用内根据需要自定义划分。 |
| tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 |
| format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 |
| args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 |
...@@ -129,7 +129,7 @@ warn(domain: number, tag: string, format: string, ...args: any[]) : void ...@@ -129,7 +129,7 @@ warn(domain: number, tag: string, format: string, ...args: any[]) : void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | | domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF<br/>建议开发者在应用内根据需要自定义划分。 |
| tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 |
| format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 |
| args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 |
...@@ -160,7 +160,7 @@ error(domain: number, tag: string, format: string, ...args: any[]) : void ...@@ -160,7 +160,7 @@ error(domain: number, tag: string, format: string, ...args: any[]) : void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | | domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF<br/>建议开发者在应用内根据需要自定义划分。 |
| tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 |
| format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 |
| args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 |
...@@ -191,7 +191,7 @@ fatal(domain: number, tag: string, format: string, ...args: any[]) : void ...@@ -191,7 +191,7 @@ fatal(domain: number, tag: string, format: string, ...args: any[]) : void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | | domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF<br/>建议开发者在应用内根据需要自定义划分。 |
| tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 |
| format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。<br/>隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\<private>过滤回显。 |
| args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 |
......
# 系统事件打点 # 系统事件打点
为系统hap应用提供系统事件打点接口 本模块提供了系统事件打点能力,包括系统事件的埋点、落盘系统事件的订阅及已落盘的系统事件的查询能力
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 分布式跟踪 # 分布式跟踪
本模块提供了端侧业务流程调用链跟踪的打点能力,包括业务流程跟踪的启动、结束、信息埋点等能力。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 性能打点 # 性能打点
本模块提供了追踪进程轨迹,度量程序执行性能的打点能力。本模块打点的数据供hiTraceMeter工具分析使用。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
...@@ -22,6 +22,8 @@ matchMediaSync(condition: string): MediaQueryListener ...@@ -22,6 +22,8 @@ matchMediaSync(condition: string): MediaQueryListener
设置媒体查询的查询条件,并返回对应的监听句柄。 设置媒体查询的查询条件,并返回对应的监听句柄。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------------------------------------- | | --------- | ------ | ---- | ---------------------------------------- |
...@@ -42,6 +44,7 @@ let listener = mediaquery.matchMediaSync('(orientation: landscape)'); //监听 ...@@ -42,6 +44,7 @@ let listener = mediaquery.matchMediaSync('(orientation: landscape)'); //监听
媒体查询的句柄,并包含了申请句柄时的首次查询结果。 媒体查询的句柄,并包含了申请句柄时的首次查询结果。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
### 属性 ### 属性
...@@ -57,6 +60,8 @@ on(type: 'change', callback: Callback&lt;MediaQueryResult&gt;): void ...@@ -57,6 +60,8 @@ on(type: 'change', callback: Callback&lt;MediaQueryResult&gt;): void
通过句柄向对应的查询条件注册回调,当媒体属性发生变更时会触发该回调。 通过句柄向对应的查询条件注册回调,当媒体属性发生变更时会触发该回调。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ---------------- | | -------- | -------------------------------- | ---- | ---------------- |
...@@ -72,6 +77,9 @@ on(type: 'change', callback: Callback&lt;MediaQueryResult&gt;): void ...@@ -72,6 +77,9 @@ on(type: 'change', callback: Callback&lt;MediaQueryResult&gt;): void
off(type: 'change', callback?: Callback&lt;MediaQueryResult&gt;): void off(type: 'change', callback?: Callback&lt;MediaQueryResult&gt;): void
通过句柄向对应的查询条件去注册回调,当媒体属性发生变更时不在触发指定的回调。 通过句柄向对应的查询条件去注册回调,当媒体属性发生变更时不在触发指定的回调。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ----------------------------- | | -------- | -------------------------------- | ---- | ----------------------------- |
......
...@@ -556,6 +556,346 @@ promise.then(data => { ...@@ -556,6 +556,346 @@ promise.then(data => {
}); });
``` ```
## radio.setPrimarySlotId<sup>8+</sup>
setPrimarySlotId(slotId: number, callback: AsyncCallback<void\>): void
设置主卡所在卡槽的索引号,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。当设置成功,err为undefined,否则为错误对象。 |
**示例:**
```js
let slotId = 0;
radio.setPrimarySlotId(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.setPrimarySlotId<sup>8+</sup>
setPrimarySlotId\(slotId: number\): Promise\<void\>
设置主卡所在卡槽的索引号,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| --------------- | ------------------------------- |
| Promise\<void\> | 无返回结果的Promise对象。 |
**示例:**
```js
let slotId = 0;
let promise = radio.setPrimarySlotId(slotId);
promise.then(data => {
console.log(`setPrimarySlotId success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`setPrimarySlotId fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getIMEI<sup>8+</sup>
getIMEI(callback: AsyncCallback<string\>): void
获取设备的指定卡槽的IMEI,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback\<string\> | 是 | 回调函数,如果IMEI不存在,则返回空字符串。 |
**示例:**
```js
radio.getIMEI((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getIMEI<sup>8+</sup>
getIMEI(slotId: number, callback: AsyncCallback<string\>): void
获取设备的指定卡槽的IMEI,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | ------------------------------------------ |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<string\> | 是 | 回调函数,如果IMEI不存在,则返回空字符串。 |
**示例:**
```js
let slotId = 0;
radio.getIMEI(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getIMEI<sup>8+</sup>
getIMEI(slotId?: number): Promise<string\>
获取设备的指定卡槽的IMEI,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 否 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------------------ |
| Promise\<string\> | Promise对象。返回IMEI;如果IMEI不存在,则返回空字符串。 |
**示例:**
```js
let slotId = 0;
let promise = radio.getIMEI(slotId);
promise.then(data => {
console.log(`getIMEI success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getIMEI fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getMEID<sup>8+</sup>
getMEID(callback: AsyncCallback<string\>): void
获取设备的指定卡槽的MEID,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | ---------- |
| callback | AsyncCallback\<string\> | 是 | 回调函数。 |
**示例:**
```js
radio.getMEID((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getMEID<sup>8+</sup>
getMEID(slotId: number, callback: AsyncCallback<string\>): void
获取设备的指定卡槽的MEID,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<string\> | 是 | 回调函数。 |
**示例:**
```js
let slotId = 0;
radio.getMEID(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getMEID<sup>8+</sup>
getMEID(slotId?: number): Promise<string\>
获取设备的指定卡槽的MEID,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 否 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | --------------------------------------- |
| Promise\<string\> | 以Promise形式返回设备的指定卡槽的MEID。 |
**示例:**
```js
let slotId = 0;
let promise = radio.getMEID(slotId);
promise.then(data => {
console.log(`getMEID success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getMEID fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getUniqueDeviceId<sup>8+</sup>
getUniqueDeviceId(callback: AsyncCallback<string\>): void
获取设备的指定卡槽的唯一设备ID,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | ---------- |
| callback | AsyncCallback\<string\> | 是 | 回调函数。 |
**示例:**
```js
radio.getUniqueDeviceId((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getUniqueDeviceId<sup>8+</sup>
getUniqueDeviceId(slotId: number, callback: AsyncCallback<string\>): void
获取设备的指定卡槽的唯一设备ID,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<string\> | 是 | 回调函数。 |
**示例:**
```js
let slotId = 0;
radio.getUniqueDeviceId(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getUniqueDeviceId<sup>8+</sup>
getUniqueDeviceId(slotId?: number): Promise<string\>
获取设备的指定卡槽的唯一设备ID,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 否 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | --------------------------------------------- |
| Promise\<string\> | 以Promise形式返回设备的指定卡槽的唯一设备ID。 |
**示例:**
```js
let slotId = 0;
let promise = radio.getUniqueDeviceId(slotId);
promise.then(data => {
console.log(`getUniqueDeviceId success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getUniqueDeviceId fail, promise: err->${JSON.stringify(err)}`);
});
```
## RadioTechnology ## RadioTechnology
......
...@@ -190,6 +190,8 @@ getLength(): string ...@@ -190,6 +190,8 @@ getLength(): string
获取当前在页面栈内的页面数量。 获取当前在页面栈内的页面数量。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -275,7 +277,7 @@ enableAlertBeforeBackPage(options: EnableAlertOptions): void ...@@ -275,7 +277,7 @@ enableAlertBeforeBackPage(options: EnableAlertOptions): void
页面返回询问对话框选项。 页面返回询问对话框选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
......
...@@ -19,11 +19,12 @@ import screenshot from '@ohos.screenshot'; ...@@ -19,11 +19,12 @@ import screenshot from '@ohos.screenshot';
**系统能力:** SystemCapability.WindowManager.WindowManager.Core **系统能力:** SystemCapability.WindowManager.WindowManager.Core
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------- | ---- | ------------------------------------------------------------ | | ---------------------- | ------------- | ---- | ------------------------------------------------------------ |
| screenRect | [Rect](#rect) | 否 | 表示截取图像的区域,不传值默认为全屏。| | screenRect | [Rect](#rect) | 否 | 表示截取图像的区域,不传值默认为全屏。 |
| imageSize | [Size](#size) | 否 | 表示截取图像的大小,不传值默认为全屏。| | imageSize | [Size](#size) | 否 | 表示截取图像的大小,不传值默认为全屏。 |
| rotation | number | 否 | 表示截取图像的旋转角度,当前仅支持输入值为0,默认值为0。| | rotation | number | 否 | 表示截取图像的旋转角度,当前仅支持输入值为0,默认值为0。 |
| displayId<sup>8+</sup> | number | 否 | 表示截取图像的显示设备[Display](js-apis-display.md#display)的ID号。 |
## Rect ## Rect
...@@ -63,10 +64,10 @@ save(options?: ScreenshotOptions, callback: AsyncCallback&lt;image.PixelMap&gt;) ...@@ -63,10 +64,10 @@ save(options?: ScreenshotOptions, callback: AsyncCallback&lt;image.PixelMap&gt;)
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect,imageSize,rotation三个参数,需要分别设置这三个参数。 | | options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect,imageSize,rotation, displayId四个参数,可以分别设置这四个参数。 |
| callback | AsyncCallback&lt;image.PixelMap&gt; | 是 | 回调返回一个PixelMap对象。 | | callback | AsyncCallback&lt;image.PixelMap&gt; | 是 | 回调返回一个PixelMap对象。 |
**示例:** **示例:**
...@@ -80,7 +81,8 @@ save(options?: ScreenshotOptions, callback: AsyncCallback&lt;image.PixelMap&gt;) ...@@ -80,7 +81,8 @@ save(options?: ScreenshotOptions, callback: AsyncCallback&lt;image.PixelMap&gt;)
"imageSize": { "imageSize": {
"width": 300, "width": 300,
"height": 300}, "height": 300},
"rotation": 0 "rotation": 0,
"displayId": 0
}; };
screenshot.save(ScreenshotOptions, (err, data) => { screenshot.save(ScreenshotOptions, (err, data) => {
if (err) { if (err) {
...@@ -105,13 +107,13 @@ save(options?: ScreenshotOptions): Promise&lt;image.PixelMap&gt; ...@@ -105,13 +107,13 @@ save(options?: ScreenshotOptions): Promise&lt;image.PixelMap&gt;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect、imageSize、rotation三个参数,需要分别设置这三个参数。 | | options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect、imageSize、rotation、displayId四个参数,可以分别设置这四个参数。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------- | ----------------------------------------------- | | ----------------------------- | ----------------------------------------------- |
| Promise&lt;image.PixelMap&gt; | 以Promise形式返回结果,返回image.PixelMap对象。 | | Promise&lt;image.PixelMap&gt; | 以Promise形式返回结果,返回image.PixelMap对象。 |
**示例:** **示例:**
...@@ -125,7 +127,8 @@ save(options?: ScreenshotOptions): Promise&lt;image.PixelMap&gt; ...@@ -125,7 +127,8 @@ save(options?: ScreenshotOptions): Promise&lt;image.PixelMap&gt;
"imageSize": { "imageSize": {
"width": 300, "width": 300,
"height": 300}, "height": 300},
"rotation": 0 "rotation": 0,
"displayId": 0
}; };
let promise = screenshot.save(ScreenshotOptions); let promise = screenshot.save(ScreenshotOptions);
promise.then(() => { promise.then(() => {
......
...@@ -156,6 +156,68 @@ promise.then(data => { ...@@ -156,6 +156,68 @@ promise.then(data => {
}); });
``` ```
## sms.setDefaultSmsSlotId<sup>7+</sup>
setDefaultSmsSlotId\(slotId: number,callback: AsyncCallback&lt;void&gt;\): void
设置发送短信的默认SIM卡槽ID,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | SIM卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2<br/>- -1:清除默认配置 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
sms.setDefaultSmsSlotId(0,(err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.setDefaultSmsSlotId<sup>7+</sup>
setDefaultSmsSlotId\(slotId: number\): Promise&lt;void&gt;
设置发送短信的默认SIM卡槽ID,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | SIM卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2<br/>- -1:清除默认配置 |
**返回值:**
| 类型 | 说明 |
| -------------- | ------------------------------- |
| Promise\<void\> | 无返回结果的Promise对象。 |
**示例:**
```js
let promise = sms.setDefaultSmsSlotId(0);
promise.then(data => {
console.log(`setDefaultSmsSlotId success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setDefaultSmsSlotId fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.setSmscAddr<sup>7+</sup> ## sms.setSmscAddr<sup>7+</sup>
...@@ -163,12 +225,12 @@ setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback<void\>\): ...@@ -163,12 +225,12 @@ setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback<void\>\):
设置短信服务中心(SMSC)地址,使用callback方式作为异步方法。 设置短信服务中心(SMSC)地址,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限 **需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限
**系统能力**:SystemCapability.Telephony.SmsMms **系统能力**:SystemCapability.Telephony.SmsMms
**系统API**:该接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -190,16 +252,16 @@ sms.setSmscAddr(slotId, smscAddr, (err,data) => { ...@@ -190,16 +252,16 @@ sms.setSmscAddr(slotId, smscAddr, (err,data) => {
## sms.setSmscAddr<sup>7+</sup> ## sms.setSmscAddr<sup>7+</sup>
setSmscAddr\(slotId: number, smscAddr: string\): Promise<void\> setSmscAddr\(slotId: number, smscAddr: string\): Promise\<void\>
设置短信服务中心(SMSC)地址,使用Promise方式作为异步方法。 设置短信服务中心(SMSC)地址,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限 **需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限
**系统能力**:SystemCapability.Telephony.SmsMms **系统能力**:SystemCapability.Telephony.SmsMms
**系统API**:该接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -233,12 +295,12 @@ getSmscAddr\(slotId: number, callback: AsyncCallback<string\>\): void ...@@ -233,12 +295,12 @@ getSmscAddr\(slotId: number, callback: AsyncCallback<string\>\): void
获取短信服务中心(SMSC)地址,使用callback方式作为异步方法。 获取短信服务中心(SMSC)地址,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限 **需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限
**系统能力**:SystemCapability.Telephony.SmsMms **系统能力**:SystemCapability.Telephony.SmsMms
**系统API**:该接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -262,12 +324,12 @@ getSmscAddr\(slotId: number\): Promise<string\> ...@@ -262,12 +324,12 @@ getSmscAddr\(slotId: number\): Promise<string\>
获取短信服务中心(SMSC)地址,使用Promise方式作为异步方法。 获取短信服务中心(SMSC)地址,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限 **需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限
**系统能力**:SystemCapability.Telephony.SmsMms **系统能力**:SystemCapability.Telephony.SmsMms
**系统API**:该接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
......
...@@ -55,9 +55,71 @@ getDefaultCellularDataSlotId(): Promise\<number\> ...@@ -55,9 +55,71 @@ getDefaultCellularDataSlotId(): Promise\<number\>
```js ```js
let promise = data.getDefaultCellularDataSlotId(); let promise = data.getDefaultCellularDataSlotId();
promise.then((data) => { promise.then((data) => {
console.log(`test success, promise: data->${JSON.stringify(data)}`); console.log(`getDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => { }).catch((err) => {
console.error(`test fail, promise: err->${JSON.stringify(err)}`); console.error(`getDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`);
});
```
## data.setDefaultCellularDataSlotId
setDefaultCellularDataSlotId(slotId: number,callback: AsyncCallback\<void\>): void
设置默认移动数据的SIM卡,使用callback方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | SIM卡槽ID。<br/>- 0:卡槽1。<br/>- 1:卡槽2。<br/>- -1:清除默认配置。 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。当设置成功,err为undefined,否则为错误对象。 |
**示例:**
```js
data.setDefaultCellularDataSlotId(0,(err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## data.setDefaultCellularDataSlotId
setDefaultCellularDataSlotId(slotId: number): Promise\<void\>
设置默认移动数据的SIM卡,使用Promise方式作为异步方法。
该接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | SIM卡槽ID。<br/>- 0:卡槽1。<br/>- 1:卡槽2。<br/>- -1:清除默认配置。 |
**返回值:**
| 类型 | 说明 |
| -------------- | ------------------------------- |
| Promise<\void\> | 无返回结果的Promise对象。 |
**示例:**
```js
let promise = data.setDefaultCellularDataSlotId(0);
promise.then((data) => {
console.log(`setDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
console.error(`setDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`);
}); });
``` ```
......
...@@ -601,7 +601,7 @@ getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback&lt;image.Pixel ...@@ -601,7 +601,7 @@ getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback&lt;image.Pixel
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 | | wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,调用成功则返回是否移除成功的结果,调用失败则返回error信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,调用成功则返回是否获取成功的结果,调用失败则返回error信息。 |
**示例:** **示例:**
...@@ -633,7 +633,7 @@ getPixelMap(wallpaperType: WallpaperType): Promise&lt;image.PixelMap&gt; ...@@ -633,7 +633,7 @@ getPixelMap(wallpaperType: WallpaperType): Promise&lt;image.PixelMap&gt;
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | 调用成功则返回是否移除成功的结果,调用失败则返回error信息。 | | Promise&lt;void&gt; | 调用成功则返回是否获取成功的结果,调用失败则返回error信息。 |
**示例:** **示例:**
......
...@@ -123,7 +123,7 @@ requestFullscreen(value: boolean) ...@@ -123,7 +123,7 @@ requestFullscreen(value: boolean)
- 参数 - 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ----- | ------- | | ----- | ------ | ---- | ----- | ------- |
| value | number | 是 | false | 是否全屏播放。 | | value | boolean | 是 | false | 是否全屏播放。 |
### exitFullscreen ### exitFullscreen
......
...@@ -53,7 +53,7 @@ foundation/windowmanager/ ...@@ -53,7 +53,7 @@ foundation/windowmanager/
## 相关仓 ## 相关仓
- [graphic_standard](https://gitee.com/openharmony/graphic_standard) - [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d)
- [ace_ace_engine](https://gitee.com/openharmony/ace_ace_engine) - [arkui_ace_engine](https://gitee.com/openharmony/arkui_ace_engine)
- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard) - [ability_ability_runtime](https://gitee.com/openharmony/ability_ability_runtime)
- [multimodalinput_input](https://gitee.com/openharmony/multimodalinput_input) - [multimodalinput_input](https://gitee.com/openharmony/multimodalinput_input)
...@@ -142,7 +142,7 @@ repo forall -c 'git lfs pull' ...@@ -142,7 +142,7 @@ repo forall -c 'git lfs pull'
## 修复缺陷列表 ## 修复缺陷列表
**表6** 修复缺陷ISSUE列表 **表4** 修复缺陷ISSUE列表
| ISSUE单 | 问题描述 | | ISSUE单 | 问题描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
...@@ -153,7 +153,7 @@ repo forall -c 'git lfs pull' ...@@ -153,7 +153,7 @@ repo forall -c 'git lfs pull'
## 遗留缺陷列表 ## 遗留缺陷列表
**表7** 遗留缺陷列表 **表5** 遗留缺陷列表
| ISSUE | 问题描述 | 影响 | 计划解决日期 | | ISSUE | 问题描述 | 影响 | 计划解决日期 |
| ------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------- | ------------ | | ------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------- | ------------ |
......
...@@ -138,7 +138,7 @@ ArkUI支持AbilityComponent组件将应用界面(Ability)作为控件嵌入 ...@@ -138,7 +138,7 @@ ArkUI支持AbilityComponent组件将应用界面(Ability)作为控件嵌入
### 特性变更 ### 特性变更
**表2** 版本特性变更表 **表3** 版本特性变更表
| 子系统名称 | 标准系统 | 轻量、小型系统 | | 子系统名称 | 标准系统 | 轻量、小型系统 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
...@@ -156,7 +156,7 @@ ArkUI支持AbilityComponent组件将应用界面(Ability)作为控件嵌入 ...@@ -156,7 +156,7 @@ ArkUI支持AbilityComponent组件将应用界面(Ability)作为控件嵌入
| 全球化 | -&nbsp;支持获取资源的同步接口,支持按资源名称获取资源,支持获取float等类型资源。<br/>-&nbsp;新增对MCC/MNC类型限定词资源的支持。<br/>-&nbsp;支持应用内不同模块独立编译。<br/>-&nbsp;支持获取区域偏好的年月日顺序。<br/>-&nbsp;获取本地文字的读音表达,例如汉字转拼音。<br/>主要涉及如下需求:<br/>I596AO&nbsp;支持MCC/MNC限定词<br/>I58ZSE&nbsp;资源管理接口能力增强<br/>I58ZSG&nbsp;资源ID生成<br/>I4WM02&nbsp;音译<br/>I4WK2O&nbsp;日期顺序获取 | NA | | 全球化 | -&nbsp;支持获取资源的同步接口,支持按资源名称获取资源,支持获取float等类型资源。<br/>-&nbsp;新增对MCC/MNC类型限定词资源的支持。<br/>-&nbsp;支持应用内不同模块独立编译。<br/>-&nbsp;支持获取区域偏好的年月日顺序。<br/>-&nbsp;获取本地文字的读音表达,例如汉字转拼音。<br/>主要涉及如下需求:<br/>I596AO&nbsp;支持MCC/MNC限定词<br/>I58ZSE&nbsp;资源管理接口能力增强<br/>I58ZSG&nbsp;资源ID生成<br/>I4WM02&nbsp;音译<br/>I4WK2O&nbsp;日期顺序获取 | NA |
| ArkUI | -&nbsp;支持组件布局边界显示。<br/>-&nbsp;增强XComponent组件的鼠标操作,并且优化了输入法弹出时的布局调整,在应用性能方面进行了优化。<br/>-&nbsp;增强分栏与侧边栏组件能力,支持拖拽自动隐藏功能。<br/>-&nbsp;AbilityComponent组件支持,支持将应用界面(Ability)作为控件嵌入其他应用显示。<br/>主要涉及需求如下:<br/>I58ZPY&nbsp;支持解码降采样图片性能化<br/>I58ZPX&nbsp;支持CPU提频优化动画性能<br/>I58ZPW&nbsp;新增AbilityComponent组件<br/>I58ZPS&nbsp;XComponent组件鼠标事件<br/>I58ZPR&nbsp;支持输入框拉起输入法应用时自动布局<br/>I58ZPQ&nbsp;分栏、侧边栏支持自由拖拽到小于最小宽度后自动隐藏功能<br/>I58ZPP&nbsp;图形绘制/辅助类组件支持显示布局边界<br/>I58ZPO&nbsp;按钮/选择/信息展示/动效类组件支持显示布局边界<br/>I58ZPN&nbsp;文本/输入/图片/视频/媒体类组件支持显示布局边界 | NA | | ArkUI | -&nbsp;支持组件布局边界显示。<br/>-&nbsp;增强XComponent组件的鼠标操作,并且优化了输入法弹出时的布局调整,在应用性能方面进行了优化。<br/>-&nbsp;增强分栏与侧边栏组件能力,支持拖拽自动隐藏功能。<br/>-&nbsp;AbilityComponent组件支持,支持将应用界面(Ability)作为控件嵌入其他应用显示。<br/>主要涉及需求如下:<br/>I58ZPY&nbsp;支持解码降采样图片性能化<br/>I58ZPX&nbsp;支持CPU提频优化动画性能<br/>I58ZPW&nbsp;新增AbilityComponent组件<br/>I58ZPS&nbsp;XComponent组件鼠标事件<br/>I58ZPR&nbsp;支持输入框拉起输入法应用时自动布局<br/>I58ZPQ&nbsp;分栏、侧边栏支持自由拖拽到小于最小宽度后自动隐藏功能<br/>I58ZPP&nbsp;图形绘制/辅助类组件支持显示布局边界<br/>I58ZPO&nbsp;按钮/选择/信息展示/动效类组件支持显示布局边界<br/>I58ZPN&nbsp;文本/输入/图片/视频/媒体类组件支持显示布局边界 | NA |
| 程序访问控制 | -&nbsp;新增SELinux针对service、hdf_service的标签保护能力。<br/>-&nbsp;新增Native服务的权限配置及校验能力。<br/>主要涉及需求如下:<br/>I58ZO1&nbsp;针对service,提供selinux标签保护能力<br/>I58ZO2&nbsp;针对hdf_service,提供selinux标签保护能力<br/>I58ZO3&nbsp;accessToken支持native服务的权限校验机制 | NA | | 程序访问控制 | -&nbsp;新增SELinux针对service、hdf_service的标签保护能力。<br/>-&nbsp;新增Native服务的权限配置及校验能力。<br/>主要涉及需求如下:<br/>I58ZO1&nbsp;针对service,提供selinux标签保护能力<br/>I58ZO2&nbsp;针对hdf_service,提供selinux标签保护能力<br/>I58ZO3&nbsp;accessToken支持native服务的权限校验机制 | NA |
| 公共基础类库 | TypedArray和SharedArrayBuffer支持ECMA&nbsp;2021规范。<br/>主要涉及如下需求:<br/>I58ZPZ&nbsp;支持TypeArray&nbsp;2021规范<br/>I58ZQ0&nbsp;支持&nbsp;shard&nbsp;array&nbsp;buffer&nbsp;2021规范 | NA | | 公共基础类库 | TypedArray和SharedArrayBuffer支持ECMA&nbsp;2021规范。<br/>主要涉及如下需求:<br/>I58ZPZ&nbsp;支持TypedArray&nbsp;2021规范<br/>I58ZQ0&nbsp;支持&nbsp;shard&nbsp;array&nbsp;buffer&nbsp;2021规范 | NA |
| 语言编译运行时 | -&nbsp;方舟虚拟机支持多实例调试,以及条件断点和watch表达式。<br/>主要涉及如下需求:<br/>I58ZQE&nbsp;方舟支持多实例调试<br/>I58ZQD&nbsp;方舟支持条件断点<br/>I58ZQB&nbsp;方舟支持watch变量及表达式<br/>I58ZQ8&nbsp;支持TSAOT优化编译器生成代码支持ArkJS运行时GC特性<br/>I58ZQ7&nbsp;支持TSAOT优化编译器后端机器码生成框架适配 | NA | | 语言编译运行时 | -&nbsp;方舟虚拟机支持多实例调试,以及条件断点和watch表达式。<br/>主要涉及如下需求:<br/>I58ZQE&nbsp;方舟支持多实例调试<br/>I58ZQD&nbsp;方舟支持条件断点<br/>I58ZQB&nbsp;方舟支持watch变量及表达式<br/>I58ZQ8&nbsp;支持TSAOT优化编译器生成代码支持ArkJS运行时GC特性<br/>I58ZQ7&nbsp;支持TSAOT优化编译器后端机器码生成框架适配 | NA |
| 升级服务 | 新增适配RK&nbsp;3568。<br/>主要涉及如下需求:<br/>I58ZSM&nbsp;update_service部件支持RK&nbsp;3568升级适配<br/>I58ZSO&nbsp;updater部件支持RK&nbsp;3568升级适配 | NA | | 升级服务 | 新增适配RK&nbsp;3568。<br/>主要涉及如下需求:<br/>I58ZSM&nbsp;update_service部件支持RK&nbsp;3568升级适配<br/>I58ZSO&nbsp;updater部件支持RK&nbsp;3568升级适配 | NA |
| Misc软件服务 | 补齐API6前的http文件上传、下载接口。<br/>主要涉及如下需求:<br/>I58ZSC&nbsp;【download】支持\@system.request接口<br/>I53J82&nbsp;&nbsp;【upload】支持\@system.request接口 | NA | | Misc软件服务 | 补齐API6前的http文件上传、下载接口。<br/>主要涉及如下需求:<br/>I58ZSC&nbsp;【download】支持\@system.request接口<br/>I53J82&nbsp;&nbsp;【upload】支持\@system.request接口 | NA |
...@@ -182,7 +182,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_ ...@@ -182,7 +182,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_
### Samples ### Samples
**表2** 新增Samples **表4** 新增Samples
| 子系统 | 名称 | 简介 | 开发语言 | | 子系统 | 名称 | 简介 | 开发语言 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -214,7 +214,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_ ...@@ -214,7 +214,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_
## 修复缺陷列表 ## 修复缺陷列表
**表6** 修复缺陷ISSUE列表 **表5** 修复缺陷ISSUE列表
| ISSUE单 | 问题描述 | | ISSUE单 | 问题描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
...@@ -223,7 +223,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_ ...@@ -223,7 +223,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_
## 遗留缺陷列表 ## 遗留缺陷列表
**表7** 遗留缺陷列表 **表6** 遗留缺陷列表
| ISSUE | 问题描述 | 影响 | 计划解决日期 | | ISSUE | 问题描述 | 影响 | 计划解决日期 |
| ------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------ | ------------ | | ------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------ | ------------ |
......
# ArkUI子系统JS API变更 # ArkUI子系统JS API变更
OpenHarmony 3.2 Beta1版本相较于OpenHarmony 3.1 Release版本,电源服务子系统的API变更如下: OpenHarmony 3.2 Beta1版本相较于OpenHarmony 3.1 Release版本,ArkUI子系统的API变更如下:
## 接口变更 ## 接口变更
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册