未验证 提交 94991f50 编写于 作者: O openharmony_ci 提交者: Gitee

!15946 [翻译完成】#I6LRTA

Merge pull request !15946 from Annie_wang/PR15710
...@@ -4,8 +4,8 @@ The **PermissionRequestResult** module defines the result of a permission reques ...@@ -4,8 +4,8 @@ The **PermissionRequestResult** module defines the result of a permission reques
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model. > - The APIs of this module can be used only in the stage model.
## Attributes ## Attributes
...@@ -14,7 +14,7 @@ The **PermissionRequestResult** module defines the result of a permission reques ...@@ -14,7 +14,7 @@ The **PermissionRequestResult** module defines the result of a permission reques
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| permissions | Array<string> | Yes| No| Permissions requested.| | permissions | Array<string> | Yes| No| Permissions requested.|
| authResults | Array&lt;number&gt; | Yes| No|Result of the permission Request.<br>**-1**: The permission has been set and no dialog box will be displayed. Users can modify the permission in **Settings**.<br>**0**: No operation is required.<br>**1**: Dynamic user authorization is required via a dialog window .<br>**2**: The request is invalid. Possible causes are as follows:<br>- The permission is not declared in the configuration file.<br>- The permission name is invalid.<br>- Special conditions for applying for the permission do not satisfied. See [ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation) and [ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location).| | authResults | Array&lt;number&gt; | Yes| No| Result of the permission request.<br>- **-1**: The permission is not authorized and must be set in **Settings** without displaying a dialog box.<br>- **0**: The permission is authorized.<br>- **2**: The permission is not authorized due to an invalid request. The possible causes are as follows:<br> - The permission is not declared in the configuration file.<br> - The permission name is invalid.<br> - Special conditions for applying for the permission are not satisfied. See [ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation) and [ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location).|
## Usage ## Usage
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
The **privacyManager** module provides APIs for privacy management, such as management of permission usage records. The **privacyManager** module provides APIs for privacy management, such as management of permission usage records.
> **NOTE** > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The APIs provided by this module are system APIs. > - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs provided by this module are system APIs.
## Modules to Import ## Modules to Import
...@@ -45,7 +46,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -45,7 +46,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 | | 12100001 | The parameter is invalid. The tokenID is 0. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | | 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. | | 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100007 | Service is abnormal. | | 12100007 | Service is abnormal. |
...@@ -95,7 +96,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -95,7 +96,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 | | 12100001 | The parameter is invalid. The tokenID is 0. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | | 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. | | 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100007 | Service is abnormal. | | 12100007 | Service is abnormal. |
...@@ -266,7 +267,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -266,7 +267,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 | | 12100001 | The parameter is invalid. The tokenID is 0. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | | 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. | | 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. | | 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
...@@ -314,7 +315,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -314,7 +315,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 | | 12100001 | The parameter is invalid. The tokenID is 0. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | | 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. | | 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. | | 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
...@@ -369,7 +370,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -369,7 +370,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 | | 12100001 | The parameter is invalid. The tokenID is 0. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | | 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. | | 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is not used with | | 12100004 | The interface is not used with |
...@@ -417,7 +418,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -417,7 +418,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 | | 12100001 | The parameter is invalid. The tokenID is 0. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | | 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. | | 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is not used with | | 12100004 | The interface is not used with |
...@@ -445,7 +446,7 @@ try { ...@@ -445,7 +446,7 @@ try {
## privacyManager.on ## privacyManager.on
on(type: 'activeStateChange', permissionNameList: Array&lt;Permissions&gt;, callback: Callback&lt;ActiveChangeResponse&gt;): void on(type: 'activeStateChange', permissionList: Array&lt;Permissions&gt;, callback: Callback&lt;ActiveChangeResponse&gt;): void
Subscribes to the permission usage status changes of the specified permissions. Subscribes to the permission usage status changes of the specified permissions.
...@@ -458,7 +459,7 @@ Subscribes to the permission usage status changes of the specified permissions. ...@@ -458,7 +459,7 @@ Subscribes to the permission usage status changes of the specified permissions.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. | | type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. |
| permissionNameList | Array&lt;Permissions&gt; | Yes | List of permissions to be observed. If this parameter is left empty, the usage changes of all permissions are observed. | | permissionList | Array&lt;Permissions&gt; | Yes | List of permissions to be observed. If this parameter is left empty, the usage changes of all permissions are observed. |
| callback | Callback&lt;[ActiveChangeResponse](#activechangeresponse)&gt; | Yes| Callback invoked to return a change in the permission usage.| | callback | Callback&lt;[ActiveChangeResponse](#activechangeresponse)&gt; | Yes| Callback invoked to return a change in the permission usage.|
**Error codes** **Error codes**
...@@ -467,7 +468,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -467,7 +468,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 | | 12100001 | The parameter is invalid. The tokenID is 0. |
| 12100004 | The interface is called repeatedly with the same input. | | 12100004 | The interface is called repeatedly with the same input. |
| 12100005 | The registration time has exceeded the limitation. | | 12100005 | The registration time has exceeded the limitation. |
| 12100007 | Service is abnormal. | | 12100007 | Service is abnormal. |
...@@ -478,9 +479,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -478,9 +479,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
```js ```js
import privacyManager from '@ohos.privacyManager'; import privacyManager from '@ohos.privacyManager';
let permissionNameList = []; let permissionList = [];
try { try {
privacyManager.on('activeStateChange', permissionNameList, (data) => { privacyManager.on('activeStateChange', permissionList, (data) => {
console.debug("receive permission state change, data:" + JSON.stringify(data)); console.debug("receive permission state change, data:" + JSON.stringify(data));
}); });
} catch(err) { } catch(err) {
...@@ -490,7 +491,7 @@ try { ...@@ -490,7 +491,7 @@ try {
## privacyManager.off ## privacyManager.off
off(type: 'activeStateChange', permissionNameList: Array&lt;Permissions&gt;, callback?: Callback&lt;ActiveChangeResponse&gt;): void; off(type: 'activeStateChange', permissionList: Array&lt;Permissions&gt;, callback?: Callback&lt;ActiveChangeResponse&gt;): void;
Unsubscribes from the permission usage status changes of the specified permissions. Unsubscribes from the permission usage status changes of the specified permissions.
...@@ -503,7 +504,7 @@ Unsubscribes from the permission usage status changes of the specified permissio ...@@ -503,7 +504,7 @@ Unsubscribes from the permission usage status changes of the specified permissio
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. | | type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. |
| permissionNameList | Array&lt;Permissions&gt; | Yes | List of permissions to be observed. If this parameter is left blank, the usage changes of all permissions are unsubscribed from. The value must be the same as that specified in **on()**.| | permissionList | Array&lt;Permissions&gt; | Yes | List of permissions to be observed. If this parameter is left blank, the usage changes of all permissions are unsubscribed from. The value must be the same as that specified in **on()**.|
| callback | Callback&lt;[ActiveChangeResponse](#activechangeresponse)&gt; | No| Callback for the permission usage change event.| | callback | Callback&lt;[ActiveChangeResponse](#activechangeresponse)&gt; | No| Callback for the permission usage change event.|
**Error codes** **Error codes**
...@@ -512,8 +513,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -512,8 +513,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The permissionName in list is all invalid or the list size is larger than 1024. | | 12100001 | The parameter is invalid. The permission names in the list are all invalid, or the list size is larger than 1024. |
| 12100004 | The interface is not used with | | 12100004 | The API is not used together with "on()". |
| 12100007 | Service is abnormal. | | 12100007 | Service is abnormal. |
| 12100008 | Out of memory. | | 12100008 | Out of memory. |
...@@ -522,9 +523,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ...@@ -522,9 +523,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
```js ```js
import privacyManager from '@ohos.privacyManager'; import privacyManager from '@ohos.privacyManager';
let permissionNameList = []; let permissionList = [];
try { try {
privacyManager.off('activeStateChange', permissionNameList); privacyManager.off('activeStateChange', permissionList);
}catch(err) { }catch(err) {
console.log(`catch err->${JSON.stringify(err)}`); console.log(`catch err->${JSON.stringify(err)}`);
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
- [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) - [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md)
- [workScheduler Error Codes](errorcode-workScheduler.md) - [workScheduler Error Codes](errorcode-workScheduler.md)
- Security - Security
- [Ability Access Control Error Codes](errorcode-access-token.md) - [Application Access Control Error Codes](errorcode-access-token.md)
- [HUKS Error Codes](errorcode-huks.md) - [HUKS Error Codes](errorcode-huks.md)
- [Crypto Framework Error Codes](errorcode-crypto-framework.md) - [Crypto Framework Error Codes](errorcode-crypto-framework.md)
- [Certificate Error Codes](errorcode-cert.md) - [Certificate Error Codes](errorcode-cert.md)
......
# Ability Access Control Error Codes # Application Access Control Error Codes
## 12100001 Invalid Parameters ## 12100001 Invalid Parameters
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册