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

!15282 [翻译完成】I6E2N2 (14612+14511+15430+14259+14816+14124+14770)

Merge pull request !15282 from Annie_wang/PR14464
...@@ -218,8 +218,8 @@ ...@@ -218,8 +218,8 @@
- [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md) - [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md)
- [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md) - [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md)
- [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md) - [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md)
- [@ohos.storageStatistics (Application Storage Statistics)](js-apis-storage-statistics.md) - [@ohos.file.storageStatistics (Application Storage Statistics)](js-apis-file-storage-statistics.md)
- [@ohos.volumeManager (Volume Management)](js-apis-volumemanager.md) - [@ohos.file.volumeManager (Volume Management)](js-apis-file-volumemanager.md)
- Telephony Service - Telephony Service
- [@ohos.contact (Contacts)](js-apis-contact.md) - [@ohos.contact (Contacts)](js-apis-contact.md)
- [@ohos.telephony.call (Call)](js-apis-call.md) - [@ohos.telephony.call (Call)](js-apis-call.md)
......
...@@ -198,18 +198,23 @@ Creates an app account implicitly based on the specified account owner. This API ...@@ -198,18 +198,23 @@ Creates an app account implicitly based on the specified account owner. This API
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result)); console.log("result: " + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
bundleName: 'com.example.accountjsdemo',
action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log("startAbility err: " + JSON.stringify(err));
}); })
} }
try { try {
...@@ -252,18 +257,23 @@ Creates an app account implicitly based on the specified account owner and optio ...@@ -252,18 +257,23 @@ Creates an app account implicitly based on the specified account owner and optio
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result)); console.log("result: " + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
bundleName: 'com.example.accountjsdemo',
action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log("startAbility err: " + JSON.stringify(err));
}); })
} }
let options = { let options = {
...@@ -1346,7 +1356,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t ...@@ -1346,7 +1356,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, authResult) { function onResultCallback(code, authResult) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
...@@ -1354,10 +1364,17 @@ Authenticates an app account. This API uses an asynchronous callback to return t ...@@ -1354,10 +1364,17 @@ Authenticates an app account. This API uses an asynchronous callback to return t
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
console.log("startAbility err: " + JSON.stringify(err)); bundleName: 'com.example.accountjsdemo',
}); action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
})
} }
try { try {
...@@ -1402,7 +1419,7 @@ Authenticates an app account with customized options. This API uses an asynchron ...@@ -1402,7 +1419,7 @@ Authenticates an app account with customized options. This API uses an asynchron
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, authResult) { function onResultCallback(code, authResult) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
...@@ -1410,10 +1427,17 @@ Authenticates an app account with customized options. This API uses an asynchron ...@@ -1410,10 +1427,17 @@ Authenticates an app account with customized options. This API uses an asynchron
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err) => { deviceId: '',
console.log("startAbility err: " + JSON.stringify(err)); bundleName: 'com.example.accountjsdemo',
}); action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
})
} }
let options = { let options = {
...@@ -2706,7 +2730,7 @@ Adds an app account. This API uses an asynchronous callback to return the result ...@@ -2706,7 +2730,7 @@ Adds an app account. This API uses an asynchronous callback to return the result
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | -------------------- | | -------- | ------------------------- | ---- | -------------------- |
| name | string | Yes | Name of the target app account. | | name | string | Yes | Name of the app account to add. |
| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Example** **Example**
...@@ -2724,6 +2748,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>) ...@@ -2724,6 +2748,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>)
Adds an app account name and additional information. This API uses an asynchronous callback to return the result. Adds an app account name and additional information. This API uses an asynchronous callback 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-1). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-1).
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
...@@ -2750,8 +2775,7 @@ addAccount(name: string, extraInfo?: string): Promise<void> ...@@ -2750,8 +2775,7 @@ addAccount(name: string, extraInfo?: string): Promise<void>
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**<br>
>
> 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).
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
...@@ -2803,7 +2827,7 @@ Adds an app account implicitly based on the specified owner. This API uses an as ...@@ -2803,7 +2827,7 @@ Adds an app account implicitly based on the specified owner. This API uses an as
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
...@@ -2811,10 +2835,17 @@ Adds an app account implicitly based on the specified owner. This API uses an as ...@@ -2811,10 +2835,17 @@ Adds an app account implicitly based on the specified owner. This API uses an as
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err)=>{ deviceId: '',
bundleName: 'com.example.accountjsdemo',
action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log("startAbility err: " + JSON.stringify(err));
}); })
} }
appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, {
...@@ -2839,7 +2870,7 @@ Deletes an app account. This API uses an asynchronous callback to return the res ...@@ -2839,7 +2870,7 @@ Deletes an app account. This API uses an asynchronous callback to return the res
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------- | | -------- | ------------------------- | ---- | ---------------- |
| name | string | Yes | Name of the target app account. | | name | string | Yes | Name of the app account to delete. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Example** **Example**
...@@ -2866,7 +2897,7 @@ Deletes an app account. This API uses a promise to return the result. ...@@ -2866,7 +2897,7 @@ Deletes an app account. This API uses a promise to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----------- | | ---- | ------ | ---- | ----------- |
| name | string | Yes | Name of the target app account.| | name | string | Yes | Name of the app account to delete.|
**Return value** **Return value**
...@@ -3751,18 +3782,23 @@ Authenticates an app account with customized options. This API uses an asynchron ...@@ -3751,18 +3782,23 @@ Authenticates an app account with customized options. This API uses an asynchron
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result)); console.log("result: " + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
let abilityStartSetting = {want: request}; let wantInfo = {
featureAbility.startAbility(abilityStartSetting, (err)=>{ deviceId: '',
console.log("startAbility err: " + JSON.stringify(err)); bundleName: 'com.example.accountjsdemo',
}); action: 'ohos.want.action.viewData',
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
})
} }
appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, {
...@@ -4521,10 +4557,13 @@ Enumerates the constants. ...@@ -4521,10 +4557,13 @@ Enumerates the constants.
| KEY_REQUIRED_LABELS<sup>9+</sup> | "requiredLabels" | Required labels. | | KEY_REQUIRED_LABELS<sup>9+</sup> | "requiredLabels" | Required labels. |
| KEY_BOOLEAN_RESULT<sup>9+</sup> | "booleanResult" | Return value of the Boolean type. | | KEY_BOOLEAN_RESULT<sup>9+</sup> | "booleanResult" | Return value of the Boolean type. |
## ResultCode<sup>8+</sup> ## ResultCode<sup>(deprecated)</sup>
Enumerates the result codes. Enumerates the result codes.
> **NOTE**
> This enum is supported since API version 8 and deprecated since API version 9. From API version 9, error codes are used. For details about the error codes, see [App Account Error Codes](../errorcodes/errorcode-app-account.md).
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
| Name | Value | Description | | Name | Value | Description |
...@@ -4760,7 +4799,7 @@ Creates an app account implicitly based on the specified account owner. This API ...@@ -4760,7 +4799,7 @@ Creates an app account implicitly based on the specified account owner. This API
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------------- | --------------------- | ---- | --------------- | | ---------------- | --------------------- | ---- | --------------- |
| options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating the account. | | options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating an account. |
| callback | [AuthCallback](#authcallback9) | Yes | Authenticator callback invoked to return the result.| | callback | [AuthCallback](#authcallback9) | Yes | Authenticator callback invoked to return the result.|
### addAccountImplicitly<sup>(deprecated)</sup> ### addAccountImplicitly<sup>(deprecated)</sup>
......
...@@ -36,14 +36,14 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ...@@ -36,14 +36,14 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
```js ```js
let path = "/dev"; let path = "/dev";
statfs.getFreeSize(path).then((number) => { statvfs.getFreeSize(path).then((number) => {
console.info("getFreeSize promise successfully, Size: " + number); console.info("getFreeSize promise successfully, Size: " + number);
}).catch((err) => { }).catch((err) => {
console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code);
}); });
``` ```
## statfs.getFreeSize ## statvfs.getFreeSize
getFreeSize(path:string, callback:AsyncCallback&lt;number&gt;): void getFreeSize(path:string, callback:AsyncCallback&lt;number&gt;): void
...@@ -62,7 +62,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ...@@ -62,7 +62,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
```js ```js
let path = "/dev"; let path = "/dev";
statfs.getFreeSize(path, (err, number) => { statvfs.getFreeSize(path, (err, number) => {
if (err) { if (err) {
console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code);
} else { } else {
...@@ -71,7 +71,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ...@@ -71,7 +71,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
}); });
``` ```
## statfs.getTotalSize ## statvfs.getTotalSize
getTotalSize(path: string): Promise&lt;number&gt; getTotalSize(path: string): Promise&lt;number&gt;
...@@ -95,14 +95,14 @@ Obtains the total number of bytes of the specified file system in asynchronous m ...@@ -95,14 +95,14 @@ Obtains the total number of bytes of the specified file system in asynchronous m
```js ```js
let path = "/dev"; let path = "/dev";
statfs.getTotalSize(path).then((number) => { statvfs.getTotalSize(path).then((number) => {
console.info("getTotalSize promise successfully, Size: " + number); console.info("getTotalSize promise successfully, Size: " + number);
}).catch((err) => { }).catch((err) => {
console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code);
}); });
``` ```
## statfs.getTotalSize ## statvfs.getTotalSize
getTotalSize(path: string, callback: AsyncCallback&lt;number&gt;): void getTotalSize(path: string, callback: AsyncCallback&lt;number&gt;): void
...@@ -121,7 +121,7 @@ Obtains the total number of bytes of the specified file system in asynchronous m ...@@ -121,7 +121,7 @@ Obtains the total number of bytes of the specified file system in asynchronous m
```js ```js
let path = "/dev"; let path = "/dev";
statfs.getTotalSize(path, (err, number) => { statvfs.getTotalSize(path, (err, number) => {
if (err) { if (err) {
console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code);
} else { } else {
......
# @ohos.volumeManager (Volume Management) # @ohos.file.volumeManager (Volument Management)
The volumeManager module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting volumes, partitioning disks, and formatting volumes. The volumeManager module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting volumes, partitioning disks, and formatting volumes.
> **NOTE** > **NOTE**
> >
> - The initial APIs of this module are supported since API version 9. > - 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 are system APIs and cannot be called by third-party applications. > - The APIs provided by this module are system APIs.
> - The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
## Modules to Import ## Modules to Import
```js ```js
import volumemanager from "@ohos.volumeManager"; import volumemanager from "@ohos.file.volumeManager";
``` ```
## volumemanager.getAllVolumes ## volumemanager.getAllVolumes
...@@ -65,7 +66,7 @@ Asynchronously obtains information about all available volumes. This API uses a ...@@ -65,7 +66,7 @@ Asynchronously obtains information about all available volumes. This API uses a
## volumemanager.mount ## volumemanager.mount
mount(volumeId: string): Promise&lt;boolean&gt; mount(volumeId: string): Promise&lt;void&gt;
Asynchronously mounts a volume. This API uses a promise to return the result. Asynchronously mounts a volume. This API uses a promise to return the result.
...@@ -83,7 +84,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result. ...@@ -83,7 +84,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| ---------------------- | ---------- | | ---------------------- | ---------- |
| Promise&lt;boolean&gt; | Promise used to return the execution result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -96,7 +97,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result. ...@@ -96,7 +97,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result.
## volumemanager.mount ## volumemanager.mount
mount(volumeId: string, callback:AsyncCallback&lt;boolean&gt;):void mount(volumeId: string, callback:AsyncCallback&lt;void&gt;):void
Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result. Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result.
...@@ -109,7 +110,7 @@ Asynchronously obtains the available space of the specified volume. This API use ...@@ -109,7 +110,7 @@ Asynchronously obtains the available space of the specified volume. This API use
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | -------------------- | | -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes | Volume ID. | | volumeId | string | Yes | Volume ID. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the execution result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result.|
**Example** **Example**
...@@ -122,7 +123,7 @@ Asynchronously obtains the available space of the specified volume. This API use ...@@ -122,7 +123,7 @@ Asynchronously obtains the available space of the specified volume. This API use
## volumemanager.unmount ## volumemanager.unmount
unmount(volumeId: string): Promise&lt;boolean&gt; unmount(volumeId: string): Promise&lt;void&gt;
Asynchronously unmounts a volume. This API uses a promise to return the result. Asynchronously unmounts a volume. This API uses a promise to return the result.
...@@ -140,7 +141,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result. ...@@ -140,7 +141,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| ---------------------- | ---------- | | ---------------------- | ---------- |
| Promise&lt;boolean&gt; | Promise used to return the execution result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -153,7 +154,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result. ...@@ -153,7 +154,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result.
## volumemanager.unmount ## volumemanager.unmount
unmount(volumeId: string, callback: AsyncCallback&lt;boolean&gt;): void unmount(volumeId: string, callback: AsyncCallback&lt;void&gt;): void
Asynchronously unmounts a volume. This API uses a callback to return the result. Asynchronously unmounts a volume. This API uses a callback to return the result.
...@@ -166,7 +167,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result. ...@@ -166,7 +167,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | -------------------- | | -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes | Volume ID. | | volumeId | string | Yes | Volume ID. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the execution result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result.|
**Example** **Example**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册