diff --git a/en/application-dev/ability/ability-assistant-guidelines.md b/en/application-dev/ability/ability-assistant-guidelines.md index 7af76245661a90090b4ba2533b5f24ea5e9a6b09..af99d83038589c063817b92084e89c808863155f 100644 --- a/en/application-dev/ability/ability-assistant-guidelines.md +++ b/en/application-dev/ability/ability-assistant-guidelines.md @@ -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. -## Development Guidelines - -The ability assistant is pre-installed in the device environment. You can directly invoke the tool using commands. - -### Query-related Commands +## Query-related Commands - **help** @@ -22,7 +18,7 @@ The ability assistant is pre-installed in the device environment. You can direct aa help ``` -### Ability-related Commands +## Ability-related Commands - **start** @@ -69,18 +65,18 @@ The ability assistant is pre-installed in the device environment. You can direct - **dump** - Prints ability-related information. + Prints ability related information. | Name | Level-2 Parameter | Description | | ----------------- | -------------------- | ------------------------------------------------------------ | | -h/--help | - | Prints help information. | | -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.
The following values are available for **type**:
- NORMAL
- DEFAULT_STANDARD
- DEFAULT_SINGLE
- LAUNCHER | + | -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Prints mission stack information.
The following values are available for **type**:
NORMAL
DEFAULT_STANDARD
DEFAULT_SINGLE
LAUNCHER | | -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.
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. | | -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.
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** diff --git a/en/application-dev/ability/ability-brief.md b/en/application-dev/ability/ability-brief.md index be6473c975266e41fee1e850fe5206eb7a624f85..dee25352d7df1e828eada909bde107554a168bd9 100644 --- a/en/application-dev/ability/ability-brief.md +++ b/en/application-dev/ability/ability-brief.md @@ -1,20 +1,20 @@ # 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. -- 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. -- 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. +- 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 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. | 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. | -| 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.| +| Intra-process object sharing| Not supported | Supported | +| 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). | 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) -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 +For details about the two models, see [FA Model Overview](fa-brief.md) and [Stage Model Overview](stage-brief.md). +## 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) diff --git a/en/application-dev/ability/fa-brief.md b/en/application-dev/ability/fa-brief.md index 670c741d84218a261df7fa09d88e42c9b69a693f..e3374b85a5e16e76a4b13dc58b1950e442a1313b 100644 --- a/en/application-dev/ability/fa-brief.md +++ b/en/application-dev/ability/fa-brief.md @@ -3,22 +3,15 @@ ## 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 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 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. -## 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 -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.** ![fa-pageAbility-lifecycle](figures/fa-pageAbility-lifecycle.png) @@ -30,6 +23,20 @@ Currently, the **app.js** file provides only the **onCreate** and **onDestroy** ## 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) +## 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) diff --git a/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png b/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png index ab6e01af0cf96f852c37696fe0c23425219eca39..59a06741053c85cab6ea90b41bd16a6f2e1ff508 100644 Binary files a/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png and b/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png differ diff --git a/en/application-dev/ability/stage-brief.md b/en/application-dev/ability/stage-brief.md index 8d4ab32e671a3364776317f724d7ce51c218bfcf..eb6b66c5507d0aab80d9d22576519f70aba351a2 100644 --- a/en/application-dev/ability/stage-brief.md +++ b/en/application-dev/ability/stage-brief.md @@ -1,6 +1,6 @@ # Stage Model Overview -### Design Ideas +## Design Ideas 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. ![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** @@ -20,10 +20,10 @@ The stage model is designed based on the following considerations: - **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. @@ -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. - **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. -- **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. -- **Ability**: provides lifecycle callback, holds the **AbilityContext** class, and supports component continuation and collaboration. +- **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**: 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**. - **WindowStage**: local window manager. - **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) -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: @@ -62,11 +62,11 @@ Abilities can be started in any of the following modes: 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) -### 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: @@ -82,9 +82,9 @@ The following figure uses the widget scenario as an example. You can inherit fro ![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. diff --git a/en/application-dev/media/audio-overview.md b/en/application-dev/media/audio-overview.md index c313e9315eb46c440efb116e318148a666d44012..e1fd93eab8238b8ae55c9ce3dff2e807a1585a00 100755 --- a/en/application-dev/media/audio-overview.md +++ b/en/application-dev/media/audio-overview.md @@ -1,30 +1,20 @@ -# Audio Overview +# Audio Overview 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** ->Due to permission issues, the above features are temporarily unavailable for the standard system. +## Basic Concepts -## Basic Concepts +- **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. - -- **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. +- **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. diff --git a/en/application-dev/media/audio-renderer.md b/en/application-dev/media/audio-renderer.md index 8e2be849396373aaa68ee7c4eb5e36a4cad28c1c..82a0753b66384e6f1a991ba97f7d6c7580936e0e 100644 --- a/en/application-dev/media/audio-renderer.md +++ b/en/application-dev/media/audio-renderer.md @@ -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). - - ## How to Develop 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 var audioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW } @@ -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). ```js - audioRenderer.on('interrupt', (interruptEvent) => { - console.info('InterruptEvent Received'); - console.info('InterruptType: ' + interruptEvent.eventType); - console.info('InterruptForceType: ' + interruptEvent.forceType); - console.info('AInterruptHint: ' + interruptEvent.hintType); - - if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { - switch (interruptEvent.hintType) { - // Force Pause: Action was taken by framework. - // Halt the write calls to avoid data loss. - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - break; - // Force Stop: Action was taken by framework. - // Halt the write calls to avoid data loss. - case audio.InterruptHint.INTERRUPT_HINT_STOP: - isPlay = false; - break; - // Force Duck: Action was taken by framework, - // just notifying the app that volume has been reduced. - case audio.InterruptHint.INTERRUPT_HINT_DUCK: - break; - // Force Unduck: Action was taken by framework, - // just notifying the app that volume has been restored. - case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: - break; - } - } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { - switch (interruptEvent.hintType) { - // Share Resume: Action is to be taken by App. - // Resume the force paused stream if required. - case audio.InterruptHint.INTERRUPT_HINT_RESUME: - startRenderer(); - break; - // Share Pause: Stream has been interrupted, - // It can choose to pause or play concurrently. - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - pauseRenderer(); - break; - } - } - }); + audioRenderer.on('interrupt', (interruptEvent) => { + console.info('InterruptEvent Received'); + console.info('InterruptType: ' + interruptEvent.eventType); + console.info('InterruptForceType: ' + interruptEvent.forceType); + console.info('AInterruptHint: ' + interruptEvent.hintType); + + if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { + switch (interruptEvent.hintType) { + // Force Pause: Action was taken by framework. + // Halt the write calls to avoid data loss. + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + isPlay = false; + break; + // Force Stop: Action was taken by framework. + // Halt the write calls to avoid data loss. + case audio.InterruptHint.INTERRUPT_HINT_STOP: + isPlay = false; + break; + // Force Duck: Action was taken by framework, + // just notifying the app that volume has been reduced. + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + break; + // Force Unduck: Action was taken by framework, + // just notifying the app that volume has been restored. + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + break; + } + } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { + switch (interruptEvent.hintType) { + // Share Resume: Action is to be taken by App. + // Resume the force paused stream if required. + case audio.InterruptHint.INTERRUPT_HINT_RESUME: + startRenderer(); + break; + // Share Pause: Stream has been interrupted, + // It can choose to pause or play concurrently. + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + isPlay = false; + pauseRenderer(); + break; + } + } + }); ``` 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 5. (Optional) Call **pause()** or **stop()** to pause or stop rendering. ```js - async function pauseRenderer() { - var state = audioRenderer.state; - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Renderer is not running'); - return; - } - - await audioRenderer.pause(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_PAUSED) { - console.info('Renderer paused'); - } else { - 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(); + async function pauseRenderer() { + var state = audioRenderer.state; + if (state != audio.AudioState.STATE_RUNNING) { + console.info('Renderer is not running'); + return; + } + + await audioRenderer.pause(); + + state = audioRenderer.state; + if (state == audio.AudioState.STATE_PAUSED) { + console.info('Renderer paused'); + } else { + console.error('Renderer pause failed'); + } + } - state = audioRenderer.state; - if (state == audio.AudioState.STATE_STOPPED) { - console.info('Renderer stopped'); - } else { - console.error('Renderer stop 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; + 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 **AudioRenderer** uses a large number of system resources. Therefore, ensure that the resources are released after the task is complete. ```js - async function releaseRenderer() { - if (state_ == RELEASED || state_ == NEW) { - console.info('Resourced already released'); - return; - } - - await audioRenderer.release(); - - state = audioRenderer.state; - if (state == STATE_RELEASED) { - console.info('Renderer released'); - } else { - console.info('Renderer release failed'); - } - - } - ``` + async function releaseRenderer() { + if (state_ == RELEASED || state_ == NEW) { + console.info('Resourced already released'); + return; + } - + await audioRenderer.release(); + + state = audioRenderer.state; + if (state == STATE_RELEASED) { + console.info('Renderer released'); + } else { + console.info('Renderer release failed'); + } + + } + ``` diff --git a/en/application-dev/media/camera.md b/en/application-dev/media/camera.md index ef72e05d5b7d5b83d827f129c28d8d0574dea74e..5af14112df2959acbcfc606c9cd2938860ad6f85 100644 --- a/en/application-dev/media/camera.md +++ b/en/application-dev/media/camera.md @@ -54,16 +54,16 @@ await cameraManager.getCameras((err, cameras) => { cameraArray = cameras }) - for(let cameraIndex = 0; cameraIndex < cameraArray.length; cameraIndex) { - console.log('cameraId : ' + cameraArray[cameraIndex].cameraId) // Obtain the camera ID. - console.log('cameraPosition : ' + cameraArray[cameraIndex].cameraPosition) // Obtain the camera position. - console.log('cameraType : ' + cameraArray[cameraIndex].cameraType) // Obtain the camera type. - console.log('connectionType : ' + cameraArray[cameraIndex].connectionType) // Obtain the camera connection type. - } - - // Create a camera input stream. - let cameraInput - await cameraManager.createCameraInput(cameraArray[0].cameraId).then((input) => { +for(let cameraIndex = 0; cameraIndex < cameraArray.length; cameraIndex) { + console.log('cameraId : ' + cameraArray[cameraIndex].cameraId) // Obtain the camera ID. + console.log('cameraPosition : ' + cameraArray[cameraIndex].cameraPosition) // Obtain the camera position. + console.log('cameraType : ' + cameraArray[cameraIndex].cameraType) // Obtain the camera type. + console.log('connectionType : ' + cameraArray[cameraIndex].connectionType) // Obtain the camera connection type. +} + +// Create a camera input stream. +let cameraInput +await cameraManager.createCameraInput(cameraArray[0].cameraId).then((input) => { console.log('Promise returned with the CameraInput instance'); cameraInput = input }) diff --git a/en/application-dev/media/video-playback.md b/en/application-dev/media/video-playback.md index 4317e0362769936b16844f22d592e5163dfbcdff..4045cc12c9f198184dce1fd531caa0d783c60ff7 100644 --- a/en/application-dev/media/video-playback.md +++ b/en/application-dev/media/video-playback.md @@ -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) - - **Figure 2** Layer 0 diagram of video playback ![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. 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, 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). - -*Note: **setSurface** must be called after the URL is set but before **prepare** is called. +For details about how to create an XComponent, see [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md). ```js import media from '@ohos.multimedia.media' @@ -120,7 +116,7 @@ export class VideoPlayerDemo { console.info('pause success'); }, 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; await videoPlayer.getTrackDescription().then((arrlist) => { if (typeof (arrlist) != 'undefined') { diff --git a/en/application-dev/reference/apis/js-apis-DataUriUtils.md b/en/application-dev/reference/apis/js-apis-DataUriUtils.md index 345eaa8b0960856001d4ce3e8395943e271bf155..584b7e1285c0087bc1109bd32d50eb1143360df1 100644 --- a/en/application-dev/reference/apis/js-apis-DataUriUtils.md +++ b/en/application-dev/reference/apis/js-apis-DataUriUtils.md @@ -1,6 +1,7 @@ # DataUriUtils Module -> **NOTE**
+> **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. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md index 2b1fdce8a973676f00cb4a75cd3b1d5e704d5564..b858d93cbd061d4f1df583ac9d4045e152105b7a 100644 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ b/en/application-dev/reference/apis/js-apis-ability-context.md @@ -78,7 +78,7 @@ Starts an ability. This API uses a callback to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | 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<void> | Yes| Callback used to return the result.| **Example** @@ -111,7 +111,7 @@ Starts an ability. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | 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** @@ -180,7 +180,7 @@ Starts an ability. This API uses a callback to return the result when the abilit | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | 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<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | 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 | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | 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** diff --git a/en/application-dev/reference/apis/js-apis-ability-errorCode.md b/en/application-dev/reference/apis/js-apis-ability-errorCode.md index d882c9b5ce0870438d9372a8470efcf5c5dad5b8..cc0197f022957aadb0dd784c1d4ae8c6e0c50005 100644 --- a/en/application-dev/reference/apis/js-apis-ability-errorCode.md +++ b/en/application-dev/reference/apis/js-apis-ability-errorCode.md @@ -1,9 +1,8 @@ # ErrorCode - -> **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. - +> **NOTE** +> +> 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 @@ -17,9 +16,9 @@ Defines the error code used when the ability is started. **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Value | Description | +| Name | Value | Description | | ------------------------------ | ---- | ---------------------------------------- | -| NO_ERROR | 0 | No error occurs. | -| INVALID_PARAMETER | -1 | Invalid parameter. | -| ABILITY_NOT_FOUND | -2 | The ability is not found. | -| PERMISSION_DENY | -3 | Permission denied. | +| NO_ERROR | 0 | No error occurs. | +| INVALID_PARAMETER | -1 | Invalid parameter.| +| ABILITY_NOT_FOUND | -2 | The ability is not found.| +| PERMISSION_DENY | -3 | Permission denied. | diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md index 1190acad72e203ec1d42e7f2c4979938156bad50..e1d57d47b1b77f1695f8ec79ac49bfbb22422d05 100644 --- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -1,17 +1,15 @@ # wantConstant - -> **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. - ## Modules to Import ``` import wantConstant from '@ohos.ability.wantConstant' ``` - ## wantConstant.Action **System capability**: SystemCapability.Ability.AbilityBase @@ -20,32 +18,32 @@ Lists the permissions. | Common Event Macro | Common Event Name | Subscriber Permission | | ------------ | ------------------ | ---------------------- | -| ACTION_HOME | ohos.want.action.home | None | -| ACTION_DIAL | ohos.want.action.dial | None | -| ACTION_SEARCH | ohos.want.action.search | None | -| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None | -| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None | -| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | -| ACTION_SET_ALARM | ohos.want.action.setAlarm | None | -| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None | -| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None | -| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None | -| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None | -| ACTION_SEND_SMS | ohos.want.action.sendSms | None | -| ACTION_CHOOSE | ohos.want.action.choose | None | -| ACTION_IMAGE_CAPTURE8+ | ohos.want.action.imageCapture | None | -| ACTION_VIDEO_CAPTUR8+ | ohos.want.action.videoCapture | None | -| ACTION_SELECT | ohos.want.action.select | None | -| ACTION_SEND_DATA | ohos.want.action.sendData | None | -| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None | -| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None | -| ACTION_VIEW_DATA | ohos.want.action.viewData | None | -| ACTION_EDIT_DATA | ohos.want.action.editData | None | -| INTENT_PARAMS_INTENT | ability.want.params.INTENT | None | -| INTENT_PARAMS_TITLE | ability.want.params.TITLE | None | -| ACTION_FILE_SELECT7+ | ohos.action.fileSelect | None | -| PARAMS_STREAM7+ | ability.params.stream | None | -| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | None | +| ACTION_HOME | ohos.want.action.home | None | +| ACTION_DIAL | ohos.want.action.dial | None | +| ACTION_SEARCH | ohos.want.action.search | None | +| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None | +| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None | +| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | +| ACTION_SET_ALARM | ohos.want.action.setAlarm | None | +| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None | +| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None | +| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None | +| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None | +| ACTION_SEND_SMS | ohos.want.action.sendSms | None | +| ACTION_CHOOSE | ohos.want.action.choose | None | +| ACTION_IMAGE_CAPTURE8+ | ohos.want.action.imageCapture | None | +| ACTION_VIDEO_CAPTUR8+ | ohos.want.action.videoCapture | None | +| ACTION_SELECT | ohos.want.action.select | None | +| ACTION_SEND_DATA | ohos.want.action.sendData | None | +| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None | +| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None | +| ACTION_VIEW_DATA | ohos.want.action.viewData | None | +| ACTION_EDIT_DATA | ohos.want.action.editData | None | +| INTENT_PARAMS_INTENT | ability.want.params.INTENT | None | +| INTENT_PARAMS_TITLE | ability.want.params.TITLE | None | +| ACTION_FILE_SELECT7+ | ohos.action.fileSelect | None | +| PARAMS_STREAM7+ | ability.params.stream | None | +| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | None | ## wantConstant.Entity @@ -56,12 +54,12 @@ Lists the permissions. | Common Event Macro | Common Event Name | Subscriber Permission | | ------------ | ------------------ | ---------------------- | -| ENTITY_DEFAULT | entity.system.default | None | -| ENTITY_HOME | entity.system.homel | None | -| ENTITY_VOICE | ENTITY_VOICE | None | -| ENTITY_BROWSABLE | entity.system.browsable | None | -| ENTITY_VIDEO | entity.system.video | None | -| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | +| ENTITY_DEFAULT | entity.system.default | None | +| ENTITY_HOME | entity.system.homel | None | +| ENTITY_VOICE | ENTITY_VOICE | None | +| ENTITY_BROWSABLE | entity.system.browsable | None | +| ENTITY_VIDEO | entity.system.video | None | +| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | ## flags @@ -70,19 +68,19 @@ Lists the permissions. | Name | Value | Description | | ------------------------------------ | ---------- | ------------------------------------------------------------ | -| 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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.| diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index dbe86ab6c071bda8d824b0dd79b417569cfda5ac..6c8d70d16381f7b6875728d0045c2d32e400c757 100644 --- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -1,6 +1,9 @@ -# Ability Access Control +# Ability Access Control -> **NOTE**
+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. ## Modules to Import @@ -96,14 +99,12 @@ Grants a user granted permission to an application. This API uses a promise to r var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; 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 => { console.log(`promise: data->${JSON.stringify(data)}`); }); ``` - - ### grantUserGrantedPermission grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback<number>): void @@ -129,8 +130,12 @@ Grants a user granted permission to an application. This API uses an asynchronou var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; let permissionFlag = 1; -AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => { - console.log(`callback: data->${JSON.stringify(data)}`); +AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, 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 var AtManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; let permissionFlag = 1; -AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => { - console.log(`callback: data->${JSON.stringify(data)}`); +AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, data) => { + if (err) { + console.log(`callback: err->${JSON.stringify(err)}`); + } else { + console.log(`callback: data->${JSON.stringify(data)}`); + } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md b/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md index 65769dc7a2fbe62443957c415ca5c095e9473d52..a609e0df688e7a9cc5b32ea25907eda95ab14c47 100644 --- a/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md +++ b/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md @@ -1,6 +1,7 @@ # AbilityDelegatorRegistry -> **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. ## Modules to Import @@ -9,21 +10,19 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityLifecycleState Enumerates the ability lifecycle states. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ------------- | ---- | --------------------------- | - | UNINITIALIZED | 0 | The ability is in an invalid state. | - | CREATE | 1 | The ability is created. | - | FOREGROUND | 2 | The ability is running in the foreground. | - | BACKGROUND | 3 | The ability is running in the background. | - | DESTROY | 4 | The ability is destroyed. | +| Name | Value | Description | +| ------------- | ---- | --------------------------- | +| UNINITIALIZED | 0 | The ability is in an invalid state. | +| CREATE | 1 | The ability is created.| +| FOREGROUND | 2 | The ability is running in the foreground. | +| BACKGROUND | 3 | The ability is running in the background. | +| DESTROY | 4 | The ability is destroyed.| @@ -37,9 +36,9 @@ Obtains the **AbilityDelegator** object of the application. **Return value** - | 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. | +| 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.| **Example** @@ -61,9 +60,9 @@ Obtains the **AbilityDelegatorArgs** object of the application. **Return value** - | 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. | +| 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.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md index 9223a481fb8a9c6f3db8366d664958294e370704..508463e3a428fffe336de4ae2c986623fb54d3b1 100644 --- a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md @@ -1,9 +1,9 @@ # AbilityRunningInfo -> **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. - Provides ability running information. ## Modules to Import @@ -11,13 +11,11 @@ Provides ability running information. ```js import abilitymanager from '@ohos.application.abilityManager'; ``` -## Usage +## Usage The ability running information is obtained by using the **getAbilityRunningInfos** API in **abilityManager**. - - ```js import abilitymanager from '@ohos.application.abilityManager'; abilitymanager.getAbilityRunningInfos((err,data) => { diff --git a/en/application-dev/reference/apis/js-apis-abilitystagecontext.md b/en/application-dev/reference/apis/js-apis-abilitystagecontext.md index c1552ef27358e1e5fd687b2003520105c82980eb..65705aae3936cc2c9e9643f6142be6de6564124b 100644 --- a/en/application-dev/reference/apis/js-apis-abilitystagecontext.md +++ b/en/application-dev/reference/apis/js-apis-abilitystagecontext.md @@ -1,8 +1,9 @@ # AbilityStageContext -> **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. - +> **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 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). @@ -14,11 +15,8 @@ import AbilityStage from '@ohos.application.AbilityStage'; ## Usage - The ability stage context is obtained through an **AbilityStage** instance. - - ```js import AbilityStage from '@ohos.application.AbilityStage'; class MyAbilityStage extends AbilityStage { @@ -28,7 +26,6 @@ class MyAbilityStage extends AbilityStage { } ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core diff --git a/en/application-dev/reference/apis/js-apis-application-StartOptions.md b/en/application-dev/reference/apis/js-apis-application-StartOptions.md index b2a29f392acdac4b4e9bdfbdd1b31c7809671ce5..e221f4506244b56ea43e24ef916085ef1f3fac63 100644 --- a/en/application-dev/reference/apis/js-apis-application-StartOptions.md +++ b/en/application-dev/reference/apis/js-apis-application-StartOptions.md @@ -1,15 +1,14 @@ # StartOptions -> **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. - +> **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 APIs of this module can be used only in the stage model. **StartOptions** is the basic communication component of the system. - ## Modules to Import - ``` import StartOptions from '@ohos.application.StartOptions'; ``` @@ -18,8 +17,8 @@ import StartOptions from '@ohos.application.StartOptions'; **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. | -| displayId | Yes| No | number | No | Display ID. | +| [windowMode](js-apis-window.md#windowmode) | Yes| No| number | No| Window mode.| +| displayId | Yes| No| number | No| Display ID.| diff --git a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md index 1db280b4b8c111250cd1cb4230c5e665184cb0df..3b2a958f7f403cade73487d61ff3695e5935d1bb 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md @@ -1,28 +1,26 @@ # AbilityConstant -> **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. - +> **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 APIs of this module can be used only in the stage model. Provides parameters related to ability launch. - ## Modules to Import - ```js import AbilityConstant from '@ohos.application.AbilityConstant'; ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | launchReason | LaunchReason | Yes | Yes | Ability launch reason. | - | lastExitReason | LastExitReason | Yes | Yes | Reason for the last exit. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| launchReason | LaunchReason| Yes| Yes| Ability launch reason.| +| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.| ## AbilityConstant.LaunchReason @@ -30,12 +28,12 @@ Enumerates ability launch reasons. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ----------------------------- | ---- | ------------------------------------------------------------ | - | UNKNOWN | 0 | Unknown reason. | - | START_ABILITY | 1 | Ability startup. | - | CALL | 2 | Call. | - | CONTINUATION | 3 | Ability continuation. | +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| UNKNOWN | 0 | Unknown reason.| +| START_ABILITY | 1 | Ability startup.| +| CALL | 2 | Call.| +| CONTINUATION | 3 | Ability continuation.| ## AbilityConstant.LastExitReason @@ -44,11 +42,11 @@ Enumerates reasons for the last exit. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ----------------------------- | ---- | ------------------------------------------------------------ | - | UNKNOWN | 0 | Unknown reason. | - | ABILITY_NOT_RESPONDING | 1 | The ability does not respond. | - | NORMAL | 2 | Normal status. | +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| UNKNOWN | 0 | Unknown reason.| +| ABILITY_NOT_RESPONDING | 1 | The ability does not respond.| +| NORMAL | 2 | Normal status.| ## AbilityConstant.OnContinueResult @@ -57,8 +55,8 @@ Enumerates ability continuation results. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ----------------------------- | ---- | ------------------------------------------------------------ | - | AGREE | 0 | Continuation agreed. | - | REJECT | 1 | Continuation denied. | - | MISMATCH | 2 | Mismatch. | +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| AGREE | 0 | Continuation agreed.| +| REJECT | 1 | Continuation denied.| +| MISMATCH | 2 | Mismatch.| diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md index e781aa0db5f13e434d049101ea35b8b1cf38aff0..ec8655be70c9037622328066aa63d2cc643421d1 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md @@ -1,7 +1,7 @@ # AbilityDelegator -> **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. ## Modules to Import @@ -10,8 +10,6 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityDelegator ### addAbilityMonitor9+ diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md index 72a1eefa41398259ea56e28e7745b975859432c5..ad43acc77bd9e7ff82b9d5bb7e01467e6b36c656 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md @@ -1,7 +1,7 @@ # AbilityDelegatorArgs -> **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. ## Modules to Import @@ -10,8 +10,6 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityDelegatorArgs Describes the test parameters. diff --git a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md b/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md index 9ac9b6868ec31a1b7e9f8b164491a6fec2e61997..02803ad07bcde72288958a9be4981a15b8b4b555 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md @@ -1,11 +1,19 @@ # AbilityLifecycleCallback -> **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. +> **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 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. +## Modules to Import + +```js +import AbilityLifecycleCallback from "@ohos.application.abilityLifecycleCallback"; +``` + ## AbilityLifecycleCallback.onAbilityCreate diff --git a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md index b31687b7edc2b3f6059d4f45fbf305c357d5a71b..e7f017b48ebb0f440b021386e7a427e2d0a59852 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md @@ -1,8 +1,8 @@ # AbilityMonitor > **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 @@ -10,8 +10,6 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityMonitor Describes an ability monitor. diff --git a/en/application-dev/reference/apis/js-apis-application-abilitystage.md b/en/application-dev/reference/apis/js-apis-application-abilitystage.md index bb9c758f36dc8456d817cb655303591f7dfa09a7..731d21305f151cd0318b14813e270bc14a27a3d2 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilitystage.md +++ b/en/application-dev/reference/apis/js-apis-application-abilitystage.md @@ -1,15 +1,14 @@ # AbilityStage -> **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. - +> **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 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. - ## Modules to Import - ```js import AbilityStage from '@ohos.application.AbilityStage'; ``` @@ -22,8 +21,6 @@ Called when the application is created. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - - **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-application-missionInfo.md index 8371830fe05b7b9ab89973f5a9390160734547ef..05938521e10970192409f856e68b816c18d3f3f0 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionInfo.md +++ b/en/application-dev/reference/apis/js-apis-application-missionInfo.md @@ -1,6 +1,7 @@ # MissionInfo -> **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. ## Modules to Import @@ -9,7 +10,6 @@ import MissionInfo from '@ohos.application.missionInfo' ``` - ## MissionInfo Provides the mission information. diff --git a/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md b/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md index d96a1d1bec16e7c05b7e802fe13ca8a895c6eac3..e0cddeee652418cdd714507cee826971fce73e28 100644 --- a/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md +++ b/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md @@ -1,7 +1,7 @@ # ShellCmdResult -> **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. ## Modules to Import @@ -10,8 +10,6 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## ShellCmdResult Describes the shell command execution result. diff --git a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md index 0a0a18ae37b50456db8c5e9d81ebceaaf675f18f..abd004e82d684fc3b038aebf8fb1153602137476 100644 --- a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md @@ -1,9 +1,9 @@ # StaticSubscriberExtensionAbility - -> **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. - +> **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 APIs of this module can be used only in the stage model. ## Modules to Import ``` @@ -20,9 +20,9 @@ Callback of the common event of a static subscriber. **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** diff --git a/en/application-dev/reference/apis/js-apis-appmanager.md b/en/application-dev/reference/apis/js-apis-appmanager.md index 96c9bd009552016f88cc361103b15eb725828195..236ed9c1af1231ebb1ddc8c63356a20f57cb3010 100644 --- a/en/application-dev/reference/apis/js-apis-appmanager.md +++ b/en/application-dev/reference/apis/js-apis-appmanager.md @@ -1,6 +1,7 @@ # appManager -> **NOTE**
+> **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. @@ -25,9 +26,9 @@ Checks whether this application is undergoing a stability test. This API uses an **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | 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** @@ -49,9 +50,9 @@ Checks whether this application is undergoing a stability test. This API uses a **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -75,9 +76,9 @@ Checks whether this application is running on a RAM constrained device. This API **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | 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.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | 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** @@ -99,9 +100,9 @@ Checks whether this application is running on a RAM constrained device. This API **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | 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** @@ -122,9 +123,9 @@ Obtains the memory size of this application. This API uses a promise to return t **Return value** -| Type| Description| -| -------- | -------- | -| Promise<number> | Size of the application memory.| + | Type| Description| + | -------- | -------- | + | Promise<number> | Size of the application memory.| **Example** @@ -146,9 +147,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | No| Size of the application memory.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<number> | No| Size of the application memory.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index 87d07aa36fe6dfa44f81ba618cfd98d399718993..3a449fb0426baae2532bd3ad2f748d5af49263ec 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -1146,6 +1146,8 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback<void> 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 **Parameters** @@ -1159,7 +1161,7 @@ Sets an audio parameter. This API uses an asynchronous callback to return the re **Example** ``` -audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => { +audioManager.setAudioParameter('key_example', 'value_example', (err) => { if (err) { console.error('Failed to set the audio parameter. ${err.message}'); return; @@ -1174,6 +1176,8 @@ setAudioParameter(key: string, value: string): Promise<void> 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 **Parameters** @@ -1192,7 +1196,7 @@ Sets an audio parameter. This API uses a promise to return the result. **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.'); }); ``` @@ -1203,6 +1207,8 @@ getAudioParameter(key: string, callback: AsyncCallback<string>): void 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 **Parameters** @@ -1215,7 +1221,7 @@ Obtains the value of an audio parameter. This API uses an asynchronous callback **Example** ``` -audioManager.getAudioParameter('PBits per sample', (err, value) => { +audioManager.getAudioParameter('key_example', (err, value) => { if (err) { console.error('Failed to obtain the value of the audio parameter. ${err.message}'); return; @@ -1230,6 +1236,8 @@ getAudioParameter(key: string): Promise<string> 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 **Parameters** @@ -1247,7 +1255,7 @@ Obtains the value of an audio parameter. This API uses a promise to return the r **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); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-configuration.md b/en/application-dev/reference/apis/js-apis-configuration.md index 0cad135c638c6663301c5a4edea7a1a436ced8f3..507b8a42448dd4ae892424feaae061c47d814138 100644 --- a/en/application-dev/reference/apis/js-apis-configuration.md +++ b/en/application-dev/reference/apis/js-apis-configuration.md @@ -1,28 +1,25 @@ # Configuration -> **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. - Provides the configuration for the environment where the ability is running. - ## Modules to Import - ```js import Configuration from '@ohos.application.Configuration'; ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityBase -| Name| Type | Readable | Writable | Description | + | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| 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**.| -| direction9+ | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**. | -| screenDensity9+ | 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). | -| displayId9+ | number | Yes| No| ID of the display where the application is located. | +| 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**.| +| direction9+ | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.| +| screenDensity9+ | 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).| +| displayId9+ | number | Yes| No| ID of the display where the application is located.| diff --git a/en/application-dev/reference/apis/js-apis-configurationconstant.md b/en/application-dev/reference/apis/js-apis-configurationconstant.md index a61eeea271c180fe92f22a8be5691daf70b45da6..ebb78bc00e5ece7a6e04e64db6135f9d2f7ed7fd 100644 --- a/en/application-dev/reference/apis/js-apis-configurationconstant.md +++ b/en/application-dev/reference/apis/js-apis-configurationconstant.md @@ -1,6 +1,7 @@ # ConfigurationConstant -> **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. @@ -27,11 +28,11 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT **System capability**: SystemCapability.Ability.AbilityBase -| Name | Value | Description | +| Name| Value| Description| | -------- | -------- | -------- | -| COLOR_MODE_NOT_SET | -1 | Unspecified color mode. | -| COLOR_MODE_DARK | 0 | Dark mode. | -| COLOR_MODE_LIGHT | 1 | Light mode. | +| COLOR_MODE_NOT_SET | -1 | Unspecified color mode.| +| COLOR_MODE_DARK | 0 | Dark mode.| +| COLOR_MODE_LIGHT | 1 | Light mode.| ## ConfigurationConstant.Direction9+ @@ -46,11 +47,11 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL **System capability**: SystemCapability.Ability.AbilityBase -| Name | Value | Description | +| Name| Value| Description| | -------- | -------- | -------- | -| DIRECTION_NOT_SET | -1 | Unspecified direction. | -| DIRECTION_VERTICAL | 0 | Vertical direction. | -| DIRECTION_HORIZONTAL | 1 | Horizontal direction. | +| DIRECTION_NOT_SET | -1 | Unspecified direction.| +| DIRECTION_VERTICAL | 0 | Vertical direction.| +| DIRECTION_HORIZONTAL | 1 | Horizontal direction.| ## ConfigurationConstant.ScreenDensity9+ @@ -65,12 +66,12 @@ ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET **System capability**: SystemCapability.Ability.AbilityBase -| Name | Value | Description | +| Name| Value| Description| | -------- | -------- | -------- | -| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution. | -| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi. | -| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi. | -| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi. | -| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi. | -| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi. | -| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi. | +| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.| +| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.| +| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.| +| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.| +| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.| +| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.| +| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.| diff --git a/en/application-dev/reference/apis/js-apis-extension-context.md b/en/application-dev/reference/apis/js-apis-extension-context.md index afd1cec9cd5df1eaaedfc8679e1dc478e8e09766..24ca2bb2e99bd5b308aea4683a9242c998417e78 100644 --- a/en/application-dev/reference/apis/js-apis-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-extension-context.md @@ -1,7 +1,9 @@ # ExtensionContext -> **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. +> **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 APIs of this module can be used only in the stage model. Implements the extension context. This module is inherited from **Context**. diff --git a/en/application-dev/reference/apis/js-apis-formInfo.md b/en/application-dev/reference/apis/js-apis-formInfo.md index 1091770862af33647f271be1d0097859c7440ad1..502a8212f54e8cdefa381a8b862f1148e2f73b11 100644 --- a/en/application-dev/reference/apis/js-apis-formInfo.md +++ b/en/application-dev/reference/apis/js-apis-formInfo.md @@ -1,6 +1,7 @@ # 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. Provides widget information. diff --git a/en/application-dev/reference/apis/js-apis-formerror.md b/en/application-dev/reference/apis/js-apis-formerror.md index 37eecd85304700c21d92e6f07d3cd11229a32c64..62e062c25eab28cfa018f4971da3e5317db7d448 100644 --- a/en/application-dev/reference/apis/js-apis-formerror.md +++ b/en/application-dev/reference/apis/js-apis-formerror.md @@ -1,6 +1,7 @@ # 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. Provides widget-related error codes. diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md index 2b0504a51b86410317627cb2dc7d3429bb3c6e1c..49f6e8f5ab16a3f6f28980204181f54a4e22c992 100644 --- a/en/application-dev/reference/apis/js-apis-media.md +++ b/en/application-dev/reference/apis/js-apis-media.md @@ -1,6 +1,7 @@ # Media > **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 multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and use media resources. diff --git a/en/application-dev/reference/apis/js-apis-missionManager.md b/en/application-dev/reference/apis/js-apis-missionManager.md index 314d2f63cca7d6139a941ca82a1e723a496f0613..94fb115434d6860cb2096586d48f0c981ea9a30a 100644 --- a/en/application-dev/reference/apis/js-apis-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-missionManager.md @@ -635,7 +635,7 @@ Switches a given mission to the foreground, with the startup parameters for the | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | 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<void> | Yes| Callback used to return the result.| **Example** @@ -669,7 +669,7 @@ Switches a given mission to the foreground, with the startup parameters for the | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | 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** diff --git a/en/application-dev/reference/apis/js-apis-particleAbility.md b/en/application-dev/reference/apis/js-apis-particleAbility.md index 2dd21c5d94a61e84c510f453457a9ef0ace89435..12f2fd80bdd78b13c59b1684f080ac2798a9c436 100644 --- a/en/application-dev/reference/apis/js-apis-particleAbility.md +++ b/en/application-dev/reference/apis/js-apis-particleAbility.md @@ -1,7 +1,9 @@ -# ParticleAbility Module +# ParticleAbility -> **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. +> **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 APIs of this module can be used only in the FA model. ## Constraints diff --git a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md index de7be38f0c910c202f90c0eb76396e18f4f5fd7e..f0d3ed2f0ce6e5e84883f38b7d9441b74dae5ae4 100644 --- a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md +++ b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md @@ -1,7 +1,9 @@ # PermissionRequestResult -> **NOTE**
+> **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 APIs of this module can be used only in the stage model. Provides the permission request result. diff --git a/en/application-dev/reference/apis/js-apis-service-extension-ability.md b/en/application-dev/reference/apis/js-apis-service-extension-ability.md index 55e18ad1fa75577fb8e711e15dffac4e339b98eb..b66c29fe1834b589ee9ffd32eb598e5c53dc2e0a 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension-ability.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-ability.md @@ -1,31 +1,29 @@ # ServiceExtensionAbility -> **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. - +> **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 APIs of this module can be used only in the stage model. Provides APIs related to **ServiceExtension**. - ## Modules to Import ``` import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; ``` - ## Required Permissions None. - ## Attributes **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 @@ -38,9 +36,9 @@ Called when an extension is created to initialize the service logic. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| **Example** @@ -82,10 +80,10 @@ Called after **onCreate** is invoked when an ability is started by calling **sta **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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.| **Example** @@ -108,15 +106,15 @@ Called after **onCreate** is invoked when an ability is started by calling **con **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| **Return value** -| Type| Description| -| -------- | -------- | -| rpc.RemoteObject | A **RemoteObject** object used for communication with the client.| + | Type| Description| + | -------- | -------- | + | rpc.RemoteObject | A **RemoteObject** object used for communication with the client.| **Example** @@ -148,9 +146,9 @@ Called when the ability is disconnected. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-testRunner.md b/en/application-dev/reference/apis/js-apis-testRunner.md index 47f1dc8dad5189495c3ca2a74d6b72ea96fc6de1..717c8448a00518b777b882fa7a49d7aca4509e11 100644 --- a/en/application-dev/reference/apis/js-apis-testRunner.md +++ b/en/application-dev/reference/apis/js-apis-testRunner.md @@ -1,8 +1,8 @@ # TestRunner -> **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. +> **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. ## Modules to Import diff --git a/zh-cn/application-dev/IDL/idl-guidelines.md b/zh-cn/application-dev/IDL/idl-guidelines.md index 6146e3ce14e27d9a57ec09fae35dd6e49a6a4550..f1c60b2ffc5949b34e78412a977c477272945f55 100644 --- a/zh-cn/application-dev/IDL/idl-guidelines.md +++ b/zh-cn/application-dev/IDL/idl-guidelines.md @@ -7,7 +7,7 @@ ![IDL-interface-description](./figures/IDL-interface-description.png) -OpenHarmony IDL接口描述语言主要用于: +OpenHarmony IDL接口描述语言主要用于: - 声明系统服务对外提供的服务接口,根据接口声明在编译时生成跨进程调用(IPC)或跨设备调用(RPC)的代理(Proxy)和桩(Stub)的C/C++代码或JS/TS代码。 @@ -29,16 +29,16 @@ OpenHarmony IDL接口描述语言主要用于: #### 2.1.1 基础数据类型 | IDL基本数据类型 | C++基本数据类型 | TS基本数据类型 | -| -------- | -------- | -------- | -|void | void | void | -|boolean | bool | boolean | -|byte | int8_t | number | -|short | int16_t | number | -|int | int32_t | number | -|long | int64_t | number | -|float | float | number | -|double | double | number | -|String | std::string | string | +| -------- | -------- | -------- | +|void | void | void | +|boolean | bool | boolean | +|byte | int8_t | number | +|short | int16_t | number | +|int | int32_t | number | +|long | int64_t | number | +|float | float | number | +|double | double | number | +|String | std::string | string | IDL支持的基本数据类型及其映射到C++、TS上的数据类型的对应关系如上表所示。 @@ -47,29 +47,34 @@ sequenceable数据类型是指使用“sequenceable”关键字声明的数据 在C++中sequenceable数据类型的声明放在文件的头部,以“sequenceable includedir..namespace.typename”的形式声明。具体而言。声明可以有如下三个形式: -``` +```cpp sequenceable includedir..namespace.typename sequenceable includedir...typename sequenceable namespace.typename ``` + 其中,includedir表示该数据类型头文件所在目录,includedir中以“.”作为分隔符。namespace表示该数据类型所在命名空间,namespace中同样以“.”作为分隔符。typename表示数据类型,数据类型中不能包含非英文字符类型的其他符号。includedir与namespace之间通过“..”分割,如果类型声明的表达式中不包含“..”,除去最后一个typename之外的字符都会被解析为命名空间。例如: -``` + +```cpp sequenceable a.b..C.D ``` + 上述声明在生成的的C++头文件中将被解析为如下代码: -``` + +```cpp #include “a/b/d.h” using C::D; ``` + TS声明放在文件的头部,以 “sequenceable namespace.typename;”的形式声明。具体而言,声明可以有如下形式: -``` +```ts sequenceable idl.MySequenceable ``` 其中,namespace是该类型所属的命名空间,typename是类型名。MySequenceable类型表示可以通过Parcel进行跨进程传递。sequenceable数据类型并不在OpenHarmony IDL文件中定义,而是定义在.ts文件中。因此,OpenHarmony IDL工具将根据声明在生成的.ts代码文件中加入如下语句: -``` +```ts import MySequenceable from "./my_sequenceable" ``` @@ -80,19 +85,19 @@ import MySequenceable from "./my_sequenceable" C++中声明的形式与sequenceable类型相似,具体而言可以有如下形式: -``` +```cpp interface includedir..namespace.typename ``` TS中声明的形式,具体而言可以有如下形式: -``` +```ts interface namespace.interfacename ``` 其中,namespace是该接口所属的命名空间,interfacename是接口名。例如:“interface OHOS.IIdlTestObserver;”声明了在其他OpenHarmony IDL文件定义的IIdlTestObserver接口,该接口可以作为当前定义中方法的参数类型或返回值类型使用。OpenHarmony IDL工具将根据该声明在生成的TS代码文件中加入如下语句: -``` +```ts 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<T>类型。 OpenHarmony IDL数组数据类型与TS数据类型、C++数据类型的对应关系如下表所示: -|OpenHarmony IDL数据类型 | C++数据类型 | TS数据类型 | -| -------- | -------- | -------- | -|T[] | std::vector<T> | T[] | +|OpenHarmony IDL数据类型 | C++数据类型 | TS数据类型 | +| ------- | -------- | -------- | +|T[] | std::vector<T> | T[] | #### 2.1.5 容器类型 IDL支持两种容器类型,即List和Map。其中List类型容器的用法为List<T>;Map容器的用法为Map,其中T、KT、VT为基本数据类型、sequenceable类型、interface类型、数组类型或容器类型。 @@ -114,26 +119,32 @@ List类型在TS代码中不支持,Map容器被映射为Map。 OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关系如下表所示: |OpenHarmony IDL数据类型 | C++数据类型 | TS数据类型 | -| -------- | -------- | -------- | -|List<T> | std::list | 不支持 | -|Map | std::map | Map | +| -------- | -------- | ------- | +|List<T> | std::list | 不支持 | +|Map | std::map | Map | ### 2.2 IDL文件编写规范 一个idl文件只能定义一个interface类型,且该interface名称必须和文件名相同。idl文件的接口定义使用BNF范式描述,其基本定义的形式如下: + ``` [<*interface_attr_declaration*>]interface<*interface_name_with_namespace*>{<*method_declaration*>} ``` + 其中,<*interface_attr_declaration*>表示接口属性声明。当前仅支持“oneway”属性,表示该接口中的接口都是单向方法,即调用方法后不用等待该方法执行即可返回。这个属性为可选项,如果未声明该属性,则默认为同步调用方法。接口名需要包含完整的接口头文件目录及命名空间,且必须包含方法声明,不允许出现空接口。 接口内的方法声明形式为: + ``` [<*method_attr_declaration*>]<*result_type*><*method_declaration*> ``` + 其中,<*method_attr_declaration*>表示接口属性说明。当前仅支持“oneway”属性,表示该方法为单向方法,即调用方法后不用等待该方法执行即可返回。这个属性为可选项,如果未声明该属性,则默认为同步调用方法。<*result_type*>为返回值类型,<*method_declaration*>是方法名和各个参数声明。 参数声明的形式为: + ``` [<*formal_param_attr*>]<*type*><*identifier*> ``` + 其中<*formal_param_attr*>的值为“in”,“out”,“inout”,分别表示该参数是输入参数,输出参数或输入输出参数。需要注意的是,如果一个方法被声明为oneway,则该方法不允许有输出类型的参数(及输入输出类型)和返回值。 ## 3.开发步骤 @@ -144,20 +155,20 @@ OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关 开发者可以使用C++编程语言构建.idl文件。.idl示例如下: -``` +```cpp interface OHOS.IIdlTestService { int TestIntTransaction([in] int 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 服务端公开接口 - OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。 +OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。 -``` +```cpp #ifndef OHOS_IDLTESTSERVICESTUB_H #define OHOS_IDLTESTSERVICESTUB_H #include @@ -182,7 +193,7 @@ private: 开发者需要继承.idl文件中定义的接口类并实现其中的方法,同时在服务侧初始化时需要将定义的服务注册至SAMGR中,在本示例中,TestService类继承了IdlTestServiceStub接口类并实现了其中的TestIntTransaction和TestStringTransaction方法。具体的示例代码如下: -``` +```cpp #ifndef OHOS_IPC_TEST_SERVICE_H #define OHOS_IPC_TEST_SERVICE_H @@ -207,7 +218,7 @@ private: 注册服务的示例代码如下: -``` +```cpp #include "test_service.h" #include @@ -259,12 +270,11 @@ ErrCode TestService::TestStringTransaction(const std::string &data) } // namespace OHOS ``` - #### 3.1.3 客户端调用IPC方法 C++客户端通常通过SAMGR获取系统中定义的服务代理,随后即可正常调用proxy提供的接口。示例代码如下: -``` +```cpp #include "test_client.h" #include "if_system_ability_manager.h" @@ -316,16 +326,13 @@ void TestClient::StartStringTransaction() } // namespace OHOS ``` - - - ### 3.2 TS开发步骤 #### 3.2.1 创建.idl文件 开发者可以使用TS编程语言构建.idl文件。.idl示例如下: -``` +```ts interface OHOS.IIdlTestService { int TestIntTransaction([in] int data); void TestStringTransaction([in] String data); @@ -336,9 +343,9 @@ void TestClient::StartStringTransaction() #### 3.2.2 服务端公开接口 - OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。 +OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声明.idl文件中的所有方法。 -``` +```ts import {testIntTransactionCallback} from "./i_idl_test_service"; import {testStringTransactionCallback} 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 开发者需要继承.idl文件中定义的接口类并实现其中的方法。在本示例中,我们继承了IdlTestServiceStub接口类并实现了其中的testIntTransaction和testStringTransaction方法。具体的示例代码如下: -``` +```ts import {testIntTransactionCallback} from "./i_idl_test_service" import {testStringTransactionCallback} from "./i_idl_test_service" import IdlTestServiceStub from "./idl_test_service_stub" @@ -408,7 +415,7 @@ class IdlTestImp extends IdlTestServiceStub { 在服务实现接口后,需要向客户端公开该接口,以便客户端进程绑定。如果开发者的服务要公开该接口,请扩展Ability并实现onConnect()从而返回IRemoteObject,以便客户端能与服务进程交互。服务端向客户端公开IRemoteAbility接口的代码示例如下: -``` +```ts export default { onStart() { console.info('ServiceAbility onStart'); @@ -442,7 +449,7 @@ export default { 客户端调用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 featureAbility from '@ohos.ability.featureAbility'; @@ -495,7 +502,7 @@ function connectAbility: void { MySequenceable类的代码示例如下: -``` +```ts import rpc from '@ohos.rpc'; export default class MySequenceable { constructor(num: number, str: string) { @@ -523,8 +530,6 @@ export default class MySequenceable { } ``` - - ## 4. C++与TS互通开发步骤 ### 4.1 TS Proxy与C++ Stub开发步骤 @@ -535,7 +540,7 @@ export default class MySequenceable { 2. 开发者创建服务对象,并继承C++ Stub文件中定义的接口类并实现其中的方法,例如: - ``` + ```cpp class IdlTestServiceImpl : public IdlTestServiceStub { public: IdlTestServiceImpl() = default; @@ -558,7 +563,7 @@ export default class MySequenceable { C++需要通过napi的方式,把C++服务对象提供给TS端,例如:C++端提供一个GetNativeObject方法,方法里创建IdlTestServiceImpl实例,通过NAPI_ohos_rpc_CreateJsRemoteObject方法,创建出一个JS远程对象供TS应用使用,如下: -``` +```cpp NativeValue* GetNativeObject(NativeEngine& engine, NativeCallbackInfo& info) { sptr impl = new IdlTestServiceImpl(); @@ -572,8 +577,7 @@ NativeValue* GetNativeObject(NativeEngine& engine, NativeCallbackInfo& info) 如上所述TS开发步骤,开发者使用TS编程语言构建.idl文件,通过命令生成接口、Stub文件、Proxy文件。Proxy文件例如: -``` - +```ts import {testIntTransactionCallback} from "./i_idl_test_service"; import {testStringTransactionCallback} from "./i_idl_test_service"; import IIdlTestService from "./i_idl_test_service"; @@ -634,7 +638,7 @@ export default class IdlTestServiceProxy implements IIdlTestService { 2. 构建TS Proxy对象,并把C++服务的远程对象传递给它 3. 此时开发者通过TS Proxy对象调用.idl声明的方法,实现TS Proxy与C++ Stub的互通,示例如下: -``` +```ts import IdlTestServiceProxy from './idl_test_service_proxy' import nativeMgr from 'nativeManager'; @@ -659,4 +663,3 @@ function jsProxyTriggerCppStub() tsProxy.testStringTransaction("test", testIntTransactionCallback); } ``` - diff --git a/zh-cn/application-dev/ability/ability-brief.md b/zh-cn/application-dev/ability/ability-brief.md index 4a72efe5350b503aa8b3f1fcb89b1863025a4067..548b3222b67a29d45dccaf472de44069d7b69fb8 100644 --- a/zh-cn/application-dev/ability/ability-brief.md +++ b/zh-cn/application-dev/ability/ability-brief.md @@ -1,13 +1,13 @@ # 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模型的设计,主要是为了开发者更加方便地开发出分布式环境下的复杂应用。下表给出了两种模型在设计上的差异: +Stage模型的设计,主要是为了开发者更加方便地开发出分布式环境下的复杂应用。下表给出了两种模型在设计上的差异: | 对比 | FA模型 | Stage模型 | | -------------- | ------------------------------------------------------------ | -------------------------------------------------------- | @@ -17,7 +17,7 @@ | 包描述文件 | 使用config.json描述HAP包和组件信息,组件必须使用固定的文件名。 | 使用module.json描述HAP包和组件信息,可以指定入口文件名。 | | 组件 | 提供PageAbility(页面展示),ServiceAbility(服务),DataAbility(数据分享)以及FormAbility(卡片)。 | 提供Ability(页面展示)、Extension(基于场景的服务扩展)。 | -​ 除了上述设计上的差异外,对于开发者而言,两种模型的主要区别在于: +除了上述设计上的差异外,对于开发者而言,两种模型的主要区别在于: * Ability类型存在差异; @@ -27,8 +27,8 @@ ![lifecycle](figures/lifecycle.png) - 两种模型的基本介绍,详见[FA模型综述](fa-brief.md)及[Stage模型综述](stage-brief.md)。 + ## 相关实例 针对Ability开发,有以下相关实例可供参考: - [Page内和Page间导航跳转](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) \ No newline at end of file diff --git a/zh-cn/application-dev/ability/fa-dataability.md b/zh-cn/application-dev/ability/fa-dataability.md index ae128df0968430bd132f8defc80de4eb93e5a1bd..d977293ae807537524eebb0aa76c56cfcd031aaf 100644 --- a/zh-cn/application-dev/ability/fa-dataability.md +++ b/zh-cn/application-dev/ability/fa-dataability.md @@ -15,10 +15,10 @@ Data提供方可以自定义数据的增、删、改、查,以及文件打开 |delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\): void|删除一条或多条数据。| |normalizeUri?(uri: string, callback: AsyncCallback\): void|对URI进行规范化。一个规范化的URI可以支持跨设备使用、持久化、备份和还原等,当上下文改变时仍然可以引用到相同的数据项。| |batchInsert?(uri: string, valueBuckets: Array\, callback: AsyncCallback\): void|向数据库中插入多条数据。| -|denormalizeUri?(uri: string, callback: AsyncCallback): void|将一个由normalizeUri生产的规范化URI转换成非规范化的URI。| +|denormalizeUri?(uri: string, callback: AsyncCallback\): void|将一个由normalizeUri生产的规范化URI转换成非规范化的URI。| |insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback\): void|向数据中插入一条数据。| |openFile?(uri: string, mode: string, callback: AsyncCallback\): void|打开一个文件。| -|getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void|获取文件的MIME类型。| +|getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback\>): void|获取文件的MIME类型。| |getType?(uri: string, callback: AsyncCallback\): void|获取URI指定数据相匹配的MIME类型。| |executeBatch?(ops: Array\, callback: AsyncCallback\>): void|批量操作数据库中的数据。| |call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback\): void|自定义方法。| diff --git a/zh-cn/application-dev/ability/fa-pageability.md b/zh-cn/application-dev/ability/fa-pageability.md index 1f7bb6f19c0f4843f15b595d2ecd1c7e403291de..e6ecc913b37323dc8eca9bb1f773547158568ece 100644 --- a/zh-cn/application-dev/ability/fa-pageability.md +++ b/zh-cn/application-dev/ability/fa-pageability.md @@ -1,12 +1,16 @@ # 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生命周期介绍**(Ability Life Cycle): +**PageAbility生命周期介绍**(Ability Lifecycle): PageAbility生命周期是PageAbility被调度到INACTIVE、ACTIVE、BACKGROUND等各个状态的统称。 @@ -34,28 +38,31 @@ PageAbility生命周期流转如下图所示: PageAbility提供生命周期回调,开发者可以在`app.js/app.ets`中重写生命周期相关回调函数 。目前`app.js`环境中仅支持onCreate和onDestroy回调,`app.ets`环境支持全量生命周期回调。 ### 启动模式 + ability支持单实例和多实例两种启动模式。 -在config.json中通过launchType配置项,可以配置具体的启动模式,其中: + +在`config.json`中通过launchType配置项,可以配置具体的启动模式,其中: | 启动模式 | 描述 |说明 | | ----------- | ------- |---------------- | -| standard | 多实例 | 每次startAbility都会启动一个新的实例 | -| singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 | +| standard | 多实例 | 每次startAbility都会启动一个新的实例。 | +| singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例。 | 缺省情况下是singleton模式。 ## 开发指导 + ### featureAbility接口说明 **表1** featureAbility接口介绍 | 接口名 | 描述 | | --------------------------------------------------- | --------------- | -| void startAbility(parameter: StartAbilityParameter) | 启动Ability | -| Context getContext(): | 获取应用Context | -| void terminateSelf() | 结束Ability | -| bool hasWindowFocus() | 是否获取焦点 | +| void startAbility(parameter: StartAbilityParameter) | 启动Ability。 | +| Context getContext(): | 获取应用Context。 | +| void terminateSelf() | 结束Ability。 | +| bool hasWindowFocus() | 是否获取焦点。 | ### 启动本地PageAbility @@ -87,7 +94,8 @@ ability支持单实例和多实例两种启动模式。 ``` ### 启动远程PageAbility(当前仅对系统应用开放) ->说明:由于DeviceManager的getTrustedDeviceListSync接口仅对系统应用开放,当前启动远程PageAbility仅支持系统应用 + +>说明:由于DeviceManager的getTrustedDeviceListSync接口仅对系统应用开放,当前启动远程PageAbility仅支持系统应用。 **导入模块** @@ -180,7 +188,7 @@ ability支持单实例和多实例两种启动模式。 | 接口名 | 描述 | | ------------ | ------------------------------------------------------------ | -| onShow() | Ability由后台不可见状态切换到前台可见状态调用onShow方法,此时用户在屏幕可以看到该Ability | +| onShow() | Ability由后台不可见状态切换到前台可见状态调用onShow方法,此时用户在屏幕可以看到该Ability。 | | onHide() | Ability由前台切换到后台不可见状态时调用onHide方法,此时用户在屏幕看不到该Ability。 | | onDestroy() | 应用退出,销毁Ability对象前调用onDestroy方法,开发者可以在该方法里做一些回收资源、清空缓存等应用退出前的准备工作。 | | onCreate() | Ability第一次启动创建Ability时调用onCreate方法,开发者可以在该方法里做一些应用初始化工作。 | @@ -189,7 +197,7 @@ ability支持单实例和多实例两种启动模式。 **示例** -开发者需要重写`app.js/app.ets`中相关生命周期回调函数,IDE模板默认生成`onCreate()`和`onDestroy()`方法,其他方法需要开发者自行实现。 +开发者需要重写`app.js/app.ets`中相关生命周期回调函数,DevEco Studio模板默认生成`onCreate()`和`onDestroy()`方法,其他方法需要开发者自行实现。 ```javascript export default { @@ -214,6 +222,7 @@ export default { } ``` ## 相关实例 + 针对PageAbility开发,有以下相关实例可供参考: - [`DMS`:分布式Demo(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DMS) \ No newline at end of file diff --git a/zh-cn/application-dev/database/database-distributedobject-guidelines.md b/zh-cn/application-dev/database/database-distributedobject-guidelines.md index 8167c1370b4ee098d35aec95520310aa78260907..093eea5fb3b843c12779d67ce68c3812aa0885a8 100644 --- a/zh-cn/application-dev/database/database-distributedobject-guidelines.md +++ b/zh-cn/application-dev/database/database-distributedobject-guidelines.md @@ -7,6 +7,8 @@ ## 接口说明 +具体分布式数据对象相关功能接口请见[分布式数据对象](../reference/apis/js-apis-data-distributedobject.md)。 + ### 创建数据对象实例 创建一个分布式数据对象实例,用户可以通过source指定分布式对象中的属性。 diff --git a/zh-cn/application-dev/database/database-mdds-guidelines.md b/zh-cn/application-dev/database/database-mdds-guidelines.md index 2109f43a375f1beff176f3834c5a2c541c36a057..7e6bc5dd5f6323c485a6018ce8bb7fceac476f4f 100644 --- a/zh-cn/application-dev/database/database-mdds-guidelines.md +++ b/zh-cn/application-dev/database/database-mdds-guidelines.md @@ -6,6 +6,7 @@ ## 接口说明 +具体分布式数据相关功能接口请见[分布式数据管理](../reference/apis/js-apis-distributed-data.md)。 OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种功能: diff --git a/zh-cn/application-dev/database/database-preference-guidelines.md b/zh-cn/application-dev/database/database-preference-guidelines.md index d7f37ca32701a0dfffedfe16f81a268b623cb396..14e25f9916b5b76deed13334993231ea7f586f20 100644 --- a/zh-cn/application-dev/database/database-preference-guidelines.md +++ b/zh-cn/application-dev/database/database-preference-guidelines.md @@ -1,12 +1,16 @@ # 首选项开发指导 +> **说明:** +> +> 该功能特性从API Version 9开始支持。API Version 9之前可使用[轻量级存储](../reference/apis/js-apis-data-storage.md)的相关功能接口。 + ## 场景介绍 首选项功能通常用于保存应用的一些常用配置信息,并不适合需要存储大量数据和频繁改变数据的场景。应用的数据保存在文件中,这些文件可以持久化地存储在设备上。需要注意的是,应用访问的实例包含文件所有数据,这些数据会一直加载在设备的内存中,直到应用主动从内存中将其移除前,应用都可以通过Preferences API进行相关数据操作。 ## 接口说明 -首选项为应用提供key-value键值型的文件数据处理能力,支持应用持久化轻量级数据,并对其修改和查询。数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括数字型、字符型、布尔型。 +首选项为应用提供key-value键值型的文件数据处理能力,支持应用持久化轻量级数据,并对其修改和查询。数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括数字型、字符型、布尔型。更多首选项相关接口,请见[首选项API](../reference/apis/js-apis-data-preferences.md)。 ### 创建存储实例 diff --git a/zh-cn/application-dev/database/database-relational-guidelines.md b/zh-cn/application-dev/database/database-relational-guidelines.md index 2983cd4c97f3fd76028a8697127b9214d6a86bd8..475f80d6a16c7be975f267c8676b923c76f07b5d 100644 --- a/zh-cn/application-dev/database/database-relational-guidelines.md +++ b/zh-cn/application-dev/database/database-relational-guidelines.md @@ -7,6 +7,8 @@ ## 接口说明 +具体关系型数据库相关功能接口请见[关系型数据库](../reference/apis/js-apis-data-rdb.md)。 + ### 数据库的创建和删除 关系型数据库提供了数据库创建方式,以及对应的删除接口,涉及的API如下所示。 diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/about-this-document.md b/zh-cn/application-dev/key-features/multi-device-app-dev/about-this-document.md index b114a0e952f456a8edf68434f0b33ea2c74bd06e..d7d5aa2c556f370a306ce4c46dd321ecc32799ac 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/about-this-document.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/about-this-document.md @@ -1,19 +1,19 @@ # 前言 -本指导的目的是快速及全面地指导读者使用OpenHarmony提供的“一多”(“一次开发,多端部署”在本指导中的简称)能力开发多设备应用。在应用开发前,开发者应尽可能全面考虑应用支持多设备的情况,避免在后期加入新的类型设备时需要对应用架构进行大幅调整。 +本指导的目的是快速及全面地指导读者使用OpenHarmony提供的“一次开发,多端部署”(本指导中简称“一多”)能力开发多设备应用。在应用开发前,开发者应尽可能全面考虑应用支持多设备的情况,避免在后期加入新的类型设备时需要对应用架构进行大幅调整。 ## 本指导面向的读者 -本指导适合开发OpenHarmony应用的UX设计师、应用开发人员,这两个角色我们统称为“应用开发者”。为什么要把两者分开来,是因为这两者是根据开发角色不同而进行区分。当然对于个人或者规模较小的应用,两者角色往往是合并的,但应当从角色上加以区分。本指导中用“应用开发者”进行统称泛指。 +本指导适合开发OpenHarmony应用的UX设计师、应用开发人员,本指导书统称为“应用开发者”。这两者是根据开发角色不同而进行的区分。对于个人或者规模较小的应用,两者可能是同一个个体,但应当从角色上加以区分。 ## 如何阅读本指导 -应用在需求明确后,开发过程大致分为:应用设计(包含界面UX设计、业务功能设计)->工程设计和创建->功能代码实现。本指导也是基于这个流程进行的内容编排。 +应用在需求明确后,开发过程大致分为:应用设计(包含界面UX设计、业务功能设计)- 工程设计和创建 - 功能代码实现。本指导也是基于这个流程进行的内容编排。 -阅读本文档时,应尽量按照章节顺序进行阅读。如果区分开发角色,那么UX设计师可以直接且仅阅读第3章,而开发人员可以从第4章开始阅读。但无论如何,我们强烈建议阅读第2章。 +阅读本文档时,应尽量按照章节顺序进行阅读。如果区分开发角色,那么UX设计师可以仅阅读第3章,而开发人员可以从第4章开始阅读。但无论何种角色,我们强烈建议阅读第2章。 本文档各章节简介如下: @@ -22,11 +22,12 @@ - 第2章[简介](introduction.md)简短介绍了“一多”的背景、定义、目标、以及用于指导后续开发的一些基础知识。 - 第3章[应用UX设计](design-principles.md)介绍了应用UX设计理念。主要阐述了应用设计之初UX设计的原则和要点。该章节主要面向应用的UX设计师。 + UX设计原则应该考虑多设备的“差异性” 、“一致性”、“灵活性”、“兼容性”。 UX设计要点则从6个方面阐述如何进行多设备应用设计,分别是“自适应应用架构”、“响应式界面布局”、“交互归一”、“视觉参数化”、“多态控件”、“针对性优化”。 - 最后,给出设计自检表,用于检查应用UX设计是否合理 。 + 最后,给出设计自检表,用于检查应用UX设计是否合理。 - 第4章[IDE使用](ide-usage.md)介绍了从工程角度如何开始开发应用,这非常有用,让读者可以直接上手创建多设备应用的工程,是后面学习“一多”能力的上手基础。 @@ -34,6 +35,6 @@ - 第7章提供了两个案例应用,阐述了从应用设计到开发这一过程中如何实践前面章节介绍的设计思路或“一多”能力,让读者可以整体上掌握“一多”在应用开发过程中的知识。 -- 第8章[常见问题](faqs.md)提供了常见的问题(FAQ),方便读者查阅。 +- 第8章[常见问题](faqs.md)提供了常见问题(FAQ),方便读者查阅。 本指导在介绍过程中还包括一些“说明”。这些“说明”,表示例外情况或者额外信息的补充。 diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/introduction.md b/zh-cn/application-dev/key-features/multi-device-app-dev/introduction.md index 05c0bc2d5a0b64f1da063a9a5b5dd29b287c17a3..d4710de462d7c3b7dbe576001b8fa76aeda3ffb8 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/introduction.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/introduction.md @@ -12,7 +12,7 @@ **定义**:一套代码工程,一次开发上架,多端按需部署。 -**目标**:支撑开发者快速高效开发多设备(多种终端设备形态的简称)应用,实现对不同设备兼容的同时提供跨设备的流转、迁移和协同的分布式体验。 +**目标**:支撑开发者快速高效开发多设备(“多种终端设备形态”的简称)应用,实现对不同设备兼容的同时提供跨设备的流转、迁移和协同的分布式体验。 ![zh-cn_image_0000001315500981](figures/zh-cn_image_0000001315500981.jpg) @@ -52,7 +52,7 @@ HAP是OpenHarmony的安装包,一个HAP在工程目录中对应一个Module, OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进行应用UI开发时所必须的能力。 -方舟开发框架提供了两种开发范式,分别是基于JS扩展的类Web开发范式(“类Web开发范式”的简称)和基于TS扩展的声明式开发范式(“声明式开发范式”的简称)。 +方舟开发框架提供了两种开发范式,分别是基于JS扩展的类Web开发范式(简称为“类Web开发范式”)和基于TS扩展的声明式开发范式(简称为“声明式开发范式”)。 - **类Web开发范式**:采用经典的HML、CSS、JavaScript三段式开发方式。使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发更新。此种开发方式,更接近Web前端开发者的使用习惯,快速将已有的Web应用改造成方舟开发框架应用。主要适用于界面较为简单的中小型应用开发。 @@ -146,4 +146,5 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进 - product:产品层目录,通过引用common和feature目录中代码的方式做功能和特性的集成,同时也作为主入口。**这一层是两个部署模型主要差异点**,部署模型A可以直接在product目录中做功能和特性集成,部署模型B则需要在product目录下再建一级子目录,在不同的子目录中对不同的产品做差异化的功能和特性集成。 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** + > 无论是用部署模型A还是部署模型B,在开发阶段,都应考虑**不同类型设备间最大程度的复用代码**,以减少开发及后续维护的工作量。 diff --git a/zh-cn/application-dev/media/video-playback.md b/zh-cn/application-dev/media/video-playback.md index bcf4cc3c69aef4e644f2787112f098b767a288b6..d68991c0a1fff0d436b57b04fc9cdfd2090dd54e 100644 --- a/zh-cn/application-dev/media/video-playback.md +++ b/zh-cn/application-dev/media/video-playback.md @@ -116,7 +116,7 @@ export class VideoPlayerDemo { console.info('pause success'); }, this.failureCallback).catch(this.catchCallback); - // 通过promise回调方式获取视频轨道信息ommunication_dsoftbus + // 通过promise回调方式获取视频轨道信息communication_dsoftbus let arrayDescription; await videoPlayer.getTrackDescription().then((arrlist) => { if (typeof (arrlist) != 'undefined') { diff --git a/zh-cn/application-dev/napi/Readme-CN.md b/zh-cn/application-dev/napi/Readme-CN.md index 6fc69e448fc805c819634d25b3945daf316774fc..c5a09227b1f18202bff8558a661013430a386d33 100644 --- a/zh-cn/application-dev/napi/Readme-CN.md +++ b/zh-cn/application-dev/napi/Readme-CN.md @@ -2,4 +2,5 @@ - [Native API在应用工程中的使用指导](napi-guidelines.md) - [Drawing开发指导](drawing-guidelines.md) +- [NativeWindow 开发指导](native_window-guidelines.md) - [Rawfile开发指导](rawfile-guidelines.md) diff --git a/zh-cn/application-dev/napi/native_window-guidelines.md b/zh-cn/application-dev/napi/native_window-guidelines.md index c30e463187e6bfd46046d8f8180de92bdf59add3..e1fef217387a4473ced7b4acf328f9fd963b6b20 100644 --- a/zh-cn/application-dev/napi/native_window-guidelines.md +++ b/zh-cn/application-dev/napi/native_window-guidelines.md @@ -12,18 +12,18 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,包括从`Surface`构建 | 接口名 | 描述 | | -------- | -------- | -| OH_NativeWindow_CreateNativeWindowFromSurface (void \*pSurface) | 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例。 | -| OH_NativeWindow_DestroyNativeWindow (struct NativeWindow \*window) | 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉。 | -| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void \*pSurfaceBuffer) | 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例。 | -| OH_NativeWindow_DestroyNativeWindowBuffer (struct NativeWindowBuffer \*buffer) | 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉。 | -| OH_NativeWindow_NativeWindowRequestBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*\*buffer, int \*fenceFd) | 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产。 | -| OH_NativeWindow_NativeWindowFlushBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer, int fenceFd, Region region) | 通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费。 | -| OH_NativeWindow_NativeWindowCancelBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer) | 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请。 | -| OH_NativeWindow_NativeWindowHandleOpt (struct NativeWindow \*window, int code,...) | 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等。 | -| OH_NativeWindow_GetBufferHandleFromNative (struct NativeWindowBuffer \*buffer) | 通过NativeWindowBuffer获取该buffer的BufferHandle指针。 | -| OH_NativeWindow_NativeObjectReference (void \*obj) | 增加一个NativeObject的引用计数。 | -| OH_NativeWindow_NativeObjectUnreference (void \*obj) | 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉。 | -| OH_NativeWindow_GetNativeObjectMagic (void \*obj) | 获取NativeObject的MagicId。 | +| OH_NativeWindow_CreateNativeWindowFromSurface (void \*pSurface) | 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例。 | +| OH_NativeWindow_DestroyNativeWindow (struct NativeWindow \*window) | 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉。 | +| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void \*pSurfaceBuffer) | 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例。 | +| OH_NativeWindow_DestroyNativeWindowBuffer (struct NativeWindowBuffer \*buffer) | 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉。 | +| OH_NativeWindow_NativeWindowRequestBuffer (struct NativeWindow \*window struct NativeWindowBuffer \*\*buffer, int \*fenceFd) | 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产。 | +| OH_NativeWindow_NativeWindowFlushBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer, int fenceFd, Region region) | 通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费。 | +| OH_NativeWindow_NativeWindowCancelBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer) | 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请。 | +| OH_NativeWindow_NativeWindowHandleOpt (struct NativeWindow \*window, int code,...) | 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等。 | +| OH_NativeWindow_GetBufferHandleFromNative (struct NativeWindowBuffer \*buffer) | 通过NativeWindowBuffer获取该buffer的BufferHandle指针。 | +| OH_NativeWindow_NativeObjectReference (void \*obj) | 增加一个NativeObject的引用计数。 | +| OH_NativeWindow_NativeObjectUnreference (void \*obj) | 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉。 | +| OH_NativeWindow_GetNativeObjectMagic (void \*obj) | 获取NativeObject的MagicId。 | 详细的接口说明请参考[native_window](../reference/native-apis/_native_window.md)。 diff --git a/zh-cn/application-dev/quick-start/app-provision-structure.md b/zh-cn/application-dev/quick-start/app-provision-structure.md index bccd6556b60d33765aefe13cbc0b62283e32aaf2..1e97d44baf1f06e4405f80070fe71c4b6d50679f 100644 --- a/zh-cn/application-dev/quick-start/app-provision-structure.md +++ b/zh-cn/application-dev/quick-start/app-provision-structure.md @@ -11,7 +11,7 @@ HarmonyAppProvision文件包含version-code对象、version-name对象、uuid对 | version-name | 表示版本号的文字描述,推荐使用三段数字版本号,如A.B.C。 | 字符串 | 必选 | 不可缺省 | | uuid | 表示文件的唯一ID号,用于OEM厂商标识HarmonyAppProvision文件,开源社区版本该属性不做强制要求。 | 字符串 | 必选 | 不可缺省 | | type | 表示HarmonyAppProvision文件的类型, 系统预定义的文件类型包括:debug(用于应用调试场景)和release(用于应用发布场景) ,开源社区版本该属性值建议为debug。 | 字符串 | 必选 | 不可缺省 | -| issuer | 表示HarmonyAPPProvision签发者。 | 字符串 | 必选 | 不可缺省 | +| issuer | 表示HarmonyAppProvision签发者。 | 字符串 | 必选 | 不可缺省 | | validity | 表示HarmonyAppProvision文件有效期的信息。参考[validity对象内部结构](#validity对象内部结构)。 | 对象 | 必选 | 不可缺省 | | bundle-info | 表示应用包以及开发者的信息。参考[bundle-info对象内部结构](#bundle-info对象内部结构)。 | 对象 | 必选 | 不可缺省 | | acls | 表示授权的acl权限信息。参考[acls对象内部结构](#acls对象内部结构)。 | 对象 | 可选 | 不可缺省 | @@ -71,7 +71,7 @@ HarmonyAppProvision文件示例: ### 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对象的内部结构 | 属性名称 | 含义 | 数据类型 | 是否必选 | 是否可缺省 | diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_202206250937.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_202206250937.png new file mode 100644 index 0000000000000000000000000000000000000000..c4aa65192d174763ee3b6c74e10274978868ac67 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_202206250937.png differ diff --git a/zh-cn/application-dev/quick-start/package-structure.md b/zh-cn/application-dev/quick-start/package-structure.md index 2f299bfa741d8f8d3b6b0d0286d12735db8d03a6..34142919b44784b74267c5897a3c80e0e15994da 100644 --- a/zh-cn/application-dev/quick-start/package-structure.md +++ b/zh-cn/application-dev/quick-start/package-structure.md @@ -501,11 +501,11 @@ skills示例: 表21 reqPermissions权限申请字段说明 -| 属性名称 | 含义 | **类型** | **取值范围** | **默认值** | **规则约束** | -| --------- | ------------------------------------------------------------ | -------- | ----------------------------------------------------------- | ---------------------- | ------------------------------------------------------------ | -| name | 必须,填写需要使用的权限名称。 | 字符串 | 自定义 | 无 | 未填写时,解析失败。 | -| reason | 可选,当申请的权限为user_grant权限时此字段必填。描述申请权限的原因。 | 字符串 | 显示文字长度不能超过256个字节。 | 空 | user_grant权限必填,否则不允许在应用市场上架。需做多语种适配。 | -| usedScene | 可选,当申请的权限为user_grant权限时此字段必填。描述权限使用的场景和时机。场景类型有:ability、when(调用时机)。可配置多个ability。 | 对象 | ability:ability的名称when:inuse(使用时)、always(始终) | ability:空when:inuse | user_grant权限必填ability,可选填when。 | +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| ---------- | ------------------------------------------------------------ | -------- | ------------------ | +| name | 需要使用的权限名称。 | 字符串 | 否 | +| reason | 描述申请权限的原因。不能超过256个字节。需要做多语种适配。 | 字符串 | 分情况:当申请的权限为user_grant时,必须填写此字段,否则不允许在应用市场上架;其它权限可缺省,缺省为空 | +| usedScene | 描述权限使用的场景和时机。场景类型有:ability、when。ability:ability的名称,可配置多个。when:调用时机,可填的值有inuse(使用时)、always(始终) | 对象 | ability分情况:申请的权限有user_grant时,ability必填;没有user_grant时可缺省,缺省值为空。when可缺省,缺省值为“inuse” | 表22 js对象的内部结构说明 diff --git a/zh-cn/application-dev/quick-start/start-with-ets-low-code.md b/zh-cn/application-dev/quick-start/start-with-ets-low-code.md index 0054fd8fbfbfc506f37f7127ebd9f62abcb3dac8..ac80b5edac057582e6cb6e3b189d088c0a2860d7 100644 --- a/zh-cn/application-dev/quick-start/start-with-ets-low-code.md +++ b/zh-cn/application-dev/quick-start/start-with-ets-low-code.md @@ -17,7 +17,7 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可 - 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。 -- 在已有工程中,创建visual文件来进行开发。 +- 在已有工程中,创建visual文件来进行开发。此种方式的操作可参考[创建visual文件支持低代码开发](#构建第二个页面)。 ## 创建新工程支持低代码开发 diff --git a/zh-cn/application-dev/quick-start/start-with-js-low-code.md b/zh-cn/application-dev/quick-start/start-with-js-low-code.md index e98ceb6a4956f2d85700011a2f89b47622c84912..bdd4bfad89140eacc919502e19bd0993885a3dff 100644 --- a/zh-cn/application-dev/quick-start/start-with-js-low-code.md +++ b/zh-cn/application-dev/quick-start/start-with-js-low-code.md @@ -15,7 +15,7 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可 - 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。 -- 在已有工程中,创建visual文件来进行开发。 +- 在已有工程中,创建visual文件来进行开发。此种方式的操作可参考[创建visual文件支持低代码开发](#构建第二个页面)。 ## 创建新工程支持低代码开发 @@ -82,10 +82,15 @@ OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可 ## 构建第二个页面 1. 创建第二个页面。 - 在“**Project**”窗口,打开“**entry > src > main > js > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > Visual**”,命名为“**second**”,单击“**Finish**”,即完成第二个页面的创建。可以看到文件目录结构如下: - + 在“**Project**”窗口,打开“**entry > src > main > js > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > Visual**”,命名为“**second**”,单击“**Finish**”,即完成第二个页面的创建。 + 新建visual文件的操作如下: + + create-newVisual + + 可以看到文件目录结构如下: + ![zh-cn_image_0000001223882030](figures/zh-cn_image_0000001223882030.png) - + 2. [删除画布原有模板组件。](#delete_origin_content) 3. [添加容器,设置Div容器的样式和属性。](#add_container) diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index 6f6e662b7fc21f6b274b6ec8ea317451d6ba29ad..3823eda73543a86d4a5d226682eb500ac459a2bf 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -1610,6 +1610,12 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri | abilityName | string | 是 | 表示要获取的配置文件所属的ability。 | | metadataName | string | 否 | 表示要获取的配置文件所属的[metadata](js-apis-bundle-Metadata.md)。 | +**返回值:** + +| 类型 | 说明 | +| ------------------------------------- | ------------------------------ | +| Promise\> | Promise形式返回配置文件的json字符串数组。 | + **示例:** ```js @@ -1670,6 +1676,12 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m | extensionAbilityName | string | 是 | 表示要获取的配置文件所属的extensionAbility。 | | metadataName | string | 否 | 表示要获取的配置文件所属的metadata。 | +**返回值:** + +| 类型 | 说明 | +| ------------------------------------- | ------------------------------ | +| Promise\> | Promise形式返回配置文件的json字符串数组。 | + **示例:** ```js diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index 46d6d818a18eb03634ca63ccba7de6002c8a7e87..d96e41caf98e3bbf94ab70bc66358d32be634305 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -1146,6 +1146,8 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback<void> 音频参数设置,使用callback方式异步返回结果。 +本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。 + **系统能力:** SystemCapability.Multimedia.Audio.Core **参数:** @@ -1159,7 +1161,7 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback<void> **示例:** ``` -audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => { +audioManager.setAudioParameter('key_example', 'value_example', (err) => { if (err) { console.error('Failed to set the audio parameter. ${err.message}'); return; @@ -1174,6 +1176,8 @@ setAudioParameter(key: string, value: string): Promise<void> 音频参数设置,使用Promise方式异步返回结果。 +本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。 + **系统能力:** SystemCapability.Multimedia.Audio.Core **参数:** @@ -1192,7 +1196,7 @@ setAudioParameter(key: string, value: string): Promise<void> **示例:** ``` -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.'); }); ``` @@ -1203,6 +1207,8 @@ getAudioParameter(key: string, callback: AsyncCallback<string>): void 获取指定音频参数值,使用callback方式异步返回结果。 +本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。 + **系统能力:** SystemCapability.Multimedia.Audio.Core **参数:** @@ -1215,7 +1221,7 @@ getAudioParameter(key: string, callback: AsyncCallback<string>): void **示例:** ``` -audioManager.getAudioParameter('PBits per sample', (err, value) => { +audioManager.getAudioParameter('key_example', (err, value) => { if (err) { console.error('Failed to obtain the value of the audio parameter. ${err.message}'); return; @@ -1230,6 +1236,8 @@ getAudioParameter(key: string): Promise<string> 获取指定音频参数值,使用Promise方式异步返回结果。 +本接口的使用场景为根据硬件设备支持能力扩展音频配置。在不同的设备平台上,所支持的音频参数会存在差异。示例代码内使用样例参数,实际支持的音频配置参数见具体设备平台的资料描述。 + **系统能力:** SystemCapability.Multimedia.Audio.Core **参数:** @@ -1247,7 +1255,7 @@ getAudioParameter(key: string): Promise<string> **示例:** ``` -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); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index b62e97fceb7038a876a81ea86f0db84288bb4879..62bd700f4d735e31882be508ec88d634aec7a3de 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -524,7 +524,7 @@ getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback<Array<Bund } }); - // 无maNum参数调用方式 + // 无maxNum参数调用方式 bundleState.getRecentlyUsedModules((err, res) => { if(err) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); @@ -1117,9 +1117,9 @@ merge(toMerge: BundleStateInfo): void | 名称 | 默认值 | 说明 | | ------------------ | ---- | ----------------- | -| ACTIVE_GROUP_ALIVE | 10 | 活跃分组 | -| ACTIVE_GROUP_DAILY | 20 | 经常使用,但当前并未在活跃态 | -| ACTIVE_GROUP_FIXED | 30 | 常用分组,定期使用,但不是每天使用 | -| ACTIVE_GROUP_RARE | 40 | 极少使用分组,不经常使用 | -| ACTIVE_GROUP_LIMIT | 50 | 受限使用分组 | -| ACTIVE_GROUP_NEVER | 60 | 从未使用分组,安装但是从未运行过 | \ No newline at end of file +| ACTIVE_GROUP_ALIVE | 10 | 活跃分组。 | +| ACTIVE_GROUP_DAILY | 20 | 经常使用,但当前并未在活跃态。 | +| ACTIVE_GROUP_FIXED | 30 | 常用分组,定期使用,但不是每天使用。 | +| ACTIVE_GROUP_RARE | 40 | 极少使用分组,不经常使用。 | +| ACTIVE_GROUP_LIMIT | 50 | 受限使用分组。 | +| ACTIVE_GROUP_NEVER | 60 | 从未使用分组,安装但是从未运行过。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md b/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md index 1ffa415cc114c461d8c6c5ad43bebd4f74480928..ac3c6a83908efb472f7282ef13675d72c387a1c8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md @@ -1,5 +1,7 @@ # 应用打点 +本模块提供了应用事件打点能力,包括对打点数据的落盘,以及对打点功能的管理配置。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-hilog.md b/zh-cn/application-dev/reference/apis/js-apis-hilog.md index 31f387c5829e9b9b1ccd11402885dd1b704c981c..ed08c559fd4ae6dbf6e3799aaed3fdea5ce7e5b3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hilog.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hilog.md @@ -23,7 +23,7 @@ isLoggable(domain: number, tag: string, level: LogLevel) : boolean | 参数名 | 类型 | 必填 | 说明 | | ------ | --------------------- | ---- | ------------------------------------------------------------ | -| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | +| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF。
建议开发者在应用内根据需要自定义划分。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | level | [LogLevel](#loglevel) | 是 | 日志级别。 | @@ -67,7 +67,7 @@ DEBUG级别的日志在正式发布版本中默认不被打印,只有在调试 | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------------------------------------------------------ | -| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | +| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF。
建议开发者在应用内根据需要自定义划分。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。
隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\过滤回显。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | @@ -98,7 +98,7 @@ info(domain: number, tag: string, format: string, ...args: any[]) : void | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------------------------------------------------------ | -| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | +| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF。
建议开发者在应用内根据需要自定义划分。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。
隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\过滤回显。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | @@ -129,7 +129,7 @@ warn(domain: number, tag: string, format: string, ...args: any[]) : void | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------------------------------------------------------ | -| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | +| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF。
建议开发者在应用内根据需要自定义划分。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。
隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\过滤回显。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | @@ -160,7 +160,7 @@ error(domain: number, tag: string, format: string, ...args: any[]) : void | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------------------------------------------------------ | -| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | +| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF。
建议开发者在应用内根据需要自定义划分。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。
隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\过滤回显。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | @@ -191,7 +191,7 @@ fatal(domain: number, tag: string, format: string, ...args: any[]) : void | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------------------------------------------------------ | -| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF,开发者可根据需要自定义。 | +| domain | number | 是 | 日志对应的领域标识,范围是0x0~0xFFFF。
建议开发者在应用内根据需要自定义划分。 | | tag | string | 是 | 指定日志标识,可以为任意字符串,建议用于标识调用所在的类或者业务行为。 | | format | string | 是 | 格式字符串,用于日志的格式化输出。格式字符串中可以设置多个参数,参数需要包含参数类型、隐私标识。
隐私标识分为{public}和{private},缺省为{private}。标识{public}的内容明文输出,标识{private}的内容以\过滤回显。 | | args | any[] | 是 | 与格式字符串format对应的可变长度参数列表。参数数目、参数类型必须与格式字符串中的标识一一对应。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md index cdb87531a4a61b4c852f20bd83a134405c6b727b..6cc5ea38e9bc6c15dfa73a02957d999c3406c5a0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md @@ -1,6 +1,6 @@ # 系统事件打点 -为系统hap应用提供系统事件打点接口。 +本模块提供了系统事件打点能力,包括系统事件的埋点、落盘系统事件的订阅及已落盘的系统事件的查询能力。 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-hitracechain.md b/zh-cn/application-dev/reference/apis/js-apis-hitracechain.md index 7cb6da52a058023bfb4b92e7ed24f8252bcfc6fa..bc6993d6dbf9f587cfad9cfa7693ab50ea739fc6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hitracechain.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hitracechain.md @@ -1,5 +1,7 @@ # 分布式跟踪 +本模块提供了端侧业务流程调用链跟踪的打点能力,包括业务流程跟踪的启动、结束、信息埋点等能力。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-hitracemeter.md b/zh-cn/application-dev/reference/apis/js-apis-hitracemeter.md index 14c49f64cd2180a71a90c274a9d71c7e17f5ed6b..83ff596c673f9d86a6617f507c51f6cf07cd7335 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hitracemeter.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hitracemeter.md @@ -1,5 +1,7 @@ # 性能打点 +本模块提供了追踪进程轨迹,度量程序执行性能的打点能力。本模块打点的数据供hiTraceMeter工具分析使用。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md b/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md index d5ecf4dd03dae5d63f2f28e480e2841135e3f88e..1eabfdf4b161a24fa2031fd187ebca5b729e15a5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md @@ -22,6 +22,8 @@ matchMediaSync(condition: string): MediaQueryListener 设置媒体查询的查询条件,并返回对应的监听句柄。 +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + **参数:** | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ---------------------------------------- | @@ -42,6 +44,7 @@ let listener = mediaquery.matchMediaSync('(orientation: landscape)'); //监听 媒体查询的句柄,并包含了申请句柄时的首次查询结果。 +**系统能力:** SystemCapability.ArkUI.ArkUI.Full ### 属性 @@ -57,6 +60,8 @@ on(type: 'change', callback: Callback<MediaQueryResult>): void 通过句柄向对应的查询条件注册回调,当媒体属性发生变更时会触发该回调。 +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------- | ---- | ---------------- | @@ -72,6 +77,9 @@ on(type: 'change', callback: Callback<MediaQueryResult>): void off(type: 'change', callback?: Callback<MediaQueryResult>): void 通过句柄向对应的查询条件去注册回调,当媒体属性发生变更时不在触发指定的回调。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------- | ---- | ----------------------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-radio.md b/zh-cn/application-dev/reference/apis/js-apis-radio.md index 3b60b6470b418fcb7e4f9d5132d9dbe0f300f478..d0114c03447b99cd162e45e6dee0ae28046dbf0b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-radio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-radio.md @@ -556,6 +556,346 @@ promise.then(data => { }); ``` +## radio.setPrimarySlotId8+ + +setPrimarySlotId(slotId: number, callback: AsyncCallback): void + +设置主卡所在卡槽的索引号,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。当设置成功,err为undefined,否则为错误对象。 | + +**示例:** + +```js +let slotId = 0; +radio.setPrimarySlotId(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.setPrimarySlotId8+ + +setPrimarySlotId\(slotId: number\): Promise\ + +设置主卡所在卡槽的索引号,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------------- | +| Promise\ | 无返回结果的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.getIMEI8+ + +getIMEI(callback: AsyncCallback): void + +获取设备的指定卡槽的IMEI,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ------------------------------------------ | +| callback | AsyncCallback\ | 是 | 回调函数,如果IMEI不存在,则返回空字符串。 | + +**示例:** + +```js +radio.getIMEI((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getIMEI8+ + +getIMEI(slotId: number, callback: AsyncCallback): void + +获取设备的指定卡槽的IMEI,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数,如果IMEI不存在,则返回空字符串。 | + +**示例:** + +```js +let slotId = 0; +radio.getIMEI(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getIMEI8+ + +getIMEI(slotId?: number): Promise + +获取设备的指定卡槽的IMEI,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------ | +| Promise\ | 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.getMEID8+ + +getMEID(callback: AsyncCallback): void + +获取设备的指定卡槽的MEID,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.getMEID((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getMEID8+ + +getMEID(slotId: number, callback: AsyncCallback): void + +获取设备的指定卡槽的MEID,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.getMEID(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getMEID8+ + +getMEID(slotId?: number): Promise + +获取设备的指定卡槽的MEID,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | --------------------------------------- | +| Promise\ | 以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.getUniqueDeviceId8+ + +getUniqueDeviceId(callback: AsyncCallback): void + +获取设备的指定卡槽的唯一设备ID,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.getUniqueDeviceId((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getUniqueDeviceId8+ + +getUniqueDeviceId(slotId: number, callback: AsyncCallback): void + +获取设备的指定卡槽的唯一设备ID,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.getUniqueDeviceId(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getUniqueDeviceId8+ + +getUniqueDeviceId(slotId?: number): Promise + +获取设备的指定卡槽的唯一设备ID,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | --------------------------------------------- | +| Promise\ | 以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 diff --git a/zh-cn/application-dev/reference/apis/js-apis-router.md b/zh-cn/application-dev/reference/apis/js-apis-router.md index 9fd1770d907ff0169795c06849ca91024be9be11..8442d3c6a9e236956b2728118fc78c783dc4a6ee 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-router.md @@ -190,6 +190,8 @@ getLength(): string 获取当前在页面栈内的页面数量。 +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + **返回值:** | 类型 | 说明 | | -------- | -------- | @@ -275,7 +277,7 @@ enableAlertBeforeBackPage(options: EnableAlertOptions): void 页面返回询问对话框选项。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。 +**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 | 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-screenshot.md b/zh-cn/application-dev/reference/apis/js-apis-screenshot.md index 2e8047f82ffef98c8f402e352b0feafcd0b8e204..80fb4d6513f144df309482ea15eac3d636d2c230 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screenshot.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screenshot.md @@ -19,11 +19,12 @@ import screenshot from '@ohos.screenshot'; **系统能力:** SystemCapability.WindowManager.WindowManager.Core -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | ------------- | ---- | ------------------------------------------------------------ | -| screenRect | [Rect](#rect) | 否 | 表示截取图像的区域,不传值默认为全屏。| -| imageSize | [Size](#size) | 否 | 表示截取图像的大小,不传值默认为全屏。| -| rotation | number | 否 | 表示截取图像的旋转角度,当前仅支持输入值为0,默认值为0。| +| 参数名 | 类型 | 必填 | 说明 | +| ---------------------- | ------------- | ---- | ------------------------------------------------------------ | +| screenRect | [Rect](#rect) | 否 | 表示截取图像的区域,不传值默认为全屏。 | +| imageSize | [Size](#size) | 否 | 表示截取图像的大小,不传值默认为全屏。 | +| rotation | number | 否 | 表示截取图像的旋转角度,当前仅支持输入值为0,默认值为0。 | +| displayId8+ | number | 否 | 表示截取图像的显示设备[Display](js-apis-display.md#display)的ID号。 | ## Rect @@ -63,10 +64,10 @@ save(options?: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>) **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | - | options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect,imageSize,rotation三个参数,需要分别设置这三个参数。 | - | callback | AsyncCallback<image.PixelMap> | 是 | 回调返回一个PixelMap对象。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | +| options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect,imageSize,rotation, displayId四个参数,可以分别设置这四个参数。 | +| callback | AsyncCallback<image.PixelMap> | 是 | 回调返回一个PixelMap对象。 | **示例:** @@ -80,7 +81,8 @@ save(options?: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>) "imageSize": { "width": 300, "height": 300}, - "rotation": 0 + "rotation": 0, + "displayId": 0 }; screenshot.save(ScreenshotOptions, (err, data) => { if (err) { @@ -105,13 +107,13 @@ save(options?: ScreenshotOptions): Promise<image.PixelMap> | 参数名 | 类型 | 必填 | 说明 | | ------- | --------------------------------------- | ---- | ------------------------------------------------------------ | -| options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect、imageSize、rotation三个参数,需要分别设置这三个参数。 | +| options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect、imageSize、rotation、displayId四个参数,可以分别设置这四个参数。 | **返回值:** - | 类型 | 说明 | - | ----------------------------- | ----------------------------------------------- | - | Promise<image.PixelMap> | 以Promise形式返回结果,返回image.PixelMap对象。 | +| 类型 | 说明 | +| ----------------------------- | ----------------------------------------------- | +| Promise<image.PixelMap> | 以Promise形式返回结果,返回image.PixelMap对象。 | **示例:** @@ -125,7 +127,8 @@ save(options?: ScreenshotOptions): Promise<image.PixelMap> "imageSize": { "width": 300, "height": 300}, - "rotation": 0 + "rotation": 0, + "displayId": 0 }; let promise = screenshot.save(ScreenshotOptions); promise.then(() => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-sim.md b/zh-cn/application-dev/reference/apis/js-apis-sim.md index ddbb645e74a3d2ba6ca53d6cb9a2ab83d88e2c66..8bc13522153775c987eaf83e0eba4ffaa948f224 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sim.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sim.md @@ -17,7 +17,7 @@ isSimActive\(slotId: number, callback: AsyncCallback\): void 获取指定卡槽SIM卡是否激活,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -41,7 +41,7 @@ isSimActive\(slotId: number\): Promise 获取指定卡槽SIM卡是否激活,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -73,7 +73,7 @@ getDefaultVoiceSlotId\(callback: AsyncCallback\): void 获取默认语音业务的卡槽ID,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -96,7 +96,7 @@ getDefaultVoiceSlotId\(\): Promise 获取默认语音业务的卡槽ID,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **返回值:** @@ -121,7 +121,7 @@ hasOperatorPrivileges(slotId: number, callback: AsyncCallback\): void 检查应用(调用者)是否已被授予运营商权限,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -144,7 +144,7 @@ hasOperatorPrivileges(slotId: number): Promise 检查应用(调用者)是否已被授予运营商权限,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -175,7 +175,7 @@ getISOCountryCodeForSim\(slotId: number, callback: AsyncCallback\): voi 获取指定卡槽SIM卡的ISO国家码,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -199,7 +199,7 @@ getISOCountryCodeForSim\(slotId: number\): Promise 获取指定卡槽SIM卡的ISO国家码,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -231,7 +231,7 @@ getSimOperatorNumeric\(slotId: number, callback: AsyncCallback\): void 获取指定卡槽SIM卡的归属PLMN(Public Land Mobile Network)号,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -255,7 +255,7 @@ getSimOperatorNumeric\(slotId: number\): Promise 获取指定卡槽SIM卡的归属PLMN(Public Land Mobile Network)号,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -287,7 +287,7 @@ getSimSpn\(slotId: number, callback: AsyncCallback\): void 获取指定卡槽SIM卡的服务提供商名称(Service Provider Name,SPN),使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -311,7 +311,7 @@ getSimSpn\(slotId: number\): Promise 获取指定卡槽SIM卡的服务提供商名称(Service Provider Name,SPN),使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -343,7 +343,7 @@ getSimState\(slotId: number, callback: AsyncCallback\): void 获取指定卡槽的SIM卡状态,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -367,7 +367,7 @@ getSimState\(slotId: number\): Promise 获取指定卡槽的SIM卡状态,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -398,7 +398,7 @@ getCardType\(slotId: number, callback: AsyncCallback\): void 获取指定卡槽SIM卡的卡类型,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -422,7 +422,7 @@ getCardType\(slotId: number\): Promise 获取指定卡槽SIM卡的卡类型,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -454,7 +454,7 @@ hasSimCard\(slotId: number, callback: AsyncCallback\): void 获取指定卡槽SIM卡是否插卡,使用callback方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -478,7 +478,7 @@ hasSimCard\(slotId: number\): Promise 获取指定卡槽SIM卡是否插卡,使用Promise方式作为异步方法。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **参数:** @@ -503,6 +503,1114 @@ promise.then(data => { }); ``` +## sim.getSimAccountInfo7+ + +getSimAccountInfo(slotId: number, callback: AsyncCallback): void + +获取SIM卡账户信息,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | 是 | 回调函数。参考[IccAccountInfo](#IccAccountInfo7)。 | + +**示例:** + +```js +sim.getSimAccountInfo(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getSimAccountInfo7+ + +getSimAccountInfo(slotId: number): Promise + +获取SIM卡账户信息,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------------------- | ------------------------------------------ | +| Promise<[IccAccountInfo](#IccAccountInfo7)\> | 以Promise形式返回指定卡槽SIM卡的账户信息。 | + +**示例:** + +```js +let promise = sim.getSimAccountInfo(0); +promise.then(data => { + console.log(`getSimAccountInfo success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getSimAccountInfo fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getActiveSimAccountInfoList8+ + +getActiveSimAccountInfoList(callback: AsyncCallback>): void + +获取活跃SIM卡账户信息列表,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\\> | 是 | 回调函数。 | + +**示例:** + +```js +sim.getActiveSimAccountInfoList(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getActiveSimAccountInfoList8+ + +getActiveSimAccountInfoList(): Promise>; + +获取活跃SIM卡账户信息列表,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | ---------------------------------------------- | +| Promise\> | 以Promise形式返回活跃卡槽SIM卡的账户信息列表。 | + +**示例:** + +```js +let promise = sim.getActiveSimAccountInfoList(); +promise.then(data => { + console.log(`getActiveSimAccountInfoList success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getActiveSimAccountInfoList fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.setDefaultVoiceSlotId7+ + +setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void + +设置默认语音业务的卡槽ID,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2
- -1:清除默认配置 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +sim.setDefaultVoiceSlotId(0,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.setDefaultVoiceSlotId7+ + +setDefaultVoiceSlotId(slotId: number): Promise\ + +设置默认语音业务的卡槽ID,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2
- -1:清除默认配置 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ------------------------------- | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +let promise = sim.setDefaultVoiceSlotId(0); +promise.then(data => { + console.log(`setDefaultVoiceSlotId success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setDefaultVoiceSlotId fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**setShowName**8+ + +setShowName\(slotId: number, name: string,callback: AsyncCallback\): void + +设置指定卡槽SIM卡显示的名称,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| name | string | 是 | SIM卡名称 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +const name='中国移动'; +sim.setShowName(0, name,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## sim.**setShowName**8+ + +setShowName\(slotId: number, name: string\): Promise\ + +设置指定卡槽SIM卡显示的名称,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| name | string | 是 | SIM卡名称 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ------------------------------- | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +const name='中国移动'; +let promise = sim.setShowName(0,name); +promise.then(data => { + console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setShowName fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**getShowName**8+ + +getShowName(slotId: number, callback: AsyncCallback): void + +获取指定卡槽SIM卡的名称,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<string> | 是 | 回调函数。 | + +**示例:** + +```js +sim.getShowName(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**getShowName**8+ + +getShowName(slotId: number): Promise + +获取指定卡槽SIM卡的名称,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | -------------------------------------- | +| Promise<string> | 以Promise形式返回指定卡槽SIM卡的名称。 | + +**示例:** + +```js +let promise = sim.getShowName(0); +promise.then(data => { + console.log(`getShowName success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getShowName fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**setShowNumber**8+ + +setShowNumber\(slotId: number, number: string,callback: AsyncCallback\): void + +设置指定卡槽SIM卡的号码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| number | string | 是 | SIM卡号码 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let number='+861xxxxxxxxxx'; +sim.setShowNumber(0, number,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**setShowNumber**8+ + +setShowNumber\(slotId: number,number: string\): Promise\ + +设置指定卡槽SIM卡的号码,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| number | string | 是 | SIM卡号码 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ------------------------------- | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +let number='+861xxxxxxxxxx'; +let promise = sim.setShowNumber(0,number); +promise.then(data => { + console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setShowNumber fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**getShowNumber**8+ + +getShowNumber(slotId: number,callback: AsyncCallback): void + +获取指定卡槽SIM卡的号码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<string> | 是 | 回调函数。 | + +**示例:** + +```js +sim.getShowNumber(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**getShowNumber**8+ + +getShowNumber(slotId: number): Promise + +获取指定卡槽SIM卡的号码,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | --------------------------------- | +| Promise<string> | 以Promise形式返回指定卡槽的号码。 | + +**示例:** + +```js +let promise = sim.getShowNumber(0); +promise.then(data => { + console.log(`getShowNumber success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getShowNumber fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**activateSim**8+ + +activateSim(slotId: number, callback: AsyncCallback): void + +激活指定卡槽SIM卡,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +sim.activateSim(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**activateSim**8+ + +activateSim(slotId: number): Promise\ + +激活指定卡槽SIM卡,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ------------------------------- | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +let promise = sim.activateSim(0); +promise.then(data => { + console.log(`activateSim success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`activateSim fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**deactivateSim**8+ + +deactivateSim(slotId: number, callback: AsyncCallback): void + +禁用指定卡槽SIM卡,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +sim.deactivateSim(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**deactivateSim**8+ + +deactivateSim(slotId: number): Promise\ + +禁用指定卡槽SIM卡,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ------------------------------- | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +let promise = sim.deactivateSim(0); +promise.then(data => { + console.log(`deactivateSim success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`deactivateSim fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.setLockState7+ + +setLockState(slotId: number, options: LockInfo, callback: AsyncCallback): void + +设置指定卡槽SIM卡的锁状态,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | +| options | [LockInfo](#LockInfo8) | 是 | 锁信息。
lockType: [LockType](#LockType8)
password: string
state: [LockState](#LockState8) | + +**示例:** + +```js +LockInfo.lockType = 1; +LockInfo.password = "1234"; +LockInfo.state = 0; +sim.setLockState(0, LockInfo, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.setLockState7+ + +setLockState(slotId: number, options: LockInfo): Promise + +设置指定卡槽SIM卡的锁状态,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| options | [LockInfo](#LockInfo8) | 是 | 锁信息。
lockType: [LockType](#LockType8)
password: string
state: [LockState](#LockState8) | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | -------------------------------------------- | +| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | + +**示例:** + +```js +LockInfo.lockType = 1; +LockInfo.password = "1234"; +LockInfo.state = 0; +let promise = sim.setLockState(0, LockInfo); +promise.then(data => { + console.log(`setLockState success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setLockState fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getLockState8+ + +getLockState(slotId: number, lockType: LockType, callback: AsyncCallback): void + +获取指定卡槽SIM卡的锁状态,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------- | ---- | --------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[LockState](#LockState8)\> | 是 | 回调函数。 | +| options | [LockType](#LockType8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | + +**示例:** + +```js +sim.getLockState(0, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getLockState8+ + +getLockState(slotId: number, lockType: LockType): Promise + +获取指定卡槽SIM卡的锁状态,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------- | ---- | --------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| options | [LockType](#LockType8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------- | -------------------------------------------- | +| Promise<[LockState](#LockState8)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | + +**示例:** + +```js +let promise = sim.getLockState(0, 1); +promise.then(data => { + console.log(`getLockState success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getLockState fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.alterPin7+ + +alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback): void + +更改Pin密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | +| newPin | string | 是 | 新密码。 | +| oldPin | string | 是 | 旧密码。 | + +**示例:** + +```js +sim.alterPin(0, "1234", "0000"(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.alterPin7+ + +alterPin(slotId: number, newPin: string, oldPin: string): Promise; + +更改Pin密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| newPin | string | 是 | 新密码。 | +| oldPin | string | 是 | 旧密码。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | --------------------------------------------- | +| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | + +**示例:** + +```js +let promise = sim.alterPin(0, "1234", "0000"); +promise.then(data => { + console.log(`alterPin success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`alterPin fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.alterPin28+ + +alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallback): void + +更改Pin2密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | +| newPin2 | string | 是 | 新密码。 | +| oldPin2 | string | 是 | 旧密码。 | + +**示例:** + +```js +sim.alterPin2(0, "1234", "0000", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.alterPin28+ + +alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise + +更改Pin2密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| newPin2 | string | 是 | 新密码。 | +| oldPin2 | string | 是 | 旧密码。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | --------------------------------------------- | +| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | + +**示例:** + +```js +let promise = sim.alterPin2(0, "1234","0000"); +promise.then(data => { + console.log(`alterPin2 success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`alterPin2 fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**unlockPin**7+ + +unlockPin(slotId: number,pin: string ,callback: AsyncCallback): void + +解锁指定卡槽SIM卡密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| pin | string | 是 | SIM卡的密码 | +| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | + +**示例:** + +```js +let pin='1234'; +sim.unlockPin(0, pin,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**unlockPin**7+ + +unlockPin(slotId: number,pin: string): Promise<LockStatusResponse\> + +解锁指定卡槽SIM卡密码,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| pin | string | 是 | SIM卡的密码 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | -------------------------------------------------- | +| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | + +**示例:** + +```js +let pin='1234'; +let promise = sim.unlockPin(0,pin); +promise.then(data => { + console.log(`unlockPin success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`unlockPin fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**unlockPuk**7+ + +unlockPuk(slotId: number,newPin: string,puk: string ,callback: AsyncCallback): void + +解锁指定卡槽SIM卡密码的解锁密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| newPin | string | 是 | 重置SIM卡的密码 | +| puk | string | 是 | SIM卡密码的解锁密码 | +| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | + +**示例:** + +```js +let puk='1xxxxxxx'; +let newPin='1235'; +sim.unlockPuk(0, newPin,puk,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**unlockPuk**7+ + +unlockPuk(slotId: number,newPin: string,puk: string): Promise<LockStatusResponse\> + +解锁指定卡槽SIM卡密码的解锁密码,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| newPin | string | 是 | 重置SIM卡的密码 | +| puk | string | 是 | SIM卡密码的解锁密码 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | -------------------------------------------------- | +| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | + +**示例:** + +```js +let puk='1xxxxxxx'; +let newPin='1235'; +let promise = sim.unlockPuk(0,newPin,puk); +promise.then(data => { + console.log(`unlockPuk success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`unlockPuk fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**unlockPin**28+ + +****unlockPin2****(slotId: number,pin2: string ,callback: AsyncCallback): void + +解锁指定卡槽SIM卡密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| pin2 | string | 是 | SIM卡的密码 | +| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | + +**示例:** + +```js +let pin2='1234'; +sim.unlockPin2(0, pin2,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**unlockPin**28+ + +unlockPin2(slotId: number,pin2: string): Promise<LockStatusResponse\> + +解锁指定卡槽SIM卡密码,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| pin2 | string | 是 | SIM卡的密码 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------------------- | -------------------------------------------------- | +| Promise\<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | + +**示例:** + +```js +let pin2='1234'; +let promise = sim.unlockPin2(0,pin2); +promise.then(data => { + console.log(`unlockPin2 success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`unlockPin2 fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.**unlockPuk**28+ + +unlockPuk2(slotId: number,newPin2: string,puk2: string ,callback: AsyncCallback): void + +解锁指定卡槽SIM卡密码的解锁密码,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| newPin2 | string | 是 | 重置SIM卡的密码 | +| puk2 | string | 是 | SIM卡密码的解锁密码 | +| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | + +**示例:** + +```js +let puk2='1xxxxxxx'; +let newPin2='1235'; +sim.unlockPuk2(0, newPin2,puk2,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.**unlockPuk2**8+ + +unlockPuk2slotId: number,newPin2: string,puk2: string): Promise<LockStatusResponse\> + +解锁指定卡槽SIM卡密码的解锁密码,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| newPin2 | string | 是 | 重置SIM卡的密码 | +| puk2 | string | 是 | SIM卡密码的解锁密码 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | -------------------------------------------------- | +| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | + +**示例:** + +```js +let puk2='1xxxxxxx'; +let newPin2='1235'; +let promise = sim.unlockPuk2(0,newPin2,puk2); +promise.then(data => { + console.log(`unlockPuk2 success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`unlockPuk2 fail, promise: err->${JSON.stringify(err)}`); +}); +``` ## sim.getMaxSimCount7+ @@ -510,7 +1618,7 @@ getMaxSimCount\(\): number 获取卡槽数量。 -**系统能力**:SystemCapability.Communication.CoreService +**系统能力**:SystemCapability.Telephony.CoreService **返回值:** @@ -557,4 +1665,110 @@ SIM卡状态。 |CU_DUAL_MODE_CARD | 42 | 中国联通双模卡 | |DUAL_MODE_TELECOM_LTE_CARD | 43 | 双模式电信LTE卡 | |DUAL_MODE_UG_CARD | 50 | 双模式UG卡 | -|SINGLE_MODE_ISIM_CARD8+ | 60 | 单一ISIM卡类型 | \ No newline at end of file +|SINGLE_MODE_ISIM_CARD8+ | 60 | 单一ISIM卡类型 | + +## LockType8+ + +锁类型。 + +该接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------- | ---- | ----------- | +| PIN_LOCK | 1 | SIM卡密码锁 | +| FDN_LOCK | 2 | 固定拨号锁 | + +## LockState8+ + +锁状态。 + +该接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------- | ---- | ---------- | +| LOCK_OFF | 0 | 锁关闭状态 | +| LOCK_ON | 1 | 锁开启状态 | + +## **PersoLockType**8+ + +定制锁类型。 + +该接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| ------------ | ---- | ----------------------------------------------- | +| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])* | +| PN_PUK_LOCK | 1 | 定制网络PUk锁 | +| PU_PIN_LOCK | 2 | 定制网络子集PIN锁*(参照 3GPP TS 22.022 [33])* | +| PU_PUK_LOCK | 3 | 定制网络子集PUK锁 | +| PP_PIN_LOCK | 4 | 定制服务提供者PIN锁*(参照 3GPP TS 22.022 [33])* | +| PP_PUK_LOCK | 5 | 定制服务提供者PUK锁 | +| PC_PIN_LOCK | 6 | 定制企业PIN锁*(参照 3GPP TS 22.022 [33])* | +| PC_PUK_LOCK | 7 | 定制企业Puk锁 | +| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* | +| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 | + +## **LockStatusResponse**7+ + +锁状态响应。 + +该接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| --------------- | ------ | ------------------ | +| result | number | 当前操作的结果 | +| remain?: number | number | 剩余次数(可以为空) | + +## **LockInfo**8+ + +锁状态响应。 + +该接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| -------- | --------- | ------ | +| lockType | LockType | 锁类型 | +| password | string | 密码 | +| state | LockState | 锁状态 | + +## **PersoLockInfo**8+ + +锁状态响应。 + +该接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| -------- | ------------- | ------------ | +| lockType | PersoLockType | 定制锁的类型 | +| password | string | 密码 | + +## **IccAccountInfo**7+ + +Icc账户信息。 + +该接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ---------- | ------- | ---------------- | +| simId | number | SIM卡ID | +| slotIndex | number | 卡槽ID | +| isEsim | boolean | 标记卡是否是eSim | +| isActive | boolean | 卡是否被激活 | +| iccId | string | ICCID号码 | +| showName | string | SIM卡显示名称 | +| showNumber | string | SIM卡显示号码 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-sms.md b/zh-cn/application-dev/reference/apis/js-apis-sms.md index e3d6d12eac2b8dc188818ec62849c659f4ebb1cc..c42d853bdc78a794e8f3372ba30513c4590d4800 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sms.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sms.md @@ -156,6 +156,68 @@ promise.then(data => { }); ``` +## sms.setDefaultSmsSlotId7+ + +setDefaultSmsSlotId\(slotId: number,callback: AsyncCallback<void>\): void + +设置发送短信的默认SIM卡槽ID,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | SIM卡槽ID。
- 0:卡槽1
- 1:卡槽2
- -1:清除默认配置 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +sms.setDefaultSmsSlotId(0,(err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.setDefaultSmsSlotId7+ + +setDefaultSmsSlotId\(slotId: number\): Promise<void> + +设置发送短信的默认SIM卡槽ID,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | SIM卡槽ID。
- 0:卡槽1
- 1:卡槽2
- -1:清除默认配置 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ------------------------------- | +| Promise\ | 无返回结果的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.setSmscAddr7+ @@ -163,12 +225,12 @@ setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\): 设置短信服务中心(SMSC)地址,使用callback方式作为异步方法。 +该接口为系统接口。 + **需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限 **系统能力**:SystemCapability.Telephony.SmsMms -**系统API**:该接口为系统接口,三方应用不支持调用。 - **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -190,16 +252,16 @@ sms.setSmscAddr(slotId, smscAddr, (err,data) => { ## sms.setSmscAddr7+ -setSmscAddr\(slotId: number, smscAddr: string\): Promise +setSmscAddr\(slotId: number, smscAddr: string\): Promise\ 设置短信服务中心(SMSC)地址,使用Promise方式作为异步方法。 +该接口为系统接口。 + **需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限 **系统能力**:SystemCapability.Telephony.SmsMms -**系统API**:该接口为系统接口,三方应用不支持调用。 - **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -233,12 +295,12 @@ getSmscAddr\(slotId: number, callback: AsyncCallback\): void 获取短信服务中心(SMSC)地址,使用callback方式作为异步方法。 +该接口为系统接口。 + **需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限 **系统能力**:SystemCapability.Telephony.SmsMms -**系统API**:该接口为系统接口,三方应用不支持调用。 - **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -262,12 +324,12 @@ getSmscAddr\(slotId: number\): Promise 获取短信服务中心(SMSC)地址,使用Promise方式作为异步方法。 +该接口为系统接口。 + **需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限 **系统能力**:SystemCapability.Telephony.SmsMms -**系统API**:该接口为系统接口,三方应用不支持调用。 - **参数:** | 参数名 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md b/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md index 87d7295989d2402e40a6485d04fd6ef15bf3808c..9bf205e19bc9a4d98419c3c8a7a5d1b5bc0d2c3d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @@ -55,9 +55,71 @@ getDefaultCellularDataSlotId(): Promise\ ```js let promise = data.getDefaultCellularDataSlotId(); promise.then((data) => { - console.log(`test success, promise: data->${JSON.stringify(data)}`); + console.log(`getDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`); }).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 + +设置默认移动数据的SIM卡,使用callback方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | SIM卡槽ID。
- 0:卡槽1。
- 1:卡槽2。
- -1:清除默认配置。 | +| callback | AsyncCallback\ | 是 | 回调函数。当设置成功,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\ + +设置默认移动数据的SIM卡,使用Promise方式作为异步方法。 + +该接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | SIM卡槽ID。
- 0:卡槽1。
- 1:卡槽2。
- -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)}`); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md index 323a24ebbd13773a98351c592d03bd7f905ad7a7..0daf3e9a555fc9c7c9b908776abce4b609c6dea0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @@ -601,7 +601,7 @@ getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback<image.Pixel | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 | - | callback | AsyncCallback<void> | 是 | 回调函数,调用成功则返回是否移除成功的结果,调用失败则返回error信息。 | + | callback | AsyncCallback<void> | 是 | 回调函数,调用成功则返回是否获取成功的结果,调用失败则返回error信息。 | **示例:** @@ -633,7 +633,7 @@ getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap> | 类型 | 说明 | | -------- | -------- | - | Promise<void> | 调用成功则返回是否移除成功的结果,调用失败则返回error信息。 | + | Promise<void> | 调用成功则返回是否获取成功的结果,调用失败则返回error信息。 | **示例:** diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001193499234.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001193499234.gif index 52fed39eeae057043dbd00abce9ff29d2c35a56a..15849e6bc210ed2bb7f7a798b145c9794972643c 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001193499234.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001193499234.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md b/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md index 0d30acaf2794c432ae1d152b0303c2b059effa45..4ccaf783fb5979b7537588427670f3a306e246af 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md @@ -123,7 +123,7 @@ requestFullscreen(value: boolean) - 参数 | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ----- | ------ | ---- | ----- | ------- | - | value | number | 是 | false | 是否全屏播放。 | + | value | boolean | 是 | false | 是否全屏播放。 | ### exitFullscreen diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001153834574.png b/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001153834574.png index 7836a009e5e3cb6351c807daf9b927c7d3b71a86..0c2d8e5bbe99ef28dd518d239948ef81b7b608dc 100644 Binary files a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001153834574.png and b/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001153834574.png differ diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001151375648.png b/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001151375648.png index f580415951aca78d1b933ffbad23d77daacafc2f..0360a88bc513f62e3b853b4b4ffec54168aa81b3 100644 Binary files a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001151375648.png and b/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001151375648.png differ diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001217858866.png b/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001217858866.png index e524495360609969011d8554d197ee04175e6b8f..35558537f96496bf642befe984cf76f820a2381e 100644 Binary files a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001217858866.png and b/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001217858866.png differ diff --git "a/zh-cn/readme/\347\252\227\345\217\243\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\347\252\227\345\217\243\345\255\220\347\263\273\347\273\237.md" index f08482a73f62c54f2cfec7f5d32c8272e0591809..daef3dbe83102d60bae9894eeb0ee6321b567438 100644 --- "a/zh-cn/readme/\347\252\227\345\217\243\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\347\252\227\345\217\243\345\255\220\347\263\273\347\273\237.md" @@ -53,7 +53,7 @@ foundation/windowmanager/ ## 相关仓 -- [graphic_standard](https://gitee.com/openharmony/graphic_standard) -- [ace_ace_engine](https://gitee.com/openharmony/ace_ace_engine) -- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard) +- [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d) +- [arkui_ace_engine](https://gitee.com/openharmony/arkui_ace_engine) +- [ability_ability_runtime](https://gitee.com/openharmony/ability_ability_runtime) - [multimodalinput_input](https://gitee.com/openharmony/multimodalinput_input) diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md index 58f3ae9277f61d707953b4dbc66678446fb801fd..f93d7594fc6b2c4475abea7edd1703b8e51459a8 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md @@ -142,7 +142,7 @@ repo forall -c 'git lfs pull' ## 修复缺陷列表 -**表6** 修复缺陷ISSUE列表 +**表4** 修复缺陷ISSUE列表 | ISSUE单 | 问题描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | @@ -153,7 +153,7 @@ repo forall -c 'git lfs pull' ## 遗留缺陷列表 -**表7** 遗留缺陷列表 +**表5** 遗留缺陷列表 | ISSUE | 问题描述 | 影响 | 计划解决日期 | | ------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------- | ------------ | diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md index 1d5d952ab4d29e70ac229b8332b078ac1b351e3f..edbda8f3faee19f2e53dda465b5d647bfffc47d7 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md @@ -138,7 +138,7 @@ ArkUI支持AbilityComponent组件将应用界面(Ability)作为控件嵌入 ### 特性变更 -**表2** 版本特性变更表 +**表3** 版本特性变更表 | 子系统名称 | 标准系统 | 轻量、小型系统 | | -------- | -------- | -------- | @@ -156,7 +156,7 @@ ArkUI支持AbilityComponent组件将应用界面(Ability)作为控件嵌入 | 全球化 | - 支持获取资源的同步接口,支持按资源名称获取资源,支持获取float等类型资源。
- 新增对MCC/MNC类型限定词资源的支持。
- 支持应用内不同模块独立编译。
- 支持获取区域偏好的年月日顺序。
- 获取本地文字的读音表达,例如汉字转拼音。
主要涉及如下需求:
I596AO 支持MCC/MNC限定词
I58ZSE 资源管理接口能力增强
I58ZSG 资源ID生成
I4WM02 音译
I4WK2O 日期顺序获取 | NA | | ArkUI | - 支持组件布局边界显示。
- 增强XComponent组件的鼠标操作,并且优化了输入法弹出时的布局调整,在应用性能方面进行了优化。
- 增强分栏与侧边栏组件能力,支持拖拽自动隐藏功能。
- AbilityComponent组件支持,支持将应用界面(Ability)作为控件嵌入其他应用显示。
主要涉及需求如下:
I58ZPY 支持解码降采样图片性能化
I58ZPX 支持CPU提频优化动画性能
I58ZPW 新增AbilityComponent组件
I58ZPS XComponent组件鼠标事件
I58ZPR 支持输入框拉起输入法应用时自动布局
I58ZPQ 分栏、侧边栏支持自由拖拽到小于最小宽度后自动隐藏功能
I58ZPP 图形绘制/辅助类组件支持显示布局边界
I58ZPO 按钮/选择/信息展示/动效类组件支持显示布局边界
I58ZPN 文本/输入/图片/视频/媒体类组件支持显示布局边界 | NA | | 程序访问控制 | - 新增SELinux针对service、hdf_service的标签保护能力。
- 新增Native服务的权限配置及校验能力。
主要涉及需求如下:
I58ZO1 针对service,提供selinux标签保护能力
I58ZO2 针对hdf_service,提供selinux标签保护能力
I58ZO3 accessToken支持native服务的权限校验机制 | NA | -| 公共基础类库 | TypedArray和SharedArrayBuffer支持ECMA 2021规范。
主要涉及如下需求:
I58ZPZ 支持TypeArray 2021规范
I58ZQ0 支持 shard array buffer 2021规范 | NA | +| 公共基础类库 | TypedArray和SharedArrayBuffer支持ECMA 2021规范。
主要涉及如下需求:
I58ZPZ 支持TypedArray 2021规范
I58ZQ0 支持 shard array buffer 2021规范 | NA | | 语言编译运行时 | - 方舟虚拟机支持多实例调试,以及条件断点和watch表达式。
主要涉及如下需求:
I58ZQE 方舟支持多实例调试
I58ZQD 方舟支持条件断点
I58ZQB 方舟支持watch变量及表达式
I58ZQ8 支持TSAOT优化编译器生成代码支持ArkJS运行时GC特性
I58ZQ7 支持TSAOT优化编译器后端机器码生成框架适配 | NA | | 升级服务 | 新增适配RK 3568。
主要涉及如下需求:
I58ZSM update_service部件支持RK 3568升级适配
I58ZSO updater部件支持RK 3568升级适配 | NA | | Misc软件服务 | 补齐API6前的http文件上传、下载接口。
主要涉及如下需求:
I58ZSC 【download】支持\@system.request接口
I53J82  【upload】支持\@system.request接口 | NA | @@ -182,7 +182,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_ ### Samples -**表2** 新增Samples +**表4** 新增Samples | 子系统 | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -------- | @@ -214,7 +214,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_ ## 修复缺陷列表 -**表6** 修复缺陷ISSUE列表 +**表5** 修复缺陷ISSUE列表 | ISSUE单 | 问题描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | @@ -223,7 +223,7 @@ _[API差异报告](api-change/v3.2-beta/readme.md)_ ## 遗留缺陷列表 -**表7** 遗留缺陷列表 +**表6** 遗留缺陷列表 | ISSUE | 问题描述 | 影响 | 计划解决日期 | | ------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------ | ------------ | diff --git a/zh-cn/release-notes/api-change/v3.2-beta/js-apidiff-arkui.md b/zh-cn/release-notes/api-change/v3.2-beta/js-apidiff-arkui.md index 9c3237a7b2c1a4aa932fd83db9e1fbabc082be97..ac8a0227e5243e55679ba20677cbeb4abbff4d7f 100644 --- a/zh-cn/release-notes/api-change/v3.2-beta/js-apidiff-arkui.md +++ b/zh-cn/release-notes/api-change/v3.2-beta/js-apidiff-arkui.md @@ -1,6 +1,6 @@ # ArkUI子系统JS API变更 -OpenHarmony 3.2 Beta1版本相较于OpenHarmony 3.1 Release版本,电源服务子系统的API变更如下: +OpenHarmony 3.2 Beta1版本相较于OpenHarmony 3.1 Release版本,ArkUI子系统的API变更如下: ## 接口变更