diff --git a/CODEOWNERS b/CODEOWNERS
index 638941c1a2a1765ad2a55dd81cf65ca72dce37be..74369f93b5bd83ef4503414d2d0d5f18326aadfd 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -187,7 +187,8 @@ zh-cn/application-dev/dfx/errormanager-guidelines.md @littlejerry1 @ccllee @chen
zh-cn/application-dev/key-features/multi-device-app-dev/ @lingminghw @crazyracing0726
zh-cn/application-dev/database/ @ge-yafang @feng-aiwen @gong-a-shi @logic42
zh-cn/application-dev/napi/native-window-guidelines.md @ge-yafang @zhangqiang183 @zhouyaoying @zxg-gitee
-zh-cn/application-dev/napi/mindspore-lite-guidelines.md @ge-yafang @grbuzhidao @jianghui58 @auraxu
+zh-cn/application-dev/napi/mindspore-lite-guidelines.md @ge-yafang @principal87 @jianghui58
+zh-cn/application-dev/napi/neural-network-runtime-guidelines.md @ge-yafang @principal87 @win10wei
zh-cn/application-dev/napi/rawfile_guidelines.md @ningningW
zh-cn/application-dev/background-agent-scheduled-reminder/ @RayShih
zh-cn/application-dev/background-task-management/ @ningningW @wangwenli_wolf @tangtiantian2021 @nan-xiansen
@@ -321,6 +322,8 @@ zh-cn/application-dev/reference/apis/js-apis-data-DataShareResultSet.md @feng-ai
zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-data-preferences.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
+zh-cn/application-dev/reference/apis/js-apis-data-udmf.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
+zh-cn/application-dev/reference/apis/js-apis-data-cloudData.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-data-relationStore.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-data-resultset.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-data-storage.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
diff --git a/en/OpenHarmony-Overview.md b/en/OpenHarmony-Overview.md
index 1aecb0171e73b02bcbcb9347497f594bf96c912e..567e303175ce4908ac4a0e1b1c81f016de47966a 100644
--- a/en/OpenHarmony-Overview.md
+++ b/en/OpenHarmony-Overview.md
@@ -1,5 +1,9 @@
# OpenHarmony Project
+> **NOTE**
+>
+> You are reading documents of OpenHarmony 4.0 Beta1. Obtain the [compatible SDK](release-notes/OpenHarmony-v4.0-beta1.md#version-mapping) during your application development.
+
## Introduction
OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. The purpose of this project is to build an open-source, distributed operating system (OS) framework for smart devices in all scenarios of a fully-connected world.
@@ -146,7 +150,7 @@ The following table describes the subsystems of OpenHarmony. For details about t
## Supported Development Boards
-Currently, the OpenHarmony community supports 22 types of development boards, which are listed in [Development Boards Supported](device-dev/dev-board-on-the-master.md). The following table describes three of them, which are the first three integrated into the OpenHarmony master. You can visit http://ci.openharmony.cn/dailys/dailybuilds to obtain daily builds.
+Currently, the OpenHarmony community supports 22 types of development boards, which are listed in [Development Boards Supported](device-dev/dev-board-on-the-master.md). The following table describes three of them, which are the first three integrated into the OpenHarmony master. You can visit http://ci.openharmony.cn/workbench/cicd/dailybuild/dailylist to obtain daily builds.
| System Type| Board Model| Chip Model|
Function Description and Use Case
| Application Scenario| Code Repository |
| -------- | -------- | -------- | -------- | -------- | -------- |
diff --git a/en/application-dev/IDL/idl-guidelines.md b/en/application-dev/IDL/idl-guidelines.md
index a7ce0ec46adeeca0dd697cd8dabde834b7cc14fc..102992de24a2879f9b08a5274058c2cdf4c0a280 100644
--- a/en/application-dev/IDL/idl-guidelines.md
+++ b/en/application-dev/IDL/idl-guidelines.md
@@ -1,4 +1,4 @@
-# OpenHarmony IDL Specifications and User Guide
+# IDL Specifications and User Guide
## IDL Overview
To ensure successful communications between the client and server, interfaces recognized by both parties must be defined. The OpenHarmony Interface Definition Language (IDL) is a tool for defining such interfaces. OpenHarmony IDL decomposes objects to be transferred into primitives that can be understood by the operating system and encapsulates cross-boundary objects based on developers' requirements.
@@ -162,7 +162,7 @@ Go to the local installation path, choose **toolchains > 3.x.x.x** (the folder n
If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses [3.2 Beta3](../../release-notes/OpenHarmony-v3.2-beta3.md) as an example.
-For details about how to replace the SDK package, see [Full SDK Compilation Guide](../quick-start/full-sdk-compile-guide.md).
+For details about how to replace the SDK package, see [Full SDK Compilation Guide](../faqs/full-sdk-compile-guide.md).
After obtaining the executable file, perform subsequent development steps based on your scenario.
diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md
index f71b814661e652486bf1a61ee3e7c7dd23dbcf4a..66ce310670de99071b5ff7e642803e04d78e5d6f 100644
--- a/en/application-dev/Readme-EN.md
+++ b/en/application-dev/Readme-EN.md
@@ -4,18 +4,16 @@
- About OpenHarmony
- [OpenHarmony Project](../OpenHarmony-Overview.md)
- [Glossary](../glossary.md)
- - [OpenHarmony Release Notes](../release-notes/Readme.md)
+ - [Release Notes](../release-notes/Readme.md)
- Quick Start
- Getting Started
- [Before You Start](quick-start/start-overview.md)
- [Getting Started with ArkTS in Stage Model](quick-start/start-with-ets-stage.md)
- - [Getting Started with ArkTS in FA Model](quick-start/start-with-ets-fa.md)
- - [Getting Started with JavaScript in FA Model](quick-start/start-with-js-fa.md)
- Development Fundamentals
- Application Package Fundamentals
- [Application Package Overview](quick-start/application-package-overview.md)
- Application Package Structure
- - [Application Package Structure in Stage Model)](quick-start/application-package-structure-stage.md)
+ - [Application Package Structure in Stage Model](quick-start/application-package-structure-stage.md)
- [Application Package Structure in FA Model](quick-start/application-package-structure-fa.md)
- Multi-HAP Mechanism
- [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md)
@@ -37,9 +35,9 @@
- Application Configuration Files in FA Model
- [Application Configuration File Overview (FA Model)](quick-start/application-configuration-file-overview-fa.md)
- [Internal Structure of the app Tag](quick-start/app-structure.md)
- - [Internal structure of deviceConfig Tag](quick-start/deviceconfig-structure.md)
+ - [Internal Structure of the deviceConfig Tag](quick-start/deviceconfig-structure.md)
- [Internal Structure of the module Tag](quick-start/module-structure.md)
- - [Resource Categories and Access](quick-start/resource-categories-and-access.md)
+ - [Resource Categories and Access](quick-start/resource-categories-and-access.md)
- Learning ArkTS
- [Getting Started with ArkTS](quick-start/arkts-get-started.md)
- Basic Syntax
@@ -48,19 +46,19 @@
- Custom Component
- [Creating a Custom Component](quick-start/arkts-create-custom-components.md)
- [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md)
- - [\@Builder: Custom Builder Function](quick-start/arkts-builder.md)
- - [\@BuilderParam: @Builder Function Reference](quick-start/arkts-builderparam.md)
- - [\@Styles: Definition of Resusable Styles](quick-start/arkts-style.md)
- - [\@Extend: Extension of Built-in Components](quick-start/arkts-extend.md)
+ - [\@Builder Decorator: Custom Builder Function](quick-start/arkts-builder.md)
+ - [\@BuilderParam Decorator: \@Builder Function Reference](quick-start/arkts-builderparam.md)
+ - [\@Styles Decorator: Definition of Resusable Styles](quick-start/arkts-style.md)
+ - [\@Extend Decorator: Extension of Built-in Components](quick-start/arkts-extend.md)
- [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md)
- State Management
- [State Management Overview](quick-start/arkts-state-management-overview.md)
- Component State Management
- - [\@State: State Owned by Component](quick-start/arkts-state.md)
- - [\@Prop: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md)
- - [\@Link: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md)
- - [\@Provide and \@Consume: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md)
- - [\@Observed and \@ObjectLink: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md)
+ - [\@State Decorator: State Owned by Component](quick-start/arkts-state.md)
+ - [\@Prop Decorator: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md)
+ - [\@Link Decorator: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md)
+ - [\@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md)
+ - [\@Observed and \@ObjectLink Decorators: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md)
- Application State Management
- [Application State Management Overview](quick-start/arkts-application-state-management-overview.md)
- [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md)
@@ -69,10 +67,10 @@
- [Environment: Device Environment Query](quick-start/arkts-environment.md)
- Other State Management Features
- [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md)
- - [\@Watch: Getting Notified of State Variable Changes](quick-start/arkts-watch.md)
+ - [\@Watch Decorator: Getting Notified of State Variable Changes](quick-start/arkts-watch.md)
- [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md)
- Rendering Control
- - [Rendering Control Overview](quick-start/arkts-rendering-control-overview.md)
+ - [Overview of Rendering Control](quick-start/arkts-rendering-control-overview.md)
- [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md)
- [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md)
- [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md)
@@ -95,28 +93,27 @@
- [DFX](dfx/Readme-EN.md)
- [Internationalization](internationalization/Readme-EN.md)
- [Application Test](application-test/Readme-EN.md)
- - [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md)
+ - [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Native APIs](napi/Readme-EN.md)
- Tools
- [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
- [Debugging Tools](tools/Readme-EN.md)
- Hands-On Tutorials
- - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md)
- - [Codelabs](https://gitee.com/openharmony/codelabs)
+ - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/OpenHarmony-4.0-Beta1/README.md)
+ - [Codelabs](https://gitee.com/openharmony/codelabs/tree/master)
- API References
- [SystemCapability](reference/syscap.md)
- [SystemCapability List](reference/syscap-list.md)
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md)
- - [JS Service Widget UI Components](reference/js-service-widget-ui/Readme-EN.md)
- - APIs
- - [ArkTS and JS APIs](reference/apis/Readme-EN.md)
+ - [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/Readme-EN.md)
+ - API Reference
+ - [ArkTS and JavaScript APIs](reference/apis/Readme-EN.md)
- [Error Codes](reference/errorcodes/Readme-EN.md)
- - Native APIs
+ - Native API Reference
- [Native APIs](reference/native-apis/Readme-EN.md)
- [Standard Libraries](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md)
- [FAQs](faqs/Readme-EN.md)
- Contribution
- [How to Contribute](../contribute/documentation-contribution.md)
-
\ No newline at end of file
diff --git a/en/application-dev/application-dev-guide-for-gitee.md b/en/application-dev/application-dev-guide-for-gitee.md
index 1ad5989d2cf8258c46e219a239a2c8c5a1d1274c..94a6427aa51f9c4f8769ba140f40063fc77023f2 100644
--- a/en/application-dev/application-dev-guide-for-gitee.md
+++ b/en/application-dev/application-dev-guide-for-gitee.md
@@ -51,7 +51,7 @@ DevEco Studio is a high-performance integrated development environment (IDE) rec
### Hands-On Tutorials
-To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs).
+To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/OpenHarmony-4.0-Beta1/README.md) and [codelabs](https://gitee.com/openharmony/codelabs).
### API References
diff --git a/en/application-dev/application-dev-guide.md b/en/application-dev/application-dev-guide.md
index 8170d075cf08e8258b7c8b3731661f0e4959c6aa..4f94d594adaee317ae68d2f58272cb2dfcbbec95 100644
--- a/en/application-dev/application-dev-guide.md
+++ b/en/application-dev/application-dev-guide.md
@@ -1,12 +1,16 @@
# Application Development Overview
+> **NOTE**
+>
+> You are reading documents of OpenHarmony 4.0 Beta1. Obtain the [compatible SDK](../release-notes/OpenHarmony-v4.0-beta1.md#version-mapping) during your application development.
+
The application development documents provide reference for you to develop applications using the APIs provided by OpenHarmony. They walk you through how to use JavaScript APIs to develop applications on the standard system.
The documents are carefully organized as follows:
## Getting Started
-[Here](quick-start/start-overview.md) you'll learn how to quickly get started with OpenHarmony application development.
+[Here](quick-start/start-overview.md) you can learn how to better prepare yourself for application development.
Browse the documents on the instructions for quickly building your first application and the basics about OpenHarmony applications.
@@ -36,12 +40,12 @@ Then, equip yourself for developing the key features, with the following guideli
- [Data Management](database/data-mgmt-overview.md)
- [File Management](file-management/file-management-overview.md)
- [Task Management](task-management/background-task-overview.md)
-- [Device](device/usb-overview.md)
+- [Device Management](device/usb-overview.md)
- [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md)
- [DFX](dfx/hiappevent-guidelines.md)
- [Internationalization](internationalization/international-overview.md)
- [Application Test](application-test/arkxtest-guidelines.md)
-- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md)
+- [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md)
## Tools
@@ -51,7 +55,7 @@ DevEco Studio is a high-performance integrated development environment (IDE) rec
## Hands-On Tutorials
-To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs).
+To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/OpenHarmony-4.0-Beta1/README.md) and [codelabs](https://gitee.com/openharmony/codelabs).
## API References
@@ -59,13 +63,12 @@ API references encompass all components and APIs available in OpenHarmony, helpi
They are organized as follows:
+- [ArkTS API Reference](reference/apis/development-intro.md)
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Full)](reference/arkui-js/js-components-common-attributes.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Lite)](reference/arkui-js-lite/js-framework-file.md)
-- [JS Service Widget UI Components](reference/js-service-widget-ui/js-service-widget-file.md)
-- [JS and TS APIs](reference/apis/development-intro.md)
-- Native APIs
- - [Standard Library](reference/native-lib/third_party_libc/musl.md)
+- [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/js-service-widget-file.md)
+- Native API Reference
+ - [Native APIs](reference/native-apis/_o_h___native_x_component.md)
+ - [Standard Libraries](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md)
-
-
\ No newline at end of file
diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md
index b38074f214762a1d42474e7e12005314427d3ee1..f89f2164e5941ae42c326caf17adbdfe1fe7c26f 100644
--- a/en/application-dev/application-models/Readme-EN.md
+++ b/en/application-dev/application-models/Readme-EN.md
@@ -8,27 +8,52 @@
- Stage Mode Application Components
- [Application- or Component-Level Configuration](application-component-configuration-stage.md)
- UIAbility Component
- - [UIAbility Component Overview](uiability-overview.md)
- - [UIAbility Component Lifecycle](uiability-lifecycle.md)
- - [UIAbility Component Launch Type](uiability-launch-type.md)
- - [UIAbility Component Usage](uiability-usage.md)
- - [Data Synchronization Between UIAbility and UI](uiability-data-sync-with-ui.md)
+ - [UIAbility Overview](uiability-overview.md)
+ - [UIAbility Lifecycle](uiability-lifecycle.md)
+ - [UIAbility Launch Type](uiability-launch-type.md)
+ - [UIAbility Usage](uiability-usage.md)
+ - [Data Synchronization Between UIAbility and UI Page](uiability-data-sync-with-ui.md)
- [Interaction Between Intra-Device UIAbility Components](uiability-intra-device-interaction.md)
- ExtensionAbility Component
- - [ExtensionAbility Component Overview](extensionability-overview.md)
+ - [ExtensionAbility Overview](extensionability-overview.md)
- [ServiceExtensionAbility](serviceextensionability.md)
- - [FormExtensionAbility (Widget)](widget-development-stage.md)
- [AccessibilityExtensionAbility](accessibilityextensionability.md)
- [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md)
- [InputMethodExtensionAbility](inputmethodextentionability.md)
- - [WindowExtensionAbility](windowextensionability.md)
+ - [WindowExtensionAbility (for System Applications Only)](windowextensionability.md)
+ - Service Widget Development in Stage Model
+ - [Service Widget Overview](service-widget-overview.md)
+ - Developing an ArkTS Widget
+ - [ArkTS Widget Working Principles](arkts-ui-widget-working-principles.md)
+ - [ArkTS Widget Related Modules](arkts-ui-widget-modules.md)
+ - ArkTS Widget Development
+ - [Creating an ArkTS Widget](arkts-ui-widget-creation.md)
+ - [Configuring Widget Configuration Files](arkts-ui-widget-configuration.md)
+ - [Widget Lifecycle Management](arkts-ui-widget-lifecycle.md)
+ - Widget Page Development
+ - [Widget Page Capability Overview](arkts-ui-widget-page-overview.md)
+ - [Using Animations in the Widget](arkts-ui-widget-page-animation.md)
+ - [Applying Custom Drawing in the Widget](arkts-ui-widget-page-custom-drawing.md)
+ - Widget Event Development
+ - [Widget Event Capability Overview](arkts-ui-widget-event-overview.md)
+ - [Redirecting to a UIAbility Through the router Event](arkts-ui-widget-event-router.md)
+ - [Launching a UIAbility in the Background Through the call Event](arkts-ui-widget-event-call.md)
+ - [Updating Widget Content Through the message Event](arkts-ui-widget-event-formextensionability.md)
+ - [Updating Widget Content Through the router or call Event](arkts-ui-widget-event-uiability.md)
+ - Widget Data Interaction
+ - [Widget Data Interaction Overview](arkts-ui-widget-interaction-overview.md)
+ - [Configuring a Widget to Update Periodically](arkts-ui-widget-update-by-time.md)
+ - [Updating Local and Online Images in the Widget](arkts-ui-widget-image-update.md)
+ - [Updating Widget Content by State](arkts-ui-widget-update-by-status.md)
+ - [Updating Widget Content by Widget Host (for System Applications Only)](arkts-ui-widget-content-update.md)
+ - [Developing a JS Widget](js-ui-widget-development.md)
- [AbilityStage Component Container](abilitystage.md)
- [Context](application-context-stage.md)
- Want
- [Want Overview](want-overview.md)
- [Matching Rules of Explicit Want and Implicit Want](explicit-implicit-want-mappings.md)
- [Common action and entities Values](actions-entities.md)
- - [Using Explicit Want to Start an Ability](ability-startup-with-explicit-want.md)
+ - [Using Explicit Want to Start an Application Component](ability-startup-with-explicit-want.md)
- [Using Implicit Want to Open a Website](ability-startup-with-implicit-want.md)
- [Using Want to Share Data Between Applications](data-share-via-want.md)
- [Component Startup Rules](component-startup-rules.md)
@@ -37,8 +62,8 @@
- [Cross-Device Migration (for System Applications Only)](hop-cross-device-migration.md)
- [Multi-device Collaboration (for System Applications Only)](hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](subscribe-system-environment-variable-changes.md)
- - IPC
- - [Process Model](process-model-stage.md)
+ - Process Model
+ - [Process Model Overview](process-model-stage.md)
- Common Events
- [Introduction to Common Events](common-event-overview.md)
- Common Event Subscription
@@ -47,14 +72,15 @@
- [Subscribing to Common Events in Static Mode (for System Applications Only)](common-event-static-subscription.md)
- [Unsubscribing from Common Events](common-event-unsubscription.md)
- [Publishing Common Events](common-event-publish.md)
+ - [Removing Sticky Common Events (for System Applications Only)](common-event-remove-sticky.md)
- [Background Services](background-services.md)
- - Inter-Thread Communication
- - [Thread Model](thread-model-stage.md)
+ - Thread Model
+ - [Thread Model Overview](thread-model-stage.md)
- [Using Emitter for Inter-Thread Communication](itc-with-emitter.md)
- [Using Worker for Inter-Thread Communication](itc-with-worker.md)
- Mission Management
- [Mission Management Scenarios](mission-management-overview.md)
- - [Mission Management and Launch Type](mission-management-launch-type.md)
+ - [Mission and Launch Type](mission-management-launch-type.md)
- [Page Stack and MissionList](page-mission-stack.md)
- [Setting the Icon and Name of a Mission Snapshot](mission-set-icon-name-for-task-snapshot.md)
- [Application Configuration File](config-file-stage.md)
@@ -63,8 +89,8 @@
- FA Mode Application Components
- [Application- or Component-Level Configuration](application-component-configuration-fa.md)
- PageAbility Component Development
- - [PageAbility Component Overview](pageability-overview.md)
- - [PageAbility Component Configuration](pageability-configuration.md)
+ - [PageAbility Overview](pageability-overview.md)
+ - [PageAbility Configuration](pageability-configuration.md)
- [PageAbility Lifecycle](pageability-lifecycle.md)
- [PageAbility Launch Type](pageability-launch-type.md)
- [Creating a PageAbility](create-pageability.md)
@@ -76,15 +102,15 @@
- [Requesting Permissions](request-permissions.md)
- [Redirection Rules](redirection-rules.md)
- ServiceAbility Component Development
- - [ServiceAbility Component Overview](serviceability-overview.md)
- - [ServiceAbility Component Configuration](serviceability-configuration.md)
+ - [ServiceAbility Overview](serviceability-overview.md)
+ - [ServiceAbility Configuration](serviceability-configuration.md)
- [ServiceAbility Lifecycle](serviceability-lifecycle.md)
- [Creating a ServiceAbility](create-serviceability.md)
- [Starting a ServiceAbility](start-serviceability.md)
- [Connecting to a ServiceAbility](connect-serviceability.md)
- DataAbility Component Development
- - [DataAbility Component Overview](dataability-overview.md)
- - [DataAbility Component Configuration](dataability-configuration.md)
+ - [DataAbility Overview](dataability-overview.md)
+ - [DataAbility Configuration](dataability-configuration.md)
- [DataAbility Lifecycle](dataability-lifecycle.md)
- [Creating a DataAbility](create-dataability.md)
- [Starting a DataAbility](start-dataability.md)
@@ -94,12 +120,12 @@
- [Context](application-context-fa.md)
- [Want](want-fa.md)
- [Component Startup Rules](component-startup-rules-fa.md)
- - IPC
- - [Process Model](process-model-fa.md)
+ - Process Model
+ - [Process Model Overview](process-model-fa.md)
- [Common Events](common-event-fa.md)
- [Background Services](rpc.md)
- - Inter-Thread Communication
- - [Thread Model](thread-model-fa.md)
+ - Thread Model
+ - [Thread Model Overview](thread-model-fa.md)
- [Inter-Thread Communication](itc-fa-overview.md)
- [Mission Management](mission-management-fa.md)
- [Application Configuration File](config-file-fa.md)
diff --git a/en/application-dev/application-models/ability-startup-with-explicit-want.md b/en/application-dev/application-models/ability-startup-with-explicit-want.md
index 6b61b06311a519e959e87d826e4a27c8b2b3d208..36d41c555bd8d4a5cd0d4d0b7bd291bb2569cee3 100644
--- a/en/application-dev/application-models/ability-startup-with-explicit-want.md
+++ b/en/application-dev/application-models/ability-startup-with-explicit-want.md
@@ -1,4 +1,4 @@
-# Using Explicit Want to Start an Ability
+# Using Explicit Want to Start an Application Component
When a user touches a button in an application, the application often needs to start a UIAbility component to complete a specific task. If the **abilityName** and **bundleName** parameters are specified when starting a UIAbility, then the explicit Want is used.
diff --git a/en/application-dev/application-models/ability-startup-with-implicit-want.md b/en/application-dev/application-models/ability-startup-with-implicit-want.md
index dbd65bb560d7531bb6e00b21c004815fda1a997c..7d92fbccbd1ebb49dc2a89de0ea825a1e2a8c873 100644
--- a/en/application-dev/application-models/ability-startup-with-implicit-want.md
+++ b/en/application-dev/application-models/ability-startup-with-implicit-want.md
@@ -5,21 +5,21 @@ This section uses the operation of using a browser to open a website as an examp
```json
{
"module": {
- // ...
+ ...
"abilities": [
{
- // ...
+ ...
"skills": [
{
"entities": [
"entity.system.home",
"entity.system.browsable"
- // ...
+ ...
],
"actions": [
"action.system.home",
"ohos.want.action.viewData"
- // ...
+ ...
],
"uris": [
{
@@ -31,9 +31,9 @@ This section uses the operation of using a browser to open a website as an examp
},
{
"scheme": "http",
- // ...
+ ...
}
- // ...
+ ...
]
}
]
@@ -59,19 +59,18 @@ function implicitStartAbility() {
'uri': 'https://www.test.com:8080/query/student'
}
context.startAbility(wantInfo).then(() => {
- // ...
+ ...
}).catch((err) => {
- // ...
+ ...
})
}
```
The matching process is as follows:
-1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills** of the ability to match, the matching is successful.
-2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills** of the ability to match, the matching is successful.
-3. If **uri** in the passed **want** parameter is included in **uris** under **skills** of the ability to match, which is concatenated into https://www.test.com:8080/query* (where * is a wildcard), the matching is successful.
-4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills** of the ability to match, the matching is successful.
+1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills** of the application component to match, the matching is successful.
+2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills** of the application component to match, the matching is successful.
+3. If **uri** in the passed **want** parameter is included in **uris** under **skills** of the application component to match, which is concatenated into https://www.test.com:8080/query* (where * is a wildcard), the matching is successful.
If there are multiple matching applications, the system displays a dialog box for you to select one of them. The following figure shows an example.
diff --git a/en/application-dev/application-models/abilitystage.md b/en/application-dev/application-models/abilitystage.md
index 9a4e71d3fa696ee6f2707545b80456df34fe85ac..da764a445a6d1a79a601719f069798191641a986 100644
--- a/en/application-dev/application-models/abilitystage.md
+++ b/en/application-dev/application-models/abilitystage.md
@@ -12,7 +12,7 @@ AbilityStage is not automatically generated in the default project of DevEco Stu
1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **myabilitystage**.
-2. In the **myabilitystage** directory, right-click and choose **New > ts File** to create a file named **MyAbilityStage.ts**.
+2. In the **myabilitystage** directory, right-click and choose **New > TypeScript File** to create a file named **MyAbilityStage.ts**.
3. Open the **MyAbilityStage.ts** file, and import the dependency package of AbilityStage. Customize a class that inherits from AbilityStage, and add the required lifecycle callbacks. The following code snippet adds the **onCreate()** lifecycle callback.
@@ -20,29 +20,28 @@ AbilityStage is not automatically generated in the default project of DevEco Stu
import AbilityStage from '@ohos.app.ability.AbilityStage';
export default class MyAbilityStage extends AbilityStage {
- onCreate() {
- // When the HAP of the application is loaded for the first time, initialize the module.
- }
- onAcceptWant(want) {
- // Triggered only for the ability with the specified launch type.
- return "MyAbilityStage";
- }
+ onCreate() {
+ // When the HAP of the application is loaded for the first time, initialize the module.
+ }
+ onAcceptWant(want) {
+ // Triggered only for the UIAbility with the specified launch type.
+ return "MyAbilityStage";
+ }
}
```
-4. Set **srcEntry** in the [module.json5 file](../quick-start/module-configuration-file.md) to the code path of the module.
+4. In the [module.json5 file](../quick-start/module-configuration-file.md), set **srcEntry** to specify the code path of the module as the entry for loading the HAP.
```json
{
"module": {
"name": "entry",
"type": "entry",
"srcEntry": "./ets/myabilitystage/MyAbilityStage.ts",
- // ...
+ ...
}
}
```
-
[AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) has the lifecycle callback [onCreate()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageoncreate) and the event callbacks [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant), [onConfigurationUpdated()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonconfigurationupdate), and [onMemoryLevel()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonmemorylevel).
@@ -53,7 +52,6 @@ AbilityStage is not automatically generated in the default project of DevEco Stu
- **onConfigurationUpdated()** event callback: triggered when the global system configuration changes. The global system configuration, such as the system language and theme, are defined in the [Configuration](../reference/apis/js-apis-app-ability-configuration.md) class before project configuration.
- **onMemoryLevel()** event callback: triggered when the system adjusts the memory.
-
When an application is switched to the background, it is cached in the background. This adversely affects the overall system performance. When system resources are insufficient, the system reclaims memory from applications in multiple ways. For example, the system may stop applications to release memory for executing key tasks. To further maintain the balance of the system memory and prevent the system from stopping application processes, you can subscribe to the system memory changes in the **onMemoryLevel()** lifecycle callback of AbilityStage to release unnecessary resources.
@@ -62,8 +60,8 @@ When an application is switched to the background, it is cached in the backgroun
import AbilityStage from '@ohos.app.ability.AbilityStage';
export default class MyAbilityStage extends AbilityStage {
- onMemoryLevel(level) {
- // Release unnecessary memory based on the change of available system memory.
- }
+ onMemoryLevel(level) {
+ // Release unnecessary memory based on the change of available system memory.
+ }
}
```
diff --git a/en/application-dev/application-models/access-dataability.md b/en/application-dev/application-models/access-dataability.md
index 24dc9305f194a61c974c63db224f2e7727689f5f..b32d38354e7e67fb8757c022fc6e65c737bb297e 100644
--- a/en/application-dev/application-models/access-dataability.md
+++ b/en/application-dev/application-models/access-dataability.md
@@ -11,7 +11,7 @@ The basic dependency packages include:
- @ohos.data.dataAbility
-- @ohos.data.rdb
+- @ohos.data.relationalStore
The sample code for accessing a DataAbility is as follows:
@@ -23,7 +23,7 @@ The sample code for accessing a DataAbility is as follows:
// Different from the URI defined in the config.json file, the URI passed in the parameter has an extra slash (/), three slashes in total.
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataAbility'
- import ohos_data_rdb from '@ohos.data.rdb'
+ import relationalStore from '@ohos.data.relationalStore'
let urivar = "dataability:///com.ix.DataAbility"
let DAHelper = featureAbility.acquireDataAbilityHelper(urivar);
diff --git a/en/application-dev/application-models/access-datashareextensionability-from-fa.md b/en/application-dev/application-models/access-datashareextensionability-from-fa.md
index 0abc7e3b8e948529b9916f936bf59b4a60a93637..5be8c5a7c9f848e0818b280fc5f5df8f4c15de22 100644
--- a/en/application-dev/application-models/access-datashareextensionability-from-fa.md
+++ b/en/application-dev/application-models/access-datashareextensionability-from-fa.md
@@ -27,12 +27,14 @@ Instead of manual modification, OpenHarmony adopts the following processing:
## Constraints
-1. When you switch a DataAbility to a DataShareExtensionAbility, only the URI prefix can be modified.
+1. When you switch a DataAbility to a DataShareExtensionAbility, only the URI prefix can be modified.
-2. The **DataShareHelper** class implements only certain APIs of **DataAbilityHelper**. For details about the APIs, see the table below.
+ 
+
+3. The **DataShareHelper** class implements only certain APIs of **DataAbilityHelper**. For details about the APIs, see the table below.
+
+ **Table 1** API compatibility when the FA model accesses a DataShareExtensionAbility of the stage model
- **Table 1** APIs invoked when the FA model accesses a DataShareExtensionAbility of the stage model
-
| API| Provided by DataAbilityHelper| Provided by DataShareHelper| Compatible|
| -------- | -------- | -------- | -------- |
| on | Yes| Yes| Yes|
diff --git a/en/application-dev/application-models/accessibilityextensionability.md b/en/application-dev/application-models/accessibilityextensionability.md
index 4c912d5e58a1b8083ba1037cccf449dd953d245c..42968456fe88c836e5befe9c096eb2f3892729e1 100644
--- a/en/application-dev/application-models/accessibilityextensionability.md
+++ b/en/application-dev/application-models/accessibilityextensionability.md
@@ -1,4 +1,4 @@
-# AccessibilityExtensionAbility Development
+# AccessibilityExtensionAbility
The **AccessibilityExtensionAbility** module provides accessibility extension capabilities based on the **ExtensionAbility** framework. You can develop your accessibility applications by applying the **AccessibilityExtensionAbility** template to enhance usability.
@@ -10,16 +10,25 @@ The **AccessibilityExtensionAbility** module provides accessibility extension ca
>
> Model: stage
-This document is organized as follows:
+## AccessibilityExtensionAbility Overview
-- [Creating an AccessibilityExtAbility File](#creating-an-accessibility-extension-service)
-- [Processing an Accessibility Event](#processing-an-accessibility-event)
-- [Declaring Capabilities of Accessibility Extension Services](#declaring-capabilities-of-accessibility-extension-services)
-- [Enabling a Custom Accessibility Extension Service](#enabling-a-custom-accessibility-extension-service)
+Accessibility is about giving equal access to everyone so that they can access and use information equally and conveniently under any circumstances. It helps narrow the digital divide between people of different classes, regions, ages, and health status in terms of information understanding, information exchange, and information utilization, so that they can participate in social life more conveniently and enjoy the benefits of technological advances.
+
+AccessibilityExtensionAbility is an accessibility extension service framework. It allows you to develop your own extension services and provides a standard mechanism for exchanging information between applications and extension services. You can make use of the provided capabilities and APIs to develop accessibility features for users with disabilities or physical limitations. For example, you can develop a screen reader for users with vision impairments.
+
+Below shows the AccessibilityExtensionAbility framework.
+
+
+
+1. Accessibility app: extension service application developed based on the AccessibilityExtensionAbility framework, for example, a screen reader application.
+2. Target app: application assisted by the accessibility app.
+3. AccessibilityAbilityManagerService (AAMS): main service of the AccessibilityExtensionAbility framework, which is used to manage the lifecycle of accessibility apps and provide a bridge for information exchange between accessibility apps and target apps.
+4. AccessibilityAbility (AAkit): ability that is used by the accessibility app to build an extension service ability operating environment and that provides interfaces for the accessibility app to query and operate the target app, including performing click/long press operations.
+5. AccessibilitySystemAbilityClient (ASACkit): used by the target app to send accessibility events, such as content change events, to AAMS, and respond to the instructions (such as performing click/long press operations) sent by the accessibility app through AAMS.
## Creating an Accessibility Extension Service
-You can create an accessibility extension service by creating a project from scratch or adding the service to an existing project.
+You can create an accessibility extension service by creating a project from scratch or adding the service to an existing project. Only one accessibility extension service can be created for a project.
### Creating a Project
@@ -37,15 +46,15 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens
class AccessibilityExtAbility extends AccessibilityExtensionAbility {
onConnect() {
- console.log('AccessibilityExtAbility onConnect');
+ console.info('AccessibilityExtAbility onConnect');
}
onDisconnect() {
- console.log('AccessibilityExtAbility onDisconnect');
+ console.info('AccessibilityExtAbility onDisconnect');
}
onAccessibilityEvent(accessibilityEvent) {
- console.log('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
+ console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
}
}
@@ -66,9 +75,9 @@ You can process the service logic for accessibility events in the **onAccessibil
```typescript
onAccessibilityEvent(accessibilityEvent) {
- console.log('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
+ console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
if (accessibilityEvent.eventType === 'pageStateUpdate') {
- console.log('AccessibilityExtAbility onAccessibilityEvent: pageStateUpdate');
+ console.info('AccessibilityExtAbility onAccessibilityEvent: pageStateUpdate');
// TODO: Develop custom logic.
}
}
@@ -79,13 +88,13 @@ You can also process physical key events in the accessibility extension service.
## Declaring Capabilities of Accessibility Extension Services
-After developing the custom logic for an accessibility extension service, you must add the configuration information of the service to the corresponding module-level **module.json5** file in the project directory. In the file, the **srcEntrance** tag indicates the path to the accessibility extension service. Make sure the value of the **type** tag is fixed at **accessibility**. Otherwise, the connection to the service will fail.
+After developing the custom logic for an accessibility extension service, you must add the configuration information of the service to the corresponding module-level **module.json5** file in the project directory. In the file, the **srcEntry** tag indicates the path to the accessibility extension service. Make sure the value of the **type** tag is fixed at **accessibility**. Otherwise, the connection to the service will fail.
```json
"extensionAbilities": [
{
"name": "AccessibilityExtAbility",
- "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts",
+ "srcEntry": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts",
"label": "$string:MainAbility_label",
"description": "$string:MainAbility_desc",
"type": "accessibility",
@@ -116,3 +125,4 @@ To enable or disable an accessibility extension service, run the following comma
In the preceding commands, **AccessibilityExtAbility** indicates the name of the accessibility extension service, **com.example.demo** indicates the bundle name, and **rg** indicates the capabilities (**r** is short for retrieve).
If the service is enabled or disabled successfully, the message "enable ability successfully" or "disable ability successfully" is displayed.
+
diff --git a/en/application-dev/application-models/actions-entities.md b/en/application-dev/application-models/actions-entities.md
index 5c5aed302c6f8f570238fac6bd73c263840244d6..38119a1b1fe16067f7e89629811327ad079a5d15 100644
--- a/en/application-dev/application-models/actions-entities.md
+++ b/en/application-dev/application-models/actions-entities.md
@@ -1,9 +1,8 @@
# Common action and entities Values
-**action**: Action to take, such as viewing, sharing, and application details, by the caller. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data, for example, viewing URI data. For example, if the URI is a website and the action is **ohos.want.action.viewData**, the ability that supports website viewing is matched. Declaring the **action** field in Want indicates that the invoked application should support the declared operation. The **actions** field under **skills** in the configuration file indicates the operations supported by the application.
+The **action** field specifies the common operation (such as viewing, sharing, and application details) to be performed by the caller. In implicit [Want](../reference/apis/js-apis-app-ability-want.md), you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data, for example, viewing URI data. For example, if the URI is a website and the action is **ohos.want.action.viewData**, the application component that supports website viewing is matched. Declaring the **action** field in [Want](../reference/apis/js-apis-app-ability-want.md) indicates that the invoked application is expected to support the declared operation. The **actions** field under **skills** in the configuration file indicates the operations supported by the application.
-
-**Common action Values**
+The following **action** values are available:
- **ACTION_HOME**: action of starting the application entry component. It must be used together with **ENTITY_HOME**. The application icon on the home screen is an explicit entry component. Users can touch the icon to start the entry component. Multiple entry components can be configured for an application.
@@ -14,14 +13,13 @@
- **ACTION_VIEW_MULTIPLE_DATA**: action of launching the UI for sending multiple data records.
-**entities**: Category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want. You can define this field to filter application categories, for example, browser. Declaring the **entities** field in Want indicates that the invoked application should belong to the declared category. The **entities** field under **skills** in the configuration file indicates the categories supported by the application.
-
+The **entities** field specify the category information (such as browser and video player) of the target application component. It is a supplement to **action** in implicit Want. You can define this field to filter application categories, for example, browser. Declaring the **entities** field in Want indicates that the invoked application should belong to the declared category. The **entities** field under **skills** in the configuration file indicates the categories supported by the application.
-**Common entities Values**
+The following **entities** values are available:
- **ENTITY_DEFAULT**: default category, which is meaningless.
-- **ENTITY_HOME**: abilities with an icon displayed on the home screen.
+- **ENTITY_HOME**: application components with an icon displayed on the home screen.
- **ENTITY_BROWSABLE**: browser type.
diff --git a/en/application-dev/application-models/api-switch-overview.md b/en/application-dev/application-models/api-switch-overview.md
index bf8223b5a6c047af46e960dad6713f20e251d02f..93db02670718e56943aba99b81ca4775423278e8 100644
--- a/en/application-dev/application-models/api-switch-overview.md
+++ b/en/application-dev/application-models/api-switch-overview.md
@@ -1,7 +1,7 @@
# API Switching Overview
-Due to the differences in the thread model and process model, certain APIs (marked with **FAModelOnly** in the SDK) can be used only in the FA model. When switching an application from the FA model to the stage model, replace the APIs marked with **FAModelOnly** in the application with the APIs supported in the stage model. This topic uses the switching of **startAbility()** as an example.
+Due to the differences in the thread model and process model, certain APIs can be used only in the FA model. They are marked with **FAModelOnly** in the SDK. When switching an application from the FA model to the stage model, replace the APIs marked with **FAModelOnly** in the application with the APIs supported in the stage model. This topic uses the switching of **startAbility()** as an example.

@@ -27,7 +27,7 @@ Due to the differences in the thread model and process model, certain APIs (mark
- Sample code of **startAbility()** in the stage model:
```ts
- // context is a member of the ability object and is required for invoking inside a non-ability object.
+ // Context is a member of the ability object and is required for invoking inside a non-ability object.
// Pass in the Context object.
let wantInfo = {
bundleName: "com.example.myapplication",
diff --git a/en/application-dev/application-models/app-deviceconfig-switch.md b/en/application-dev/application-models/app-deviceconfig-switch.md
index 1092c21081cd9a8d62c92a1a68ba434efee7c8c9..6c872f0c167bd4779516d611ee07d9036ca550ee 100644
--- a/en/application-dev/application-models/app-deviceconfig-switch.md
+++ b/en/application-dev/application-models/app-deviceconfig-switch.md
@@ -22,7 +22,7 @@ OpenHarmony has reconstructed the [deviceConfig](../quick-start/deviceconfig-str
| deviceConfig in the FA Model| Description| Stage Model| Difference|
| -------- | -------- | -------- | -------- |
| deviceConfig| Device information.| / | This tag is no longer available in the stage model. In the stage model, device information is configured under the **app** tag.|
-| process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process.| / | The stage model does not support the configuration of process names.|
+| process | Name of the process running the application or UIAbility. If the **process** attribute is configured in the **deviceConfig** tag, all UIAbilities of the application run in this process. You can set the **process** attribute for a specific UIAbility in the **abilities** attribute, so that the UIAbility can run in the particular process.| / | The stage model does not support the configuration of process names.|
| keepAlive | Whether the application is always running. This attribute applies only to system applications and does not take effect for third-party applications.| / | The stage model does not support changing of the model control mode for system applications.|
| supportBackup | Whether the application supports data backup and restore.| / | This configuration is not supported in the stage model.|
| compressNativeLibs | Whether the **libs** libraries are packaged in the HAP file after being compressed.| / | This configuration is not supported in the stage model.|
diff --git a/en/application-dev/application-models/application-component-configuration-fa.md b/en/application-dev/application-models/application-component-configuration-fa.md
index 4cc1c9ad6831f0e54ae4c70f4f7229a7abc7c62f..336ad698d0f2298045b00fe0af1563574bccfd24 100644
--- a/en/application-dev/application-models/application-component-configuration-fa.md
+++ b/en/application-dev/application-models/application-component-configuration-fa.md
@@ -22,7 +22,7 @@ When developing an application, you may need to configure certain tags to identi
"actions": ["action.system.home"]
}
]
- // ...
+ ...
}
```
diff --git a/en/application-dev/application-models/application-component-configuration-stage.md b/en/application-dev/application-models/application-component-configuration-stage.md
index bcf9b095464ba0110c35be9cfef44b078a091ffb..555964ca58a6e21380ac67aa389280504d9c7dce 100644
--- a/en/application-dev/application-models/application-component-configuration-stage.md
+++ b/en/application-dev/application-models/application-component-configuration-stage.md
@@ -1,17 +1,19 @@
# Application- or Component-Level Configuration (Stage Model)
+When developing an application, you may need to configure certain tags to identify the application, such as the bundle name and application icon. This topic describes key tags that need to be configured during application development.
-When developing an application, you may need to configure certain tags to identify the application, such as the bundle name and application icon. This topic describes key tags that need to be configured during application development. Icons and labels are usually configured together. There is the application icon, application label, entry icon, and entry label, which correspond to the **icon** and **label** fields in the [app.json5 file](../quick-start/app-configuration-file.md) and [module.json5 file](../quick-start/module-configuration-file.md). The application icon and label are used in **Settings**. For example, they are displayed in the application list in **Settings**. The entry icon is displayed on the device's home screen after the application is installed. The entry icon maps to a [UIAbility](uiability-overview.md) component. Therefore, an application can have multiple entry icons and labels. When you touch one of them, the corresponding UIAbility page is displayed.
+Icons and labels are usually configured together. There is the application icon, application label, entry icon, and entry label, which correspond to the **icon** and **label** fields in the [app.json5 file](../quick-start/app-configuration-file.md) and [module.json5 file](../quick-start/module-configuration-file.md).
+The application icon and label are used in **Settings**. For example, they are displayed in the application list in **Settings**. The entry icon is displayed on the device's home screen after the application is installed. The entry icon maps to a [UIAbility](uiability-overview.md) component. Therefore, an application can have multiple entry icons and entry labels. When you touch one of them, the corresponding UIAbility page is displayed.
- **Figure 1** Icons and labels
+**Figure 1** Icons and labels

- **Configuring the bundle name**
- The bundle name is specified by the **bundleName** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. This field uniquely identifies an application. You are advised to use the reverse domain name notion, for example, *com.example.demo*, where the first part is the domain suffix **com**, the second part is the vendor/individual name, and the third part is the application name, which can be of multiple levels.
+ The bundle name is specified by the **bundleName** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. This field uniquely identifies an application. You are advised to use the reverse domain name notation, for example, *com.example.demo*, where the first part is the domain suffix **com**, the second part is the vendor/individual name, and the third part is the application name, which can be of multiple levels.
- **Configuring the application icon and label**
@@ -19,28 +21,28 @@ When developing an application, you may need to configure certain tags to identi
The application icon is specified by the **icon** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. The **icon** field must be set to the index of an image so that the image is displayed as the application icon.
- The application label is specified by the **label** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** module of the project. The **label** field specifies the application name displayed to users. It must be set to the index of a string resource.
+ The application label is specified by the **label** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. The **label** field specifies the application name displayed to users. It must be set to the index of a string resource.
```json
- {
- "app": {
- "icon": "$media:app_icon",
- "label": "$string:app_name"
- // ...
- }
+ {
+ "app": {
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ ...
}
+ }
```
- **Configuring the entry icon and label**
On the stage model, you can configure an entry icon and label for each application component. The entry icon and label are displayed on the home screen.
- The entry icon is configured by specifying **icon** under **abilities** in the [module.json5 file](../quick-start/module-configuration-file.md). For example, if you want to display the icon of the UIAbility component on the home screen, add **entity.system.home** to **entities** and **ohos.want.action.home** to **actions** under **skills**. If this field is configured for multiple UIAbility components of an application, multiple icons are displayed on the home screen, corresponding to their respective UIAbility component.
+ The entry icon is configured by specifying **icon** under **abilities** in the [module.json5 file](../quick-start/module-configuration-file.md). For example, if you want to display the icon of the UIAbility component on the home screen, add **entity.system.home** to **entities** and **ohos.want.action.home** to **actions** under **skills**. If this field is configured for multiple UIAbility components of an application, multiple icons are displayed on the home screen, corresponding to their respective UIAbility components.
```json
{
"module": {
- // ...
+ ...
"abilities": [
{
// The information starting with $ is the resource value.
@@ -61,6 +63,35 @@ When developing an application, you may need to configure certain tags to identi
}
}
```
+ OpenHarmony strictly controls applications without icons to prevent malicious applications from deliberately configuring no icon to block uninstall attempts.
+
+ To hide an application icon on the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md). The rules for displaying the entry icon and entry label are as follows:
+
+ 1. The HAP file contains UIAbility configuration.
+ * An entry icon is set in the **abilities** field of the **module.json5** file.
+ * The application does not have the privilege to hide its icon on the home screen.
+ * The system uses the icon configured for the UIAbility as the entry icon and displays it on the home screen. Touching this icon will direct the user to the home page of the UIAbility.
+ * The system uses the label configured for the UIAbility as the entry label and displays it on the home screen. If no label is configured, the system uses the label specified in the **app.json5** file as the entry label and displays it on the home screen.
+ * The application has the privilege to hide its icon on the home screen.
+ * The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
+ * No entry icon is set in the **abilities** field of the **module.json5** file.
+ * The application does not have the privilege to hide its icon on the home screen.
+ * The system uses the icon specified in the **app.json5** file as the entry icon and displays it on the home screen. Touching this icon will direct the user to the application details page, as shown below.
+ * The system uses the label specified in the **app.json5** file as the entry label and displays it on the home screen.
+ * The application has the privilege to hide its icon on the home screen.
+ * The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
+
+ 2. The HAP file does not contain UIAbility configuration.
+ * The application does not have the privilege to hide its icon on the home screen.
+ * The system uses the icon specified in the **app.json5** file as the entry icon and displays it on the home screen. Touching this icon will direct the user to the application details page, as shown below.
+ * The system uses the label specified in the **app.json5** file as the entry label and displays it on the home screen.
+ * The application has the privilege to hide its icon on the home screen.
+ * The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
+
+ **Figure 2** Application details page
+
+
+
- **Configuring application version declaration**
To declare the application version, configure the **versionCode** and **versionName** fields in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. **versionCode** specifies the version number of the application. The value is a 32-bit non-negative integer. It is used only to determine whether a version is later than another version. A larger value indicates a later version. **versionName** provides the text description of the version number.
diff --git a/en/application-dev/application-models/application-context-fa.md b/en/application-dev/application-models/application-context-fa.md
index 9f68b42a873782c9fd1693c73724354cbf347ced..6ea4445778aba90c668f19839a367b5a4a168925 100644
--- a/en/application-dev/application-models/application-context-fa.md
+++ b/en/application-dev/application-models/application-context-fa.md
@@ -44,17 +44,17 @@ For details about the APIs, see [API Reference](../reference/apis/js-apis-inner-
}
```
-2. Set the display orientation of the host featureAbility.
+2. Set the display orientation of the **featureAbility**.
```ts
import featureAbility from '@ohos.ability.featureAbility'
- import bundle from '@ohos.bundle';
+ import bundleManager from '@ohos.bundle.bundleManager';
export default {
onCreate() {
// Obtain the context and call related APIs.
let context = featureAbility.getContext();
- context.setDisplayOrientation(bundle.DisplayOrientation.LANDSCAPE).then(() => {
+ context.setDisplayOrientation(bundleManager.DisplayOrientation.LANDSCAPE).then(() => {
console.info("Set display orientation.")
})
console.info('Application onCreate')
diff --git a/en/application-dev/application-models/application-context-stage.md b/en/application-dev/application-models/application-context-stage.md
index 5308d1899a46ffb9907a18bd74a7920627ac720b..47fdeeedf1fe5238b0f0a2e56945be35208e0391 100644
--- a/en/application-dev/application-models/application-context-stage.md
+++ b/en/application-dev/application-models/application-context-stage.md
@@ -3,16 +3,16 @@
## Overview
-[Context](../reference/apis/js-apis-inner-application-context.md) is the context of an object in an application. It provides basic information about the application, for example, **resourceManager**, **applicationInfo**, **dir** (application development path), and **area** (encrypted area). It also provides basic methods such as **createBundleContext()** and **getApplicationContext()**. The UIAbility component and ExtensionAbility derived class components have their own **Context** classes, for example, the base class **Context**, **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, **ExtensionContext**, and **ServiceExtensionContext**.
+[Context](../reference/apis/js-apis-inner-application-context.md) is the context of an object in an application. It provides basic information about the application, for example, **resourceManager**, **applicationInfo**, **dir** (application file path), and **area** (encryption level). It also provides basic methods such as **createBundleContext()** and **getApplicationContext()**. The UIAbility component and ExtensionAbility derived class components have their own **Context** classes, for example, the base class **Context**, **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, **ExtensionContext**, and **ServiceExtensionContext**.
-- The figure below illustrates the inheritance relationship of contexts.
+- The figure below illustrates the inheritance relationship of contexts.

-
-- The figure below illustrates the holding relationship of contexts.
+
+- The figure below illustrates the holding relationship of contexts.

-
+
- The following describes the information provided by different contexts.
- [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md): Each UIAbility has the **Context** attribute, which provides APIs to operate an application component, obtain the application component configuration, and more.
@@ -21,7 +21,7 @@
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
let uiAbilityContext = this.context;
- // ...
+ ...
}
}
```
@@ -36,7 +36,7 @@
export default class MyService extends ServiceExtensionAbility {
onCreate(want) {
let serviceExtensionContext = this.context;
- // ...
+ ...
}
}
```
@@ -47,7 +47,7 @@
export default class MyAbilityStage extends AbilityStage {
onCreate() {
let abilityStageContext = this.context;
- // ...
+ ...
}
}
```
@@ -58,7 +58,7 @@
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
let applicationContext = this.context.getApplicationContext();
- // ...
+ ...
}
}
```
@@ -70,108 +70,117 @@
This topic describes how to use the context in the following scenarios:
-- [Obtaining the Application Development Path](#obtaining-the-application-development-path)
-- [Obtaining and Modifying Encryption Areas](#obtaining-and-modifying-encryption-areas)
+- [Obtaining Application File Paths](#obtaining-application-file-paths)
+- [Obtaining and Modifying Encryption Levels](#obtaining-and-modifying-encryption-levels)
- [Creating Context of Another Application or Module](#creating-context-of-another-application-or-module)
- [Subscribing to UIAbility Lifecycle Changes in a Process](#subscribing-to-uiability-lifecycle-changes-in-a-process)
-### Obtaining the Application Development Path
-
-The following table describes the application development paths obtained from context.
+### Obtaining Application File Paths
-**Table 1** Application development paths
+The base class [Context](../reference/apis/js-apis-inner-application-context.md) provides the capability of obtaining application file paths. **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, and **ExtensionContext** inherit this capability. The application file paths are a type of application sandbox paths. For details, see [Application Sandbox Directory](../file-management/app-sandbox-directory.md).
-| Name| Type| Readable| Writable| Description|
-| -------- | -------- | -------- | -------- | -------- |
-| bundleCodeDir | string | Yes | No | Path for storing the application's installation package, that is, installation directory of the application on the internal storage. |
-| cacheDir | string | Yes| No| Path for storing the application's cache files, that is, cache directory of the application on the internal storage. It is the content of **Storage** of an application under **Settings > Apps & services > Apps**.|
-| filesDir | string | Yes | No | Path for storing the application's common files, that is, file directory of the application on the internal storage. Files in this directory may be synchronized to other directories during application migration or backup.|
-| preferencesDir | string | Yes | Yes | Path for storing the application's preference files, that is, preferences directory of the application. |
-| tempDir | string | Yes | No | Path for storing the application's temporary files. Files in this directory are deleted after the application is uninstalled.|
-| databaseDir | string | Yes | No | Path for storing the application's database, that is, storage directory of the local database. |
-| distributedFilesDir | string | Yes| No| Path for storing the application's distributed files.|
+The application file paths obtained by the preceding contexts are different.
-The capability of obtaining the application development path is provided by the base class **Context**. This capability is also provided by **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, and **ExtensionContext**. However, the paths obtained from different contexts may differ, as shown below.
+- The application file path obtained through **ApplicationContext** is at the application level. This path is recommended for storing global application information, and the files in the path will be deleted when the application is uninstalled.
-**Figure 1** Application development paths obtained from context
-
-
-
-- Obtain the application-level path through **ApplicationContext**. It is recommended that global application information be stored in this path. Files stored in this path will be deleted only when the application is uninstalled.
- | Name| Path|
+ | Name| Path|
| -------- | -------- |
- | bundleCodeDir | {Path prefix}/el1/bundle/|
- | cacheDir | {Path prefix}/{Encryption level}/base/cache/|
- | filesDir | {Path prefix}/{Encryption level}/base/files/|
- | preferencesDir | {Path prefix}/{Encryption level}/base/preferences/|
- | tempDir | {Path prefix}/{Encryption level}/base/temp/|
- | databaseDir | {Path prefix}/{Encryption level}/database/|
- | distributedFilesDir | {Path prefix}/el2/distributedFiles/|
-
-- Obtain the HAP level path through **AbilityStageContext**, **UIAbilityContext**, and **ExtensionContext**. It is recommended that the HAP information be stored in this path. The file content stored in this path will be deleted when the HAP is uninstalled. The file content in the application-level path will be deleted only after all the HAPs of the application are uninstalled.
- | Name| Path|
- | -------- | -------- |
- | bundleCodeDir | {Path prefix}/el1/bundle/|
- | cacheDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/cache/|
- | filesDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/files/|
- | preferencesDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/preferences/|
- | tempDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/temp/|
- | databaseDir | {Path prefix}/{Encryption level}/database/**{moduleName}**/|
- | distributedFilesDir | {Path prefix}/el2/distributedFiles/**{moduleName}**/|
+ | bundleCodeDir | \/el1/bundle|
+ | cacheDir | \/\/base/cache|
+ | filesDir | \/\/base/files|
+ | preferencesDir | \/\/base/preferences|
+ | tempDir | \/\/base/temp|
+ | databaseDir | \/\/database|
+ | distributedFilesDir | \/el2/distributedFiles|
+
+ The sample code is as follows:
+
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+
+ export default class EntryAbility extends UIAbility {
+ onCreate(want, launchParam) {
+ let applicationContext = this.context.getApplicationContext();
+ let cacheDir = applicationContext.cacheDir;
+ let tempDir = applicationContext.tempDir;
+ let filesDir = applicationContext.filesDir;
+ let databaseDir = applicationContext.databaseDir;
+ let bundleCodeDir = applicationContext.bundleCodeDir;
+ let distributedFilesDir = applicationContext.distributedFilesDir;
+ let preferencesDir = applicationContext.preferencesDir;
+ ...
+ // Obtain the application file path.
+ let filePath = tempDir + 'test.txt';
+ console.info(`filePath: ${filePath}`);
+ }
+ }
+ ```
-The sample code for obtaining the application development paths is as follows:
+- The application file path obtained through **AbilityStageContext**, **UIAbilityContext**, or **ExtensionContext** is at the HAP level. This path is recommended for storing HAP-related information, and the files in this path are deleted when the HAP is uninstalled. However, the deletion does not affect the files in the application-level path unless all HAPs of the application are uninstalled.
+ | Name| Path|
+ | -------- | -------- |
+ | bundleCodeDir | \/el1/bundle|
+ | cacheDir | \/\/base/**haps/\**/cache|
+ | filesDir | \/\/base/**haps/\**/files|
+ | preferencesDir | \/\/base/**haps/\**/preferences|
+ | tempDir | \/\/base/**haps/\**/temp|
+ | databaseDir | \/\/database/**\**|
+ | distributedFilesDir | \/el2/distributedFiles/**\**|
-```ts
-import UIAbility from '@ohos.app.ability.UIAbility';
+ The sample code is as follows:
-export default class EntryAbility extends UIAbility {
- onCreate(want, launchParam) {
- let cacheDir = this.context.cacheDir;
- let tempDir = this.context.tempDir;
- let filesDir = this.context.filesDir;
- let databaseDir = this.context.databaseDir;
- let bundleCodeDir = this.context.bundleCodeDir;
- let distributedFilesDir = this.context.distributedFilesDir;
- let preferencesDir = this.context.preferencesDir;
- // ...
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+
+ export default class EntryAbility extends UIAbility {
+ onCreate(want, launchParam) {
+ let cacheDir = this.context.cacheDir;
+ let tempDir = this.context.tempDir;
+ let filesDir = this.context.filesDir;
+ let databaseDir = this.context.databaseDir;
+ let bundleCodeDir = this.context.bundleCodeDir;
+ let distributedFilesDir = this.context.distributedFilesDir;
+ let preferencesDir = this.context.preferencesDir;
+ ...
+ // Obtain the application file path.
+ let filePath = tempDir + 'test.txt';
+ console.info(`filePath: ${filePath}`);
+ }
}
-}
-```
+ ```
-> **NOTE**
->
-> The sample code obtains the sandbox path of the application development path. The absolute path can be obtained by running the **find / -name ** command in the hdc shell after file creation or modification.
-### Obtaining and Modifying Encryption Areas
+### Obtaining and Modifying Encryption Levels
-Encrypting application files enhances data security by preventing files from unauthorized access. Different application files require different levels of protection. For private files, such as alarms and wallpapers, the application must place them in the device-level encryption area (EL1) to ensure that they can be accessed before the user enters the password. For sensitive files, such as personal privacy data, the application must place them in the user-level encryption area (EL2).
+Encrypting application files enhances data security by preventing files from unauthorized access. Different application files require different levels of protection. For private files, such as alarms and wallpapers, the application must place them in a directory with the device-level encryption (EL1) to ensure that they can be accessed before the user enters the password. For sensitive files, such as personal privacy data, the application must place them in a directory with the user-level encryption (EL2).
-In practice, you need to select a proper encrypted area based on scenario-specific requirements to protect application data security. The proper use of EL1 and the EL2 can efficiently improve the security.
+In practice, you need to select a proper encryption level based on scenario-specific requirements to protect application data security. The proper use of EL1 and the EL2 can efficiently improve the security.
> **NOTE**
>
-> - AreaMode.EL1: device-level encryption area, which is accessible after the device is powered on.
+> - AreaMode.EL1: device-level encryption. Directories with this encryption level are accessible after the device is powered on.
>
-> - AreaMode.EL2: user-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time).
+> - AreaMode.EL2: user-level encryption. Directories with this encryption level are accessible only after the device is powered on and the password is entered (for the first time).
-You can obtain and set the encryption area by reading and writing the [area attribute in Context](../reference/apis/js-apis-inner-application-context.md).
+You can obtain and set the encryption level by reading and writing the **area** attribute in [Context](../reference/apis/js-apis-inner-application-context.md).
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
+import contextConstant from '@ohos.app.ability.contextConstant';
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
// Before storing common information, switch the encryption level to EL1.
- if (this.context.area === 1) {// Obtain the area.
- this.context.area = 0; // Modify the area.
+ if (this.context.area === contextConstant.AreaMode.EL2) { // Obtain the area.
+ this.context.area = contextConstant.AreaMode.EL1; // Modify the area.
}
// Store common information.
// Before storing sensitive information, switch the encryption level to EL2.
- if (this.context.area === 0) { // Obtain the area.
- this.context.area = 1; // Modify the area.
+ if (this.context.area === contextConstant.AreaMode.EL1) { // Obtain the area.
+ this.context.area = contextConstant.AreaMode.EL2; // Modify the area.
}
// Store sensitive information.
}
@@ -181,7 +190,7 @@ export default class EntryAbility extends UIAbility {
### Creating Context of Another Application or Module
-The base class **Context** provides [createBundleContext(bundleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext), [createModuleContext(moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext), and [createModuleContext(bundleName:string, moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1) to create the context of other applications or modules, so as to obtain the resource information, for example, [obtaining the application development paths](#obtaining-the-application-development-path) of other modules.
+The base class **Context** provides [createBundleContext(bundleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext), [createModuleContext(moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext), and [createModuleContext(bundleName:string, moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1) to create the context of other applications or modules, so as to obtain the resource information, for example, [obtaining application file paths](#obtaining-application-development-paths) of other modules.
- Call **createBundleContext(bundleName:string)** to create the context of another application.
> **NOTE**
@@ -191,9 +200,9 @@ The base class **Context** provides [createBundleContext(bundleName:string)](../
> - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
>
> - This is a system API and cannot be called by third-party applications.
-
+
For example, application information displayed on the home screen includes the application name and icon. The home screen application calls the foregoing method to obtain the context information, so as to obtain the resource information including the application name and icon.
-
+
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
@@ -202,11 +211,11 @@ The base class **Context** provides [createBundleContext(bundleName:string)](../
let bundleName2 = 'com.example.application';
let context2 = this.context.createBundleContext(bundleName2);
let label2 = context2.applicationInfo.label;
- // ...
+ ...
}
}
```
-
+
- Call **createModuleContext(bundleName:string, moduleName:string)** to obtain the context of a specified module of another application. After obtaining the context, you can obtain the resource information of that module.
> **NOTE**
>
@@ -224,7 +233,7 @@ The base class **Context** provides [createBundleContext(bundleName:string)](../
let bundleName2 = 'com.example.application';
let moduleName2 = 'module1';
let context2 = this.context.createModuleContext(bundleName2, moduleName2);
- // ...
+ ...
}
}
```
@@ -238,7 +247,7 @@ The base class **Context** provides [createBundleContext(bundleName:string)](../
onCreate(want, launchParam) {
let moduleName2 = 'module1';
let context2 = this.context.createModuleContext(moduleName2);
- // ...
+ ...
}
}
```
@@ -248,7 +257,7 @@ The base class **Context** provides [createBundleContext(bundleName:string)](../
In the DFX statistics scenario of an application, if you need to collect statistics on the stay duration and access frequency of a page, you can subscribe to UIAbility lifecycle changes in a process.
-[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext) provides APIs for subscribing to UIAbility lifecycle changes in a process. When the UIAbility lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered. Each time the callback is registered, a listener lifecycle ID is returned, with the value incremented by 1 each time. When the number of listeners exceeds the upper limit (2^63-1), **-1** is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example.
+[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md) provides APIs for subscribing to UIAbility lifecycle changes in a process. When the UIAbility lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered. Each time the callback is registered, a listener lifecycle ID is returned, with the value incremented by 1 each time. When the number of listeners exceeds the upper limit (2^63-1), **-1** is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example.
```ts
@@ -266,53 +275,53 @@ export default class EntryAbility extends UIAbility {
let abilityLifecycleCallback = {
// Called when a UIAbility is created.
onAbilityCreate(uiAbility) {
- console.log(TAG, `onAbilityCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onAbilityCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
},
// Called when a window is created.
onWindowStageCreate(uiAbility, windowStage: window.WindowStage) {
- console.log(TAG, `onWindowStageCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
- console.log(TAG, `onWindowStageCreate windowStage: ${JSON.stringify(windowStage)}`);
+ console.info(TAG, `onWindowStageCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onWindowStageCreate windowStage: ${JSON.stringify(windowStage)}`);
},
// Called when the window becomes active.
onWindowStageActive(uiAbility, windowStage: window.WindowStage) {
- console.log(TAG, `onWindowStageActive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
- console.log(TAG, `onWindowStageActive windowStage: ${JSON.stringify(windowStage)}`);
+ console.info(TAG, `onWindowStageActive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onWindowStageActive windowStage: ${JSON.stringify(windowStage)}`);
},
// Called when the window becomes inactive.
onWindowStageInactive(uiAbility, windowStage: window.WindowStage) {
- console.log(TAG, `onWindowStageInactive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
- console.log(TAG, `onWindowStageInactive windowStage: ${JSON.stringify(windowStage)}`);
+ console.info(TAG, `onWindowStageInactive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onWindowStageInactive windowStage: ${JSON.stringify(windowStage)}`);
},
// Called when the window is destroyed.
onWindowStageDestroy(uiAbility, windowStage: window.WindowStage) {
- console.log(TAG, `onWindowStageDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
- console.log(TAG, `onWindowStageDestroy windowStage: ${JSON.stringify(windowStage)}`);
+ console.info(TAG, `onWindowStageDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onWindowStageDestroy windowStage: ${JSON.stringify(windowStage)}`);
},
// Called when the UIAbility is destroyed.
onAbilityDestroy(uiAbility) {
- console.log(TAG, `onAbilityDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onAbilityDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
},
// Called when the UIAbility is switched from the background to the foreground.
onAbilityForeground(uiAbility) {
- console.log(TAG, `onAbilityForeground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onAbilityForeground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
},
// Called when the UIAbility is switched from the foreground to the background.
onAbilityBackground(uiAbility) {
- console.log(TAG, `onAbilityBackground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onAbilityBackground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
},
// Called when UIAbility is continued on another device.
onAbilityContinue(uiAbility) {
- console.log(TAG, `onAbilityContinue uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
+ console.info(TAG, `onAbilityContinue uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
}
}
// Obtain the application context.
let applicationContext = this.context.getApplicationContext();
// Register the application lifecycle callback.
this.lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback);
- console.log(TAG, `register callback number: ${this.lifecycleId}`);
+ console.info(TAG, `register callback number: ${this.lifecycleId}`);
}
- // ...
+ ...
onDestroy() {
// Obtain the application context.
diff --git a/en/application-dev/application-models/application-model-description.md b/en/application-dev/application-models/application-model-description.md
index 0cdfa7323c6ef367a47a44e2c30104d3201ca159..20fa9019d10c8d242e34b309debec78e722e6c27 100644
--- a/en/application-dev/application-models/application-model-description.md
+++ b/en/application-dev/application-models/application-model-description.md
@@ -12,10 +12,9 @@ Along its evolution, OpenHarmony has provided two application models:
The stage model is designed based on the following considerations, which make it become the recommended model:
1. **Designed for complex applications**
-
- In the stage model, multiple application components share an ArkTS engine (VM running the programming language ArkTS) instance, making it easy for application components to share objects and status while requiring less memory.
- The object-oriented development mode makes the code of complex applications easy to read, maintain, and scale.
-
+
2. **Native support for [cross-device migration](hop-cross-device-migration.md) and [multi-device collaboration](hop-multi-device-collaboration.md) at the application component level**
The stage model decouples application components from User Interfaces (UIs).
@@ -38,7 +37,7 @@ The stage model is designed based on the following considerations, which make it
The stage model redefines the boundary of application capabilities to well balance application capabilities and system management costs.
- - Diverse application components (such as widgets and input methods) for specific scenarios.
+ - Diverse application components (such as service widgets and input methods) for specific scenarios.
- Standardized background process management. To deliver a better user experience, the stage model manages background application processes in a more orderly manner. Applications cannot reside in the background randomly, and their background behavior is strictly managed to minimize malicious behavior.
@@ -52,8 +51,8 @@ The table below describes their differences in detail.
| Item| FA model| Stage model|
| -------- | -------- | -------- |
-| **Application component**| 1. Component classification  - PageAbility: has the UI and supports user interaction For details, see [PageAbility Component Overview](pageability-overview.md). - ServiceAbility: provides background services and has no UI. For details, see [ServiceAbility Component Overview](serviceability-overview.md). - DataAbility: provides the data sharing capability and has no UI. For details, see [DataAbility Component Overview](dataability-overview.md). 2. Development mode Application components are specified by exporting anonymous objects and fixed entry files. You cannot perform derivation. It is inconvenient for capability expansion. | 1. Component classification  - UIAbility: has the UI and supports user interaction. For details, see [UIAbility Component Overview](uiability-overview.md). - ExtensionAbility: provides extension capabilities (such as widget and input methods) for specific scenarios. For details, see [ExtensionAbility Component Overview](extensionability-overview.md). 2. Development mode The object-oriented mode is used to provide open application components as classes. You can derive application components for capability expansion. |
-| **Process model**| There are two types of processes: 1. Main process 2. Rendering process For details, see [Process Model (FA Model)](process-model-fa.md).| There are three types of processes: 1. Main process 2. ExtensionAbility process 3. Rendering process For details, see [Process Model (Stage Model)](process-model-stage.md).|
-| **Thread model**| 1. ArkTS engine instance creation A process can run multiple application component instances, and each application component instance runs in an independent ArkTS engine instance. 2. Thread model Each ArkTS engine instance is created on an independent thread (non-main thread). The main thread does not have an ArkTS engine instance. 3. Intra-process object sharing: not supported. For details, see [Thread Model (FA Model)](thread-model-fa.md).| 1. ArkTS engine instance creation A process can run multiple application component instances, and all application component instances share one ArkTS engine instance. 2. Thread model The ArkTS engine instance is created on the main thread. 3. Intra-process object sharing: supported. For details, see [Thread Model (Stage Model)](thread-model-stage.md).|
+| **Application component**| 1. Component classification  - PageAbility: has the UI and supports user interaction For details, see [PageAbility Component Overview](pageability-overview.md). - ServiceAbility: provides background services and has no UI. For details, see [ServiceAbility Component Overview](serviceability-overview.md). - DataAbility: provides the data sharing capability and has no UI. For details, see [DataAbility Component Overview](dataability-overview.md). 2. Development mode Application components are specified by exporting anonymous objects and fixed entry files. You cannot perform derivation. It is inconvenient for capability expansion.| 1. Component classification  - UIAbility: has the UI and supports user interaction. For details, see [UIAbility Component Overview](uiability-overview.md). - ExtensionAbility: provides extension capabilities (such as widget and input methods) for specific scenarios. For details, see [ExtensionAbility Component Overview](extensionability-overview.md). 2. Development mode The object-oriented mode is used to provide open application components as classes. You can derive application components for capability expansion.|
+| **Process model**| There are two types of processes: 1. Main process 2. Rendering process For details, see [Process Model Overview (FA Model)](process-model-fa.md). | There are three types of processes: 1. Main process 2. ExtensionAbility process 3. Rendering process For details, see [Process Model Overview (Stage Model)](process-model-stage.md). |
+| **Thread model**| 1. ArkTS engine instance creation A process can run multiple application component instances, and each application component instance runs in an independent ArkTS engine instance. 2. Thread model Each ArkTS engine instance is created on an independent thread (non-main thread). The main thread does not have an ArkTS engine instance. 3. Intra-process object sharing: not supported. For details, see [Thread Model Overview (FA Model)](thread-model-fa.md). | 1. ArkTS engine instance creation A process can run multiple application component instances, and all application component instances share one ArkTS engine instance. 2. Thread model The ArkTS engine instance is created on the main thread. 3. Intra-process object sharing: supported. For details, see [Thread Model Overview (Stage Model)](thread-model-stage.md). |
| **Mission management model**| - A mission is created for each PageAbility component instance. - Missions are stored persistently until the number of missions exceeds the maximum (customized based on the product configuration) or users delete missions. - PageAbility components do not form a stack structure. For details, see [Mission Management Scenarios](mission-management-overview.md).| - A mission is created for each UIAbility component instance. - Missions are stored persistently until the number of missions exceeds the maximum (customized based on the product configuration) or users delete missions. - UIAbility components do not form a stack structure. For details, see [Mission Management Scenarios](mission-management-overview.md).|
| **Application configuration file**| The **config.json** file is used to describe the application, HAP, and application component information. For details, see [Application Configuration File Overview (FA Model)](../quick-start/application-configuration-file-overview-fa.md).| The **app.json5** file is used to describe the application information, and the **module.json5** file is used to describe the HAP and application component information. For details, see [Application Configuration File Overview (Stage Model)](../quick-start/application-configuration-file-overview-stage.md).|
diff --git a/en/application-dev/application-models/arkts-ui-widget-configuration.md b/en/application-dev/application-models/arkts-ui-widget-configuration.md
new file mode 100644
index 0000000000000000000000000000000000000000..7e438ce4215a583c4ad7ccebc8cfc591b5251ad6
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-configuration.md
@@ -0,0 +1,84 @@
+# Configuring Widget Configuration Files
+
+
+Widget-related configuration includes **FormExtensionAbility** configuration and widget configuration.
+
+
+1. Configure FormExtensionAbility information under **extensionAbilities** in the [module.json5 file](../quick-start/module-configuration-file.md). For a FormExtensionAbility, you must specify **metadata**. Specifically, set **name** to **ohos.extension.form** (fixed), and set **resource** to the index of the widget configuration information.
+
+ Example configuration:
+
+
+ ```json
+ {
+ "module": {
+ ...
+ "extensionAbilities": [
+ {
+ "name": "EntryFormAbility",
+ "srcEntry": "./ets/entryformability/EntryFormAbility.ts",
+ "label": "$string:EntryFormAbility_label",
+ "description": "$string:EntryFormAbility_desc",
+ "type": "form",
+ "metadata": [
+ {
+ "name": "ohos.extension.form",
+ "resource": "$profile:form_config"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ```
+
+2. Configure the widget configuration information. In the **metadata** configuration item of FormExtensionAbility, you can specify the resource index of specific configuration information of the widget. For example, if resource is set to **$profile:form_config**, **form_config.json** in the **resources/base/profile/** directory of the development view is used as the profile configuration file of the widget. The following table describes the internal field structure.
+
+ **Table 1** form_config.json file
+
+ | Field| Description| Data Type| Default Value Allowed|
+ | -------- | -------- | -------- | -------- |
+ | name | Class name of the widget. The value is a string with a maximum of 127 bytes.| String| No|
+ | description | Description of the widget. The value can be a string or a resource index to descriptions in multiple languages. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
+ | src | Full path of the UI code corresponding to the widget. For an ArkTS widget, the full path must contain the widget file name extension, for example, **./ets/widget/pages/WidgetCard.ets**. For a JS widget, the full path does not need to contain the widget file name extension, for example, **./js/widget/pages/WidgetCard**.| String| No|
+ | uiSyntax | Type of the widget. - **arkts**: ArkTS widget - **hml**: JS widget| String| Yes (initial value: **hml**)|
+ | window | Window-related configurations.| Object| Yes|
+ | isDefault | Whether the widget is a default one. Each UIAbility has only one default widget. - **true**: The widget is the default one. - **false**: The widget is not the default one.| Boolean| No|
+ | colorMode | Color mode of the widget. - **auto**: auto-adaptive color mode - **dark**: dark color mode - **light**: light color mode| String| Yes (initial value: **auto**)|
+ | supportDimensions | Grid styles supported by the widget. - **1 * 2**: indicates a grid with one row and two columns. - **2 * 2**: indicates a grid with two rows and two columns. - **2 * 4**: indicates a grid with two rows and four columns. - **4 * 4**: indicates a grid with four rows and four columns.| String array| No|
+ | defaultDimension | Default grid style of the widget. The value must be available in the **supportDimensions** array of the widget.| String| No|
+ | updateEnabled | Whether the widget can be updated periodically. - **true**: The widget can be updated at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** takes precedence over **scheduledUpdateTime**. - **false**: The widget cannot be updated periodically.| Boolean| No|
+ | scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute. **NOTE** **updateDuration** takes precedence over **scheduledUpdateTime**. If both are specified, the value specified by **updateDuration** is used.| String| Yes (initial value: The widget cannot be updated periodically.)|
+ | updateDuration | Interval to update the widget. The value is a natural number, in the unit of 30 minutes. If the value is **0**, this field does not take effect. If the value is a positive integer *N*, the interval is calculated by multiplying *N* and 30 minutes. **NOTE** **updateDuration** takes precedence over **scheduledUpdateTime**. If both are specified, the value specified by **updateDuration** is used.| Number| Yes (initial value: **0**)|
+ | formConfigAbility | Link to a specific page of the application. The value is a URI.| String| Yes (initial value: left empty)|
+ | formVisibleNotify | Whether the widget is allowed to use the widget visibility notification.| String| Yes (initial value: left empty)|
+ | metadata | Metadata of the widget. This field contains the array of the **customizeData** field.| Object| Yes (initial value: left empty)|
+
+ Example configuration:
+
+
+ ```json
+ {
+ "forms": [
+ {
+ "name": "widget",
+ "description": "This is a service widget.",
+ "src": "./ets/widget/pages/WidgetCard.ets",
+ "uiSyntax": "arkts",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ },
+ "colorMode": "auto",
+ "isDefault": true,
+ "updateEnabled": true,
+ "scheduledUpdateTime": "10:30",
+ "updateDuration": 1,
+ "defaultDimension": "2*2",
+ "supportDimensions": [
+ "2*2"
+ ]
+ }
+ ]
+ }
+ ```
diff --git a/en/application-dev/application-models/arkts-ui-widget-content-update.md b/en/application-dev/application-models/arkts-ui-widget-content-update.md
new file mode 100644
index 0000000000000000000000000000000000000000..c0f4c840b6c11b497405ce8777a04317b5ffca4d
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-content-update.md
@@ -0,0 +1,30 @@
+# Updating Widget Content by Widget Host (for System Applications Only)
+
+
+Widgets that are updated periodically are subject to the scheduled time or interval settings. To offer more flexible updates, the widget host can provide a button to proactively trigger a widget update. Specifically, the widget host calls the [requestForm](../reference/apis/js-apis-app-form-formHost.md#requestform) API to request a widget update. The system then calls the [onUpdateForm](../reference/apis/js-apis-app-form-formExtensionAbility.md#onupdateform) lifecycle callback in the FormExtensionAbility of the widget provider. In the callback, the [updateForm](../reference/apis/js-apis-app-form-formProvider.md#updateform) API can be used to update the widget content. For details about the **onUpdateForm** lifecycle callback, see [Updating Widget Content Through FormExtensionAbility](arkts-ui-widget-event-formextensionability.md).
+
+```ts
+import formHost from '@ohos.app.form.formHost';
+
+@Entry()
+@Component
+struct WidgetCard {
+ formId = ...; // Widget ID
+
+ build() {
+ Button (`Update Widget`)
+ .type(ButtonType.Capsule)
+ .width('50%')
+ .height(50)
+ .onClick(() => {
+ console.info('FormAbility update form click');
+ // formId is the ID of the widget to be updated.
+ formHost.requestForm(this.formId.toString()).then(() => {
+ console.info('Succeeded in requestForming.');
+ });
+ })
+
+ ...
+ }
+}
+```
diff --git a/en/application-dev/application-models/arkts-ui-widget-creation.md b/en/application-dev/application-models/arkts-ui-widget-creation.md
new file mode 100644
index 0000000000000000000000000000000000000000..cc8843c0294cf745e7737164e46cb8f69256efa2
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-creation.md
@@ -0,0 +1,19 @@
+# Creating an ArkTS Widget
+
+To create an ArkTS widget in an existing application project, perform the following steps:
+
+1. Create a widget.
+
+ 
+
+2. Select a widget template based on the actual service scenario.
+
+ 
+
+3. Set **Language** to **ArkTS** and click **Finish**.
+
+ 
+
+After an ArkTS widget is created, the following widget-related files are added to the project directory: **EntryFormAbility.ts** (widget lifecycle management file), **WidgetCard.ets** (widget page file), and **form_config.json** (widget configuration file).
+
+
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-call.md b/en/application-dev/application-models/arkts-ui-widget-event-call.md
new file mode 100644
index 0000000000000000000000000000000000000000..69189afb06c941158047462015519499961c9b95
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-event-call.md
@@ -0,0 +1,91 @@
+# Launching a UIAbility in the Background Through the call Event
+
+
+There may be cases you want to provide in a widget access to features available in your application running in the foreground, for example, the play, pause, and stop buttons in a music application widget. This is where the **call** capability of the **postCardAction** API comes in handy. This capability, when used in a widget, can start the specified UIAbility of the widget provider in the background. It also allows the widget to call the specified method of the application and transfer data so that the application, while in the background, can behave accordingly in response to touching of the buttons on the widget.
+
+
+Typically, the call event is triggered for touching of buttons. Below is an example.
+
+
+- In this example, two buttons are laid out on the widget page. When one button is clicked, the **postCardAction** API is called to send a call event to the target UIAbility. Note that the **method** parameter in the API indicates the method to call in the target UIAbility. It is mandatory and of the string type.
+
+ ```ts
+ @Entry
+ @Component
+ struct WidgetCard {
+ build() {
+ Column() {
+ Button ('Feature A')
+ .margin('20%')
+ .onClick(() => {
+ console.info('call EntryAbility funA');
+ postCardAction(this, {
+ 'action': 'call',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'method': 'funA' // Set the name of the method to call in the EntryAbility.
+ }
+ });
+ })
+
+ Button ('Feature B')
+ .margin('20%')
+ .onClick(() => {
+ console.info('call EntryAbility funB');
+ postCardAction(this, {
+ 'action': 'call',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'method': 'funB', // Set the name of the method to call in the EntryAbility.
+ 'num': 1 // Set other parameters to be passed in.
+ }
+ });
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+- The UIAbility receives the call event and obtains the transferred parameters. It then executes the target method specified by the **method** parameter. Other data can be obtained in readString mode. Listen for the method required by the call event in the **onCreate** callback of the UIAbility.
+
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+
+ function FunACall(data) {
+ // Obtain all parameters passed in the call event.
+ console.info('FunACall param:' + JSON.stringify(data.readString()));
+ return null;
+ }
+
+ function FunBCall(data) {
+ console.info('FunBCall param:' + JSON.stringify(data.readString()));
+ return null;
+ }
+
+ export default class CameraAbility extends UIAbility {
+ // If the UIAbility is started for the first time, onCreate is triggered afte the call event is received.
+ onCreate(want, launchParam) {
+ try {
+ // Listen for the method required by the call event.
+ this.callee.on('funA', FunACall);
+ this.callee.on('funB', FunBCall);
+ } catch (err) {
+ console.error(`Failed to register callee on. Cause: ${JSON.stringify(err)}`);
+ }
+ }
+
+ ...
+
+ // Deregister the listener when the process exits.
+ onDestroy() {
+ try {
+ this.callee.off('funA');
+ this.callee.off('funB');
+ } catch (err) {
+ console.error(`Failed to register callee off. Cause: ${JSON.stringify(err)}`);
+ }
+ }
+ };
+ ```
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-formextensionability.md b/en/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
new file mode 100644
index 0000000000000000000000000000000000000000..be7761d8d78da5102afadd2c37043c228dfcd53e
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
@@ -0,0 +1,66 @@
+# Updating Widget Content Through the message Event
+
+
+On the widget page, the **postCardAction** API can be used to trigger a message event to start a FormExtensionAbility, which then updates the widget content. The following is an example of this widget update mode.
+
+
+- On the widget page, register the **onClick** event callback of the button and call the **postCardAction** API in the callback to trigger the event to the FormExtensionAbility.
+
+ ```ts
+ let storage = new LocalStorage();
+ @Entry(storage)
+ @Component
+ struct WidgetCard {
+ @LocalStorageProp('title') title: string = 'init';
+ @LocalStorageProp('detail') detail: string = 'init';
+
+ build() {
+ Column() {
+ Button ('Update')
+ .onClick(() => {
+ postCardAction(this, {
+ 'action': 'message',
+ 'params': {
+ 'msgTest': 'messageEvent'
+ }
+ });
+ })
+ Text(`${this.title}`)
+ Text(`${this.detail}`)
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+- Call the [updateForm](../reference/apis/js-apis-app-form-formProvider.md#updateform) API to update the widget in the **onFormEvent** callback of the FormExtensionAbility.
+
+ ```ts
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+ import formProvider from '@ohos.app.form.formProvider';
+
+ export default class EntryFormAbility extends FormExtensionAbility {
+ onFormEvent(formId, message) {
+ // Called when a specified message event defined by the form provider is triggered.
+ console.info(`FormAbility onEvent, formId = ${formId}, message: ${JSON.stringify(message)}`);
+ let formData = {
+ 'title':'Title Update Success.', // Matches the widget layout.
+ 'detail':'Detail Update Success.', // Matches the widget layout.
+ };
+ let formInfo = formBindingData.createFormBindingData(formData)
+ formProvider.updateForm(formId, formInfo).then((data) => {
+ console.info('FormAbility updateForm success.' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('FormAbility updateForm failed: ' + JSON.stringify(error));
+ })
+ }
+
+ ...
+ }
+ ```
+
+ The figure below shows the effect.
+
+ 
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-overview.md b/en/application-dev/application-models/arkts-ui-widget-event-overview.md
new file mode 100644
index 0000000000000000000000000000000000000000..299a279c9117dad71e6fea658bb8da3298ed8f05
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-event-overview.md
@@ -0,0 +1,63 @@
+# Widget Event Capability Overview
+
+The ArkTS widget provides the **postCardAction()** API for interaction between the widget internal and the widget provider. Currently, this API supports the router, message, and call events and can be called only in the widget.
+
+
+
+**Definition**: postCardAction(component: Object, action: Object): void
+
+**Parameters**
+
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| component | Object | Yes| Instance of the current custom component. Generally, **this** is passed in.|
+| action | Object | Yes| Action description. For details, see the following table.|
+
+**Description of the action parameter**
+
+
+| Key | Value | Description|
+| -------- | -------- | -------- |
+| "action" | string | Action type. - **"router"**: redirection to the specified UIAbility of the widget provider. - **"message"**: custom message. If this type of action is triggered, the [onFormEvent()](../reference/apis/js-apis-app-form-formExtensionAbility.md#onformevent) lifecycle callback of the provider FormExtensionAbility is called. - **"call"**: launch of the widget provider in the background. If this type of action is triggered, the specified UIAbility (whose [launch type](uiability-launch-type.md) must be singleton) of the widget provider is started in the background, but not displayed in the foreground. This action type requires that the widget provider should have the [ohos.permission.KEEP_BACKGROUND_RUNNING](../security/permission-list.md#ohospermissionkeep_background_running) permission.|
+| "bundleName" | string | Name of the target bundle when **action** is **"router"** or **"call"**. This parameter is optional.|
+| "moduleName" | string | Name of the target module when **action** is **"router"** or **"call"**. This parameter is optional.|
+| "abilityName" | string | Name of the target UIAbility when **action** is **"router"** or **"call"**. This parameter is mandatory.|
+| "params" | Object | Additional parameters carried in the current action. The value is a key-value pair in JSON format. For the **"call"** action type, the **method** parameter (mandatory) must be set and its value type must be string.|
+
+
+Sample code of the **postCardAction()** API:
+
+```typescript
+Button ('Redirect')
+ .width('40%')
+ .height('20%')
+ .onClick(() => {
+ postCardAction(this, {
+ 'action': 'router',
+ 'bundleName': 'com.example.myapplication',
+ 'abilityName': 'EntryAbility',
+ 'params': {
+ 'message': 'testForRouter' // Customize the message to send.
+ }
+ });
+ })
+
+Button ('Start in Background')
+ .width('40%')
+ .height('20%')
+ .onClick(() => {
+ postCardAction(this, {
+ 'action': 'call',
+ 'bundleName': 'com.example.myapplication',
+ 'abilityName': 'EntryAbility',
+ 'params': {
+ 'method': 'fun', // Set the name of the method to call. It is mandatory.
+ 'message': 'testForCall' // Customize the message to send.
+ }
+ });
+ })
+```
+
+
+Read on to learn the typical widget development scenarios that can be implemented through widget events.
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-router.md b/en/application-dev/application-models/arkts-ui-widget-event-router.md
new file mode 100644
index 0000000000000000000000000000000000000000..733ff7f59b57ec4295fa21cb4d83ae8a5b2b8eb4
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-event-router.md
@@ -0,0 +1,108 @@
+# Redirecting to a UIAbility Through the router Event
+
+The **router** capability of the **postCardAction** API can be used in a widget to quickly start a specific UIAbility of the widget provider. By leveraging this capability, an application can provide in the widget multiple buttons, each of which targets a different target UIAbility. For example, a camera widget can provide the buttons that redirect the user to the UIAbility for taking a photo and the UIAbility for recording a video.
+
+
+
+
+Generally, a button is used to start a page.
+
+
+- Design two buttons on the widget page. When one of the buttons is clicked, **postCardAction** is called to send a router event to the specified UIAbility, with the content to be transferred defined in the event.
+
+ ```ts
+ @Entry
+ @Component
+ struct WidgetCard {
+ build() {
+ Column() {
+ Button ('Function A')
+ .margin('20%')
+ .onClick(() => {
+ console.info('Jump to EntryAbility funA');
+ postCardAction(this, {
+ 'action': 'router',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'targetPage': 'funA' // Process the information in the EntryAbility.
+ }
+ });
+ })
+
+ Button ('Function B')
+ .margin('20%')
+ .onClick(() => {
+ console.info('Jump to EntryAbility funB');
+ postCardAction(this, {
+ 'action': 'router',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'targetPage': 'funB' // Process the information in the EntryAbility.
+ }
+ });
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+- The UIAbility receives the router event and obtains parameters. It then starts the page specified in the received message.
+
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+ import window from '@ohos.window';
+
+ let selectPage = "";
+ let currentWindowStage = null;
+
+ export default class CameraAbility extends UIAbility {
+ // If the UIAbility is started for the first time, the onCreate lifecycle callback is triggered after the router event is received.
+ onCreate(want, launchParam) {
+ // Obtain the targetPage parameter passed in the router event.
+ console.info("onCreate want:" + JSON.stringify(want));
+ if (want.parameters.params !== undefined) {
+ let params = JSON.parse(want.parameters.params);
+ console.info("onCreate router targetPage:" + params.targetPage);
+ selectPage = params.targetPage;
+ }
+ }
+ // If the UIAbility is running in the background, the onNewWant lifecycle callback is triggered after the router event is received.
+ onNewWant(want, launchParam) {
+ console.info("onNewWant want:" + JSON.stringify(want));
+ if (want.parameters.params !== undefined) {
+ let params = JSON.parse(want.parameters.params);
+ console.info("onNewWant router targetPage:" + params.targetPage);
+ selectPage = params.targetPage;
+ }
+ if (currentWindowStage != null) {
+ this.onWindowStageCreate(currentWindowStage);
+ }
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ let targetPage;
+ // Start the page specified by targetPage.
+ switch (selectPage) {
+ case 'funA':
+ targetPage = 'pages/FunA';
+ break;
+ case 'funB':
+ targetPage = 'pages/FunB';
+ break;
+ default:
+ targetPage = 'pages/Index';
+ }
+ if (currentWindowStage === null) {
+ currentWindowStage = windowStage;
+ }
+ windowStage.loadContent(targetPage, (err, data) => {
+ if (err && err.code) {
+ console.info('Failed to load the content. Cause: %{public}s', JSON.stringify(err));
+ return;
+ }
+ });
+ }
+ };
+ ```
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-uiability.md b/en/application-dev/application-models/arkts-ui-widget-event-uiability.md
new file mode 100644
index 0000000000000000000000000000000000000000..17a211188704609e5bc60dcbcf6b058a8a8a0dbe
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-event-uiability.md
@@ -0,0 +1,187 @@
+# Updating Widget Content Through the router or call Event
+
+
+On the widget page, the **postCardAction** API can be used to trigger a router or call event to start a UIAbility, which then updates the widget content. The following is an example of this widget update mode.
+
+## Updating Widget Content Through the router Event
+
+- On the widget page, register the **onClick** event callback of the button and call the **postCardAction** API in the callback to trigger the router event to the FormExtensionAbility.
+
+ ```ts
+ let storage = new LocalStorage();
+ @Entry(storage)
+ @Component
+ struct WidgetCard {
+ @LocalStorageProp('detail') detail: string = 'init';
+
+ build() {
+ Column() {
+ Button ('Redirect')
+ .margin('20%')
+ .onClick(() => {
+ console.info('postCardAction to EntryAbility');
+ postCardAction(this, {
+ 'action': 'router',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'detail': 'RouterFromCard'
+ }
+ });
+ })
+ Text(`${this.detail}`).margin('20%')
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+- In the **onCreate()** or **onNewWant()** lifecycle callback of the UIAbility, use the input parameter **want** to obtain the ID (**formID**) and other information of the widget, and then call the [updateForm](../reference/apis/js-apis-app-form-formProvider.md#updateform) API to update the widget.
+
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import formProvider from '@ohos.app.form.formProvider';
+ import formInfo from '@ohos.app.form.formInfo';
+
+ export default class EntryAbility extends UIAbility {
+ // If the UIAbility is started for the first time, onCreate is triggered after the router event is received.
+ onCreate(want, launchParam) {
+ console.info('Want:' + JSON.stringify(want));
+ if (want.parameters[formInfo.FormParam.IDENTITY_KEY] !== undefined) {
+ let curFormId = want.parameters[formInfo.FormParam.IDENTITY_KEY];
+ let message = JSON.parse(want.parameters.params).detail;
+ console.info(`UpdateForm formId: ${curFormId}, message: ${message}`);
+ let formData = {
+ "detail": message +': onCreate UIAbility.', // Matches the widget layout.
+ };
+ let formMsg = formBindingData.createFormBindingData(formData)
+ formProvider.updateForm(curFormId, formMsg).then((data) => {
+ console.info('updateForm success.' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('updateForm failed:' + JSON.stringify(error));
+ })
+ }
+ }
+ // If the UIAbility is running in the background, onNewWant is triggered after the router event is received.
+ onNewWant(want, launchParam) {
+ console.info('onNewWant Want:' + JSON.stringify(want));
+ if (want.parameters[formInfo.FormParam.IDENTITY_KEY] !== undefined) {
+ let curFormId = want.parameters[formInfo.FormParam.IDENTITY_KEY];
+ let message = JSON.parse(want.parameters.params).detail;
+ console.info(`UpdateForm formId: ${curFormId}, message: ${message}`);
+ let formData = {
+ "detail": message +': onNewWant UIAbility.', // Matches the widget layout.
+ };
+ let formMsg = formBindingData.createFormBindingData(formData)
+ formProvider.updateForm(curFormId, formMsg).then((data) => {
+ console.info('updateForm success.' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('updateForm failed:' + JSON.stringify(error));
+ })
+ }
+ }
+
+ ...
+ }
+ ```
+
+## Updating Widget Content Through the call Event
+
+- When using the call event of the **postCardAction** API, the value of **formId** must be updated in the **onAddForm** callback of the FormExtensionAbility.
+
+ ```ts
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+
+ export default class EntryFormAbility extends FormExtensionAbility {
+ onAddForm(want) {
+ let formId = want.parameters["ohos.extra.param.key.form_identity"];
+ let dataObj1 = {
+ "formId": formId
+ };
+ let obj1 = formBindingData.createFormBindingData(dataObj1);
+ return obj1;
+ }
+
+ ...
+ };
+ ```
+
+- On the widget page, register the **onClick** event callback of the button and call the **postCardAction** API in the callback to trigger the event to the UIAbility.
+
+ ```ts
+ let storage = new LocalStorage();
+ @Entry(storage)
+ @Component
+ struct WidgetCard {
+ @LocalStorageProp('detail') detail: string = 'init';
+ @LocalStorageProp('formId') formId: string = '0';
+
+ build() {
+ Column() {
+ Button ('Start in Background')
+ .margin('20%')
+ .onClick(() => {
+ console.info('postCardAction to EntryAbility');
+ postCardAction(this, {
+ 'action': 'call',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'method': 'funA',
+ 'formId': this.formId,
+ 'detail': 'CallFromCard'
+ }
+ });
+ })
+ Text(`${this.detail}`).margin('20%')
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+- Listen for the method required by the call event in the **onCreate** callback of the UIAbility, and then call the [updateForm](../reference/apis/js-apis-app-form-formProvider.md#updateform) API in the corresponding method to update the widget.
+
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import formProvider from '@ohos.app.form.formProvider';
+
+ const MSG_SEND_METHOD: string = 'funA';
+
+ // After the call event is received, the method listened for by the callee is triggered.
+ function FunACall(data) {
+ // Obtain all parameters transferred in the call event.
+ let params = JSON.parse(data.readString())
+ if (params.formId !== undefined) {
+ let curFormId = params.formId;
+ let message = params.detail;
+ console.info(`UpdateForm formId: ${curFormId}, message: ${message}`);
+ let formData = {
+ "detail": message
+ };
+ let formMsg = formBindingData.createFormBindingData(formData)
+ formProvider.updateForm(curFormId, formMsg).then((data) => {
+ console.info('updateForm success.' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('updateForm failed:' + JSON.stringify(error));
+ })
+ }
+ return null;
+ }
+ export default class EntryAbility extends UIAbility {
+ // If the UIAbility is started for the first time, onCreate is triggered after the call event is received.
+ onCreate(want, launchParam) {
+ console.info('Want:' + JSON.stringify(want));
+ try {
+ // Listen for the method required by the call event.
+ this.callee.on(MSG_SEND_METHOD, FunACall);
+ } catch (error) {
+ console.info(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`)
+ }
+ }
+ ...
+ }
+ ```
diff --git a/en/application-dev/application-models/arkts-ui-widget-image-update.md b/en/application-dev/application-models/arkts-ui-widget-image-update.md
new file mode 100644
index 0000000000000000000000000000000000000000..dfe6dbf0e9249c66c3fb1d0723f1c7b296443381
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-image-update.md
@@ -0,0 +1,166 @@
+# Updating Local and Online Images in the Widget
+
+
+Typically, a widget includes local images or online images downloaded from the network. To obtain local and online images, use the FormExtensionAbility. The following exemplifies how to show local and online images on a widget.
+
+
+1. For the widget to download online images, declare the **ohos.permission.INTERNET** permission for the widget. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md).
+
+2. Update local files in the **onAddForm** lifecycle callback of the EntryFormAbility.
+
+ ```ts
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import formProvider from '@ohos.app.form.formProvider';
+ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+ import request from '@ohos.request';
+ import fs from '@ohos.file.fs';
+
+ export default class EntryFormAbility extends FormExtensionAbility {
+ ...
+ // When the widget is added, a local image is opened and transferred to the widget page for display.
+ onAddForm(want) {
+ // Assume that the local image head.PNG is in the tmp directory of the current widget.
+ let tempDir = this.context.getApplicationContext().tempDir;
+ // Open the local image and obtain the FD after the image is opened.
+ let file;
+ try {
+ file = fs.openSync(tempDir + '/' + 'head.PNG');
+ } catch (e) {
+ console.error(`openSync failed: ${JSON.stringify(e)}`);
+ }
+ let formData = {
+ 'text': 'Image: Bear',
+ 'imgName': 'imgBear',
+ 'formImages': {
+ 'imgBear': file.fd
+ },
+ 'loaded': true
+ }
+ // Encapsulate the FD in formData and return it to the widget page.
+ return formBindingData.createFormBindingData(formData);
+ }
+
+ ...
+ }
+ ```
+
+3. Update online images in the **onFormEvent** lifecycle callback of the EntryFormAbility.
+
+ ```ts
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import formProvider from '@ohos.app.form.formProvider';
+ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+ import request from '@ohos.request';
+ import fs from '@ohos.file.fs';
+
+ export default class EntryFormAbility extends FormExtensionAbility {
+ // When the message event is triggered on the widget page, an online image is downloaded and transferred to the widget page for display.
+ onFormEvent(formId, message) {
+ let formInfo = formBindingData.createFormBindingData({
+ 'text': 'Updating...'
+ })
+ formProvider.updateForm(formId, formInfo)
+ // Note: After being started with the triggering of the lifecycle callback, the FormExtensionAbility can run in the background for only 5 seconds.
+ // When possible, limit the size of the image to download. If an image cannot be downloaded within 5 seconds, it will not be updated to the widget page.
+ let netFile = 'https://xxxx/xxxx.png'; // Specify the URL of the image to download.
+ let tempDir = this.context.getApplicationContext().tempDir;
+ let fileName = 'file' + Date.now();
+ let tmpFile = tempDir + '/' + fileName;
+ request.downloadFile(this.context, {
+ url: netFile, filePath: tmpFile, enableMetered: true, enableRoaming: true
+ }).then((task) => {
+ task.on('complete', function callback() {
+ console.info('ArkTSCard download complete:' + tmpFile);
+ let file;
+ try {
+ file = fs.openSync(tmpFile);
+ } catch (e) {
+ console.error(`openSync failed: ${JSON.stringify(e)}`);
+ }
+ let fileInfo = {};
+ fileInfo[fileName] = file.fd;
+ let formData = {
+ 'text': 'Image:' + fileName,
+ 'imgName': fileName,
+ 'formImages': fileInfo,
+ 'loaded': true
+ };
+ let formInfo = formBindingData.createFormBindingData(formData)
+ formProvider.updateForm(formId, formInfo).then((data) => {
+ console.info('FormAbility updateForm success.' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('FormAbility updateForm failed: ' + JSON.stringify(error));
+ })
+ })
+ task.on('fail', function callBack(err) {
+ console.info('ArkTSCard download task failed. Cause:' + err);
+ let formInfo = formBindingData.createFormBindingData({
+ 'text':'Update failed.'
+ })
+ formProvider.updateForm(formId, formInfo)
+ });
+ }).catch((err) => {
+ console.error('Failed to request the download. Cause: ' + JSON.stringify(err));
+ });
+ }
+
+ ...
+ };
+ ```
+
+4. On the widget page, use the **\** component to display the widget content transferred from the EntryFormAbility.
+
+ ```ts
+ let storage = new LocalStorage();
+ @Entry(storage)
+ @Component
+ struct WidgetCard {
+ @LocalStorageProp('text') text: string = 'Loading...';
+ @LocalStorageProp('loaded') loaded: boolean = false;
+ @LocalStorageProp('imgName') imgName: string = 'name';
+
+ build() {
+ Column() {
+ Text(this.text)
+ .fontSize('12vp')
+ .textAlign(TextAlign.Center)
+ .width('100%')
+ .height('15%')
+
+ Row() {
+ if (this.loaded) {
+ Image('memory://' + this.imgName)
+ .width('50%')
+ .height('50%')
+ .margin('5%')
+ } else {
+ Image('common/start.PNG')
+ .width('50%')
+ .height('50%')
+ .margin('5%')
+ }
+ }.alignItems(VerticalAlign.Center)
+ .justifyContent(FlexAlign.Center)
+
+ Button ('Update')
+ .height('15%')
+ .onClick(() => {
+ postCardAction(this, {
+ 'action': 'message',
+ 'params': {
+ 'info': 'refreshImage'
+ }
+ });
+ })
+ }
+ .width('100%').height('100%')
+ .alignItems(HorizontalAlign.Center)
+ .padding('5%')
+ }
+ }
+ ```
+
+> **NOTE**
+> - The **\** component displays images in the remote memory based on the **memory://** identifier in the input parameter (**memory://fileName**). The value of **fileName** must be consistent with the key in the object (**'formImages': {key: fd}**) passed by the EntryFormAbility.
+>
+> - The **\** component determines whether to update the image by comparing the values of **imgName** consecutively passed by the EntryFormAbility. It updates the image only when the values are different.
diff --git a/en/application-dev/application-models/arkts-ui-widget-interaction-overview.md b/en/application-dev/application-models/arkts-ui-widget-interaction-overview.md
new file mode 100644
index 0000000000000000000000000000000000000000..76c4a202543c00f3df44f71b0a33d417831b5f53
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-interaction-overview.md
@@ -0,0 +1,20 @@
+# Widget Data Interaction
+
+
+The ArkTS widget framework provides the **updateForm()** and **requestForm()** APIs to proactively trigger widget updates.
+
+
+
+
+
+| API| System Capability| Constraints|
+| -------- | -------- | -------- |
+| updateForm | No| 1. Invoked by the provider. 2. Allows only the widget provider to update its own widgets. It cannot be used to update widgets by other providers.|
+| requestForm | Yes| 1. Invoked by the host. 2. Allows only the widget host to update the widgets added to it. It cannot be used to update widgets added to other hosts.|
+
+The following describes the typical use cases of widget updates:
+
+- [Configuring a Widget to Update Periodically](arkts-ui-widget-update-by-time.md)
+- [Updating Local and Online Images](arkts-ui-widget-image-update.md)
+- [Updating Widget Content by State](arkts-ui-widget-update-by-status.md)
+- [Updating Widget Content by Widget Host (for System Applications Only)](arkts-ui-widget-content-update.md)
diff --git a/en/application-dev/application-models/arkts-ui-widget-lifecycle.md b/en/application-dev/application-models/arkts-ui-widget-lifecycle.md
new file mode 100644
index 0000000000000000000000000000000000000000..fb25fd362f67646d65853b870a6a9cb518c4d760
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-lifecycle.md
@@ -0,0 +1,96 @@
+# Widget Lifecycle Management
+
+
+When creating an ArkTS widget, you need to implement the [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md) lifecycle APIs.
+
+
+1. Import related modules to **EntryFormAbility.ts**.
+
+ ```ts
+ import formInfo from '@ohos.app.form.formInfo';
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+ import formProvider from '@ohos.app.form.formProvider';
+ ```
+
+2. In **EntryFormAbility.ts**, implement the [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md) lifecycle APIs, including **onAddForm**, whose **want** parameter can be used to obtain the widget information through [FormParam](../reference/apis/js-apis-app-form-formInfo.md#formparam).
+
+ ```typescript
+ import formInfo from '@ohos.app.form.formInfo';
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+ import formProvider from '@ohos.app.form.formProvider';
+
+ export default class EntryFormAbility extends FormExtensionAbility {
+ onAddForm(want) {
+ console.info('[EntryFormAbility] onAddForm');
+ // Obtain the unique widget ID formId from the want parameter.
+ let formId: string = want.parameters[formInfo.FormParam.IDENTITY_KEY];
+ // Called when the widget is created. The widget provider should return the widget data binding class.
+ let obj = {
+ 'title': 'titleOnAddForm',
+ 'detail': 'detailOnAddForm'
+ };
+ let formData = formBindingData.createFormBindingData(obj);
+ return formData;
+ }
+
+ onCastToNormalForm(formId) {
+ // Called when the form provider is notified that a temporary form is successfully
+ // converted to a normal form.
+ // Called when the widget host converts the temporary widget into a normal one. The widget provider should do something to respond to the conversion.
+ console.info(`[EntryFormAbility] onCastToNormalForm, formId: ${formId}`);
+ }
+
+ onUpdateForm(formId) {
+ // Override this method to support scheduled updates, periodic updates, or updates requested by the widget host.
+ console.info('[EntryFormAbility] onUpdateForm');
+ let obj = {
+ 'title': 'titleOnUpdateForm',
+ 'detail': 'detailOnUpdateForm'
+ };
+ let formData = formBindingData.createFormBindingData(obj);
+ formProvider.updateForm(formId, formData).catch((err) => {
+ if (err) {
+ // Print errors.
+ console.error(`[EntryFormAbility] Failed to updateForm. Code: ${err.code}, message: ${err.message}`);
+ return;
+ }
+ });
+ }
+
+ onChangeFormVisibility(newStatus) {
+ // Called when the form provider receives form events from the system.
+ // The callback is performed only when formVisibleNotify is set to true and the application is a system application.
+ console.info('[EntryFormAbility] onChangeFormVisibility');
+ }
+
+ onFormEvent(formId, message) {
+ // Called when a specified message event defined by the form provider is triggered.
+ // If the widget supports event triggering, override this method and implement the trigger.
+ console.info('[EntryFormAbility] onFormEvent');
+ }
+
+ onRemoveForm(formId) {
+ // Called to notify the form provider that a specified form has been destroyed.
+ // Called when the corresponding widget is deleted. The input parameter is the ID of the deleted card.
+ console.info('[EntryFormAbility] onRemoveForm');
+ }
+
+ onConfigurationUpdate(config) {
+ // Called when the system configuration is updated.
+ console.info('[EntryFormAbility] configurationUpdate:' + JSON.stringify(config));
+ }
+
+ onAcquireFormState(want) {
+ // Called to return a {@link FormState} object.
+ // Called when the widget provider receives the status query result of a widget. By default, the initial state of the widget is returned.
+ return formInfo.FormState.READY;
+ }
+ }
+ ```
+
+
+> **NOTE**
+>
+> The FormExtensionAbility cannot reside in the background. It persists for 5 seconds after the lifecycle callback is completed and exist if no new lifecycle callback is invoked during this time frame. This means that continuous tasks cannot be processed in the widget lifecycle callbacks. For the service logic that may take more than 5 seconds to complete, it is recommended that you [start the application](arkts-ui-widget-event-uiability.md) for processing. After the processing is complete, use [updateForm()](../reference/apis/js-apis-app-form-formProvider.md#updateform) to notify the widget of the update.
diff --git a/en/application-dev/application-models/arkts-ui-widget-modules.md b/en/application-dev/application-models/arkts-ui-widget-modules.md
new file mode 100644
index 0000000000000000000000000000000000000000..b9a411426db84a4c1af12e70eab956adc8f25806
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-modules.md
@@ -0,0 +1,24 @@
+# ArkTS Widget Related Modules
+
+**Figure 1** ArkTS widget related modules
+
+
+
+
+- [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md): provides lifecycle callbacks invoked when a widget is created, destroyed, or updated.
+
+- [FormExtensionContext](../reference/apis/js-apis-inner-application-formExtensionContext.md): provides context for FormExtensionAbilities. You can use the APIs of this module to start FormExtensionAbilities.
+
+- [formProvider](../reference/apis/js-apis-app-form-formProvider.md): provides APIs related to the widget provider. You can use the APIs to update a widget, set the next update time for a widget, obtain widget information, and request a widget release.
+
+- [formInfo](../reference/apis/js-apis-app-form-formInfo.md): provides types and enums related to the widget information and state.
+
+- [formBindingData](../reference/apis/js-apis-app-form-formBindingData.md): provides APIs for widget data binding. You can use the APIs to create a **FormBindingData** object and obtain related information.
+
+- [Page layout (Card.ets)](arkts-ui-widget-page-overview.md): provides APIs for a declarative paradigm UI.
+ - [Capabilities exclusive to ArkTS widgets](arkts-ui-widget-event-overview.md): include the **postCardAction** API used for interaction between the widget internal and the provider application and can be called only in the widget.
+ - [ArkTS widget capability list](arkts-ui-widget-page-overview.md#page-capabilities-supported-by-arkts-widgets): contain the APIs, components, events, attributes, and lifecycle callbacks that can be used in ArkTS widgets.
+
+- [Widget configuration](arkts-ui-widget-configuration.md): includes FormExtensionAbility configuration and widget configuration.
+ - Configure the FormExtensionAbility information under **extensionAbilities** in the [module.json5 file](../quick-start/module-configuration-file.md).
+ - Configure the widget configuration information (**WidgetCard.ets**) in the [form_config.json](arkts-ui-widget-configuration.md) file in **resources/base/profile**.
diff --git a/en/application-dev/application-models/arkts-ui-widget-page-animation.md b/en/application-dev/application-models/arkts-ui-widget-page-animation.md
new file mode 100644
index 0000000000000000000000000000000000000000..0cb8e356c61155d367e55c0f39bbf491d03e2e12
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-page-animation.md
@@ -0,0 +1,41 @@
+# Using Animations in the Widget
+
+
+To make your ArkTS widget more engaging, you can apply animations to it, including [explicit animation](../reference/arkui-ts/ts-explicit-animation.md), [attribute animation](../reference/arkui-ts/ts-animatorproperty.md), and [component transition](../reference/arkui-ts/ts-transition-animation-component.md). Just note the following restrictions when using the animations in ArkTS widgets.
+
+
+**Table 1** Restrictions on animation parameters
+
+| Name| Description| Description|
+| -------- | -------- | -------- |
+| duration | Animation playback duration| The maximum value is 1 second. If a larger value is set, the animation is still played for 1 second.|
+| tempo | Animation playback speed.| Do not set this parameter in the widget. Use the default value 1.|
+| delay | Animation delay duration.| Do not set this parameter in the widget. Use the default value 0.|
+| iterations | Number of times that the animation is played.| Do not set this parameter in the widget. Use the default value 1.|
+
+The following sample code implements the animation effect of button rotation:
+
+
+
+```ts
+@Entry
+@Component
+struct AttrAnimationExample {
+ @State rotateAngle: number = 0;
+
+ build() {
+ Column() {
+ Button('change rotate angle')
+ .onClick(() => {
+ this.rotateAngle = 90;
+ })
+ .margin(50)
+ .rotate({ angle: this.rotateAngle })
+ .animation({
+ curve: Curve.EaseOut,
+ playMode: PlayMode.AlternateReverse
+ })
+ }.width('100%').margin({ top: 20 })
+ }
+}
+```
diff --git a/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md b/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md
new file mode 100644
index 0000000000000000000000000000000000000000..3fb83498972a425ef11821c3292a74bbdb81016d
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md
@@ -0,0 +1,90 @@
+# Applying Custom Drawing in the Widget
+
+
+You can apply custom drawing in your ArkTS widget to create a more vibrant experience. Use the [\