提交 58a83ff4 编写于 作者: zyjhandsome's avatar zyjhandsome 提交者: Gitee

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

Signed-off-by: zyjhandsome's avatarzyjhandsome <zyjhandsome@126.com>
...@@ -25,7 +25,8 @@ An [ExtensionAbilityType](../reference/apis/js-apis-bundleManager.md#extensionab ...@@ -25,7 +25,8 @@ An [ExtensionAbilityType](../reference/apis/js-apis-bundleManager.md#extensionab
- [EnterpriseAdminExtensionAbility](../reference/apis/js-apis-EnterpriseAdminExtensionAbility.md): ExtensionAbility component of the enterprise_admin type, which provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts. - [EnterpriseAdminExtensionAbility](../reference/apis/js-apis-EnterpriseAdminExtensionAbility.md): ExtensionAbility component of the enterprise_admin type, which provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts.
> **NOTE**<br> > **NOTE**
>
> 1. Third-party applications cannot implement ServiceExtensionAbility, DataShareExtensionAbility, StaticSubscriberExtensionAbility, or WindowExtensionAbility. > 1. Third-party applications cannot implement ServiceExtensionAbility, DataShareExtensionAbility, StaticSubscriberExtensionAbility, or WindowExtensionAbility.
> >
> 2. To implement transaction processing in the background for a third-party application, use background tasks rather than ServiceExtensionAbility. For details, see [Background Task](../task-management/background-task-overview.md). > 2. To implement transaction processing in the background for a third-party application, use background tasks rather than ServiceExtensionAbility. For details, see [Background Task](../task-management/background-task-overview.md).
...@@ -45,7 +46,7 @@ The following uses [InputMethodExtensionAbility](../reference/apis/js-apis-input ...@@ -45,7 +46,7 @@ The following uses [InputMethodExtensionAbility](../reference/apis/js-apis-input
## Implementing ExtensionAbility of the Specified Type ## Implementing ExtensionAbility of the Specified Type
The following uses [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md) as an example. The widget framework provides the base class [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md). You derive this base class to create your own class (such as **MyFormExtensionAbility**), implement the callbacks, such as **onCreate()** and **onUpdateForm()**, to provide specific widget functionalities. For details, see [FormExtensionAbility](Widget-development-stage.md). The following uses [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md) as an example. The widget framework provides the base class [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md). You derive this base class to create your own class (such as **MyFormExtensionAbility**), implement the callbacks, such as **onCreate()** and **onUpdateForm()**, to provide specific widget functionalities. For details, see [FormExtensionAbility](service-widget-overview.md).
You do not need to care when to add or delete a widget. The lifecycle of the FormExtensionAbility instance and the lifecycle of the ExtensionAbility process where the FormExtensionAbility instance is located are scheduled and managed by FormManagerService. You do not need to care when to add or delete a widget. The lifecycle of the FormExtensionAbility instance and the lifecycle of the ExtensionAbility process where the FormExtensionAbility instance is located are scheduled and managed by FormManagerService.
...@@ -63,3 +64,5 @@ You do not need to care when to add or delete a widget. The lifecycle of the For ...@@ -63,3 +64,5 @@ You do not need to care when to add or delete a widget. The lifecycle of the For
> - The two FormExtensionAbility components run in an independent process. > - The two FormExtensionAbility components run in an independent process.
> >
> - The two ImeExtensionAbility components run in an independent process. > - The two ImeExtensionAbility components run in an independent process.
<!--no_check-->
\ No newline at end of file
...@@ -323,7 +323,7 @@ async function deleteFormInfo(formId: string) { ...@@ -323,7 +323,7 @@ async function deleteFormInfo(formId: string) {
// ... // ...
``` ```
For details about how to implement persistent data storage, see [Lightweight Data Store Development](../database/database-preference-guidelines.md). For details about how to implement persistent data storage, see [Persisting Preferences Data](../database/data-persistence-by-preferences.md).
The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary. The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary.
......
...@@ -332,7 +332,7 @@ export default class EntryFormAbility extends FormExtension { ...@@ -332,7 +332,7 @@ export default class EntryFormAbility extends FormExtension {
} }
``` ```
For details about how to implement persistent data storage, see [Lightweight Data Store Development](../database/database-preference-guidelines.md). For details about how to implement persistent data storage, see [Persisting Preferences Data](../database/data-persistence-by-preferences.md).
The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary. The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary.
......
...@@ -53,10 +53,10 @@ let want = { ...@@ -53,10 +53,10 @@ let want = {
abilityName: 'EntryAbility' abilityName: 'EntryAbility'
}; };
abilityDelegator.startAbility(want, (err) => { abilityDelegator.startAbility(want, (err) => {
if (!err || err.code === 0) { if (err) {
console.log('Success start ability.');
} else {
console.error('Failed start ability, error: ${JSON.stringify(err)}'); console.error('Failed start ability, error: ${JSON.stringify(err)}');
} else {
console.log('Success start ability.');
} }
}); });
``` ```
......
...@@ -40,7 +40,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -40,7 +40,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
appManager.isRunningInStabilityTest((err, flag) => { appManager.isRunningInStabilityTest((err, flag) => {
if (err && err.code !== 0) { if (err) {
console.error('isRunningInStabilityTest fail, err: ${JSON.stringify(err)}'); console.error('isRunningInStabilityTest fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}'); console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}');
...@@ -146,7 +146,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -146,7 +146,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
appManager.isRamConstrainedDevice((err, data) => { appManager.isRamConstrainedDevice((err, data) => {
if (err && err.code !== 0) { if (err) {
console.error('isRamConstrainedDevice fail, err: ${JSON.stringify(err)}'); console.error('isRamConstrainedDevice fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}'); console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
...@@ -216,7 +216,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -216,7 +216,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
appManager.getAppMemorySize((err, data) => { appManager.getAppMemorySize((err, data) => {
if (err && err.code !== 0) { if (err) {
console.error('getAppMemorySize fail, err: ${JSON.stringify(err)}'); console.error('getAppMemorySize fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('The size of app memory is: ${JSON.stringify(data)}'); console.log('The size of app memory is: ${JSON.stringify(data)}');
...@@ -290,7 +290,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -290,7 +290,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
appManager.getRunningProcessInformation((err, data) => { appManager.getRunningProcessInformation((err, data) => {
if (err && err.code !== 0) { if (err) {
console.error('getRunningProcessInformation fail, err: ${JSON.stringify(err)}'); console.error('getRunningProcessInformation fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('The process running information is: ${JSON.stringify(data)}'); console.log('The process running information is: ${JSON.stringify(data)}');
...@@ -489,7 +489,7 @@ try { ...@@ -489,7 +489,7 @@ try {
// 2. Deregister the application state observer. // 2. Deregister the application state observer.
function unregisterApplicationStateObserverCallback(err) { function unregisterApplicationStateObserverCallback(err) {
if (err && err.code !== 0) { if (err) {
console.error('unregisterApplicationStateObserverCallback fail, err: ${JSON.stringify(err)}'); console.error('unregisterApplicationStateObserverCallback fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('unregisterApplicationStateObserverCallback success.'); console.log('unregisterApplicationStateObserverCallback success.');
...@@ -612,7 +612,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -612,7 +612,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
function getForegroundApplicationsCallback(err, data) { function getForegroundApplicationsCallback(err, data) {
if (err && err.code !== 0) { if (err) {
console.error('getForegroundApplicationsCallback fail, err: ${JSON.stringify(err)}'); console.error('getForegroundApplicationsCallback fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('getForegroundApplicationsCallback success, data: ${JSON.stringify(data)}'); console.log('getForegroundApplicationsCallback success, data: ${JSON.stringify(data)}');
...@@ -745,7 +745,7 @@ import appManager from '@ohos.app.ability.appManager'; ...@@ -745,7 +745,7 @@ import appManager from '@ohos.app.ability.appManager';
let bundleName = 'bundleName'; let bundleName = 'bundleName';
let accountId = 0; let accountId = 0;
function killProcessWithAccountCallback(err, data) { function killProcessWithAccountCallback(err, data) {
if (err && err.code !== 0) { if (err) {
console.error('killProcessWithAccountCallback fail, err: ${JSON.stringify(err)}'); console.error('killProcessWithAccountCallback fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('killProcessWithAccountCallback success.'); console.log('killProcessWithAccountCallback success.');
...@@ -788,7 +788,7 @@ import appManager from '@ohos.app.ability.appManager'; ...@@ -788,7 +788,7 @@ import appManager from '@ohos.app.ability.appManager';
let bundleName = 'bundleName'; let bundleName = 'bundleName';
function killProcessesByBundleNameCallback(err, data) { function killProcessesByBundleNameCallback(err, data) {
if (err && err.code !== 0) { if (err) {
console.error('killProcessesByBundleNameCallback fail, err: ${JSON.stringify(err)}'); console.error('killProcessesByBundleNameCallback fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('killProcessesByBundleNameCallback success.'); console.log('killProcessesByBundleNameCallback success.');
...@@ -884,7 +884,7 @@ import appManager from '@ohos.app.ability.appManager'; ...@@ -884,7 +884,7 @@ import appManager from '@ohos.app.ability.appManager';
let bundleName = 'bundleName'; let bundleName = 'bundleName';
function clearUpApplicationDataCallback(err, data) { function clearUpApplicationDataCallback(err, data) {
if (err && err.code !== 0) { if (err) {
console.error('clearUpApplicationDataCallback fail, err: ${JSON.stringify(err)}'); console.error('clearUpApplicationDataCallback fail, err: ${JSON.stringify(err)}');
} else { } else {
console.log('clearUpApplicationDataCallback success.'); console.log('clearUpApplicationDataCallback success.');
......
...@@ -29,7 +29,7 @@ Creates a **Filter** instance based on the pixel map. ...@@ -29,7 +29,7 @@ Creates a **Filter** instance based on the pixel map.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------- | ---- | -------- | | ------- | ----------------- | ---- | -------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | **PixelMap** instance created by the image module. | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | **PixelMap** instance created by the image module. An instance can be obtained by decoding an image or directly created. For details, see [Image Overview](../../media/image-overview.md). |
**Return value** **Return value**
...@@ -61,7 +61,7 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses a promi ...@@ -61,7 +61,7 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses a promi
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------- | ---- | -------------------------- | | -------- | ----------- | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | **PixelMap** instance created by the image module.| | source | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | **PixelMap** instance created by the image module. An instance can be obtained by decoding an image or directly created. For details, see [Image Overview](../../media/image-overview.md).|
**Return value** **Return value**
...@@ -95,7 +95,7 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses an asyn ...@@ -95,7 +95,7 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses an asyn
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------ | ---- | -------------------------- | | -------- | ------------------ | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes |**PixelMap** instance created by the image module. | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes |**PixelMap** instance created by the image module. An instance can be obtained by decoding an image or directly created. For details, see [Image Overview](../../media/image-overview.md). |
| callback | AsyncCallback\<[ColorPicker](#colorpicker)> | Yes | Callback used to return the **ColorPicker** instance created.| | callback | AsyncCallback\<[ColorPicker](#colorpicker)> | Yes | Callback used to return the **ColorPicker** instance created.|
**Example** **Example**
......
# @ohos.enterprise.dateTimeManager (System Time Management) # @ohos.enterprise.dateTimeManager (System Time Management)
The **dateTimeManager** module provides APIs for system time management, which can only be called by device administrator applications. The **dateTimeManager** module provides APIs for system time management. Only the enterprise device administrator applications can call the APIs provided by this module.
> **NOTE** > **NOTE**
> >
...@@ -30,7 +30,7 @@ Sets the system time. This API uses an asynchronous callback to return the resul ...@@ -30,7 +30,7 @@ Sets the system time. This API uses an asynchronous callback to return the resul
| ----- | ----------------------------------- | ---- | ------- | | ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.| | admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).| | time | number | Yes| Timestamp (ms).|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the setting is successful, **err** is **null**. Otherwise, **err** is an error object.| | callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -101,3 +101,181 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => { ...@@ -101,3 +101,181 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => {
console.log("error code:" + error.code + " error message:" + error.message); console.log("error code:" + error.code + " error message:" + error.message);
}) })
``` ```
## dateTimeManager.disallowModifyDateTime<sup>10+</sup>
disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<void>): void
Disables modification of the system time. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disallow | boolean | Yes| Whether to disable modification of the system time. The value **true** means to disable modification of the system time, and **false** means the opposite.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp, true, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
})
```
## dateTimeManager.disallowModifyDateTime<sup>10+</sup>
disallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void>
Disables modification of the system time. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disallow | boolean | Yes| Whether to disable modification of the system time. The value **true** means to disable modification of the system time, and **false** means the opposite.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | that returns no value. If the operation fails, an error object is thrown.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
```
## dateTimeManager.isModifyDateTimeDisallowed<sup>10+</sup>
isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void
Checks whether modification of the system time is disabled. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| callback | AsyncCallback\<boolean> | Yes| Callback used to return the result. The value **true** means that modification of the system time is disabled, and **false** means the opposite.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
})
```
## dateTimeManager.isModifyDateTimeDisallowed<sup>10+</sup>
isModifyDateTimeDisallowed(admin: Want): Promise\<boolean>
Checks whether modification of the system time is disabled. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<boolean> | Promise Promise used to return the result. The value **true** means that modification of the system time is disabled, and **false** means the opposite.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
```
...@@ -6,6 +6,12 @@ The **AbilityMonitor** module provides monitors for abilities that meet specifie ...@@ -6,6 +6,12 @@ The **AbilityMonitor** module provides monitors for abilities that meet specifie
> >
> 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.
## Modules to Import
```ts
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
```
## Usage ## Usage
**AbilityMonitor** can be used as an input parameter of [addAbilityMonitor](js-apis-inner-application-abilityDelegator.md#addabilitymonitor9) in **abilityDelegator** to listen for lifecycle changes of an ability. **AbilityMonitor** can be used as an input parameter of [addAbilityMonitor](js-apis-inner-application-abilityDelegator.md#addabilitymonitor9) in **abilityDelegator** to listen for lifecycle changes of an ability.
...@@ -43,9 +49,9 @@ let monitor = { ...@@ -43,9 +49,9 @@ let monitor = {
onAbilityCreate: onAbilityCreateCallback onAbilityCreate: onAbilityCreateCallback
}; };
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.addAbilityMonitor(monitor, (error : any) => { abilityDelegator.addAbilityMonitor(monitor, (error : any) => {
if (error && error.code !== 0) { if (error) {
console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}'); console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}');
} }
}); });
......
...@@ -6,6 +6,12 @@ The **AbilityRunningInfo** module defines the running information and state of a ...@@ -6,6 +6,12 @@ The **AbilityRunningInfo** module defines the running information and state of a
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
```
## Usage ## Usage
The ability running information is obtained by calling [getAbilityRunningInfos](js-apis-app-ability-abilityManager.md#getabilityrunninginfos) in **abilityManager**. The ability running information is obtained by calling [getAbilityRunningInfos](js-apis-app-ability-abilityManager.md#getabilityrunninginfos) in **abilityManager**.
...@@ -31,7 +37,7 @@ The ability running information is obtained by calling [getAbilityRunningInfos]( ...@@ -31,7 +37,7 @@ The ability running information is obtained by calling [getAbilityRunningInfos](
import abilitymanager from '@ohos.app.ability.abilityManager'; import abilitymanager from '@ohos.app.ability.abilityManager';
abilitymanager.getAbilityRunningInfos((error, data) => { abilitymanager.getAbilityRunningInfos((error, data) => {
if (error && error.code !== 0) { if (error) {
console.error('getAbilityRunningInfos fail, error: ${JSON.stringify(error)}'); console.error('getAbilityRunningInfos fail, error: ${JSON.stringify(error)}');
} else { } else {
console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}'); console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}');
......
# AbilityStageMonitor # AbilityStageMonitor
The **AbilityStageMonitor** module provides conditions for matching **AbilityStage** instances. The most recently matched **AbilityStage** instance is saved in an **AbilityStageMonitor** instance. The **AbilityStageMonitor** module provides conditions for matching **AbilityStage** instances. The most recently matched **AbilityStage** instance is saved in an **AbilityStageMonitor** instance.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -20,7 +21,7 @@ let monitor = { ...@@ -20,7 +21,7 @@ let monitor = {
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.waitAbilityStageMonitor(monitor, (error, data) => { abilityDelegator.waitAbilityStageMonitor(monitor, (error, data) => {
if (error && error.code !== 0) { if (error) {
console.error('waitAbilityStageMonitor fail, error: ${JSON.stringify(error)}'); console.error('waitAbilityStageMonitor fail, error: ${JSON.stringify(error)}');
} else { } else {
console.log('waitAbilityStageMonitor success, data: ${JSON.stringify(data)}'); console.log('waitAbilityStageMonitor success, data: ${JSON.stringify(data)}');
......
...@@ -6,6 +6,12 @@ The **ProcessInformation** module defines the running information of a process. ...@@ -6,6 +6,12 @@ The **ProcessInformation** module defines the running information of a process.
> >
> 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.
## Modules to Import
```ts
import appManager from '@ohos.app.ability.appManager';
```
## How to Use ## How to Use
The process information is obtained by calling [getRunningProcessInformation](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation9) of the **appManager** module. The process information is obtained by calling [getRunningProcessInformation](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation9) of the **appManager** module.
...@@ -14,7 +20,7 @@ The process information is obtained by calling [getRunningProcessInformation](js ...@@ -14,7 +20,7 @@ The process information is obtained by calling [getRunningProcessInformation](js
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
appManager.getRunningProcessInformation((error, data) => { appManager.getRunningProcessInformation((error, data) => {
if (error && error.code !== 0) { if (error) {
console.error('getRunningProcessInformation fail, error: ${JSON.stringify(error)}'); console.error('getRunningProcessInformation fail, error: ${JSON.stringify(error)}');
} else { } else {
console.log('getRunningProcessInformation success, data: ${JSON.stringify(data)}'); console.log('getRunningProcessInformation success, data: ${JSON.stringify(data)}');
......
...@@ -6,6 +6,12 @@ The **ShellCmdResult** module provides the shell command execution result. ...@@ -6,6 +6,12 @@ The **ShellCmdResult** module provides the shell command execution result.
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
...@@ -20,12 +26,12 @@ The result is obtained by calling [executeShellCommand](js-apis-inner-applicatio ...@@ -20,12 +26,12 @@ The result is obtained by calling [executeShellCommand](js-apis-inner-applicatio
**Example** **Example**
```ts ```ts
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
let abilityDelegator; let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator;
let cmd = 'cmd'; let cmd = 'cmd';
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand(cmd, (error: any, data: any) => { abilityDelegator.executeShellCommand(cmd, (error: any, data: any) => {
if (error && error.code !== 0) { if (error) {
console.error('executeShellCommand fail, error: ${JSON.stringify(error)}'); console.error('executeShellCommand fail, error: ${JSON.stringify(error)}');
} else { } else {
console.log('executeShellCommand success, data: ${JSON.stringify(data)}'); console.log('executeShellCommand success, data: ${JSON.stringify(data)}');
......
...@@ -47,7 +47,7 @@ struct Page45 { ...@@ -47,7 +47,7 @@ struct Page45 {
grad.addColorStop(0.5, '#ffffff') grad.addColorStop(0.5, '#ffffff')
grad.addColorStop(1.0, '#00ff00') grad.addColorStop(1.0, '#00ff00')
this.context.fillStyle = grad this.context.fillStyle = grad
this.context.fillRect(0, 0, 500, 500) this.context.fillRect(0, 0, 400, 400)
}) })
} }
.width('100%') .width('100%')
......
...@@ -24,29 +24,29 @@ An **ImageData** object stores pixel data rendered on a canvas. ...@@ -24,29 +24,29 @@ An **ImageData** object stores pixel data rendered on a canvas.
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Translate { struct Translate {
private settings: RenderingContextSettings = new RenderingContextSettings(true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private img:ImageBitmap = new ImageBitmap("/common/images/1234.png") private img:ImageBitmap = new ImageBitmap("common/images/1234.png")
build() { build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context) Canvas(this.context)
.width('100%') .width('100%')
.height('100%') .height('100%')
.backgroundColor('#ffff00') .backgroundColor('#ffff00')
.onReady(() =>{ .onReady(() =>{
this.context.drawImage(this.img,0,0,130,130) this.context.drawImage(this.img,0,0,130,130)
var imagedata = this.context.getImageData(50,50,130,130) var imagedata = this.context.getImageData(50,50,130,130)
this.context.putImageData(imagedata,150,150) this.context.putImageData(imagedata,150,150)
}) })
}
.width('100%')
.height('100%')
} }
.width('100%')
.height('100%')
} }
}
``` ```
![en-us_image_000000127777780](figures/en-us_image_000000127777780.png) ![en-us_image_000000127777780](figures/en-us_image_000000127777780.png)
...@@ -39,7 +39,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -39,7 +39,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not work for the **\<Line>** component, which does not have corners. | | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not work for the **\<Line>** component, which does not have corners.|
| strokeMiterLimit | number \| string | 4 | Limit value when the sharp angle is drawn as a miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a shape with a sharp angle.| | strokeMiterLimit | number \| string | 4 | Limit value when the sharp angle is drawn as a miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a shape with a sharp angle.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.|
| strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.|
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册