提交 b498a42a 编写于 作者: Y yuyaozhi

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

......@@ -435,6 +435,7 @@ zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md @cheng_guohong
zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @aqxyjay @zengyawen @aqxyjay @alien0208
zh-cn/application-dev/reference/apis/js-apis-system-cipher.md @gaoyong @zengyawen @niejiteng @jumozhanjiang
zh-cn/application-dev/reference/apis/js-apis-system-configuration.md @Buda-Liu @ningningW @budda-wang @tomatodevboy
zh-cn/application-dev/reference/apis/js-apis-system-date-time.md @feng-aiwen @ningningW @illybyy @murphy1984
zh-cn/application-dev/reference/apis/js-apis-system-device.md @mupceet @zengyawen @handyohos @nan-xiansen
zh-cn/application-dev/reference/apis/js-apis-system-fetch.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785
zh-cn/application-dev/reference/apis/js-apis-system-file.md @panqinxu @zengyawen @bubble_mao @jinhaihw
......@@ -520,7 +521,7 @@ zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @shuaytao @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md @shuaytao @RayShih @wangzhen107 @inter515
zh-cn/application-dev/reference/apis/js-apis-colorSpaceManager.md @zhangqiang183 @ge-yafang @wind_zj @zxg-gitee
zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md @jayleehw @RayShih @li-weifeng2 @currydavids
zh-cn/application-dev/reference/apis/js-apis-configPolicy.md @Buda-Liu @ningningW @budda-wang @yangqing3
zh-cn/application-dev/reference/apis/js-apis-configPolicy.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-cooperate.md @yuanxinying @ningningW @cococoler @alien0208
zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @gaoyong @zengyawen @niejiteng @jumozhanjiang
zh-cn/application-dev/reference/apis/js-apis-cert.md @gaoyong @zengyawen @niejiteng @jumozhanjiang
......@@ -528,8 +529,13 @@ zh-cn/application-dev/reference/apis/js-apis-curve.md @huaweimaxuchu @HelloCreas
zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md @shuaytao @RayShih @wangzhen107 @inter515
zh-cn/application-dev/reference/apis/js-apis-distributedBundle.md @shuaytao @RayShih @wangzhen107 @inter515
zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md @Buda-Liu @ningningW @budda-wang @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md @Buda-Liu @ningningW @budda-wang @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-fileAccess.md @panqinxu @zengyawen @bubble_mao @jinhaihw
zh-cn/application-dev/reference/apis/js-apis-fileExtensionInfo.md @panqinxu @zengyawen @bubble_mao @jinhaihw
zh-cn/application-dev/reference/apis/js-apis-freeInstall.md @shuaytao @RayShih @wangzhen107 @inter515
......
......@@ -108,7 +108,7 @@ You write a UI test script based on the unit test framework, adding the invoking
In this example, the UI test script is written based on the preceding unit test script. First, add the dependency package, as shown below:
```js
import {UiDriver,BY,UiComponent,MatchPattern} from '@ohos.uitest'
import {Driver,ON,Component,MatchPattern} from '@ohos.uitest'
```
Then, write specific test code. Specifically, implement the click action on the started application page and add checkpoint check cases.
......@@ -131,16 +131,16 @@ export default function abilityTest() {
expect(Ability.context.abilityInfo.name).assertEqual('EntryAbility');
})
//ui test code
//init uidriver
var driver = await UiDriver.create();
//init driver
var driver = await Driver.create();
await driver.delayMs(1000);
//find button by text 'Next'
var button = await driver.findComponent(BY.text('Next'));
//find button on text 'Next'
var button = await driver.findComponent(ON.text('Next'));
//click button
await button.click();
await driver.delayMs(1000);
//check text
await driver.assertComponentExist(BY.text('after click'));
await driver.assertComponentExist(ON.text('after click'));
await driver.pressBack();
done();
})
......@@ -195,14 +195,15 @@ The framework supports multiple test case execution modes, which are triggered b
| itName | Test case to be executed. | {itName} | -s itName testAttributeIt |
| timeout | Timeout interval for executing a test case. | Positive integer (unit: ms). If no value is set, the default value 5000 is used. | -s timeout 15000 |
| breakOnError | Whether to enable break-on-error mode. When this mode is enabled, the test execution process exits if a test assertion error or any other error occurs.| **true**/**false** (default value) | -s breakOnError true |
| random | Whether to execute test cases in random sequence.| **true**/**false** (default value) | -s random true |
| testType | Type of the test case to be executed. | function, performance, power, reliability, security, global, compatibility, user, standard, safety, resilience| -s testType function |
| level | Level of the test case to be executed. | 0, 1, 2, 3, 4 | -s level 0 |
| size | Size of the test case to be executed. | small, medium, large | -s size small |
| size | Size of the test case to be executed. | small, medium, large | -s size small |
| stress | Number of times that the test case is executed. | Positive integer | -s stress 1000 |
**Running Commands**
> Configure hdc-related environment variables, and then perform the following:
> Before running commands in the CLI, make sure hdc-related environment variables have been configured.
- Open the CLI.
- Run the **aa test** commands.
......
# Device
# Device Management
- USB Service
- [USB Service Overview](usb-overview.md)
- [USB Service Development](usb-guidelines.md)
- Location
- [Location Service Development](location-guidelines.md)
- Multimodal Input
- [Input Device Development](inputdevice-guidelines.md)
- [Mouse Pointer Development](pointerstyle-guidelines.md)
- Sensor
- [Sensor Overview](sensor-overview.md)
- [Sensor Development](sensor-guidelines.md)
- Vibrator
- [Vibrator Overview](vibrator-overview.md)
- [Vibrator Development](vibrator-guidelines.md)
- Multimodal Input
- [Input Device Development](inputdevice-guidelines.md)
- [Mouse Pointer Development](pointerstyle-guidelines.md)
- Update Service
- [Sample Server Overview](sample-server-overview.md)
- [Sample Server Development](sample-server-guidelines.md)
- USB Service
- [USB Service Overview](usb-overview.md)
- [USB Service Development](usb-guidelines.md)
- Vibrator
- [Vibrator Overview](vibrator-overview.md)
- [Vibrator Development](vibrator-guidelines.md)
\ No newline at end of file
- Stationary
- [Stationary Development](stationary-guidelines.md)
# Stationary Development
## When to Use
An application can call the **Stationary** module to obtain the device status, for example, whether the device is absolutely or relatively still.
For details about the APIs, see [Stationary](../reference/apis/js-apis-stationary.md).
## Device Status Type Parameters
| Name| Description|
| -------- | -------- |
| still | Absolutely still.|
| relativeStill | Relatively still.|
## Parameters for Subscribing to Device Status events
| Name | Value | Description |
| ------------------------------ | ---- | ---------------------------------------- |
| ENTER | 1 | Event indicating entering device status. |
| EXIT | 2 | Event indicating exiting device status.|
| ENTER_EXIT | 3 | Event indicating entering and exiting device status.|
## Returned Device Status Parameters
| Name | Value | Description |
| ------------------------------ | ---- | ---------------------------------------- |
| ENTER | 1 | Entering device status. |
| EXIT | 2 | Exiting device status.|
## Available APIs
| Module | Name | Description |
| ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ohos.stationary | on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback<ActivityResponse>): void | Subscribes to the device status. This API uses an asynchronous callback to return the result.|
| ohos.stationary | once(activity: ActivityType, callback: Callback<ActivityResponse>): void | Obtains the device status. This API uses an asynchronous callback to return the result.|
| ohos.stationary | off(activity: ActivityType, event: ActivityEvent, callback?: Callback<ActivityResponse>): void | Unsubscribes from the device status. |
## Constraints
The device must support the acceleration sensor.
## How to Develop
1. Subscribe to the event indicating entering the absolute still state, and the event is reported every 1 second.
```js
import stationary from '@ohos.stationary';
var reportLatencyNs = 1000000000;
try {
stationary.on('still', stationary.ActivityEvent.ENTER, reportLatencyNs, (data) => {
console.log('data='+ JSON.stringify(data));
})
} catch (err) {
console.error('errCode: ' + err.code + ' ,msg: ' + err.message);
}
```
2. Obtain the event indicating entering the absolute still state.
```js
import stationary from '@ohos.stationary';
try {
stationary.once('still', (data) => {
console.log('data='+ JSON.stringify(data));
})
} catch (err) {
console.error('errCode: ' + err.code + ' ,msg: ' + err.message);
}
```
3. Unsubscribe from the event indicating entering the absolute still state.
```js
import stationary from '@ohos.stationary';
try {
stationary.off('still', stationary.ActivityEvent.ENTER, (data) => {
console.log('data='+ JSON.stringify(data));
})
} catch (err) {
console.error('errCode: ' + err.code + ' ,msg: ' + err.message);
}
```
......@@ -35,7 +35,7 @@ resources
| Category | base Subdirectory | Qualifiers Subdirectory | rawfile Subdirectory |
| ---- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.<br>Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You need to create qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectories](#qualifiers-subdirectories).<br>Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories). | You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.<br>However, resource files in the **rawfile** subdirectory will not be matched based on the device status.|
| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.<br>Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You need to create qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectories](#qualifiers-subdirectories).<br>Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.<br>However, resource files in the **rawfile** subdirectory will not be matched based on the device status.|
| Compilation| Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are directly packed into the application without being compiled, and no IDs will be assigned to the resource files. |
| Reference| Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the file path and file name. |
......@@ -81,9 +81,9 @@ You can create resource group subdirectories (including element, media, and prof
| Resource Group Subdirectory | Description | Resource File |
| ------- | ---------------------------------------- | ---------------------------------------- |
| element | Indicates element resources. Each type of data is represented by a JSON file. The options are as follows:<br>- **boolean**: boolean data<br>- **color**: color data<br>- **float**: floating-point data<br>- **intarray**: array of integers<br>- **integer**: integer data<br>- **pattern**: pattern data<br>- **plural**: plural form data<br>- **strarray**: array of strings<br>- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:<br>- boolean.json<br>- color.json<br>- float.json<br>- intarray.json<br>- integer.json<br>- pattern.json<br>- plural.json<br>- strarray.json<br>- string.json |
| media | Indicates media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. |
| profile | Indicates a user-defined configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. | The file name can be customized, for example, **test_profile.json**. |
| element | Indicates element resources. Each type of data is represented by a JSON file. (Only files are supported in this directory.) The options are as follows:<br>- **boolean**: boolean data<br>- **color**: color data<br>- **float**: floating-point data<br>- **intarray**: array of integers<br>- **integer**: integer data<br>- **pattern**: pattern data<br>- **plural**: plural form data<br>- **strarray**: array of strings<br>- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:<br>- boolean.json<br>- color.json<br>- float.json<br>- intarray.json<br>- integer.json<br>- pattern.json<br>- plural.json<br>- strarray.json<br>- string.json |
| media | Indicates media resources, including non-text files such as images, audios, and videos. (Only files are supported in this directory.) | The file name can be customized, for example, **icon.png**. |
| profile | Indicates a custom configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. (Only files are supported in this directory.) | The file name can be customized, for example, **test_profile.json**. |
| rawfile | Indicates other types of files, which are stored in their raw formats after the application is built as an HAP file. They will not be integrated into the **resources.index** file.| The file name can be customized. |
**Media Resource Types**
......@@ -229,7 +229,7 @@ When referencing resources in the **rawfile** subdirectory, use the **"$rawfile(
>
> Resource descriptors accept only strings, such as **'app.type.name'**, and cannot be combined.
>
> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md) API.
> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md#getstringvalue9) API.
In the **.ets** file, you can use the resources defined in the **resources** directory. The following is a resource usage example based on the resource file examples in [Resource Group Sub-directories](#resource-group-subdirectories):
......@@ -252,7 +252,6 @@ Text($r('app.string.message_arrive', "five'o clock"))
Text($r('app.plural.eat_apple', 5, 5))
.fontColor($r('app.color.color_world'))
.fontSize($r('app.float.font_world'))
}
Image($r('app.media.my_background_image')) // Reference media resources.
......
......@@ -157,7 +157,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead.
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\<Array\<BundleInfo\>\>
Obtains the information of all bundles of the specified user. This API uses a promise to return the result.
......@@ -201,7 +201,7 @@ bundle.getAllBundleInfo(bundleFlag, userId)
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead.
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\<Array\<BundleInfo\>\>): void
Obtains the information of all bundles of the current user. This API uses an asynchronous callback to return the result.
......@@ -238,7 +238,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead.
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\<Array\<BundleInfo\>\>): void
Obtains the information of all bundles of the specified user. This API uses an asynchronous callback to return the result.
......@@ -823,7 +823,7 @@ bundle.getPermissionDef(permissionName).then((data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead.
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array\<ApplicationInfo>>
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\<Array\<ApplicationInfo\>\>
Obtains the information about all applications of the specified user. This API uses a promise to return the result.
......@@ -865,7 +865,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId)
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead.
getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array\<ApplicationInfo>>): void
getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<ApplicationInfo\>\>): void
Obtains the information about all applications. This API uses an asynchronous callback to return the result.
......@@ -1320,7 +1320,7 @@ bundle.isApplicationEnabled(bundleName, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead.
queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array\<AbilityInfo>>
queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\<Array\<AbilityInfo\>\>
Obtains the ability information based on given Want. This API uses a promise to return the result.
......@@ -1371,7 +1371,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId)
> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead.
queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback<Array\<AbilityInfo>>): void
queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void
Obtains the ability information of the specified user based on given Want. This API uses an asynchronous callback to return the result.
......@@ -1416,7 +1416,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead.
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void;
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void;
Obtains the ability information based on given Want. This API uses an asynchronous callback to return the result.
......
......@@ -57,8 +57,12 @@ featureAbility.startAbility(
uri: ''
},
},
(err, data) => {
console.info('startAbility err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
(error, data) => {
if (error && error.code !== 0) {
console.error('startAbility fail, error: ${JSON.stringify(error)}');
} else {
console.log('startAbility success, data: ${JSON.stringify(data)}');
}
}
);
```
......@@ -99,7 +103,7 @@ featureAbility.startAbility(
{
want:
{
action: 'action.system.home',
action: 'ohos.want.action.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
......@@ -182,7 +186,7 @@ featureAbility.startAbilityForResult(
{
want:
{
action: 'action.system.home',
action: 'ohos.want.action.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
......@@ -193,8 +197,12 @@ featureAbility.startAbilityForResult(
uri:''
},
},
(err, data) => {
console.info('startAbilityForResult err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
(error, data) => {
if (error && error.code !== 0) {
console.error('startAbilityForResult fail, error: ${JSON.stringify(error)}');
} else {
console.log('startAbilityForResult success, data: ${JSON.stringify(data)}');
}
}
);
```
......@@ -236,7 +244,7 @@ featureAbility.startAbilityForResult(
{
want:
{
action: 'action.system.home',
action: 'ohos.want.action.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
......@@ -288,7 +296,7 @@ featureAbility.terminateSelfWithResult(
resultCode: 1,
want:
{
action: 'action.system.home',
action: 'ohos.want.action.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
......@@ -309,8 +317,8 @@ featureAbility.terminateSelfWithResult(
}
},
},
(err) => {
console.error('err: ${JSON.stringify(err)}');
(error) => {
console.error('error: ${JSON.stringify(error)}');
}
);
```
......@@ -345,7 +353,7 @@ featureAbility.terminateSelfWithResult(
resultCode: 1,
want:
{
action: 'action.system.home',
action: 'ohos.want.action.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
......@@ -389,8 +397,12 @@ Checks whether the main window of this ability has the focus. This API uses an a
```ts
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.hasWindowFocus((err, data) => {
console.info('hasWindowFocus err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
featureAbility.hasWindowFocus((error, data) => {
if (error && error.code !== 0) {
console.error('hasWindowFocus fail, error: ${JSON.stringify(error)}');
} else {
console.log('hasWindowFocus success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -435,8 +447,12 @@ Obtains the Want corresponding to the ability to start. This API uses an asynchr
```ts
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.getWant((err, data) => {
console.info('getWant err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
featureAbility.getWant((error, data) => {
if (error && error.code !== 0) {
console.error('getWant fail, error: ${JSON.stringify(error)}');
} else {
console.log('getWant success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -482,8 +498,12 @@ Obtains the application context.
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getBundleName((err, data) => {
console.info('getBundleName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getBundleName((error, data) => {
if (error && error.code !== 0) {
console.error('getBundleName fail, error: ${JSON.stringify(error)}');
} else {
console.log('getBundleName success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -506,8 +526,8 @@ Terminates this ability. This API uses an asynchronous callback to return the re
```ts
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.terminateSelf(
(err) => {
console.error('err: ${JSON.stringify(err)}');
(error) => {
console.error('error: ${JSON.stringify(error)}');
}
)
```
......@@ -574,7 +594,7 @@ function onDisconnectCallback(element){
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}')
}
function onFailedCallback(code){
console.log('featureAbilityTest ConnectAbility onFailed errCode : ${code}')
console.error('featureAbilityTest ConnectAbility onFailed errCode : ${code}')
}
let connectId = featureAbility.connectAbility(
{
......@@ -617,7 +637,7 @@ function onDisconnectCallback(element){
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
}
function onFailedCallback(code){
console.log('featureAbilityTest ConnectAbility onFailed errCode : ${code}');
console.error('featureAbilityTest ConnectAbility onFailed errCode : ${code}');
}
let connectId = featureAbility.connectAbility(
{
......@@ -631,8 +651,12 @@ let connectId = featureAbility.connectAbility(
},
);
featureAbility.disconnectAbility(connectId, (err) => {
console.error('featureAbilityTest disconnectAbility err: ${JSON.stringify(err)}');
featureAbility.disconnectAbility(connectId, (error) => {
if (error && error.code !== 0) {
console.error('disconnectAbility fail, connectId: ${connectId}, error: ${JSON.stringify(error)}');
} else {
console.log('disconnectAbility success, connectId: ${connectId}');
}
});
```
......@@ -668,7 +692,7 @@ function onDisconnectCallback(element){
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
}
function onFailedCallback(code){
console.log('featureAbilityTest ConnectAbility onFailed errCode : ${code}');
console.error('featureAbilityTest ConnectAbility onFailed errCode : ${code}');
}
let connectId = featureAbility.connectAbility(
{
......@@ -707,8 +731,12 @@ Obtains the window corresponding to this ability. This API uses an asynchronous
**Example**
```ts
featureAbility.getWindow((err, data) => {
console.info('getWindow err: ${JSON.stringify(err)}, data: ${typeof(data)}');
featureAbility.getWindow((error, data) => {
if (error && error.code !== 0) {
console.error('getWindow fail, error: ${JSON.stringify(error)}');
} else {
console.log('getWindow success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -823,6 +851,6 @@ Enumerates the flags that specify how the Want will be handled.
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible. |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for [Want](js-apis-application-want.md) under the [parameter](js-apis-inner-ability-startAbilityParameter.md) object passed to the [startAbility](#featureabilitystartability) API in **FeatureAbility**. It must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on an existing mission stack. |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Reuses an ability instance if it is on the top of an existing mission stack; creates an ability instance otherwise.|
......@@ -47,7 +47,7 @@ particleAbility.startAbility(
{
want:
{
action: 'action.system.home',
action: 'ohos.want.action.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
......@@ -57,8 +57,12 @@ particleAbility.startAbility(
uri: ''
},
},
(error, result) => {
console.error('particleAbility startAbility errCode: ${JSON.stringify(error)}, result: ${JSON.stringify(result)}');
(error, data) => {
if (error && error.code !== 0) {
console.error('startAbility fail, error: ${JSON.stringify(error)}');
} else {
console.log('startAbility success, data: ${JSON.stringify(data)}');
}
},
);
```
......@@ -98,7 +102,7 @@ particleAbility.startAbility(
{
want:
{
action: 'action.system.home',
action: 'ohos.want.action.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
......@@ -133,8 +137,12 @@ Terminates this ParticleAbility. This API uses an asynchronous callback to retur
import particleAbility from '@ohos.ability.particleAbility';
particleAbility.terminateSelf(
(error, result) => {
console.log('particleAbility terminateSelf errCode: ${JSON.stringify(error)}, result: ${JSON.stringify(result)}');
(error, data) => {
if (error && error.code !== 0) {
console.error('terminateSelf fail, error: ${JSON.stringify(error)}');
} else {
console.log('terminateSelf success, data: ${JSON.stringify(data)}');
}
}
);
```
......@@ -226,11 +234,11 @@ import notification from '@ohos.notification';
import particleAbility from '@ohos.ability.particleAbility';
import wantAgent from '@ohos.app.ability.wantAgent';
function callback(err, data) {
if (err) {
console.error('Operation failed cause: ${JSON.stringify(err)}');
function callback(error, data) {
if (error && error.code !== 0) {
console.error('Operation failed error: ${JSON.stringify(error)}');
} else {
console.info('Operation succeeded');
console.info('Operation succeeded, data: ${data}');
}
}
......@@ -349,11 +357,11 @@ Requests to cancel a continuous task from the system. This API uses an asynchron
```ts
import particleAbility from '@ohos.ability.particleAbility';
function callback(err, data) {
if (err) {
console.error('Operation failed cause: ${JSON.stringify(err)}');
function callback(error, data) {
if (error && error.code !== 0) {
console.error('Operation failed error: ${JSON.stringify(error)}');
} else {
console.info('Operation succeeded');
console.info('Operation succeeded, data: ${data}');
}
}
......@@ -421,11 +429,11 @@ function onConnectCallback(element, remote) {
}
function onDisconnectCallback(element) {
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
console.log('ConnectAbility onDisconnect element.deviceId: ${element.deviceId}');
}
function onFailedCallback(code) {
console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}');
console.error('particleAbilityTest ConnectAbility onFailed errCode: ${code}');
}
let connId = particleAbility.connectAbility(
......@@ -441,9 +449,9 @@ let connId = particleAbility.connectAbility(
);
particleAbility.disconnectAbility(connId).then((data) => {
console.log(' data: ${data}');
console.log('data: ${data}');
}).catch((error) => {
console.log('particleAbilityTest result errCode : ${error.code}');
console.error('particleAbilityTest result errCode: ${error.code}');
});
```
......@@ -472,11 +480,11 @@ function onConnectCallback(element, remote) {
}
function onDisconnectCallback(element) {
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
console.log('ConnectAbility onDisconnect element.deviceId: ${element.deviceId}');
}
function onFailedCallback(code) {
console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}');
console.error('particleAbilityTest ConnectAbility onFailed errCode: ${code}');
}
let connId = particleAbility.connectAbility(
......@@ -492,7 +500,7 @@ let connId = particleAbility.connectAbility(
);
particleAbility.disconnectAbility(connId, (err) => {
console.log('particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}');
console.error('particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}');
});
```
......@@ -522,11 +530,11 @@ function onConnectCallback(element, remote) {
}
function onDisconnectCallback(element) {
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
console.log('ConnectAbility onDisconnect element.deviceId: ${element.deviceId}');
}
function onFailedCallback(code) {
console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}');
console.error('particleAbilityTest ConnectAbility onFailed errCode: ${code}');
}
let connId = particleAbility.connectAbility(
......@@ -544,7 +552,7 @@ let connId = particleAbility.connectAbility(
particleAbility.disconnectAbility(connId).then((data) => {
console.log(' data: ${data}');
}).catch((error) => {
console.log('particleAbilityTest result errCode : ${error.code}');
console.error('particleAbilityTest result errCode : ${error.code}');
});
```
......
......@@ -35,8 +35,8 @@ Enumerates the initial ability launch reasons. You can use it together with [onC
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.|
| START_ABILITY | 1 | The ability is started by calling [startAbility](js-apis-ability-context.md#abilitycontextstartability).|
| CALL | 2 | The ability is started by calling [startAbilityByCall](js-apis-ability-context.md#abilitycontextstartabilitybycall).|
| START_ABILITY | 1 | The ability is started by calling [startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability).|
| CALL | 2 | The ability is started by calling [startAbilityByCall](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilitybycall).|
| CONTINUATION | 3 | The ability is started by means of cross-device migration.|
| APP_RECOVERY | 4 | The ability is automatically started when the application is restored from a fault.|
......@@ -135,7 +135,7 @@ let option = {
this.context.startAbility(want, option).then(()={
console.log('Succeed to start ability.');
}).catch((error)=>{
console.log('Failed to start ability with error: ${JSON.stringify(error)}');
console.error('Failed to start ability with error: ${JSON.stringify(error)}');
});
```
......
......@@ -56,7 +56,7 @@ abilityDelegator.startAbility(want, (err) => {
if (!err || err.code === 0) {
console.log('Success start ability.');
} else {
console.log('Failed start ability, error: ${JSON.stringify(err)}');
console.error('Failed start ability, error: ${JSON.stringify(err)}');
}
});
```
......
......@@ -277,7 +277,7 @@ export default class MyFirstAbility extends UIAbility {
globalThis.lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback);
console.log('registerAbilityLifecycleCallback number: ${JSON.stringify(lifecycleId)}');
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
}
}
......@@ -293,7 +293,7 @@ export default class MySecondAbility extends UIAbility {
// 3. Deregister the listener for the ability lifecycle changes through the applicationContext object.
applicationContext.off('abilityLifecycle', globalThis.lifecycleId, (error) => {
if (error && error.code !== 0) {
console.log('unregisterAbilityLifecycleCallback fail, error: ${JSON.stringify(error)}');
console.error('unregisterAbilityLifecycleCallback fail, error: ${JSON.stringify(error)}');
} else {
console.log('unregisterAbilityLifecycleCallback success.');
}
......
......@@ -105,7 +105,7 @@ let observer = {
try {
errorManager.on('error', observer);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -139,6 +139,6 @@ let observer = {
try {
errorManager.on('error', observer);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions';
try {
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -49,6 +49,6 @@ import StartOptions from '@ohos.app.ability.StartOptions';
});
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -136,7 +136,7 @@ import Want from '@ohos.app.ability.Want';
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
console.log('openSync fail: ${JSON.stringify(e)}');
console.error('openSync fail: ${JSON.stringify(e)}');
}
let want = {
'deviceId': '', // An empty deviceId indicates the local device.
......
......@@ -59,6 +59,6 @@ try {
};
formBindingData.createFormBindingData(obj);
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -46,13 +46,13 @@ try {
let formId = '12400633174999288';
formHost.deleteForm(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost deleteForm success');
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -96,10 +96,10 @@ try {
formHost.deleteForm(formId).then(() => {
console.log('formHost deleteForm success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -136,11 +136,11 @@ try {
let formId = '12400633174999288';
formHost.releaseForm(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -178,11 +178,11 @@ try {
let formId = '12400633174999288';
formHost.releaseForm(formId, true, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -226,10 +226,10 @@ try {
formHost.releaseForm(formId, true).then(() => {
console.log('formHost releaseForm success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -266,11 +266,11 @@ try {
let formId = '12400633174999288';
formHost.requestForm(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -313,10 +313,10 @@ try {
formHost.requestForm(formId).then(() => {
console.log('formHost requestForm success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -354,11 +354,11 @@ try {
let formId = '12400633174999288';
formHost.castToNormalForm(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -401,10 +401,10 @@ try {
formHost.castToNormalForm(formId).then(() => {
console.log('formHost castTempForm success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -441,11 +441,11 @@ try {
let formId = ['12400633174999288'];
formHost.notifyVisibleForms(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -488,10 +488,10 @@ try {
formHost.notifyVisibleForms(formId).then(() => {
console.log('formHost notifyVisibleForms success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -528,11 +528,11 @@ try {
let formId = ['12400633174999288'];
formHost.notifyInvisibleForms(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -575,10 +575,10 @@ try {
formHost.notifyInvisibleForms(formId).then(() => {
console.log('formHost notifyInvisibleForms success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -615,11 +615,11 @@ try {
let formId = ['12400633174999288'];
formHost.enableFormsUpdate(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -662,10 +662,10 @@ try {
formHost.enableFormsUpdate(formId).then(() => {
console.log('formHost enableFormsUpdate success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -702,11 +702,11 @@ try {
let formId = ['12400633174999288'];
formHost.disableFormsUpdate(formId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -749,10 +749,10 @@ try {
formHost.disableFormsUpdate(formId).then(() => {
console.log('formHost disableFormsUpdate success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -778,11 +778,11 @@ import formHost from '@ohos.app.form.formHost';
try {
formHost.isSystemReady((error, data) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -809,10 +809,10 @@ try {
formHost.isSystemReady().then(() => {
console.log('formHost isSystemReady success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -840,13 +840,13 @@ import formHost from '@ohos.app.form.formHost';
try {
formHost.getAllFormsInfo((error, data) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost getAllFormsInfo, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -875,10 +875,10 @@ try {
formHost.getAllFormsInfo().then((data) => {
console.log('formHost getAllFormsInfo data: ${JSON.stringify(data)}');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -914,13 +914,13 @@ import formHost from '@ohos.app.form.formHost';
try {
formHost.getFormsInfo('com.example.ohos.formjsdemo', (error, data) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost getFormsInfo, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -957,13 +957,13 @@ import formHost from '@ohos.app.form.formHost';
try {
formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry', (error, data) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost getFormsInfo, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1006,10 +1006,10 @@ try {
formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry').then((data) => {
console.log('formHost getFormsInfo, data: ${JSON.stringify(data)}');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1039,13 +1039,13 @@ try {
let formIds = new Array('12400633174999288', '12400633174999289');
formHost.deleteInvalidForms(formIds, (error, data) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost deleteInvalidForms, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1081,10 +1081,10 @@ try {
formHost.deleteInvalidForms(formIds).then((data) => {
console.log('formHost deleteInvalidForms, data: ${JSON.stringify(data)}');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1130,13 +1130,13 @@ let want = {
try {
formHost.acquireFormState(want, (error, data) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost acquireFormState, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1188,10 +1188,10 @@ try {
formHost.acquireFormState(want).then((data) => {
console.log('formHost acquireFormState, data: ${JSON.stringify(data)}');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1281,11 +1281,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
try {
formHost.notifyFormsVisible(formIds, true, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1329,10 +1329,10 @@ try {
formHost.notifyFormsVisible(formIds, true).then(() => {
console.log('formHost notifyFormsVisible success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1370,11 +1370,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
try {
formHost.notifyFormsEnableUpdate(formIds, true, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1418,10 +1418,10 @@ try {
formHost.notifyFormsEnableUpdate(formIds, true).then(() => {
console.log('formHost notifyFormsEnableUpdate success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## shareForm
......@@ -1459,11 +1459,11 @@ let deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2
try {
formHost.shareForm(formId, deviceId, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1508,10 +1508,10 @@ try {
formHost.shareForm(formId, deviceId).then(() => {
console.log('formHost shareForm success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1549,11 +1549,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
try {
formHost.notifyFormsPrivacyProtected(formIds, true, (error) => {
if (error) {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -1595,9 +1595,9 @@ try {
formHost.notifyFormsPrivacyProtected(formIds, true).then(() => {
console.log('formHost notifyFormsPrivacyProtected success');
}).catch((error) => {
console.log(`error, code: ${error.code}, message: ${error.message}`);
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.log(`catch error, code: ${error.code}, message: ${error.message}`);
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -43,13 +43,13 @@ let formId = '12400633174999288';
try {
formProvider.setFormNextRefreshTime(formId, 5, (error, data) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log(`formProvider setFormNextRefreshTime success`);
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -91,10 +91,10 @@ try {
formProvider.setFormNextRefreshTime(formId, 5).then(() => {
console.log(`formProvider setFormNextRefreshTime success`);
}).catch((error) => {
console.log(`promise error, code: ${error.code}, message: ${error.message})`);
console.error(`promise error, code: ${error.code}, message: ${error.message})`);
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -132,13 +132,13 @@ try {
let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'});
formProvider.updateForm(formId, obj, (error, data) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log(`formProvider updateForm success`);
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -182,10 +182,10 @@ try {
formProvider.updateForm(formId, obj).then(() => {
console.log(`formProvider updateForm success`);
}).catch((error) => {
console.log(`promise error, code: ${error.code}, message: ${error.message})`);
console.error(`promise error, code: ${error.code}, message: ${error.message})`);
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -219,13 +219,13 @@ import formProvider from '@ohos.app.form.formProvider';
try {
formProvider.getFormsInfo((error, data) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
## getFormsInfo
......@@ -263,13 +263,13 @@ const filter: formInfo.FormInfoFilter = {
try {
formProvider.getFormsInfo(filter, (error, data) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -314,10 +314,10 @@ try {
formProvider.getFormsInfo(filter).then((data) => {
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
}).catch((error) => {
console.log(`promise error, code: ${error.code}, message: ${error.message})`);
console.error(`promise error, code: ${error.code}, message: ${error.message})`);
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -364,13 +364,13 @@ try {
let obj = formBindingData.createFormBindingData({ temperature: '22c', time: '22:00' });
formProvider.requestPublishForm(want, obj, (error, data) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -414,13 +414,13 @@ let want = {
try {
formProvider.requestPublishForm(want, (error, data) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -471,10 +471,10 @@ try {
formProvider.requestPublishForm(want).then((data) => {
console.log('formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}');
}).catch((error) => {
console.log(`promise error, code: ${error.code}, message: ${error.message})`);
console.error(`promise error, code: ${error.code}, message: ${error.message})`);
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -502,7 +502,7 @@ import formProvider from '@ohos.app.form.formProvider';
try {
formProvider.isRequestPublishFormSupported((error, isSupported) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
if (isSupported) {
var want = {
......@@ -516,19 +516,19 @@ try {
try {
formProvider.requestPublishForm(want, (error, data) => {
if (error) {
console.log(`callback error, code: ${error.code}, message: ${error.message})`);
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
}
}
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -568,16 +568,16 @@ try {
formProvider.requestPublishForm(want).then((data) => {
console.log('formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}');
}).catch((error) => {
console.log(`promise error, code: ${error.code}, message: ${error.message})`);
console.error(`promise error, code: ${error.code}, message: ${error.message})`);
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
}
}).catch((error) => {
console.log(`promise error, code: ${error.code}, message: ${error.message})`);
console.error(`promise error, code: ${error.code}, message: ${error.message})`);
});
} catch (error) {
console.log(`catch error, code: ${error.code}, message: ${error.message})`);
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
}
```
......@@ -90,7 +90,7 @@ let config = {
abilityManager.updateConfiguration(config).then(() => {
console.log('updateConfiguration success');
}).catch((err) => {
console.log('updateConfiguration fail');
console.error('updateConfiguration fail');
});
```
......@@ -140,6 +140,6 @@ Obtains the ability running information. This API uses a promise to return the r
abilityManager.getAbilityRunningInfos().then((data) => {
console.log('getAbilityRunningInfos data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getAbilityRunningInfos err: ${JSON.stringify(err)}');
console.error('getAbilityRunningInfos err: ${JSON.stringify(err)}');
});
```
......@@ -59,6 +59,6 @@ try {
};
formBindingData.createFormBindingData(obj);
} catch (error) {
console.log('catch error, error: ${JSON.stringify(error)}');
console.error('catch error, error: ${JSON.stringify(error)}');
}
```
......@@ -36,7 +36,7 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback
let formId = '12400633174999288';
formProvider.setFormNextRefreshTime(formId, 5, (error, data) => {
if (error.code) {
console.log('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}');
console.error('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}');
}
});
```
......@@ -71,7 +71,7 @@ Sets the next refresh time for a widget. This API uses a promise to return the r
formProvider.setFormNextRefreshTime(formId, 5).then(() => {
console.log('formProvider setFormNextRefreshTime success');
}).catch((error) => {
console.log('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}');
console.error('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}');
});
```
......@@ -101,7 +101,7 @@ Updates a widget. This API uses an asynchronous callback to return the result.
let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'});
formProvider.updateForm(formId, obj, (error, data) => {
if (error.code) {
console.log('formProvider updateForm, error: ${JSON.stringify(error)}');
console.error('formProvider updateForm, error: ${JSON.stringify(error)}');
}
});
```
......@@ -138,6 +138,6 @@ Updates a widget. This API uses a promise to return the result.
formProvider.updateForm(formId, obj).then(() => {
console.log('formProvider updateForm success');
}).catch((error) => {
console.log('formProvider updateForm, error: ${JSON.stringify(error)}');
console.error('formProvider updateForm, error: ${JSON.stringify(error)}');
});
```
......@@ -25,7 +25,7 @@ import Want from '@ohos.application.Want';
| type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. |
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantConstant.Flags).|
| action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantConstant.Action). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantConstant.Entity). |
| moduleName<sup>9+</sup> | string | No | Module to which the ability belongs.|
......@@ -42,7 +42,7 @@ import Want from '@ohos.application.Want';
};
this.context.startAbility(want, (error) => {
// Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability.
console.log('error.code = ${error.code}');
console.error('error.code = ${error.code}');
});
```
......@@ -114,7 +114,7 @@ import Want from '@ohos.application.Want';
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
console.log('openSync fail: ${JSON.stringify(e)}');
console.error('openSync fail: ${JSON.stringify(e)}');
}
let want = {
'deviceId': '', // An empty deviceId indicates the local device.
......@@ -127,7 +127,7 @@ import Want from '@ohos.application.Want';
};
this.context.startAbility(want, (error) => {
// Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability.
console.log('error.code = ${error.code}');
console.error('error.code = ${error.code}');
});
```
......
......@@ -2215,7 +2215,7 @@ try {
### bundleManager.getProfileByAbility
getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback<Array\<string>>): void;
getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string\>\>): void;
Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses an asynchronous callback to return the result.
......@@ -2266,7 +2266,7 @@ try {
### bundleManager.getProfileByAbility
getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise<Array\<string>>;
getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\<Array\<string\>\>;
Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses a promise to return the result.
......@@ -2336,7 +2336,7 @@ try {
### bundleManager.getProfileByExtensionAbility
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback<Array\<string>>): void;
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string\>\>): void;
Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses an asynchronous callback to return the result.
......@@ -2386,7 +2386,7 @@ try {
### bundleManager.getProfileByExtensionAbility
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise<Array\<string>>;
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\<Array\<string\>\>;
Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses a promise to return the result.
......@@ -2659,7 +2659,6 @@ try {
### bundleManager.getApplicationInfoSync
getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md);
getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md);
Synchronously obtains the application information based on the given bundle name, application flags, and user ID.
......@@ -2710,6 +2709,42 @@ try {
}
```
### bundleManager.getApplicationInfoSync
getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md);
Synchronously obtains the application information based on the given bundle name and application flags.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------------- | -------------------------- | ---- | ----------------------------------------------------- |
| bundleName | string | Yes | Bundle name. |
| applicationFlags | [number](#applicationflag) | Yes | Type of the application information to obtain.|
**Return value**
| Type | Description |
| ----------------------------------------------------------- | ------------------------- |
| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Application information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700026 | The specified bundle is disabled. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
......@@ -2727,7 +2762,6 @@ try {
### bundleManager.getBundleInfoSync
getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId: number): [BundleInfo](js-apis-bundleManager-bundleInfo.md);
getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md);
Synchronously obtains the bundle information based on the given bundle name, bundle flags, and user ID.
......@@ -2743,7 +2777,7 @@ Synchronously obtains the bundle information based on the given bundle name, bun
| ----------- | ------ | ---- | -------------------------------------------------------- |
| bundleName | string | Yes | Bundle name. |
| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.|
| userId | number | No | User ID. |
| userId | number | Yes | User ID. |
**Return value**
......@@ -2778,6 +2812,42 @@ try {
}
```
### bundleManager.getBundleInfoSync
getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md);
Synchronously obtains the bundle information based on the given bundle name and bundle flags.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------------- | ---- | ------------------------------------------------------ |
| bundleName | string | Yes | Bundle name. |
| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.|
**Return value**
| Type | Description |
| ------------------------------------------------- | -------------------- |
| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700026 | The specified bundle is disabled. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
......@@ -2790,3 +2860,37 @@ try {
hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', err.message);
}
```
## ModuleType
Enumerates the module types.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Value | Description |
| ------- | ---- | -------------------- |
| ENTRY | 1 | Main module of the application. |
| FEATURE | 2 | Dynamic feature module of the application.|
| SHARED | 3 | Dynamic shared library module of the application. |
## BundleType
Enumerates the bundle types.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Value | Description |
| -------------- | ---- | --------------- |
| APP | 0 | The bundle is a common application. |
| ATOMIC_SERVICE | 1 | The bundle is an atomic service.|
## AtomicServiceModuleType
Enumerates the module types of an atomic service.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Value | Description |
| ------ | ---- | --------------------------- |
| NORMAL | 0 | Page package in the atomic service. |
| MAIN | 1 | Landing page package in the atomic service.|
......@@ -16,7 +16,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor';
| Permission | Permission Level | Description |
| ------------------------------------ | ----------- | ------------------------------ |
| ohos.permission.LISTEN_BUNDLE_CHANGE | system_core | Permission to listen for bundle installation, uninstall, and updates.|
| ohos.permission.LISTEN_BUNDLE_CHANGE | system_basic | Permission to listen for bundle installation, uninstall, and updates.|
For details, see [Permission Levels](../../security/accesstoken-overview.md).
......@@ -33,7 +33,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md).
## bundleMonitor.on
on(type: BundleChangedEvent, callback: callback\<BundleChangedInfo>): void;
on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;
Subscribes to bundle installation, uninstall, and update events.
......@@ -66,7 +66,7 @@ try {
## bundleMonitor.off
off(type: BundleChangedEvent, callback?: callback\<BundleChangedInfo>): void;
off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;
Unsubscribes from bundle installation, uninstall, and update events.
......
# @ohos.data.dataShare (DataShare)
# @ohos.data.dataShare (Data Sharing)
The **DataShare** module allows an application to manage its own data and share data with other applications on the same device.
> **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.
>
> The APIs of this module can be used only in the stage model.
> - The APIs provided by this module are system APIs.
>
> - The APIs of this module can be used only in the stage model.
## Modules to Import
......@@ -55,7 +56,7 @@ Observe the following when using this API:
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. |
| context | [Context](js-apis-inner-application-context.md#context) | Yes | Context of an application. |
| uri | string | Yes | Uniform Resource Identifier (URI) of the server application to connect. |
| callback | AsyncCallback&lt;[DataShareHelper](#datasharehelper)&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the **DataShareHelper** instance created. Otherwise, **err** is an error object.|
......@@ -105,7 +106,7 @@ Observe the following when using this API:
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------- | ---- | ------------------------------ |
| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. |
| context | [Context](js-apis-inner-application-context.md#context) | Yes | Context of an application. |
| uri | string | Yes | URI of the server application to connect.|
**Return value**
......@@ -187,18 +188,19 @@ Unsubscribes from the changes of the specified data. This API uses an asynchrono
| -------- | -------------------- | ---- | ------------------------ |
| type | string | Yes | Event type to unsubscribe from. The value is **dataChange**, which indicates data change events.|
| uri | string | Yes | URI of the data.|
| callback | AsyncCallback&lt;void&gt; | No | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
| callback | AsyncCallback&lt;void&gt; | No | Callback for the data change event. If this parameter is left empty, all notification events of the URI are unsubscribed from.|
**Example**
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
function offCallback() {
console.info("**** Observer off callback ****");
function callback() {
console.info("**** Observer callback ****");
}
let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.off("dataChange", uri, offCallback);
dataShareHelper.on("dataChange", uri, callback);
dataShareHelper.off("dataChange", uri, callback);
```
### insert
......
......@@ -5,7 +5,7 @@ The **Preferences** module provides APIs for processing data in the form of key-
The key is of the string type, and the value can be a number, a string, a Boolean value, or an array of numbers, strings, or Boolean values.
> **NOTE**<br/>
> **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.
......@@ -22,8 +22,8 @@ import data_preferences from '@ohos.data.preferences';
| Name | Type| Readable| Writable| Description |
| ---------------- | -------- | ---- | ---- | --------------------------------------- |
| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. The maximum key length is 80 bytes. |
| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. The maximum value length is 8192 bytes.|
| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key, which is 80 bytes. |
| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value, which is 8192 bytes.|
## data_preferences.getPreferences
......@@ -38,8 +38,8 @@ Obtains a **Preferences** instance. This API uses an asynchronous callback to re
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ |
| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). |
| name | string | Yes | Name of the **Preferences** instance.|
| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). |
| name | string | Yes | Name of the **Preferences** instance. |
| callback | AsyncCallback&lt;[Preferences](#preferences)&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **object** is the **Preferences** instance obtained. Otherwise, **err** is an error code.|
**Example**
......@@ -213,7 +213,6 @@ Stage model:
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
......@@ -289,7 +288,6 @@ Stage model:
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try{
......@@ -350,7 +348,6 @@ Stage model:
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
......@@ -973,7 +970,7 @@ Unsubscribes from data changes.
| Name | Type | Mandatory| Description |
| -------- | -------------------------------- | ---- | ------------------------------------------ |
| type | string | Yes | Event type to unsubscribe from. The value **change** indicates data change events. |
| callback | Callback&lt;{ key : string }&gt; | No | Callback to unregister. If this parameter is left blank, the callbacks used to subscribing to all data changes will be unregistered.|
| callback | Callback&lt;{ key : string }&gt; | No | Callback to unregister. If this parameter is left blank, the callbacks for all data changes will be unregistered.|
**Example**
......
......@@ -7,8 +7,8 @@ The **DataStorage** module provides applications with data processing capability
>
> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs of this module are no longer maintained since API version 9. You are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md).
>
> - The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md).
>
> - The APIs of this module can be used only in the FA model.
......@@ -24,8 +24,8 @@ import data_storage from '@ohos.data.storage';
| Name | Type| Readable| Writable| Description |
| ---------------- | -------- | ---- | ---- | ------------------------------------- |
| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. It must be less than 80 bytes. |
| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. It must be less than 8192 bytes.|
| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key, which is 80 bytes. |
| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value, which is 8192 bytes.|
## data_storage.getStorageSync
......@@ -79,7 +79,7 @@ Reads the specified file and loads its data to the **Storage** instance for data
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | -------------------------- |
| path | string | Yes | Path of the target file.|
| callback | AsyncCallback&lt;[Storage](#storage)&gt; | Yes | Callback used to return the execution result. |
| callback | AsyncCallback&lt;[Storage](#storage)&gt; | Yes | Callback invoked to return the result. |
**Example**
......@@ -172,7 +172,7 @@ context.getFilesDir().then((filePath) => {
console.info("======================>getFilesDirPromise====================>");
data_storage.deleteStorageSync(path + '/mystore');
});
});
```
## data_storage.deleteStorage
......@@ -276,9 +276,9 @@ let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
data_storage.removeStorageFromCacheSync(path + '/mystore');
});
});
```
......@@ -406,7 +406,7 @@ Obtains the value corresponding to a key. If the value is null or not of the def
| -------- | ------------------------------ | ---- | ----------------------------------------- |
| key | string | Yes | Key of the data. It cannot be empty. |
| defValue | [ValueType](#valuetype) | Yes | Default value to be returned. It can be a number, string, or Boolean value.|
| callback | AsyncCallback&lt;ValueType&gt; | Yes | Callback used to return the execution result. |
| callback | AsyncCallback&lt;ValueType&gt; | Yes | Callback invoked to return the result. |
**Example**
......@@ -581,7 +581,7 @@ Checks whether the storage object contains data with a given key. This API uses
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ------------------------------- |
| key | string | Yes | Key of the data. It cannot be empty.|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the execution result. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the result. |
**Return value**
......@@ -867,7 +867,7 @@ Subscribes to data changes. The **StorageObserver** needs to be implemented. Whe
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ------ |---------------------------------------- |
| type | string |Yes| Event type. The value **change** indicates data change events.|
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Yes|Callback used to return data changes. |
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Yes|Callback invoked to return the data change. |
**Example**
......@@ -894,7 +894,7 @@ Unsubscribes from data changes.
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ------ |---------------------------------------- |
| type | string |Yes| Event type. The value **change** indicates data change events.|
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Yes|Callback used to return data changes. |
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Yes|Callback for the data change. |
**Example**
......
......@@ -4,7 +4,7 @@ The **Environment** module provides APIs for obtaining the root directories of t
> **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 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> - The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
......@@ -26,7 +26,7 @@ Obtains the root directory of the storage. This API uses a promise to return the
| Type | Description |
| --------------------- | ---------------- |
| Promise&lt;string&gt; | Promise returned with the root directory of the storage.|
| Promise&lt;string&gt; | Promise used to return the root directory of the storage.|
**Example**
......@@ -50,7 +50,7 @@ Obtains the root directory of the storage. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback&lt;string&gt; | Yes | Asynchronous callback used to return the root directory of the storage.|
| callback | AsyncCallback&lt;string&gt; | Yes | Asynchronous callback invoked to return the root directory of the storage.|
**Example**
......
......@@ -5,7 +5,7 @@ The **securityLabel** module provides APIs for managing data security levels of
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>- The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
> - The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
## Modules to Import
......@@ -45,7 +45,7 @@ For details about how to obtain the FA model context, see [Context](js-apis-inne
## securityLabel.setSecurityLabel
setSecurityLabel(path:string, type:dataLevel):Promise&lt;void&gt;
setSecurityLabel(path:string, type:DataLevel):Promise&lt;void&gt;
Sets a security label for a file in asynchronous mode. This API uses a promise to return the result.
......@@ -56,7 +56,7 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | -------------------------------------------- |
| path | string | Yes | Path of the target file. |
| type | dataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.|
| type | DataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.|
**Return value**
......@@ -76,7 +76,7 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t
## securityLabel.setSecurityLabel
setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback&lt;void&gt;):void
setSecurityLabel(path:string, type:DataLevel, callback: AsyncCallback&lt;void&gt;):void
Sets a security label for a file in asynchronous mode. This API uses an asynchronous callback to return the result.
......@@ -87,7 +87,7 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | -------------------------------------------- |
| path | string | Yes | Path of the target file. |
| type | dataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.|
| type | DataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. |
**Example**
......@@ -104,7 +104,7 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro
## securityLabel.setSecurityLabelSync
setSecurityLabelSync(path:string, type:dataLevel):void
setSecurityLabelSync(path:string, type:DataLevel):void
Sets a security label for a file in synchronous mode.
......@@ -115,7 +115,7 @@ Sets a security label for a file in synchronous mode.
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | -------------------------------------------- |
| path | string | Yes | Path of the target file. |
| type | dataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.|
| type | DataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.|
**Example**
......
......@@ -3,7 +3,7 @@
The **HUKS** module provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations.
The keys managed by OpenHarmony Universal KeyStore (HUKS) can be imported by applications or generated by calling the HUKS APIs.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> **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.
......@@ -1818,9 +1818,9 @@ Enumerates the user authentication types.
| Name | Value | Description |
| ------------------------------- | ---- | ------------------------- |
| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 | Fingerprint authentication. |
| HUKS_USER_AUTH_TYPE_FACE | 2 | Facial authentication.|
| HUKS_USER_AUTH_TYPE_PIN | 4 | PIN authentication.|
| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 << 0 | Fingerprint authentication. |
| HUKS_USER_AUTH_TYPE_FACE | 1 << 1 | Facial authentication.|
| HUKS_USER_AUTH_TYPE_PIN | 1 << 2 | PIN authentication.|
## HuksAuthAccessType<sup>9+</sup>
......@@ -1830,8 +1830,8 @@ Enumerates the access control types.
| Name | Value | Description |
| --------------------------------------- | ---- | ------------------------------------------------ |
| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 | The key becomes invalid after the password is cleared. |
| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 2 | The key becomes invalid after a new biometric feature is added.|
| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 << 0 | The key becomes invalid after the password is cleared. |
| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 1 << 1 | The key becomes invalid after a new biometric feature is added.|
## HuksChallengeType<sup>9+</sup>
......@@ -1892,7 +1892,7 @@ Enumerates the tags used to invoke parameters.
| Name | Value | Description |
| -------------------------------------------- | ---------------------------------------- | -------------------------------------- |
| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. |
| HUKS_TAG_ALGORITHM | HUKS_TAG_TYPE_UINT \| 1 | Algorithm. |
| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | Algorithm. |
| HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Purpose of the key. |
| HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | Key size. |
| HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | Digest algorithm. |
......@@ -1922,7 +1922,7 @@ Enumerates the tags used to invoke parameters.
| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | Reserved. |
| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | Reserved. |
| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | Reserved. |
| HUKS_TAG_ALL_USERS | ksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. |
| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. |
| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | Reserved. |
| HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | Reserved. |
| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | User authentication type. For details, see [HuksUserAuthType](#huksuserauthtype9). This parameter must be set together with [HuksAuthAccessType](#huksauthaccesstype9). You can set a maximum of two user authentication types at a time. For example, if **HuksAuthAccessType** is **HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL**, you can set two of **HKS_USER_AUTH_TYPE_FACE**, **HKS_USER_AUTH_TYPE_FINGERPRINT**, and **HKS_USER_AUTH_TYPE_FACE\**.| HKS_USER_AUTH_TYPE_FINGERPRINT |
......@@ -2889,11 +2889,6 @@ Enumerates the error codes.
| HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST | -36 |New root key material exists.|
| HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL | -37 |Failed to update the root key material.|
| HUKS_ERROR_VERIFICATION_FAILED | -38 |Failed to verify the certificate chain.|
| HUKS_ERROR_GET_USERIAM_SECINFO_FAILED<sup>9+</sup> | -40 |Failed to obtain the security attribute information of the user.|
| HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED<sup>9+</sup> | -41 |Failed to obtain the authentication information of the user.|
| HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT<sup>9+</sup> | -42 |The access control of the current authentication type is not supported.|
| HUKS_ERROR_KEY_AUTH_FAILED<sup>9+</sup> | -43 |The access control authentication has failed.|
| HUKS_ERROR_DEVICE_NO_CREDENTIAL<sup>9+</sup> | -44 |No credential has been enrolled for the device.|
| HUKS_ERROR_CHECK_GET_ALG_FAIL | -100 |Failed to obtain the ALG. |
| HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL | -101 |Failed to obtain the key size.|
| HUKS_ERROR_CHECK_GET_PADDING_FAIL | -102 |Failed to obtain the padding algorithm.|
......@@ -2920,7 +2915,5 @@ Enumerates the error codes.
| HUKS_ERROR_INVALID_SALT | -123 |Invalid salt value.|
| HUKS_ERROR_INVALID_ITERATION | -124 |Invalid iteration count.|
| HUKS_ERROR_INVALID_OPERATION | -125 |Invalid operation.|
| HUKS_ERROR_INVALID_WRAPPED_FORMAT<sup>9+</sup> | -126 |Incorrect format of the wrapped key being imported.|
| HUKS_ERROR_INVALID_USAGE_OF_KEY<sup>9+</sup> | -127 |Incorrect purpose of the wrapped key being imported.|
| HUKS_ERROR_INTERNAL_ERROR | -999 |Internal error.|
| HUKS_ERROR_UNKNOWN_ERROR | -1000 |Unknown error.|
......@@ -39,8 +39,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.DataAbility'
);
let mode = 'rw';
DAHelper.openFile('dataability:///com.example.DataAbility', mode, (err, data) => {
console.info('openFile err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.openFile('dataability:///com.example.DataAbility', mode, (error, data) => {
if (error && error.code !== 0) {
console.error('openFile fail, error: ${JSON.stringify(error)}');
} else {
console.log('openFile success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -170,8 +174,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let DAHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.DataAbility'
);
DAHelper.getType('dataability:///com.example.DataAbility', (err, data) => {
console.info('getType err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.getType('dataability:///com.example.DataAbility', (error, data) => {
if (error && error.code !== 0) {
console.error('getType fail, error: ${JSON.stringify(error)}');
} else {
console.log('getType success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -230,8 +238,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let DAHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.DataAbility'
);
DAHelper.getFileTypes( 'dataability:///com.example.DataAbility', 'image/*', (err, data) => {
console.info('getFileTypes err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.getFileTypes( 'dataability:///com.example.DataAbility', 'image/*', (error, data) => {
if (error && error.code !== 0) {
console.error('getFileTypes fail, error: ${JSON.stringify(error)}');
} else {
console.log('getFileTypes success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -290,8 +302,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let DAHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.DataAbility'
);
DAHelper.normalizeUri('dataability:///com.example.DataAbility', (err, data) => {
console.info('normalizeUri err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.normalizeUri('dataability:///com.example.DataAbility', (error, data) => {
if (error && error.code !== 0) {
console.error('normalizeUri fail, error: ${JSON.stringify(error)}');
} else {
console.log('normalizeUri success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -349,8 +365,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let DAHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.DataAbility'
);
DAHelper.denormalizeUri('dataability:///com.example.DataAbility', (err, data) => {
console.info('denormalizeUri err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.denormalizeUri('dataability:///com.example.DataAbility', (error, data) => {
if (error && error.code !== 0) {
console.error('denormalizeUri fail, error: ${JSON.stringify(error)}');
} else {
console.log('denormalizeUri success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -408,8 +428,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let DAHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.DataAbility'
);
DAHelper.notifyChange('dataability:///com.example.DataAbility', (err) => {
console.info('==========================>Called=======================>');
DAHelper.notifyChange('dataability:///com.example.DataAbility', (error) => {
if (error && error.code !== 0) {
console.error('notifyChange fail, error: ${JSON.stringify(error)}');
} else {
console.log('notifyChange success');
}
});
```
......@@ -474,8 +498,12 @@ const valueBucket = {
'salary': 200.5,
'blobType': 'u8',
};
DAHelper.insert('dataability:///com.example.DataAbility', valueBucket, (err, data) => {
console.info('insert err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.insert('dataability:///com.example.DataAbility', valueBucket, (error, data) => {
if (error && error.code !== 0) {
console.error('insert fail, error: ${JSON.stringify(error)}');
} else {
console.log('insert success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -544,8 +572,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
let cars = new Array({'name': 'roe11', 'age': 21, 'salary': 20.5, 'blobType': 'u8',},
{'name': 'roe12', 'age': 21, 'salary': 20.5, 'blobType': 'u8',},
{'name': 'roe13', 'age': 21, 'salary': 20.5, 'blobType': 'u8',});
DAHelper.batchInsert('dataability:///com.example.DataAbility', cars, (err, data) => {
console.info('batchInsert err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.batchInsert('dataability:///com.example.DataAbility', cars, (error, data) => {
if (error && error.code !== 0) {
console.error('batchInsert fail, error: ${JSON.stringify(error)}');
} else {
console.log('batchInsert success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -610,8 +642,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.DataAbility'
);
let da = new ohos_data_ability.DataAbilityPredicates();
DAHelper.delete('dataability:///com.example.DataAbility', da, (err, data) => {
console.info('delete err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.delete('dataability:///com.example.DataAbility', da, (error, data) => {
if (error && error.code !== 0) {
console.error('delete fail, error: ${JSON.stringify(error)}');
} else {
console.log('delete success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -682,8 +718,12 @@ const va = {
'blobType': 'u8',
};
let da = new ohos_data_ability.DataAbilityPredicates();
DAHelper.update('dataability:///com.example.DataAbility', va, da, (err, data) => {
console.info('update err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.update('dataability:///com.example.DataAbility', va, da, (error, data) => {
if (error && error.code !== 0) {
console.error('update fail, error: ${JSON.stringify(error)}');
} else {
console.log('update success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -756,8 +796,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
);
let cars=new Array('value1', 'value2', 'value3', 'value4');
let da = new ohos_data_ability.DataAbilityPredicates();
DAHelper.query('dataability:///com.example.DataAbility', cars, da, (err, data) => {
console.info('query err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
DAHelper.query('dataability:///com.example.DataAbility', cars, da, (error, data) => {
if (error && error.code !== 0) {
console.error('query fail, error: ${JSON.stringify(error)}');
} else {
console.log('query success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -827,12 +871,12 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.jsapidemo.UserDataAbility'
);
dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility',
'method', 'arg', {'key1':'value1'}, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ${err}');
return;
'method', 'arg', {'key1':'value1'}, (error, data) => {
if (error && error.code !== 0) {
console.error('call fail, error: ${JSON.stringify(error)}');
} else {
console.log('call success, data: ${JSON.stringify(data)}');
}
console.info('Operation succeeded: ${data}');
});
```
......@@ -869,9 +913,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
);
dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility',
'method', 'arg', {'key1':'value1'}).then((data) => {
console.info('Operation succeeded: ${data}');
console.info('call success, data: ${data}');
}).catch((error) => {
console.error('Operation failed. Cause: ${error}');
console.error('call failed, error: ${error}');
});
```
......@@ -901,12 +945,12 @@ let op=new Array();
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.jsapidemo.UserDataAbility'
);
dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', op, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ${err}');
return;
dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', op, (error, data) => {
if (error && error.code !== 0) {
console.error('executeBatch fail, error: ${JSON.stringify(error)}');
} else {
console.log('executeBatch success, data: ${JSON.stringify(data)}');
}
console.info('Operation succeeded: ${data}');
});
```
......@@ -942,9 +986,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
'dataability:///com.example.jsapidemo.UserDataAbility'
);
dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', op).then((data) => {
console.info('Operation succeeded: ${data}');
console.info('executeBatch success, data: ${data}');
}).catch((error) => {
console.error('Operation failed. Cause: ${error}');
console.error('executeBatch failed, error: ${error}');
});
```
......
......@@ -36,11 +36,14 @@ let startAbilityParameter = {
};
try {
featureAbility.startAbility(startAbilityParameter, (err, data) => {
console.log('errCode : ${JSON.stringify(err)}');
console.log('data : ${JSON.stringify(data)}');
featureAbility.startAbility(startAbilityParameter, (error, data) => {
if (error && error.code !== 0) {
console.error('startAbility fail, error: ${JSON.stringify(error)}');
} else {
console.log('startAbility success, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.log('startAbility error: ${JSON.stringify(error)}');
console.error('startAbility error: ${JSON.stringify(error)}');
}
```
......@@ -41,8 +41,12 @@ If this API is called for the first time, a root directory will be created.
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getOrCreateLocalDir((err, data)=>{
console.info('getOrCreateLocalDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getOrCreateLocalDir((error, data)=>{
if (error && error.code !== 0) {
console.error('getOrCreateLocalDir fail, error: ${JSON.stringify(error)}');
} else {
console.log('getOrCreateLocalDir success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -97,8 +101,12 @@ import featureAbility from '@ohos.ability.featureAbility';
import bundle from '@ohos.bundle.bundleManager';
let context = featureAbility.getContext();
bundle.getBundleInfo('com.context.test', 1, (err, datainfo) =>{
context.verifyPermission('com.example.permission', {uid:datainfo.appInfo.uid}, (err, data) =>{
console.info('verifyPermission err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.verifyPermission('com.example.permission', {uid:datainfo.appInfo.uid}, (error, data) =>{
if (error && error.code !== 0) {
console.error('verifyPermission fail, error: ${JSON.stringify(error)}');
} else {
console.log('verifyPermission success, data: ${JSON.stringify(data)}');
}
});
});
```
......@@ -126,8 +134,12 @@ Verifies whether the current PID and UID have the given permission. This API use
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.verifyPermission('com.example.permission', (err, data) =>{
console.info('verifyPermission err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.verifyPermission('com.example.permission', (error, data) =>{
if (error && error.code !== 0) {
console.error('verifyPermission fail, error: ${JSON.stringify(error)}');
} else {
console.log('verifyPermission success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -193,8 +205,12 @@ context.requestPermissionsFromUser(
'com.example.permission4',
'com.example.permission5'],
1,
(err, data) => {
console.info('requestPermissionsFromUser err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
(error, data) => {
if (error && error.code !== 0) {
console.error('requestPermissionsFromUser fail, error: ${JSON.stringify(error)}');
} else {
console.log('requestPermissionsFromUser success, data: ${JSON.stringify(data)}');
}
}
);
```
......@@ -259,8 +275,12 @@ Obtains information about the current application. This API uses an asynchronous
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getApplicationInfo((err, data) => {
console.info('getApplicationInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getApplicationInfo((error, data) => {
if (error && error.code !== 0) {
console.error('getApplicationInfo fail, error: ${JSON.stringify(error)}');
} else {
console.log('getApplicationInfo success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -311,8 +331,12 @@ Obtains the bundle name of this ability. This API uses an asynchronous callback
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getBundleName((err, data) => {
console.info('getBundleName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getBundleName((error, data) => {
if (error && error.code !== 0) {
console.error('getBundleName fail, error: ${JSON.stringify(error)}');
} else {
console.log('getBundleName success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -361,8 +385,12 @@ Obtains the display orientation of this ability. This API uses an asynchronous c
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getDisplayOrientation((err, data) => {
console.info('getDisplayOrientation err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getDisplayOrientation((error, data) => {
if (error && error.code !== 0) {
console.error('getDisplayOrientation fail, error: ${JSON.stringify(error)}');
} else {
console.log('getDisplayOrientation success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -409,8 +437,12 @@ Obtains the external cache directory of the application. This API uses an asynch
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getExternalCacheDir((err, data) => {
console.info('getExternalCacheDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getExternalCacheDir((error, data) => {
if (error && error.code !== 0) {
console.error('getExternalCacheDir fail, error: ${JSON.stringify(error)}');
} else {
console.log('getExternalCacheDir success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -460,8 +492,8 @@ import featureAbility from '@ohos.ability.featureAbility';
import bundle from '@ohos.bundle';
let context = featureAbility.getContext();
let orientation = bundle.DisplayOrientation.UNSPECIFIED;
context.setDisplayOrientation(orientation, (err) => {
console.info('setDisplayOrientation err: ${JSON.stringify(err)}');
context.setDisplayOrientation(orientation, (error) => {
console.error('setDisplayOrientation fail, error: ${JSON.stringify(error)}');
});
```
......@@ -513,8 +545,8 @@ Sets whether to show this feature at the top of the lock screen so that the feat
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let show = true;
context.setShowOnLockScreen(show, (err) => {
console.info('setShowOnLockScreen err: ${JSON.stringify(err)}');
context.setShowOnLockScreen(show, (error) => {
console.error('setShowOnLockScreen fail, error: ${JSON.stringify(error)}');
});
```
......@@ -570,8 +602,8 @@ Sets whether to wake up the screen when this feature is restored. This API uses
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let wakeUp = true;
context.setWakeUpScreen(wakeUp, (err) => {
console.info('setWakeUpScreen err: ${JSON.stringify(err)}');
context.setWakeUpScreen(wakeUp, (error) => {
console.error('setWakeUpScreen fail, error: ${JSON.stringify(error)}');
});
```
......@@ -628,8 +660,12 @@ Obtains information about the current process, including the PID and process nam
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getProcessInfo((err, data) => {
console.info('getProcessInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getProcessInfo((error, data) => {
if (error && error.code !== 0) {
console.error('getProcessInfo fail, error: ${JSON.stringify(error)}');
} else {
console.log('getProcessInfo success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -682,8 +718,12 @@ This API is available only to Page abilities.
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getElementName((err, data) => {
console.info('getElementName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getElementName((error, data) => {
if (error && error.code !== 0) {
console.error('getElementName fail, error: ${JSON.stringify(error)}');
} else {
console.log('getElementName success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -734,8 +774,12 @@ Obtains the name of the current process. This API uses an asynchronous callback
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getProcessName((err, data) => {
console.info('getProcessName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getProcessName((error, data) => {
if (error && error.code !== 0) {
console.error('getProcessName fail, error: ${JSON.stringify(error)}');
} else {
console.log('getProcessName success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -786,8 +830,12 @@ Obtains the bundle name of the caller ability. This API uses an asynchronous cal
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getCallingBundle((err, data) => {
console.info('getCallingBundle err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getCallingBundle((error, data) => {
if (error && error.code !== 0) {
console.error('getCallingBundle fail, error: ${JSON.stringify(error)}');
} else {
console.log('getCallingBundle success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -836,8 +884,12 @@ Obtains the cache directory of the application in the internal storage. This API
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getCacheDir((err, data) => {
console.info('getCacheDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getCacheDir((error, data) => {
if (error && error.code !== 0) {
console.error('getCacheDir fail, error: ${JSON.stringify(error)}');
} else {
console.log('getCacheDir success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -884,8 +936,12 @@ Obtains the file directory of the application in the internal storage. This API
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getFilesDir((err, data) => {
console.info('getFilesDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getFilesDir((error, data) => {
if (error && error.code !== 0) {
console.error('getFilesDir fail, error: ${JSON.stringify(error)}');
} else {
console.log('getFilesDir success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -934,8 +990,12 @@ If the distributed file path does not exist, the system will create one and retu
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getOrCreateDistributedDir((err, data) => {
console.info('getOrCreateDistributedDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getOrCreateDistributedDir((error, data) => {
if (error && error.code !== 0) {
console.error('getOrCreateDistributedDir fail, error: ${JSON.stringify(error)}');
} else {
console.log('getOrCreateDistributedDir success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -984,8 +1044,12 @@ Obtains the application type. This API uses an asynchronous callback to return t
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getAppType((err, data) => {
console.info('getAppType err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getAppType((error, data) => {
if (error && error.code !== 0) {
console.error('getAppType fail, error: ${JSON.stringify(error)}');
} else {
console.log('getAppType success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -1032,8 +1096,12 @@ Obtains the **ModuleInfo** object of the application. This API uses an asynchron
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getHapModuleInfo((err, data) => {
console.info('getHapModuleInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getHapModuleInfo((error, data) => {
if (error && error.code !== 0) {
console.error('getHapModuleInfo fail, error: ${JSON.stringify(error)}');
} else {
console.log('getHapModuleInfo success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -1080,8 +1148,12 @@ Obtains the version information of the application. This API uses an asynchronou
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getAppVersionInfo((err, data) => {
console.info('getAppVersionInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getAppVersionInfo((error, data) => {
if (error && error.code !== 0) {
console.error('getAppVersionInfo fail, error: ${JSON.stringify(error)}');
} else {
console.log('getAppVersionInfo success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -1128,8 +1200,12 @@ Obtains information about this ability. This API uses an asynchronous callback t
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getAbilityInfo((err, data) => {
console.info('getAbilityInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getAbilityInfo((error, data) => {
if (error && error.code !== 0) {
console.error('getAbilityInfo fail, error: ${JSON.stringify(error)}');
} else {
console.log('getAbilityInfo success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -1197,8 +1273,12 @@ Checks whether the configuration of this ability is being updated. This API uses
```ts
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.isUpdatingConfigurations((err, data) => {
console.info('isUpdatingConfigurations err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.isUpdatingConfigurations((error, data) => {
if (error && error.code !== 0) {
console.error('isUpdatingConfigurations fail, error: ${JSON.stringify(error)}');
} else {
console.log('isUpdatingConfigurations success, data: ${JSON.stringify(data)}');
}
});
```
......
......@@ -18,9 +18,11 @@ The **ProcessInfo** module defines process information. You can use [getProcessI
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
context.getProcessInfo((err, data) => {
if (err.code !== 0) {
console.info('getProcessInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}');
context.getProcessInfo((error, data) => {
if (error && error.code !== 0) {
console.error('getProcessInfo fail, error: ${JSON.stringify(error)}');
} else {
console.log('getProcessInfo success, data: ${JSON.stringify(data)}');
let pid = data.pid;
let processName = data.processName;
}
......
......@@ -34,7 +34,7 @@ Describes an ability monitor.
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
function onAbilityCreateCallback(data) {
console.info('onAbilityCreateCallback');
console.info('onAbilityCreateCallback, data: ${JSON.stringify(data)}');
}
let monitor = {
......@@ -44,7 +44,9 @@ let monitor = {
};
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.addAbilityMonitor(monitor, (err : any) => {
console.info('addAbilityMonitor callback');
abilityDelegator.addAbilityMonitor(monitor, (error : any) => {
if (error && error.code !== 0) {
console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}');
}
});
```
......@@ -30,16 +30,20 @@ The ability running information is obtained by calling [getAbilityRunningInfos](
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
abilitymanager.getAbilityRunningInfos((err,data) => {
console.log('getAbilityRunningInfos err: ${err}, data: ${JSON.stringify(data)}');
for (let i = 0; i < data.length; i++) {
let abilityinfo = data[i];
console.log('abilityinfo.ability: ${JSON.stringify(abilityinfo.ability)}');
console.log('abilityinfo.pid: ${JSON.stringify(abilityinfo.pid)}');
console.log('abilityinfo.uid: ${JSON.stringify(abilityinfo.uid)}');
console.log('abilityinfo.processName: ${JSON.stringify(abilityinfo.processName)}');
console.log('abilityinfo.startTime: ${JSON.stringify(abilityinfo.startTime)}');
console.log('abilityinfo.abilityState: ${JSON.stringify(abilityinfo.abilityState)}');
abilitymanager.getAbilityRunningInfos((error, data) => {
if (error && error.code !== 0) {
console.error('getAbilityRunningInfos fail, error: ${JSON.stringify(error)}');
} else {
console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}');
for (let i = 0; i < data.length; i++) {
let abilityinfo = data[i];
console.log('abilityinfo.ability: ${JSON.stringify(abilityinfo.ability)}');
console.log('abilityinfo.pid: ${JSON.stringify(abilityinfo.pid)}');
console.log('abilityinfo.uid: ${JSON.stringify(abilityinfo.uid)}');
console.log('abilityinfo.processName: ${JSON.stringify(abilityinfo.processName)}');
console.log('abilityinfo.startTime: ${JSON.stringify(abilityinfo.startTime)}');
console.log('abilityinfo.abilityState: ${JSON.stringify(abilityinfo.abilityState)}');
}
}
});
```
......@@ -20,6 +20,10 @@ let monitor = {
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.waitAbilityStageMonitor(monitor, (error, data) => {
console.info('stageMonitor waitAbilityStageMonitor, abilityStage = ${JSON.stringify(data)}');
if (error && error.code !== 0) {
console.error('waitAbilityStageMonitor fail, error: ${JSON.stringify(error)}');
} else {
console.log('waitAbilityStageMonitor success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -83,7 +83,7 @@ export default class EntryAbility extends UIAbility {
let applicationContext = this.context.getApplicationContext();
// 2. Use applicationContext to register a listener for the ability lifecycle in the application.
lifecycleId = applicationContext.on('abilityLifecycle', AbilityLifecycleCallback);
console.log('registerAbilityLifecycleCallback number: ' + JSON.stringify(lifecycleId));
console.log('registerAbilityLifecycleCallback lifecycleId: ${lifecycleId)}');
}
}
```
......@@ -114,9 +114,13 @@ let lifecycleId;
export default class EntryAbility extends UIAbility {
onDestroy() {
let applicationContext = this.context.getApplicationContext();
console.log('stage applicationContext: ' + applicationContext);
console.log('stage applicationContext: ${applicationContext}');
applicationContext.off(type: 'abilityLifecycle', lifecycleId, (error, data) => {
console.log('unregisterAbilityLifecycleCallback success, err: ' + JSON.stringify(error));
if (error && error.code !== 0) {
console.error('unregisterAbilityLifecycleCallback fail, err: ${JSON.stringify(error)}');
} else {
console.log('unregisterAbilityLifecycleCallback success, data: ${JSON.stringify(data)}');
}
});
}
}
......@@ -147,7 +151,7 @@ let lifecycleId;
export default class MyAbility extends Ability {
onDestroy() {
let applicationContext = this.context.getApplicationContext();
console.log('stage applicationContext: ' + applicationContext);
console.log('stage applicationContext: ${applicationContext}');
applicationContext.off(type: 'abilityLifecycle', lifecycleId);
}
}
......@@ -185,19 +189,19 @@ export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate')
globalThis.applicationContext = this.context.getApplicationContext();
let EnvironmentCallback = {
let environmentCallback = {
onConfigurationUpdated(config){
console.log('onConfigurationUpdated config:' + JSON.stringify(config));
console.log('onConfigurationUpdated config: ${JSON.stringify(config)}');
},
onMemoryLevel(level){
console.log('onMemoryLevel level:' + level);
console.log('onMemoryLevel level: ${level}');
}
}
};
// 1. Obtain an applicationContext object.
let applicationContext = globalThis.applicationContext;
// 2. Use applicationContext to register a listener for the ability lifecycle in the application.
callbackId = applicationContext.on('environment', EnvironmentCallback);
console.log('registerEnvironmentCallback number: ' + JSON.stringify(callbackId));
// 2. Use applicationContext to register a listener for system environment changes.
callbackId = applicationContext.on('environment', environmentCallback);
console.log('registerEnvironmentCallback callbackId: ${callbackId}');
}
}
```
......@@ -229,7 +233,11 @@ export default class EntryAbility extends UIAbility {
onDestroy() {
let applicationContext = this.context.getApplicationContext();
applicationContext.off('environment', callbackId, (error, data) => {
console.log('unregisterEnvironmentCallback success, err: ' + JSON.stringify(error));
if (error && error.code !== 0) {
console.error('unregisterEnvironmentCallback fail, err: ${JSON.stringify(error)}');
} else {
console.log('unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}');
}
});
}
}
......@@ -290,7 +298,7 @@ let applicationContext = this.context.getApplicationContext();
applicationContext.getRunningProcessInformation().then((data) => {
console.log('The process running information is: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -364,7 +372,9 @@ Kills all the processes where the application is located. This API uses an async
```ts
let applicationContext = this.context.getApplicationContext();
applicationContext.killAllProcesses(err => {
console.error('killAllProcesses result: ${JSON.stringify(err)}');
applicationContext.killAllProcesses(error => {
if (error && error.code !== 0) {
console.error('killAllProcesses fail, error: ${JSON.stringify(error)}');
}
});
```
......@@ -62,7 +62,7 @@ let bundleContext;
try {
bundleContext = this.context.createBundleContext('com.example.test');
} catch (error) {
console.log('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
```
......@@ -101,7 +101,7 @@ let moduleContext;
try {
moduleContext = this.context.createModuleContext('entry');
} catch (error) {
console.log('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
```
......@@ -141,7 +141,7 @@ let moduleContext;
try {
moduleContext = this.context.createModuleContext('com.example.test', 'entry');
} catch (error) {
console.log('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
```
......@@ -166,6 +166,6 @@ let applicationContext;
try {
applicationContext = this.context.getApplicationContext();
} catch (error) {
console.log('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
```
......@@ -38,7 +38,7 @@ Called when the mission continuation is complete.
distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => {
if (error && error.code) {
console.log('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
console.log('continueMission finished');
});
......
......@@ -33,7 +33,7 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating
distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => {
if (error && error.code) {
console.log('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
console.log('continueMission finished');
});
......
......@@ -23,13 +23,13 @@ import errorManager from '@ohos.app.ability.errorManager';
let observer = {
onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ', errorMsg);
console.error('onUnhandledException, errorMsg: ', errorMsg);
}
};
try {
errorManager.on('error', observer);
} catch (error) {
console.log('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
```
......@@ -33,7 +33,7 @@ let upperLimit = 1;
function getExtensionInfos() {
abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => {
if (error && error.code) {
console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
......
......@@ -67,7 +67,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
};
this.context.startAbility(want, (error, data) => {
if (error) {
console.log('FormExtensionContext startAbility, error:${JSON.stringify(error)}');
console.error('FormExtensionContext startAbility, error:${JSON.stringify(error)}');
} else {
console.log('FormExtensionContext startAbility success');
}
......@@ -118,7 +118,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
this.context.startAbility(want).then(() => {
console.info('StartAbility Success');
}).catch((error) => {
console.info('StartAbility failed');
console.error('StartAbility failed');
});
}
};
......
......@@ -25,7 +25,7 @@ try {
missionManager.getMissionInfo('', 1, (error, data) => {
if (error.code) {
// Process service logic errors.
console.log('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
......@@ -39,6 +39,6 @@ try {
console.log('getMissionInfo continuable is: ${JSON.stringify(data.continuable)}');
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -42,6 +42,6 @@ let listener = {
try {
let listenerId = missionManager.on('mission', listener);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -21,8 +21,12 @@ let missionParameter = {
};
try {
distributedMissionManager.startSyncRemoteMissions(missionParameter,
(err, data) => {
console.log('startSyncRemoteMissions, data: ${JSON.stringify(data)}');
(error, data) => {
if (error && error.code !== 0) {
console.error('startSyncRemoteMissions fail, error: ${JSON.stringify(error)}');
} else {
console.log('startSyncRemoteMissions success, data: ${JSON.stringify(data)}');
}
}
);
} catch (err) {
......
......@@ -14,7 +14,11 @@ The process information is obtained by calling [getRunningProcessInformation](js
import appManager from '@ohos.app.ability.appManager';
appManager.getRunningProcessInformation((error, data) => {
console.log('error: ${error.code}, data: ${JSON.stringify(data)}');
if (error && error.code !== 0) {
console.error('getRunningProcessInformation fail, error: ${JSON.stringify(error)}');
} else {
console.log('getRunningProcessInformation success, data: ${JSON.stringify(data)}');
}
});
```
......
......@@ -28,6 +28,6 @@ import appManager from '@ohos.app.ability.appManager';
appManager.getProcessRunningInfos().then((data) => {
console.log('success: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('failed: ${JSON.stringify(error)}');
console.error('failed: ${JSON.stringify(error)}');
});
```
......@@ -77,7 +77,7 @@ Starts an ability. This API uses an asynchronous callback to return the result.
this.context.startAbility(want, (error) => {
if (error.code) {
// Process service logic errors.
console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -85,7 +85,7 @@ Starts an ability. This API uses an asynchronous callback to return the result.
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -155,11 +155,11 @@ Starts an ability. This API uses a promise to return the result.
})
.catch((error) => {
// Process service logic errors.
console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -167,7 +167,7 @@ Starts an ability. This API uses a promise to return the result.
startAbility(want: Want, options: StartOptions, callback: AsyncCallback&lt;void&gt;): void
Starts an ability with the start options specified. This API uses an asynchronous callback to return the result.
Starts an ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -221,7 +221,7 @@ Starts an ability with the start options specified. This API uses an asynchronou
this.context.startAbility(want, options, (error) => {
if (error.code) {
// Process service logic errors.
console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -229,7 +229,7 @@ Starts an ability with the start options specified. This API uses an asynchronou
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -295,7 +295,7 @@ Observe the following when using this API:
this.context.startAbilityWithAccount(want, accountId, (error) => {
if (error.code) {
// Process service logic errors.
console.log('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -303,7 +303,7 @@ Observe the following when using this API:
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -373,7 +373,7 @@ Observe the following when using this API:
this.context.startAbilityWithAccount(want, accountId, options, (error) => {
if (error.code) {
// Process service logic errors.
console.log('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -381,7 +381,7 @@ Observe the following when using this API:
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -461,11 +461,11 @@ Observe the following when using this API:
})
.catch((error) => {
// Process service logic errors.
console.log('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -516,7 +516,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to
this.context.startServiceExtensionAbility(want, (error) => {
if (error.code) {
// Process service logic errors.
console.log('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -524,7 +524,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -584,11 +584,11 @@ Starts a new ServiceExtensionAbility. This API uses a promise to return the resu
})
.catch((error) => {
// Process service logic errors.
console.log('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -645,7 +645,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use
this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => {
if (error.code) {
// Process service logic errors.
console.log('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -653,7 +653,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -718,11 +718,11 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use
})
.catch((error) => {
// Process service logic errors.
console.log('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -770,7 +770,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch
this.context.stopServiceExtensionAbility(want, (error) => {
if (error.code) {
// Process service logic errors.
console.log('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -778,7 +778,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -835,11 +835,11 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise
})
.catch((error) => {
// Process service logic errors.
console.log('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -892,7 +892,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec
this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => {
if (error.code) {
// Process service logic errors.
console.log('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}');
console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -900,7 +900,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -962,11 +962,11 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec
})
.catch((error) => {
// Process service logic errors.
console.log('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -1003,7 +1003,7 @@ Terminates this ability. This API uses an asynchronous callback to return the re
this.context.terminateSelf((error) => {
if (error.code) {
// Process service logic errors.
console.log('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -1046,7 +1046,7 @@ Terminates this ability. This API uses a promise to return the result.
console.log('terminateSelf succeed');
}).catch((error) => {
// Process service logic errors.
console.log('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
```
......@@ -1095,7 +1095,7 @@ Connects this ability to a ServiceAbility.
let options = {
onConnect(elementName, remote) { console.log('----------- onConnect -----------') },
onDisconnect(elementName) { console.log('----------- onDisconnect -----------') },
onFailed(code) { console.log('----------- onFailed -----------') }
onFailed(code) { console.error('----------- onFailed -----------') }
};
let connection = null;
......@@ -1103,7 +1103,7 @@ Connects this ability to a ServiceAbility.
connection = this.context.connectServiceExtensionAbility(want, options);
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -1164,7 +1164,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect
connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options);
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -1206,7 +1206,7 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous
this.context.disconnectServiceExtensionAbility(connection, (error) => {
if (error.code) {
// Process service logic errors.
console.log('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -1214,7 +1214,7 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -1265,11 +1265,11 @@ Disconnects this ability from the ServiceAbility. This API uses a promise to ret
})
.catch((error) => {
// Process service logic errors.
console.log('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -1337,11 +1337,11 @@ Observe the following when using this API:
console.log('startAbilityByCall succeed');
}).catch((error) => {
// Process service logic errors.
console.log('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -1369,10 +1369,10 @@ Observe the following when using this API:
console.log('startAbilityByCall succeed');
}).catch((error) => {
// Process service logic errors.
console.log('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -24,8 +24,11 @@ let abilityDelegator;
let cmd = 'cmd';
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand(cmd, (err: any, data: any) => {
console.info('executeShellCommand callback, result: ', err);
console.info('executeShellCommand callback, data: ', data);
abilityDelegator.executeShellCommand(cmd, (error: any, data: any) => {
if (error && error.code !== 0) {
console.error('executeShellCommand fail, error: ${JSON.stringify(error)}');
} else {
console.log('executeShellCommand success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -1916,7 +1916,7 @@ Sets a label for this UIAbility in the mission. This API uses a promise to retur
setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\<void>): void;
Sets an icon for this ability in the mission. This API uses an asynchronous callback to return the result.
Sets an icon for this ability in the mission. This API uses an asynchronous callback to return the result. The maximum size of the icon is 600 MB.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -1966,7 +1966,7 @@ Sets an icon for this ability in the mission. This API uses an asynchronous call
setMissionIcon(icon: image.PixelMap): Promise\<void>;
Sets an icon for this ability in the mission. This API uses a promise to return the result.
Sets an icon for this ability in the mission. This API uses a promise to return the result. The maximum size of the icon is 600 MB.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -2112,7 +2112,7 @@ try {
return;
}
// Carry out normal service processing.
console.info('requestDialogService succeed, result = ' + JSON.stringify(result));
console.info('requestDialogService succeed, result = ${JSON.stringify(result)}');
});
} catch (err) {
// Process input parameter errors.
......@@ -2160,7 +2160,7 @@ try {
this.context.requestDialogService(want)
.then((result) => {
// Carry out normal service processing.
console.info('requestDialogService succeed, result = ' + JSON.stringify(result));
console.info('requestDialogService succeed, result = ${JSON.stringify(result)}');
})
.catch((err) => {
// Process service logic errors.
......
......@@ -58,7 +58,7 @@ Starts an ability. This API uses an asynchronous callback to return the result.
this.context.startAbility(want, options, (error) => {
if (error.code) {
// Process service logic errors.
console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
// Carry out normal service processing.
......@@ -110,7 +110,7 @@ Starts an ability. This API uses a promise to return the result.
})
.catch((error) => {
// Process service logic errors.
console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
});
} catch (paramError) {
// Process input parameter errors.
......
......@@ -175,7 +175,6 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| -------- | ------------------------------------------------------------ |
| 17700004 | The specified user ID is not found. |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700101 | The system service is excepted. |
**Example**
......@@ -284,7 +283,7 @@ Defines the parameters that need to be specified for bundle installation, uninst
| Name | Type | Mandatory | Description |
| ------------------------------ | ------------------------------ | ------------------ | ------------------ |
| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9) to obtain the user of the current process.|
| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.|
| installFlag | number | Yes | Installation flag. The value **0** means initial installation and **1** means overwrite installation.|
| isKeepData | boolean | Yes | Whether to retain the data directory during bundle uninstall.|
| hashParams | Array<[HashParam](#hashparam)> | Yes| Hash parameters. |
......
......@@ -23,8 +23,6 @@ hasInstalled(options: CheckPackageHasInstalledOptions): void
Checks whether an application exists, or whether a native application has been installed.
**Required permissions**: none
**System capability**: SystemCapability.BundleManager.BundleFramework
**Parameters**
......
......@@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text.<br>Default value: **TextAlign.Start**|
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. |
| inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) => void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
## Events
......
......@@ -38,7 +38,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. |
| maxLength | number | Maximum number of characters in the text input. |
| inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) =&gt; void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
| showPasswordIcon<sup>9+</sup> | boolean | Whether to display the show password icon at the end of the password text box.<br>Default value: **true**|
| style<sup>9+</sup> | [TextInputStyle](#textinputstyle9) | Text input style.<br>Default value: **TextInputStyle.Default**|
| textAlign<sup>9+</sup> | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.<br>Default value: **TextAlign.Start** |
......
......@@ -683,7 +683,7 @@ Fills a rectangle on the canvas.
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.fillRect(0,30,100,100)
this.context.fillRect(30,30,100,100)
})
}
.width('100%')
......@@ -1666,10 +1666,15 @@ struct Clip {
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
region.rect(80,10,20,130)
region.rect(40,50,100,50)
region.moveTo(30, 90)
region.lineTo(110, 20)
region.lineTo(240, 130)
region.lineTo(60, 130)
region.lineTo(190, 20)
region.lineTo(270, 90)
region.closePath()
this.context.clip(region,"evenodd")
this.context.fillStyle = "rgb(255,0,0)"
this.context.fillStyle = "rgb(0,255,0)"
this.context.fillRect(0, 0, this.context.width, this.context.height)
})
}
......@@ -1918,6 +1923,8 @@ setTransform(transform?: Matrix2D): void
Resets the current transformation to the identity matrix, and then creates a new transformation matrix based on the specified **Matrix2D** object. This API is a void API.
Since API version 9, this API can be used for ArkTS widgets.
### translate
......
......@@ -27,9 +27,9 @@ Navigator(value?: {target: string, type?: NavigationType})
| Name | Description |
| ------- | -------------------------- |
| Push | Navigates to a specified page in the application. |
| Push | Navigates to the specified page in the application. |
| Replace | Replaces the current page with another one in the application and destroys the current page.|
| Back | Returns to the previous page or a specified page. |
| Back | Returns to the specified page. If the specified page does not exist in the stack, no response is returned. If no page is specified, the previous page is returned to.|
## Attributes
......
......@@ -727,7 +727,7 @@ Fills a rectangle on the canvas.
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.fillRect(0,30,100,100)
this.offContext.fillRect(30,30,100,100)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
......@@ -1767,10 +1767,15 @@ struct Clip {
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
region.rect(80,10,20,130)
region.rect(40,50,100,50)
region.moveTo(30, 90)
region.lineTo(110, 20)
region.lineTo(240, 130)
region.lineTo(60, 130)
region.lineTo(190, 20)
region.lineTo(270, 90)
region.closePath()
this.offContext.clip(region,"evenodd")
this.offContext.fillStyle = "rgb(255,0,0)"
this.offContext.fillStyle = "rgb(0,255,0)"
this.offContext.fillRect(0, 0, 600, 600)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
......
......@@ -4,7 +4,11 @@
### **Distributed Hardware Subsystem**
The distributed hardware subsystem manages hardware information of all the devices in a Super Device so that the hardware capabilities can be shared and called across devices.
Super Device allows multiple devices to collaborate with each other to provide optimal user experience.
The distributed hardware subsystem shares peripheral capabilities between devices in a Super Device. It manages the hardware information of each device in a virtual hardware resource pool and centrally shares and schedules the hardware capabilities across devices. The distributed hardware subsystem breaks device boundaries and redefines product forms and user experience through software. For example, you can display the content of your smartphone on a TV screen, and leverage the smartphone cameras to provide enhanced video recording capabilities for your PC.
The distributed hardware platform uses a hardware virtualization component to implement hardware resource pooling of all devices in a Super Device. Each device has a virtual hardware instance registered with the platform. The hardware virtualization component implements the interaction between the virtual hardware and physical hardware to complete the control over the hardware and data transmission. Hardware resource pooling implements hardware virtualization over the hardware device interface (HDI). Each service subsystem at the service layer can use distributed hardware like using local hardware.
### Architecture
......@@ -24,15 +28,15 @@ foundation/distributedhardware
### DeviceManager
DeviceManager provides authentication and networking for devices of a Super Device, including discovering distributed devices, performing authentication, and listening for device online/offline status.
OpenHarmony DeviceManager provides authentication and networking capabilities for distributed devices and provides a set of APIs for detecting the online/offline device status, and discovering and authenticating distributed devices. The DeviceManager implements trusted status management, online/offline status management, device discovery, and authentication management. The discovered and authenticated devices can form a Super Device. In the Super Device, hardware resources are automatically synchronized to all devices and uniformly managed by the distributed hardware subsystem.
### Distributed Hardware Framework
As an information management component of the distributed hardware subsystem, the distributed hardware framework implements unified hardware access, information query, and hardware enablement.
The distributed hardware framework provides information management capabilities for the distributed hardware subsystem. It implements unified hardware access, query, and enablement for the distributed hardware subsystem.
### Distributed Camera
The distributed camera component implements collaboration of cameras of multiple devices that form a Super Device. Instead of directly interacting with applications, the distributed camera component only provides C++ interfaces for the distributed hardware framework. Applications can call the APIs of the camera framework to use the distributed camera component to operate cameras of other devices, just like operating a local camera.
Distributed camera implements collaboration of cameras of multiple devices that form a Super Device. The distributed camera component provides C++ interfaces for the distributed hardware framework, but not directly interacting with applications. Applications can call the APIs of the camera framework to use the distributed camera component to operate cameras of other devices, just like operating a local camera.
### Distributed Screen
......
# OpenHarmony 3.1.6 Release
## Version Description
OpenHarmony 3.1.6 Release provides enhanced system security over OpenHarmony 3.1.5 Release by rectifying memory leak issues, certain known vulnerabilities in open-source components such as Linux kernel, and system stability issues. The matching SDK version is also updated.
## Version Mapping
**Table 1** Version mapping of software and tools
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 3.1.6 Release | NA |
| Full SDK | Ohos_sdk_full 3.1.12.5 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Public SDK | Ohos_sdk_public 3.1.12.5 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.|
| (Optional) HUAWEI DevEco Studio| 3.1 Preview for OpenHarmony| Recommended for developing OpenHarmony applications|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release| Recommended for developing OpenHarmony smart devices|
## Source Code Acquisition
### Prerequisites
1. Register your account with Gitee.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure user information.
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. Run the following commands to install the **repo** tool:
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the permission, download the tool to another directory and configure it as an environment variable by running the chmod a+x /usr/local/bin/repo command.
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
### Acquiring Source Code Using the repo Tool
**Method 1 (recommended)**
Use the **repo** tool to download the source code over SSH. (You must have an SSH public key for access to Gitee.)
```
repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.1.6-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
**Method 2**
Use the **repo** tool to download the source code over HTTPS.
```
repo init -u https://gitee.com/openharmony/manifest.git -b refs/tags/OpenHarmony-v3.1.6-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
### Acquiring Source Code from Mirrors
**Table 2** Mirrors for acquiring source code
| Source Code| Version| Mirror| SHA-256 Checksum|
| -------- | -------- | -------- | -------- |
| Full code base (for mini, small, and standard systems)| 3.1.6 Release| [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/code-v3.1.6-Release.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/code-v3.1.6-Release.tar.gz.sha256) |
| Hi3516 standard system solution (binary)| 3.1.6 Release| [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/standard_hi3516.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/standard_hi3516.tar.gz.sha256) |
| RK3568 standard system solution (binary)| 3.1.6 Release| [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/standard_rk3568.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/standard_rk3568.tar.gz.sha256) |
| Hi3861 mini system solution (binary)| 3.1.6 Release| [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/hispark_pegasus.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/hispark_pegasus.tar.gz.sha256) |
| Hi3516 small system solution - LiteOS (binary)| 3.1.6 Release| [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/hispark_taurus.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/hispark_taurus.tar.gz.sha256) |
| Hi3516 small system solution - Linux (binary)| 3.1.6 Release| [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/hispark_taurus_linux.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/hispark_taurus_linux.tar.gz.sha256) |
| Full SDK package for the standard system (macOS)| 3.1.12.5 | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-mac-full.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-mac-full.tar.gz.sha256) |
| Full SDK package for the standard system (Windows/Linux)| 3.1.12.5 | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-full.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-full.tar.gz.sha256) |
| Public SDK package for the standard system (macOS)| 3.1.12.5 | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-mac-public.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-mac-public.tar.gz.sha256) |
| Public SDK package for the standard system (Windows/Linux)| 3.1.12.5 | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-public.tar.gz) | [Download](https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-public.tar.gz.sha256) |
## What's New
This version has the following updates to OpenHarmony 3.1.5 Release.
### Feature Updates
This version does not involve feature updates.
### API Updates
This version does not involve API updates.
### Chip and Development Board Adaptation
For details about the adaptation status, see [SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md).
### Resolved Issues
**Table 3** Resolved issues
| Subsystem | Description |
| ------------------ | ------------------------------------------------------------ |
| Application subsystem | The JS crash occurs multiple times in the updateCallTimeList stack of the com.ohos.callui application. ([I5LWIW](https://gitee.com/openharmony/applications_call/issues/I5LWIW))|
| Globalization subsystem | The exception stack libglobal_resmgr.z.so occurs multiple times in the com.ohos.launch thread of the key process com.ohos.launcher. ([I5LT0M](https://gitee.com/openharmony/global_resource_management/issues/I5LT0M))<br>The exception stack libglobal_resmgr.z.so occurs multiple times in the 2.ui thread of the com.ohos.permissionmanager process. ([I68J7P](https://gitee.com/openharmony/global_resource_management/issues/I68J7P))|
| Misc services subsystem| The CPP crash occurs in the com.example.kikakeyboard process of libinputmethod_client.z.so. ([I66W3B](https://gitee.com/openharmony/inputmethod_imf/issues/I66W3B))<br>The CPP crash occurs during a pressure test using a tool. ([I65K13](https://gitee.com/openharmony/inputmethod_imf/issues/I65K13))|
| Distributed hardware | The JS crash occurs multiple times in com.ohos.devicemanagerui. ([I69LD9](https://gitee.com/openharmony/distributedhardware_device_manager/issues/I69LD9))|
| DSoftBus | Media resources of the peer device cannot be displayed after the distributed Gallery network is restarted. ([I674LD](https://gitee.com/openharmony/applications_photos/issues/I674LD))|
### Fixed Security Vulnerabilities
**Table 4** Fixed security vulnerabilities
| Issue No.| Description| PR Link|
| -------- | -------- | -------- |
| I5UI5A | Security vulnerabilities of the kernel_linux_5.10 component: CVE-2022-41218, CVE-2022-3424, CVE-2022-42328, CVE-2022-3643, and CVE-2022-47946| [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/646) |
| I69WX6 | Security vulnerability of the ffmpeg component: CVE-2022-3341 | [PR](https://gitee.com/openharmony/third_party_ffmpeg/pulls/74) |
| I68JS0 | Security vulnerability of the ffmpeg component: CVE-2022-3109 | [PR](https://gitee.com/openharmony/third_party_ffmpeg/pulls/71) |
| I671DT | Security vulnerabilities of the curl component: CVE-2022-43551 and CVE-2022-43552 | [PR](https://gitee.com/openharmony/third_party_curl/pulls/99) |
| I6A4YJ | Security vulnerability of the kernel_linux_5.10 component: CVE-2022-20568 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/629) |
| I6A55C | Security vulnerability of the kernel_linux_5.10 component: CVE-2023-0047 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/631) |
## Known Issues
**Table 5** Known issues
| Issue No. | Description | Impact | To Be Resolved By|
| ------------------------------------------------------------ | ---------------------------------------------------------- | ---------------- | ------------ |
| [I6AF0Y](https://gitee.com/openharmony/ability_ability_runtime/issues/I6AF0Y) | When two windows are paired in split-screen mode, if one window is closed, the other window is also closed.| Exiting the split-screen mode does not take effect.| 2023/02/15 |
......@@ -40,6 +40,8 @@
- [应用测试](application-test/Readme-CN.md)
- [IDL工具规格及使用说明书](IDL/idl-guidelines.md)
- [Native API的相关指导](napi/Readme-CN.md)
- [文件管理](file-management/medialibrary-overview.md)
- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md)
### 工具
......
......@@ -40,6 +40,8 @@
- [应用测试](application-test/arkxtest-guidelines.md)
- [IDL工具规格及使用说明书](IDL/idl-guidelines.md)
- [Native API的相关指导](napi/napi-guidelines.md)
- [文件管理](file-management/medialibrary-overview.md)
- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md)
### 工具
......
......@@ -597,7 +597,7 @@ struct GridRowSample6 {
**示例7:**
通过order属性,控制GridCol的顺序。在sm和md断点下,按照至6的顺序排列显示;在lg断点下,按照6至1的顺序排列显示。
通过order属性,控制GridCol的顺序。在sm和md断点下,按照1至6的顺序排列显示;在lg断点下,按照6至1的顺序排列显示。
| sm | md | lg |
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册