提交 e9ae5d12 编写于 作者: 陈浩 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

......@@ -28,6 +28,6 @@ This repository stores device and application development documents provided by
### Historical Stable Versions
OpenHarmony_v1.x_release: OpenHarmony v1.1.2 LTS. [Learn more](en/release-notes/OpenHarmony-v1.1.2-LTS.md)
OpenHarmony_v1.x_release: OpenHarmony v1.1.4 LTS. [Learn more](en/release-notes/OpenHarmony-v1-1-4-LTS.md)
[More versions](en/release-notes/)
......@@ -8,6 +8,8 @@
```
import dataAbility from '@ohos.data.dataAbility'
```
## System Capabilities
SystemCapability.DistributedDataManager.DataShare.Consumer
## Required Permissions<a name="section11257113618419"></a>
......@@ -1336,7 +1338,7 @@ Sets the **DataAbilityPredicates** to filter out duplicate records.
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME")
let resultSet = await rdbStore.query(predicates, ["NAME"])
rdbStore.query(predicates, ["NAME"])
```
......
......@@ -3,6 +3,9 @@
>![](../../public_sys-resources/icon-note.gif) **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.
## System Capabilities
SystemCapability.DistributedDataManager.RelationalStore.Core
## Usage<a name="section42211227142416"></a>
The **resultSet** object is obtained by using [**RdbStore.query\(\)**](js-apis-data-rdb.md#section6231155031814).
......@@ -13,8 +16,8 @@ let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("AGE", 18)
let promise = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promise.then((resultSet) => {
await console.log(TAG + "resultSet columnNames:" + resultSet.columnNames);
await console.log(TAG + "resultSet columnCount:" + resultSet.columnCount);})
console.log("resultSet columnNames:" + resultSet.columnNames);
console.log("resultSet columnCount:" + resultSet.columnCount);
```
## Required Permissions<a name="section11257113618419"></a>
......@@ -291,10 +294,11 @@ Moves the cursor to the row based on the specified offset.
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goTo(1)
resultSet.close()
resultSet = null
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goTo(1);
resultSet.close();
resultSet = null;
})
```
......@@ -351,10 +355,11 @@ Moves the cursor to the specified row in the result set.
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToRow(1)
resultSet.close()
resultSet = null
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToRow(1);
resultSet.close();
resultSet = null
})
```
......@@ -385,10 +390,11 @@ Moves the cursor to the first row of the result set.
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToFirstRow()
resultSet.close()
resultSet = null;
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToFirstRow();
resultSet.close();
resultSet = null;
})
```
......@@ -419,10 +425,11 @@ Moves the cursor to the last row of the result set.
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToLastRow()
resultSet.close()
resultSet = null;
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToLastRow();
resultSet.close();
resultSet = null;
})
```
......@@ -453,10 +460,11 @@ Moves the cursor to the next row in the result set.
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToNextRow()
resultSet.close()
resultSet = null;
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToNextRow()
resultSet.close()
resultSet = null;
})
```
......@@ -487,10 +495,11 @@ Moves the cursor to the previous row in the result set.
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToPreviousRow()
resultSet.close()
resultSet = null
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToPreviousRow();
resultSet.close();
resultSet = null
})
```
......@@ -780,9 +789,10 @@ Closes the result set.
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.close()
resultSet = null
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.close();
resultSet = null
})
```
......@@ -11,6 +11,9 @@ Lightweight storage provides applications with data processing capability and al
import dataStorage from '@ohos.data.storage'
```
## System Capabilities
SystemCapability.DistributedDataManager.Preference.Core
## Required Permissions<a name="section11257113618419"></a>
None
......@@ -109,11 +112,13 @@ Reads a specified file and loads the data to the **Storage** instance for data
import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
var path = await context.getFilesDir()
let storage = dataStorage.getStorageSync(path + '/mystore')
storage.putSync('startup', 'auto')
storage.flushSync()
(async () => {
var context = featureAbility.getContext()
var path = await context.getFilesDir()
let storage = dataStorage.getStorageSync(path + '/mystore')
storage.putSync('startup', 'auto')
storage.flushSync()
})()
```
......@@ -163,9 +168,10 @@ Reads a specified file and loads the data to the **Storage** instance for data
import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
var path = await context.getFilesDir()
dataStorage.getStorage(path + '/mystore', function (err, storage) {
(async () => {
var context = featureAbility.getContext()
var path = await context.getFilesDir()
dataStorage.getStorage(path + '/mystore', function (err, storage) {
if (err) {
console.info("Get the storage failed, path: " + path + '/mystore')
return;
......@@ -173,6 +179,7 @@ Reads a specified file and loads the data to the **Storage** instance for data
storage.putSync('startup', 'auto')
storage.flushSync()
})
})()
```
......@@ -230,15 +237,17 @@ Reads a specified file and loads the data to the **Storage** instance for data
import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
var path = await context.getFilesDir()
let promise = dataStorage.getStorage(path + '/mystore')
promise.then((storage) => {
(async () => {
var context = featureAbility.getContext()
var path = await context.getFilesDir()
let promise = dataStorage.getStorage(path + '/mystore')
promise.then((storage) => {
storage.putSync('startup', 'auto')
storage.flushSync()
}).catch((err) => {
console.info("Get the storage failed, path: " + path + '/mystore')
})
}()
```
......
......@@ -6,9 +6,9 @@
import deviceInfo from '@ohos.deviceInfo'
```
## Required Permissions<a name="section373mcpsimp"></a>
## System Capabilities<a name="section373mcpsimp"></a>
None
SystemCapability.Startup.SysInfo
## Attributes<a name="section62871841172112"></a>
......@@ -347,4 +347,3 @@ None
</tr>
</tbody>
</table>
......@@ -8,10 +8,9 @@
```
import distributedData from '@ohos.data.distributedData';
```
## System Capabilities
SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
## Required Permissions<a name="section11257113618419"></a>
None
## distributedData.createKVManager<a name="section2771164881119"></a>
......
......@@ -6,7 +6,7 @@
## Modules to Import
```js
import statfs from '@ohos.statfs'
import statfs from '@ohos.statfs';
```
## Note
......@@ -18,7 +18,7 @@ Absolute file or directory path = Application directory + File name or directory
For example, if the application directory obtained by using **getOrCreateLocalDir** is **dir** and the file name is **xxx.txt**, the absolute path of the file is as follows:
```js
let path = dir + "xxx.txt"
let path = dir + "xxx.txt";
```
## System Capabilities
......@@ -46,7 +46,12 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
- Example
```js
let num = await statfs.getFreeBytes(path);
let path = "/data";
statfs.getFreeBytes(path).then(function (number){
console.info("getFreeBytes successfully:"+ number);
}).catch(function(err){
console.info("getFreeBytes failed with error:"+ err);
});
```
## statfs.getFreeBytes
......@@ -91,7 +96,12 @@ Obtains the total number of bytes of the specified file system in asynchronous m
- Example
```js
let num = await statfs.getTotalBytes(path);
let path = "/data";
statfs.getTotalBytes(path).then(function (number){
console.info("getTotalBytes successfully:"+ number);
}).catch(function(err){
console.info("getTotalBytes failed with error:"+ err);
});
```
## statfs.getTotalBytes
......
# Update
The update module applies to updates throughout the entire OpenHarmony system, including built-in resources and preset applications, but not third-party applications.
The update module applies to updates throughout the entire system, including built-in resources and preset applications, but not third-party applications.
There are two types of updates: SD card update and over the air (OTA) update.
......
......@@ -41,7 +41,7 @@ None
<td class="cellrowborder" valign="top" width="52.42%" headers="mcps1.1.6.1.5 "><p id="p72131224114411"><a name="p72131224114411"></a><a name="p72131224114411"></a>Protocol in the URI.</p>
</td>
</tr>
<tr id="row58631729183511"><td class="cellrowborder" valign="top" width="15.870000000000001%" headers="mcps1.1.6.1.1 "><p id="p1669917383355"><a name="p1669917383355"></a><a name="p1669917383355"></a>userinfo</p>
<tr id="row58631729183511"><td class="cellrowborder" valign="top" width="15.870000000000001%" headers="mcps1.1.6.1.1 "><p id="p1669917383355"><a name="p1669917383355"></a><a name="p1669917383355"></a>userInfo</p>
</td>
<td class="cellrowborder" valign="top" width="10.86%" headers="mcps1.1.6.1.2 "><p id="p986510296359"><a name="p986510296359"></a><a name="p986510296359"></a>string</p>
</td>
......
# LoadingProgress
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **<LoadingProgress\>** component is used to display the loading progress.
## Required Permissions
None
## Child Components
None
## APIs
LoadingProgress()
Creates a **LoadingProgress** instance.
## Attributes
| Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- |
| color | Color | - | Foreground color of the loading progress bar.|
## Example
```
@Entry
@Component
struct LoadingProgressExample {
build() {
Column({ space: 5 }) {
Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('90%')
LoadingProgress()
.color(Color.Blue)
}.width('100%').margin({ top: 5 })
}
}
```
![zh-cn_image_0000001198839004](figures/loadingProgress.png)
此差异已折叠。
......@@ -3,6 +3,7 @@
- [Compilation and Building](subsys-build.md)
- [Building Guidelines for Mini and Small Systems](subsys-build-mini-lite.md)
- [Building Guidelines for Standard Systems](subsys-build-standard-large.md)
- [Build System Coding Specifications and Best Practices](subsys-build-gn-coding-style-and-best-practice.md)
- [Distributed Remote Startup](subsys-remote-start.md)
- [Graphics](subsys-graphics.md)
- [Graphics](subsys-graphics-overview.md)
......@@ -81,7 +82,14 @@
- [DFX](subsys-dfx-overview.md)
- [Development Guidelines on HiLog ](subsys-dfx-hilog-rich.md)
- [Development Guidelines on HiLog\_Lite](subsys-dfx-hilog-lite.md)
- [HiTrace Development](subsys-dfx-hitrace.md)
- [HiCollie Development](subsys-dfx-hicollie.md)
- [Development Guidelines on HiSysEvent](subsys-dfx-hisysevent.md)
- [HiSysEvent Development](subsys-dfx-hisysevent.md)
- [HiSysEvent Logging](subsys-dfx-hisysevent-logging.md)
- [HiSysEvent Listening](subsys-dfx-hisysevent-listening.md)
- [HiSysEvent Query](subsys-dfx-hisysevent-query.md)
- [HiSysEvent Tool Usage](subsys-dfx-hisysevent-tool.md)
- [R&D Tools](subsys-toolchain.md)
- [bytrace Usage Guidelines](subsys-toolchain-bytrace-guide.md)
- [hdc\_std Usage Guidelines](subsys-toolchain-hdc-guide.md)
......
......@@ -15,7 +15,7 @@ HiSysEvent supports listening for events across processes. You can register a li
</th>
</tr>
</thead>
<tbody><tr id="row16441155818499"><td class="cellrowborder" valign="top" width="48.120000000000005%" headers="mcps1.2.3.1.1 "><p id="p877916438211"><a name="p877916438211"></a><a name="p877916438211"></a>int HiSysEventManager::AddEventListener(std::shared_ptr&lt;HiSysEventSubscribeCallBackBase&gt; listener, std::vector&lt;struct ListenerRule&gt;&amp; rules)</p>
<tbody><tr id="row16441155818499"><td class="cellrowborder" valign="top" width="48.120000000000005%" headers="mcps1.2.3.1.1 "><p id="p877916438211"><a name="p877916438211"></a><a name="p877916438211"></a>int HiSysEventManager::AddEventListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener, std::vector&lt;struct ListenerRule&gt;&amp; rules)</p>
</td>
<td class="cellrowborder" valign="top" width="51.88%" headers="mcps1.2.3.1.2 "><p id="p14727325133216"><a name="p14727325133216"></a><a name="p14727325133216"></a>Registers a listener for system events. You can listen for certain events by specifying rules.</p>
<p id="p167271525203213"><a name="p167271525203213"></a><a name="p167271525203213"></a>Input arguments:</p>
......@@ -24,7 +24,7 @@ HiSysEvent supports listening for events across processes. You can register a li
<a name="ul12105842111913"></a><a name="ul12105842111913"></a><ul id="ul12105842111913"><li><strong id="b117641849702"><a name="b117641849702"></a><a name="b117641849702"></a>0</strong>: Repeated registration is successful.</li><li><strong id="b2682415314"><a name="b2682415314"></a><a name="b2682415314"></a>1</strong>: Initial registration is successful.</li><li>Other values: Registration has failed.</li></ul>
</td>
</tr>
<tr id="row910319443242"><td class="cellrowborder" valign="top" width="48.120000000000005%" headers="mcps1.2.3.1.1 "><p id="p15104154411248"><a name="p15104154411248"></a><a name="p15104154411248"></a>void HiSysEventManager::RemoveListener(std::shared_ptr&lt;HiSysEventSubscribeCallBackBase&gt; listener)</p>
<tr id="row910319443242"><td class="cellrowborder" valign="top" width="48.120000000000005%" headers="mcps1.2.3.1.1 "><p id="p15104154411248"><a name="p15104154411248"></a><a name="p15104154411248"></a>void HiSysEventManager::RemoveListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener)</p>
</td>
<td class="cellrowborder" valign="top" width="51.88%" headers="mcps1.2.3.1.2 "><p id="p1104194420248"><a name="p1104194420248"></a><a name="p1104194420248"></a>Removes the listener for system events.</p>
<p id="p7943171095411"><a name="p7943171095411"></a><a name="p7943171095411"></a>Input arguments:</p>
......@@ -72,7 +72,7 @@ HiSysEvent supports listening for events across processes. You can register a li
</th>
</tr>
</thead>
<tbody><tr id="row111823719274"><td class="cellrowborder" valign="top" width="48.25%" headers="mcps1.2.3.1.1 "><p id="p161181537112712"><a name="p161181537112712"></a><a name="p161181537112712"></a>void HiSysEventSubscribeCallBackBase::OnHandle(const std::string&amp; domain, const std::string&amp; eventName, const int eventType, const std::string&amp; eventDetail)</p>
<tbody><tr id="row111823719274"><td class="cellrowborder" valign="top" width="48.25%" headers="mcps1.2.3.1.1 "><p id="p161181537112712"><a name="p161181537112712"></a><a name="p161181537112712"></a>void HiSysEventSubscribeCallBack::OnHandle(const std::string&amp; domain, const std::string&amp; eventName, const int eventType, const std::string&amp; eventDetail)</p>
</td>
<td class="cellrowborder" valign="top" width="51.74999999999999%" headers="mcps1.2.3.1.2 "><p id="p1772213111011"><a name="p1772213111011"></a><a name="p1772213111011"></a>Callback object for system events.</p>
<p id="p182081719151016"><a name="p182081719151016"></a><a name="p182081719151016"></a>Input arguments:</p>
......@@ -97,11 +97,11 @@ In this example, you'll be instructed to register a listener for all system even
- Implement the callback API.
HiSysEventSubscribeCallBackBase::OnHandle\(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail\)
HiSysEventSubscribeCallBack::OnHandle\(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail\)
- Register a callback object.
HiSysEventManager::AddEventListener\(std::shared\_ptr<HiSysEventSubscribeCallBackBase\> listener, std::vector<struct ListenerRule\>& rules\)
HiSysEventManager::AddEventListener\(std::shared\_ptr<HiSysEventSubscribeCallBack\> listener, std::vector<struct ListenerRule\>& rules\)
```
......
......@@ -15,7 +15,7 @@ HiSysEvent provides an API for you to query system events. You can query concern
</th>
</tr>
</thead>
<tbody><tr id="row16441155818499"><td class="cellrowborder" valign="top" width="48.120000000000005%" headers="mcps1.2.3.1.1 "><p id="p114411558204915"><a name="p114411558204915"></a><a name="p114411558204915"></a>bool HiSysEventManager::QueryHiSysEvent(struct QueryArg&amp; queryArg, std::vector&lt;struct QueryRule&gt;&amp; queryRules, std::shared_ptr&lt;HiSysEventQueryCallBackBase&gt; queryCallBack)</p>
<tbody><tr id="row16441155818499"><td class="cellrowborder" valign="top" width="48.120000000000005%" headers="mcps1.2.3.1.1 "><p id="p114411558204915"><a name="p114411558204915"></a><a name="p114411558204915"></a>bool HiSysEventManager::QueryHiSysEvent(struct QueryArg&amp; queryArg, std::vector&lt;struct QueryRule&gt;&amp; queryRules, std::shared_ptr&lt;HiSysEventQueryCallBack&gt; queryCallBack)</p>
</td>
<td class="cellrowborder" valign="top" width="51.88%" headers="mcps1.2.3.1.2 "><p id="p14727325133216"><a name="p14727325133216"></a><a name="p14727325133216"></a>Queries system events by specifying search criteria such as the time segment, event domain, and event name.</p>
<p id="p167271525203213"><a name="p167271525203213"></a><a name="p167271525203213"></a>Input arguments:</p>
......@@ -90,7 +90,7 @@ HiSysEvent provides an API for you to query system events. You can query concern
</th>
</tr>
</thead>
<tbody><tr id="row35141554151115"><td class="cellrowborder" valign="top" width="48.03%" headers="mcps1.2.3.1.1 "><p id="p4714143785410"><a name="p4714143785410"></a><a name="p4714143785410"></a>void HiSysEventQueryCallBackBase::OnQuery(const ::std::vector&lt;std::string&gt;&amp; sysEvent, const ::std::vector&lt;int64_t&gt;&amp; seq)</p>
<tbody><tr id="row35141554151115"><td class="cellrowborder" valign="top" width="48.03%" headers="mcps1.2.3.1.1 "><p id="p4714143785410"><a name="p4714143785410"></a><a name="p4714143785410"></a>void HiSysEventQueryCallBack::OnQuery(const ::std::vector&lt;std::string&gt;&amp; sysEvent, const ::std::vector&lt;int64_t&gt;&amp; seq)</p>
</td>
<td class="cellrowborder" valign="top" width="51.970000000000006%" headers="mcps1.2.3.1.2 "><p id="p1772213111011"><a name="p1772213111011"></a><a name="p1772213111011"></a>Callback object for event query.</p>
<p id="p182081719151016"><a name="p182081719151016"></a><a name="p182081719151016"></a>Input arguments:</p>
......@@ -98,7 +98,7 @@ HiSysEvent provides an API for you to query system events. You can query concern
<p id="p18209419201010"><a name="p18209419201010"></a><a name="p18209419201010"></a>Return value: none</p>
</td>
</tr>
<tr id="row15141154161111"><td class="cellrowborder" valign="top" width="48.03%" headers="mcps1.2.3.1.1 "><p id="p561110151119"><a name="p561110151119"></a><a name="p561110151119"></a>void HiSysEventQueryCallBackBase::OnComplete(int32_t reason, int32_t total)</p>
<tr id="row15141154161111"><td class="cellrowborder" valign="top" width="48.03%" headers="mcps1.2.3.1.1 "><p id="p561110151119"><a name="p561110151119"></a><a name="p561110151119"></a>void HiSysEventQueryCallBack::OnComplete(int32_t reason, int32_t total)</p>
</td>
<td class="cellrowborder" valign="top" width="51.970000000000006%" headers="mcps1.2.3.1.2 "><p id="p126315352130"><a name="p126315352130"></a><a name="p126315352130"></a>Callback object for completion of event query.</p>
<p id="p6631235191316"><a name="p6631235191316"></a><a name="p6631235191316"></a>Input arguments:</p>
......@@ -123,13 +123,13 @@ In this example, you'll be instructed to query all system events.
- Implement the callback API.
void HiSysEventQueryCallBackBase::OnQuery\(const ::std::vector<std::string\>& sysEvent, const ::std::vector<int64\_t\>& seq\)
void HiSysEventQueryCallBack::OnQuery\(const ::std::vector<std::string\>& sysEvent, const ::std::vector<int64\_t\>& seq\)
void HiSysEventQueryCallBackBase::OnComplete\(int32\_t reason, int32\_t total\)
void HiSysEventQueryCallBack::OnComplete\(int32\_t reason, int32\_t total\)
- Invoke the query API in the corresponding service logic.
HiSysEventManager::QueryHiSysEvent\(struct QueryArg& queryArg, std::vector<struct QueryRule\>& queryRules, std::shared\_ptr<HiSysEventQueryCallBackBase\> queryCallBack\)
HiSysEventManager::QueryHiSysEvent\(struct QueryArg& queryArg, std::vector<struct QueryRule\>& queryRules, std::shared\_ptr<HiSysEventQueryCallBack\> queryCallBack\)
```
......
# DHiSysEvent Development<a name="EN-US_TOPIC_0000001195021448"></a>
- **[HiSysEvent Logging Configuration](subsys-dfx-hisysevent-logging-config.md)**
# HiSysEvent Development<a name="EN-US_TOPIC_0000001195021448"></a>
- **[HiSysEvent Logging](subsys-dfx-hisysevent-logging.md)**
......
......@@ -7,5 +7,5 @@
- [HiSysEvent Logging](subsys-dfx-hisysevent-logging.md)
- [HiSysEvent Listening](subsys-dfx-hisysevent-listening.md)
- [HiSysEvent Query](subsys-dfx-hisysevent-query.md)
- [HiSysEvent Tool Usage](subsys-dfx-hisysevent-tool-usage.md)
- [HiSysEvent Tool Usage](subsys-dfx-hisysevent-tool.md)
# OpenHarmony 1.1.4 LTS
## Version Description
OpenHarmony 1.1.4 LTS is a maintenance version with a tag of OpenHarmony 1.1.3 LTS. This version has rectified certain issues and security vulnerabilities detected in OpenHarmony 1.1.3 LTS.
## Version Mapping
**Table 1** Version mapping of software and tools
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 1.1.4&nbsp;LTS | NA |
| (Optional) HUAWEI&nbsp;DevEco&nbsp;Device&nbsp;Tool| 2.2&nbsp;Beta2 | Recommended for developing OpenHarmony smart devices|
## Source Code Acquisition
### Acquiring Source Code Using the repo Tool
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have an SSH public key for access to Gitee.\)
```
repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v1.1.4-LTS --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
Method 2: Use the **repo** tool to download the source code over HTTPS.
```
repo init -u https://gitee.com/openharmony/manifest.git -b refs/tags/OpenHarmony-v1.1.4-LTS --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
### Acquiring Source Code from Mirrors
**Table 2** Mirrors for acquiring source code
| Source Code| Version| Mirror| SHA-256 Checksum|
| -------- | -------- | -------- | -------- |
| Full code base| 1.1.4 | [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/code-v1.1.4-LTS.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/code-v1.1.4-LTS.tar.gz.sha256)|
| Hi3861 solution (binary) for the mini system| 1.1.4 | [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/wifiiot-1.1.4.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/wifiiot-1.1.4.tar.gz.sha256)|
| Hi3518 solution (binary) for the small system| 1.1.4 | [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/ipcamera_hi3518ev300-1.1.4.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/ipcamera_hi3518ev300-1.1.4.tar.gz.sha256)|
| Hi3516 solution (binary) for the small system| 1.1.4 | [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/ipcamera_hi3516dv300-1.1.4.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/1.1.4/ipcamera_hi3516dv300-1.1.4.tar.gz.sha256)|
## What's New
This version has the following updates to OpenHarmony 1.1.3 LTS.
### Feature Updates
This version does not involve feature updates.
### Change
This version does not involve API updates.
### Chip and Development Board Adaptation
For details about the adaptation status, see [SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md).
## Resolved Issues
**Table 3** Resolved security vulnerabilities
| Issue No.| Description|
| -------- | -------- |
| [I4AJEN](https://gitee.com/openharmony/third_party_freetype/issues/I4AJEN) | Fixed the CVE-2020-15999 security vulnerability of the third_party_freetype component.|
| [I4AJ6T](https://gitee.com/openharmony/third_party_mbedtls/issues/I4AJ6T) | Fixed the CVE-2020-36475 and CVE-2020-36478 security vulnerabilities of the third_party_mbedtls component.|
| [I4AIYJ](https://gitee.com/openharmony/device_hisilicon_third_party_uboot/issues/I4AIYJ?from=project-issue) | Fixed the CVE-2021-27138 and CVE-2021-27097 security vulnerabilities of the third_party_uboot component.|
| [I4HUM6](https://gitee.com/openharmony/third_party_lwip/issues/I4HUM6?from=project-issue) | Fixed the CVE-2020-22284 security vulnerability of the third_party_lwip component.|
| I4QTVZ | Fixed the CVE-2021-44732 and CVE-2021-45450 security vulnerabilities of the third_party_mbedtls component.|
| [I46RRM](https://gitee.com/openharmony/third_party_wpa_supplicant/issues/I46RRM?from=project-issue) | Fixed copying of secondary device types for the P2P group client.|
**Table 4** Resolved issues
| Issue No.| Description|
| -------- | -------- |
| [I457ZZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I457ZZ) | Fixed nested locking in the OsLockDepCheckIn exception handling.|
| [I3WU8Y](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WU8Y) | Fixed the failed test cases in the storage directory of the FS module during the integration test of the lightweight kernel subsystem.|
| [I4AJI2](https://gitee.com/openharmony/device_hisilicon_third_party_ffmpeg/issues/I4AJI2) | Upgraded the FFmpeg version to 4.3.1.|
| [I3HXIX](https://gitee.com/openharmony/third_party_NuttX/issues/I3HXIX?from=project-issue) | Fixed the possible system error in the case of multiple processes, which is caused because the kernel operation node of the pipe uses the dirty private field dev.|
| [I4QO9B](https://gitee.com/openharmony/communication_wifi_lite/issues/I4QO9B?from=project-issue) | Fixed freezing when returning from the WLAN list to the home screen.|
| [I4EPVL](https://gitee.com/openharmony/xts_acts/issues/I4EPVL?from=project-issue) | Temporarily removed the ActsCMSISTest test case since the CMSIS code is not yet compatible with third-party chips.|
| [I4QQU9](https://gitee.com/openharmony/xts_acts/issues/I4QQU9) | Fixed the issue where the serial port logs contain the board IP address and MAC address when the XTS test suite ActsNetTest is executed on the Hi3516 or Hi3518 board of a small-system device.|
## Known Issues
N/A
......@@ -8,6 +8,7 @@
- [OpenHarmony v2.2 beta2 (2021-08-04)](OpenHarmony-v2.2-beta2.md)
- [OpenHarmony 2.0 Canary (2021-06-02)](OpenHarmony-2-0-Canary.md)
## OpenHarmony 1.x Releases
- [OpenHarmony v1.1.4 LTS (2022-02-11)](OpenHarmony-v1-1-4-LTS.md)
- [OpenHarmony v1.1.3 LTS (2021-09-30)](OpenHarmony-v1-1-3-LTS.md)
- [OpenHarmony v1.1.2 LTS (2021-08-04)](OpenHarmony-v1.1.2-LTS.md)
- [OpenHarmony 1.1.1 LTS (2021-06-22)](OpenHarmony-1-1-1-LTS.md)
......
......@@ -271,9 +271,9 @@ OpenHarmony支持如下几种系统类型:
<td class="cellrowborder" valign="top" width="8.35916408359164%" headers="mcps1.1.4.1.3 "><p id="p1962012112314"><a name="p1962012112314"></a><a name="p1962012112314"></a>标准系统</p>
</td>
</tr>
<tr id="row176674368222"><td class="cellrowborder" valign="top" width="11.148885111488852%" headers="mcps1.1.4.1.1 "><p id="p3667203652214"><a name="p3667203652214"></a><a name="p3667203652214"></a>用户程序框架</p>
<tr id="row176674368222"><td class="cellrowborder" valign="top" width="11.148885111488852%" headers="mcps1.1.4.1.1 "><p id="p3667203652214"><a name="p3667203652214"></a><a name="p3667203652214"></a>包管理子系统</p>
</td>
<td class="cellrowborder" valign="top" width="80.49195080491951%" headers="mcps1.1.4.1.2 "><p id="p12923326230"><a name="p12923326230"></a><a name="p12923326230"></a>提供包安装、卸载、运行及管理能力。</p>
<td class="cellrowborder" valign="top" width="80.49195080491951%" headers="mcps1.1.4.1.2 "><p id="p12923326230"><a name="p12923326230"></a><a name="p12923326230"></a>提供包安装、卸载、更新、查询等能力。</p>
</td>
<td class="cellrowborder" valign="top" width="8.35916408359164%" headers="mcps1.1.4.1.3 "><p id="p12667123619226"><a name="p12667123619226"></a><a name="p12667123619226"></a>所有系统</p>
</td>
......
......@@ -3,4 +3,10 @@
- 应用事件打点
- [应用事件打点概述](hiappevent-overview.md)
- [应用事件打点开发指导](hiappevent-guidelines.md)
- 性能打点跟踪
- [性能打点跟踪概述](hitracemeter-overview.md)
- [性能打点跟踪开发指导](hitracemeter-guidelines.md)
- 分布式跟踪
- [分布式跟踪概述](hitracechain-overview.md)
- [分布式跟踪开发指导](hitracechain-guidelines.md)
# 分布式跟踪开发指导
## 场景介绍
HiTraceChain为开发者提供业务流程调用链跟踪的维测接口,帮助开发者迅速获取指定业务流程调用链的运行日志,定位跨设备/跨进程/跨线程的故障问题。
## 接口说明
分布式跟踪接口由hiTraceChain模块提供,详细API请参考[分布式跟踪API参考](../reference/apis/js-apis-hitracechain.md)
**分布式跟踪接口功能介绍:**
| 接口名 | 返回值 | 描述 |
| ------------------------------------------------------------------------------------------------------------------- | -------------- | ------------ |
| hiTraceChain.begin(name: string, flags: number = HiTraceFlag.DEFAULT) | HiTraceId | 开始跟踪。 |
| hiTraceChain.tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracepointType, id: HiTraceId, msg?: string) | void | 信息埋点。 |
| hiTraceChain.end(id: HiTraceId) | void | 结束跟踪。 |
## 开发步骤
在应用启动执行页面加载后,开始分布式跟踪,完成业务之后,停止分布式跟踪。
1. 新建一个JS应用工程,在“Project”窗口点击“entry > src > main > js > default > pages > index”,打开工程中的“index.js”文件,在页面执行加载后,在实际业务逻辑中调用hiTraceChain的API,进行分布式跟踪,示例代码如下:
```
import hiTraceChain from '@ohos.hiTraceChain'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
// 1、开启分布式跟踪
let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.INCLUDE_ASYNC | hiTraceChain.HiTraceFlag.DONOT_CREATE_SPAN);
// 2、业务流程开始
console.log(`business start`);
// 3、埋点操作
hiTraceChain.tracepoint(hiTraceChain.HiTraceCommunicationMode.THREAD, hiTraceChain.HiTraceTracepointType.SS, asyncTraceId, "Just a example");
// 4、业务流程执行中
console.log(`business running`);
// 5、业务流程结束
console.log(`business end`);
// 6、停止跟踪
hiTraceChain.end(asyncTraceId);
}
}
```
2. 运行项目,点击应用界面上的运行按钮,即可通过日志信息分析实际业务。
# 分布式跟踪概述
hiTraceChain是基于云计算分布式跟踪调用链思想,在端侧业务流程(涉及跨线程、跨进程、跨设备)中的一种轻量级实现。
## 基本概念
- **chainId**
分布式跟踪标识,属于HiTraceId的一部分,用于标识当前跟踪的业务流程。
## 运作机制
hiTraceChain在业务控制面流程中,生成和传递唯一跟踪标识,在业务流程中输出的各类信息中(包括应用事件、系统时间、日志等)记录该跟踪标识。在调试、问题定位过程中,开发者可以通过该唯一跟踪标识将本次业务流程端到端的各类信息快速关联起来。
## 约束与限制
hiTraceChain API提供的相关接口全部为同步接口。
\ No newline at end of file
# 性能打点跟踪开发指导
## 场景介绍
HiTraceMeter为开发者提供系统性能打点接口。开发者通过在自己的业务逻辑中的关键代码位置调用HiTraceMeter接口提供的API接口,能够有效追踪进程轨迹、查看系统性能。
## 接口说明
性能打点跟踪接口由hiTraceMeter模块提供,详细API请参考[性能打点跟踪API参考](../reference/apis/js-apis-hitracemeter.md)
**性能打点跟踪接口功能介绍:**
| 接口名 | 返回值 | 描述 |
| ---------------------------------------------------------------------------- | --------- | ------------ |
| hiTraceMeter.startTrace(name: string, taskId: number, expectedTime?: number) | void | 标记一个预追踪耗时任务的开始。如果有多个相同name的任务需要追踪或者对同一个任务要追踪多次,并且任务同时被执行,则每次调用startTrace的taskId不相同。如果具有相同name的任务是串行执行的,则taskId可以相同。 |
| hiTraceMeter.finishTrace(name: string, taskId: number) | void | name和taskId必须与流程开始的hiTraceMeter.startTrace对应参数值保持一致。 |
| hiTraceMeter.traceByValue(name: string, value: number) | void | 用来标记一个预追踪的数值变量,该变量的数值会不断变化。|
## 开发步骤
在应用启动执行页面加载后,开始分布式跟踪,完成业务之后,停止分布式跟踪。
1. 新建一个JS应用工程,在“Project”窗口点击“entry > src > main > js > default > pages > index”,打开工程中的“index.js”文件,在页面执行加载后,在自己的业务中调用hiTraceMeter的接口,进行性能打点追踪,示例代码如下:
```js
import hiTraceMeter from '@ohos.hiTraceMeter'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
//从startTrace到finishTrace流程的耗时期望为5ms
hiTraceMeter.startTrace("business", 1);
hiTraceMeter.startTrace("business", 1, 5);
//追踪并行执行的同名任务
hiTraceMeter.startTrace("business", 1);
//业务流程
console.log(`business running`);
hiTraceMeter.startTrace("business", 2); //第二个追踪的任务开始,同时第一个追踪的同名任务还没结束,出现了并行执行,对应接口的taskId需要不同。
//业务流程
console.log(`business running`);
hiTraceMeter.finishTrace("business", 1);
//业务流程
console.log(`business running`);
hiTraceMeter.finishTrace("business", 2);
//追踪串行执行的同名任务
hiTraceMeter.startTrace("business", 1);
//业务流程
console.log(`business running`);
hiTraceMeter.finishTrace("business", 1); //第一个追踪的任务结束
//业务流程
console.log(`business running`);
hiTraceMeter.startTrace("business", 1); //第二个追踪的同名任务开始,同名的待追踪任务串行执行。
//业务流程
console.log(`business running`);
let traceCount = 3;
hiTraceMeter.traceByValue("myTestCount", traceCount);
traceCount = 4;
hiTraceMeter.traceByValue("myTestCount", traceCount);
hiTraceMeter.finishTrace("business", 1);
}
}
```
2. 运行项目,点击应用界面上的运行按钮,即可通过日志信息分析实际业务。
# 性能打点跟踪概述
hiTraceMeter是开发者用于追踪进程轨迹,度量程序执行性能的一种工具,基于内核的ftrace机制,提供给用户态应用代码执行时长度量打点的能力。开发者通过使用hiTraceMeter API在程序中打点,并使用hiTraceMeter提供的命令行工具采集跟踪数据。
## 基本概念
- **hiTraceMeter Tag**
跟踪数据使用类别分类,称作hiTraceMeter Tag或hiTraceMeter Category,一般每个软件子系统对应一个Tag,该Tag在打点API中以类别TAg参数传入。hiTraceMeter命令行工具采集跟踪数据时,只采集给定的Tag类别选项指定的跟踪数据。
## 运作机制
- 应用程序通过hiTraceMeter函数接口进行打点,hiTraceMeter函数将跟踪数据通过内核sysfs文件接口输出到内核的ftrace数据缓冲区。
- hiTraceMeter命令行工具读取内核ftrace缓冲区中的跟踪数据,将文本格式的跟踪数据保存到设备侧的文件中。
## 约束与限制
- 由于JS程序的异步IO特性,现在hiTraceMeter只提供了异步接口。
\ No newline at end of file
......@@ -45,6 +45,7 @@
- [短信服务](js-apis-sms.md)
- [SIM卡管理](js-apis-sim.md)
- [网络搜索](js-apis-radio.md)
- [observer](js-apis-observer.md)
- 网络与连接
- [WLAN](js-apis-wifi.md)
- [Bluetooth](js-apis-bluetooth.md)
......@@ -73,6 +74,7 @@
- [动画](js-apis-basic-features-animator.md)
- [WebGL](js-apis-webgl.md)
- [WebGL2](js-apis-webgl2.md)
- [屏幕截图](js-apis-screenshot.md)
- DFX
- [应用打点](js-apis-hiappevent.md)
- [性能打点](js-apis-hitracemeter.md)
......
......@@ -63,7 +63,7 @@ getOrCreateLocalDir(): Promise\<string>
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getOrCreateLocalDir().then((void) => {
context.getOrCreateLocalDir().then(() => {
console.info("==========================>getOrCreateLocalDirCallback=======================>");
});
```
......@@ -91,9 +91,9 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async
import featureAbility from '@ohos.ability.featureAbility'
import bundle from '@ohos.bundle'
var context = featureAbility.getContext();
var datainfo = await bundle.getBundleInfo('com.context.test',1);
context.verifyPermission("com.example.permission",datainfo.uid)
bundle.getBundleInfo('com.context.test', 1, (datainfo) =>{
context.verifyPermission("com.example.permission", datainfo.uid);
});
```
......@@ -146,7 +146,7 @@ verifyPermission(permission: string, options?: PermissionOptions): Promise\<numb
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
var Permission = context.PermissionOptions(1,1);
context.getOrCreateLocalDir('com.context.permission',Permission).then((void) => {
context.getOrCreateLocalDir('com.context.permission',Permission).then(() => {
console.info("==========================>verifyPermissionCallback=======================>");
});
```
......@@ -223,7 +223,7 @@ getApplicationInfo(): Promise\<ApplicationInfo>
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getApplicationInfo().then((void) => {
context.getApplicationInfo().then(() => {
console.info("==========================>getApplicationInfoCallback=======================>");
});
```
......@@ -269,7 +269,7 @@ getBundleName(): Promise\<string>
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getBundleName().then((void) => {
context.getBundleName().then(() => {
console.info("==========================>getBundleNameCallback=======================>");
});
```
......@@ -315,7 +315,7 @@ getProcessInfo(): Promise\<ProcessInfo>
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getProcessInfo().then((void) => {
context.getProcessInfo().then(() => {
console.info("==========================>getProcessInfoCallback=======================>");
});
```
......@@ -365,7 +365,7 @@ getElementName(): Promise\<ElementName>
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getElementName().then((void) => {
context.getElementName().then(() => {
console.info("==========================>getElementNameCallback=======================>");
});
```
......@@ -407,7 +407,7 @@ getProcessName(): Promise\<string>
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getProcessName().then((void) => {
context.getProcessName().then(() => {
console.info("==========================>getProcessNameCallback=======================>");
});
```
......@@ -453,7 +453,7 @@ getCallingBundle(): Promise\<string>
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getCallingBundle().then((void) => {
context.getCallingBundle().then(() => {
console.info("==========================>getCallingBundleCallback=======================>");
});
```
......
......@@ -27,7 +27,6 @@ getId(uri: string): number
**示例:**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
dataUriUtils.getIdSync("com.example.dataUriUtils/1221")
```
......@@ -55,10 +54,9 @@ attachId(uri: string, id: number): string
**示例:**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
var idint = 1122;
dataUriUtils.attachId(
"com.example.dataUriUtils"
"com.example.dataUriUtils",
idint,
)
```
......@@ -85,7 +83,6 @@ deleteId(uri: string): string
**示例:**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
dataUriUtils.deleteId("com.example.dataUriUtils/1221")
```
......@@ -112,11 +109,10 @@ updateId(uri: string, id: number): string
**示例:**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
var idint = 1122;
dataUriUtils.updateId(
"com.example.dataUriUtils"
idint,
"com.example.dataUriUtils",
idint
)
```
# AbilityContext
- [使用说明](#使用说明)
- [属性](#属性)
- [startAbility](#startAbility)
- [startAbility](#startAbility)
- [startAbility](#startAbility)
- [startAbilityForResult](#startAbilityForResult)
- [startAbilityForResult](#startAbilityForResult)
- [startAbilityForResult](#startAbilityForResult)
- [terminateSelf](#terminateSelf)
- [terminateSelf](#terminateSelf)
- [terminateSelfWithResult](#terminateSelfWithResult)
- [terminateSelfWithResult](#terminateSelfWithResult)
- [startAbilityByCall](#startAbilityByCall)
- [requestPermissionsFromUser](#requestPermissionsFromUser)
- [requestPermissionsFromUser](#requestPermissionsFromUser)
- [setMissionLabel](#setMissionLabel)
- [setMissionLabel](#setMissionLabel)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
Ability的上下文环境,继承自Context。
## 使用说明
​在使用AbilityContext的功能前,需要通过Ability子类实例获取。
```
import Ability from '@ohos.application.Ability'
class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
let context = this.context;
}
}
```
## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
......@@ -42,7 +78,37 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void
## startAbility
startAbility(want: Want): Promise&lt;void&gt;;
startAbility(want: Want, options: StartOptions, callback: AsyncCallback&lt;void&gt;): void
启动Ability。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 |
| options | StartOptions | 是 | 启动Ability所携带的参数。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动结果。 |
- 示例:
```
var want = {
"deviceId": "",
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
var options = {
windowMode: 0,
};
this.context.startAbility(want, options, (error) => {
console.log("error.code = " + error.code)
})
```
## startAbility
startAbility(want: Want, options: StartOptions): Promise&lt;void&gt;;
启动Ability。通过Promise返回结果。
......@@ -50,6 +116,7 @@ startAbility(want: Want): Promise&lt;void&gt;;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 |
| options | StartOptions | 是 | 启动Ability所携带的参数。 |
- 返回值:
| 类型 | 说明 |
......@@ -63,7 +130,10 @@ startAbility(want: Want): Promise&lt;void&gt;;
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
this.context.startAbility(want)
var options = {
windowMode: 0,
};
this.context.startAbility(want, options)
.then((data) => {
console.log('Operation successful.')
}).catch((error) => {
......@@ -82,7 +152,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback&lt;AbilityResult&gt;):
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |[Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 |
| callback | Callback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | 是 | 执行结果回调函数。 |
| callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | 是 | 执行结果回调函数。 |
- 示例:
......@@ -96,17 +166,47 @@ startAbilityForResult(want: Want, callback: AsyncCallback&lt;AbilityResult&gt;):
);
```
## startAbilityForResult
startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback&lt;AbilityResult&gt;): void;
启动Ability并在结束的时候返回执行结果。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |[Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 |
| options | StartOptions | 是 | 启动Ability所携带的参数。 |
| callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | 是 | 执行结果回调函数。 |
- 示例:
```
var options = {
windowMode: 0,
};
this.context.startAbilityForResult(
{bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options,
(error, result) => {
console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code)
console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode)
}
);
```
## startAbilityForResult
startAbilityForResult(want: Want): Promise&lt;AbilityResult&gt;;
startAbilityForResult(want: Want, options: StartOptions): Promise&lt;AbilityResult&gt;;
启动Ability并在结束的时候返回执行结果。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 |
| options | StartOptions | 是 | 启动Ability所携带的参数。 |
- 返回值
| 类型 | 说明 |
......@@ -115,7 +215,10 @@ startAbilityForResult(want: Want): Promise&lt;AbilityResult&gt;;
- 示例:
```
this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}).then((result) => {
var options = {
windowMode: 0,
};
this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options).then((result) => {
console.log("startAbilityForResult Promise.resolve is called, result.resultCode = " + result.resultCode)
}, (error) => {
console.log("startAbilityForResult Promise.Reject is called, error.code = " + error.code)
......@@ -132,13 +235,13 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | | 回调函数,返回接口调用是否成功的结果。 |
| callback | AsyncCallback&lt;void&gt; | | 回调函数,返回接口调用是否成功的结果。 |
- 示例:
```
this.context.terminateSelf((err) => {
console.log('terminateSelf result:' + JSON.stringfy(err);
}
console.log('terminateSelf result:' + JSON.stringfy(err));
});
```
......@@ -157,7 +260,7 @@ terminateSelf(): Promise&lt;void&gt;;
```
this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data));
)).catch((error) => {
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
......@@ -173,7 +276,7 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback&lt;voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | 是 | 返回给调用startAbilityForResult&nbsp;接口调用方的相关信息。 |
| callback | Callback&lt;void&gt; | 否 | callback形式返回停止结果 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回停止结果。 |
- 示例:
```
......@@ -202,7 +305,7 @@ terminateSelfWithResult(parameter: AbilityResult): Promise&lt;void&gt;;
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | promise形式返回停止结果 |
| Promise&lt;void&gt; | promise形式返回停止结果 |
- 示例:
```
......@@ -215,3 +318,138 @@ terminateSelfWithResult(parameter: AbilityResult): Promise&lt;void&gt;;
}
)
```
## startAbilityByCall
startAbilityByCall(want: Want): Promise&lt;Caller&gt;;
获取指定通用组件服务端的caller通信接口, 并且将指定通用组件服务端拉起并切换到后台。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 传入需要启动的ability的信息,包含ability名称、包名、设备ID,设备ID缺省或为空表示启动本地ability。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;&gt; | 获取要通讯的caller对象。 |
- 示例:
```
import Ability from '@ohos.application.Ability';
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "com.example.myservice.MainAbility",
deviceId: ""
}).then((obj) => {
caller = obj;
console.log('Caller GetCaller Get ' + call);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
}
}
```
## requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array&lt;string&gt;, requestCallback: AsyncCallback&lt;PermissionRequestResult&gt;) : void;
拉起弹窗请求用户授权。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | 是 | 权限列表。 |
| callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | 是 | 回调函数,返回接口调用是否成功的结果。 |
- 示例:
```
this.context.requestPermissionsFromUser(permissions,(result) => {
console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
});
```
## requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array&lt;string&gt;) : Promise&lt;PermissionRequestResult&gt;;
拉起弹窗请求用户授权。通过Promise返回结果。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | 是 | 权限列表。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | 返回一个Promise,包含接口的结果。 |
- 示例:
```
this.context.requestPermissionsFromUser(permissions).then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
## setMissionLabel
setMissionLabel(label: string, callback:AsyncCallback&lt;void&gt;): void;
设置ability在任务中显示的名称。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| label | string | 是 | 显示名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,返回接口调用是否成功的结果。 |
- 示例:
```
this.context.setMissionLabel("test",(result) => {
console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
});
```
## setMissionLabel
setMissionLabel(label: string, callback:AsyncCallback&lt;void&gt;): void;
设置ability在任务中显示的名称。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| label | string | 是 | 显示名称。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果。 |
- 示例:
```
this.context.setMissionLabel("test").then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
# AbilityRunningInfo
- [使用说明](#使用说明)
- [属性](#属性)
- [abilityManager.AbilityState](#abilityManagerAbilityState)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 8开始支持。
Ability运行相关信息。
## 使用说明
通过abilityManager中getAbilityRunningInfos方法获取。
```
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getAbilityRunningInfos((err,data) => {
console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data));
});
```
## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ability | ElementName | 是 | 否 | Ability匹配信息。 |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| startTime | number | 是 | 否 | Ability启动时间。 |
| abilityState | [abilityManager.AbilityState](#abilitymanager-abilitystate) | 是 | 否 | Ability状态。 |
## abilityManager.AbilityState
Ability的状态信息。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| INITIAL | 0 | 表示ability为initial状态。 |
| FOREGROUND | 9 | 表示ability为foreground状态。 |
| BACKGROUND | 10 | 表示ability为background状态。 |
| FOREGROUNDING | 11 | 表示ability为foregrounding状态。 |
| BACKGROUNDING | 12 | 表示ability为backgrounding状态。 |
# AbilityStageContext
- [使用说明](#使用说明)
- [属性](#属性)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 9开始支持。
AbilityStage的上下文环境,继承自[Context](js-apis-application-context.md)
## 使用说明
通过AbilityStage实例来获取。
```
import AbilityStage from '@ohos.application.AbilityStage';
class MyAbilityStage extends AbilityStage {
onCreate() {
let abilityStageContext = this.context;
}
}
```
## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| currentHapModuleInfo | HapModuleInfo | 是 | 否 | AbilityStage对应的ModuleInfo对象。 |
| config | [Configuration](js-apis-configuration.md) | 是 | 否 | 环境变化对象。 |
# Ability
- [导入模块](#导入模块)
- [属性](#属性)
- [onCreate](#onCreate)
- [onWindowStageCreate](#onWindowStageCreate)
- [onWindowStageDestroy](#onWindowStageDestroy)
- [onWindowStageRestore](#onWindowStageRestore)
- [onDestroy](#onDestroy)
- [onForeground](#onForeground)
- [onBackground](#onBackground)
- [onContinue](#onContinue)
- [onNewWant](#onNewWant)
- [onConfigurationUpdated](#onConfigurationUpdated)
- [Caller](#Caller)
- [call](#call)
- [callWithResult](#callWithResult)
- [release](#release)
- [onRelease](#onRelease)
- [Callee](#Callee)
- [on](#on)
- [off](#off)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 从API Version 8 开始支持。
Ability模块,提供对Ability生命周期、上下文环境等调用管理。
## 导入模块
```
import Ability from '@ohos.application.Ability';
```
## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| context | [AbilityContext](js-apis-ability-context.md) | 是 | 否 | 上下文。 |
| launchWant | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 否 | Ability启动时的参数。 |
| lastRequestWant | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 否 | Ability最后请求时的参数。 |
## onCreate
onCreate(want: Want,param:LaunchParam): void
Ability创建时回调,执行初始化业务逻辑操作。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 当前Ability的Want类型信息,包括ability名称、bundle名称等。 |
| param | LaunchParam | 是 | 创建&nbsp;ability、上次异常退出的原因信息。 |
- 示例:
```
class myAbility extends Ability {
onCreate(want, param) {
console.log('onCreate, want:' + want.abilityName);
}
}
```
## onWindowStageCreate
onWindowStageCreate(windowStage: window.WindowStage): void
当WindowStage创建后调用。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | 是 | WindowStage相关信息。 |
- 示例:
```
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
}
}
```
## onWindowStageDestroy
onWindowStageDestroy(): void
当WindowStage销毁后调用。
- 示例:
```
class myAbility extends Ability {
onWindowStageDestroy() {
console.log('onWindowStageDestroy');
}
}
```
## onWindowStageRestore
onWindowStageRestore(windowStage: window.WindowStage): void
当迁移多实例ability时,恢复WindowStage后调用。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | 是 | WindowStage相关信息。 |
- 示例:
```
class myAbility extends Ability {
onWindowStageRestore(windowStage) {
console.log('onWindowStageRestore');
}
}
```
## onDestroy
onDestroy(): void;
Ability生命周期回调,在销毁时回调,执行资源清理等操作。
- 示例:
```
class myAbility extends Ability {
onDestroy() {
console.log('onDestroy');
}
}
```
## onForeground
onForeground(): void;
Ability生命周期回调,当应用处于前台时触发。
- 示例:
```
class myAbility extends Ability {
onForeground() {
console.log('onForeground');
}
}
```
## onBackground
onBackground(): void;
Ability生命周期回调,当应用处于后台时触发。
- 示例:
```
class myAbility extends Ability {
onBackground() {
console.log('onBackground');
}
}
```
## onContinue
onContinue(wantParam : {[key: string]: any}): boolean;
当ability迁移准备迁移时触发,保存数据。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | 是 | want相关参数。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| boolean | true表示同意迁移,false表示拒绝迁移。 |
- 示例:
```
class myAbility extends Ability {
onContinue(wantParams) {
console.log('onContinue');
wantParams["myData"] = "my1234567";
return true;
}
}
```
## onNewWant
onNewWant(want: Want): void;
当ability的启动模式设置为单例时回调会被调用。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,如ability名称,包名等。 |
- 示例:
```
class myAbility extends Ability {
onNewWant(want) {
console.log('onNewWant, want:' + want.abilityName);
}
}
```
## onConfigurationUpdated
onConfigurationUpdated(config: Configuration): void;
当系统配置更新时调用。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| config | [Configuration](#section188911144124715) | 是 | 表示需要更新的配置信息。 |
- 示例:
```
class myAbility extends Ability {
onConfigurationUpdated(config) {
console.log('onConfigurationUpdated, config:' + JSON.stringify(config));
}
}
```
## Caller
通用组件Caller通信客户端调用接口, 用来向通用组件服务端发送约定数据。
### call
call(method, data: rpc.Sequenceable): Promise&lt;void&gt;;
向通用组件服务端发送约定序列化数据。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| method | string | 是 | 约定的服务端注册事件字符串。 |
| data | rpc.Sequenceable | 是 | 由开发者实现的Sequenceable可序列化数据。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | Promise形式返回应答。 |
- 示例:
```
import Ability from '@ohos.application.Ability';
class MyMessageAble{ // 自定义的Sequenceable数据结构
num: 0
str: ''
constructor() {}
marshalling(messageParcel) {
messageParcel.writeInt(this.num);
messageParcel.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageParcel) {
this.num = messageParcel.readInt();
this.str = messageParcel.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
var method = 'call_Function'; // 约定的通知消息字符串
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
caller = await this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "com.example.myservice.MainAbility",
deviceId: ""
});
let msg = new MyMessageAble(1, "world"); // 参考Sequenceable数据定义
caller.call(method, msg)
.then(() => {
console.log('Caller call() called');
}).catch((e) => {
console.log('Caller call() catch error ' + e);
});
}
}
```
### callWithResult
callWithResult(method, data: rpc.Sequenceable): Promise&lt;rpc.MessageParcel&gt;;
向通用组件服务端发送约定序列化数据, 并将服务端返回的约定序列化数据带回。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| method | string | 是 | 约定的服务端注册事件字符串。 |
| data | rpc.Sequenceable | 是 | 由开发者实现的Sequenceable可序列化数据。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;rpc.MessageParcel&gt; | Promise形式返回通用组件服务端应答数据。 |
- 示例:
```
import Ability from '@ohos.application.Ability';
class MyMessageAble{
num: 0
str: ''
constructor() {}
marshalling(messageParcel) {
messageParcel.writeInt(this.num);
messageParcel.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageParcel) {
this.num = messageParcel.readInt();
this.str = messageParcel.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
var method = 'call_Function';
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
caller = await this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "com.example.myservice.MainAbility",
deviceId: ""
});
let msg = new MyMessageAble(1, "world");
caller.callWithResult(method, msg)
.then((data) => {
console.log('Caller call() called');
let retmsg = new MyMessageAble(0, "");
data.readSequenceable(retmsg);
}).catch((e) => {
console.log('Caller call() catch error ' + e);
});
}
}
```
### release
release(): void;
主动释放通用组件服务端的通信接口。
- 示例:
```
import Ability from '@ohos.application.Ability';
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
caller = await this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "com.example.myservice.MainAbility",
deviceId: ""
});
try {
caller.release();
} catch (e) {
console.log('Caller Release error ' + e);
}
}
}
```
### onRelease
onRelease(callback: function): void;
注册通用组件服务端Stub断开监听通知。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | function | 是 | 返回onRelease回调结果。 |
- 示例:
```
import Ability from '@ohos.application.Ability';
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
caller = await this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "com.example.myservice.MainAbility",
deviceId: ""
});
try {
caller.onRelease((str) => {
console.log(' Caller OnRelease CallBack is called ' + str);
});
} catch (e) {
console.log('Caller Release error ' + e);
}
}
}
```
## Callee
通用组件服务端注册和解除客户端caller通知送信的callback接口。
### on
on(method: string, callback: function): void;
通用组件服务端注册消息通知callback。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| method | string | 是 | 与客户端约定的通知消息字符串。 |
| callback | function | 是 | 一个rpc.MessageParcel类型入参的js通知同步回调函数,&nbsp;回调函数至少要返回一个空的rpc.Sequenceable数据对象,&nbsp;其他视为函数执行错误。 |
- 示例:
```
import Ability from '@ohos.application.Ability';
class MyMessageAble{
num: 0
str: ''
constructor() {}
marshalling(messageParcel) {
messageParcel.writeInt(this.num);
messageParcel.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageParcel) {
this.num = messageParcel.readInt();
this.str = messageParcel.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
var method = 'call_Function';
function funcCallBack(pdata) {
console.log('Callee funcCallBack is called ' + pdata);
let msg = new MyMessageAble(0, "");
pdata.readSequenceable(msg);
return new MyMessageAble(10, "Callee test");
}
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
this.callee.on(method, funcCallBack);
}
}
```
### off
off(method: string): void;
解除通用组件服务端注册消息通知callback。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| method | string | 是 | 已注册的通知事件字符串。 |
- 示例:
```
import Ability from '@ohos.application.Ability';
var method = 'call_Function';
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
this.callee.off(method);
}
}
```
# AbilityStage
- [导入模块](#导入模块)
- [onCreate](#onCreate)
- [onAcceptWant](#onAcceptWant)
- [onConfigurationUpdated](#onConfigurationUpdated)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 9开始支持。
AbilityStage是HAP包的运行时类。在HAP加载的时候,通知开发者,开发者可以在此进行该HAP的初始化(如资源预加载,线程创建等)。
## 导入模块
```
import AbilityStage from '@ohos.application.AbilityStage';
```
## onCreate
onCreate(): void
当应用创建时调用。
- 示例
```
class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage.onCreate is called")
}
}
```
## onAcceptWant
onAcceptWant(want: Want): string;
启动一个specified ability时触发的事件。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| string | 用户返回一个ability标识,如果之前启动过次标识的ability,不创建新的实例并拉回栈顶,否则创建新的实例并启动。 |
- 示例
```
class MyAbilityStage extends AbilityStage {
onAcceptWant(want) {
console.log("MyAbilityStage.onAcceptWant called");
return "com.example.test";
}
}
```
## onConfigurationUpdated
onConfigurationUpdated(config: Configuration): void;
环境变化通知接口,发生全局配置变更时回调。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | 是 | 发生全局配置变更时触发回调,当前全局配置包括系统语言、深浅色模式。 |
- 示例:
```
class MyAbilityStage extends AbilityStage {
onConfigurationUpdated(config) {
console.log('onConfigurationUpdated, language:' + config.language);
}
}
```
# Context
- [使用说明](#使用说明)
- [属性](#属性)
- [createBundleContext](#createBundleContext)
- [getApplicationContext](#getApplicationContext)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9开始支持。
提供开发者运行代码的上下文环境,包括应用信息、ResourceManager等信息。
## 使用说明
通过AbilityContext等集成实现。
## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| resourceManager | ResourceManager | 是 | 否 | ResourceManager对象。 |
| applicationInfo | ApplicationInfo | 是 | 否 | 当前应用信息。 |
| cacheDir | string | 是 | 否 | 应用在内部存储上的缓存路径。 |
| tempDir | string | 是 | 否 | 应用的临时文件路径。 |
| filesDir | string | 是 | 否 | 应用在内部存储上的文件路径。 |
| databaseDir | string | 是 | 否 | 获取本地数据存储路径。 |
| storageDir | string | 是 | 否 | 获取轻量级数据存储路径。 |
| bundleCodeDir | string | 是 | 否 | 应用安装路径。 |
| distributedFilesDir | string | 是 | 否 | 应用的分布式文件路径。 |
| eventHub | [EventHub](js-apis-eventhub.md) | 是 | 否 | 事件中心信息。|
## createBundleContext
createBundleContext(bundleName: string): Context;
创建指定应用上下文。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| bundleName | string | 是 | 应用bundle名。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Context | 对应创建应用的上下文context。 |
- 示例:
```
let test = "com.huawei.test";
let context = this.context.createBundleContext(test);
```
## getApplicationContext
getApplicationContext(): Context;
获取当前context。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Context | 当前Context&nbsp;信息。 |
- 示例:
```
// 必选项。
let context = this.context.getApplicationContext();
```
# appManager
- [导入模块](#导入模块)
- [isRunningInStabilityTest](#isRunningInStabilityTest)
- [isRunningInStabilityTest](#isRunningInStabilityTest)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 8开始支持。
App运行相关信息。
## 导入模块
```
import app from '@ohos.application.appManager';
```
## isRunningInStabilityTest
static isRunningInStabilityTest(callback: AsyncCallback&lt;boolean&gt;): void
查询当前用户是否是一个稳定性测试。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | 否 | 返回当前是否处于稳定性测试场景。 |
- 示例:
```
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest((err, flag) => {
console.log('startAbility result:' + JSON.stringfy(err);
}
```
## isRunningInStabilityTest
static isRunningInStabilityTest(): Promise&lt;boolean&gt;
查询当前是否处于稳定性测试场景。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;boolean&gt; | 返回当前是否处于稳定性测试场景。 |
- 示例:
```
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest().then((flag) => {
console.log('success:' + JSON.stringfy(flag));
)).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
此差异已折叠。
......@@ -17,7 +17,9 @@ dial\(phoneNumber: string, callback: AsyncCallback<boolean\>\): void
拨打电话,使用callback方式作为异步方法。
需要权限:ohos.permission.PLACE\_CALL权限,该权限为系统权限。
**需要权限**:ohos.permission.PLACE\_CALL,该权限为系统权限
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
......@@ -41,7 +43,9 @@ dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean
拨打电话,可设置通话参数,使用callback方式作为异步方法。
需要权限:ohos.permission.PLACE\_CALL权限,该权限为系统权限。
**需要权限**:ohos.permission.PLACE\_CALL,该权限为系统权限
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
......@@ -68,7 +72,9 @@ dial\(phoneNumber: string, options?: DialOptions\): Promise<boolean\>
拨打电话,可设置通话参数,使用promise方式作为异步方法。
需要权限:ohos.permission.PLACE\_CALL权限,该权限为系统权限。
**需要权限**:ohos.permission.PLACE\_CALL,该权限为系统权限
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
......@@ -102,6 +108,8 @@ hasCall\(callback: AsyncCallback<boolean\>\): void
判断是否存在通话,使用callback方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -123,6 +131,8 @@ hasCall\(\): Promise<boolean\>
判断是否存在通话,使用Promise方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
......@@ -147,6 +157,8 @@ getCallState\(callback: AsyncCallback<CallState\>\): void
获取通话状态,使用callback方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -168,6 +180,8 @@ getCallState\(\): Promise<CallState\>
获取通话状态,使用Promise方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
......@@ -191,6 +205,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback<boolean\>\)
判断是否是紧急电话号码,使用callback方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -213,6 +229,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, ca
判断是否是紧急电话号码,使用callback方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -236,6 +254,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\):
判断是否是紧急电话号码,使用promise方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -266,6 +286,8 @@ formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback<string\>\): void
格式化电话号码,使用callback方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -288,6 +310,8 @@ formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback:
格式化电话号码,可设置格式化参数,使用callback方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -313,6 +337,8 @@ formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise
格式化电话号码,可设置格式化参数,使用promise方式作为异步方法。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -349,6 +375,8 @@ formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: Asy
支持所有国家码。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -378,6 +406,8 @@ formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise<str
支持所有国家码。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数 | 类型 | 必填 | 说明 |
......@@ -407,6 +437,9 @@ promise.then(data => {
## DialOptions<a name=DialOptions></a>
拨打电话的可选参数。
**系统能力**:SystemCapability.Telephony.CallManager
| 参数 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| extras | boolean | 否 | 根据extras的值判断是否为视频通话,默认为语音通话。<br/>- true:视频通话。<br/>- fasle:语音通话。 |
......@@ -414,16 +447,20 @@ promise.then(data => {
## CallState<a name=CallState></a>
通话状态码。
| 变量 | 值 | 说明 |
| ------------------ | ---- | ------------------------------------------------------------ |
| CALL_STATE_UNKNOWN | -1 | 无效状态,当获取呼叫状态失败时返回。 |
| CALL_STATE_IDLE | 0 | 表示没有正在进行的呼叫。 |
| CALL_STATE_RINGING | 1 | 表示来电正在振铃或等待。 |
| CALL_STATE_OFFHOOK | 2 | 表示至少有一个呼叫处于拨号、通话中或呼叫保持状态,并且没有新的来电振铃或等待。 |
| CALL_STATE_UNKNOWN | -1 | 无效状态,当获取呼叫状态失败时返回。<br />**系统能力**:SystemCapability.Telephony.CallManager |
| CALL_STATE_IDLE | 0 | 表示没有正在进行的呼叫。<br />**系统能力**:SystemCapability.Telephony.CallManager |
| CALL_STATE_RINGING | 1 | 表示来电正在振铃或等待。<br />**系统能力**:SystemCapability.Telephony.CallManager |
| CALL_STATE_OFFHOOK | 2 | 表示至少有一个呼叫处于拨号、通话中或呼叫保持状态,并且没有新的来电振铃或等待。<br />**系统能力**:SystemCapability.Telephony.CallManager |
## EmergencyNumberOptions<sup>7+</sup><a name=EmergencyNumberOptions></a>
判断是否是紧急电话号码的可选参数。
**系统能力**:SystemCapability.Telephony.CallManager
| 参数 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------ |
| slotId | number | 否 | 卡槽ID:<br/>- 0:卡槽1。<br/>- 1:卡槽2。 |
......@@ -431,6 +468,9 @@ promise.then(data => {
## NumberFormatOptions<sup>7+</sup><a name=NumberFormatOptions></a>
格式化号码的可选参数。
**系统能力**:SystemCapability.Telephony.CallManager
| 参数 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | 否 | 国家码,支持所有国家的国家码,如:中国(CN)。默认为:CN。 |
\ No newline at end of file
# Configuration
- [导入模块](#导入模块)
- [属性](#属性)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8开始支持。
环境变化信息。
## 导入模块
```
import Configuration from '@ohos.application.Configuration';
```
## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| language | string | 是 | 是 | 表示应用程序的当前语言。 |
| colorMode | [ColorMode](js-apis-configurationconstant.md) | 是 | 是 | 表示深浅色模式,取值范围:浅色模式(COLOR_MODE_LIGHT),深色模式(COLOR_MODE_DARK)。默认为浅色。 |
| direction | Direction | 是 | 否 | 表示屏幕方向,取值范围:水平方向(DIRECTION_HORIZONTAL),垂直方向(DIRECTION_VERTICAL)。 |
| screenDensity | ScreenDensity | 是 | 否 | 表示屏幕分辨率,取值范围:SCREEN_DENSITY_SDPI(120)、SCREEN_DENSITY_MDPI(160)、SCREEN_DENSITY_LDPI(240)、SCREEN_DENSITY_XLDPI(320)、SCREEN_DENSITY_XXLDPI(480)、SCREEN_DENSITY_XXXLDPI(640)。 |
| displayId | number | 是 | 否 | 表示应用所在的displayId。 |
# ConfigurationConstant
- [导入模块](#导入模块)
- [ColorMode](#ColorMode)
- [Direction](#Direction)
- [ScreenDensity](#ScreenDensity)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8开始支持。
配置信息枚举值定义。
## 导入模块
```
import ConfigurationConstant from '@ohos.application.ConfigurationConstant';
```
## ColorMode
使用时通过ConfigurationConstant.ColorMode获取,示例:ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| COLOR_MODE_NOT_SET | -1 | 未设置颜色模式。 |
| COLOR_MODE_DARK | 0 | 深色模式。 |
| COLOR_MODE_LIGHT | 1 | 浅色模式。 |
## Direction
使用时通过ConfigurationConstant.Direction获取,示例:ConfigurationConstant.Direction.DIRECTION_VERTICAL。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| DIRECTION_NOT_SET | -1 | 未设置方向。 |
| DIRECTION_VERTICAL | 0 | 垂直方向。 |
| DIRECTION_HORIZONTAL | 1 | 水平方向。 |
## ScreenDensity
使用时通过ConfigurationConstant.ScreenDensity获取,示例:ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| SCREEN_DENSITY_NOT_SET | 0 | 未设置屏幕分辨率。 |
| SCREEN_DENSITY_SDPI | 120 | 屏幕分辨率为"sdpi"。 |
| SCREEN_DENSITY_MDPI | 160 | 屏幕分辨率为"mdpi"。 |
| SCREEN_DENSITY_LDPI | 240 | 屏幕分辨率为"ldpi"。 |
| SCREEN_DENSITY_XLDPI | 320 | 屏幕分辨率为"xldpi"。 |
| SCREEN_DENSITY_XXLDPI | 480 | 屏幕分辨率为"xxldpi"。 |
| SCREEN_DENSITY_XXXLDPI | 640 | 屏幕分辨率为"xxxldpi"。 |
......@@ -65,8 +65,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
);
var mode = "rwt";
DAHelper.openFile(
"dataability:///com.example.DataAbility"
mode).then((void) => {
"dataability:///com.example.DataAbility",
mode).then((data) => {
console.info("==========================>openFileCallback=======================>");
});
```
......@@ -338,7 +338,7 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
DAHelper.denormalizeUri(
"dataability:///com.example.DataAbility",,
"dataability:///com.example.DataAbility",
(err, data) => {
console.info("==========================>Called=======================>");
});
......@@ -398,7 +398,7 @@ var helper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
helper.notifyChange(
"dataability:///com.example.DataAbility",,
"dataability:///com.example.DataAbility",
(err) => {
console.info("==========================>Called=======================>");
});
......@@ -430,7 +430,7 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
);
DAHelper.notifyChange(
"dataability:///com.example.DataAbility",
).then((void) => {
).then(() => {
console.info("==========================>notifyChangeCallback=======================>");
});
```
......@@ -747,7 +747,7 @@ import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
var cars=new Array({"value1"}, {"value2"}, {"value3"}, {"value4"});
var cars=new Array("value1", "value2", "value3", "value4");
let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.query(
"dataability:///com.example.DataAbility",
......@@ -787,7 +787,7 @@ import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
var cars=new Array({"value1"}, {"value2"}, {"value3"}, {"value4"});
var cars=new Array("value1", "value2", "value3", "value4");
let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.query(
"dataability:///com.example.DataAbility",
......
# ExtensionRunningInfo
- [使用说明](#使用说明)
- [属性](#属性)
- [bundle.ExtensionAbilityType](#bundleExtensionAbilityType)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 8开始支持。
Extension运行相关信息。
## 使用说明
通过abilityManager中方法获取。
```
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => {
console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data));
});
```
### 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| extension | ElementName | 是 | 否 | Extension匹配信息。 |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| startTime | number | 是 | 否 | Extension启动时间。 |
| clientPackage | Array&lt;String&gt; | 是 | 否 | 连接客户端包名。 |
| type | [bundle.ExtensionAbilityType](#bundle-extensionabilitytype) | 是 | 否 | Extension类型。 |
## bundle.ExtensionAbilityType
Extension类型。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| FORM | 0 | 表示带有form类型的扩展信息。 |
| WORK_SCHEDULER | 1 | 表示带有work&nbsp;schedule类型的扩展信息。 |
| INPUT_METHOD | 2 | 表示用输入法类型的扩展信息。 |
| SERVICE | 3 | 表示带有service类型的扩展信息。 |
| ACCESSIBILITY | 4 | 表示具有可访问性类型的扩展信息。 |
| DATA_SHARE | 5 | 表示带有datashare类型的扩展信息。 |
| FILE_SHARE | 6 | 表示带有fileshare类型的扩展信息。 |
| STATIC_SUBSCRIBER | 7 | 表示带有静态订阅者类型的扩展信息。 |
| WALLPAPER | 8 | 表示带有wallpaper类型的扩展信息。 |
| UNSPECIFIED | 9 | 表示未指定类型信息。 |
此差异已折叠。
......@@ -1757,9 +1757,13 @@ audioRecorder.prepare(); // prepare不设置参数,触发'error'
表示音频编码格式的枚举。
| 名称 | 默认值 | 说明 |
| ------ | ------ | ------------------------------------------------------------ |
| AAC_LC | 3 | AAC-LC(Advanced&nbsp;Audio&nbsp;Coding&nbsp;Low&nbsp;Complexity)编码格式。 |
| 名称 | 默认值 | 说明 |
| ------- | ------ | ------------------------------------------------------------ |
| DEFAULT | 0 | Default audio encoding format is AMR_NB。本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| AMR_NB | 1 | AMR-NB(Adaptive Multi Rate-Narrow Band Speech Codec) 编码格式。本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| AMR_WB | 2 | AMR-WB(Adaptive Multi Rate-Wide Band Speech Codec) 编码格式。本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| AAC_LC | 3 | AAC-LC(Advanced&nbsp;Audio&nbsp;Coding&nbsp;Low&nbsp;Complexity)编码格式。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| HE_AAC | 4 | HE_AAC(High-Efficiency Advanced&nbsp;Audio&nbsp;Coding)编码格式。本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
## AudioOutputFormat
......@@ -1768,8 +1772,11 @@ audioRecorder.prepare(); // prepare不设置参数,触发'error'
| 名称 | 默认值 | 说明 |
| -------- | ------ | ------------------------------------------------------------ |
| MPEG_4 | 2 | 封装为MPEG-4格式。 |
| AAC_ADTS | 6 | 封装为ADTS(Audio&nbsp;Data&nbsp;Transport&nbsp;Stream)格式,是AAC音频的传输流格式。 |
| DEFAULT | 0 | 默认封装格式为MPEG-4。本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| MPEG_4 | 2 | 封装为MPEG-4格式。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| AMR_NB | 3 | 封装为AMR_NB格式。本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| AMR_WB | 4 | 封装为AMR_WB格式。本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
| AAC_ADTS | 6 | 封装为ADTS(Audio&nbsp;Data&nbsp;Transport&nbsp;Stream)格式,是AAC音频的传输流格式。<br/>**系统能力:**SystemCapability.Multimedia.Media.AudioRecorder |
## VideoRecorder<sup>8+</sup>
......
# richtext<a name="ZH-CN_TOPIC_0000001173164701"></a>
>![](../../public_sys-resources/icon-note.gif) **说明:** 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
富文本组件,用于展示富文本信息,内容需要写在元素标签内。
## 权限列表<a name="section11257113618419"></a>
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册