diff --git a/zh-cn/application-dev/device/sample-server-guidelines.md b/zh-cn/application-dev/device/sample-server-guidelines.md
index b9d1ab5850fa0cbe35f503b517b66fa28f3d3664..5e86789f8270c8ca37d232a9e3ea06a5d0bc0516 100644
--- a/zh-cn/application-dev/device/sample-server-guidelines.md
+++ b/zh-cn/application-dev/device/sample-server-guidelines.md
@@ -2,7 +2,7 @@
## 场景介绍
-示例服务器解决了升级服务器实际应用场景中,缺乏相应搜包服务器提供查询升级包、获取升级包下载url等问题,支持测试升级服务和二次开发功能验证,为升级服务的应用场景提供尽可能完善的端到端环境搭建。
+示例服务器解决了升级服务器实际应用场景中的问题,例如,缺乏相应的搜包服务器来提供查询升级包、获取升级包下载链接等服务。示例服务器支持测试升级服务和二次开发功能验证,为升级服务的应用场景提供尽可能完善的端到端环境搭建。
## 开发步骤
diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md
index 12835a3a2744693575f97f78c76e76dc473b1218..946d859aa95e3a9e87d10a4d0b36e98e804e0f5a 100755
--- a/zh-cn/application-dev/reference/apis/Readme-CN.md
+++ b/zh-cn/application-dev/reference/apis/Readme-CN.md
@@ -175,10 +175,15 @@
- [@ohos.telephony.data (蜂窝数据)](js-apis-telephony-data.md)
- 网络管理
- [@ohos.net.connection (网络连接管理)](js-apis-net-connection.md)
+ - [@ohos.net.statistics (网络流量管理)](js-apis-net-statistics.md)
+ - [@ohos.net.policy (网络策略管理)](js-apis-net-policy.md)
+ - [@ohos.net.ethernet (以太网连接管理)](js-apis-net-ethernet.md)
+ - [@ohos.net.sharing (网络共享管理)](js-apis-net-sharing.md)
- [@ohos.net.http (数据请求)](js-apis-http.md)
- [@ohos.request (上传下载)](js-apis-request.md)
- [@ohos.net.socket (Socket连接)](js-apis-socket.md)
- [@ohos.net.webSocket (WebSocket连接)](js-apis-webSocket.md)
+ - [@ohos.net.tlsSocket (TLSSocket连接)](js-apis-tlsSocket.md)
- 通信与连接
- [@ohos.bluetooth (蓝牙)](js-apis-bluetooth.md)
diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md b/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md
index 230abe9053b032e5f6aaffdf1d941044b63a96b6..52ac34de00da85572d9e0cd1866bc544544d1655 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md
@@ -48,7 +48,11 @@ want操作的常数。
| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | 指示提供oauth服务的操作。 |
| ACTION_MARKET_DOWNLOAD 9+ | ohos.want.action.marketDownload | 表示从应用程序市场下载应用程序的的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 |
| ACTION_MARKET_CROWDTEST 9+ | ohos.want.action.marketCrowdTest | 指示从应用程序市场众测应用程序的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 |
-
+| DLP_PARAMS_SANDBOX9+ |ohos.dlp.params.sandbox | 指示沙盒标志的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 |
+| DLP_PARAMS_BUNDLE_NAME9+ |ohos.dlp.params.bundleName |指示DLP包名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 |
+| DLP_PARAMS_MODULE_NAME9+ |ohos.dlp.params.moduleName |指示DLP模块名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 |
+| DLP_PARAMS_ABILITY_NAME9+ |ohos.dlp.params.abilityName |指示DLP能力名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 |
+| DLP_PARAMS_INDEX9+ |ohos.dlp.params.index |指示DLP索引参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 |
## wantConstant.Entity
diff --git a/zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md
index 5b928c9dea8cd95d8c7c9fd9b671d85baa1de892..a8fbb343f2b44e1e20e6be71a3005c773861774a 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md
@@ -27,7 +27,7 @@ class MainAbility extends AccessibilityExtensionAbility {
表示查询下一焦点元素的方向。
-**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
+**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
| 名称 | 描述 |
| -------- | ------- |
@@ -42,7 +42,7 @@ class MainAbility extends AccessibilityExtensionAbility {
表示查询焦点元素的类型。
-**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
+**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
| 名称 | 描述 |
| ------------- | ----------- |
@@ -53,7 +53,7 @@ class MainAbility extends AccessibilityExtensionAbility {
表示矩形区域。
-**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
+**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ---- | ---- | --------- |
@@ -66,7 +66,7 @@ class MainAbility extends AccessibilityExtensionAbility {
表示窗口的类型。
-**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
+**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
| 名称 | 描述 |
| ----------- | --------- |
@@ -185,7 +185,7 @@ this.context.getWindows().then(windows => {
## AccessibilityExtensionContext.injectGesture
-injectGesture(gesturePath: GesturePath, listener: Callback\): Promise\
+injectGesture(gesturePath: GesturePath, callback: AsyncCallback\): void
注入手势。
@@ -196,13 +196,7 @@ injectGesture(gesturePath: GesturePath, listener: Callback\): Promise\<
| 参数名 | 参数类型 | 必填 | 说明 |
| ----------- | ---------------------------------------- | ---- | -------------- |
| gesturePath | [GesturePath](js-apis-application-AccessibilityExtensionAbility.md#GesturePath) | 是 | 表示手势的路径信息。 |
-| listener | Callback<boolean> | 是 | 表示注入手势执行结果的回调。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| ---------------------- | ---------------------- |
-| Promise<boolean> | Promise对象。返回注入手势的调用结果。 |
+| callback | AsyncCallback<void> | 是 | 表示注入手势执行结果的回调。 |
**示例:**
@@ -218,7 +212,7 @@ this.context.gestureInject(gesturePath, (result) => {
```
## AccessibilityElement.attributeNames
-attributeNames\(): Promise\>;
+attributeNames\(): Promise\>;
获取节点元素的所有属性名称。
@@ -283,7 +277,7 @@ try {
## AccessibilityElement.actionNames
-actionNames(): Promise\>;
+actionNames(): Promise\>;
获取节点元素支持的所有操作名称。
@@ -349,7 +343,7 @@ try {
## AccessibilityElement.findElement
-findElement(type: 'content', condition: string): Promise\>;
+findElement(type: 'content', condition: string): Promise\>;
查询节点元素的指定内容。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-accessibility.md b/zh-cn/application-dev/reference/apis/js-apis-accessibility.md
index 640249008adb16cfeb905f813c745adc7d3894a1..de981f480adff501aedf34b43da4e74b905d01f9 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-accessibility.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-accessibility.md
@@ -173,6 +173,7 @@ on(type: 'enableChange', callback: Callback<boolean>): void;
- **示例:**
```typescript
+ let captionsManager = accessibility.getCaptionsManager();
captionsManager.on('enableChange',(data) => {
console.info('success data:subscribeStateObserver : ' + JSON.stringify(data))
})
@@ -194,6 +195,7 @@ on(type: 'styleChange', callback: Callback<CaptionsStyle>): void;
- **示例:**
```typescript
+ let captionsManager = accessibility.getCaptionsManager();
captionsManager.on('styleChange',(data) => {
console.info('success data:subscribeStateObserver : ' + JSON.stringify(data))
})
@@ -215,6 +217,7 @@ off(type: 'enableChange', callback?: Callback<boolean>): void;
- **示例:**
```typescript
+ let captionsManager = accessibility.getCaptionsManager();
captionsManager.off('enableChange')
```
@@ -234,6 +237,7 @@ off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void;
- **示例:**
```typescript
+ let captionsManager = accessibility.getCaptionsManager();
captionsManager.off('styleChange')
```
@@ -361,11 +365,6 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise<A
console.info(item.id);
console.info(item.name);
console.info(item.description);
- console.info(item.abilityTypes);
- console.info(item.eventTypes);
- console.info(item.capabilities);
- console.info(item.packageName);
- console.info(item.filterBundleNames);
console.info(item.bundleName);
}
}).catch((error) => {
@@ -402,11 +401,6 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState,callback: Asyn
console.info(item.id);
console.info(item.name);
console.info(item.description);
- console.info(item.abilityTypes);
- console.info(item.eventTypes);
- console.info(item.capabilities);
- console.info(item.packageName);
- console.info(item.filterBundleNames);
console.info(item.bundleName);
}
})
@@ -429,7 +423,7 @@ getCaptionsManager(): CaptionsManager
- **示例:**
```typescript
- captionsManager = accessibility.getCaptionsManager()
+ let captionsManager = accessibility.getCaptionsManager()
```
## accessibility.on('accessibilityStateChange' | 'touchGuideStateChange')
@@ -603,7 +597,12 @@ sendEvent(event: EventInfo): Promise<void>
- **示例:**
```typescript
- accessibility.sendEvent(this.eventInfo)
+ let eventInfo : accessibility.EventInfo = {
+ type: 'focus',
+ bundleName: 'bundle',
+ triggerAction: 'focus'
+ }
+ accessibility.sendEvent(eventInfo)
.then((data) => {
console.info('success data:sendEvent : ' + JSON.stringify(data))
}).catch((error) => {
@@ -629,7 +628,12 @@ sendEvent(event: EventInfo, callback: AsyncCallback<void>): void
- **示例:**
```typescript
- accessibility.sendEvent(this.eventInfo,(err, data) => {
+ let eventInfo : accessibility.EventInfo = {
+ type: 'focus',
+ bundleName: 'bundle',
+ triggerAction: 'focus'
+ }
+ accessibility.sendEvent(eventInfo,(err, data) => {
if (err) {
console.error('failed to sendEvent because ' + JSON.stringify(err));
return;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-quickFixManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-quickFixManager.md
new file mode 100644
index 0000000000000000000000000000000000000000..88876191cbe1311ff44d9f15cd355fa352555243
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-application-quickFixManager.md
@@ -0,0 +1,178 @@
+# quickFixManager
+
+quickFixManager模块提供快速修复的能力,快速修复是鸿蒙提供给开发者的一种技术手段,支持开发者以远快于(小时级、分钟级)应用升级的方式进行缺陷修复。
+
+> **说明:**
+>
+> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```
+import quickFixManager from '@ohos.application.quickFixManager';
+```
+
+## HapModuleQuickFixInfo
+
+hap级别的快速修复信息。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+| 名称 | 读写属性 | 类型 | 必填 | 描述 |
+| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
+| moduleName | 只读 | string | 是 | hap包的名称。 |
+| originHapHash | 只读 | string | 是 | 指示hap的哈希值。 |
+| quickFixFilePath | 只读 | string | 是 | 指示快速修复文件的安装路径。 |
+
+## ApplicationQuickFixInfo
+
+应用级别的快速修复信息。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+| 名称 | 读写属性 | 类型 | 必填 | 描述 |
+| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
+| bundleName | 只读 | string | 是 | 应用的包名。 |
+| bundleVersionCode | 只读 | number | 是 | 应用的版本号。 |
+| bundleVersionName | 只读 | string | 是 | 应用版本号的文字描述。 |
+| quickFixVersionCode | 只读 | number | 是 | 快速修复补丁包的版本号。 |
+| quickFixVersionName | 只读 | string | 是 | 快速修复补丁包版本号的文字描述。 |
+| hapModuleQuickFixInfo | 只读 | Array\<[HapModuleQuickFixInfo](#hapmodulequickfixinfo)> | 是 | hap级别的快速修复信息。 |
+
+## quickFixManager.applyQuickFix
+
+applyQuickFix(hapModuleQuickFixFiles: Array\, callback: AsyncCallback\): void;
+
+快速修复的补丁安装接口。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | hapModuleQuickFixFiles | Array\ | 否 | 快速修复补丁文件(补丁文件需包含有效的文件路径)。 |
+ | callback | AsyncCallback\ | 否 | 表示指定的回调方法。 |
+
+**示例:**
+
+```js
+ import quickFixManager from '@ohos.application.quickFixManager'
+
+ let hapModuleQuickFixFiles = ["/data/storage/el2/base/entry.hqf"]
+ quickFixManager.applyQuickFix(hapModuleQuickFixFiles, (error) => {
+ if (error) {
+ console.info( `applyQuickFix failed with error + ${error}`)
+ } else {
+ console.info( 'applyQuickFix success')
+ }
+ })
+```
+
+## quickFixManager.applyQuickFix
+
+applyQuickFix(hapModuleQuickFixFiles: Array\): Promise;
+
+快速修复的补丁安装接口。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | hapModuleQuickFixFiles | Array\ | 否 | 快速修复补丁文件(补丁文件需包含有效的文件路径)。 |
+
+**返回值:**
+
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Promise\ | 返回相应结果。 |
+
+**示例:**
+
+```js
+ import quickFixManager from '@ohos.application.quickFixManager'
+
+ let hapModuleQuickFixFiles = ["/data/storage/el2/base/entry.hqf"]
+ quickFixManager.applyQuickFix(hapModuleQuickFixFiles).then(() => {
+ console.info('applyQuickFix success')
+ }).catch((error) => {
+ console.info(`applyQuickFix err: + ${error}`)
+ })
+```
+
+## quickFixManager.getApplicationQuickFixInfo
+
+getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\): void;
+
+获取应用的快速修复信息。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | bundleName | string | 否 |应用的包名。 |
+ | callback | AsyncCallback\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | 否 | 应用的快速修复信息。 |
+
+**示例:**
+
+```js
+ import quickFixManager from '@ohos.application.quickFixManager'
+
+ let bundleName = "bundleName"
+ quickFixManager.getApplicationQuickFixInfo(bundleName, (error, data) => {
+ if (error) {
+ console.info(`getApplicationQuickFixInfo error: + ${error}`)
+ } else {
+ console.info(`getApplicationQuickFixInfo success: + ${data}`)
+ }
+ })
+```
+
+## quickFixManager.getApplicationQuickFixInfo
+
+getApplicationQuickFixInfo(bundleName: string): Promise\;
+
+获取应用的快速修复信息。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | bundleName | string | 否 | 应用的包名。 |
+
+**返回值:**
+
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | 返回应用的快速修复信息。 |
+
+**示例:**
+
+ ```js
+ import quickFixManager from '@ohos.application.quickFixManager'
+
+ let bundleName = "bundleName"
+ quickFixManager.getApplicationQuickFixInfo(bundleName).then((data) => {
+ console.info(`getApplicationQuickFixInfo success: + ${data}`)
+ }).catch((error) => {
+ console.info(`getApplicationQuickFixInfo err: + ${error}`)
+ })
+```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md b/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md
index 2c9f76234fb7eec46f45e2faf3d09f2bf980b7ae..7fb56e487ec5d78cd1f6ae87edbc645faee0a5bc 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md
@@ -1,6 +1,6 @@
# ShellCmdResult
-ShellCmdResult模块提供Shell命令执行结果的能力。
+本模块提供Shell命令执行结果的能力。
> **说明:**
>
diff --git a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md
index 01c486e90e52e531bb75c8301f0df1bbbf6a47a9..32cbf3a3a2a7aabc52d408aeb90113156af8b099 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md
@@ -784,7 +784,7 @@ onProcessDied(processData: ProcessData): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
-| processData | ProcessData | 否 | 进程信息。 |
+| processData | [ProcessData](#processdata) | 否 | 进程信息。 |
**示例:**
@@ -798,6 +798,34 @@ onProcessDied(processData: ProcessData): void;
console.log('-------- observerCode: ---------', observerCode);
```
+## ApplicationStateObserver.onProcessStateChanged9+
+
+ onProcessStateChanged(processData: ProcessData): void;
+
+当进程状态更改时调用。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**系统API**:该接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| processData | [ProcessData](#processdata) | 否 | 进程信息。 |
+
+**示例:**
+
+```js
+ var applicationStateObserver = {
+ onProcessStateChanged(processData) {
+ console.log('------------ onProcessStateChanged -----------', processData);
+ }
+ }
+ const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
+ console.log('-------- observerCode: ---------', observerCode);
+```
+
## AppStateData
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
@@ -837,8 +865,8 @@ onProcessDied(processData: ProcessData): void;
| pid8+ | number | 是 | 否 | 进程ID。 |
| bundleName8+ | string | 是 | 否 | 应用包名。 |
| uid8+ | number | 是 | 否 | 用户ID。 |
-
-
+| isContinuousTask9+ | boolean | 是 | 否 | 判断过程是否为连续任务。 |
+| isKeepAlive8+ | boolean | 是 | 否 | 判断该过程是否保持活跃。 |
## ProcessRunningInfo
@@ -875,4 +903,32 @@ onProcessDied(processData: ProcessData): void;
| pid9+ | 只读 | number | 否 | 进程ID。 |
| uid9+ | 只读 | number | 否 | 用户ID。 |
| processName9+ | 只读 | string | 否 | 进程的名称。 |
-| bundleNames9+ | 只读 | Array\ | 否 | 进程中运行的bundleName数组。 |
\ No newline at end of file
+| bundleNames9+ | 只读 | Array\ | 否 | 进程中运行的bundleName数组。 |
+
+## ApplicationState9+
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+| 名称 | 值 | 描述 |
+| -------------------- | --- | --------------------------------- |
+| STATE_CREATE | 1 | 当应用在创建中的时候处于的状态。 |
+| STATE_FOREGROUND | 2 | 当应用切换到前台的时候处于的状态。 |
+| STATE_ACTIVE | 3 | 当应用在获焦的时候处于的状态。 |
+| STATE_BACKGROUND | 4 | 当应用处于后台不可见时处于的状态。 |
+| STATE_DESTROY | 5 | 当应用在销毁的时候处于的状态。 |
+
+## ProcessState9+
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+| 名称 | 值 | 描述 |
+| -------------------- | --- | --------------------------------- |
+| STATE_CREATE | 1 | 当进程在创建中的时候处于的状态。 |
+| STATE_FOREGROUND | 2 | 当进程切换到前台的时候处于的状态。 |
+| STATE_ACTIVE | 3 | 当进程在获焦的时候处于的状态。 |
+| STATE_BACKGROUND | 4 | 当进程处于后台不可见时处于的状态。 |
+| STATE_DESTROY | 5 | 当进程在销毁的时候处于的状态。 |
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 5cbada92e9bcffa7e92423848b3c2d5c3b4030ae..217aa618a40a96f02eb38d24931db1143d08ad49 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-audio.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md
@@ -752,7 +752,7 @@ getRoutingManager(callback: AsyncCallback<AudioRoutingManager>): void
**示例:**
```js
-await audioManager.getRoutingManager((err, callback) => {
+audioManager.getRoutingManager((err, callback) => {
if (err) {
console.error(`Result ERROR: ${err}`);
}
@@ -3360,28 +3360,19 @@ AudioRenderChangeInfo数组,只读。
import audio from '@ohos.multimedia.audio';
var audioStreamManager;
-var audioStreamManagerCB;
var resultFlag = false;
-
-async function getStreamManager(){
- await audioManager.getStreamManager().then(async function (data) {
- audioStreamManager = data;
- console.info('Get AudioStream Manager : Success');
- }).catch((err) => {
- console.error(`Get AudioStream Manager : ERROR : ${err}`);
- });
-}
+var audioManager = audio.getAudioManager();
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`Get AudioStream Manager : ERROR : ${err}`);
} else {
- audioStreamManagerCB = data;
+ audioStreamManager = data;
console.info('Get AudioStream Manager : Success');
}
});
-audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => {
+audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => {
for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) {
console.info(`## RendererChange on is called for ${i} ##`);
console.info(`StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`);
@@ -3434,6 +3425,16 @@ AudioCapturerChangeInfo数组,只读。
import audio from '@ohos.multimedia.audio';
const audioManager = audio.getAudioManager();
+let audioStreamManager;
+audioManager.getStreamManager((err, data) => {
+ if (err) {
+ console.error(`getStreamManager : Error: ${err}`);
+ } else {
+ console.info('getStreamManager : Success : SUCCESS');
+ audioStreamManager = data;
+ }
+});
+
var resultFlag = false;
audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => {
for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) {
@@ -3926,34 +3927,6 @@ write(buffer: ArrayBuffer, callback: AsyncCallback\): void
**示例:**
```js
-import audio from '@ohos.multimedia.audio';
-import fileio from '@ohos.fileio';
-import featureAbility from '@ohos.ability.featureAbility'
-
-var audioStreamInfo = {
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
- channels: audio.AudioChannel.CHANNEL_2,
- sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
- encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
-}
-
-var audioRendererInfo = {
- content: audio.ContentType.CONTENT_TYPE_SPEECH,
- usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
- rendererFlags: 0
-}
-
-var audioRendererOptions = {
- streamInfo: audioStreamInfo,
- rendererInfo: audioRendererInfo
-}
-var audioRenderer;
-audio.createAudioRenderer(audioRendererOptions).then((data)=> {
- audioRenderer = data;
- console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
- }).catch((err) => {
- console.error(`AudioFrameworkRenderLog: AudioRenderer Created: ERROR: ${err}`);
- });
var bufferSize;
audioRenderer.getBufferSize().then((data)=> {
console.info(`AudioFrameworkRenderLog: getBufferSize: SUCCESS ${data}`);
@@ -4034,10 +4007,11 @@ audioRenderer.getBufferSize().then((data) => {
});
console.info(`BufferSize: ${bufferSize}`);
var context = featureAbility.getContext();
+var path;
async function getCacheDir(){
path = await context.getCacheDir();
}
-var filePath = 'data/StarWars10s-2C-48000-4SW.wav';
+var filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize);
ss.readSync(buf);
@@ -4139,33 +4113,6 @@ getBufferSize(): Promise\
**示例:**
```js
-import audio from '@ohos.multimedia.audio';
-import fileio from '@ohos.fileio';
-
-var audioStreamInfo = {
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
- channels: audio.AudioChannel.CHANNEL_2,
- sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
- encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
-}
-
-var audioRendererInfo = {
- content: audio.ContentType.CONTENT_TYPE_SPEECH,
- usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
- rendererFlags: 0
-}
-
-var audioRendererOptions = {
- streamInfo: audioStreamInfo,
- rendererInfo: audioRendererInfo
-}
-var audioRenderer;
-audio.createAudioRenderer(audioRendererOptions).then((data) => {
- audioRenderer = data;
- console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
- }).catch((err) => {
- console.info(`AudioFrameworkRenderLog: AudioRenderer Created: ERROR: ${err}`);
- });
var bufferSize;
audioRenderer.getBufferSize().then((data) => {
console.info(`AudioFrameworkRenderLog: getBufferSize: SUCCESS ${data}`);
@@ -4300,26 +4247,6 @@ setInterruptMode(mode: InterruptMode): Promise<void>
**示例:**
```js
-var audioStreamInfo = {
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
- channels: audio.AudioChannel.CHANNEL_1,
- sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
- encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
-}
-var audioRendererInfo = {
- content: audio.ContentType.CONTENT_TYPE_MUSIC,
- usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
- rendererFlags: 0
-}
-var audioRendererOptions = {
- streamInfo: audioStreamInfo,
- rendererInfo: audioRendererInfo
-}
-let audioRenderer;
-async function createAudioRenderer(){
- audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
-}
-
let mode = 0;
audioRenderer.setInterruptMode(mode).then(data=>{
console.info('setInterruptMode Success!');
@@ -4345,27 +4272,6 @@ setInterruptMode(mode: InterruptMode, callback: AsyncCallback\): void
**示例:**
```js
-var audioStreamInfo = {
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
- channels: audio.AudioChannel.CHANNEL_1,
- sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
- encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
-}
-var audioRendererInfo = {
- content: audio.ContentType.CONTENT_TYPE_MUSIC,
- usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
- rendererFlags: 0
-}
-var audioRendererOptions = {
- streamInfo: audioStreamInfo,
- rendererInfo: audioRendererInfo
-}
-
-let audioRenderer;
-async function createAudioRenderer(){
- audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
-}
-
let mode = 1;
audioRenderer.setInterruptMode(mode, (err, data)=>{
if(err){
@@ -4740,33 +4646,6 @@ start(): Promise
**示例:**
```js
-import audio from '@ohos.multimedia.audio';
-import fileio from '@ohos.fileio';
-
-var audioStreamInfo = {
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
- channels: audio.AudioChannel.CHANNEL_2,
- sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
- encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
-}
-
-var audioCapturerInfo = {
- source: audio.SourceType.SOURCE_TYPE_MIC,
- capturerFlags: 0
-}
-
-var audioCapturerOptions = {
- streamInfo: audioStreamInfo,
- capturerInfo: audioCapturerInfo
-}
-
-var audioCapturer;
-audio.createAudioCapturer(audioCapturerOptions).then((data) => {
- audioCapturer = data;
- console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS');
- }).catch((err) => {
- console.info(`AudioFrameworkRecLog: AudioCapturer Created: ERROR: ${err}`);
- });
audioCapturer.start().then(() => {
console.info('AudioFrameworkRecLog: ---------START---------');
console.info('AudioFrameworkRecLog: Capturer started: SUCCESS');
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-PackInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-PackInfo.md
index 8fc830671da2e42592ba87b7d6ea55d4fd56bd4a..82d22cb133c5e81ea7621f1345d86ad56d04c32c 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bundle-PackInfo.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-PackInfo.md
@@ -139,8 +139,8 @@
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | ------ | ---- | ---- | -------------------- |
-| releaseType | string | 是 | 否 | 版本的最小兼容代码。 |
-| compatible | number | 是 | 否 | 版本的名称。 |
+| releaseType | string | 是 | 否 | 版本的名称。 |
+| compatible | number | 是 | 否 | 版本的最小兼容代码。 |
| target | numbe | 是 | 否 | 目标版本号。 |
## Version
diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-connection.md b/zh-cn/application-dev/reference/apis/js-apis-net-connection.md
index 0fcca6fa662a650154ca5b1fe4d5db44e197228b..9ac63506828b3293812c8fdccdeb22cd16594259 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-net-connection.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-net-connection.md
@@ -66,6 +66,7 @@ connection.getDefaultNet().then(function (netHandle) {
hasDefaultNet(callback: AsyncCallback\): void
检查默认数据网络是否被激活,使用callback方式作为异步方法。
+默认数据网络:以太网>wifi>蜂窝,当只有一个网络为连接状态时,当前连接网络为默认数据网络。
**系统能力**:SystemCapability.Communication.NetManager.Core
@@ -89,6 +90,7 @@ connection.hasDefaultNet(function (error, has) {
hasDefaultNet(): Promise\
检查默认数据网络是否被激活,使用Promise方式作为异步方法。
+默认数据网络:以太网>wifi>蜂窝,当只有一个网络为连接状态时,当前连接网络为默认数据网络。
**系统能力**:SystemCapability.Communication.NetManager.Core
@@ -794,6 +796,108 @@ netConnection.unregister(function (error) {
| ------ | ------ | ------------------------- |
| netId | number | 网络ID,必须大于等于100。 |
+
+### bindSocket
+
+bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): void;
+
+将TCPSocket或UDPSocket绑定到当前网络,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----------- | ------------------------ | ---- | -------------------------------|
+| socketParam | [TCPSocket](js-apis-socket.md#tcpsocket) \| [UDPSocket](js-apis-socket.md#udpsocket) | 是 | 待绑定的TCPSocket或UDPSocket对象。|
+| callback | AsyncCallback\ | 是 | 回调函数 |
+
+**示例:**
+
+```js
+connection.getDefaultNet().then(function (netHandle) {
+ var tcp = socket.constructTCPSocketInstance();
+ var udp = socket.constructUDPSocketInstance();
+ let socketType = "xxxx";
+ if (socketType == "TCPSocket") {
+ tcp.bind({
+ address: "xxxx", port: xxxx, family: xxxx
+ }, err => {
+ netHandle.bindSocket(tcp, function (error, data) {
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+ })
+ } else {
+ udp.on('message', callback);
+ udp.bind({
+ address: "xxxx", port: xxxx, family: xxxx
+ }, err => {
+ udp.on('message', (data) => {
+ console.log(JSON.stringify(data))
+ });
+ netHandle.bindSocket(udp, function (error, data) {
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+ });
+ })
+ }
+}
+```
+
+### bindSocket
+
+bindSocket(socketParam: TCPSocket \| UDPSocket): Promise\;
+
+将TCPSocket或UDPSockett绑定到当前网络,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------------- | --------------------- | ---- | ------------------------------ |
+| socketParam | [TCPSocket](js-apis-socket.md#tcpsocket) \| [UDPSocket](js-apis-socket.md#udpsocket) | 是 | 待绑定的TCPSocket或UDPSocket对象。|
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------------- | ---------------------- |
+| Promise\ | 以Promise形式返回结果。 |
+
+**示例:**
+
+```js
+connection.getDefaultNet().then(function (netHandle) {
+ var tcp = socket.constructTCPSocketInstance();
+ var udp = socket.constructUDPSocketInstance();
+ let socketType = "xxxx";
+ if(socketType == "TCPSocket") {
+ tcp.bind({
+ address: "xxxx", port: xxxx, family: xxxx
+ }, err => {
+ netHandle.bindSocket(tcp).then(err, data) {
+ console.log(JSON.stringify(data))
+ })
+ } else {
+ udp.on('message', callback);
+ udp.bind({
+ address: "xxxx", port: xxxx, family: xxxx
+ }, err => {
+ udp.on('message', (data) => {
+ console.log(JSON.stringify(data))
+ });
+ netHandle.bindSocket(tcp).then(err, data) {
+ console.log(JSON.stringify(data))
+ });
+ })
+ }
+}
+```
+
### getAddressesByName
getAddressesByName(host: string, callback: AsyncCallback\>): void
@@ -1018,4 +1122,4 @@ connection.getDefaultNet().then(function (netHandle) {
| ------- | ------ | ------------------------------ |
| address | string | 地址。 |
| family | number | IPv4 = 1,IPv6 = 2,默认IPv4。 |
-| port | number | 端口,取值范围\[0, 65535]。 |
\ No newline at end of file
+| port | number | 端口,取值范围\[0, 65535]。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
new file mode 100644
index 0000000000000000000000000000000000000000..2c644dccc3e07b9cbbeb2cee34b52a66dc94df84
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
@@ -0,0 +1,301 @@
+# 以太网连接管理
+
+以太网连接管理主要提供有线网络能力,提供设置有线网络的IP地址,子网掩码,网关,DNS等信息
+
+> **说明:**
+>
+> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```js
+import ethernet from '@ohos.net.ethernet'
+```
+
+## ethernet.setIfaceConfig
+
+setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\): void;
+
+设置网络接口配置信息,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------------------------------------------------- | ---- | ------------------------------------------ |
+| iface | string | 是 | 网络接口名 |
+| ic | [InterfaceConfiguration](#interfaceconfiguration) | 是 | 要设置的网络接口配置信息 |
+| callback | AsyncCallback\ | 是 | 回调函数,成功无返回,失败返回对应错误码。 |
+
+**示例:**
+
+```js
+ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", routeAddr:"192.168.1.1",
+ gateAddr:"192.168.1.1", maskAddr:"255.255.255.0", dnsAddr0:"1.1.1.1", dnsAddr1:"2.2.2.2"},
+ (error) => {
+ if (error) {
+ console.log("setIfaceConfig callback error = " + error);
+ } else {
+ console.log("setIfaceConfig callback ok ");
+ }
+ });
+```
+
+## ethernet.setIfaceConfig
+
+setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\;
+
+设置网络接口配置信息,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------------------------------------------------- | ---- | ------------------------ |
+| iface | string | 是 | 接口名 |
+| ic | [InterfaceConfiguration](#interfaceconfiguration) | 是 | 要设置的网络接口配置信息 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ----------------------------------------------------------- |
+| Promise\ | 以Promise形式返回执行结果。成功无返回,失败返回对应错误码。 |
+
+**示例:**
+
+```js
+ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", routeAddr:"192.168.1.1",
+ gateAddr:"192.168.1.1", maskAddr:"255.255.255.0", dnsAddr0:"1.1.1.1", dnsAddr1:"2.2.2.2"}).then(() => {
+ console.log("setIfaceConfig promiss ok ");
+}).catch((error) => {
+ console.log("setIfaceConfig promiss error = " + error);
+});
+```
+
+## ethernet.getIfaceConfig
+
+getIfaceConfig(iface: string, callback: AsyncCallback\): void;
+
+获取指定网络接口信息,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------------- | ----- | ------------ |
+| iface | string | 是 | 指定网络接口 |
+| callback | AsyncCallback\<[InterfaceConfiguration](#interfaceconfiguration)> | 是 | 回调函数,返回指定网络接口信息 |
+
+**示例:**
+
+```js
+ethernet.getIfaceConfig("eth0", (error, value) => {
+ if (error) {
+ console.log("getIfaceConfig callback error = " + error);
+ } else {
+ console.log("getIfaceConfig callback mode = " + value.mode);
+ console.log("getIfaceConfig callback ipAddr = " + value.ipAddr);
+ console.log("getIfaceConfig callback routeAddr = " + value.routeAddr);
+ console.log("getIfaceConfig callback gateAddr = " + value.gateAddr);
+ console.log("getIfaceConfig callback maskAddr = " + value.maskAddr);
+ console.log("getIfaceConfig callback dns0Addr = " + value.dns0Addr);
+ console.log("getIfaceConfig callback dns1Addr = " + value.dns1Addr);
+ }
+});
+```
+
+## ethernet.getIfaceConfig
+
+getIfaceConfig(iface: string): Promise\;
+
+获取指定网络接口信息,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ------------ |
+| iface | string | 是 | 指定网络接口 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ---------------------------------- |
+| Promise\<[InterfaceConfiguration](#interfaceconfiguration)> | 以Promise形式返回接口信息。 |
+
+**示例:**
+
+```js
+ethernet.getIfaceConfig("eth0").then((data) => {
+ console.log("getIfaceConfig promiss mode = " + data.mode);
+ console.log("getIfaceConfig promiss ipAddr = " + data.ipAddr);
+ console.log("getIfaceConfig promiss routeAddr = " + data.routeAddr);
+ console.log("getIfaceConfig promiss gateAddr = " + data.gateAddr);
+ console.log("getIfaceConfig promiss maskAddr = " + data.maskAddr);
+ console.log("getIfaceConfig promiss dns0Addr = " + data.dns0Addr);
+ console.log("getIfaceConfig promiss dns1Addr = " + data.dns1Addr);
+}).catch((error) => {
+ console.log("getIfaceConfig promiss error = " + error);
+});
+```
+
+## ethernet.isIfaceActive
+
+isIfaceActive(iface?: string, callback: AsyncCallback\): void;
+
+判断接口是否已激活,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------- | ---- | -------------------------------------------------- |
+| iface | string | 否 | 接口名。为空时代表查询是否存在激活接口 |
+| callback | AsyncCallback\ | 是 | 回调函数,已激活:1,未激活:0,其他为获取失败错误码。 |
+
+**示例:**
+
+```js
+ethernet.isIfaceActive("eth0", (error, value) => {
+ if (error) {
+ console.log("whether2Activate callback error = " + error);
+ } else {
+ console.log("whether2Activate callback = " + value);
+ }
+});
+```
+
+## ethernet.isIfaceActive
+
+isIfaceActive(iface?: string): Promise\;
+
+判断接口是否已激活,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | -------------------------------------- |
+| iface | string | 否 | 接口名。为空时代表查询是否存在激活接口 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------| ------------------------------------------------------------------ |
+| Promise\ | 以Promise形式返回获取结果。已激活:1,未激活:0,其他为获取失败错误码。|
+
+**示例:**
+
+```js
+ethernet.isIfaceActive("eth0").then((data) => {
+ console.log("isIfaceActive promiss = " + data);
+}).catch((error) => {
+ console.log("isIfaceActive promiss error = " + error);
+});
+```
+
+## ethernet.getAllActiveIfaces
+
+getAllActiveIfaces(callback: AsyncCallback\>): void;
+
+获取活动的网络接口,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------------------------------------ | ---- | ------------------------------ |
+| callback | AsyncCallback\> | 是 | 回调函数,返回值为对应接口名。 |
+
+**示例:**
+
+```js
+ethernet.getAllActiveIfaces((error, value) => {
+ if (error) {
+ console.log("getAllActiveIfaces callback error = " + error);
+ } else {
+ console.log("getAllActiveIfaces callback value.length = " + value.length);
+ for (let i = 0; i < value.length; i++) {
+ console.log("getAllActiveIfaces callback = " + value[i]);
+ }
+ }
+});
+```
+
+## ethernet.getAllActiveIfaces
+
+getAllActiveIfaces(): Promise\>;
+
+获取活动的网络接口,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.GET_NETWORK_INFO
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------------------ | ----------------------------------------------- |
+| Promise\> | 以Promise形式返回获取结果。返回值为对应接口名。 |
+
+**示例:**
+
+```js
+ethernet.getAllActiveIfaces().then((data) => {
+ console.log("getAllActiveIfaces promiss data.length = " + data.length);
+ for (let i = 0; i < data.length; i++) {
+ console.log("getAllActiveIfaces promiss = " + data[i]);
+ }
+}).catch((error) => {
+ console.log("getAllActiveIfaces promiss error = " + error);
+});
+```
+
+## InterfaceConfiguration
+
+以太网连接配置网络信息。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 类型 | 说明 |
+| ----------------------- | ----------------------------------- | ------------------------------------------------------------ |
+| mode | [IPSetMode](#ipsetmode) | 以太网连接配置模式。 |
+| ipAddr | string | 以太网连接静态配置ip信息,地址值范围0-255.0-255.0-255.0-255(DHCP模式无需配置)。 |
+| route | string | 以太网连接静态配置路由信息,地址值范围0-255.0-255.0-255.0-255(DHCP模式无需配置)。 |
+| gateway | string | 以太网连接配置网关信息,地址值范围0-255.0-255.0-255.0-255(DHCP模式无需配置)。 |
+| netMask | string | 以太网连接配置子网掩码,地址值范围0-255.0-255.0-255.0-255(DHCP模式无需配置)。 |
+| dnsServers | string | 以太网连接配置dns服务地址,地址值范围0-255.0-255.0-255.0-255(DHCP模式无需配置)多地址间用“,”隔开。 |
+
+## IPSetMode
+
+以太网连接模式。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ------------------------ | ---- | ---------------------- |
+| STATIC | 0 | 以太网连接静态配置网络信息。 |
+| DHCP | 1 | 以太网连接动态配置网络信息。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md
new file mode 100644
index 0000000000000000000000000000000000000000..8bffaf0ea66260cdb6f5a405c3cc72545a9b0056
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md
@@ -0,0 +1,1120 @@
+# 网络策略管理
+
+网络策略管理通过对用户使用数据流量进行控制管理,采用防火墙技术实现网络策略的管理。
+
+> **说明:**
+>
+> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```js
+import policy from '@ohos.net.policy'
+```
+
+## policy.setBackgroundPolicy
+
+setBackgroundPolicy(isAllowed: boolean, callback: AsyncCallback\): void
+
+设置后台网络策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| isAllowed | boolean | 是 | 是否允许应用后台使用数据 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回设定结果。 |
+
+**示例:**
+
+```js
+policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))), (err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+});
+```
+
+## policy.setBackgroundPolicy
+
+setBackgroundPolicy(isAllowed: boolean): Promise\
+
+设置后台网络策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| isAllowed | boolean | 是 | 是否允许应用后台使用数据 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## policy.getBackgroundPolicy
+
+getBackgroundPolicy(callback: AsyncCallback\): void;
+
+获取后台网络策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,返回true代表后台策略为允许。 |
+
+**示例:**
+
+```js
+policy.getBackgroundPolicy((err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+});
+```
+
+## policy.getBackgroundPolicy
+
+getBackgroundPolicy(): Promise\;
+
+获取后台网络策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+policy.getBackgroundPolicy().then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.setPolicyByUid
+
+setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback\): void;
+
+设置对应uid应用的访问计量网络的策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | 应用的唯一标识符 |
+| policy | [NetUidPolicy](#netuidpolicy) | 是 | 应用对应的策略 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {
+ uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy)
+}
+policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy), (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.setPolicyByUid
+
+setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\;
+
+设置对应uid应用的访问计量网络的策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | 应用的唯一标识符 |
+| policy | [NetUidPolicy](#netuidpolicy) | 是 | 应用对应的策略 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {
+ uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy)
+}
+policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy)).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.getPolicyByUid
+
+getPolicyByUid(uid: number, callback: AsyncCallback\): void;
+
+通过应用uid获取策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| callback | AsyncCallback\<[NetUidPolicy](#netuidpolicy)> | 是 | 回调函数,返回获取结果。 |
+
+**示例:**
+
+```js
+policy.getPolicyByUid(Number.parseInt(this.firstParam), (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.getPolicyByUid
+
+getPolicyByUid(uid: number): Promise\;
+
+通过应用uid获取策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\<[NetUidPolicy](#netuidpolicy)> | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+policy.getPolicyByUid(Number.parseInt(this.firstParam)).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.getUidsByPolicy
+
+getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback\>): void;
+
+通过策略获取设置这一策略的应用uid数组,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| policy | [NetUidPolicy](#netuidpolicy) | 是 | 应用对应的计量网络下的策略 |
+| callback | AsyncCallback\> | 是 | 回调函数,返回获取结果。 |
+
+**示例:**
+
+```js
+policy.getUidsByPolicy(Number.parseInt(this.currentNetUidPolicy), (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.getUidsByPolicy
+
+function getUidsByPolicy(policy: NetUidPolicy): Promise\>;
+
+通过策略获取设置这一策略的应用uid数组,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| policy | [NetUidPolicy](#netuidpolicy) | 是 | app对应的计量网络下的策略 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\> | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.getNetQuotaPolicies
+
+getNetQuotaPolicies(callback: AsyncCallback\>): void;
+
+获取计量网络策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\> | 是 | 回调函数,返回获取结果。 |
+
+**示例:**
+
+```js
+policy.getNetQuotaPolicies((err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.getNetQuotaPolicies
+
+getNetQuotaPolicies(): Promise\>;
+
+获取计量网络策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\> | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+policy.getNetQuotaPolicies().then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.setNetQuotaPolicies
+
+setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallback\): void;
+
+设置计量网络策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | 是 | 计量网络策略 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes),
+ limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction};
+this.netQuotaPolicyList.push(param);
+
+policy.setNetQuotaPolicies(this.netQuotaPolicyList, (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.setNetQuotaPolicies
+
+setNetQuotaPolicies(quotaPolicies: Array\): Promise\;
+
+设置计量网络策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | 是 | 计量网络策略 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes),
+ limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction};
+this.netQuotaPolicyList.push(param);
+
+policy.setNetQuotaPolicies(this.netQuotaPolicyList).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## policy.restoreAllPolicies
+
+restoreAllPolicies(iccid: string, callback: AsyncCallback\): void;
+
+重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| iccid | string | 是 | SIM卡ID|
+| callback | AsyncCallback\ | 是 | 回调函数,返回重置结果。 |
+
+**示例:**
+
+```js
+this.firstParam = iccid;
+policy.restoreAllPolicies(this.firstParam, (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.restoreAllPolicies
+
+restoreAllPolicies(iccid: string): Promise\;
+
+重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| iccid | string | 是 | SIM卡ID|
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+this.firstParam = iccid;
+policy.restoreAllPolicies(this.firstParam).then((err, data){
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.isUidNetAllowed
+
+isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback\): void;
+
+获取对应uid能否访问计量或非计量网络,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| isMetered | boolean | 是 | 是否为计量网络 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回true表示这个uid可以访问对应的计量网络。 |
+
+**示例:**
+
+```js
+
+let param = {
+ uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean))
+}
+policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.isUidNetAllowed
+
+isUidNetAllowed(uid: number, isMetered: boolean): Promise\;
+
+获取对应uid能否访问计量或非计量网络,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| isMetered | boolean | 是 | 是否为计量网络 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+
+let param = {
+ uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean))
+}
+policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.isUidNetAllowed
+
+isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback\): void;
+
+获取对应uid能否访问指定的iface的网络,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| iface | string | 是 | 网络对应的名称 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回true表示这个uid可以访问对应iface的网络。 |
+
+**示例:**
+
+```js
+
+let param = {
+ uid: Number.parseInt(this.firstParam), iface: this.secondParam
+}
+policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam, (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.isUidNetAllowed
+
+isUidNetAllowed(uid: number, iface: string): Promise\;
+
+获取对应uid能否访问指定的iface的网络,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| iface | string | 是 | 网络对应的名称 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {
+ uid: Number.parseInt(this.firstParam), iface: this.secondParam
+}
+policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.setDeviceIdleAllowlist
+
+setDeviceIdleAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void;
+
+设置指定uid能应用是否在休眠防火墙的白名单,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| isAllowed | boolean | 是 | 是否加入白名单 |
+| callback | callback: AsyncCallback\ | 是 | 回调函数,返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {
+ uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
+}
+policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.setDeviceIdleAllowlist
+
+setDeviceIdleAllowList(uid: number, isAllowed: boolean): Promise\;
+
+设置指定uid能应用是否在休眠防火墙的白名单,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| isAllowed | boolean | 是 | 是否加入白名单 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {
+ uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
+}
+policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.getDeviceIdleAllowlist
+
+getDeviceIdleAllowList(callback: AsyncCallback\>): void;
+
+获取休眠模式白名单所包含的uid数组,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\> | 是 | 回调函数,返回获取结果。 |
+
+**示例:**
+
+```js
+policy.getDeviceIdleAllowList((err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.getDeviceIdleAllowlist
+
+getDeviceIdleAllowList(): Promise\>;
+
+获取休眠模式白名单所包含的uid数组,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\> | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+policy.getDeviceIdleAllowList().then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## policy.getBackgroundPolicyByUid
+
+getBackgroundPolicyByUid(uid: number, callback: AsyncCallback\): void;
+
+获取指定uid能否访问后台网络,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+| callback | AsyncCallback\<[NetBackgroundPolicy](#netbackgroundpolicy)> | 是 | 回调函数,返回获取结果。 |
+
+**示例:**
+
+```js
+this.firstParam = uid
+policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam), (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.getBackgroundPolicyByUid
+
+getBackgroundPolicyByUid(uid: number): Promise\;
+
+获取指定uid能否访问后台网络,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | app唯一标识符 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\<[NetBackgroundPolicy](#netbackgroundpolicy)> | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+this.firstParam = uid
+policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam)).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## policy.resetPolicies
+
+resetPolicies(iccid: string, callback: AsyncCallback\): void;
+
+重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| iccid | string | 是 | SIM卡ID|
+| callback | AsyncCallback\ | 是 | 回调函数,返回重置结果。 |
+
+**示例:**
+
+```js
+this.firstParam = iccid
+policy.resetPolicies(this.firstParam, (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.resetPolicies
+
+resetPolicies(iccid: string): Promise\;
+
+重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| iccid | string | 是 | SIM卡ID|
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then((err, data) {
+
+})
+this.firstParam = iccid
+policy.resetPolicies(this.firstParam).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.updateRemindPolicy
+
+updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType, callback: AsyncCallback\): void;
+
+更新提醒策略,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | 是 | 网络类型 |
+| iccid | string | 是 | SIM卡ID|
+| remindType | [RemindType](#remindtype) | 是 | 提醒类型 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回更新结果。 |
+
+**示例:**
+
+```js
+let param = {
+ netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType
+}
+policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType), (err, data) => {
+ this.callBack(err, data);
+});
+```
+
+## policy.updateRemindPolicy
+
+updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType): Promise\;
+
+更新提醒策略,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | 是 | 网络类型 |
+| iccid | string | 是 | SIM卡ID|
+| remindType | [RemindType](#remindtype) | 是 | 提醒类型 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回设定结果。 |
+
+**示例:**
+
+```js
+let param = {
+ netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType
+}
+policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType)).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+
+```
+
+## policy.on
+
+网络策略的句柄。
+
+### on('netUidPolicyChange')
+
+on(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void;
+
+注册policy发生改变时的回调,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
+| type | netUidPolicyChange | 是 | policy发生改变的类型 |
+| callback | Callback\<{ uid: number, policy: [NetUidPolicy](#netuidpolicy) }> | 是 | 回调函数。 |
+
+**示例:**
+
+```js
+policy.on('netUidPolicyChange', (data) => {
+ this.log('on netUidPolicyChange:' + JSON.stringify(data));
+})
+```
+
+### on('netUidRuleChange')
+
+on(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void;
+
+注册rule发生改变时的回调,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
+| type | netUidRuleChange | 是 | rule发生改变的类型 |
+| callback | Callback\<{ uid: number, rule: [NetUidRule](#netuidrule) }> | 是 | 回调函数。 |
+
+**示例:**
+
+```js
+policy.on('netUidRuleChange', (data) => {
+ this.log('on netUidRuleChange:' + JSON.stringify(data));
+})
+```
+
+### on('netMeteredIfacesChange')
+
+on(type: "netMeteredIfacesChange", callback: Callback\>): void;
+
+注册计量iface发生改变时的回调,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
+| type | netMeteredIfacesChange | 是 | 计量iface发生改变的类型 |
+| callback | Callback\> | 是 | 回调函数。 |
+
+**示例:**
+
+```js
+policy.on('netMeteredIfacesChange', (data) => {
+ this.log('on netMeteredIfacesChange:' + JSON.stringify(data));
+})
+```
+
+### on('netQuotaPolicyChange')
+
+on(type: "netQuotaPolicyChange", callback: Callback\>): void;
+
+注册计量网络策略发生改变时的回调,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
+| type | netQuotaPolicyChange | 是 | 计量网络策略发生改变的类型 |
+| callback | Callback\> | 是 | 回调函数。 |
+
+**示例:**
+
+```js
+policy.on('netQuotaPolicyChange', (data) => {
+ this.log('on netQuotaPolicyChange:' + JSON.stringify(data));
+})
+```
+
+### on('netBackgroundPolicyChange')
+
+on(type: "netBackgroundPolicyChange", callback: Callback\): void;
+
+注册后台网络策略发生改变时的回调,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
+| type | netBackgroundPolicyChange | 是 | 后台网络策略发生改变的类型 |
+| callback | Callback\ | 是 | 回调函数。 |
+
+**示例:**
+
+```js
+policy.on('netBackgroundPolicyChange', (data) => {
+ this.log('on netBackgroundPolicyChange:' + JSON.stringify(data));
+})
+```
+
+## NetBackgroundPolicy
+
+后台网络策略。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ------------------------ | ---- | ---------------------- |
+| NET_BACKGROUND_POLICY_NONE | 0 | 默认值。 |
+| NET_BACKGROUND_POLICY_ENABLE | 1 | 应用在后台可以使用计量网路。 |
+| NET_BACKGROUND_POLICY_DISABLE | 2 | 应用在后台不可以使用计量网路。 |
+| NET_BACKGROUND_POLICY_ALLOW_LIST | 3 | 只有应用指定的列表在后台可以使用计量网络。 |
+
+## NetQuotaPolicy
+
+计量网络策略。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 类型 | 说明 |
+| ----------------------- | ----------------------------------- | ------------------------------------------------------------ |
+| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | 网络类型。 |
+| iccid | string | 计量蜂窝网络的SIM卡的标识值。以太网,wify网络不会用到 |
+| ident | string | 计量蜂窝网络中配合iccid联合使用。以太网,wify网络单独使用。用于标记类型。 |
+| periodDuration | string | 计量开始时间。 |
+| warningBytes | number | 发出警告的流量阈值。 |
+| limitBytes | number | 流量设置的配额。 |
+| lastWarningRemind | string | 最新一次发出警告的时间。 |
+| lastLimitRemind | string | 最新一次配额耗尽的时间。 |
+| metered | string | 是否为计量网络。 |
+| limitAction | [LimitAction](#limitaction) | 到达流量限制后的动作。 |
+
+## LimitAction
+
+限制动作。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ---------------------- | ----- | ------------ |
+| LIMIT_ACTION_NONE | -1 | 默认值。 |
+| LIMIT_ACTION_DISABLE | 0 | 当配额策略达到限制时,访问被禁用。 |
+| LIMIT_ACTION_AUTO_BILL| 1 | 当配额策略达到限制时,用户将自动计费。 |
+
+## NetUidRule
+
+计量网络规则。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ---------------------- | ----- | ------------ |
+| NET_RULE_NONE | 0 | 默认规则 |
+| NET_RULE_ALLOW_METERED_FOREGROUND | 1 | 允许前台访问计量网络 |
+| NET_RULE_ALLOW_METERED | 2 | 允许访问计量网络 |
+| NET_RULE_REJECT_METERED | 4 | 拒绝访问计量网络 |
+| NET_RULE_ALLOW_ALL | 32 | 允许访问所有网络 |
+| NET_RULE_REJECT_ALL | 64 | 拒绝访问所有网络 |
+
+## RemindType
+
+提醒类型。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ---------------------- | - | ------- |
+| REMIND_TYPE_WARNING | 1 | 警告提醒 |
+| REMIND_TYPE_LIMIT | 2 | 限制提醒 |
+
+## NetUidPolicy
+
+应用对应的网络策略。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ---------------------- | ----- | ------------ |
+| NET_POLICY_NONE | 0 | 默认网络策略 |
+| NET_POLICY_ALLOW_METERED_BACKGROUND | 1 | 允许应用在后台访问计量网络 |
+| NET_POLICY_REJECT_METERED_BACKGROUND | 2 | 拒绝应用在后台访问计量网络 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md b/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
new file mode 100644
index 0000000000000000000000000000000000000000..f19a5f42023b2a16c589e19dc16509de079ba336
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
@@ -0,0 +1,746 @@
+# 网络共享管理
+
+网络共享管理分享设备已有网络给其他连接设备,支持Wi-Fi热点共享、蓝牙共享和USB共享,同时提供网络共享状态、共享流量查询功能。
+
+> **说明:**
+>
+> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```js
+import sharing from '@ohos.net.sharing'
+```
+
+## sharing.isSharingSupported
+
+isSharingSupported(callback: AsyncCallback\): void
+
+判断是否支持网络共享,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,返回ture代表支持网络共享。 |
+
+**示例:**
+
+```js
+sharing.isSharingSupported((error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.isSharingSupported
+
+isSharingSupported(): Promise\
+
+判断是否支持网络共享,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回是否支持共享结果。 |
+
+**示例:**
+
+```js
+sharing.isSharingSupported().then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.isSharing
+
+isSharing(callback: AsyncCallback\): void
+
+获取当前网络共享状态,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,返回ture代表网络共享中。 |
+
+**示例:**
+
+```js
+sharing.isSharing((error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.isSharing
+
+isSharing(): Promise\
+
+获取当前网络共享状态,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回网络共享状态结果,返回ture代表网络共享中。 |
+
+**示例:**
+
+```js
+sharing.isSharing().then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.startSharing
+
+startSharing(type: SharingIfaceType, callback: AsyncCallback\): void
+
+开启指定类型共享,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回开启网络共享结果。 |
+
+**示例:**
+
+```js
+import SharingIfaceType from '@ohos.net.sharing'
+sharing.startSharing(SharingIfaceType.SHARING_WIFI, (error) => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.startSharing
+
+startSharing(type: SharingIfaceType): Promise\
+
+开启指定类型共享,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回开启共享执行结果。 |
+
+**示例:**
+
+```js
+import SharingIfaceType from '@ohos.net.sharing'
+sharing.startSharing(SharingIfaceType.SHARING_WIFI).then(() => {
+ console.log("start wifi sharing successful");
+}).catch(error => {
+ console.log("start wifi sharing failed");
+});
+```
+
+## sharing.stopSharing
+
+stopSharing(type: SharingIfaceType, callback: AsyncCallback\): void
+
+关闭指定类型共享,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回停止网络共享结果。 |
+
+**示例:**
+
+```js
+import SharingIfaceType from '@ohos.net.sharing'
+sharing.stopSharing(SharingIfaceType.SHARING_WIFI, (error) => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.stopSharing
+
+stopSharing(type: SharingIfaceType): Promise\
+
+关闭指定类型共享,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回关闭共享执行结果。 |
+
+**示例:**
+
+```js
+import SharingIfaceType from '@ohos.net.sharing'
+sharing.stopSharing(SharingIfaceType.SHARING_WIFI).then(() => {
+ console.log("stop wifi sharing successful");
+}).catch(error => {
+ console.log("stop wifi sharing failed");
+});
+```
+
+## sharing.getStatsRxBytes
+
+getStatsRxBytes(callback: AsyncCallback\): void
+
+获取共享网络接收数据量,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:KB。 |
+
+**示例:**
+
+```js
+sharing.getStatsRxBytes((error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.getStatsRxBytes
+
+getStatsRxBytes(): Promise\
+
+获取共享网络接收数据量,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回共享网络接收数据量,单位:KB。 |
+
+**示例:**
+
+```js
+sharing.getStatsRxBytes().then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.getStatsTxBytes
+
+getStatsTxBytes(callback: AsyncCallback\): void
+
+获取共享网络发送数据量,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:KB。 |
+
+**示例:**
+
+```js
+sharing.getStatsTxBytes((error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.getStatsTxBytes
+
+getStatsTxBytes(): Promise\
+
+获取共享网络发送数据量,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回共享网络发送数据量,单位:KB。 |
+
+**示例:**
+
+```js
+sharing.getStatsTxBytes().then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.getStatsTotalBytes
+
+getStatsTotalBytes(callback: AsyncCallback\): void
+
+获取共享网络总数据量,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:KB。 |
+
+**示例:**
+
+```js
+sharing.getStatsTotalBytes((error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.getStatsTotalBytes
+
+getStatsTotalBytes(): Promise\
+
+获取共享网络总数据量,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回共享网络总数据量,单位:KB。 |
+
+**示例:**
+
+```js
+sharing.getStatsTotalBytes().then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.getSharingIfaces
+
+getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\>): void
+
+获取指定状态的网卡名称列表,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| state | state: [SharingIfaceState](#sharingifacestate) | 是 | 网络共享状态。 |
+| callback | AsyncCallback\> | 是 | 回调函数,返回指定状态的网卡名称列表。 |
+
+**示例:**
+
+```js
+import SharingIfaceState from '@ohos.net.sharing'
+sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.getSharingIfaces
+
+getSharingIfaces(state: SharingIfaceState): Promise\>
+
+获取指定状态的网卡名称列表,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| state | state: [SharingIfaceState](#sharingifacestate) | 是 | 网络共享状态。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\> | 以Promise形式返回指定状态网卡名称列表。 |
+
+**示例:**
+
+```js
+import SharingIfaceState from '@ohos.net.sharing'
+sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER).then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.getSharingState
+
+getSharingState(type: SharingIfaceType, callback: AsyncCallback\): void
+
+获取指定类型网络共享状态,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+| callback | AsyncCallback\<[SharingIfaceState](#sharingifacestate)> | 是 | 回调函数,返回指定类型网络共享状态。 |
+
+**示例:**
+
+```js
+import SharingIfaceState from '@ohos.net.sharing'
+sharing.getSharingState(SharingIfaceType.SHARING_WIFI, (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.getSharingState
+
+getSharingState(type: SharingIfaceType): Promise\
+
+获取指定类型网络共享状态,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\<[SharingIfaceState](#sharingifacestate)> | 以Promise形式返回定类型网络共共享状态。 |
+
+**示例:**
+
+```js
+import SharingIfaceType from '@ohos.net.sharing'
+sharing.getSharingIfaces(SharingIfaceType.SHARING_WIFI).then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## sharing.getSharableRegexes
+
+getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\>): void
+
+获取指定类型网卡名称正则表达式列表,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+| callback | AsyncCallback\> | 是 | 回调函数,返回指定类型网卡名称正则表达式列表。 |
+
+**示例:**
+
+```js
+import SharingIfaceState from '@ohos.net.sharing'
+sharing.getSharingState(SharingIfaceType.SHARING_WIFI, (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## sharing.getSharableRegexes
+
+getSharableRegexes(type: SharingIfaceType): Promise\>
+
+获取指定类型网卡名称正则表达式列表,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\> | 以Promise形式返回正则表达式列表。 |
+
+**示例:**
+
+```js
+import SharingIfaceType from '@ohos.net.sharing'
+sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
+```
+
+## on('sharingStateChange')
+
+on(type: 'sharingStateChange', callback: Callback\): void
+
+注册网络共享状态变化事件,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | string | 是 | 事件名称。 |
+| callback | AsyncCallback\ | 是 | 回调函数,返回网络共享状态。 |
+
+**示例:**
+
+```js
+sharing.on('sharingStateChange', (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## off('sharingStateChange')
+
+off(type: 'sharingStateChange', callback?: Callback\): void
+
+注销网络共享状态变化事件,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | string | 是 | 事件名称。 |
+| callback | AsyncCallback\ | 否 | 回调函数,返回网络共享状态。 |
+
+**示例:**
+
+```js
+sharing.off('sharingStateChange', (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## on('interfaceSharingStateChange')
+
+on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
+
+注册网卡网络共享状态变化事件,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | string | 是 | 事件名称。 |
+| callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | 是 | 回调函数,指定网卡共享状态变化时调用。 |
+
+**示例:**
+
+```js
+sharing.on('interfaceSharingStateChange', (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## off('interfaceSharingStateChange')
+
+off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
+
+注销网卡网络共享状态变化事件,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | string | 否 | 事件名称。 |
+| callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | 否 | 回调函数,注销指定网卡共享状态变化通知。 |
+
+**示例:**
+
+```js
+sharing.off('interfaceSharingStateChange', (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## on('sharingUpstreamChange')
+
+on(type: 'sharingUpstreamChange', callback: Callback\): void
+
+注册上行网络变化事件,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | string | 是 | 事件名称。 |
+| callback | AsyncCallback\ | 是 | 回调函数,上行网络变化时调用。 |
+
+**示例:**
+
+```js
+sharing.on('sharingUpstreamChange', (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## off('sharingUpstreamChange')
+
+off(type: 'sharingUpstreamChange', callback?: Callback\): void
+
+注销上行网络变化事件,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| type | string | 是 | 事件名称。 |
+| callback | AsyncCallback\ | 否 | 回调函数,注销上行网络变化事件。 |
+
+**示例:**
+
+```js
+sharing.off('sharingUpstreamChange', (error, data) => {
+ console.log(JSON.stringify(error));
+ console.log(JSON.stringify(data));
+});
+```
+
+## SharingIfaceState
+
+网络共享状态。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ------------------------ | ---- | ---------------------- |
+| SHARING_NIC_SERVING | 1 | 正在网络共享。 |
+| SHARING_NIC_CAN_SERVER | 2 | 可提供网络共享。 |
+| SHARING_NIC_ERROR | 3 | 网络共享错误。 |
+
+## SharingIfaceType
+
+网络共享类型。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。
+
+| 参数名 | 值 | 说明 |
+| ------------------------ | ---- | ---------------------- |
+| SHARING_WIFI | 0 | 网络共享类型Wi-Fi。 |
+| SHARING_USB | 1 | 网络共享类型USB。 |
+| SHARING_BLUETOOTH | 2 | 网络共享类型蓝牙。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-statistics.md b/zh-cn/application-dev/reference/apis/js-apis-net-statistics.md
new file mode 100644
index 0000000000000000000000000000000000000000..f9589f42ba6f1cc09a78a1052791915c7400e2fa
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-net-statistics.md
@@ -0,0 +1,409 @@
+# 网络流量管理
+
+网络流量管理提供对用户上网过程中产生的流量进行统计,支持用户按网络接口(蜂窝、Wi-Fi)和按应用查询网络流量使用情况的功能
+
+> **说明:**
+>
+> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```js
+import statistics from '@ohos.net.statistics'
+```
+
+## statistics.getIfaceRxBytes
+
+getIfaceRxBytes(nic: string, callback: AsyncCallback\): void
+
+获取指定网卡的接收数据量,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| nic | string | 是 | 网卡名 |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getIfaceRxBytes(this.nic, (err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getIfaceRxBytes
+
+getIfaceRxBytes(nic: string): Promise\;
+
+获取指定网卡的接收数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| nic | string | 是 | 网卡名 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回指定网卡的接收数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getIfaceRxBytes(this.nic).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getIfaceTxBytes
+
+getIfaceTxBytes(nic: string, callback: AsyncCallback\): void
+
+获取指定网卡的发送数据量,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| nic | string | 是 | 网卡名 |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getIfaceTxBytes(this.nic, (err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getIfaceTxBytes
+
+getIfaceTxBytes(nic: string): Promise\;
+
+获取指定网卡的发送数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| nic | string | 是 | 网卡名 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回指定网卡的发送数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getIfaceTxBytes(this.nic).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getCellularRxBytes
+
+getCellularRxBytes(callback: AsyncCallback\): void;
+
+获取蜂窝网的接收数据量,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getCellularRxBytes((err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getCellularRxBytes
+
+getCellularRxBytes(): Promise\;
+
+获取蜂窝网的接收数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回蜂窝网的接收数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getCellularRxBytes().then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getCellularTxBytes
+
+getCellularTxBytes(callback: AsyncCallback\): void;
+
+获取蜂窝网的发送数据量,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getCellularTxBytes((err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getCellularTxBytes
+
+getCellularTxBytes(): Promise\;
+
+获取蜂窝网的发送数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回蜂窝网的发送数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getCellularTxBytes().then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getAllRxBytes
+
+getAllRxBytes(callback: AsyncCallback\): void;
+
+获取所有网卡的接收数据量,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getAllRxBytes(err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getAllRxBytes
+
+getAllRxBytes(): Promise\;
+
+获取所有网卡的接收数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回所有网卡的接收数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getAllRxBytes().then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getAllTxBytes
+
+getAllTxBytes(callback: AsyncCallback\): void;
+
+获取所有网卡的发送数据,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getAllTxBytes((err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getAllTxBytes
+
+getAllTxBytes(): Promise\;
+
+获取所有网卡的发送数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回所有网卡的发送数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getAllTxBytes().then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getUidRxBytes
+
+getUidRxBytes(uid: number, callback: AsyncCallback\): void;
+
+获取指定应用的接收数据量,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | 应用ID |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getUidRxBytes(this.uid, (err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getUidRxBytes
+
+getUidRxBytes(uid: number): Promise\;
+
+获取指定应用的接收数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | 应用ID |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回指定网卡的接收数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getUidRxBytes(this.uid).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getUidTxBytes
+
+getUidTxBytes(uid: number, callback: AsyncCallback\): void;
+
+获取指定应用的发送数据量,使用callback方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | 应用ID |
+| callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getUidTxBytes(this.uid, (err, data) => {
+ this.callBack(err, data);
+ console.log(JSON.stringify(error))
+ console.log(JSON.stringify(data))
+})
+```
+
+## statistics.getUidTxBytes
+
+getUidTxBytes(uid: number): Promise\;
+
+获取指定应用的发送数据量,使用Promise方式作为异步方法。
+
+**系统能力**:SystemCapability.Communication.NetManager.Core
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------- | ---- | ---------- |
+| uid | number | 是 | 应用ID |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | 以Promise形式返回指定网卡的发送数据量,单位:bytes。 |
+
+**示例:**
+
+```js
+statistics.getUidTxBytes(this.uid).then((err, data) {
+ console.log(JSON.stringify(err))
+ console.log(JSON.stringify(data))
+})
+```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-settings.md b/zh-cn/application-dev/reference/apis/js-apis-settings.md
index 49f7d8163bad10bad37ce1e6fdbb085d948da5cb..fd47e723a1704c326bd60c77a85e3144132dfbef 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-settings.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-settings.md
@@ -422,7 +422,7 @@ enableAirplaneMode(enable: boolean): Promise\
```js
let isEnabled = true;
-settingsenableAirplaneMode(isEnabled).then((err) => {
+settings.enableAirplaneMode(isEnabled).then((err) => {
if (err) {
console.log('Failed to enable AirplaneMode.');
return;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-time.md b/zh-cn/application-dev/reference/apis/js-apis-system-time.md
index b5a91f3821e9dbf7913fc57368783f3424eda9d3..2147c418222723f385189fe4256a0259f443e754 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-system-time.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-system-time.md
@@ -357,7 +357,7 @@ setDate(date: Date, callback: AsyncCallback<void>): void
**示例:**
```js
- var data = new Date("October 13, 2020 11:13:00");
+ var data = new Date();
systemTime.setDate(data,(error, data) => {
if (error) {
console.error('failed to systemTime.setDate because ' + JSON.stringify(error));
@@ -393,7 +393,7 @@ setDate(date: Date): Promise<void>
**示例:**
```js
- var data = new Date("October 13, 2020 11:13:00");
+ var data = new Date();
systemTime.setDate(data).then((value) => {
console.log(`systemTime.setDate success data : ` + JSON.stringify(value));
}).catch((error) => {
diff --git a/zh-cn/application-dev/reference/apis/js-apis-tlsSocket.md b/zh-cn/application-dev/reference/apis/js-apis-tlsSocket.md
new file mode 100644
index 0000000000000000000000000000000000000000..3d20d8473bf82661aeb2c21002d87723b9ac1b4c
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-tlsSocket.md
@@ -0,0 +1,486 @@
+# TLSSocket
+
+TLS Socket通信是对Socket通信的拓展。在Socket通信的基础上添加了一层安全性保护,提供了更高的安全性,分为三个子模块,包括密钥,证书,通信。
+
+> **说明:**
+>
+> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```js
+import socket from '@ohos.net.tlssocket'
+```
+
+## socket.constructTLSSocketInstance
+
+constructTLSSocketInstance(): TLSSocket
+
+创建并返回一个TLSSocket对象。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**示例:**
+
+```js
+let tlssocket = socket.constructTLSSocketInstance();
+```
+
+## tlssocket.connect
+
+connect(options: TLSConnectOptions, callback: AsyncCallback\): void
+
+在TLSSocket上进行通信连接,并创建和初始化TLS会话,实现建立连接过程,启动与服务器的TLS/SSL握手,实现数据传输功能,使用callback方式作为异步方法。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------------| ----| --------------- |
+| options | [TLSConnectOptions](#tlsconnectoptions) | 是 | 连接所需要的参数。|
+| callback | AsyncCallback\ | 是 | 回调函数,成功无返回,失败返回对应错误码。 |
+
+**示例:**
+
+```js
+let options = {
+ ALPNProtocols: ["spdy/1", "http/1.1"],
+ address: {
+ address: "xxx",
+ port: "xxxx",
+ family: 1,
+ },
+ secureOptions: {
+ key: "xxxx",
+ cert: "xxxx",
+ ca: ["xxxx"],
+ passwd: "xxxx",
+ protocols: "TlsV1_2",
+ useRemoteCipherPrefer: true,
+ signatureAlgorithms: SHA256,
+ cipherSuites: AES256-SHA256,
+ },
+};
+
+tlssocket.connect(options, (err, data) => {
+ console.info(err);
+ console.info(data);
+});
+```
+
+## tlssocket.connect
+
+connect(options: TLSConnectOptions): Promise\;
+
+在TLSSocket上进行通信连接,并创建和初始化TLS会话,实现建立连接过程,启动与服务器的TLS/SSL握手,实现数据传输功能,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------------------| ----| --------------- |
+| options | [TLSConnectOptions](#tlsconnectoptions) | 是 | 连接所需要的参数。|
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------------------------------- | ----------------------------- |
+| Promise\ | 以Promise形式返回,成功无返回,失败返回对应错误码。 |
+
+**示例:**
+
+```js
+let options = {
+ ALPNProtocols: ["spdy/1", "http/1.1"],
+ address: {
+ address: "xxxx",
+ port: "xxxx",
+ family: 1,
+ },
+ secureOptions: {
+ key: "xxxx",
+ cert: "xxxx",
+ ca: ["xxxx"],
+ passwd: "xxxx",
+ protocols: "TlsV1_2",
+ useRemoteCipherPrefer: true,
+ signatureAlgorithms: SHA256,
+ cipherSuites: AES256-SHA256,
+ },
+};
+
+tlssocket.connect(options).then(data => {
+ console.info(data);
+}).catch(err => {
+ console.error(err);
+});
+```
+
+## tlssocket.getCertificate
+
+getCertificate(callback: AsyncCallback\): void;
+
+在TLSSocket通信连接之后,获取本地的数字证书,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------| ---- | ---------------|
+| callback | AsyncCallback\ | 是 | 回调函数,返回本地的证书。|
+
+**示例:**
+
+```js
+tlssocket.getCertificate((err, data) => {
+ if (err) {
+ console.log("getCertificate callback error = " + err);
+ } else {
+ console.log("getCertificate callback = " + data);
+ }
+});
+```
+
+## tlssocket.getCertificate
+
+getCertificate():Promise\;
+
+在TLSSocket通信连接之后,获取本地的数字证书,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------------- | -------------------- |
+| Promise\ | 以Promise形式返回本地的数字证书。 |
+
+**示例:**
+
+```js
+tlssocket.getCertificate().then(data => {
+ console.info(data);
+}).catch(err => {
+ console.error(err);
+});
+```
+
+## tlssocket.getRemoteCertificate
+
+getRemoteCertificate(callback: AsyncCallback\): void;
+
+在TLSSocket通信连接之后,获取对等方的数字证书,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------| ---- | ---------------|
+| callback | AsyncCallback\ | 是 | 回调函数,返回对等方的证书。 |
+
+**示例:**
+
+```js
+tlssocket.getRemoteCertificate((err, data) => {
+ if (err) {
+ console.log("getRemoteCertificate callback error = " + err);
+ } else {
+ console.log("getRemoteCertificate callback = " + data);
+ }
+});
+```
+
+## tlssocket.getRemoteCertificate
+
+getRemoteCertificate():Promise\;
+
+在TLSSocket通信连接之后,获取对等方的数字证书,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------------- | -------------------- |
+| Promise\ | 以Promise形式返回对等方的数字证书。 |
+
+**示例:**
+
+```js
+tlssocket.getRemoteCertificate().then(data => {
+ console.info(data);
+}).catch(err => {
+ console.error(err);
+});
+```
+
+## tlssocket.getProtocol
+
+getProtocol(callback: AsyncCallback\): void;
+
+在TLSSocket通信连接之后,获取通信的协议,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------| ---- | ---------------|
+| callback | AsyncCallback\ | 是 | 回调函数,返回通信的协议。 |
+
+**示例:**
+
+```js
+tlssocket.getProtocol((err, data) => {
+ if (err) {
+ console.log("getProtocol callback error = " + err);
+ } else {
+ console.log("getProtocol callback = " + data);
+ }
+});
+```
+
+## tlssocket.getProtocol
+
+getProtocol():Promise\;
+
+在TLSSocket通信连接之后,获取通信的协议,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------------- | -------------------- |
+| Promise\ | 以Promise形式返回通信的协议。 |
+
+**示例:**
+
+```js
+tlssocket.getProtocol().then(data => {
+ console.info(data);
+}).catch(err => {
+ console.error(err);
+});
+```
+
+## tlssocket.getCipherSuites
+
+getCipherSuites(callback: AsyncCallback\>): void;
+
+在TLSSocket通信连接之后,获取通信双方支持的加密套件,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------| ---- | ---------------|
+| callback | AsyncCallback\> | 是 | 回调函数,返回通信双方支持的加密套件。 |
+
+**示例:**
+
+```js
+tlssocket.getCipherSuites((err, data) => {
+ if (err) {
+ console.log("getCipherSuites callback error = " + err);
+ } else {
+ console.log("getCipherSuites callback = " + data);
+ }
+});
+```
+
+## tlssocket.getCipherSuites
+
+getCipherSuites(): Promise\>;
+
+在TLSSocket通信连接之后,获取通信双方支持的加密套件,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------------- | --------------------- |
+| Promise\> | 以Promise形式返回通信双方支持的加密套件。 |
+
+**示例:**
+
+```js
+tlssocket.getCipherSuites().then(data => {
+ console.info(data);
+}).catch(err => {
+ console.error(err);
+});
+```
+
+## tlssocket.getSignatureAlgorithms
+
+getSignatureAlgorithms(callback: AsyncCallback\>): void;
+
+在TLSSocket通信连接之后,获取通信双方支持的签名算法,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------------------------------------| ---- | ---------------|
+| callback | AsyncCallback\> | 是 | 回调函数,返回双方支持的签名算法。 |
+
+**示例:**
+
+```js
+tlssocket.getSignatureAlgorithms((err, data) => {
+ if (err) {
+ console.log("getSignatureAlgorithms callback error = " + err);
+ } else {
+ console.log("getSignatureAlgorithms callback = " + data);
+ }
+});
+```
+
+## tlssocket.getSignatureAlgorithms
+
+getSignatureAlgorithms(): Promise\>;
+
+在TLSSocket通信连接之后,获取通信双方支持的签名算法,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------------- | -------------------- |
+| Promise\> | 以Promise形式返回获取到的双方支持的签名算法。 |
+
+**示例:**
+
+```js
+tlssocket.getSignatureAlgorithms().then(data => {
+ console.info(data);
+}).catch(err => {
+ console.error(err);
+});
+```
+
+## tlssocket.close
+
+close(callback: AsyncCallback\): void;
+
+在TLSSocket通信连接之后,断开连接,使用callback方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -----------------------------| ---- | ---------------|
+| callback | AsyncCallback\ | 是 | 回调函数,返回TLSSocket关闭连接的结果。 |
+
+**示例:**
+
+```js
+tlssocket.close((err) => {
+ if (err) {
+ console.log("close callback error = " + err);
+ } else {
+ console.log("close success");
+ }
+});
+```
+
+## tlssocket.close
+
+close(): Promise\;
+
+在TLSSocket通信连接之后,断开连接,使用Promise方式作为异步方法。
+
+**需要权限**:ohos.permission.INTERNET
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------------- | -------------------- |
+| Promise\ | 以Promise形式返回,返回TLSSocket关闭连接的结果。 |
+
+**示例:**
+
+```js
+tlssocket.close().then(() =>
+ console.log("close success");
+}).catch(err => {
+ console.error(err);
+});
+```
+
+## TLSConnectOptions
+
+TLS连接的操作。
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+| 参数名 | 类型 | 说明 |
+| -------------- | ------------------------------------- | -------------- |
+| address | [NetAddress](#netaddress) | 网关地址。 |
+| secureOptions | [TLSSecureOptions](#tlssecureoptions) | TLS安全相关操作。|
+| ALPNProtocols | Array\ | ALPN协议。 |
+
+## NetAddress
+
+网络地址。
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+| 参数名 | 类型 | 说明 |
+| ------- | ------ | ---------------------------- |
+| address | string | 地址。 |
+| family | number | IPv4 = 1,IPv6 = 2,默认IPv4。 |
+| port | number | 端口,取值范围\[0, 65535]。 |
+
+## TLSSecureOptions
+
+TLS安全相关操作。
+
+**系统能力**:SystemCapability.Communication.NetStack
+
+| 参数名 | 类型 | 说明 |
+| --------------------- | ---------------------- | ---------------------- |
+| ca | string \| Array\ | ca证书。 |
+| cert | string | 本地数字证书。 |
+| key | string | 本地数字证书私钥。 |
+| passwd | string | 密码。 |
+| protocols | string | 协议名。 |
+| useRemoteCipherPrefer | boolean | 优先使用对等方的密码套件。 |
+| signatureAlgorithms | string | 设置签名算法。 |
+| cipherSuites | string | 加密套件。 |
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md
index 37f051e57ddd82ed09243a92ad4c38f8eaa12a61..618db8db2c38c6d2b9a1140f817b647c3c0685d9 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-window.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-window.md
@@ -303,8 +303,8 @@ create(id: string, type: WindowType, callback: AsyncCallback<Window>): voi
**示例:**
```js
-var windowClass = null;
-window.create("first", window.WindowType.TYPE_APP,(err,data) => {
+let windowClass = null;
+window.create('first', window.WindowType.TYPE_APP,(err,data) => {
if(err.code){
console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
return;
@@ -340,8 +340,8 @@ create(id: string, type: WindowType): Promise<Window>
**示例:**
```js
-var windowClass = null;
-let promise = window.create("first", window.WindowType.TYPE_APP);
+let windowClass = null;
+let promise = window.create('first', window.WindowType.TYPE_APP);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in creating the subWindow. Data: ' + JSON.stringify(data));
@@ -372,8 +372,8 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback<Wi
**示例:**
```js
-var windowClass = null;
- window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT, (err, data) => {
+let windowClass = null;
+ window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT, (err, data) => {
if (err.code) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
return;
@@ -411,8 +411,8 @@ create(ctx: Context, id: string, type: WindowType): Promise<Window>
**示例:**
```js
-var windowClass = null;
-let promise = window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT);
+let windowClass = null;
+let promise = window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in creating the window. Data:' + JSON.stringify(data));
@@ -439,8 +439,8 @@ find(id: string, callback: AsyncCallback<Window>): void
**示例:**
```js
-var windowClass = null;
- window.find("alertWindow", (err, data) => {
+let windowClass = null;
+ window.find('alertWindow', (err, data) => {
if (err.code) {
console.error('Failed to find the Window. Cause: ' + JSON.stringify(err));
return;
@@ -473,8 +473,8 @@ find(id: string): Promise<Window>
**示例:**
```js
-var windowClass = null;
-let promise = window.find("alertWindow");
+let windowClass = null;
+let promise = window.find('alertWindow');
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in finding the window. Data: ' + JSON.stringify(data));
@@ -502,7 +502,7 @@ getTopWindow(callback: AsyncCallback<Window>): void
**示例:**
```js
-var windowClass = null;
+let windowClass = null;
window.getTopWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
@@ -532,7 +532,7 @@ getTopWindow(): Promise<Window>
**示例:**
```js
-var windowClass = null;
+let windowClass = null;
let promise = window.getTopWindow();
promise.then((data)=> {
windowClass = data;
@@ -560,7 +560,7 @@ getTopWindow(ctx: Context, callback: AsyncCallback<Window>): void
**示例:**
```js
-var windowClass = null;
+let windowClass = null;
window.getTopWindow(this.context, (err, data) => {
if (err.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
@@ -594,7 +594,7 @@ getTopWindow(ctx: Context): Promise<Window>
**示例:**
```js
-var windowClass = null;
+let windowClass = null;
let promise = window.getTopWindow(this.context);
promise.then((data)=> {
windowClass = data;
@@ -626,7 +626,7 @@ minimizeAll(id: number, callback: AsyncCallback<void>): void
import display from '@ohos.display'
import window from '@ohos.window'
-var displayClass = null;
+let displayClass = null;
display.getDefaultDisplay((err, data) => {
if(err.code) {
return;
@@ -669,7 +669,7 @@ minimizeAll(id: number): Promise<void>
import display from '@ohos.display'
import window from '@ohos.window'
-var displayClass = null;
+let displayClass = null;
display.getDefaultDisplay((err, data) => {
if(err.code) {
return;
@@ -1259,7 +1259,7 @@ setWindowType(type: WindowType, callback: AsyncCallback<void>): void
**示例:**
```js
-var type = window.WindowType.TYPE_APP;
+let type = window.WindowType.TYPE_APP;
windowClass.setWindowType(type, (err, data) => {
if (err.code) {
console.error('Failed to set the window type. Cause: ' + JSON.stringify(err));
@@ -1298,7 +1298,7 @@ setWindowType(type: WindowType): Promise<void>
**示例:**
```js
-var type = window.WindowType.TYPE_APP;
+let type = window.WindowType.TYPE_APP;
let promise = windowClass.setWindowType(type);
promise.then((data)=> {
console.info('Succeeded in setting the window type. Data: ' + JSON.stringify(data));
@@ -1376,7 +1376,7 @@ getAvoidArea(type: [AvoidAreaType](#avoidareatype7), callback: AsyncCallback<
**示例:**
```js
-var type = window.AvoidAreaType.TYPE_SYSTEM;
+let type = window.AvoidAreaType.TYPE_SYSTEM;
windowClass.getAvoidArea(type, (err, data) => {
if (err.code) {
console.error('Failed to obtain the area. Cause:' + JSON.stringify(err));
@@ -1409,7 +1409,7 @@ getAvoidArea(type: [AvoidAreaType](#avoidareatype7)): Promise<[AvoidArea](#av
**示例:**
```js
-var type = window.AvoidAreaType.TYPE_SYSTEM;
+let type = window.AvoidAreaType.TYPE_SYSTEM;
let promise = windowClass.getAvoidArea(type);
promise.then((data)=> {
console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data));
@@ -1436,7 +1436,7 @@ setFullScreen(isFullScreen: boolean, callback: AsyncCallback<void>): void
**示例:**
```js
-var isFullScreen = true;
+let isFullScreen = true;
windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) {
console.error('Failed to enable the full-screen mode. Cause: ' + JSON.stringify(err));
@@ -1469,7 +1469,7 @@ setFullScreen(isFullScreen: boolean): Promise<void>
**示例:**
```js
-var isFullScreen = true;
+let isFullScreen = true;
let promise = windowClass.setFullScreen(isFullScreen);
promise.then((data)=> {
console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data));
@@ -1496,7 +1496,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void
**示例:**
```js
-var isLayoutFullScreen= true;
+let isLayoutFullScreen= true;
windowClass.setLayoutFullScreen(isLayoutFullScreen, (err, data) => {
if (err.code) {
console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
@@ -1529,7 +1529,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void>
**示例:**
```js
-var isLayoutFullScreen = true;
+let isLayoutFullScreen = true;
let promise = windowClass.setLayoutFullScreen(isLayoutFullScreen);
promise.then((data)=> {
console.info('Succeeded in setting the window layout to full-screen mode. Data: ' + JSON.stringify(data));
@@ -1550,14 +1550,14 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
-| names | Array | 是 | 设置状态栏和导航栏是否显示。
例如,需全部显示,该参数设置为["status", "navigation"];不设置,则默认不显示。 |
+| names | Array | 是 | 设置状态栏和导航栏是否显示。
例如,需全部显示,该参数设置为['status', 'navigation'];不设置,则默认不显示。 |
| callback | AsyncCallback<void> | 是 | 回调函数。 |
**示例:**
```js
// 此处以不显示导航栏、状态栏为例
-var names = [];
+let names = [];
windowClass.setSystemBarEnable(names, (err, data) => {
if (err.code) {
console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
@@ -1579,7 +1579,7 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----- | ---- | ------------------------------------------------------------ |
-| names | Array | 是 | 设置状态栏和导航栏是否显示。
例如,需全部显示,该参数设置为["status", "navigation"];不设置,则默认不显示。 |
+| names | Array | 是 | 设置状态栏和导航栏是否显示。
例如,需全部显示,该参数设置为['status', 'navigation'];不设置,则默认不显示。 |
**返回值:**
@@ -1591,7 +1591,7 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise<void>
```js
// 此处以不显示导航栏、状态栏为例
-var names = [];
+let names = [];
let promise = windowClass.setSystemBarEnable(names);
promise.then((data)=> {
console.info('Succeeded in setting the system bar to be invisible. Data: ' + JSON.stringify(data));
@@ -1618,7 +1618,7 @@ setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: Async
**示例:**
```js
-var SystemBarProperties={
+let SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
//以下两个属性从API Version7开始支持
@@ -1660,7 +1660,7 @@ setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise<voi
**示例:**
```js
-var SystemBarProperties={
+let SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
//以下两个属性从API Version7开始支持
@@ -1696,7 +1696,7 @@ setPreferredOrientation(orientation: Orientation, callback: AsyncCallback<voi
**示例:**
```js
-var orientation = window.Orientation.AUTO_ROTATION;
+let orientation = window.Orientation.AUTO_ROTATION;
windowClass.setPreferredOrientation(orientation, (err, data) => {
if (err.code) {
console.error('Failed to set window orientation. Cause: ' + JSON.stringify(err));
@@ -1729,7 +1729,7 @@ setPreferredOrientation(orientation: Orientation): Promise<void>
**示例:**
```js
-var orientation = window.Orientation.AUTO_ROTATION;
+let orientation = window.Orientation.AUTO_ROTATION;
let promise = windowClass.setPreferredOrientation(orientation);
promise.then((data)=> {
console.info('Succeeded in setting the window orientation. Data: ' + JSON.stringify(data));
@@ -1756,7 +1756,7 @@ loadContent(path: string, callback: AsyncCallback<void>): void
**示例:**
```js
-windowClass.loadContent("pages/page2/page2", (err, data) => {
+windowClass.loadContent('pages/page2/page2', (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -1788,7 +1788,7 @@ loadContent(path: string): Promise<void>
**示例:**
```js
-let promise = windowClass.loadContent("pages/page2/page2");
+let promise = windowClass.loadContent('pages/page2/page2');
promise.then((data)=> {
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data));
}).catch((err)=>{
@@ -1820,9 +1820,9 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- windowStage.loadContent("pages/page2",this.storage,(err, data) => {
+ windowStage.loadContent('pages/page2',this.storage,(err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -1863,10 +1863,10 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- var windowClass = null;
- let promise = windowStage.loadContent("pages/page2",this.storage);
+ let windowClass = null;
+ let promise = windowStage.loadContent('pages/page2',this.storage);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data));
@@ -2199,7 +2199,7 @@ off(type: 'screenshot', callback?: Callback<void>): void
**示例:**
```js
-var callback = ()=>{
+let callback = ()=>{
console.info('screenshot happened');
}
windowClass.on('screenshot', callback)
@@ -2276,7 +2276,7 @@ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>, c
```js
class MyDeathRecipient {
onRemoteDied() {
- console.log("server died");
+ console.log('server died');
}
}
class TestRemoteObject extends rpc.RemoteObject {
@@ -2293,7 +2293,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return false;
}
}
-let token = new TestRemoteObject("testObject");
+let token = new TestRemoteObject('testObject');
windowClass.bindDialogTarget(token, () => {
console.info('Dialog Window Need Destroy.');
}, (err, data) => {
@@ -2333,7 +2333,7 @@ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>):
```js
class MyDeathRecipient {
onRemoteDied() {
- console.log("server died");
+ console.log('server died');
}
}
class TestRemoteObject extends rpc.RemoteObject {
@@ -2350,7 +2350,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return false;
}
}
-let token = new TestRemoteObject("testObject");
+let token = new TestRemoteObject('testObject');
let promise = windowClass.bindDialogTarget(token, () => {
console.info('Dialog Window Need Destroy.');
});
@@ -2539,7 +2539,7 @@ setBackgroundColor(color: string, callback: AsyncCallback<void>): void
**示例:**
```js
-var color = '#00ff33';
+let color = '#00ff33';
windowClass.setBackgroundColor(color, (err, data) => {
if (err.code) {
console.error('Failed to set the background color. Cause: ' + JSON.stringify(err));
@@ -2561,7 +2561,7 @@ setBackgroundColor(color: string): Promise<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
-| color | string | 是 | 需要设置的背景色,为十六进制颜色,不区分大小写,例如"#00FF00"或"#FF00FF00"。 |
+| color | string | 是 | 需要设置的背景色,为十六进制颜色,不区分大小写,例如`#00FF00`或`#FF00FF00`。 |
**返回值:**
@@ -2572,7 +2572,7 @@ setBackgroundColor(color: string): Promise<void>
**示例:**
```js
-var color = '#00ff33';
+let color = '#00ff33';
let promise = windowClass.setBackgroundColor(color);
promise.then((data)=> {
console.info('Succeeded in setting the background color. Data: ' + JSON.stringify(data));
@@ -2600,7 +2600,7 @@ setWakeUpScreen(wakeUp: boolean): void;
**示例:**
```js
-var wakeUp = true;
+let wakeUp = true;
windowClass.setWakeUpScreen(wakeUp);
```
@@ -2622,7 +2622,7 @@ setBrightness(brightness: number, callback: AsyncCallback<void>): void
**示例:**
```js
-var brightness = 1;
+let brightness = 1;
windowClass.setBrightness(brightness, (err, data) => {
if (err.code) {
console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
@@ -2655,7 +2655,7 @@ setBrightness(brightness: number): Promise<void>
**示例:**
```js
-var brightness = 1;
+let brightness = 1;
let promise = windowClass.setBrightness(brightness);
promise.then((data)=> {
console.info('Succeeded in setting the brightness. Data: ' + JSON.stringify(data));
@@ -2748,7 +2748,7 @@ setFocusable(isFocusable: boolean, callback: AsyncCallback<void>): void
**示例:**
```js
-var isFocusable= true;
+let isFocusable= true;
windowClass.setFocusable(isFocusable, (err, data) => {
if (err.code) {
console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(err));
@@ -2781,7 +2781,7 @@ setFocusable(isFocusable: boolean): Promise<void>
**示例:**
```js
-var isFocusable= true;
+let isFocusable= true;
let promise = windowClass.setFocusable(isFocusable);
promise.then((data)=> {
console.info('Succeeded in setting the window to be focusable. Data: ' + JSON.stringify(data));
@@ -2808,7 +2808,7 @@ setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback<void>): v
**示例:**
```js
-var isKeepScreenOn = true;
+let isKeepScreenOn = true;
windowClass.setKeepScreenOn(isKeepScreenOn, (err, data) => {
if (err.code) {
console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err));
@@ -2841,7 +2841,7 @@ setKeepScreenOn(isKeepScreenOn: boolean): Promise<void>
**示例:**
```js
-var isKeepScreenOn = true;
+let isKeepScreenOn = true;
let promise = windowClass.setKeepScreenOn(isKeepScreenOn);
promise.then((data) => {
console.info('Succeeded in setting the screen to be always on. Data: ' + JSON.stringify(data));
@@ -2934,7 +2934,7 @@ setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): voi
**示例:**
```js
-var isPrivacyMode = true;
+let isPrivacyMode = true;
windowClass.setPrivacyMode(isPrivacyMode, (err, data) => {
if (err.code) {
console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err));
@@ -2968,7 +2968,7 @@ setPrivacyMode(isPrivacyMode: boolean): Promise<void>
**示例:**
```js
-var isPrivacyMode = true;
+let isPrivacyMode = true;
let promise = windowClass.setPrivacyMode(isPrivacyMode);
promise.then((data)=> {
console.info('Succeeded in setting the window to privacy mode. Data: ' + JSON.stringify(data));
@@ -2992,7 +2992,7 @@ setSnapshotSkip(isSkip: boolean): void
| ------------- | ------- | ---- | -------------------- |
| isSkip | boolean | 是 | 截屏录屏是否忽略当前窗口,默认为false。
true表示忽略当前窗口,false表示不忽略当前窗口。 |
```js
-var isSkip = true;
+let isSkip = true;
windowClass.setSnapshotSkip(isSkip);
```
@@ -3014,7 +3014,7 @@ setTouchable(isTouchable: boolean, callback: AsyncCallback<void>): void
**示例:**
```js
-var isTouchable = true;
+let isTouchable = true;
windowClass.setTouchable(isTouchable, (err, data) => {
if (err.code) {
console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(err));
@@ -3048,7 +3048,7 @@ setTouchable(isTouchable: boolean): Promise<void>
**示例:**
```js
-var isTouchable = true;
+let isTouchable = true;
let promise = windowClass.setTouchable(isTouchable);
promise.then((data)=> {
console.info('Succeeded in setting the window to be touchable. Data: ' + JSON.stringify(data));
@@ -3077,7 +3077,7 @@ setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback<void&g
**示例:**
```js
-var isForbidSplitMove = true;
+let isForbidSplitMove = true;
windowClass.setForbidSplitMove(isForbidSplitMove, (err, data) => {
if (err.code) {
console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(err));
@@ -3113,7 +3113,7 @@ setForbidSplitMove(isForbidSplitMove: boolean): Promise<void>
**示例:**
```js
-var isForbidSplitMove = true;
+let isForbidSplitMove = true;
let promise = windowClass.setForbidSplitMove(isForbidSplitMove);
promise.then((data)=> {
console.info('Succeeded in forbidding window moving in split screen mode. Data: ' + JSON.stringify(data));
@@ -3329,7 +3329,7 @@ scale(scaleOptions: ScaleOptions): void
**示例:**
```js
-var obj : window.ScaleOptions = {
+let obj : window.ScaleOptions = {
x : 2.0,
y : 1.0,
pivotX = 0.5;
@@ -3357,7 +3357,7 @@ rotate(rotateOptions: RotateOptions): void
**示例:**
```js
-var obj : window.RotateOptions = {
+let obj : window.RotateOptions = {
x : 1.0,
y : 1.0,
z : 45.0,
@@ -3386,7 +3386,7 @@ translate(translateOptions: TranslateOptions): void
**示例:**
```js
-var obj : window.TranslateOptions = {
+let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -3427,7 +3427,7 @@ controller.animationForHidden = (context : window.TransitionContext) => {
context.completeTransition(true)
}
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -3491,7 +3491,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
windowStage.getMainWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
@@ -3526,7 +3526,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
let promise = windowStage.getMainWindow();
promise.then((data)=> {
windowClass = data;
@@ -3561,8 +3561,8 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
- windowStage.createSubWindow("mySubWindow", (err, data) => {
+ let windowClass = null;
+ windowStage.createSubWindow('mySubWindow', (err, data) => {
if (err.code) {
console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err));
return;
@@ -3603,8 +3603,8 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
- let promise = windowStage.createSubWindow("mySubWindow");
+ let windowClass = null;
+ let promise = windowStage.createSubWindow('mySubWindow');
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
@@ -3637,7 +3637,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
windowStage.getSubWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the subwindow. Cause: ' + JSON.stringify(err));
@@ -3672,7 +3672,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
let promise = windowStage.getSubWindow();
promise.then((data)=> {
windowClass = data;
@@ -3709,9 +3709,9 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- windowStage.loadContent("pages/page2",this.storage,(err, data) => {
+ windowStage.loadContent('pages/page2',this.storage,(err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -3753,10 +3753,10 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- var windowClass = null;
- let promise = windowStage.loadContent("pages/page2",this.storage);
+ let windowClass = null;
+ let promise = windowStage.loadContent('pages/page2',this.storage);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data));
@@ -3791,7 +3791,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- windowStage.loadContent("pages/page2", (err, data) => {
+ windowStage.loadContent('pages/page2', (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -3959,7 +3959,7 @@ controller.animationForShown = (context : window.TransitionContext) => {
iterations: 1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -4010,7 +4010,7 @@ controller.animationForShown = (context : window.TransitionContext) => {
context.completeTransition(true)
}
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -4056,7 +4056,7 @@ controller.animationForHidden = (context : window.TransitionContext) => {
context.completeTransition(true)
}
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
diff --git a/zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md b/zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md
index 3ee3e6c15b08ea72ef017d9a501e3e7e6e615206..4f7dfd2cadeb9d48ed10bb06d56675692192321a 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md
@@ -31,7 +31,7 @@ setController(controller: WindowAnimationController): void
**示例:**
```js
-var controller = {
+let controller = {
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
@@ -88,8 +88,8 @@ minimizeWindowWithAnimation(windowTarget: WindowAnimationTarget, callback: Async
**示例:**
```js
-var target: WindowAnimationTarget = undefined;
-var controller = {
+let target: WindowAnimationTarget = undefined;
+let controller = {
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
@@ -127,7 +127,7 @@ var controller = {
windowAnimationManager.setController(controller)
-var finishedCallback = null;
+let finishedCallback = null;
windowAnimationManager.minimizeWindowWithAnimation(target, (err, data) => {
if (err.code) {
console.error('Failed to minimize the window target. Cause: ' + JSON.stringify(err));
@@ -164,8 +164,8 @@ minimizeWindowWithAnimation(windowTarget: WindowAnimationTarget): Promise<Win
**示例:**
```js
-var target: WindowAnimationTarget = undefined;
-var controller = {
+let target: WindowAnimationTarget = undefined;
+let controller = {
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md b/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md
index 67e39e531f83feed60ddb3688b0db422199f1998..c68b1abee0f764f0b46f4f70d89d47844755e609 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md
@@ -140,9 +140,9 @@
| Center(deprecated) | 竖直方向居中位置
从API version 9开始废弃 |
| Bottom | 竖直方向下边缘 |
| Baseline(deprecated) | 交叉轴方向文本基线位置
从API version 9开始废弃 |
-| Start(deprecated) | 水平方向起始位置
从API version 9开始废弃 |
+| Start | 水平方向起始位置 |
| Middle(deprecated) | 水平方向居中位置
从API version 9开始废弃 |
-| End(deprecated) | 水平方向末尾位置
从API version 9开始废弃 |
+| End | 水平方向末尾位置 |
## Week
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md
index 3683017871d40b86882a5568bc7e4879fa510be9..4dadcc663fc36e9375eec8e830cade16ceb5cc57 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md
@@ -53,7 +53,7 @@ Scroll(scroller?: Scroller)
## Scroller
-可滚动容器组件的控制器,可以将此组件绑定至容器组件,然后通过它控制容器组件的滚动,目前支持绑定到List、Scroll、ScrollBar上。
+可滚动容器组件的控制器,可以将此组件绑定至容器组件,然后通过它控制容器组件的滚动,同一个控制器不可以控制多个容器组件,目前支持绑定到List、Scroll、ScrollBar上。
### 导入对象
diff --git a/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md b/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md
index 3245b542fae857e0d358ac3641d4f85c173c5636..300086d76e88216b98d0e7f67b0a112ec95b7913 100644
--- a/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md
+++ b/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md
@@ -192,4 +192,10 @@ onWorkStop(work: WorkInfo): void | 延迟调度任务结束回调
.catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
});
- })
\ No newline at end of file
+ })
+
+## 相关实例
+
+基于延迟任务调度,有以下相关实例可供参考:
+
+- [`WorkScheduler`:延迟任务调度(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/ResourcesSchedule/WorkScheduler)
\ No newline at end of file
diff --git a/zh-cn/application-dev/ui/js-framework-syntax-css.md b/zh-cn/application-dev/ui/js-framework-syntax-css.md
index 1c62aadebe72cd7e9854cf6be14c659a7de43077..a3961ebc73492776031d337f8a6c0be62925a9bb 100644
--- a/zh-cn/application-dev/ui/js-framework-syntax-css.md
+++ b/zh-cn/application-dev/ui/js-framework-syntax-css.md
@@ -1,6 +1,6 @@
# CSS语法参考
-CSS是描述HML页面结构的样式语言。所有组件均存在系统默认样式,也可在页面CSS样式文件中对组件、页面自定义不同的样式。请参考[通用样式](../reference/arkui-js/js-components-common-styles.md)了解基于JS扩展的类Web开发范式支持的组件样式。
+CSS是描述HML页面结构的样式语言。所有组件均存在系统默认样式,也可在页面CSS样式文件中对组件、页面自定义不同的样式。请参考[通用样式](../reference/arkui-js/js-components-common-styles.md)了解兼容JS的类Web开发范式支持的组件样式。
## 尺寸单位
diff --git a/zh-cn/application-dev/ui/ts-general-ui-concepts.md b/zh-cn/application-dev/ui/ts-general-ui-concepts.md
index d155cd948d690b9d9fee99f50c0e1d15af18bb46..9735a4db91aff4684659e886f1b82a0effb1c4a5 100644
--- a/zh-cn/application-dev/ui/ts-general-ui-concepts.md
+++ b/zh-cn/application-dev/ui/ts-general-ui-concepts.md
@@ -1,6 +1,6 @@
# 基本概念
-基于TS扩展的声明式开发范式提供了一系列基础组件,这些组件以声明方式进行组合和扩展来描述应用程序的UI界面,并且还提供了基本的数据绑定和事件处理机制,帮助开发者实现应用交互逻辑。
+基于eTS的声明式开发范式提供了一系列基础组件,这些组件以声明方式进行组合和扩展来描述应用程序的UI界面,并且还提供了基本的数据绑定和事件处理机制,帮助开发者实现应用交互逻辑。
## HelloWorld基本示例
diff --git a/zh-cn/application-dev/ui/ui-js-custom-components.md b/zh-cn/application-dev/ui/ui-js-custom-components.md
index 1b89f629196dd2d46d03be566c553e04429c2f0d..31f471ea264959ffb1dc8ebcf1432531f0f3041c 100755
--- a/zh-cn/application-dev/ui/ui-js-custom-components.md
+++ b/zh-cn/application-dev/ui/ui-js-custom-components.md
@@ -1,6 +1,6 @@
# 自定义组件
-使用基于JS扩展的类Web开发范式的方舟开发框架支持自定义组件,用户可根据业务需求将已有的组件进行扩展,增加自定义的私有属性和事件,封装成新的组件,方便在工程中多次调用,提高页面布局代码的可读性。具体的封装方法示例如下:
+使用兼容JS的类Web开发范式的方舟开发框架支持自定义组件,用户可根据业务需求将已有的组件进行扩展,增加自定义的私有属性和事件,封装成新的组件,方便在工程中多次调用,提高页面布局代码的可读性。具体的封装方法示例如下:
- 构建自定义组件
diff --git a/zh-cn/application-dev/ui/ui-ts-overview.md b/zh-cn/application-dev/ui/ui-ts-overview.md
index 8729ec39918ba2bc7687c5e3c532444171baf2b8..e14132c51fc147d8f1844070ae9887de52986b6b 100644
--- a/zh-cn/application-dev/ui/ui-ts-overview.md
+++ b/zh-cn/application-dev/ui/ui-ts-overview.md
@@ -1,13 +1,13 @@
# 概述
-基于TS扩展的声明式开发范式的方舟开发框架是一套开发极简、高性能、跨设备应用的UI开发框架,支持开发者高效的构建跨设备应用UI界面。
+基于eTS的声明式开发范式的方舟开发框架是一套开发极简、高性能、跨设备应用的UI开发框架,支持开发者高效的构建跨设备应用UI界面。
## 基础能力
-使用基于TS扩展的声明式开发范式的方舟开发框架,采用更接近自然语义的编程方式,让开发者可以直观地描述UI界面,不必关心框架如何实现UI绘制和渲染,实现极简高效开发。开发框架不仅从组件、动效和状态管理三个维度来提供UI能力,还提供了系统能力接口,实现系统能力的极简调用。
+使用基于eTS的声明式开发范式的方舟开发框架,采用更接近自然语义的编程方式,让开发者可以直观地描述UI界面,不必关心框架如何实现UI绘制和渲染,实现极简高效开发。开发框架不仅从组件、动效和状态管理三个维度来提供UI能力,还提供了系统能力接口,实现系统能力的极简调用。
-请参考[基于TS扩展的声明式开发范式API](../reference/arkui-ts/ts-universal-events-click.md)文档,全面地了解组件,更好地开发应用。
+请参考[基于eTS的声明式开发范式API](../reference/arkui-ts/ts-universal-events-click.md)文档,全面地了解组件,更好地开发应用。
- **开箱即用的组件**
@@ -22,12 +22,12 @@
- **状态与数据管理**
- 状态数据管理作为基于TS扩展的声明式开发范式的特色,通过功能不同的装饰器给开发者提供了清晰的页面更新渲染流程和管道。状态管理包括UI组件状态和应用程序状态,两者协作可以使开发者完整地构建整个应用的数据更新和UI渲染。
+ 状态数据管理作为基于eTS的声明式开发范式的特色,通过功能不同的装饰器给开发者提供了清晰的页面更新渲染流程和管道。状态管理包括UI组件状态和应用程序状态,两者协作可以使开发者完整地构建整个应用的数据更新和UI渲染。
- **系统能力接口**
- 使用基于TS扩展的声明式开发范式的方舟开发框架,还封装了丰富的系统能力接口,开发者可以通过简单的接口调用,实现从UI设计到系统能力调用的极简开发。
+ 使用基于eTS的声明式开发范式的方舟开发框架,还封装了丰富的系统能力接口,开发者可以通过简单的接口调用,实现从UI设计到系统能力调用的极简开发。
## 整体架构
@@ -59,7 +59,7 @@
## 相关实例
-基于TS扩展的声明式开发范式的方舟开发框架,有以下相关实例可供参考:
+基于eTS的声明式开发范式的方舟开发框架,有以下相关实例可供参考:
- [`Canvas`:画布组件(eTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Canvas)
@@ -73,7 +73,7 @@
- [`Gallery`:组件集合(eTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Gallery)
-- [`BringApp`:拉起系统应用(eTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/BringApp)
+- [`BringApp`:拉起系统应用(eTS)(API8)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/BringApp)
- [`Chat`:聊天示例应用(eTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/AppSample/Chat)
@@ -95,7 +95,7 @@
- [`Search`:Search组件(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Search)
-- [`QRCode`:二维码(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/QRCode)
+- [`QRCode`:二维码(eTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/QRCode)
- [极简声明式UI范式(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SimpleGalleryEts)
diff --git "a/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md" "b/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md"
index aa4241d4df7115fdf8f71587d22fcf74c3ab659c..556baff875baa8ee7927e5fc035885d4c4a61dfa 100755
--- "a/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md"
+++ "b/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md"
@@ -33,8 +33,8 @@
步骤写作要求:
- 步骤里涉及的接口在前面开放能力介绍里有说明。
- - 如果操作可选,要明确可选条件
- - 每一个开发步骤,如果涉及接口调用,需要清晰给出使用的接口及其使用说明,或给出示例代码
+ - 如果操作可选,要明确可选条件。
+ - 每一个开发步骤,如果涉及接口调用,需要清晰给出使用的接口及其使用说明,或给出示例代码。
**介绍性文档**以开发指南某一功能为例,文档结构可以参考如下:
@@ -109,38 +109,12 @@ Output
**表 1** 参数表
-
-Tables
- |
-Type
- |
-Note
- |
-
-
-first
- |
-standard
- |
-None
- |
-
-second
- |
-outstanding
- |
-5
- |
-
-third
- |
-inside
- |
-with
- |
-
-
-
+| Tables | Type | Note |
+| ----------- |:-------------:| -----:|
+| first | standard | None |
+| second | outstanding | 5 |
+| third | inside | with |
+
**代码**
diff --git "a/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md"
index 8843134dea16033a935ba8feb0e6a062c7bfb7d5..2603d7dac1e653453732807e44956fdd6097c254 100644
--- "a/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md"
+++ "b/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md"
@@ -3,7 +3,7 @@
## 简介
-网络管理子系统,作为设备联网的必备组件,提供了对不同类型网络连接的统一管理,并提供了网络协议栈能力。应用可以通过调用API来获取数据网络的连接信息,查询和订阅数据网络的连接状态等,并可通过网络协议栈进行数据传输。
+网络管理子系统,作为设备联网的必备组件,提供了对不同类型网络连接的统一管理、流量管理、策略管理、网络共享,并提供了网络协议栈能力。应用可以通过调用API来获取数据网络的连接信息,查询和订阅数据网络的连接状态,网络流量数据,网路策略以及网络共享等,并可通过网络协议栈进行数据传输。
下图所示为网络管理子系统架构图。各个部件主要作用如下:
@@ -67,6 +67,26 @@ foundation/communication/
conn.unregister((err, data) => {});
```
+### 网路共享
+
+1. 从@ohos.net.sharing中导入sharing命名空间。
+2. 设定共享类型
+3. 开始共享
+4. 止共享
+```
+// 引入包名
+import sharing from '@ohos.net.sharing';
+// 设定共享类型
+this.sharingType = 0; // 0: WIFI 1: USB 2: BLUETOOTH
+// 开始共享
+sharing.startSharing(this.sharingType,(err)=>{
+ this.callBack(err);
+})
+// 停止共享
+sharing.stopSharing(this.sharingType,(err)=>{
+ this.callBack(err);
+})
+```
### 发起网络请求
@@ -119,13 +139,10 @@ httpRequest.request(
);
```
-
## 相关仓
**网络管理子系统**
[communication_netmanager_base](https://gitee.com/openharmony/communication_netmanager_base/blob/master/README_zh.md)
-
[communication_netmanager_ext](https://gitee.com/openharmony/communication_netmanager_ext/blob/master/README_zh.md)
-
[communication_netstack](https://gitee.com/openharmony/communication_netstack/blob/master/README_zh.md)
\ No newline at end of file