提交 819ac7c3 编写于 作者: Y yuyaozhi

Merge branch 'master' of https://gitee.com/yuyaozhi/docs

Signed-off-by: Nyuyaozhi <yuyaozhi@h-partners.com>
......@@ -20,7 +20,7 @@ master:最新开发版本。
发布OpenHarmony 3.1 Beta版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.1-beta.md)
发布OpenHarmony 3.0 LTS版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0-LTS.md)。该版本已更新至OpenHarmony 3.0.1 LTS,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0.1-LTS.md)
发布OpenHarmony 3.0 LTS版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0-LTS.md)。该版本已更新至OpenHarmony 3.0.2 LTS,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0.2-LTS.md)
发布 OpenHarmony v2.2 Beta2版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v2.2-beta2.md)
......
......@@ -7,5 +7,9 @@
- [RDB Overview](database-relational-overview.md)
- [RDB Development](database-relational-guidelines.md)
- Lightweight Data Store
- [Lightweight Data Store Overview](database-preference-overview.md)
- [Lightweight Data Store Development](database-preference-guidelines.md)
\ No newline at end of file
- [Lightweight Data Store Overview](database-distributedobject-overview.md)
- [Lightweight Data Store Development](database-distributedobject-guidelines.md)
\ No newline at end of file
......@@ -124,7 +124,7 @@ Refer to the following descriptions about the parameters in the command:
## Generating the App Profile<a name="section2048641015325"></a>
The profile contains the following inforamtion about the OpenHarmony app: bundle name, digital certificate information, certificate permissions that can be applied for by the app, and devices where the app can be debugged \(the device list will be empty if the app type is Release\). Each app package must contain a profile file.
The profile contains the following information about the OpenHarmony app: bundle name, digital certificate information, certificate permissions that can be applied for by the app, and devices where the app can be debugged \(the device list will be empty if the app type is Release\). Each app package must contain a profile file.
Go to the **Sdk\\toolchains\\lib** directory, open the command-line tool, and run the following command.
......
......@@ -36,6 +36,7 @@
- [App Storage Statistics](js-apis-storage-statistics.md)
- [Volume Management](js-apis-volumemanager.md)
- Account Management
- [OS Account Management](js-apis-osAccount.md)
- [Distributed Account Management](js-apis-distributed-account.md)
- [App Account Management](js-apis-appAccount.md)
- Telephony Service
......
......@@ -9,15 +9,15 @@
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
```
## System Capabilities
SystemCapability.Security.AccessToken
## abilityAccessCtrl.createAtManager
createAtManager(): AtManager
Creates an **AtManager** instance, which is used for ability access control.
**System capability**: SystemCapability.Security.AccessToken
**Return value**
| Type| Description|
......@@ -38,25 +38,27 @@ Implements ability access control.
verifyAccessToken(tokenID: number, permissionName: string): Promise&lt;GrantStatus&gt;
Checks whether an application has been granted the specified permission. This method uses a promise to return the result.
Checks whether an application has been granted the specified permission. This API uses a promise to return the result.
**System capability**: SystemCapability.Security.AccessToken
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ------------------- | ---- | ------------------------------------------ |
| tokenID | number | Yes| ID of the application.|
| permissionName | string | Yes| Name of the permission to verify.|
| tokenID | number | Yes | ID of the application. |
| permissionName | string | Yes | Name of the permission to verify.|
**Return value**
| Type| Description|
| Type | Description |
| :------------ | :---------------------------------- |
| Promise&lt;GrantStatus&gt; | Promise instance used to return the result.|
**Example**
```
const AtManager = abilityAccessCtrl.createAtManager();
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
let promise = AtManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
promise.then(data => {
......@@ -68,28 +70,30 @@ promise.then(data => {
grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise&lt;number&gt;
Grants a user granted permission to an application. This method uses a promise to return the result.
Grants a user granted permission to an application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GRANT_SENSITIVE_PERMISSIONS
Required permission: ohos.permission.GRANT_SENSITIVE_PERMISSIONS
**System capability**: SystemCapability.Security.AccessToken
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| --------- | ------------------- | ---- | ------------------------------------------------------------ |
| tokenID | number | Yes| ID of the application.|
| permissionName | string | Yes| Name of the permission to grant.|
| permissionFlag | number | Yes| Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed.|
| tokenID | number | Yes | ID of the application. |
| permissionName | string | Yes | Name of the permission to grant.|
| permissionFlag | number | Yes | Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
**Return value**
| Type| Description|
| Type | Description |
| :------------ | :---------------------------------- |
| Promise&lt;number&gt; | Promise instance used to return the result.|
**Example**
```
const AtManager = abilityAccessCtrl.createAtManager();
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
let promise = AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
promise.then(data => {
......@@ -103,23 +107,25 @@ promise.then(data => {
grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback&lt;number&gt;): void
Grants a user granted permission to an application. This method uses an asynchronous callback to return the result.
Grants a user granted permission to an application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GRANT_SENSITIVE_PERMISSIONS
Required permission: ohos.permission.GRANT_SENSITIVE_PERMISSIONS
**System capability**: SystemCapability.Security.AccessToken
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| --------- | ------------------- | ---- | ------------------------------------------------------------ |
| tokenID | number | Yes| ID of the application.|
| permissionName | string | Yes| Name of the permission to grant.|
| permissionFlag | number | Yes| Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed.|
| tokenID | number | Yes | ID of the application. |
| permissionName | string | Yes | Name of the permission to grant.|
| permissionFlag | number | Yes | Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| callback | AsyncCallback&lt;number&gt; | Yes| Callback used to return the result.|
**Example**
```
const AtManager = abilityAccessCtrl.createAtManager();
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
let permissionFlag = 1;
AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => {
......@@ -131,28 +137,30 @@ AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_P
revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise&lt;number&gt;
Revokes a user granted permission given to an application. This method uses a promise to return the result.
Revokes a user granted permission given to an application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
Required permission: ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
**System capability**: SystemCapability.Security.AccessToken
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| --------- | ------------------- | ---- | ------------------------------------------------------------ |
| tokenID | number | Yes| ID of the application.|
| permissionName | string | Yes| Name of the permission to revoke.|
| permissionFlag | number | Yes| Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed.|
| tokenID | number | Yes | ID of the application. |
| permissionName | string | Yes | Name of the permission to revoke.|
| permissionFlag | number | Yes | Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
**Return value**
| Type| Description|
| Type | Description |
| :------------ | :---------------------------------- |
| Promise&lt;number&gt; | Promise instance used to return the result.|
**Example**
```
const AtManager = abilityAccessCtrl.createAtManager();
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
let permissionFlag = 1;
let promise = AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag);
......@@ -165,23 +173,25 @@ promise.then(data => {
revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback&lt;number&gt;): void
Revokes a user granted permission given to an application. This method uses an asynchronous callback to return the result.
Revokes a user granted permission given to an application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
Required permission: ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
**System capability**: SystemCapability.Security.AccessToken
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| --------- | ------------------- | ---- | ------------------------------------------------------------ |
| tokenID | number | Yes| ID of the application.|
| permissionName | string | Yes| Name of the permission to revoke.|
| permissionFlag | number | Yes| Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed.|
| tokenID | number | Yes | ID of the application. |
| permissionName | string | Yes | Name of the permission to revoke.|
| permissionFlag | number | Yes | Permission flag. The value **1** means that a dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| callback | AsyncCallback&lt;number&gt; | Yes| Callback used to return the result.|
**Example**
```
const AtManager = abilityAccessCtrl.createAtManager();
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => {
console.log(`callback: data->${JSON.stringify(data)}`);
......@@ -192,25 +202,27 @@ AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_
getPermissionFlags(tokenID: number, permissionName: string): Promise&lt;number&gt;
Obtains the flags of the specified permission of a given application. This method uses a promise to return the result.
Obtains the flags of the specified permission of a given application. This API uses a promise to return the result.
**System capability**: SystemCapability.Security.AccessToken
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| --------- | ------------------- | ---- | ------------------------------------------------------------ |
| tokenID | number | Yes| ID of the application.|
| permissionName | string | Yes| Name of the permission to query.|
| tokenID | number | Yes | ID of the application. |
| permissionName | string | Yes | Name of the permission to query.|
**Return value**
| Type| Description|
| Type | Description |
| :------------ | :---------------------------------- |
| Promise&lt;number&gt; | Promise instance used to return the result.|
**Example**
```
const AtManager = abilityAccessCtrl.createAtManager();
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
let promise = AtManager.getPermissionFlags(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
promise.then(data => {
......@@ -222,7 +234,9 @@ promise.then(data => {
Enumerates the permission grant states.
| Name| Default Value| Description|
**System capability:** SystemCapability.Security.AccessToken
| Name | Default Value | Description |
| ----------------------------- | ---------------------- | ----------------------- |
| PERMISSION_DENIED | -1 | Permission denied.|
| PERMISSION_GRANTED | 0 | Permission granted.|
| PERMISSION_DENIED | -1 | Permission denied. |
| PERMISSION_GRANTED | 0 | Permission granted. |
......@@ -13,7 +13,7 @@ Provides extension running information.
The extension running information is obtained through an **abilityManager** instance.
```
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => {
......@@ -24,30 +24,34 @@ abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => {
### Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| extension | ElementName | Yes| No| Information that matches an extension. <br><b>System capability</b>: SystemCapability.Ability.AbilityRuntime.Core|
| pid | number | Yes| No| Process ID. <br><b>System capability</b>: SystemCapability.Ability.AbilityRuntime.Core|
| uid | number | Yes| No| User ID. <br><b>System capability</b>: SystemCapability.Ability.AbilityRuntime.Core|
| processName | string | Yes| No| Process name. <br><b>System capability</b>: SystemCapability.Ability.AbilityRuntime.Core|
| startTime | number | Yes| No| Extension start time. <br><b>System capability</b>: SystemCapability.Ability.AbilityRuntime.Core|
| clientPackage | Array&lt;String&gt; | Yes| No| Names of all packages in the process. <br><b>System capability</b>: SystemCapability.Ability.AbilityRuntime.Core|
| type | [bundle.ExtensionAbilityType](#bundle-extensionabilitytype) | Yes| No| Extension type. <br><b>System capability</b>: SystemCapability.Ability.AbilityRuntime.Core|
| extension | ElementName | Yes| No| Information that matches an extension.|
| pid | number | Yes| No| Process ID.|
| uid | number | Yes| No| User ID.|
| processName | string | Yes| No| Process name.|
| startTime | number | Yes| No| Extension start time.|
| clientPackage | Array&lt;String&gt; | Yes| No| Names of all packages in the process.|
| type | [bundle.ExtensionAbilityType](#bundle-extensionabilitytype) | Yes| No| Extension type.|
## bundle.ExtensionAbilityType
Enumerates the extension types.
Enumerates extension types.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name| Value| Description|
| -------- | -------- | -------- |
| FORM | 0 | Extension information of the form type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| WORK_SCHEDULER | 1 | Extension information of the work scheduler type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| INPUT_METHOD | 2 | Extension information of the input method type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| SERVICE | 3 | Extension information of the service type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| ACCESSIBILITY | 4 | Extension information of the accessibility type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| DATA_SHARE | 5 | Extension information of the data share type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| FILE_SHARE | 6 | Extension information of the file share type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| STATIC_SUBSCRIBER | 7 | Extension information of the static subscriber type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| WALLPAPER | 8 | Extension information of the wallpaper type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| UNSPECIFIED | 9 | Extension information of the unspecified type. <br><b>System capability</b>: SystemCapability.BundleManager.BundleFramework|
| FORM | 0 | Extension information of the form type. |
| WORK_SCHEDULER | 1 | Extension information of the work scheduler type. |
| INPUT_METHOD | 2 | Extension information of the input method type. |
| SERVICE | 3 | Extension information of the service type. |
| ACCESSIBILITY | 4 | Extension information of the accessibility type. |
| DATA_SHARE | 5 | Extension information of the data share type. |
| FILE_SHARE | 6 | Extension information of the file share type. |
| STATIC_SUBSCRIBER | 7 | Extension information of the static subscriber type. |
| WALLPAPER | 8 | Extension information of the wallpaper type. |
| UNSPECIFIED | 9 | Extension information of the unspecified type. |
# Fault Logger
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
## Modules to Import
......@@ -8,14 +8,13 @@
import faultLogger from '@ohos.faultLogger'
```
## System Capabilities
SystemCapability.HiviewDFX.Hiview.FaultLogger
## FaultType
Enumerates the fault types.
**System capability**: SystemCapability.HiviewDFX.Hiview.FaultLogger
| Name| Default Value| Description|
| -------- | -------- | -------- |
| NO_SPECIFIC | 0 | No specific fault type.|
......@@ -27,6 +26,8 @@ Enumerates the fault types.
Defines the data structure of the fault log information.
**System capability**: SystemCapability.HiviewDFX.Hiview.FaultLogger
| Name| Type| Description|
| -------- | -------- | -------- |
| pid | number | Process ID of the faulty process.|
......@@ -42,14 +43,16 @@ Defines the data structure of the fault log information.
querySelfFaultLog(faultType: FaultType, callback: AsyncCallback&lt;Array&lt;FaultLogInfo&gt;&gt;) : void
Obtains the fault information about the current process. This method uses a callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
Obtains the fault information about the current process. This API uses a callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
**System capability**: SystemCapability.HiviewDFX.Hiview.FaultLogger
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array. <br/>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
| callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
**Example**
......@@ -73,14 +76,16 @@ function queryFaultLogCallback(error, value) {
}
}
}
faultLogger.querySelfFaultLog(faultlogger.FaultType.JS_CRASH, queryFaultLogCallback);
faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
```
## faultLogger.querySelfFaultLog
querySelfFaultLog(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&gt;;
querySelfFaultLog(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&gt;
Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
Obtains the fault information about the current process. This method uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
**System capability**: SystemCapability.HiviewDFX.Hiview.FaultLogger
**Parameters**
......@@ -92,25 +97,27 @@ Obtains the fault information about the current process. This method uses a prom
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**. <br/>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
**Example**
```
let value = await faultLogger.querySelfFaultLog(faultlogger.FaultType.JS_CRASH);
if (value) {
console.info("value length is " + value.length);
let len = value.length;
for (let i = 0; i < len; i++) {
console.info("log: " + i);
console.info("Log pid: " + value[i].pid);
console.info("Log uid: " + value[i].uid);
console.info("Log type: " + value[i].type);
console.info("Log ts: " + value[i].ts);
console.info("Log reason: " + value[i].reason);
console.info("Log module: " + value[i].module);
console.info("Log summary: " + value[i].summary);
console.info("Log text: " + value[i].fullLog);
async function getLog() {
let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH);
if (value) {
console.info("value length is " + value.length);
let len = value.length;
for (let i = 0; i < len; i++) {
console.info("log: " + i);
console.info("Log pid: " + value[i].pid);
console.info("Log uid: " + value[i].uid);
console.info("Log type: " + value[i].type);
console.info("Log ts: " + value[i].ts);
console.info("Log reason: " + value[i].reason);
console.info("Log module: " + value[i].module);
console.info("Log summary: " + value[i].summary);
console.info("Log text: " + value[i].fullLog);
}
}
}
```
此差异已折叠。
......@@ -10,7 +10,7 @@
import LinkedList from '@ohos.util.LinkedList'
```
## System Capabilities
## System Capability
SystemCapability.Utils.Lang
......@@ -452,7 +452,7 @@ callbackfn
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the entry that is currently traversed.|
| index | number | No| Position index of the entry that is currently traversed.|
| LinkedList | LinkedList&lt;T&gt; | No| Instance that invokes the **forEach** method.|
| LinkedList | LinkedList&lt;T&gt; | No| Instance that invokes the **forEach** API.|
**Example**
......
此差异已折叠。
......@@ -10,7 +10,7 @@
import PlainArray from '@ohos.util.PlainArray'
```
## System Capabilities
## System Capability
SystemCapability.Utils.Lang
......@@ -432,7 +432,7 @@ callbackfn
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the entry that is currently traversed.|
| key | number | Yes| Key of the entry that is currently traversed.|
| plainArray | PlainArray<number, T> | No| Instance that invokes the **forEach** method.|
| plainArray | PlainArray<number, T> | No| Instance that invokes the **forEach** API.|
**Example**
......
......@@ -262,7 +262,7 @@ var pres = process.getThreadPriority(tid);
## process.getStartRealtime<sup>8+</sup>
getStartRealtime() :number
getStartRealtime(): number
Obtains the duration, in milliseconds, from the time the system starts to the time the process starts.
......@@ -280,7 +280,7 @@ var realtime = process.getStartRealtime();
## process.getPastCputime<sup>8+</sup>
getPastCputime() :number
getPastCputime(): number
Obtains the CPU time (in milliseconds) from the time the process starts to the current time.
......
此差异已折叠。
......@@ -10,7 +10,7 @@
import Vector from '@ohos.util.Vector'
```
## System Capabilities
## System Capability
SystemCapability.Utils.Lang
......@@ -284,7 +284,7 @@ callbackfn
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the entry that is currently traversed.|
| index | number | No| Position index of the entry that is currently traversed.|
| vector | Vector&lt;T&gt; | No| Instance that invokes the **replaceAllElements** method.|
| vector | Vector&lt;T&gt; | No| Instance that invokes the **replaceAllElements** API.|
**Example**
......@@ -321,7 +321,7 @@ callbackfn
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the entry that is currently traversed.|
| index | number | No| Position index of the entry that is currently traversed.|
| vector | Vector&lt;T&gt; | No| Instance that invokes the **forEach** method.|
| vector | Vector&lt;T&gt; | No| Instance that invokes the **forEach** API.|
**Example**
......
......@@ -10,21 +10,16 @@
import vibrator from '@ohos.vibrator';
```
## System Capabilities
SystemCapability.Sensors.MiscDevice
## Required Permissions
ohos.permission.VIBRATE
## vibrator.vibrate
vibrate(duration: number): Promise&lt;void&gt;
Triggers vibration with a specific duration. This API uses a promise to return the execution result.
**Required permissions**: ohos.permission.VIBRATE (a system permission)
Triggers vibration with a specific duration. This method uses a promise to return the execution result.
**System capability**: SystemCapability.Sensors.MiscDevice
- Parameters
......@@ -52,7 +47,11 @@ Triggers vibration with a specific duration. This method uses a promise to retur
vibrate(duration: number, callback?: AsyncCallback&lt;void&gt;): void
Triggers vibration with a specific duration. This method uses a callback to return the execution result.
Triggers vibration with a specific duration. This API uses an asynchronous callback to return the execution result.
**Required permissions**: ohos.permission.VIBRATE (a system permission)
**System capability**: SystemCapability.Sensors.MiscDevice
- Parameters
| Name| Type| Mandatory| Description|
......@@ -76,7 +75,11 @@ Triggers vibration with a specific duration. This method uses a callback to retu
vibrate(effectId: EffectId): Promise&lt;void&gt;
Triggers vibration with a specific effect. This method uses a promise to return the execution result.
Triggers vibration with a specific effect. This API uses a promise to return the execution result.
**Required permissions**: ohos.permission.VIBRATE (a system permission)
**System capability**: SystemCapability.Sensors.MiscDevice
- Parameters
| Name| Type| Mandatory| Description|
......@@ -102,7 +105,11 @@ Triggers vibration with a specific effect. This method uses a promise to return
vibrate(effectId: EffectId, callback?: AsyncCallback&lt;void&gt;): void
Triggers vibration with a specific effect. This method uses a callback to return the execution result.
Triggers vibration with a specific effect. This API uses an asynchronous callback to return the execution result.
**Required permissions**: ohos.permission.VIBRATE (a system permission)
**System capability**: SystemCapability.Sensors.MiscDevice
- Parameters
| Name| Type| Mandatory| Description|
......@@ -126,7 +133,11 @@ Triggers vibration with a specific effect. This method uses a callback to return
stop(stopMode: VibratorStopMode): Promise&lt;void&gt;
Stops the vibration based on the specified **stopMode**. This method uses a promise to return the execution result. If the specified **stopMode** is different from the mode used to trigger the vibration, this method fails to be called.
Stops the vibration based on the specified **stopMode**. This API uses a promise to return the execution result. If the specified **stopMode** is different from the mode used to trigger the vibration, this API fails to be called.
**Required permissions**: ohos.permission.VIBRATE (a system permission)
**System capability**: SystemCapability.Sensors.MiscDevice
- Parameters
| Name| Type| Mandatory| Description|
......@@ -152,7 +163,11 @@ Stops the vibration based on the specified **stopMode**. This method uses a prom
stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void;
Stops the vibration based on the specified **stopMode**. This method uses an asynchronous callback to return the execution result. If the specified **stopMode** is different from the mode used to trigger the vibration, this method fails to be called.
Stops the vibration based on the specified **stopMode**. This API uses an asynchronous callback to return the execution result. If the specified **stopMode** is different from the mode used to trigger the vibration, this API fails to be called.
**Required permissions**: ohos.permission.VIBRATE (a system permission)
**System capability**: SystemCapability.Sensors.MiscDevice
- Parameters
| Name| Type| Mandatory| Description|
......@@ -176,6 +191,8 @@ Stops the vibration based on the specified **stopMode**. This method uses an asy
Describes the vibration effect.
**System capability**: SystemCapability.Sensors.MiscDevice
| Name| Default Value| Description|
| -------- | -------- | -------- |
| EFFECT_CLOCK_TIMER | "haptic.clock.timer" | Vibration effect of the vibrator when a user adjusts the timer.|
......@@ -185,6 +202,8 @@ Describes the vibration effect.
Describes the vibration mode to stop.
**System capability**: SystemCapability.Sensors.MiscDevice
| Name| Default Value| Description|
| -------- | -------- | -------- |
| VIBRATOR_STOP_MODE_TIME | "time" | The vibration to stop is in **duration** mode. This vibration is triggered with the parameter **duration** of the **number** type.|
......
此差异已折叠。
# Gauge
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
Data gauge chart widget, which is used to display data in a ring chart.
## Required Permissions
None
## Child Component
N/A
## APIs
Gauge(value:{value: number, min?: number, max?: number})
- Parameter
| Name | Type | Mandatory | Default&nbsp;Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| value | number | Yes | - | Current&nbsp;data&nbsp;value. |
| min | number | No | 0 | Minimum&nbsp;value&nbsp;of&nbsp;the&nbsp;current&nbsp;data&nbsp;segment. |
| max | number | No | 100 | Maximum&nbsp;value&nbsp;of&nbsp;the&nbsp;current&nbsp;data&nbsp;segment. |
## Attributes
| Name | Type | Default&nbsp;Value | Description |
| -------- | -------- | -------- | -------- |
| value | number | 0 | Sets&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;current&nbsp;data&nbsp;chart. |
| startAngle | Angle | -150 | Set&nbsp;the&nbsp;start&nbsp;angle.&nbsp;Clock&nbsp;0&nbsp;indicates&nbsp;0&nbsp;degree,&nbsp;and&nbsp;the&nbsp;clockwise&nbsp;direction&nbsp;indicates&nbsp;the&nbsp;positive&nbsp;angle. |
| endAngle | Angle | 150 | Sets&nbsp;the&nbsp;end&nbsp;angle&nbsp;position.&nbsp;The&nbsp;clock&nbsp;0&nbsp;point&nbsp;is&nbsp;0&nbsp;degree,&nbsp;and&nbsp;the&nbsp;clockwise&nbsp;direction&nbsp;is&nbsp;the&nbsp;positive&nbsp;angle. |
| colors | Color&nbsp;\|&nbsp;Array&lt;ColorStop&gt; | - | Set&nbsp;the&nbsp;color&nbsp;of&nbsp;the&nbsp;chart.&nbsp;You&nbsp;can&nbsp;set&nbsp;the&nbsp;pure&nbsp;color&nbsp;or&nbsp;segmental&nbsp;gradient&nbsp;color. |
| strokeWidth | Length | - | Sets&nbsp;the&nbsp;ring&nbsp;thickness&nbsp;of&nbsp;a&nbsp;ring&nbsp;chart. |
## Example
```
@Entry
@Component
struct GaugeExample {
build() {
Column() {
Gauge({ value: 50, min: 0, max: 100 })
.startAngle(210).endAngle(150)
.colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]])
.strokeWidth(20)
.width(200).height(200)
}.width('100%').margin({ top: 5 })
}
}
```
![en-us_image_0000001174422916](figures/en-us_image_0000001174422916.png)
# Radio
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **\<Radio>** component allows users to select from a set of mutually exclusive options.
## Required Permissions
None
## Child Components
None
## APIs
Radio(options: {value: string, group: string})
- Parameters
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| value | string | Yes| - | Value of the current radio button.|
| group | string | Yes| - | Name of the group to which the radio button belongs. Only one radio button in a given group can be selected at a time.|
## Attributes
| Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- |
| checked | boolean | false | Whether the radio button is selected.|
## Events
| Name| Description|
| -------- | -------- |
| onChange(callback: (value: boolean) => void) | Triggered when the selected state of the radio button changes.<br> -The value **true** means that the radio button is selected.<br> -The value **false** means that the radio button is not selected.|
## Example
```
@Entry
@Component
struct RadioExample {
build() {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Column() {
Text('Radio1')
Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
.height(50)
.width(50)
.onChange((value: boolean) => {
console.log('Radio1 status is ' + value)
})
}
Column() {
Text('Radio2')
Radio({ value: 'Radio2', group: 'radioGroup' }).checked(false)
.height(50)
.width(50)
.onChange((value: boolean) => {
console.log('Radio2 status is ' + value)
})
}
Column() {
Text('Radio3')
Radio({ value: 'Radio3', group: 'radioGroup' }).checked(false)
.height(50)
.width(50)
.onChange((value: boolean) => {
console.log('Radio3 status is ' + value)
})
}
}.padding({ top: 30 })
}
}
```
![](figures/radio.gif)
......@@ -20,8 +20,8 @@ Select(options: Array<SelectOption>)
| Name| Type| Mandatory| Default Value| Description|
| ------ | ----------------------------------------------- | ---- | ------ | -------------- |
| value | [ResourceStr](../../ui/ts-types.md#resourcestr) | Yes| - | Value of an option in the drop-down list box.|
| icon | [ResourceStr](../../ui/ts-types.md#resourcestr) | No| - | Icon of an option in the drop-down list box.|
| value | [ResourceStr](../../ui/ts-types.md#ResourceStr) | Yes| - | Value of an option in the drop-down list box.|
| icon | [ResourceStr](../../ui/ts-types.md#ResourceStr) | No| - | Icon of an option in the drop-down list box.|
## Attributes
......@@ -30,13 +30,13 @@ Select(options: Array<SelectOption>)
| selected | number | - | Index of the initial selected option in the drop-down list box. The index of the first option is **0**.|
| value | string | - | Text of the drop-down button.|
| font | [Font](../../ui/ts-types.md) | - | Text font of the drop-down button.|
| fontColor | [ResourceColor](../../ui/ts-types.md#resourcecolor) | - | Text color of the drop-down button.|
| selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md#resourcecolor) | - | Background color of the selected option in the drop-down list box.|
| fontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | Text color of the drop-down button.|
| selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | Background color of the selected option in the drop-down list box.|
| selectedOptionFont | [Font](../../ui/ts-types.md) | - | Text font of the selected option in the drop-down list box.|
| selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md#resourcecolor) | - | Text color of the selected option in the drop-down list box.|
| optionBgColor | [ResourceColor](../../ui/ts-types.md#resourcecolor) | - | Background color of an option in the drop-down list box.|
| selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | Text color of the selected option in the drop-down list box.|
| optionBgColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | Background color of an option in the drop-down list box.|
| optionFont | [Font](../../ui/ts-types.md) | - | Text font of an option in the drop-down list box.|
| optionFontColor | [ResourceColor](../../ui/ts-types.md#resourcecolor) | - | Text color of an option in the drop-down list box.|
| optionFontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | Text color of an option in the drop-down list box.|
## Events
......
......@@ -30,7 +30,7 @@ Slider(value:{value?: number, min?: number, max?: number, step?: number, style?:
| max | number | No | 100 | Maximum&nbsp;value. |
| step | number | No | 1 | Step&nbsp;of&nbsp;the&nbsp;slider.&nbsp;When&nbsp;the&nbsp;corresponding&nbsp;step&nbsp;is&nbsp;set,&nbsp;the&nbsp;slider&nbsp;slides&nbsp;intermittently. |
| style | SliderStyle | No | SliderStyle.OutSet | Style&nbsp;of&nbsp;the&nbsp;slider. |
| direction<sup>8+</sup> | [Axis](ts-appendix-enums.md) | No | Axis.Horizontal | Whether&nbsp;the&nbsp;slider&nbsp;moves&nbsp;horizontally&nbsp;or&nbsp;vertically. |
| direction<sup>8+</sup> | [Axis](../reference/arkui-ts/ts-appendix-enums.md#axis-enums) | No | Axis.Horizontal | Whether&nbsp;the&nbsp;slider&nbsp;moves&nbsp;horizontally&nbsp;or&nbsp;vertically. |
| reverse<sup>8+</sup> | boolean | No | false | Whether&nbsp;the&nbsp;slider&nbsp;values&nbsp;are&nbsp;reversed. |
- SliderStyle enums
......
# Stepper
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **&lt;Stepper&gt;** component provides a step navigator.
## Required Permissions
None
## Child Components
Only the child component **&lt;[StepperItem](ts-basic-components-stepperitem.md)&gt;** is supported.
## APIs
Stepper(value?: { index?: number })
- Parameters
| Name | Type | Mandatory | Default&nbsp;Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| index | number | No | 0 | Index&nbsp;of&nbsp;the&nbsp;**&lt;StepperItem&gt;**&nbsp;that&nbsp;is&nbsp;currently&nbsp;displayed. |
## Attributes
None
## Events
| Name | Description |
| -------- | -------- |
| onFinish(callback:&nbsp;()&nbsp;=&gt;&nbsp;void) | Triggered&nbsp;when&nbsp;the&nbsp;**nextLabel**&nbsp;of&nbsp;the&nbsp;last&nbsp;**&lt;StepperItem&gt;**&nbsp;in&nbsp;the&nbsp;**&lt;Stepper&gt;**&nbsp;is&nbsp;clicked. |
| onSkip(callback:&nbsp;()&nbsp;=&gt;&nbsp;void) | Triggered&nbsp;when&nbsp;the&nbsp;current&nbsp;**&lt;StepperItem&gt;**&nbsp;is&nbsp;**ItemState.Skip**&nbsp;and&nbsp;the&nbsp;**nextLabel**&nbsp;is&nbsp;clicked. |
| onChange(callback:&nbsp;(prevIndex?:&nbsp;number,&nbsp;index?:&nbsp;number)&nbsp;=&gt;&nbsp;void) | Triggered&nbsp;when&nbsp;the&nbsp;text&nbsp;button&nbsp;on&nbsp;the&nbsp;left&nbsp;or&nbsp;right&nbsp;is&nbsp;clicked&nbsp;to&nbsp;switch&nbsp;between&nbsp;steps.<br/>-&nbsp;**prevIndex**:&nbsp;index&nbsp;of&nbsp;the&nbsp;step&nbsp;page&nbsp;before&nbsp;the&nbsp;switching.<br/>-&nbsp;**index**:&nbsp;index&nbsp;of&nbsp;the&nbsp;step&nbsp;page&nbsp;after&nbsp;the&nbsp;switching,&nbsp;that&nbsp;is,&nbsp;index&nbsp;of&nbsp;the&nbsp;previous&nbsp;or&nbsp;next&nbsp;page. |
## Example
```
@Entry
@Component
struct StepperExample {
@State currentIndex: number = 0
@State firstState: ItemState = ItemState.Normal
@State secondState: ItemState = ItemState.Normal
build() {
Stepper({
index: this.currentIndex
}) {
StepperItem() {
Text('Page One')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
}
.nextLabel('')
.position({x: '35%', y: 0})
StepperItem() {
Text('Page Two')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
.onClick(()=>{
this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip
})
}
.nextLabel('Next')
.prevLabel('Previous')
.status(this.firstState)
.position({x: '35%', y: 0})
StepperItem() {
Text('Page Three')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
.onClick(()=>{
this.secondState = this.secondState === ItemState.Waiting ? ItemState.Normal : ItemState.Waiting
})
}
.position({x: '35%', y: 0})
.status(this.secondState)
StepperItem() {
Text('Page four')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
}
.position({x: '35%', y: 0})
.nextLabel('Finish')
}
.onFinish(() => {
console.log('onFinish')
})
.onSkip(() => {
console.log('onSkip')
})
.onChange((prevIndex: number, index: number) => {
this.currentIndex = index
})
.align(Alignment.Center)
}
}
```
![en-us_image_0000001250678457](figures/en-us_image_0000001250678457.gif)
# StepperItem
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **&lt;StepperItem&gt;** component provides an element for the **&lt;Stepper&gt;** component.
## Required Permissions
None
## Child Components
This component supports only one child component.
## APIs
StepperItem()
## Attributes
| Name | Type | Default&nbsp;Value | Description |
| -------- | -------- | -------- | -------- |
| prevLabel | string | - | When&nbsp;the&nbsp;**&lt;Stepper&gt;**&nbsp;contains&nbsp;more&nbsp;than&nbsp;one&nbsp;page,&nbsp;the&nbsp;default&nbsp;value&nbsp;for&nbsp;all&nbsp;pages&nbsp;except&nbsp;the&nbsp;first&nbsp;page&nbsp;is&nbsp;**Back**. |
| nextLabel | string | - | When&nbsp;the&nbsp;stepper&nbsp;contains&nbsp;more&nbsp;than&nbsp;one&nbsp;page,&nbsp;the&nbsp;default&nbsp;value&nbsp;for&nbsp;the&nbsp;last&nbsp;page&nbsp;is&nbsp;**Start**,&nbsp;and&nbsp;the&nbsp;default&nbsp;value&nbsp;for&nbsp;other&nbsp;pages&nbsp;is&nbsp;**Next**. |
| status | ItemState | ItemState.Normal | Status&nbsp;of&nbsp;the&nbsp;**&lt;StepperItem&gt;**. |
- ItemState enums
| Name | Description |
| -------- | -------- |
| Normal | The&nbsp;right&nbsp;button&nbsp;is&nbsp;clickable&nbsp;and&nbsp;can&nbsp;navigate&nbsp;users&nbsp;to&nbsp;the&nbsp;next&nbsp;**&lt;StepperItem&gt;**&nbsp;when&nbsp;it&nbsp;is&nbsp;clicked.. |
| Disabled | The&nbsp;right&nbsp;button&nbsp;is&nbsp;grayed&nbsp;out&nbsp;and&nbsp;unavailable. |
| Waiting | The&nbsp;right&nbsp;button&nbsp;is&nbsp;not&nbsp;displayed,&nbsp;and&nbsp;a&nbsp;progress&nbsp;bar&nbsp;is&nbsp;displayed&nbsp;instead. |
| Skip | The&nbsp;current&nbsp;**&lt;StepperItem&gt;**&nbsp;is&nbsp;skipped,&nbsp;and&nbsp;the&nbsp;next&nbsp;**&lt;StepperItem&gt;**&nbsp;is&nbsp;displayed. |
## Example
See [Stepper](ts-basic-components-stepper.md).
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册