提交 85ca2bbc 编写于 作者: L LiAn 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

Signed-off-by: NLiAn <lian15@huawei.com>
...@@ -22,9 +22,11 @@ This repository stores device and application development documents provided by ...@@ -22,9 +22,11 @@ This repository stores device and application development documents provided by
- OpenHarmony 3.1 Release. [Learn more](en/release-notes/OpenHarmony-v3.1-release.md) - OpenHarmony 3.1 Release. [Learn more](en/release-notes/OpenHarmony-v3.1-release.md)
This version is upgraded to OpenHarmony 3.1.1 LTS. [Learn more](en/release-notes/OpenHarmony-v3.1.1-release.md)
- OpenHarmony 3.0 LTS. [Learn more](en/release-notes/OpenHarmony-v3.0-LTS.md) - OpenHarmony 3.0 LTS. [Learn more](en/release-notes/OpenHarmony-v3.0-LTS.md)
This version is upgraded to OpenHarmony 3.0.3 LTS. [Learn more](en/release-notes/OpenHarmony-v3.0.3-LTS.md) This version is upgraded to OpenHarmony 3.0.5 LTS. [Learn more](en/release-notes/OpenHarmony-v3.0.5-LTS.md)
- OpenHarmony 2.2 Beta2. [Learn more](en/release-notes/OpenHarmony-v2.2-beta2.md) - OpenHarmony 2.2 Beta2. [Learn more](en/release-notes/OpenHarmony-v2.2-beta2.md)
...@@ -41,10 +43,14 @@ OpenHarmony_v1.x_release: OpenHarmony v1.1.4 LTS. [Learn more](en/release-notes/ ...@@ -41,10 +43,14 @@ OpenHarmony_v1.x_release: OpenHarmony v1.1.4 LTS. [Learn more](en/release-notes/
Third-party license: [Third-Party Open-Source Software and License Notice](en/contribute/third-party-open-source-software-and-license-notice.md) Third-party license: [Third-Party Open-Source Software and License Notice](en/contribute/third-party-open-source-software-and-license-notice.md)
## How to Contribute ## Contribution
A great open-source project wouldn't be possible without the hard work of many contributors. We'd like to invite anyone from around the world to [participate](en/contribute/how-to-contribute.md) in this exciting journey, and we're grateful for your time, passion, and efforts! A great open-source project wouldn't be possible without the hard work of many contributors. We'd like to invite anyone from around the world to [participate](en/contribute/how-to-contribute.md) in this exciting journey, and we're grateful for your time, passion, and efforts!
You can evaluate available documents, make simple modifications, provide feedback on document quality, and contribute your original content. For details, see [Documentation Contribution](en/contribute/documentation-contribution.md). You can evaluate available documents, make simple modifications, provide feedback on document quality, and contribute your original content. For details, see [Documentation Contribution](en/contribute/documentation-contribution.md).
Excellent contributors will be awarded and the contributions will be publicized in the developer community. Excellent contributors will be awarded and the contributions will be publicized in the developer community.
- Mail list: docs@openharmony.io
- Zulip group: documentation_sig
\ No newline at end of file
...@@ -30,7 +30,7 @@ A Service ability is used to run tasks in the background, such as playing music ...@@ -30,7 +30,7 @@ A Service ability is used to run tasks in the background, such as playing music
}, },
onConnect(want) { onConnect(want) {
console.log('ServiceAbility OnConnect'); console.log('ServiceAbility OnConnect');
return null; return new FirstServiceAbilityStub('test');
}, },
onDisconnect(want) { onDisconnect(want) {
console.log('ServiceAbility OnDisConnect'); console.log('ServiceAbility OnDisConnect');
...@@ -113,8 +113,6 @@ let promise = featureAbility.startAbility( ...@@ -113,8 +113,6 @@ let promise = featureAbility.startAbility(
Once created, the Service ability keeps running in the background. The system does not stop or destroy it unless memory resources must be reclaimed. Once created, the Service ability keeps running in the background. The system does not stop or destroy it unless memory resources must be reclaimed.
### Connecting to a Local Service Ability ### Connecting to a Local Service Ability
If you need to connect a Service ability to a Page ability or to a Service ability in another application, you must first implement the **IAbilityConnection** API for the connection. A Service ability allows other abilities to connect to it through **connectAbility()**. If you need to connect a Service ability to a Page ability or to a Service ability in another application, you must first implement the **IAbilityConnection** API for the connection. A Service ability allows other abilities to connect to it through **connectAbility()**.
...@@ -124,7 +122,7 @@ You can use either of the following methods to connect to a Service ability: ...@@ -124,7 +122,7 @@ You can use either of the following methods to connect to a Service ability:
1. Using the IDL to automatically generate code 1. Using the IDL to automatically generate code
Use OpenHarmony Interface Definition Language (IDL) to automatically generate the corresponding client, server, and **IRemoteObject** code. For details, see [“Development Using TS” in OpenHarmony IDL Specifications and User Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/IDL/idl-guidelines.md#development-using-ts). Use OpenHarmony Interface Definition Language (IDL) to automatically generate the corresponding client, server, and **IRemoteObject** code. For details, see “Development Using TS" in [OpenHarmony IDL Specifications and User Guide](../IDL/idl-guidelines.md).
2. Writing code in the corresponding file 2. Writing code in the corresponding file
...@@ -134,42 +132,37 @@ You can use either of the following methods to connect to a Service ability: ...@@ -134,42 +132,37 @@ You can use either of the following methods to connect to a Service ability:
```javascript ```javascript
import prompt from '@system.prompt' import prompt from '@system.prompt'
let mRemote; var option = {
function onConnectCallback(element, remote){ onConnect: function onConnectCallback(element, proxy) {
console.log('onConnectLocalService onConnectDone element: ' + element); console.log(`onConnectLocalService onConnectDone`)
console.log('onConnectLocalService onConnectDone remote: ' + remote); if (proxy === null) {
mRemote = remote; prompt.showToast({
if (mRemote == null) { message: "Connect service failed"
prompt.showToast({ })
message: "onConnectLocalService not connected yet" return
}); }
return; let data = rpc.MessageParcel.create()
} let reply = rpc.MessageParcel.create()
let option = new rpc.MessageOption(); let option = new rpc.MessageOption()
let data = new rpc.MessageParcel(); data.writeInterfaceToken("connect.test.token")
let reply = new rpc.MessageParcel(); proxy.sendRequest(0, data, reply, option)
data.writeInt(1);
data.writeInt(99);
mRemote.sendRequest(1, data, reply, option).then((result) => {
console.log('sendRequest success');
let msg = reply.readInt();
prompt.showToast({ prompt.showToast({
message: "onConnectLocalService connect result: " + msg, message: "Connect service success"
duration: 3000 })
}); },
}).catch((e) => { onDisconnect: function onDisconnectCallback(element) {
console.log('sendRequest error:' + e); console.log(`onConnectLocalService onDisconnectDone element:${element}`)
}); prompt.showToast({
message: "Disconnect service success"
} })
},
function onDisconnectCallback(element){ onFailed: function onFailedCallback(code) {
console.log('ConnectAbility onDisconnect Callback') console.log(`onConnectLocalService onFailed errCode:${code}`)
} prompt.showToast({
message: "Connect local service onFailed"
function onFailedCallback(code){ })
console.log('ConnectAbility onFailed Callback') }
} }
``` ```
...@@ -196,45 +189,28 @@ You can use either of the following methods to connect to a Service ability: ...@@ -196,45 +189,28 @@ You can use either of the following methods to connect to a Service ability:
```javascript ```javascript
import rpc from "@ohos.rpc"; import rpc from "@ohos.rpc";
let mMyStub; class FirstServiceAbilityStub extends rpc.RemoteObject {
export default { constructor(des: any) {
onStart() { if (typeof des === 'string') {
class MyStub extends rpc.RemoteObject{ super(des)
constructor(des) { } else {
if (typeof des === 'string') { return
super(des); }
} }
return null;
} onRemoteRequest(code: number, data: any, reply: any, option: any) {
onRemoteRequest(code, data, reply, option) { console.log(printLog + ` onRemoteRequest called`)
console.log("ServiceAbility onRemoteRequest called"); if (code === 1) {
if (code === 1) { let string = data.readString()
let op1 = data.readInt(); console.log(printLog + ` string=${string}`)
let op2 = data.readInt(); let result = Array.from(string).sort().join('')
console.log("op1 = " + op1 + ", op2 = " + op2); console.log(printLog + ` result=${result}`)
reply.writeInt(op1 + op2); reply.writeString(result)
} else { } else {
console.log("ServiceAbility unknown request code"); console.log(printLog + ` unknown request code`)
} }
return true; return true;
}
}
mMyStub = new MyStub("ServiceAbility-test");
},
onCommand(want, startId) {
console.log('ServiceAbility onCommand');
},
onConnect(want) {
console.log('ServiceAbility OnConnect');
return mMyStub;
},
onDisconnect(want) {
console.log('ServiceAbility OnDisConnect');
},
onStop() {
console.log('ServiceAbility onStop');
},
} }
``` ```
...@@ -253,40 +229,36 @@ The following code snippet shows how to implement the callbacks: ...@@ -253,40 +229,36 @@ The following code snippet shows how to implement the callbacks:
```ts ```ts
import prompt from '@system.prompt' import prompt from '@system.prompt'
let mRemote; var option = {
function onConnectCallback(element, remote){ onConnect: function onConnectCallback(element, proxy) {
console.log('onConnectRemoteService onConnectDone element: ' + element); console.log(`onConnectRemoteService onConnectDone`)
console.log('onConnectRemoteService onConnectDone remote: ' + remote); if (proxy === null) {
mRemote = remote; prompt.showToast({
if (mRemote == null) { message: "Connect service failed"
prompt.showToast({ })
message: "onConnectRemoteService not connected yet" return
}); }
return; let data = rpc.MessageParcel.create()
} let reply = rpc.MessageParcel.create()
let option = new rpc.MessageOption(); let option = new rpc.MessageOption()
let data = new rpc.MessageParcel(); data.writeInterfaceToken("connect.test.token")
let reply = new rpc.MessageParcel(); proxy.sendRequest(0, data, reply, option)
data.writeInt(1);
data.writeInt(99);
mRemote.sendRequest(1, data, reply, option).then((result) => {
console.log('sendRequest success');
let msg = reply.readInt();
prompt.showToast({ prompt.showToast({
message: "onConnectRemoteService connect result: " + msg, message: "Connect service success"
duration: 3000 })
}); },
}).catch((e) => { onDisconnect: function onDisconnectCallback(element) {
console.log('sendRequest error:' + e); console.log(`onConnectRemoteService onDisconnectDone element:${element}`)
}); prompt.showToast({
} message: "Disconnect service success"
})
function onDisconnectCallback(element){ },
console.log('ConnectRemoteAbility onDisconnect Callback') onFailed: function onFailedCallback(code) {
} console.log(`onConnectRemoteService onFailed errCode:${code}`)
prompt.showToast({
function onFailedCallback(code){ message: "Connect local service onFailed"
console.log('ConnectRemoteAbility onFailed Callback') })
}
} }
``` ```
...@@ -372,23 +344,25 @@ The following code snippet shows how the Service ability instance returns itself ...@@ -372,23 +344,25 @@ The following code snippet shows how the Service ability instance returns itself
```ts ```ts
import rpc from "@ohos.rpc"; import rpc from "@ohos.rpc";
class FirstServiceAbilityStub extends rpc.RemoteObject{ class FirstServiceAbilityStub extends rpc.RemoteObject {
constructor(des) { constructor(des: any) {
if (typeof des === 'string') { if (typeof des === 'string') {
super(des); super(des)
} else { } else {
return null; return
} }
} }
onRemoteRequest(code, data, reply, option) {
console.log("ServiceAbility onRemoteRequest called"); onRemoteRequest(code: number, data: any, reply: any, option: any) {
console.log(printLog + ` onRemoteRequest called`)
if (code === 1) { if (code === 1) {
let op1 = data.readInt(); let string = data.readString()
let op2 = data.readInt(); console.log(printLog + ` string=${string}`)
console.log("op1 = " + op1 + ", op2 = " + op2); let result = Array.from(string).sort().join('')
reply.writeInt(op1 + op2); console.log(printLog + ` result=${result}`)
reply.writeString(result)
} else { } else {
console.log("ServiceAbility unknown request code"); console.log(printLog + ` unknown request code`)
} }
return true; return true;
} }
......
...@@ -14,6 +14,7 @@ You can `import` the native .so that contains the JS processing logic. For examp ...@@ -14,6 +14,7 @@ You can `import` the native .so that contains the JS processing logic. For examp
* Add **static** to the **nm_register_func** function to prevent symbol conflicts with other .so files. * Add **static** to the **nm_register_func** function to prevent symbol conflicts with other .so files.
* The name of the module registration entry, that is, the function decorated by **\_\_attribute\_\_((constructor))**, must be unique. * The name of the module registration entry, that is, the function decorated by **\_\_attribute\_\_((constructor))**, must be unique.
### .so Naming Rules ### .so Naming Rules
Each module has a .so file. For example, if the module name is `hello`, name the .so file **libhello.so**. The `nm_modname` field in `napi_module` must be `hello`, which is the same as the module name. The sample code for importing the .so file is `import hello from 'libhello.so'`. Each module has a .so file. For example, if the module name is `hello`, name the .so file **libhello.so**. The `nm_modname` field in `napi_module` must be `hello`, which is the same as the module name. The sample code for importing the .so file is `import hello from 'libhello.so'`.
...@@ -25,6 +26,10 @@ The Ark engine prevents NAPIs from being called to operate JS objects in non-JS ...@@ -25,6 +26,10 @@ The Ark engine prevents NAPIs from being called to operate JS objects in non-JS
* The NAPIs can be used only in JS threads. * The NAPIs can be used only in JS threads.
* **env** is bound to a thread and cannot be used across threads. The JS object created by a NAPI can be used only in the thread, in which the object is created, that is, the JS object is bound to the **env** of the thread. * **env** is bound to a thread and cannot be used across threads. The JS object created by a NAPI can be used only in the thread, in which the object is created, that is, the JS object is bound to the **env** of the thread.
### Importing Header Files
Before using NAPI objects and methods, include **napi/native_api.h**. Otherwise, when only the third-party library header file is included, an error will be reporting, indicating that the interface cannot be found.
### napi_create_async_work ### napi_create_async_work
**napi_create_async_work** has two callbacks: **napi_create_async_work** has two callbacks:
...@@ -635,3 +640,8 @@ export default { ...@@ -635,3 +640,8 @@ export default {
} }
} }
``` ```
## Samples
The following samples are provided for native API development:
- [`NativeAPI`: NativeAPI (eTS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/Native/NativeAPI)
- [First Native C++ Application (eTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/NativeTemplateDemo)
- [Native Component (eTS) (API9) ](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/XComponent)
...@@ -89,7 +89,7 @@ Adds an app account name and additional information (information that can be con ...@@ -89,7 +89,7 @@ Adds an app account name and additional information (information that can be con
### addAccount ### addAccount
addAccount(name: string, extraInfo: string): Promise&lt;void&gt; addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
Adds an app account name and additional information (information that can be converted into the string type, such as token) to the **AppAccountManager** service. This API uses a promise to return the result. Adds an app account name and additional information (information that can be converted into the string type, such as token) to the **AppAccountManager** service. This API uses a promise to return the result.
...@@ -100,7 +100,7 @@ Adds an app account name and additional information (information that can be con ...@@ -100,7 +100,7 @@ Adds an app account name and additional information (information that can be con
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------------------------------------- | | --------- | ------ | ---- | ---------------------------------------- |
| name | string | Yes | Name of the app account to add. | | name | string | Yes | Name of the app account to add. |
| extraInfo | string | Yes | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.| | extraInfo | string | No | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
**Return value** **Return value**
...@@ -1696,7 +1696,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous ...@@ -1696,7 +1696,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
| name | string | Yes | Name of the target app account. | | name | string | Yes | Name of the target app account. |
| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.| | owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
| labels | Array&lt;string&gt; | Yes | Labels to check. | | labels | Array&lt;string&gt; | Yes | Labels to check. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the result. |
**Example** **Example**
...@@ -1710,7 +1710,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous ...@@ -1710,7 +1710,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
### checkAccountLabels<sup>9+</sup> ### checkAccountLabels<sup>9+</sup>
checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;): Promise&lt;void&gt; checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;): Promise&lt;boolean&gt;
Checks whether an app account has specific labels. This API uses a promise to return the result. Checks whether an app account has specific labels. This API uses a promise to return the result.
...@@ -1771,7 +1771,7 @@ Selects the accounts accessible to the requester based on the options. This API ...@@ -1771,7 +1771,7 @@ Selects the accounts accessible to the requester based on the options. This API
### selectAccountsByOptions<sup>9+</sup> ### selectAccountsByOptions<sup>9+</sup>
selectAccountsByOptions(options: SelectAccountsOptions): Promise&lt;void&gt; selectAccountsByOptions(options: SelectAccountsOptions): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
Selects the accounts accessible to the requester based on the options. This API uses a promise to return the result. Selects the accounts accessible to the requester based on the options. This API uses a promise to return the result.
...@@ -1836,7 +1836,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t ...@@ -1836,7 +1836,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t
### verifyCredential<sup>9+</sup> ### verifyCredential<sup>9+</sup>
verifyCredential(name: string, owner: string, options, callback: AuthenticatorCallback): void; verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, callback: AuthenticatorCallback): void;
Verifies the user credential. This API uses an asynchronous callback to return the result. Verifies the user credential. This API uses an asynchronous callback to return the result.
...@@ -1952,11 +1952,11 @@ Defines OAuth token information. ...@@ -1952,11 +1952,11 @@ Defines OAuth token information.
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------ | ---- | -------- | | -------------------- | -------------- | ----- | ---------------- |
| authType | string | Yes | Authentication type.| | authType | string | Yes | Authentication type. |
| token | string | Yes | Value of the token. | | token | string | Yes | Value of the token. |
| account<sup>9+</sup> | AppAccountInfo | No | Account information of the token. | | account<sup>9+</sup> | AppAccountInfo | No | Account information of the token.|
## AuthenticatorInfo<sup>8+</sup> ## AuthenticatorInfo<sup>8+</sup>
...@@ -1978,7 +1978,7 @@ Represents the options for selecting accounts. ...@@ -1978,7 +1978,7 @@ Represents the options for selecting accounts.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------------- | --------------------------- | ----- | ------------------- | | --------------- | --------------------------- | ----- | ------------------- |
| allowedAccounts | Array&lt;[AppAccountInfo](#appAccountinfo)&gt; | No | Allowed accounts. | | allowedAccounts | Array&lt;[AppAccountInfo](#appaccountinfo)&gt; | No | Allowed accounts. |
| allowedOwners | Array&lt;string&gt; | No | Allowed account owners.| | allowedOwners | Array&lt;string&gt; | No | Allowed account owners.|
| requiredLabels | Array&lt;string&gt; | No | Labels required for the authenticator. | | requiredLabels | Array&lt;string&gt; | No | Labels required for the authenticator. |
...@@ -2012,21 +2012,21 @@ Enumerates the constants. ...@@ -2012,21 +2012,21 @@ Enumerates the constants.
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
| Name | Default Value | Description | | Name | Default Value | Description |
| ----------------------------- | ---------------------- | ------------- | | -------------------------------- | ---------------------- | ----------------------- |
| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | Operation of adding an account implicitly. | | ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | Operation of adding an account implicitly. |
| ACTION_AUTHENTICATE | "authenticate" | Authentication operation. | | ACTION_AUTHENTICATE | "authenticate" | Authentication operation. |
| KEY_NAME | "name" | App account name. | | KEY_NAME | "name" | App account name. |
| KEY_OWNER | "owner" | Owner of an app account.| | KEY_OWNER | "owner" | Owner of an app account.|
| KEY_TOKEN | "token" | Token. | | KEY_TOKEN | "token" | Token. |
| KEY_ACTION | "action" | Operation. | | KEY_ACTION | "action" | Operation. |
| KEY_AUTH_TYPE | "authType" | Authentication type. | | KEY_AUTH_TYPE | "authType" | Authentication type. |
| KEY_SESSION_ID | "sessionId" | Session ID. | | KEY_SESSION_ID | "sessionId" | Session ID. |
| KEY_CALLER_PID | "callerPid" | PID of the caller. | | KEY_CALLER_PID | "callerPid" | PID of the caller. |
| KEY_CALLER_UID | "callerUid" | UID of the caller. | | KEY_CALLER_UID | "callerUid" | UID of the caller. |
| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | Bundle name of the caller. | | KEY_CALLER_BUNDLE_NAME | "callerBundleName" | Bundle name of the caller. |
| KEY_REQUIRED_LABELS | "requiredLabels" | Required labels. | | KEY_REQUIRED_LABELS<sup>9+</sup> | "requiredLabels" | Required labels. |
| KEY_BOOLEAN_RESULT | "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>8+</sup>
...@@ -2125,7 +2125,7 @@ Called to redirect a request. ...@@ -2125,7 +2125,7 @@ Called to redirect a request.
### onRequestContinued<sup>9+</sup> ### onRequestContinued<sup>9+</sup>
onRequestContinued: () =&gt; void onRequestContinued?: () =&gt; void
Called to continue to process the request. Called to continue to process the request.
......
...@@ -2148,11 +2148,10 @@ Subscribes to audio capturer change events. ...@@ -2148,11 +2148,10 @@ Subscribes to audio capturer change events.
**System capability**: SystemCapability.Multimedia.Audio.Capturer **System capability**: SystemCapability.Multimedia.Audio.Capturer
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ------------------------------------------------------------------- ---- | | -------- | ------- | --------- | ----------------------------------------------------------------------- |
| type | string | Yes | Event type. The event `'audioCapturerChange'` is triggered when the audio capturer changes. | | type | string | Yes | Event type. The event `'audioCapturerChange'` is triggered when the audio capturer changes. |
| callback | Callback<[AudioCapturerChangeInfoArray](#audiocapturerchangeinfoarray9)> | Yes | Callback used to return the result. | | callback | Callback\<[AudioCapturerChangeInfoArray](#audiocapturerchangeinfoarray9)> | Yes | Callback used to return the result. |
**Example** **Example**
``` ```
......
...@@ -18,9 +18,11 @@ The **ApplicationInfo** module provides application information. Unless otherwis ...@@ -18,9 +18,11 @@ The **ApplicationInfo** module provides application information. Unless otherwis
| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. | | systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | | enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
| label | string | Yes | No | Application label. | | label | string | Yes | No | Application label. |
| labelId | string | Yes | No | Application label ID. | | labelId<sup>(deprecated)</sup> | string | Yes | No | Application label ID.<br>\- **NOTE**: This attribute is deprecated from API version 9. Use **labelIndex** instead. |
| labelIndex<sup>9+</sup> | number | Yes | No | Index of the application label.|
| icon | string | Yes | No | Application icon. | | icon | string | Yes | No | Application icon. |
| iconId | string | Yes | No | Application icon ID. | | iconId<sup>(deprecated)</sup> | string | Yes | No | Application icon ID.<br>\- **NOTE**: This attribute is deprecated from API version 9. Use **iconIndex** instead. |
| iconIndex<sup>9+</sup> | number | Yes | No | Index of the application icon.|
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. | | process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| supportedModes | number | Yes | No | Running modes supported by the application. | | supportedModes | number | Yes | No | Running modes supported by the application. |
| moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. | | moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. |
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
The **DataShareResultSet** module provides APIs for accessing the result set obtained from the database. You can access the values in the specified rows or the value of the specified data type. The **DataShareResultSet** module provides APIs for accessing the result set obtained from the database. You can access the values in the specified rows or the value of the specified data type.
>**NOTE** > **NOTE**
> >
>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
## Modules to Import ## Modules to Import
...@@ -44,7 +46,10 @@ dataShareHelper.query(uri, da, columns).then((data) => { ...@@ -44,7 +46,10 @@ dataShareHelper.query(uri, da, columns).then((data) => {
}); });
``` ```
## Attributes ## DataShareResultSet
Provides methods for accessing the result sets generated by querying the database.
### Attributes
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core **System capability**: SystemCapability.DistributedDataManager.DataShare.Core
...@@ -55,7 +60,7 @@ dataShareHelper.query(uri, da, columns).then((data) => { ...@@ -55,7 +60,7 @@ dataShareHelper.query(uri, da, columns).then((data) => {
| rowCount | number | Yes | Number of rows in the result set. | | rowCount | number | Yes | Number of rows in the result set. |
| isClosed | boolean | Yes | Whether the result set is closed.| | isClosed | boolean | Yes | Whether the result set is closed.|
## goToFirstRow ### goToFirstRow
goToFirstRow(): boolean goToFirstRow(): boolean
...@@ -76,7 +81,7 @@ let isGoTOFirstRow = resultSet.goToFirstRow(); ...@@ -76,7 +81,7 @@ let isGoTOFirstRow = resultSet.goToFirstRow();
console.info('resultSet.goToFirstRow: ' + isGoTOFirstRow); console.info('resultSet.goToFirstRow: ' + isGoTOFirstRow);
``` ```
## goToLastRow ### goToLastRow
goToLastRow(): boolean goToLastRow(): boolean
...@@ -97,7 +102,7 @@ let isGoToLastRow = resultSet.goToLastRow(); ...@@ -97,7 +102,7 @@ let isGoToLastRow = resultSet.goToLastRow();
console.info('resultSet.goToLastRow: ' + isGoToLastRow); console.info('resultSet.goToLastRow: ' + isGoToLastRow);
``` ```
## goToNextRow ### goToNextRow
goToNextRow(): boolean goToNextRow(): boolean
...@@ -118,7 +123,7 @@ let isGoToNextRow = resultSet.goToNextRow(); ...@@ -118,7 +123,7 @@ let isGoToNextRow = resultSet.goToNextRow();
console.info('resultSet.goToNextRow: ' + isGoToNextRow); console.info('resultSet.goToNextRow: ' + isGoToNextRow);
``` ```
## goToPreviousRow ### goToPreviousRow
goToPreviousRow(): boolean goToPreviousRow(): boolean
...@@ -139,7 +144,7 @@ let isGoToPreviousRow = resultSet.goToPreviousRow(); ...@@ -139,7 +144,7 @@ let isGoToPreviousRow = resultSet.goToPreviousRow();
console.info('resultSet.goToPreviousRow: ' + isGoToPreviousRow); console.info('resultSet.goToPreviousRow: ' + isGoToPreviousRow);
``` ```
## goTo ### goTo
goTo(offset:number): boolean goTo(offset:number): boolean
...@@ -167,7 +172,7 @@ let isGoTo = resultSet.goTo(goToNum); ...@@ -167,7 +172,7 @@ let isGoTo = resultSet.goTo(goToNum);
console.info('resultSet.goTo: ' + isGoTo); console.info('resultSet.goTo: ' + isGoTo);
``` ```
## goToRow ### goToRow
goToRow(position: number): boolean goToRow(position: number): boolean
...@@ -195,7 +200,7 @@ let isGoToRow = resultSet.goToRow(goToRowNum); ...@@ -195,7 +200,7 @@ let isGoToRow = resultSet.goToRow(goToRowNum);
console.info('resultSet.goToRow: ' + isGoToRow); console.info('resultSet.goToRow: ' + isGoToRow);
``` ```
## getBlob ### getBlob
getBlob(columnIndex: number): Uint8Array getBlob(columnIndex: number): Uint8Array
...@@ -224,7 +229,7 @@ let getBlob = resultSet.getBlob(columnIndex); ...@@ -224,7 +229,7 @@ let getBlob = resultSet.getBlob(columnIndex);
console.info('resultSet.getBlob: ' + getBlob); console.info('resultSet.getBlob: ' + getBlob);
``` ```
## getString ### getString
getString(columnIndex: number): *string* getString(columnIndex: number): *string*
...@@ -253,7 +258,7 @@ let getString = resultSet.getString(columnIndex); ...@@ -253,7 +258,7 @@ let getString = resultSet.getString(columnIndex);
console.info('resultSet.getString: ' + getString); console.info('resultSet.getString: ' + getString);
``` ```
## getLong ### getLong
getLong(columnIndex: number): number getLong(columnIndex: number): number
...@@ -282,7 +287,7 @@ let getLong = resultSet.getLong(columnIndex); ...@@ -282,7 +287,7 @@ let getLong = resultSet.getLong(columnIndex);
console.info('resultSet.getLong: ' + getLong); console.info('resultSet.getLong: ' + getLong);
``` ```
## getDouble ### getDouble
getDouble(columnIndex: number): number getDouble(columnIndex: number): number
...@@ -311,7 +316,7 @@ let getDouble = resultSet.getDouble(columnIndex); ...@@ -311,7 +316,7 @@ let getDouble = resultSet.getDouble(columnIndex);
console.info('resultSet.getDouble: ' + getDouble); console.info('resultSet.getDouble: ' + getDouble);
``` ```
## close ### close
close(): void close(): void
...@@ -325,7 +330,7 @@ Closes this result set. ...@@ -325,7 +330,7 @@ Closes this result set.
resultSet.close(); resultSet.close();
``` ```
## getColumnIndex ### getColumnIndex
getColumnIndex(columnName: string): number getColumnIndex(columnName: string): number
...@@ -353,7 +358,7 @@ let getColumnIndex = resultSet.getColumnIndex(ColumnName) ...@@ -353,7 +358,7 @@ let getColumnIndex = resultSet.getColumnIndex(ColumnName)
console.info('resultSet.getColumnIndex: ' + getColumnIndex); console.info('resultSet.getColumnIndex: ' + getColumnIndex);
``` ```
## getColumnName ### getColumnName
getColumnName(columnIndex: number): *string* getColumnName(columnIndex: number): *string*
...@@ -381,7 +386,7 @@ let getColumnName = resultSet.getColumnName(columnIndex) ...@@ -381,7 +386,7 @@ let getColumnName = resultSet.getColumnName(columnIndex)
console.info('resultSet.getColumnName: ' + getColumnName); console.info('resultSet.getColumnName: ' + getColumnName);
``` ```
## getDataType ### getDataType
getDataType(columnIndex: number): DataType getDataType(columnIndex: number): DataType
......
...@@ -174,6 +174,42 @@ Obtains all display objects. This API uses a promise to return the result. ...@@ -174,6 +174,42 @@ Obtains all display objects. This API uses a promise to return the result.
}); });
``` ```
## display.hasPrivateWindow<sup>9+</sup>
hasPrivateWindow(displayId: number): boolean
Checks whether there is a visible privacy window on a display. The privacy window can be set by calling **[setPrivacyMode](js-apis-window.md#setprivacymode7)**. The content in the privacy window cannot be captured or recorded.
This is a system API.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- |----------|
| id | number | Yes | ID of the display.|
**Return value**
| Type | Description |
| -------------------------------- |-----------------------------------------------------------------------|
|boolean | Whether there is a visible privacy window on the display.<br>The value **true** means that there is a visible privacy window on the display, and **false** means the opposite.<br>|
**Example**
```js
var ret = display.hasPrivateWindow(displayClass.id);
if (ret == undefined) {
console.log("HasPrivateWindow undefined.");
}
if (ret) {
console.log("HasPrivateWindow.");
} else if (!ret) {
console.log("Don't HasPrivateWindow.");
}
```
## display.on('add'|'remove'|'change') ## display.on('add'|'remove'|'change')
on(type: 'add'|'remove'|'change', callback: Callback&lt;number&gt;): void on(type: 'add'|'remove'|'change', callback: Callback&lt;number&gt;): void
......
...@@ -19,8 +19,6 @@ getDistributedAccountAbility(): DistributedAccountAbility ...@@ -19,8 +19,6 @@ getDistributedAccountAbility(): DistributedAccountAbility
Obtains a **DistributedAccountAbility** instance. Obtains a **DistributedAccountAbility** instance.
**System capability**: SystemCapability.Account.OsAccount
- Return value - Return value
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
...@@ -43,7 +41,7 @@ Obtains distributed account information. This API uses an asynchronous callback ...@@ -43,7 +41,7 @@ Obtains distributed account information. This API uses an asynchronous callback
**System capability**: SystemCapability.Account.OsAccount **System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications) **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -68,7 +66,7 @@ Obtains distributed account information. This API uses a promise to return the r ...@@ -68,7 +66,7 @@ Obtains distributed account information. This API uses a promise to return the r
**System capability**: SystemCapability.Account.OsAccount **System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications) **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC
- Return value - Return value
| Type| Description| | Type| Description|
......
...@@ -16,22 +16,23 @@ import image from '@ohos.multimedia.image'; ...@@ -16,22 +16,23 @@ import image from '@ohos.multimedia.image';
createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<PixelMap> createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<PixelMap>
Creates a **PixelMap** object. This API uses a promise to return the result. Creates a **PixelMap** object with the default BGRA_8888 format and pixel properties specified. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ | | ------- | ------------------------------------------------ | ---- | ---------------------------------------------------------------- |
| colors | ArrayBuffer | Yes | Color array in BGRA_8888 format. | | colors | ArrayBuffer | Yes | Color array in BGRA_8888 format. |
| options | [InitializationOptions](#initializationoptions8) | Yes | Pixel properties, including the alpha type, size, scale mode, pixel format, and editable.| | options | [InitializationOptions](#initializationoptions8) | Yes | Pixel properties, including the alpha type, size, scale mode, pixel format, and editable.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------------------------- | -------------- | | -------------------------------- | ----------------------------------------------------------------------- |
| Promise\<[PixelMap](#pixelmap7)> | Promise used to return the **PixelMap** object.| | Promise\<[PixelMap](#pixelmap7)> | Promise used to return the **PixelMap** object.<br>If the size of the created pixel map exceeds that of the original image, the pixel map size of the original image is returned.|
**Example** **Example**
...@@ -48,7 +49,7 @@ image.createPixelMap(color, opts) ...@@ -48,7 +49,7 @@ image.createPixelMap(color, opts)
createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: AsyncCallback\<PixelMap>): void createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: AsyncCallback\<PixelMap>): void
Creates a **PixelMap** object. This API uses an asynchronous callback to return the result. Creates a **PixelMap** object with the default BGRA_8888 format and pixel properties specified. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
...@@ -91,7 +92,7 @@ Provides APIs to read or write image pixel map data and obtain image pixel map i ...@@ -91,7 +92,7 @@ Provides APIs to read or write image pixel map data and obtain image pixel map i
readPixelsToBuffer(dst: ArrayBuffer): Promise\<void> readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses a promise to return the result. Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses a promise to return the result. If the pixel map is created in the BGRA_8888 format, the pixel map data read is the same as the original data.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
...@@ -122,7 +123,7 @@ pixelmap.readPixelsToBuffer(readBuffer).then(() => { ...@@ -122,7 +123,7 @@ pixelmap.readPixelsToBuffer(readBuffer).then(() => {
readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses an asynchronous callback to return the result. Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses an asynchronous callback to return the result. If the pixel map is created in the BGRA_8888 format, the pixel map data read is the same as the original data.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
...@@ -1008,7 +1009,7 @@ const imageSourceApi = image.createImageSource(fd); ...@@ -1008,7 +1009,7 @@ const imageSourceApi = image.createImageSource(fd);
createImageSource(buf: ArrayBuffer): ImageSource createImageSource(buf: ArrayBuffer): ImageSource
Creates an **ImageSource** instance based on the buffer. Creates an **ImageSource** instance based on the buffers.
**System capability**: SystemCapability.Multimedia.Image.ImageSource **System capability**: SystemCapability.Multimedia.Image.ImageSource
...@@ -1029,7 +1030,7 @@ const imageSourceApi = image.createImageSource(buf); ...@@ -1029,7 +1030,7 @@ const imageSourceApi = image.createImageSource(buf);
createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource
Creates an **ImageSource** instance based on the buffer. Creates an **ImageSource** instance based on the buffers.
**System capability**: SystemCapability.Multimedia.Image.ImageSource **System capability**: SystemCapability.Multimedia.Image.ImageSource
...@@ -1057,7 +1058,7 @@ const imageSourceApi = image.createImageSource(data); ...@@ -1057,7 +1058,7 @@ const imageSourceApi = image.createImageSource(data);
CreateIncrementalSource(buf: ArrayBuffer): ImageSource CreateIncrementalSource(buf: ArrayBuffer): ImageSource
Creates an **ImageSource** instance in incremental mode based on the buffer. Creates an **ImageSource** instance in incremental mode based on the buffers.
**System capability**: SystemCapability.Multimedia.Image.ImageSource **System capability**: SystemCapability.Multimedia.Image.ImageSource
...@@ -1084,7 +1085,7 @@ const imageSourceApi = image.CreateIncrementalSource(buf); ...@@ -1084,7 +1085,7 @@ const imageSourceApi = image.CreateIncrementalSource(buf);
CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource
Creates an **ImageSource** instance in incremental mode based on the buffer. Creates an **ImageSource** instance in incremental mode based on the buffers.
**System capability**: SystemCapability.Multimedia.Image.ImageSource **System capability**: SystemCapability.Multimedia.Image.ImageSource
...@@ -2246,7 +2247,7 @@ Describes image properties. ...@@ -2246,7 +2247,7 @@ Describes image properties.
## PropertyKey<sup>7+</sup> ## PropertyKey<sup>7+</sup>
Describes the exchangeable image file format (Exif) information of an image. Describes the exchangeable image file format (EXIF) information of an image.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
...@@ -2322,7 +2323,7 @@ Enumerates the response codes returned upon build errors. ...@@ -2322,7 +2323,7 @@ Enumerates the response codes returned upon build errors.
| ERR_IMAGE_CROP | 62980109 | An error occurs during image cropping. | | ERR_IMAGE_CROP | 62980109 | An error occurs during image cropping. |
| ERR_IMAGE_SOURCE_DATA | 62980110 | The image source data is incorrect. | | ERR_IMAGE_SOURCE_DATA | 62980110 | The image source data is incorrect. |
| ERR_IMAGE_SOURCE_DATA_INCOMPLETE | 62980111 | The image source data is incomplete. | | ERR_IMAGE_SOURCE_DATA_INCOMPLETE | 62980111 | The image source data is incomplete. |
| ERR_IMAGE_MISMATCHED_FORMAT | 62980112 | The image format does not match. | | ERR_IMAGE_MISMATCHED_FORMAT | 62980112 | The image formats do not match. |
| ERR_IMAGE_UNKNOWN_FORMAT | 62980113 | Unknown image format. | | ERR_IMAGE_UNKNOWN_FORMAT | 62980113 | Unknown image format. |
| ERR_IMAGE_SOURCE_UNRESOLVED | 62980114 | The image source is not parsed. | | ERR_IMAGE_SOURCE_UNRESOLVED | 62980114 | The image source is not parsed. |
| ERR_IMAGE_INVALID_PARAMETER | 62980115 | Invalid image parameter. | | ERR_IMAGE_INVALID_PARAMETER | 62980115 | Invalid image parameter. |
...@@ -2338,4 +2339,4 @@ Enumerates the response codes returned upon build errors. ...@@ -2338,4 +2339,4 @@ Enumerates the response codes returned upon build errors.
| ERR_IMAGE_READ_PIXELMAP_FAILED | 62980246 | Failed to read the pixel map. | | ERR_IMAGE_READ_PIXELMAP_FAILED | 62980246 | Failed to read the pixel map. |
| ERR_IMAGE_WRITE_PIXELMAP_FAILED | 62980247 | Failed to write the pixel map. | | ERR_IMAGE_WRITE_PIXELMAP_FAILED | 62980247 | Failed to write the pixel map. |
| ERR_IMAGE_PIXELMAP_NOT_ALLOW_MODIFY | 62980248 | Modification to the pixel map is not allowed. | | ERR_IMAGE_PIXELMAP_NOT_ALLOW_MODIFY | 62980248 | Modification to the pixel map is not allowed. |
| ERR_IMAGE_CONFIG_FAILED | 62980259 | The software parameter setting is incorrect. | | ERR_IMAGE_CONFIG_FAILED | 62980259 | The configuration is incorrect. |
...@@ -2278,7 +2278,7 @@ Describes options for fetching media files. ...@@ -2278,7 +2278,7 @@ Describes options for fetching media files.
| Name | Type | Readable| Writable| Mandatory| Description | | Name | Type | Readable| Writable| Mandatory| Description |
| ----------------------- | ------------------- | ---- | ---- | ---- | ------------------------------------------------------------ | | ----------------------- | ------------------- | ---- | ---- | ---- | ------------------------------------------------------------ |
| selections | string | Yes | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?',| | selections | string | Yes | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
| selectionArgs | Array&lt;string&gt; | Yes | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.<br>Example:<br>selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], | | selectionArgs | Array&lt;string&gt; | Yes | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.<br>Example:<br>selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
| order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " AESC"<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"| | order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " AESC"<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"|
| uri<sup>8+</sup> | string | Yes | Yes | No | File URI. | | uri<sup>8+</sup> | string | Yes | Yes | No | File URI. |
......
# Prompt # Prompt
The **Prompt** module provides APIs for creating and showing toasts, dialog boxes, and action menus.
> **NOTE** > **NOTE**
>
> The initial APIs of this module are supported since API version 8. 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 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
``` ```js
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
``` ```
## Required Permissions
None.
## prompt.showToast ## prompt.showToast
showToast(options: ShowToastOptions): void showToast(options: ShowToastOptions): void
Shows the toast. Shows a toast.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
...@@ -26,15 +26,11 @@ Shows the toast. ...@@ -26,15 +26,11 @@ Shows the toast.
| options | [ShowToastOptions](#showtoastoptions) | Yes | Toast options.| | options | [ShowToastOptions](#showtoastoptions) | Yes | Toast options.|
**Example** **Example**
``` ```js
export default { prompt.showToast({
showToast() { message: 'Message Info',
prompt.showToast({ duration: 2000,
message: 'Message Info', });
duration: 2000,
});
}
}
``` ```
## ShowToastOptions ## ShowToastOptions
...@@ -42,11 +38,11 @@ Describes the options for showing the toast. ...@@ -42,11 +38,11 @@ Describes the options for showing the toast.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ------ | ---------------------------------------- |
| message | string | Yes | Text to display. | | message | string\| [Resource](.../ui/ts-types.md#resource-type)<sup>9+</sup>| Yes | Text to display. |
| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The recommended value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used.| | duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The recommended value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used.|
| bottom | &lt;length&gt; | No | Distance between the toast border and the bottom of the screen. | | bottom | string\| number | No | Distance between the toast border and the bottom of the screen. |
## prompt.showDialog ## prompt.showDialog
...@@ -69,38 +65,34 @@ Shows a dialog box. This API uses a promise to return the result synchronously. ...@@ -69,38 +65,34 @@ Shows a dialog box. This API uses a promise to return the result synchronously.
**Example** **Example**
``` ```js
export default { prompt.showDialog({
showDialog() { title: 'Title Info',
prompt.showDialog({ message: 'Message Info',
title: 'Title Info', buttons: [
message: 'Message Info', {
buttons: [ text: 'button1',
{ color: '#000000',
text: 'button1', },
color: '#000000', {
}, text: 'button2',
{ color: '#000000',
text: 'button2',
color: '#000000',
}
],
})
.then(data => {
console.info('showDialog success, click button: ' + data.index);
})
.catch(err => {
console.info('showDialog error: ' + err);
})
} }
} ],
})
.then(data => {
console.info('showDialog success, click button: ' + data.index);
})
.catch(err => {
console.info('showDialog error: ' + err);
})
``` ```
## prompt.showDialog ## prompt.showDialog
showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSuccessResponse&gt;):void showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSuccessResponse&gt;):void
Shows a dialog box. This API uses a callback to return the result asynchronously. Shows a dialog box. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
...@@ -112,32 +104,27 @@ Shows a dialog box. This API uses a callback to return the result asynchronously ...@@ -112,32 +104,27 @@ Shows a dialog box. This API uses a callback to return the result asynchronously
| callback | AsyncCallback&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | Yes | Callback used to return the dialog box response result. | | callback | AsyncCallback&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | Yes | Callback used to return the dialog box response result. |
**Example** **Example**
``` ```js
export default { prompt.showDialog({
callback(err, data) { title: 'showDialog Title Info',
if(err) { message: 'Message Info',
console.info('showDialog err: ' + err); buttons: [
return; {
} text: 'button1',
console.info('showDialog success callback, click button: ' + data.index); color: '#000000',
}, },
showDialog() { {
prompt.showDialog({ text: 'button2',
title: 'showDialog Title Info', color: '#000000',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
]
}, this.callback);
} }
]
}, (err, data) => {
if (err) {
console.info('showDialog err: ' + err);
return;
} }
console.info('showDialog success callback, click button: ' + data.index);
});
``` ```
## ShowDialogOptions ## ShowDialogOptions
...@@ -146,11 +133,11 @@ Describes the options for showing the dialog box. ...@@ -146,11 +133,11 @@ Describes the options for showing the dialog box.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ---------------------------------------- | | ------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string | No | Title of the text to display. | | title | string\| [Resource](.../ui/ts-types.md#resource-type)<sup>9+</sup>| No | Title of the dialog box. |
| message | string | No | Text body. | | message | string\| [Resource](.../ui/ts-types.md#resource-type)<sup>9+</sup>| No | Text body. |
| buttons | Array | No | Array of buttons in the dialog box. The array structure is **{text:'button',&nbsp;color:&nbsp;'\#666666'}**. One to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.| | buttons | Array | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. Up to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.|
## ShowDialogSuccessResponse ## ShowDialogSuccessResponse
...@@ -160,7 +147,7 @@ Describes the dialog box response result. ...@@ -160,7 +147,7 @@ Describes the dialog box response result.
| Name | Type | Description | | Name | Type | Description |
| ----- | ------ | ------------------- | | ----- | ------ | ------------------- |
| index | number | Index of the selected button in the array.| | index | number | Index of the selected button in the **buttons** array.|
## prompt.showActionMenu ## prompt.showActionMenu
...@@ -179,36 +166,31 @@ Shows an action menu. This API uses a callback to return the result asynchronous ...@@ -179,36 +166,31 @@ Shows an action menu. This API uses a callback to return the result asynchronous
**Example** **Example**
``` ```js
export default { prompt.showActionMenu({
callback(err, data) { title: 'Title Info',
if(err) { buttons: [
console.info('showActionMenu err: ' + err); {
return; text: 'item1',
} color: '#666666',
console.info('showActionMenu success callback, click button: ' + data.index);
}, },
showActionMenu() { {
prompt.showActionMenu({ text: 'item2',
title: 'Title Info', color: '#000000',
buttons: [ },
{ ]
text: 'item1', }, (err, data) => {
color: '#666666', if (err) {
}, console.info('showActionMenu err: ' + err);
{ return;
text: 'item2',
color: '#000000',
},
]
}, this.callback)
}
} }
console.info('showActionMenu success callback, click button: ' + data.index);
})
``` ```
## prompt.showActionMenu ## prompt.showActionMenu
showActionMenu(options: ActionMenuOptions): Promise\<ActionMenuSuccessResponse> showActionMenu(options: ActionMenuOptions): Promise&lt;ActionMenuSuccessResponse&gt;
Shows an action menu. This API uses a promise to return the result synchronously. Shows an action menu. This API uses a promise to return the result synchronously.
...@@ -225,30 +207,26 @@ Shows an action menu. This API uses a promise to return the result synchronously ...@@ -225,30 +207,26 @@ Shows an action menu. This API uses a promise to return the result synchronously
| Promise&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)&gt; | Promise used to return the action menu response result.| | Promise&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)&gt; | Promise used to return the action menu response result.|
**Example** **Example**
``` ```js
export default { prompt.showActionMenu({
showActionMenu() { title: 'showActionMenu Title Info',
prompt.showActionMenu({ buttons: [
title: 'showActionMenu Title Info', {
buttons: [ text: 'item1',
{ color: '#666666',
text: 'item1', },
color: '#666666', {
}, text: 'item2',
{ color: '#000000',
text: 'item2', },
color: '#000000', ]
}, })
] .then(data => {
}) console.info('showActionMenu success, click button: ' + data.index);
.then(data => { })
console.info('showActionMenu success, click button: ' + data.index); .catch(err => {
}) console.info('showActionMenu error: ' + err);
.catch(err => { })
console.info('showActionMenu error: ' + err);
})
}
}
``` ```
## ActionMenuOptions ## ActionMenuOptions
...@@ -256,10 +234,10 @@ Describes the options for showing the action menu. ...@@ -256,10 +234,10 @@ Describes the options for showing the action menu.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ---------------------------------------- | | ------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string | No | Title of the text to display. | | title | string\| [Resource](.../ui/ts-types.md#resource-type)<sup>9+</sup>| No | Title of the text to display. |
| buttons | Array | Yes | Array of menu items. The array structure is **{text:'button',&nbsp;color:&nbsp;'\#666666'}**. One to six items are supported. If there are more than six items, extra items will not be displayed.| | buttons | Array&lt;[Button](#button)&gt; | Yes | Array of menu item buttons. The array structure is **{text:'button', color: '\#666666'}**. Up to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed.|
## ActionMenuSuccessResponse ## ActionMenuSuccessResponse
...@@ -269,4 +247,15 @@ Describes the action menu response result. ...@@ -269,4 +247,15 @@ Describes the action menu response result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ------------------------ | | ----- | ------ | ---- | ------------------------ |
| index | number | No | Index of the selected button in the array, starting from **0**.| | index | number | No | Index of the selected button in the **buttons** array, starting from **0**.|
## Button
Describes the menu item button in the action menu.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ----- | ---------------------------------------- | ---- | ------- |
| text | string\| [Resource](.../ui/ts-types.md#resource-type)<sup>9+</sup>| Yes | Button text.|
| color | string\| [Resource](.../ui/ts-types.md#resource-type)<sup>9+</sup>| Yes | Text color of the button.|
...@@ -874,7 +874,7 @@ Queries this download task. This API uses a promise to return the result. ...@@ -874,7 +874,7 @@ Queries this download task. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Download **System capability**: SystemCapability.MiscServices.Download
**Parameters** **Parameters**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[DownloadInfo](#downloadinfo7)&gt; | Promise used to return the download task information.| | Promise&lt;[DownloadInfo](#downloadinfo7)&gt; | Promise used to return the download task information.|
...@@ -1113,11 +1113,11 @@ Resumes this download task. This API uses an asynchronous callback to return the ...@@ -1113,11 +1113,11 @@ Resumes this download task. This API uses an asynchronous callback to return the
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| url | string | Yes| Resource URL.| | url | string | Yes| Resource URL.|
| header | object | No| HTTP or HTTPS header added to a download request.| | header | object | No| HTTP or HTTPS header added to a download request.|
| enableMetered | boolean | No| Download allowed in metered connections.| | enableMetered | boolean | No| Whether download is allowed on a metered connection.<br>- **true**: yes<br> **false**: no|
| enableRoaming | boolean | No| Download allowed on a roaming network.| | enableRoaming | boolean | No| Whether download is allowed on a roaming network.<br>- **true**: yes<br> **false**: no|
| description | string | No| Description of the download session.| | description | string | No| Description of the download session.|
| filePath<sup>7+</sup> | string | No| Download path. (The default path is **'internal://cache/'**.)<br>- filePath:'workspace/test.txt': The **workspace** directory is created in the default path to store files.<br>- filePath:'test.txt': Files are stored in the default path.<br>- filePath:'workspace/': The **workspace** directory is created in the default path to store files.| | filePath<sup>7+</sup> | string | No| Download path. (The default path is **'internal://cache/'**.)<br>- filePath:'workspace/test.txt': The **workspace** directory is created in the default path to store files.<br>- filePath:'test.txt': Files are stored in the default path.<br>- filePath:'workspace/': The **workspace** directory is created in the default path to store files.|
| networkType | number | No| Network type allowed for download.| | networkType | number | No| Network type allowed for download.<br>- NETWORK_MOBILE: 0x00000001<br>- NETWORK_WIFI: 0x00010000|
| title | string | No| Title of the download session.| | title | string | No| Title of the download session.|
| background | boolean | No| Whether to enable the background task notification. When this parameter is enabled, the download status is displayed in the notification panel.| | background | boolean | No| Whether to enable the background task notification. When this parameter is enabled, the download status is displayed in the notification panel.|
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
| 8 | Deprecated API description | Do not delete the deprecated content from the document. Instead, suffix `deprecated` as a superscript to the content, and use the greater-than sign (`>`) to introduce the substitute API plus a link to the API description.<br>Example: abandonmentMethod<sup>(deprecated)</sup><br>> This API is no longer maintained since API version 7. You are advised to use [newMethod]\(#newmethod) instead.| | 8 | Deprecated API description | Do not delete the deprecated content from the document. Instead, suffix `deprecated` as a superscript to the content, and use the greater-than sign (`>`) to introduce the substitute API plus a link to the API description.<br>Example: abandonmentMethod<sup>(deprecated)</sup><br>> This API is no longer maintained since API version 7. You are advised to use [newMethod]\(#newmethod) instead.|
| 9 | Permission description | Provide the same permission description as that defined in the code for each method, enum, and attribute.<br>1. If a specific permission required for using an API can be requested only by system applications, provide the description in the following format:<br> **Required permissions**: ohos.permission.examplePermission (available only to system applications)<br>2. If a specific permission required for using an API can be requested by all applications, provide the description in the following format:<br> **Required permissions**: ohos.permission.examplePermission<br>3. If multiple permissions are required for using an API, provide the permissions with `and` or `or` in the following format:<br> **Required permissions**: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB<br> **Required permissions**: ohos.permission.examplePermissionA or ohos.permission.examplePermissionB| | 9 | Permission description | Provide the same permission description as that defined in the code for each method, enum, and attribute.<br>1. If a specific permission required for using an API can be requested only by system applications, provide the description in the following format:<br> **Required permissions**: ohos.permission.examplePermission (available only to system applications)<br>2. If a specific permission required for using an API can be requested by all applications, provide the description in the following format:<br> **Required permissions**: ohos.permission.examplePermission<br>3. If multiple permissions are required for using an API, provide the permissions with `and` or `or` in the following format:<br> **Required permissions**: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB<br> **Required permissions**: ohos.permission.examplePermissionA or ohos.permission.examplePermissionB|
| 10 | @syscap | 1. Provide a description for every API in the following format, wherein *A.B* indicates a specific system capability.<br> **System capability**: SystemCapability.*A.B*<br>2. There are two cases for adding system capability information to a table (of attributes, enums, constants, or variables).<br> 1) If all the items in a table require the same system capability, add the following information to the front of the table:<br> **System capability**: SystemCapability.*A.B*<br> 2) If the items in a table require different system capabilities,<br> list the system capability for each item in the table. | | 10 | @syscap | 1. Provide a description for every API in the following format, wherein *A.B* indicates a specific system capability.<br> **System capability**: SystemCapability.*A.B*<br>2. There are two cases for adding system capability information to a table (of attributes, enums, constants, or variables).<br> 1) If all the items in a table require the same system capability, add the following information to the front of the table:<br> **System capability**: SystemCapability.*A.B*<br> 2) If the items in a table require different system capabilities,<br> list the system capability for each item in the table. |
| 11 | @system api | 1. If all APIs of a module are system APIs, add the following sentence to the next line of the initial version description:<br> The APIs provided by this module are system APIs.<br>2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description:<br> This is a system API. | | 11 | @system api | 1. If all APIs of a module are system APIs, add the following sentence to the next line of the initial version description:<br> The APIs provided by this module are system APIs.<br>2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description:<br> **System API**: This is a system API. |
| 12 | @FAModelOnly<br>@StageModelOnly | 1. If a module is implemented only for a specific ability model, add the following sentence to the next line of the initial version description:<br> - The APIs of this module can be used only in the FA model.<br>Or<br> - The APIs of this module can be used only in the stage model.<br>2. If an API is implemented only for a specific ability model, add the following sentence to the API description:<br> - This API can be used only in the FA model.<br>Or<br> - This API can be used only in the stage model.| | 12 | @FAModelOnly<br>@StageModelOnly | 1. If a module is implemented only for a specific ability model, add the following sentence to the next line of the initial version description:<br> The APIs of this module can be used only in the FA model.<br>Or<br> The APIs of this module can be used only in the stage model.<br>2. If an API is implemented only for a specific ability model, add the following sentence to the API description:<br> **Model restriction**: This API can be used only in the FA model.<br/>Or<br/> **Model restriction**: This API can be used only in the stage model. |
| 13 | Asynchronous methods (callback and promise)| Use the following sentences for callback methods.<br>Method introduction: *Describe the method.* This API uses an asynchronous callback to return the result.<br>Parameter description:<br>**callback\<boolean>**: Callback used to return the result. The value `true` indicates *something*, and `false` indicates the opposite.<br>**callback\<Object>**: Callback used to return *something*. Example: Callback used to return the `AudioCapturer` object. <br>**AsyncCallback\<void>**: Callback used to return the result. If the operation (or a specific operation description) is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.<br>**AsyncCallback\<Object x>**: Callback used to return the result. If the operation (or a specific operation description) is successful, `err` is `undefined`, and `data` is the *x* object obtained; otherwise, `err` is an `Error` object.<br>Use the following sentences for promise methods.<br>Method introduction: *Describe the method.* This API uses a promise to return the result.<br>Parameter description:<br>**Promise\<boolean>**: Promise used to return the result. The value `true` indicates *something*, and `false` indicates the opposite.<br>**Promise\<Object>**: Promise used to return *something*. Example: Promise used to return the `AudioCapturer` object. <br>**Promise\<void>**: Promise that returns no value. | | 13 | Asynchronous methods (callback and promise)| Use the following sentences for callback methods.<br>Method introduction: *Describe the method.* This API uses an asynchronous callback to return the result.<br>Parameter description:<br>**callback\<boolean>**: Callback used to return the result. The value `true` indicates *something*, and `false` indicates the opposite.<br>**callback\<Object>**: Callback used to return *something*. Example: Callback used to return the `AudioCapturer` object. <br>**AsyncCallback\<void>**: Callback used to return the result. If the operation (or a specific operation description) is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.<br>**AsyncCallback\<Object x>**: Callback used to return the result. If the operation (or a specific operation description) is successful, `err` is `undefined`, and `data` is the *x* object obtained; otherwise, `err` is an `Error` object.<br>Use the following sentences for promise methods.<br>Method introduction: *Describe the method.* This API uses a promise to return the result.<br>Parameter description:<br>**Promise\<boolean>**: Promise used to return the result. The value `true` indicates *something*, and `false` indicates the opposite.<br>**Promise\<Object>**: Promise used to return *something*. Example: Promise used to return the `AudioCapturer` object. <br>**Promise\<void>**: Promise that returns no value.|
| 14 | Sample code programming language | Use code blocks to provide sample code and mark the programming language.<br>Use `js` as the mark if both JS and eTS can be used, and use `ts` if only eTS can be used.| | 14 | Sample code programming language | Use code blocks to provide sample code and mark the programming language.<br>Use `js` as the mark if both JS and eTS can be used, and use `ts` if only eTS can be used.|
| 15 | Link | Link format: [Link text]\(Link content)<br>Cross-folder link format: [markdown file name]\(\.\./../xxx/xxx.md). One `./` indicates one upper-level folder.<br>Intra-topic link: [Interface A<sup>7+</sup>]\(#xxxa7). The text in the intra-topic link must be the same as the title to be linked. In the link, all letters must be in lowercase, and no special character or label is included.| | 15 | Link | Link format: [Link text]\(Link content)<br>Cross-folder link format: [markdown file name]\(\.\./../xxx/xxx.md). One `./` indicates one upper-level folder.<br>Intra-topic link: [Interface A<sup>7+</sup>]\(#xxxa7). The text in the intra-topic link must be the same as the title to be linked. In the link, all letters must be in lowercase, and no special character or label is included.|
...@@ -57,7 +57,6 @@ When compared with `LinkedList`, `ArrayList` is more efficient in random access ...@@ -57,7 +57,6 @@ When compared with `LinkedList`, `ArrayList` is more efficient in random access
You are advised to use `ArrayList` when elements in a container need to be frequently read. You are advised to use `ArrayList` when elements in a container need to be frequently read.
> **NOTE** > **NOTE**
>
> The initial APIs of this module are supported since API version 8. 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 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -67,7 +66,7 @@ You are advised to use `ArrayList` when elements in a container need to be frequ ...@@ -67,7 +66,7 @@ You are advised to use `ArrayList` when elements in a container need to be frequ
> 1. Write the modules to import based on the actual conditions. Provide the **import** statement in the form of a code block. > 1. Write the modules to import based on the actual conditions. Provide the **import** statement in the form of a code block.
> >
> 2. If no module needs to be imported, change "Modules to Import" to "Usage" and provide a usage description. <br>Example of **Usage**:<br> > 2. If no module needs to be imported, change "Modules to Import" to "Usage" and provide a usage description. <br>Example of **Usage**:<br>
> Before using the `AbilityContext`, obtain the `Context` object through [getContext()]\(*API-reference*.md). > Before using the `AbilityContext`, obtain the `Context` object through \[getContext()]\(*API-reference*.md)\.
> >
> ```js > ```js
> import ability_featureAbility from '@ohos.ability.featureAbility'; > import ability_featureAbility from '@ohos.ability.featureAbility';
...@@ -106,7 +105,6 @@ import call from '@ohos.telephony.call'; ...@@ -106,7 +105,6 @@ import call from '@ohos.telephony.call';
> 2. Use the actual method name, in the format of ClassName.methodName, as the level-2 heading. For a subscription method, add the subscription event to the method name. > 2. Use the actual method name, in the format of ClassName.methodName, as the level-2 heading. For a subscription method, add the subscription event to the method name.
> >
> Example of a common method: sim.getSimIccId > Example of a common method: sim.getSimIccId
>
> Example of a subscription method: sim.on('exampleEvent') > Example of a subscription method: sim.on('exampleEvent')
> >
> 3. **Method calling mode**: The description must be the same as that in the .d.ts file and include the parameter type, parameter name, and return value type. > 3. **Method calling mode**: The description must be the same as that in the .d.ts file and include the parameter type, parameter name, and return value type.
...@@ -123,9 +121,9 @@ Provide the method name in the following format: (`static` if it is a static met ...@@ -123,9 +121,9 @@ Provide the method name in the following format: (`static` if it is a static met
Describe the method. For details, see the fourth and fifth points in "Writing Instructions" above. Describe the method. For details, see the fourth and fifth points in "Writing Instructions" above.
This API can be used only in the stage model. (optional) **Model restriction**: This API can be used only in the FA model. (Delete this part if it is not involved.)
This is a system API. (optional) **System API**: This is a system API. (Delete this part if it is not involved.)
**Required permissions**: ohos.permission.examplePermission (Delete this part if no permission is involved. If a system permission is required, specify it.) **Required permissions**: ohos.permission.examplePermission (Delete this part if no permission is involved. If a system permission is required, specify it.)
...@@ -179,15 +177,15 @@ Provide the method name in the following format: (`static` if it is a static met ...@@ -179,15 +177,15 @@ Provide the method name in the following format: (`static` if it is a static met
Describe the method. For details, see the fourth and fifth points in "Writing Instructions" under [Methods](#methods). Describe the method. For details, see the fourth and fifth points in "Writing Instructions" under [Methods](#methods).
This API can be used only in the stage model. (optional) **Model restriction**: This API can be used only in the FA model. (Delete this part if it is not involved.)
This is a system API. (optional) **System API**: This is a system API. (Delete this part if it is not involved.)
**Required permissions**: ohos.permission.examplePermission (Delete this part if no permission is involved. If a system permission is required, specify it.) **Required permissions**: ohos.permission.examplePermission (Delete this part if no permission is involved. If a system permission is required, specify it.)
**System capability**: SystemCapability.*A.B* (mandatory) **System capability**: SystemCapability.*A.B* (mandatory)
**Parameters** (Optional. Delete this heading if there is no parameter.) **Parameters** (Optional. Delete this part if there is no parameter.)
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------ | ---- | ------------------------------------------------------------ |
...@@ -268,7 +266,7 @@ The following is an example of the custom type of a key-value pair. ...@@ -268,7 +266,7 @@ The following is an example of the custom type of a key-value pair.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------ | ------------------- | ---- | ---- | ------------------------------------------------------------ | | ------------ | ------------------- | ---- | ---- | ------------------------------------------------------------ |
| parameterUrl | string | Yes | Yes | Media output URI. Supported: 1. Relative path whose protocol type is `internal`. Example: <br/>Temporary directory: internal://cache/test.mp4<br/> 2. Absolute path. Example:<br/> file:///data/data/ohos.xxx.xxx/files/test.mp4| | parameterUrl | string | Yes | Yes | Media output URI. Supported:<br>1. Relative path whose protocol type is `internal`. Example: <br/>Temporary directory: internal://cache/test.mp4<br>2. Absolute path. Example:<br/>file:///data/data/ohos.xxx.xxx/files/test.mp4 |
| parameterOne | [CustomEnum](#Enumeration)| Yes | Yes | Describe the attributes. The requirements are similar to those for the parameter description. | | parameterOne | [CustomEnum](#Enumeration)| Yes | Yes | Describe the attributes. The requirements are similar to those for the parameter description. |
## Change History ## Change History
......
...@@ -52,7 +52,7 @@ The camera module encapsulates camera operations in camera preview, photographin ...@@ -52,7 +52,7 @@ The camera module encapsulates camera operations in camera preview, photographin
| API | Description | | API | Description |
| ------------------------------------------------------------ | ---------------------------- | | ------------------------------------------------------------ | ---------------------------- |
| CamRetCode GetStreamOperator(<br> const OHOS::sptr<IStreamOperatorCallback> &callback,<br> OHOS::sptr<IStreamOperator> &streamOperator) | Obtains the stream controller. | | CamRetCode GetStreamOperator(<br> const OHOS::sptr<IStreamOperatorCallback> &callback,<br> OHOS::sptr<IStreamOperator> &streamOperator) | Obtains the stream controller. |
| CamRetCode UpdateSettings(const std::shared_ptr<CameraSetting> &settingss) | Updates device control parameters. | | CamRetCode UpdateSettings(const std::shared_ptr<CameraSetting> &settings) | Updates device control parameters. |
| CamRetCode SetResultMode(const ResultCallbackMode &mode) | Sets the result callback mode and function.| | CamRetCode SetResultMode(const ResultCallbackMode &mode) | Sets the result callback mode and function.|
| CamRetCode GetEnabledResults(std::vector<MetaType> &results) | Obtains the enabled ResultMeta. | | CamRetCode GetEnabledResults(std::vector<MetaType> &results) | Obtains the enabled ResultMeta. |
| CamRetCode EnableResult(const std::vector<MetaType> &results) | Enables specific ResultMeta. | | CamRetCode EnableResult(const std::vector<MetaType> &results) | Enables specific ResultMeta. |
...@@ -730,7 +730,7 @@ There is a camera demo in the **/drivers/peripheral/camera/hal/init** directory. ...@@ -730,7 +730,7 @@ There is a camera demo in the **/drivers/peripheral/camera/hal/init** directory.
"-o | --offline stream offline test\n" "-o | --offline stream offline test\n"
"-c | --capture capture one picture\n" "-c | --capture capture one picture\n"
"-w | --set WB Set white balance Cloudy\n" "-w | --set WB Set white balance Cloudy\n"
"-v | --video capture Viedeo of 10s\n" "-v | --video capture Video of 10s\n"
"-a | --Set AE Set Auto exposure\n" "-a | --Set AE Set Auto exposure\n"
"-f | --Set Flashlight Set flashlight ON 5s OFF\n" "-f | --Set Flashlight Set flashlight ON 5s OFF\n"
"-q | --quit stop preview and quit this app\n"); "-q | --quit stop preview and quit this app\n");
......
...@@ -175,7 +175,7 @@ VOID SendEntry(VOID) ...@@ -175,7 +175,7 @@ VOID SendEntry(VOID)
ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0); ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("send message failure, error: %x\n", ret); printf("Failed to send the message, error: %x\n", ret);
} }
} }
...@@ -189,17 +189,17 @@ VOID RecvEntry(VOID) ...@@ -189,17 +189,17 @@ VOID RecvEntry(VOID)
usleep(1000000); usleep(1000000);
ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0); ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("recv message failure, error: %x\n", ret); printf("Failed to receive the message, error: %x\n", ret);
} }
printf("recv message: %s\n", readBuf); printf("recv message: %s\n", readBuf);
ret = LOS_QueueDelete(g_queue); ret = LOS_QueueDelete(g_queue);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("delete the queue failure, error: %x\n", ret); printf("Failed to delete the queue, error: %x\n", ret);
} }
printf("delete the queue success.\n"); printf("Deleted the queue successfully.\n");
} }
UINT32 ExampleQueue(VOID) UINT32 ExampleQueue(VOID)
...@@ -217,7 +217,7 @@ UINT32 ExampleQueue(VOID) ...@@ -217,7 +217,7 @@ UINT32 ExampleQueue(VOID)
LOS_TaskLock(); LOS_TaskLock();
ret = LOS_TaskCreate(&task1, &initParam); ret = LOS_TaskCreate(&task1, &initParam);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create task1 failed, error: %x\n", ret); printf("Failed to create task1, error: %x\n", ret);
return ret; return ret;
} }
...@@ -226,16 +226,16 @@ UINT32 ExampleQueue(VOID) ...@@ -226,16 +226,16 @@ UINT32 ExampleQueue(VOID)
initParam.usTaskPrio = 10; initParam.usTaskPrio = 10;
ret = LOS_TaskCreate(&task2, &initParam); ret = LOS_TaskCreate(&task2, &initParam);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create task2 failed, error: %x\n", ret); printf("Failed to create task2, error: %x\n", ret);
return ret; return ret;
} }
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50); ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create queue failure, error: %x\n", ret); printf("Failed to create the queue, error: %x\n", ret);
} }
printf("create the queue succes.\n"); printf("Created the queue successfully.\n");
LOS_TaskUnlock(); LOS_TaskUnlock();
return ret; return ret;
} }
......
...@@ -75,7 +75,7 @@ The following table describes the APIs available for signal operations. ...@@ -75,7 +75,7 @@ The following table describes the APIs available for signal operations.
>``` >```
>You can obtain and modify the configuration of signal registration. Currently, only the **SIGINFO** options are supported. For details, see the description of the **sigtimedwait** API. >You can obtain and modify the configuration of signal registration. Currently, only the **SIGINFO** options are supported. For details, see the description of the **sigtimedwait** API.
>Transmit a signal. >Transmit a signal.
>a. Among the default signal-receiving behaviors, the process does not support **STOP**, **COTINUE**, and **COREDUMP** defined in the POSIX standard. >a. Among the default signal-receiving behaviors, the process does not support **STOP**, **CONTINUE**, and **COREDUMP** defined in the POSIX standard.
>b. The **SIGSTOP**, **SIGKILL**, and **SIGCONT** signals cannot be shielded. >b. The **SIGSTOP**, **SIGKILL**, and **SIGCONT** signals cannot be shielded.
>c. If a process killed is not reclaimed by its parent process, the process becomes a zombie process. >c. If a process killed is not reclaimed by its parent process, the process becomes a zombie process.
>d. A process will not call back the signal received until the process is scheduled. >d. A process will not call back the signal received until the process is scheduled.
......
...@@ -45,8 +45,8 @@ The typical development process of adding a system call API is as follows: ...@@ -45,8 +45,8 @@ The typical development process of adding a system call API is as follows:
#define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0) #define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0)
#define __NR_pthread_join (__NR_OHOS_BEGIN + 1) #define __NR_pthread_join (__NR_OHOS_BEGIN + 1)
#define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2) #define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2)
#define __NR_creat_user_thread (__NR_OHOS_BEGIN + 3) #define __NR_create_user_thread (__NR_OHOS_BEGIN + 3)
#define __NR_processcreat (__NR_OHOS_BEGIN + 4) #define __NR_processcreate (__NR_OHOS_BEGIN + 4)
#define __NR_processtart (__NR_OHOS_BEGIN + 5) #define __NR_processtart (__NR_OHOS_BEGIN + 5)
#define __NR_printf (__NR_OHOS_BEGIN + 6) #define __NR_printf (__NR_OHOS_BEGIN + 6)
#define __NR_dumpmemory (__NR_OHOS_BEGIN + 13) #define __NR_dumpmemory (__NR_OHOS_BEGIN + 13)
...@@ -91,8 +91,8 @@ The typical development process of adding a system call API is as follows: ...@@ -91,8 +91,8 @@ The typical development process of adding a system call API is as follows:
#define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0) #define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0)
#define __NR_pthread_join (__NR_OHOS_BEGIN + 1) #define __NR_pthread_join (__NR_OHOS_BEGIN + 1)
#define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2) #define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2)
#define __NR_creat_user_thread (__NR_OHOS_BEGIN + 3) #define __NR_create_user_thread (__NR_OHOS_BEGIN + 3)
#define __NR_processcreat (__NR_OHOS_BEGIN + 4) #define __NR_processcreate (__NR_OHOS_BEGIN + 4)
#define __NR_processtart (__NR_OHOS_BEGIN + 5) #define __NR_processtart (__NR_OHOS_BEGIN + 5)
#define __NR_printf (__NR_OHOS_BEGIN + 6) #define __NR_printf (__NR_OHOS_BEGIN + 6)
#define __NR_dumpmemory (__NR_OHOS_BEGIN + 13) #define __NR_dumpmemory (__NR_OHOS_BEGIN + 13)
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
- [Introduction to the Hi3861 Development Board](quickstart-lite-introduction-hi3861.md) - [Introduction to the Hi3861 Development Board](quickstart-lite-introduction-hi3861.md)
- [Introduction to the Hi3516 Development Board](quickstart-lite-introduction-hi3516.md) - [Introduction to the Hi3516 Development Board](quickstart-lite-introduction-hi3516.md)
- [Reference](quickstart-lite-reference.md) - [Reference](quickstart-lite-reference.md)
- [Burning Code by Using HiTool](quickstart-lite-hitool.md)
- [Overall Description of Compilation Form Factors](quickstart-build.md) - [Overall Description of Compilation Form Factors](quickstart-build.md)
- Getting Started with Standard System (IDE Mode, Recommended) - Getting Started with Standard System (IDE Mode, Recommended)
- [Standard System Overview](quickstart-ide-standard-overview.md) - [Standard System Overview](quickstart-ide-standard-overview.md)
...@@ -94,4 +95,5 @@ ...@@ -94,4 +95,5 @@
- [Introduction to the Hi3516 Development Board](quickstart-standard-board-introduction-hi3516.md) - [Introduction to the Hi3516 Development Board](quickstart-standard-board-introduction-hi3516.md)
- [Introduction to the RK3568 Development Board](quickstart-standard-board-introduction-rk3568.md) - [Introduction to the RK3568 Development Board](quickstart-standard-board-introduction-rk3568.md)
- [Reference](quickstart-standard-reference.md) - [Reference](quickstart-standard-reference.md)
- [Burning Code by Using HiTool](quickstart-standard-hitool.md)
- [Overall Description of Compilation Form Factors](quickstart-build.md) - [Overall Description of Compilation Form Factors](quickstart-build.md)
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册