未验证 提交 6526bf72 编写于 作者: O openharmony_ci 提交者: Gitee

!21839 修改policy-md

Merge pull request !21839 from 徐杰/beta2policy
...@@ -89,9 +89,11 @@ setBackgroundAllowed(isAllowed: boolean): Promise\<void> ...@@ -89,9 +89,11 @@ setBackgroundAllowed(isAllowed: boolean): Promise\<void>
**示例:** **示例:**
```js ```js
policy.setBackgroundAllowed(true).then(function (error) { policy.setBackgroundAllowed(true).then(() => {
console.log(JSON.stringify(error)) console.log("setBackgroundAllowed success");
}) }).catch(error => {
console.log(JSON.stringify(error));
});
``` ```
## policy.isBackgroundAllowed<sup>10+</sup> ## policy.isBackgroundAllowed<sup>10+</sup>
...@@ -164,10 +166,11 @@ isBackgroundAllowed(): Promise\<boolean>; ...@@ -164,10 +166,11 @@ isBackgroundAllowed(): Promise\<boolean>;
**示例:** **示例:**
```js ```js
policy.isBackgroundAllowed().then(function (error, data) { policy.isBackgroundAllowed().then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.setPolicyByUid<sup>10+</sup> ## policy.setPolicyByUid<sup>10+</sup>
...@@ -248,9 +251,11 @@ setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\<void>; ...@@ -248,9 +251,11 @@ setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\<void>;
**示例:** **示例:**
```js ```js
policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then(function (error) { policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then(() => {
console.log(JSON.stringify(error)) console.log("setPolicyByUid success");
}) }).catch(error => {
console.log(JSON.stringify(error));
});
``` ```
## policy.getPolicyByUid<sup>10+</sup> ## policy.getPolicyByUid<sup>10+</sup>
...@@ -329,10 +334,11 @@ getPolicyByUid(uid: number): Promise\<NetUidPolicy>; ...@@ -329,10 +334,11 @@ getPolicyByUid(uid: number): Promise\<NetUidPolicy>;
**示例:** **示例:**
```js ```js
policy.getPolicyByUid(11111).then(function (error, data) { policy.getPolicyByUid(11111).then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.getUidsByPolicy<sup>10+</sup> ## policy.getUidsByPolicy<sup>10+</sup>
...@@ -412,10 +418,11 @@ getUidsByPolicy(policy: NetUidPolicy): Promise\<Array\<number>>; ...@@ -412,10 +418,11 @@ getUidsByPolicy(policy: NetUidPolicy): Promise\<Array\<number>>;
**示例:** **示例:**
```js ```js
policy.getUidsByPolicy(11111).then(function (error, data) { policy.getUidsByPolicy(11111).then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.getNetQuotaPolicies<sup>10+</sup> ## policy.getNetQuotaPolicies<sup>10+</sup>
...@@ -487,11 +494,11 @@ getNetQuotaPolicies(): Promise\<Array\<NetQuotaPolicy>>; ...@@ -487,11 +494,11 @@ getNetQuotaPolicies(): Promise\<Array\<NetQuotaPolicy>>;
**示例:** **示例:**
```js ```js
policy.getNetQuotaPolicies().then(function (error, data) { policy.getNetQuotaPolicies().then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.setNetQuotaPolicies<sup>10+</sup> ## policy.setNetQuotaPolicies<sup>10+</sup>
...@@ -608,9 +615,11 @@ let netquotapolicy = { ...@@ -608,9 +615,11 @@ let netquotapolicy = {
netQuotaPolicyList.push(netquotapolicy); netQuotaPolicyList.push(netquotapolicy);
policy.setNetQuotaPolicies(netQuotaPolicyList).then(function (error) { policy.setNetQuotaPolicies(netQuotaPolicyList).then(() => {
console.log(JSON.stringify(error)) console.log("setNetQuotaPolicies success");
}) }).catch(error => {
console.log(JSON.stringify(error));
});
``` ```
## policy.isUidNetAllowed<sup>10+</sup> ## policy.isUidNetAllowed<sup>10+</sup>
...@@ -692,10 +701,11 @@ isUidNetAllowed(uid: number, isMetered: boolean): Promise\<boolean>; ...@@ -692,10 +701,11 @@ isUidNetAllowed(uid: number, isMetered: boolean): Promise\<boolean>;
**示例:** **示例:**
```js ```js
policy.isUidNetAllowed(11111, true).then(function (error, data) { policy.isUidNetAllowed(11111, true).then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.isUidNetAllowed<sup>10+</sup> ## policy.isUidNetAllowed<sup>10+</sup>
...@@ -777,10 +787,11 @@ isUidNetAllowed(uid: number, iface: string): Promise\<boolean>; ...@@ -777,10 +787,11 @@ isUidNetAllowed(uid: number, iface: string): Promise\<boolean>;
**示例:** **示例:**
```js ```js
policy.isUidNetAllowed(11111, 'wlan0').then(function (error, data) { policy.isUidNetAllowed(11111, 'wlan0').then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.setDeviceIdleTrustlist<sup>10+</sup> ## policy.setDeviceIdleTrustlist<sup>10+</sup>
...@@ -861,9 +872,11 @@ setDeviceIdleTrustlist(uids: Array\<number>, isAllowed: boolean): Promise\<void> ...@@ -861,9 +872,11 @@ setDeviceIdleTrustlist(uids: Array\<number>, isAllowed: boolean): Promise\<void>
**示例:** **示例:**
```js ```js
policy.setDeviceIdleTrustlist([11111,22222], true).then(function (error) { policy.setDeviceIdleTrustlist([11111,22222], true).then(() => {
console.log(JSON.stringify(error)) console.log("setDeviceIdleTrustlist success");
}) }).catch(error => {
console.log(JSON.stringify(error));
});
``` ```
## policy.getDeviceIdleTrustlist<sup>10+</sup> ## policy.getDeviceIdleTrustlist<sup>10+</sup>
...@@ -934,10 +947,11 @@ getDeviceIdleTrustlist(): Promise\<Array\<number>>; ...@@ -934,10 +947,11 @@ getDeviceIdleTrustlist(): Promise\<Array\<number>>;
**示例:** **示例:**
```js ```js
policy.getDeviceIdleTrustlist().then(function (error, data) { policy.getDeviceIdleTrustlist().then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.getBackgroundPolicyByUid<sup>10+</sup> ## policy.getBackgroundPolicyByUid<sup>10+</sup>
...@@ -1017,10 +1031,11 @@ getBackgroundPolicyByUid(uid: number): Promise\<NetBackgroundPolicy>; ...@@ -1017,10 +1031,11 @@ getBackgroundPolicyByUid(uid: number): Promise\<NetBackgroundPolicy>;
**示例:** **示例:**
```js ```js
policy.getBackgroundPolicyByUid(11111).then(function (error, data) { policy.getBackgroundPolicyByUid(11111).then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.resetPolicies<sup>10+</sup> ## policy.resetPolicies<sup>10+</sup>
...@@ -1099,9 +1114,11 @@ resetPolicies(simId: string): Promise\<void>; ...@@ -1099,9 +1114,11 @@ resetPolicies(simId: string): Promise\<void>;
**示例:** **示例:**
```js ```js
policy.resetPolicies('1').then(function (error) { policy.resetPolicies('1').then(() => {
console.log(JSON.stringify(error)) console.log("resetPolicies success");
}) }).catch(error => {
console.log(JSON.stringify(error));
});
``` ```
## policy.updateRemindPolicy<sup>10+</sup> ## policy.updateRemindPolicy<sup>10+</sup>
...@@ -1186,9 +1203,11 @@ updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType): ...@@ -1186,9 +1203,11 @@ updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType):
```js ```js
import connection from '@ohos.net.connection'; import connection from '@ohos.net.connection';
policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(function (error) { policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(() => {
console.log(JSON.stringify(error)) console.log("updateRemindPolicy success");
}) }).catch(error => {
console.log(JSON.stringify(error));
});
``` ```
## policy.setPowerSaveTrustlist<sup>10+</sup> ## policy.setPowerSaveTrustlist<sup>10+</sup>
...@@ -1269,9 +1288,11 @@ setPowerSaveTrustlist(uids: Array\<number>, isAllowed: boolean): Promise\<void>; ...@@ -1269,9 +1288,11 @@ setPowerSaveTrustlist(uids: Array\<number>, isAllowed: boolean): Promise\<void>;
**示例:** **示例:**
```js ```js
policy.setPowerSaveTrustlist([11111,22222], true).then(function (error) { policy.setPowerSaveTrustlist([11111,22222], true).then(() => {
console.log(JSON.stringify(error)) console.log("setPowerSaveTrustlist success");
}) }).catch(error => {
console.log(JSON.stringify(error));
});
``` ```
## policy.getPowerSaveTrustlist<sup>10+</sup> ## policy.getPowerSaveTrustlist<sup>10+</sup>
...@@ -1343,10 +1364,11 @@ getPowerSaveTrustlist(): Promise\<Array\<number>>; ...@@ -1343,10 +1364,11 @@ getPowerSaveTrustlist(): Promise\<Array\<number>>;
**示例:** **示例:**
```js ```js
policy.getPowerSaveTrustlist().then(function (error, data) { policy.getPowerSaveTrustlist().then((data) => {
console.log(JSON.stringify(error)) console.log(JSON.stringify(data));
console.log(JSON.stringify(data)) }).catch(error => {
}) console.log(JSON.stringify(error));
});
``` ```
## policy.on ## policy.on
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册