提交 85327156 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 9e325ef8
...@@ -64,7 +64,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -64,7 +64,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example** **Example**
...@@ -111,7 +111,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -111,7 +111,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example** **Example**
...@@ -154,7 +154,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -154,7 +154,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | The specified tokenID does not exist. | | 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. | | 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -206,7 +206,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -206,7 +206,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | TokenId does not exist. | | 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. | | 12100003 | Permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -265,7 +265,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -265,7 +265,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | The specified tokenID does not exist. | | 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. | | 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -317,7 +317,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -317,7 +317,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | TokenId does not exist. | | 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. | | 12100003 | Permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -375,7 +375,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -375,7 +375,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 12100002 | The specified tokenID does not exist. | | 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. | | 12100003 | The specified permission does not exist. |
| 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -452,7 +452,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -452,7 +452,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 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. |
...@@ -462,10 +462,10 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -462,10 +462,10 @@ For details about the error codes, see [Application Access Control Error Codes](
```js ```js
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle.bundleManager'; import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId]; let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"]; let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try { try {
...@@ -513,10 +513,10 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -513,10 +513,10 @@ For details about the error codes, see [Application Access Control Error Codes](
```js ```js
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle.bundleManager'; import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId]; let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"]; let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try { try {
...@@ -533,7 +533,7 @@ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise&lt;Gran ...@@ -533,7 +533,7 @@ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise&lt;Gran
Verifies whether a permission is granted to an application. This API uses a promise to return the result. Verifies whether a permission is granted to an application. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
> You are advised to use [checkAccessToken](#checkaccesstoken9). > You are advised to use [checkAccessToken](#checkaccesstoken9).
**System capability**: SystemCapability.Security.AccessToken **System capability**: SystemCapability.Security.AccessToken
...@@ -543,7 +543,7 @@ Verifies whether a permission is granted to an application. This API uses a prom ...@@ -543,7 +543,7 @@ Verifies whether a permission is granted to an application. This API uses a prom
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------- | ---- | ------------------------------------------ | | -------- | ------------------- | ---- | ------------------------------------------ |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). | | permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value** **Return value**
...@@ -568,7 +568,10 @@ promise.then(data => { ...@@ -568,7 +568,10 @@ promise.then(data => {
requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;, requestCallback: AsyncCallback&lt;PermissionRequestResult&gt;) : void; requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;, requestCallback: AsyncCallback&lt;PermissionRequestResult&gt;) : void;
Requests permissions from the user in a dialog box. This API uses an asynchronous callback to return the result. Requests user authorization in a dialog box opened by a UIAbility. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> The API cannot be called by any non-UIAbility.
**Model restriction**: This API can be used only in the stage model. **Model restriction**: This API can be used only in the stage model.
...@@ -578,7 +581,7 @@ Requests permissions from the user in a dialog box. This API uses an asynchronou ...@@ -578,7 +581,7 @@ Requests permissions from the user in a dialog box. This API uses an asynchronou
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| context | Context | Yes| Ability context of the application that requests the permissions. | | context | Context | Yes| Context of the UIAbility.|
| permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| | permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback invoked to return the result.| | callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback invoked to return the result.|
...@@ -610,7 +613,11 @@ try { ...@@ -610,7 +613,11 @@ try {
requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;) : Promise&lt;PermissionRequestResult&gt;; requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;) : Promise&lt;PermissionRequestResult&gt;;
Requests permissions from the user in a dialog box. This API uses a promise to return the result. Requests user authorization in a dialog box opened by a UIAbility. This API uses a promise to return the result.
> **NOTE**
>
> The API cannot be called by any non-UIAbility.
**Model restriction**: This API can be used only in the stage model. **Model restriction**: This API can be used only in the stage model.
...@@ -620,7 +627,7 @@ Requests permissions from the user in a dialog box. This API uses a promise to ...@@ -620,7 +627,7 @@ Requests permissions from the user in a dialog box. This API uses a promise to
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| context | Context | Yes| Ability context of the application that requests the permissions. | | context | Context | Yes| Context of the UIAbility.|
| permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| | permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value** **Return value**
...@@ -662,7 +669,7 @@ verifyAccessToken(tokenID: number, permissionName: string): Promise&lt;GrantStat ...@@ -662,7 +669,7 @@ verifyAccessToken(tokenID: number, permissionName: string): Promise&lt;GrantStat
Verifies whether a permission is granted to an application. This API uses a promise to return the result. Verifies whether a permission is granted to an application. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
> This API is no longer maintained since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9). > This API is no longer maintained since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9).
**System capability**: SystemCapability.Security.AccessToken **System capability**: SystemCapability.Security.AccessToken
...@@ -672,7 +679,7 @@ Verifies whether a permission is granted to an application. This API uses a prom ...@@ -672,7 +679,7 @@ Verifies whether a permission is granted to an application. This API uses a prom
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------- | ---- | ------------------------------------------ | | -------- | ------------------- | ---- | ------------------------------------------ |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | string | Yes | Permission to check.| | permissionName | string | Yes | Permission to verify.|
**Return value** **Return value**
...@@ -730,4 +737,3 @@ Defines detailed information about the permission grant state change. ...@@ -730,4 +737,3 @@ Defines detailed information about the permission grant state change.
| change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. | | change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. |
| tokenID | number | Yes | No | Token ID of the application. | | tokenID | number | Yes | No | Token ID of the application. |
| permissionName | Permissions | Yes | No | Permission whose grant state changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). | | permissionName | Permissions | Yes | No | Permission whose grant state changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). |
...@@ -903,7 +903,7 @@ Sets custom data for an app account. This API uses an asynchronous callback to r ...@@ -903,7 +903,7 @@ Sets custom data for an app account. This API uses an asynchronous callback to r
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or key or value. | | 12300002 | Invalid name, key, or value. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400003 | The number of custom data reaches the upper limit. | | 12400003 | The number of custom data reaches the upper limit. |
...@@ -950,7 +950,7 @@ Sets custom data for an app account. This API uses a promise to return the resul ...@@ -950,7 +950,7 @@ Sets custom data for an app account. This API uses a promise to return the resul
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or key or value. | | 12300002 | Invalid name, key, or value. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400003 | The number of custom data reaches the upper limit. | | 12400003 | The number of custom data reaches the upper limit. |
...@@ -1347,7 +1347,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t ...@@ -1347,7 +1347,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType. | | 12300002 | Invalid name, owner, or authType. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -1410,7 +1410,7 @@ Authenticates an app account with customized options. This API uses an asynchron ...@@ -1410,7 +1410,7 @@ Authenticates an app account with customized options. This API uses an asynchron
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType. | | 12300002 | Invalid name, owner, authType, or options. |
| 12300003 | Account not exist. | | 12300003 | Account not exist. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -1522,7 +1522,7 @@ Obtains the authorization token of the specified authentication type for an app ...@@ -1522,7 +1522,7 @@ Obtains the authorization token of the specified authentication type for an app
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType. | | 12300002 | Invalid name, owner, or authType. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
...@@ -1562,7 +1562,7 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -1562,7 +1562,7 @@ Sets an authorization token of the specific authentication type for an app accou
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or token. | | 12300002 | Invalid name, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. | | 12400004 | The number of token reaches the upper limit. |
...@@ -1609,7 +1609,7 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -1609,7 +1609,7 @@ Sets an authorization token of the specific authentication type for an app accou
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or token. | | 12300002 | Invalid name, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. | | 12400004 | The number of token reaches the upper limit. |
...@@ -1650,7 +1650,7 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -1650,7 +1650,7 @@ Deletes the authorization token of the specified authentication type for an app
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType or token. | | 12300002 | Invalid name, owner, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
...@@ -1698,7 +1698,7 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -1698,7 +1698,7 @@ Deletes the authorization token of the specified authentication type for an app
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType or token. | | 12300002 | Invalid name, owner, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
...@@ -1739,7 +1739,7 @@ Sets the visibility of an authorization token to an app. This API uses an asynch ...@@ -1739,7 +1739,7 @@ Sets the visibility of an authorization token to an app. This API uses an asynch
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -1789,7 +1789,7 @@ Sets the visibility of an authorization token to an app. This API uses a promise ...@@ -1789,7 +1789,7 @@ Sets the visibility of an authorization token to an app. This API uses a promise
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -1831,7 +1831,7 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -1831,7 +1831,7 @@ Checks the visibility of an authorization token of the specified authentication
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -1879,7 +1879,7 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -1879,7 +1879,7 @@ Checks the visibility of an authorization token of the specified authentication
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -2092,31 +2092,34 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2092,31 +2092,34 @@ Obtains the authenticator callback for the authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; export default class EntryAbility extends UIAbility {
try { onCreate(want, param) {
appAccountManager.getAuthCallback(sessionId, (err, callback) => { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
if (err.code != account_appAccount.ResultCode.SUCCESS) { try {
console.log("getAuthCallback err: " + JSON.stringify(err)); appAccountManager.getAuthCallback(sessionId, (err, callback) => {
return; if (err != null) {
} console.log("getAuthCallback err: " + JSON.stringify(err));
var result = { return;
accountInfo: {
name: "Lisi",
owner: "com.example.accountjsdemo",
},
tokenInfo: {
token: "xxxxxx",
authType: "getSocialData"
} }
}; var result = {
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); accountInfo: {
}); name: "Lisi",
} catch (err) { owner: "com.example.accountjsdemo",
console.log("getAuthCallback exception: " + JSON.stringify(err)); },
tokenInfo: {
token: "xxxxxx",
authType: "getSocialData"
}
};
callback.onResult(0, result);
});
} catch (err) {
console.log("getAuthCallback exception: " + JSON.stringify(err));
}
} }
}); }
``` ```
### getAuthCallback<sup>9+</sup> ### getAuthCallback<sup>9+</sup>
...@@ -2150,9 +2153,10 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2150,9 +2153,10 @@ Obtains the authenticator callback for the authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant().then((want) => { export default class EntryAbility extends UIAbility {
onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
try { try {
appAccountManager.getAuthCallback(sessionId).then((callback) => { appAccountManager.getAuthCallback(sessionId).then((callback) => {
...@@ -2166,16 +2170,15 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2166,16 +2170,15 @@ Obtains the authenticator callback for the authentication session. This API uses
authType: "getSocialData" authType: "getSocialData"
} }
}; };
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(0, result);
}).catch((err) => { }).catch((err) => {
console.log("getAuthCallback err: " + JSON.stringify(err)); console.log("getAuthCallback err: " + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getAuthCallback exception: " + JSON.stringify(err)); console.log("getAuthCallback exception: " + JSON.stringify(err));
} }
}).catch((err) => { }
console.log("getWant err: " + JSON.stringify(err)); }
});
``` ```
### queryAuthenticatorInfo<sup>9+</sup> ### queryAuthenticatorInfo<sup>9+</sup>
...@@ -2281,7 +2284,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous ...@@ -2281,7 +2284,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or labels. | | 12300002 | Invalid name, owner, or labels. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -2331,7 +2334,7 @@ Checks whether an app account has specific labels. This API uses a promise to re ...@@ -2331,7 +2334,7 @@ Checks whether an app account has specific labels. This API uses a promise to re
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or labels. | | 12300002 | Invalid name, owner, or labels. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -2594,7 +2597,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t ...@@ -2594,7 +2597,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or options. | | 12300002 | Invalid name, owner, or options. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -2775,7 +2778,7 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt; ...@@ -2775,7 +2778,7 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
Adds an app account name and additional information. This API uses an asynchronous callback to return the result. This API uses a promise to return the result. Adds an app account name and additional information. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-2). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-2).
...@@ -4289,10 +4292,12 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4289,10 +4292,12 @@ Obtains the authenticator callback for an authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; export default class EntryAbility extends UIAbility {
appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => {
if (err.code != account_appAccount.ResultCode.SUCCESS) { if (err.code != account_appAccount.ResultCode.SUCCESS) {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
return; return;
...@@ -4302,8 +4307,9 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4302,8 +4307,9 @@ Obtains the authenticator callback for an authentication session. This API uses
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData",
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}); });
}); }
}
``` ```
### getAuthenticatorCallback<sup>(deprecated)</sup> ### getAuthenticatorCallback<sup>(deprecated)</sup>
...@@ -4333,22 +4339,22 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4333,22 +4339,22 @@ Obtains the authenticator callback for an authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant().then((want) => { export default class EntryAbility extends UIAbility {
onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi",
[account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", [account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo",
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData",
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}).catch((err) => { }).catch((err) => {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
}); });
}).catch((err) => { }
console.log("getWant err: " + JSON.stringify(err)); }
});
``` ```
### getAuthenticatorInfo<sup>(deprecated)</sup> ### getAuthenticatorInfo<sup>(deprecated)</sup>
...@@ -4562,7 +4568,8 @@ Enumerates the constants. ...@@ -4562,7 +4568,8 @@ Enumerates the constants.
Enumerates the result codes. Enumerates the result codes.
> **NOTE**<br> > **NOTE**
>
> This enum is supported since API version 8 and deprecated since API version 9. Error codes are used from API version 9. For details, see [Account Management Error Codes](../errorcodes/errorcode-account.md). > This enum is supported since API version 8 and deprecated since API version 9. Error codes are used from API version 9. For details, see [Account Management Error Codes](../errorcodes/errorcode-account.md).
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
......
...@@ -1736,7 +1736,7 @@ Moves a file. This API uses a promise to return the result. ...@@ -1736,7 +1736,7 @@ Moves a file. This API uses a promise to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------------------------- | | ------ | ------ | ---- | --------------------------- |
| src | string | Yes | Application sandbox path of the source file.| | src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.| | dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example** **Example**
...@@ -1764,7 +1764,7 @@ Moves a file. This API uses an asynchronous callback to return the result. ...@@ -1764,7 +1764,7 @@ Moves a file. This API uses an asynchronous callback to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------------------------- | | ------ | ------ | ---- | --------------------------- |
| src | string | Yes | Application sandbox path of the source file.| | src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.| | dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is moved. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is moved. |
...@@ -1795,7 +1795,7 @@ Moves a file synchronously. ...@@ -1795,7 +1795,7 @@ Moves a file synchronously.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------------------------- | | ------ | ------ | ---- | --------------------------- |
| src | string | Yes | Application sandbox path of the source file.| | src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.| | dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example** **Example**
...@@ -1938,7 +1938,7 @@ Creates a stream based on the file path. This API uses an asynchronous callback ...@@ -1938,7 +1938,7 @@ Creates a stream based on the file path. This API uses an asynchronous callback
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the file. |
| mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| | mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
| callback | AsyncCallback&lt;[Stream](#stream)&gt; | Yes | Callback invoked when the stream is open asynchronously. | | callback | AsyncCallback&lt;[Stream](#stream)&gt; | Yes | Callback invoked when the stream is created asynchronously. |
**Example** **Example**
......
# @ohos.file.picker (Picker) # @ohos.file.picker (File Picker)
**Picker** encapsulates the system applications such as **PhotoViewPicker**, **DocumentViewPicker** and **AudioViewPicker** to provide capabilities of selecting and saving files of different types. The application can select the picker as required.
> **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.
**Picker** encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving images, videos, documents, and audio clips. The application can select the picker as required.
## Modules to Import ## Modules to Import
```js ```js
import picker from '@ohos.file.picker'; import picker from '@ohos.file.picker';
...@@ -27,7 +27,7 @@ let photoPicker = new picker.PhotoViewPicker(); ...@@ -27,7 +27,7 @@ let photoPicker = new picker.PhotoViewPicker();
select(option?: PhotoSelectOptions) : Promise&lt;PhotoSelectResult&gt; select(option?: PhotoSelectOptions) : Promise&lt;PhotoSelectResult&gt;
Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select. Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -35,7 +35,7 @@ Selects one or more images or videos in a **photoPicker** page. This API uses a ...@@ -35,7 +35,7 @@ Selects one or more images or videos in a **photoPicker** page. This API uses a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting images or videos.| | option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting files. If this parameter is not specified, images and videos are selected by default. A maximum of 50 files can be selected.|
**Return value** **Return value**
...@@ -67,7 +67,7 @@ async function example() { ...@@ -67,7 +67,7 @@ async function example() {
select(option: PhotoSelectOptions, callback: AsyncCallback&lt;PhotoSelectResult&gt;) : void select(option: PhotoSelectOptions, callback: AsyncCallback&lt;PhotoSelectResult&gt;) : void
Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select. Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -145,7 +145,7 @@ Saves one or more images or videos in a **photoPicker** page. This API uses a pr ...@@ -145,7 +145,7 @@ Saves one or more images or videos in a **photoPicker** page. This API uses a pr
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving images or videos.| | option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving files. If this parameter is not specified, a **photoPicker** page will be displayed for the user to enter the names of the files to save.|
**Return value** **Return value**
...@@ -265,7 +265,7 @@ Selects one or more documents in a **documentPicker** page. This API uses a prom ...@@ -265,7 +265,7 @@ Selects one or more documents in a **documentPicker** page. This API uses a prom
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [DocumentSelectOptions](#documentselectoptions) | No | Options for selecting documents.| | option | [DocumentSelectOptions](#documentselectoptions) | No | Options for select documents. If this parameter is not specified, the **documentPicker** page is displayed by default.|
**Return value** **Return value**
...@@ -372,13 +372,13 @@ Saves one or more documents in a **documentPicker** page. This API uses a promis ...@@ -372,13 +372,13 @@ Saves one or more documents in a **documentPicker** page. This API uses a promis
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents.| | option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents. If this parameter is not specified, a **documentPicker** page will be displayed for the user to enter the names of the documents to save.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------------------- | :---- | | ----------------------------- | :---- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the documents saved.| | Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the documents saved.|
**Example** **Example**
...@@ -492,7 +492,7 @@ Selects one or more audio files in an **audioPicker** page (currently, a **docum ...@@ -492,7 +492,7 @@ Selects one or more audio files in an **audioPicker** page (currently, a **docum
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting audio files.| | option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting the audio files. If this parameter is not specified, the **audioPicker** page is displayed by default. |
**Return value** **Return value**
...@@ -590,7 +590,7 @@ async function example() { ...@@ -590,7 +590,7 @@ async function example() {
save(option?: AudioSaveOptions) : Promise&lt;Array&lt;string&gt;&gt; save(option?: AudioSaveOptions) : Promise&lt;Array&lt;string&gt;&gt;
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save. Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -598,7 +598,7 @@ Saves one or more audio files in an **audioPicker** page (currently, a **documen ...@@ -598,7 +598,7 @@ Saves one or more audio files in an **audioPicker** page (currently, a **documen
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files.| | option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files. If this parameter is not specified, an **audioPicker** page will be displayed for the user to enter the names of the files to save.|
**Return value** **Return value**
...@@ -629,7 +629,7 @@ async function example() { ...@@ -629,7 +629,7 @@ async function example() {
save(option: AudioSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void save(option: AudioSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save. Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -714,7 +714,7 @@ Defines the options for selecting images or videos. ...@@ -714,7 +714,7 @@ Defines the options for selecting images or videos.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | -------------------------------- | | ----------------------- | ------------------- | ---- | -------------------------------- |
| MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | No | Media file types to select.| | MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | No | Available media file types. **IMAGE_VIDEO_TYPE** is used by default.|
| maxSelectNumber? | number | No | Maximum number of media files to select. The default value is **50**, and the maximum value is **500**. | | maxSelectNumber? | number | No | Maximum number of media files to select. The default value is **50**, and the maximum value is **500**. |
## PhotoSelectResult ## PhotoSelectResult
...@@ -726,7 +726,7 @@ Defines information about the images or videos selected. ...@@ -726,7 +726,7 @@ Defines information about the images or videos selected.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------------------- | ------------------- | ---- | ---- | ------------------------------ | | ----------------------- | ------------------- | ---- | ---- | ------------------------------ |
| photoUris | Array&lt;string&gt; | Yes | Yes | URIs of the media files selected.| | photoUris | Array&lt;string&gt; | Yes | Yes | URIs of the media files selected.|
| isOriginalPhoto | boolean | Yes | Yes | Whether the selected media file is the original image.| | isOriginalPhoto | boolean | Yes | Yes | Whether the selected media file is the original image.|
## PhotoSaveOptions ## PhotoSaveOptions
...@@ -736,7 +736,7 @@ Defines the options for saving images or videos. ...@@ -736,7 +736,7 @@ Defines the options for saving images or videos.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | ---------------------------- | | ----------------------- | ------------------- | ---- | ---------------------------- |
| newFileNames? | Array&lt;string&gt; | No | Files names of the images or videos to save.| | newFileNames? | Array&lt;string&gt; | No | Names of the files to save. If this parameter is not specified, the user needs to enter the file names.|
## DocumentSelectOptions ## DocumentSelectOptions
...@@ -752,11 +752,11 @@ Defines the options for saving documents. ...@@ -752,11 +752,11 @@ Defines the options for saving documents.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | ---------------------------- | | ----------------------- | ------------------- | ---- | ---------------------------- |
| newFileNames? | Array&lt;string&gt; | No | File names of the documents to save.| | newFileNames? | Array&lt;string&gt; | No | Names of the documents to save. If this parameter is not specified, the user needs to enter the document names. |
## AudioSelectOptions ## AudioSelectOptions
Defines the options for selecting audio clips. Currently, this parameter cannot be configured. Defines the options for selecting audio files. Currently, this parameter cannot be configured.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -768,4 +768,4 @@ Defines the options for saving audio files. ...@@ -768,4 +768,4 @@ Defines the options for saving audio files.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | ---------------------------- | | ----------------------- | ------------------- | ---- | ---------------------------- |
| newFileNames? | Array&lt;string&gt; | No | File names of the audio clips to save.| | newFileNames? | Array&lt;string&gt; | No | Name of the audio files to save. If this parameter is not specified, the user needs to enter the file names.|
...@@ -328,7 +328,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u ...@@ -328,7 +328,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId or constraint. | | 12300002 | invalid localId or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Check whether OS account 100 is forbidden to use Wi-Fi. **Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
...@@ -378,7 +378,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u ...@@ -378,7 +378,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId or constraint. | | 12300002 | invalid localId or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Check whether OS account 100 is forbidden to use Wi-Fi. **Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
...@@ -529,7 +529,7 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca ...@@ -529,7 +529,7 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -577,7 +577,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur ...@@ -577,7 +577,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -2231,7 +2231,7 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn ...@@ -2231,7 +2231,7 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid serialNumber. | | 12300002 | invalid serialNumber. |
| 12300003 | the account indicated by serialNumber dose not exist. | | 12300003 | The account indicated by serialNumber dose not exist. |
**Example**: Obtain the ID of the OS account whose SN is 12345. **Example**: Obtain the ID of the OS account whose SN is 12345.
...@@ -2274,7 +2274,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the ...@@ -2274,7 +2274,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid serialNumber. | | 12300002 | invalid serialNumber. |
| 12300003 | the account indicated by serialNumber dose not exist. | | 12300003 | The account indicated by serialNumber dose not exist. |
**Example**: Obtain the ID of the OS account whose SN is 12345. **Example**: Obtain the ID of the OS account whose SN is 12345.
...@@ -2313,7 +2313,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch ...@@ -2313,7 +2313,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Obtain the SN of the OS account 100. **Example**: Obtain the SN of the OS account 100.
...@@ -2356,7 +2356,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise ...@@ -2356,7 +2356,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Obtain the SN of the OS account 100. **Example**: Obtain the SN of the OS account 100.
...@@ -2390,7 +2390,7 @@ Subscribes to the OS account activation states, including the states of the acco ...@@ -2390,7 +2390,7 @@ Subscribes to the OS account activation states, including the states of the acco
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------- | ---- | ------------------------------------------------------------ |
| type | 'activate' \| 'activating' | Yes | Type of the event to subscribe to. The value **activate** means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.| | type | 'activate' \| 'activating' | Yes | Type of the event to subscribe to. The value **activate** indicates the state of an OS account activated, and **activating** indicates the state of an OS account being activated.|
| name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes. | | name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes. |
| callback | Callback&lt;number&gt; | Yes | Callback invoked to return the ID of the OS account being activated or activated. | | callback | Callback&lt;number&gt; | Yes | Callback invoked to return the ID of the OS account being activated or activated. |
...@@ -2432,7 +2432,7 @@ Unsubscribes from the OS account activation states, including the states of the ...@@ -2432,7 +2432,7 @@ Unsubscribes from the OS account activation states, including the states of the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------- | ---- | ------------------------------------------------------------ |
| type | 'activate' \| 'activating' | Yes | Type of the event to unsubscribe from. The value **activate** means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.| | type | 'activate' \| 'activating' | Yes | Type of the event to unsubscribe from. The value **activate** indicates the state of an OS account activated, and **activating** indicates the state of an OS account being activated.|
| name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.| | name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.|
| callback | Callback&lt;number&gt; | No | Callback to unregister. By default, **0** is returned. | | callback | Callback&lt;number&gt; | No | Callback to unregister. By default, **0** is returned. |
...@@ -2642,7 +2642,7 @@ Obtains the constraint source information of an OS account. This API uses an asy ...@@ -2642,7 +2642,7 @@ Obtains the constraint source information of an OS account. This API uses an asy
| -------- | ------------- | | -------- | ------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid name or constraint. | | 12300002 | invalid name or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -2689,7 +2689,7 @@ Obtains the constraint source information of an OS account. This API uses a prom ...@@ -2689,7 +2689,7 @@ Obtains the constraint source information of an OS account. This API uses a prom
| -------- | ------------- | | -------- | ------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid name or constraint. | | 12300002 | invalid name or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -3600,7 +3600,7 @@ Obtains the type of the account to which the current process belongs. This API u ...@@ -3600,7 +3600,7 @@ Obtains the type of the account to which the current process belongs. This API u
getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
Obtains the ID of the distributed virtual device. This API uses an asynchronous callback to return the result. Obtains the ID of this distributed virtual device. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**
> >
...@@ -3630,7 +3630,7 @@ Obtains the ID of the distributed virtual device. This API uses an asynchronous ...@@ -3630,7 +3630,7 @@ Obtains the ID of the distributed virtual device. This API uses an asynchronous
getDistributedVirtualDeviceId(): Promise&lt;string&gt; getDistributedVirtualDeviceId(): Promise&lt;string&gt;
Obtains the ID of the distributed virtual device. This API uses a promise to return the result. Obtains the ID of this distributed virtual device. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
...@@ -5389,7 +5389,7 @@ Defines the OS account information. ...@@ -5389,7 +5389,7 @@ Defines the OS account information.
| localName | string | Yes | OS account name. | | localName | string | Yes | OS account name. |
| type | [OsAccountType](#osaccounttype) | Yes | OS account type. | | type | [OsAccountType](#osaccounttype) | Yes | OS account type. |
| constraints | Array&lt;string&gt; | No | [Constraints](#constraints) on the OS account.| | constraints | Array&lt;string&gt; | No | [Constraints](#constraints) on the OS account.|
| isVerified<sup>8+</sup> | boolean | Yes | Whether the OS account is verified. | | isVerified<sup>8+</sup> | boolean | Yes | Whether to verify the OS account. |
| photo<sup>8+</sup> | string | No | Profile photo of the OS account. | | photo<sup>8+</sup> | string | No | Profile photo of the OS account. |
| createTime<sup>8+</sup> | number | Yes | Time when the OS account was created. | | createTime<sup>8+</sup> | number | Yes | Time when the OS account was created. |
| lastLoginTime<sup>8+</sup> | number | No | Last login time of the OS account. | | lastLoginTime<sup>8+</sup> | number | No | Last login time of the OS account. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册