diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/app.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e8cec709e0d0a31a40c8f870d9b17e92799bd9e6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.example.createfloatwindow",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..ff6adcd094eafd145ef5d442b49f30189da17265
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CreateFloatWindow"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/AppScope/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/README.md b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..49a67185d9f7abfd7cd463396049930f02a20f50
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/README.md
@@ -0,0 +1,78 @@
+# CreateFloatWindow简介
+
+### 介绍
+
+全局悬浮窗可以在已有的任务基础上,创建一个始终在前台显示的窗口。即使创建全局悬浮窗的任务退至后台,全局悬浮窗仍然可以在前台显示。通常全局悬浮窗位于所有应用窗口之上,开发者可以创建全局悬浮窗,并对全局悬浮窗进行属性设置等操作。
+
+### 效果预览
+
+
+| 桌面 | 全局悬浮窗 | 交互 |
+|----------------------------------------|----------------------------------------|----------------------------------------|
+|  |  |  |
+
+
+
+### 使用说明
+
+1. 使用时先注释destroyWindow方法
+2. 编译运行生成全局悬浮窗
+3. 点击全局悬浮窗Hello World进行交互
+
+### 工程目录
+
+```
+entry/src/main/ets/
+|---main
+| |---ets
+| | |---entryability
+| | | |---EntryAbility.ets // 创建全局悬浮窗
+| | |---entrybackupability
+| | |---pages
+| | | |---Index.ets // 悬浮窗页面
+| |---resources
+| |---module.json5
+|---ohosTest
+| |---ets
+| | |---test
+| | | |---Ability.test.ets // 自动化测试代码
+```
+
+### 具体实现
+
+创建全局悬浮窗的方法在EntryAbility中实现,源码参考:[EntryAbility.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets)
+
+- 通过window.createWindow接口创建全局悬浮窗类型的窗口;
+- 全局悬浮窗窗口创建成功后,设置大小、位置等相关属性;
+- 通过setUIContent和showWindow接口加载显示全局悬浮窗的具体内容;
+- 当不再需要全局悬浮窗时,使用destroyWindow接口销毁全局悬浮窗。
+
+目标页面在Index中实现,源码参考:[Index.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/pages/Index.ets)
+
+### 相关权限
+
+创建WindowType.TYPE_FLOAT即全局悬浮窗类型的窗口,需要申请ohos.permission.SYSTEM_FLOAT_WINDOW权限,该权限为受控开放权限,仅符合指定场景的在2in1设备上的应用可申请该权限。申请方式请参考:[申请使用受限权限](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/declare-permissions-in-acl)
+
+### 依赖
+
+不涉及
+
+### 约束与限制
+
+1.本示例仅支持标准系统上运行, 支持设备:2in1。
+
+2.本示例为Stage模型,支持API Version 20及以上版本SDK。
+
+3.本示例需要使用DevEco Studio 6.0.0 Release及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateFloatWindow > .git/info/sparse-checkout
+git remote add origin https://gitcode.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..724b825f1ee429691a14b6b6d138c70fd7c56db9
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": "6.0.0(20)",
+ "compatibleSdkVersion": "6.0.0(20)",
+ "targetSdkVersion": "6.0.0(20)",
+ "runtimeOS": "HarmonyOS",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/code-linter.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/code-linter.json5
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9016faf39f8a65cf648bae246a53575510fe8b9f
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/build-profile.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "resOptions": {
+ "copyCodeResource": {
+ "enable": false
+ }
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/obfuscation-rules.txt b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..518efcd23f096b3280bc52c217678064c9eae2b6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start create_float_window]
+import { UIAbility } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+import { BusinessError } from '@kit.BasicServicesKit';
+import hilog from '@ohos.hilog';
+
+const DOMAIN = 0X0000;
+const TAG : string = '[Sample_CreatFloatWindow]';
+
+export default class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ // 1.创建悬浮窗。
+ let windowClass: window.Window | null = null;
+ let config: window.Configuration = {
+ name: 'floatWindow', windowType: window.WindowType.TYPE_FLOAT, ctx: this.context
+ };
+ window.createWindow(config, (err: BusinessError, data) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to create the floatWindow. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in creating the floatWindow. Data: ${JSON.stringify(data)}`);
+ windowClass = data;
+ // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
+ windowClass.moveWindowTo(300, 300, (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to move the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in moving the window.`);
+ });
+ windowClass.resize(500, 500, (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to change the window size. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in changing the window size.`);
+ });
+ // 3.为悬浮窗加载对应的目标页面。
+ windowClass.setUIContent('pages/page4', (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to load the content. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in loading the content.`);
+ // 3.显示悬浮窗。
+ (windowClass as window.Window).showWindow((err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to show the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in showing the window.`);
+ });
+ });
+ // 4.销毁悬浮窗。当不再需要悬浮窗时,可根据具体实现逻辑,使用destroy对其进行销毁。
+ windowClass.destroyWindow((err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to destroy the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in destroying the window.`);
+ });
+ });
+ }
+};
+// [End create_float_window]
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+const DOMAIN = 0x0000;
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(DOMAIN, 'testTag', 'onBackup ok');
+ await Promise.resolve();
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ await Promise.resolve();
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/pages/Index.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..64ca99781cb5c3e261ecdd74d316c6fa7cec67e4
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World';
+
+ build() {
+ RelativeContainer() {
+ Text(this.message)
+ .id('HelloWorld')
+ .fontSize($r('app.float.page_text_font_size'))
+ .fontWeight(FontWeight.Bold)
+ .alignRules({
+ center: { anchor: '__container__', align: VerticalAlign.Center },
+ middle: { anchor: '__container__', align: HorizontalAlign.Center }
+ })
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e17592e988d38312c097e2f86f168fd81005a5c3
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/module.json5
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "ohos.want.action.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ],
+ "requestPermissions":[
+ {
+ "name" : "ohos.permission.SYSTEM_FLOAT_WINDOW",
+ // "reason": "$string:reason",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when":"inuse"
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/color.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/float.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/startIcon.png b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/profile/backup_config.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/dark/element/color.json b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/mock/mock-config.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..323d1d611fecf4ecb751976e3a71500b3712a445
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/mock/mock-config.json5
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e8b4934f00bb1201169a00411aa5a84ee93f74f7
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+import { describe, it, expect } from '@ohos/hypium';
+import { Driver, ON } from '@kit.TestKit';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+const TAG = '[Sample_CreatFloatWindow]';
+const DOMAIN = 0xFF00
+const BUNDLE = 'CreatFloatWindow_';
+
+export default function abilityTest() {
+
+ describe('EntryAbilityTest', () => {
+ /**
+ * 打开应用
+ */
+ it(BUNDLE + 'StartAbility_001', 0, async (done: Function) => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "StartAbility_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.createfloatwindow',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `StartAbility_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ done();
+ hilog.info(DOMAIN, TAG, BUNDLE + 'StartAbility_001 end');
+ })
+
+ /**
+ * 点击Hello World
+ */
+ it (BUNDLE + 'ClickHelloWorld_001', 2, async () => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "ClickHelloWorld_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.createfloatwindow',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `ClickHelloWorld_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ let clickBtn = await driver.findComponent(ON.text('Hello World'));
+ await clickBtn.click();
+ await driver.delayMs(1000);
+
+
+ hilog.info(DOMAIN, TAG, BUNDLE + `ClickHelloWorld_001 end`);
+ })
+
+ })
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/ets/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c64e0b06938d246ce044186d4b2d02b500a89e14
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..240f81ea64618a21c3bc0ed8fb18368cf3204876
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/ohosTest/module.json5
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "phone",
+ "tablet",
+ "2in1",
+ "car",
+ "wearable",
+ "tv"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a60c87c5cbb0badf7c3fd8975034590e6fafa992
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/test/LocalUnit.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..841bfd77e56060e50ec0924302a5ae624e76e3aa
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/hvigor/hvigor-config.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3b057578a1bb4d591ee53054e39ab0154fc2e43a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae9086af35844176c08f1be3772d081d95d267c6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..837c0ff9f35a6bb9eea849fead7955c19bcdec8d
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.24",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/ohosTest.md b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..2e6eabe83c3a322fc02b01e2de4d53adb9eeb7d7
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/ohosTest.md
@@ -0,0 +1,7 @@
+# createFloatWindow示例测试用例归档
+## 用例表
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+|---------| --- |----------------------|-----------| --- |------|
+| 拉起应用 |设备正常运行| | 成功拉起应用 | 是 | Pass |
+| 创建全局悬浮窗 |设备正常运行| | 成功创建全局悬浮窗 | 是 | Pass |
+| 点击交互 |设备正常运行| | 页面变化 | 是 | Pass |
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/1.gif b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..d9d5c85fb2977062791ffdbe215a90a089ecef33
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/1.gif differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_1.jpg b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..5394b404713a2e600e38d688c774293bb25ec065
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_1.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_2.jpg b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..8f7bea55cc697dc79dfeefda76e759c18cfd1115
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_2.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_3.jpg b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_3.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..4ec708300678de5b9eadb76df5b06ad455cdb9e8
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/screenshots/screenshot_3.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/app.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c72e4e19d94d0fe5aeeabc06a48738ef44a9be2e
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.example.createsubwindow",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f2e816099fce56b5bc8cd85304c46c5867df9bb9
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CreateSubWindow"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/AppScope/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/README.md b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..a90fb47085313614ec526d4ac58eb2b241dd8f51
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/README.md
@@ -0,0 +1,76 @@
+# CreateSubWindow简介
+
+### 介绍
+
+创建应用子窗口是通过createSubWindow接口实现。子窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置窗口背景色、亮度等属性。
+
+### 效果预览
+
+| 桌面 | 子窗口 | 交互 |
+|----------------------------------------|----------------------------------------|----------------------------------------|
+|  |  |  |
+
+### 使用说明
+
+1. 通过CreateSubWind接口创建子窗口。
+2. 子窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置窗口背景色、亮度等属性。
+3. 通过setUIContent接口为子窗口加载对应的页面,showWindow接口显示子窗口。
+4. 通过destroyWindow接口销毁子窗。
+
+### 工程目录
+
+```
+entry/src/main/ets/
+|---main
+| |---ets
+| | |---entryability
+| | | |---EntryAbility.ets // 创建子窗口
+| | |---entrybackupability
+| | |---pages
+| | | |---Index.ets // 子窗口页面
+| |---resources
+| |---module.json5
+|---ohosTest
+| |---ets
+| | |---test
+| | | |---Ability.test.ets // 自动化测试代码
+```
+### 具体实现
+
+创建子窗口的方法在EntryAbility中,源码参考:[EntryAbility.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/entryability/EntryAbility.ets)
+
+- 使用createSubWindow创建应用子窗口;
+- 使用moveWindowTo设置子窗口的位置、大小及相关属性等;
+- 使用setUIContent为子窗口加载对应的页面;
+- 使用showWindow方法显示子窗口
+- 当不再需要子窗口时,可使用destroy对其进行销毁。
+
+子窗口加载的页面在Index中实现,源码参考:[Index.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/pages/Index.ets)
+
+### 相关权限
+
+不涉及
+
+### 依赖
+
+不涉及
+
+### 约束与限制
+
+1.本示例仅支持标准系统上运行, 支持设备:华为手机、平板。
+
+2.本示例为Stage模型,支持API Version 20及以上版本SDK。
+
+3.本示例需要使用DevEco Studio 6.0.0 Release及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateSubWindow > .git/info/sparse-checkout
+git remote add origin https://gitcode.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..724b825f1ee429691a14b6b6d138c70fd7c56db9
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": "6.0.0(20)",
+ "compatibleSdkVersion": "6.0.0(20)",
+ "targetSdkVersion": "6.0.0(20)",
+ "runtimeOS": "HarmonyOS",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/code-linter.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/code-linter.json5
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9016faf39f8a65cf648bae246a53575510fe8b9f
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/build-profile.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "resOptions": {
+ "copyCodeResource": {
+ "enable": false
+ }
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/obfuscation-rules.txt b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0125d07cb7e0e8a2bf6f58d2179a61031b90faa5
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start create_sub_window]
+import { UIAbility } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+import { BusinessError } from '@kit.BasicServicesKit';
+import hilog from '@ohos.hilog';
+
+const DOMAIN = 0X0000;
+const TAG : string = '[Sample_CreatSubWindow]';
+
+let windowStage_: window.WindowStage | null = null;
+let sub_windowClass: window.Window | null = null;
+
+export default class EntryAbility extends UIAbility {
+ showSubWindow() {
+ // 1.创建应用子窗口。
+ if (windowStage_ == null) {
+ hilog.error(DOMAIN, TAG, `Failed to create the subwindow. Cause: windowStage_ is null`);
+ } else {
+ windowStage_.createSubWindow('mySubWindow', (err: BusinessError, data) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to create the subwindow. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ sub_windowClass = data;
+ if (!sub_windowClass) {
+ hilog.error(DOMAIN, TAG, `sub_windowClass is null`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in creating the subwindow. Data: ${JSON.stringify(data)}`);
+ // 2.子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
+ sub_windowClass.moveWindowTo(300, 300, (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to move the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in moving the window.`);
+ });
+ sub_windowClass.resize(500, 500, (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to change the window size. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in changing the window size.`);
+ });
+ // 3.为子窗口加载对应的目标页面。
+ sub_windowClass.setUIContent('pages/Index', (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.info(DOMAIN, TAG, `Failed to load the content. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in loading the content.`);
+ if (!sub_windowClass) {
+ hilog.error(DOMAIN, TAG, `sub_windowClass is null`);
+ return;
+ }
+ // 3.显示子窗口。
+ sub_windowClass.showWindow((err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to show the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in showing the window.`);
+ });
+ });
+ })
+ }
+ }
+
+ destroySubWindow() {
+ if (!sub_windowClass) {
+ hilog.error(DOMAIN, TAG, `sub_windowClass is null`);
+ return;
+ }
+ // 4.销毁子窗口。当不再需要子窗口时,可根据具体实现逻辑,使用destroy对其进行销毁。
+ sub_windowClass.destroyWindow((err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to destroy the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in destroying the window.`);
+ });
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ windowStage_ = windowStage;
+ // 开发者可以在适当的时机,如主窗口上按钮点击事件等,创建子窗口。并不一定需要在onWindowStageCreate调用,这里仅作展示
+ this.showSubWindow();
+ }
+
+ onWindowStageDestroy() {
+ // 开发者可以在适当的时机,如子窗口上点击关闭按钮等,销毁子窗口。并不一定需要在onWindowStageDestroy调用,这里仅作展示
+ this.destroySubWindow();
+ }
+};
+// [End create_sub_window]
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+const DOMAIN = 0x0000;
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(DOMAIN, 'testTag', 'onBackup ok');
+ await Promise.resolve();
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ await Promise.resolve();
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/pages/Index.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..64ca99781cb5c3e261ecdd74d316c6fa7cec67e4
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World';
+
+ build() {
+ RelativeContainer() {
+ Text(this.message)
+ .id('HelloWorld')
+ .fontSize($r('app.float.page_text_font_size'))
+ .fontWeight(FontWeight.Bold)
+ .alignRules({
+ center: { anchor: '__container__', align: VerticalAlign.Center },
+ middle: { anchor: '__container__', align: HorizontalAlign.Center }
+ })
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b97e860de808ae4e85362dc1ab044800f9d27836
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/module.json5
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "ohos.want.action.home"
+ ]
+ }
+ ],
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/color.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/float.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/startIcon.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/profile/backup_config.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/dark/element/color.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/mock/mock-config.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..323d1d611fecf4ecb751976e3a71500b3712a445
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/mock/mock-config.json5
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b58487644ada0400abc8db07df28b177104c686d
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+import { describe, it, expect } from '@ohos/hypium';
+import { Driver, ON } from '@kit.TestKit';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+const TAG = '[Sample_CreatSubWindow]';
+const DOMAIN = 0xFF00
+const BUNDLE = 'CreatSubWindow_';
+
+export default function abilityTest() {
+
+ describe('EntryAbilityTest', () => {
+ /**
+ * 打开应用
+ */
+ it(BUNDLE + 'StartAbility_001', 0, async (done: Function) => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "StartAbility_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.createsubwindow',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `StartAbility_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello Page3'));
+ done();
+ hilog.info(DOMAIN, TAG, BUNDLE + 'StartAbility_001 end')
+ })
+
+ /**
+ * 点击Hello Window,与主窗交互
+ */
+ it (BUNDLE + 'CreateWindow_001', 2, async () => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "CreateWindow_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.createsubwindow',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `CreateWindow_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ let clickBtn = await driver.findComponent(ON.text('Hello World'));
+ await clickBtn.click();
+ await driver.delayMs(1000);
+
+
+ hilog.info(DOMAIN, TAG, BUNDLE + `Hello World_001 end`);
+ })
+
+ })
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/ets/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c64e0b06938d246ce044186d4b2d02b500a89e14
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1cafc28b86d7d9f2b34f24d26a75c0dbd7299715
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/ohosTest/module.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a60c87c5cbb0badf7c3fd8975034590e6fafa992
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/test/LocalUnit.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..841bfd77e56060e50ec0924302a5ae624e76e3aa
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/hvigor/hvigor-config.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3b057578a1bb4d591ee53054e39ab0154fc2e43a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae9086af35844176c08f1be3772d081d95d267c6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..837c0ff9f35a6bb9eea849fead7955c19bcdec8d
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.24",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/ohosTest.md b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..29820d06f6ad6a65dcb4de3e6d804fc1637985c3
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/ohosTest.md
@@ -0,0 +1,7 @@
+# CreateSubWindow示例1测试用例归档
+## 用例表
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+|------| --- |----------------------|--------| --- |------|
+| 拉起应用 |设备正常运行| | 成功拉起应用 | 是 | Pass |
+| 创建子窗 |设备正常运行| | 成功创建子窗 | 是 | Pass |
+| 点击交互 |设备正常运行| | 页面变化 | 是 | Pass |
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_1.jpg b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..fac388a324d2d5fbc88b35635ca0cfce33a7e9a7
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_1.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_2.jpg b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..23b8cc8b0106d0288a88d74355e46970a49c6bcf
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_2.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_3.jpg b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_3.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..52bafd106c4d392b1ea4183dd491971c3c7af6c8
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/screenshots/screenshot_3.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/app.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..2178794c4234a2d597d4eb9077f799669eb9df14
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.example.createsubwindow2",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..8487354fba2af38a59e6ca7bdc7c2227449e3fe1
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CreateSubWindow2"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/AppScope/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/README.md b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..44401b9d7c3cec5d862274c7e220d7cfe6afeca8
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/README.md
@@ -0,0 +1,77 @@
+# CreateSubWindow2简介
+
+### 介绍
+
+创建应用子窗口是通过createSubWindow接口实现。子窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置窗口背景色、亮度等属性。
+
+### 效果预览
+
+| 桌面 |主窗口|子窗口|
+|---------------------------------------|--------------------------------|--------------------------------|
+||||
+
+### 使用说明
+
+1. 通过CreateSubWind接口创建子窗口。
+2. 子窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置窗口背景色、亮度等属性。
+3. 通过setUIContent接口为子窗口加载对应的页面,showWindow接口显示子窗口。
+4. 通过destroyWindow接口销毁子窗。
+
+### 工程目录
+
+```
+entry/src/main/ets/
+|---main
+| |---ets
+| | |---entryability
+| | | |---EntryAbility.ets // 创建主窗口
+| | |---entrybackupability
+| | |---pages
+| | | |---Index.ets // 主窗口页面
+| | | |---SubWindow.ets // 子窗口页面
+| |---resources
+| |---module.json5
+|---ohosTest
+| |---ets
+| | |---test
+| | | |---Ability.test.ets // 自动化测试代码
+```
+### 具体实现
+
+创建子窗口的方法在Index中实现,源码参考:[Index.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/Index.ets)
+
+- 使用createSubWindow创建应用子窗口;
+- 使用moveWindowTo设置子窗口的位置、大小及相关属性等;
+- 使用setUIContent为子窗口加载对应的页面;
+- 使用showWindow方法显示子窗口
+- 当不再需要子窗口时,可使用destroy对其进行销毁。
+
+子窗口加载的页面在SubWindow中实现,源码参考:[SubWindow.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/Index.ets)
+
+### 相关权限
+
+不涉及
+
+### 依赖
+
+不涉及
+
+### 约束与限制
+
+1.本示例仅支持标准系统上运行, 支持设备:华为手机、平板。
+
+2.本示例为Stage模型,支持API Version 20及以上版本SDK。
+
+3.本示例需要使用DevEco Studio 6.0.0 Release及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/ArkUISample/ArkUIWindowSamples/CreateSubWindow2 > .git/info/sparse-checkout
+git remote add origin https://gitcode.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..724b825f1ee429691a14b6b6d138c70fd7c56db9
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": "6.0.0(20)",
+ "compatibleSdkVersion": "6.0.0(20)",
+ "targetSdkVersion": "6.0.0(20)",
+ "runtimeOS": "HarmonyOS",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/code-linter.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/code-linter.json5
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9016faf39f8a65cf648bae246a53575510fe8b9f
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/build-profile.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "resOptions": {
+ "copyCodeResource": {
+ "enable": false
+ }
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/obfuscation-rules.txt b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..95c4d26864ef6f5521ff9a5ff00a218d5a85b9cd
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start create_sub_window2_entryability]
+// EntryAbility.ets
+import { UIAbility } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+import hilog from '@ohos.hilog';
+
+const DOMAIN = 0X0000;
+const TAG : string = '[Sample_CreatSubWindow2]';
+
+export default class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(DOMAIN, TAG, `Failed to load the content. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in loading the content.`);
+ });
+
+ // 给Index页面传递windowStage
+ AppStorage.setOrCreate('windowStage', windowStage);
+ }
+}
+// [End create_sub_window2_entryability]
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+const DOMAIN = 0x0000;
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(DOMAIN, 'testTag', 'onBackup ok');
+ await Promise.resolve();
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ await Promise.resolve();
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/Index.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7e1b4dda122226d3da078d399d6268402a318a7
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start create_sub_window2_index]
+// Index.ets
+import { window } from '@kit.ArkUI';
+import { BusinessError } from '@kit.BasicServicesKit';
+import hilog from '@ohos.hilog';
+
+const DOMAIN = 0X0000;
+const TAG : string = '[Sample_CreatSubWindow2]';
+
+let windowStage_: window.WindowStage | undefined = undefined;
+let sub_windowClass: window.Window | undefined = undefined;
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World';
+ private createSubWindow(){
+ // 获取windowStage
+ windowStage_ = AppStorage.get('windowStage');
+ // 1.创建应用子窗口。
+ if (windowStage_ == null) {
+ hilog.error(DOMAIN, TAG, `Failed to create the subwindow. Cause: windowStage_ is null`);
+ } else {
+ windowStage_.createSubWindow('mySubWindow', (err: BusinessError, data) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to create the subwindow. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ sub_windowClass = data;
+ if (!sub_windowClass) {
+ hilog.error(DOMAIN, TAG, `sub_windowClass is null`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in creating the subwindow. Data: ${JSON.stringify(data)}`);
+ // 2.子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
+ sub_windowClass.moveWindowTo(300, 300, (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to move the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in moving the window.`);
+ });
+ sub_windowClass.resize(500, 500, (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to change the window size. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in changing the window size.`);
+ });
+ // 3.为子窗口加载对应的目标页面。
+ sub_windowClass.setUIContent('pages/SubWindow', (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to load the content. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in loading the content.`);
+ if (!sub_windowClass) {
+ hilog.error(DOMAIN, TAG, `sub_windowClass is null`);
+ return;
+ }
+ // 3.显示子窗口。
+ sub_windowClass.showWindow((err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to show the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in showing the window.`);
+ });
+ });
+ })
+ }
+ }
+ private destroySubWindow(){
+ if (!sub_windowClass) {
+ hilog.error(DOMAIN, TAG, `sub_windowClass is null`);
+ return;
+ }
+ // 4.销毁子窗口。当不再需要子窗口时,可根据具体实现逻辑,使用destroy对其进行销毁。
+ sub_windowClass.destroyWindow((err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to destroy the window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in destroying the window.`);
+ });
+ }
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button(){
+ Text('CreateSubWindow')
+ .fontSize(24)
+ .fontWeight(FontWeight.Normal)
+ }.width(220).height(68)
+ .margin({left:10, top:60})
+ .onClick(() => {
+ this.createSubWindow()
+ })
+ Button(){
+ Text('destroySubWindow')
+ .fontSize(24)
+ .fontWeight(FontWeight.Normal)
+ }.width(220).height(68)
+ .margin({left:10, top:60})
+ .onClick(() => {
+ this.destroySubWindow()
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+// [End create_sub_window2_index]
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/SubWindow.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/SubWindow.ets
new file mode 100644
index 0000000000000000000000000000000000000000..91a56759bcc6824a54c5cb9e92bda13f02c69515
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/ets/pages/SubWindow.ets
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start create_sub_window2_subwindow]
+// subWindow.ets
+@Entry
+@Component
+struct SubWindow {
+ @State message: string = 'Hello subWindow';
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ .backgroundColor('#0D9FFB')
+ }
+}
+// [End create_sub_window2_subwindow]
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/module.json5
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "ohos.want.action.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/color.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/float.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/startIcon.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/profile/backup_config.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..de4d20e93eac3f6acc0d9de214c54c76af98f568
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,6 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/SubWindow"
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/dark/element/color.json b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/mock/mock-config.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..323d1d611fecf4ecb751976e3a71500b3712a445
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/mock/mock-config.json5
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3a65179b64b47e1f11f5461e12e2342bde68ae8a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+import { describe, it, expect } from '@ohos/hypium';
+import { Driver, ON } from '@kit.TestKit';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+const TAG = '[Sample_CreatSubWindow2]';
+const DOMAIN = 0xFF00
+const BUNDLE = 'CreatSubWindow2_';
+
+export default function abilityTest() {
+
+ describe('EntryAbilityTest', () => {
+ /**
+ * 打开应用
+ */
+ it(BUNDLE + 'StartAbility_001', 0, async (done: Function) => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "StartAbility_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.createsubwindow2',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `StartAbility_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ done();
+ hilog.info(DOMAIN, TAG, BUNDLE + 'StartAbility_001 end');
+ })
+
+ /**
+ * 点击CreateSubWindow按钮,生成子窗
+ */
+ it (BUNDLE + 'CreateSubWindow_001', 2, async () => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "CreateSubWindow_001, begin")
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.createsubwindow2',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `CreateSubWindow_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('CreateSubWindow'));
+ let clickBtn = await driver.findComponent(ON.text('CreateSubWindow'));
+ await clickBtn.click();
+ await driver.delayMs(1000);
+
+ await driver.assertComponentExist(ON.text('destroySubWindow'));
+ clickBtn = await driver.findComponent(ON.text('destroySubWindow'));
+ await clickBtn.click();
+ await driver.delayMs(1000);
+
+ hilog.info(DOMAIN, TAG, BUNDLE + `CreateSubWindow_001 end`);
+ })
+ })
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/ets/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c64e0b06938d246ce044186d4b2d02b500a89e14
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1cafc28b86d7d9f2b34f24d26a75c0dbd7299715
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/ohosTest/module.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a60c87c5cbb0badf7c3fd8975034590e6fafa992
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/test/LocalUnit.test.ets b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..841bfd77e56060e50ec0924302a5ae624e76e3aa
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/hvigor/hvigor-config.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3b057578a1bb4d591ee53054e39ab0154fc2e43a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae9086af35844176c08f1be3772d081d95d267c6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..837c0ff9f35a6bb9eea849fead7955c19bcdec8d
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.24",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/ohosTest.md b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..fc9aadd0dc72566c8c571e963aaa86cfaae0a86e
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/ohosTest.md
@@ -0,0 +1,7 @@
+# createSubWindow示例2测试用例归档
+## 用例表
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+|------| --- |----------------------|--------| --- |------|
+| 拉起应用 |设备正常运行| | 成功拉起应用 | 是 | Pass |
+| 创建子窗 |设备正常运行| 点击【CreateSubWindow】 | 成功创建子窗 | 是 | Pass |
+| 销毁子窗 |设备正常运行| 点击【destroySubWindow】 | 成功销毁子窗 | 是 | Pass |
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_1.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_1.png
new file mode 100644
index 0000000000000000000000000000000000000000..fac388a324d2d5fbc88b35635ca0cfce33a7e9a7
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_1.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_2.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_2.png
new file mode 100644
index 0000000000000000000000000000000000000000..96e22d590b31961a5828044b1888cea5e2e0978a
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_2.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_3.png b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_3.png
new file mode 100644
index 0000000000000000000000000000000000000000..03635f405faa1a137d0d1afff73dc54b9955e5e4
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/screenshots/screenshot_3.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/app.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1d9f76bce2f61afc2960959c85b7866288e134a2
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.example.listenwindowstage",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6e0b7df5a6e6f7a161458c9b0fedb070acb6c687
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ListenWindowStage"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/AppScope/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/README.md b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..9dafca316a4130d4f95bd136417a73f3d44eac5b
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/README.md
@@ -0,0 +1,72 @@
+# ListenWindowStage简介
+
+### 介绍
+
+应用在前台显示过程中可能会进入某些不可交互的场景,对于一些应用可能需要选择暂停某个与用户正在交互的业务。当该应用从多任务又切回前台时,又变成了可交互的状态,此时需要恢复被暂停中断的业务。
+
+### 效果预览
+
+| 桌面 | 主窗口 | 交互 |
+|----------------------------------------|----------------------------------------|----------------------------------------|
+|  |  |  |
+
+### 使用说明
+
+1. 通过loadContent接口加载主窗口的目标页面。
+2. 与页面进行交互
+
+### 工程目录
+
+
+```
+entry/src/main/ets/
+|---main
+| |---ets
+| | |---entryability
+| | | |---EntryAbility.ets // 创建主窗口
+| | |---entrybackupability
+| | |---pages
+| | | |---Index.ets // 主窗口页面
+| |---resources
+| |---module.json5
+|---ohosTest
+| |---ets
+| | |---test
+| | | |---Ability.test.ets // 自动化测试代码
+```
+### 具体实现
+
+创建子窗口的方法在EntryAbility中,源码参考:[EntryAbility.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/entryability/EntryAbility.ets)
+
+- 使用loadContent为当前主窗加载页面;
+- 使用on()接口监听当前的页面状态。
+
+主窗口加载的页面在Index中实现,源码参考:[Index.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/pages/Index.ets)
+
+### 相关权限
+
+不涉及
+
+### 依赖
+
+不涉及
+
+### 约束与限制
+
+1.本示例仅支持标准系统上运行, 支持设备:华为手机、平板。
+
+2.本示例为Stage模型,支持API Version 20及以上版本SDK。
+
+3.本示例需要使用DevEco Studio 6.0.0 Release及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/ArkUISample/ArkUIWindowSamples/ListenWindowStage > .git/info/sparse-checkout
+git remote add origin https://gitcode.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..724b825f1ee429691a14b6b6d138c70fd7c56db9
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": "6.0.0(20)",
+ "compatibleSdkVersion": "6.0.0(20)",
+ "targetSdkVersion": "6.0.0(20)",
+ "runtimeOS": "HarmonyOS",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/code-linter.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/code-linter.json5
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9016faf39f8a65cf648bae246a53575510fe8b9f
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/build-profile.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "resOptions": {
+ "copyCodeResource": {
+ "enable": false
+ }
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/obfuscation-rules.txt b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7157bdec7e7b8b8bf5e6ac201ab2d17bbae41fe9
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start listen_window_stage]
+import { UIAbility } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+import hilog from '@ohos.hilog';
+
+const DOMAIN = 0X0000;
+const TAG : string = '[Sample_ListenWindowStage]';
+
+export default class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ // [StartExclude listen_window_stage]
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(DOMAIN, TAG, `Failed to load the content. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in loading the content.`);
+ })
+ // [EndExclude listen_window_stage]
+ try {
+ windowStage.on('windowStageEvent', (data) => {
+ hilog.info(DOMAIN, TAG, `Succeeded in enabling the listener for window stage event changes. Data: ${JSON.stringify(data)}`);
+
+ // 根据事件状态类型选择进行相应的处理
+ if (data === window.WindowStageEventType.SHOWN) {
+ hilog.info(DOMAIN, TAG, `current window stage event is SHOWN`);
+ // 应用进入前台,默认为可交互状态
+ // ...
+ } else if (data === window.WindowStageEventType.HIDDEN) {
+ hilog.info(DOMAIN, TAG, `current window stage event is HIDDEN`);
+ // 应用进入后台,默认为不可交互状态
+ // ...
+ } else if (data === window.WindowStageEventType.PAUSED) {
+ hilog.info(DOMAIN, TAG, `current window stage event is PAUSED`);
+ // 前台应用进入多任务,转为不可交互状态
+ // ...
+ } else if (data === window.WindowStageEventType.RESUMED) {
+ hilog.info(DOMAIN, TAG, `current window stage event is RESUMED`);
+ // 进入多任务后又继续返回前台时,恢复可交互状态
+ // ...
+ }
+
+ // ...
+ });
+ } catch (exception) {
+ hilog.error(DOMAIN, TAG, `Failed to enable the listener for window stage event changes. Cause: ${JSON.stringify(exception)}`);
+ }
+ }
+}
+// [End listen_window_stage]
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+const DOMAIN = 0x0000;
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(DOMAIN, 'testTag', 'onBackup ok');
+ await Promise.resolve();
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ await Promise.resolve();
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/pages/Index.ets b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..64ca99781cb5c3e261ecdd74d316c6fa7cec67e4
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World';
+
+ build() {
+ RelativeContainer() {
+ Text(this.message)
+ .id('HelloWorld')
+ .fontSize($r('app.float.page_text_font_size'))
+ .fontWeight(FontWeight.Bold)
+ .alignRules({
+ center: { anchor: '__container__', align: VerticalAlign.Center },
+ middle: { anchor: '__container__', align: HorizontalAlign.Center }
+ })
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/module.json5
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "ohos.want.action.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/color.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/float.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/startIcon.png b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/profile/backup_config.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/dark/element/color.json b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/mock/mock-config.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..323d1d611fecf4ecb751976e3a71500b3712a445
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/mock/mock-config.json5
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a08a520439710f6d188417c4338b79057886f3bc
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+import { describe, it, expect } from '@ohos/hypium';
+import { Driver, ON } from '@kit.TestKit';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+const TAG = '[Sample_ListenWindowStage]';
+const DOMAIN = 0xFF00
+const BUNDLE = 'ListenWindowStage_';
+
+export default function abilityTest() {
+
+ describe('EntryAbilityTest', () => {
+ /**
+ * 打开应用
+ */
+ it(BUNDLE + 'StartAbility_001', 0, async (done: Function) => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "StartAbility_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.listenwindowstage',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `StartAbility_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ done();
+ hilog.info(DOMAIN, TAG, BUNDLE + 'StartAbility_001 end');
+ })
+
+ /**
+ * 交互
+ */
+ it (BUNDLE + 'ListenWindowStage_001', 2, async () => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "ListenWindowStage_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.listenwindowstage',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `ListenWindowStage_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ let clickBtn = await driver.findComponent(ON.text('Hello World'));
+ await clickBtn.click();
+ await driver.delayMs(1000);
+
+
+ hilog.info(DOMAIN, TAG, BUNDLE + `Hello World_001 end`);
+ })
+
+ })
+}
+
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/ets/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c64e0b06938d246ce044186d4b2d02b500a89e14
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/module.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1cafc28b86d7d9f2b34f24d26a75c0dbd7299715
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/ohosTest/module.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a60c87c5cbb0badf7c3fd8975034590e6fafa992
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/test/LocalUnit.test.ets b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..841bfd77e56060e50ec0924302a5ae624e76e3aa
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/hvigor/hvigor-config.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3b057578a1bb4d591ee53054e39ab0154fc2e43a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae9086af35844176c08f1be3772d081d95d267c6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..837c0ff9f35a6bb9eea849fead7955c19bcdec8d
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.24",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/ohosTest.md b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..c3a6a2f6fd8afdfa575c24edbf1aee3bb67bdf6c
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/ohosTest.md
@@ -0,0 +1,7 @@
+# ListenWindowStage示例测试用例归档
+## 用例表
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+|------| --- |----------------------|--------| --- |------|
+| 拉起应用 |设备正常运行| | 成功拉起应用 | 是 | Pass |
+| 创建主窗 |设备正常运行| | 成功创建主窗 | 是 | Pass |
+| 点击交互 |设备正常运行| | 页面变化 | 是 | Pass |
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_1.jpg b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..4eaa273dbea71b2581941dc10f3d84344c928989
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_1.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_2.jpg b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..caf72fbf5556b13a4f4c850b4c648351983db426
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_2.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_3.jpg b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_3.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..e02a07afe70db98eacf7724c4df810b6091b3908
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/screenshots/screenshot_3.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/app.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3a95c31969041da684d14d59e463f85c6191c389
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.example.setwindowsystembarenable",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..cdd5bb07114b1edd1426d02689679804a0df4d47
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "SetWindowSystemBarEnable"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/AppScope/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/README.md b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..d254b988124ca84e3b241bfa2d5a661fdef57632
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/README.md
@@ -0,0 +1,72 @@
+# SetWindowSystemBarEnable简介
+
+### 介绍
+
+在看视频、玩游戏等场景下,用户往往希望隐藏状态栏、导航栏等不必要的系统窗口,从而获得更佳的沉浸式体验。此时可以借助窗口沉浸式能力(窗口沉浸式能力都是针对应用主窗口而言的),达到预期效果。
+
+### 效果预览
+
+| 桌面 | 主窗口 | 交互 |
+|----------------------------------------|----------------------------------------|----------------------------------------|
+|  |  |  |
+
+### 使用说明
+
+1. 点击页面交互
+
+### 工程目录
+
+```
+entry/src/main/ets/
+|---main
+| |---ets
+| | |---entryability
+| | | |---EntryAbility.ets // 创建主窗口
+| | |---entrybackupability
+| | |---pages
+| | | |---Index.ets // 主窗口页面
+| |---resources
+| |---module.json5
+|---ohosTest
+| |---ets
+| | |---test
+| | | |---Ability.test.ets // 自动化测试代码
+```
+
+### 具体实现
+
+设置窗口沉浸式的方法在EntryAbility中,源码参考:[EntryAbility.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/entryability/EntryAbility.ets)
+
+- 使用getMainWindow获取到主窗口;
+- 使用setWindowSystemBarEnable设置导航栏、状态栏不显示;
+- 使用setWindowLayoutFullScreen设置窗口为全屏布局,配合设置导航栏、状态栏的透明度、背景/文字颜色及高亮图标等属性。
+
+主窗口加载的页面在Index中实现,源码参考:[Index.ets](https://gitcode.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkUISample/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/pages/Index.ets)
+
+### 相关权限
+
+不涉及
+
+### 依赖
+
+不涉及
+
+### 约束与限制
+
+1.本示例仅支持标准系统上运行, 支持设备:华为手机、平板。
+
+2.本示例为Stage模型,支持API Version 20及以上版本SDK。
+
+3.本示例需要使用DevEco Studio 6.0.0 Release及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/ArkUISample/ArkUIWindowSamples/SetWindowSystemBarEnable > .git/info/sparse-checkout
+git remote add origin https://gitcode.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..724b825f1ee429691a14b6b6d138c70fd7c56db9
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": "6.0.0(20)",
+ "compatibleSdkVersion": "6.0.0(20)",
+ "targetSdkVersion": "6.0.0(20)",
+ "runtimeOS": "HarmonyOS",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/code-linter.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/code-linter.json5
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/build-profile.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9016faf39f8a65cf648bae246a53575510fe8b9f
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/build-profile.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "resOptions": {
+ "copyCodeResource": {
+ "enable": false
+ }
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/obfuscation-rules.txt b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..096e2251b47333541c6cd1853fa4ba3c7893a0bc
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start set_window_system_bar_enable]
+import { UIAbility } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+import { BusinessError } from '@kit.BasicServicesKit';
+import hilog from '@ohos.hilog';
+
+const DOMAIN = 0X0000;
+const TAG : string = '[Sample_SetWindowSystemBarEnable]';
+
+export default class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ // 1.获取应用主窗口。
+ let windowClass: window.Window | null = null;
+ windowStage.getMainWindow((err: BusinessError, data) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to obtain the main window. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ windowClass = data;
+ hilog.info(DOMAIN, TAG, `Succeeded in obtaining the main window. Data: ${JSON.stringify(data)}`);
+
+ // 2.实现沉浸式效果。方式一:设置导航栏、状态栏不显示。
+ let names: 'status'[] | 'navigation'[] = [];
+ windowClass.setWindowSystemBarEnable(names)
+ .then(() => {
+ hilog.info(DOMAIN, TAG, `Succeeded in setting the system bar to be visible.`);
+ })
+ .catch((err: BusinessError) => {
+ hilog.error(DOMAIN, TAG, `Failed to set the system bar to be visible. Cause: ${JSON.stringify(err)}`);
+ });
+ // 2.实现沉浸式效果。方式二:设置窗口为全屏布局,配合设置导航栏、状态栏的透明度、背景/文字颜色及高亮图标等属性,与主窗口显示保持协调一致。
+ let isLayoutFullScreen = true;
+ windowClass.setWindowLayoutFullScreen(isLayoutFullScreen)
+ .then(() => {
+ hilog.info(DOMAIN, TAG, `Succeeded in setting the window layout to full-screen mode.`);
+ })
+ .catch((err: BusinessError) => {
+ hilog.error(DOMAIN, TAG, `Failed to set the window layout to full-screen mode. Cause: ${JSON.stringify(err)}`);
+ });
+ let sysBarProps: window.SystemBarProperties = {
+ statusBarColor: '#ff00ff',
+ navigationBarColor: '#00ff00',
+ // 以下两个属性从API Version 8开始支持
+ statusBarContentColor: '#ffffff',
+ navigationBarContentColor: '#ffffff'
+ };
+ windowClass.setWindowSystemBarProperties(sysBarProps)
+ .then(() => {
+ hilog.info(DOMAIN, TAG, `Succeeded in setting the system bar properties.`);
+ })
+ .catch((err: BusinessError) => {
+ hilog.error(DOMAIN, TAG, `Failed to set the system bar properties. Cause: ${JSON.stringify(err)}`);
+ });
+ })
+ // 3.为沉浸式窗口加载对应的目标页面。
+ windowStage.loadContent('pages/Index', (err: BusinessError) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(DOMAIN, TAG, `Failed to load the content. Cause: ${JSON.stringify(err)}`);
+ return;
+ }
+ hilog.info(DOMAIN, TAG, `Succeeded in loading the content.`);
+ });
+ }
+};
+// [End set_window_system_bar_enable]
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+const DOMAIN = 0x0000;
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(DOMAIN, 'testTag', 'onBackup ok');
+ await Promise.resolve();
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ await Promise.resolve();
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/pages/Index.ets b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..64ca99781cb5c3e261ecdd74d316c6fa7cec67e4
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World';
+
+ build() {
+ RelativeContainer() {
+ Text(this.message)
+ .id('HelloWorld')
+ .fontSize($r('app.float.page_text_font_size'))
+ .fontWeight(FontWeight.Bold)
+ .alignRules({
+ center: { anchor: '__container__', align: VerticalAlign.Center },
+ middle: { anchor: '__container__', align: HorizontalAlign.Center }
+ })
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/module.json5
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "ohos.want.action.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/color.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/float.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/string.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/background.png b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/foreground.png b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/layered_image.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/startIcon.png b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/profile/backup_config.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/dark/element/color.json b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/mock/mock-config.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..323d1d611fecf4ecb751976e3a71500b3712a445
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/mock/mock-config.json5
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a86f1c77e93e0b6132f549fd6ae3a747037e6c6e
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+import { describe, it, expect } from '@ohos/hypium';
+import { Driver, ON } from '@kit.TestKit';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+const TAG = '[Sample_SetWindowSystemBarEnable]';
+const DOMAIN = 0xFF00
+const BUNDLE = 'SetWindowSystemBarEnable_';
+
+export default function abilityTest() {
+
+ describe('EntryAbilityTest', () => {
+ /**
+ * 打开应用
+ */
+ it(BUNDLE + 'StartAbility_001', 0, async (done: Function) => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "StartAbility_001, begin");
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.setwindowsystembarenable',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `StartAbility_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ done();
+ hilog.info(DOMAIN, TAG, BUNDLE + 'StartAbility_001 end');
+ })
+
+ /**
+ * 点击Hello Window,与主窗交互
+ */
+ it (BUNDLE + 'CreateMWindow_001', 2, async () => {
+ hilog.info(DOMAIN, TAG, BUNDLE + "CreateWindow_001, begin")
+ let driver = Driver.create();
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ try {
+ await abilityDelegator.startAbility({
+ bundleName: 'com.example.setwindowsystembarenable',
+ abilityName: 'EntryAbility'
+ });
+ } catch (exception) {
+ hilog.info(DOMAIN, TAG, BUNDLE + `CreateWindow_001 exception = ${JSON.stringify(exception)}`);
+ expect().assertFail();
+ }
+ await driver.delayMs(1000);
+ await driver.assertComponentExist(ON.text('Hello World'));
+ let clickBtn = await driver.findComponent(ON.text('Hello World'));
+ await clickBtn.click();
+ await driver.delayMs(1000);
+
+
+ hilog.info(DOMAIN, TAG, BUNDLE + `Hello World_001 end`);
+ })
+ })
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/ets/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c64e0b06938d246ce044186d4b2d02b500a89e14
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/module.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1cafc28b86d7d9f2b34f24d26a75c0dbd7299715
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/ohosTest/module.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/test/List.test.ets b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a60c87c5cbb0badf7c3fd8975034590e6fafa992
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/test/LocalUnit.test.ets b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..841bfd77e56060e50ec0924302a5ae624e76e3aa
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/hvigor/hvigor-config.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3b057578a1bb4d591ee53054e39ab0154fc2e43a
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/hvigorfile.ts b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae9086af35844176c08f1be3772d081d95d267c6
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/oh-package.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..837c0ff9f35a6bb9eea849fead7955c19bcdec8d
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.24",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/ohosTest.md b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..89d9a323c6c0b382bb0de8f5bac1c48ea32f8107
--- /dev/null
+++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/ohosTest.md
@@ -0,0 +1,7 @@
+# SetWindowSystemBarEnable示例测试用例归档
+## 用例表
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+|------| --- |----------------------|--------| --- |------|
+| 拉起应用 |设备正常运行| | 成功拉起应用 | 是 | Pass |
+| 创建主窗 |设备正常运行| | 成功创建主窗 | 是 | Pass |
+| 点击交互 |设备正常运行| | 页面变化 | 是 | Pass |
\ No newline at end of file
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_1.jpg b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..56139f85bed396f271ff264c87dc31c0aab5dd7d
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_1.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_2.jpg b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..508119995617a9441771b4b3b70bef91e46f0ec7
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_2.jpg differ
diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_3.jpg b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_3.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..5adb350f3ebcb49c477506eb892ada2cbe1c70fa
Binary files /dev/null and b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/screenshots/screenshot_3.jpg differ
diff --git a/ArkUIKit/BuilderComponent/AppScope/app.json5 b/ArkUIKit/BuilderComponent/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5dd26f2b5b8394e045e5828309080c371cc0e333
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/AppScope/app.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "app": {
+ "bundleName": "com.samples.builder",
+ "vendor": "samples",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkUIKit/BuilderComponent/AppScope/resources/base/element/string.json b/ArkUIKit/BuilderComponent/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..92392d0ef256abb0b667841de5804d222181f548
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "BuilderComponent"
+ }
+ ]
+}
diff --git a/ArkUIKit/BuilderComponent/AppScope/resources/base/media/background.png b/ArkUIKit/BuilderComponent/AppScope/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/BuilderComponent/AppScope/resources/base/media/background.png differ
diff --git a/ArkUIKit/BuilderComponent/AppScope/resources/base/media/foreground.png b/ArkUIKit/BuilderComponent/AppScope/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb
Binary files /dev/null and b/ArkUIKit/BuilderComponent/AppScope/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/BuilderComponent/AppScope/resources/base/media/layered_image.json b/ArkUIKit/BuilderComponent/AppScope/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/AppScope/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/README_zh.md b/ArkUIKit/BuilderComponent/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..c8241fc0a3b2889a17ae625936061ae0d126de54
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/README_zh.md
@@ -0,0 +1,103 @@
+# @Builder装饰器:自定义构建函数
+
+### 介绍
+
+本示例通过使用[@Builder装饰器:自定义构建函数](https://gitcode.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/state-management/arkts-builder.md)中各场景开发实例,主要展示了Builder装饰器的使用方法和一些常见的使用场景以及问题场景,便于开发者学习与理解。
+
+### 效果预览
+
+|主页前半部分|主页后半部分|
+|--------------------------------|--------------------------------|
+|||
+
+使用说明
+
+1. 在主界面,自上而下共27个按钮,每个按钮对应一个示例场景,点即可跳转至对应页面;
+2. 在对应的场景页面可以查看对应参考示例效果;
+3. 通过自动测试框架可进行测试及维护。
+
+### 工程目录
+
+```
+entry/src/main/ets/
+|---entryability
+|---entrybackupability
+|---pages
+| |---Index.ets // 主页
+| |---PrivateCustomConstructor.ets // 私有自定义构建函数
+| |---GlobalCustomConstructor.ets // 全局自定义构建函数
+| |---ParameterPassing.ets // 自定义构建函数参数传递规则
+| |---InCustomComponent.ets // 自定义组件内使用自定义构建函数
+| |---GlobalCustomBuilder.ets // 全局自定义构建函数
+| |---ChangingByDecorator.ets // 修改装饰器修饰的变量触发UI刷新
+| |---AsCustomBuilder.ets // 将@Builder装饰的函数当作CustomBuilder类型使用
+| |---NestedBuilderFunctions.ets // 多层@Builder函数嵌套
+| |---BuilderCombined.ets // @Builder函数联合V2装饰器
+| |---BuilderCombinedLocal.ets // @Builder函数联合V2装饰器且传参为@Local对象
+| |---AcrossComponents.ets // 跨组件复用的全局@Builder
+| |---BuilderSupports.ets // @Builder支持状态变量刷新
+| |---MultipleIncorrectUsage1.ets // @Builder存在两个或两个以上参数反例1
+| |---MultipleIncorrectUsage2.ets // @Builder存在两个或两个以上参数反例反例2
+| |---MultipleCorrectUsage.ets // @Builder存在两个或两个以上参数反例正例
+| |---DynamicIncorrectUsage.ets // 使用@ComponentV2装饰器触发动态刷新反例
+| |---DynamicCorrectUsage.ets // 使用@ComponentV2装饰器触发动态刷新正例
+| |---BuilderIncorrectUsage.ets // 在@Builder内创建自定义组件传递参数不刷新问题反例
+| |---BuilderCorrectUsage.ets // 在@Builder内创建自定义组件传递参数不刷新问题正例
+| |---OutsideIncorrectUsage.ets // 在UI语句外调用@Builder函数或方法影响节点正常刷新反例
+| |---OutsideCorrectUsage.ets // 在UI语句外调用@Builder函数或方法影响节点正常刷新正例
+| |---AccessorIncorrectUsage.ets // 在@Builder方法中使用MutableBinding未传递set访问器反例
+| |---AccessorCorrectUsage.ets // 在@Builder方法中使用MutableBinding未传递set访问器正例
+| |---ChangingIncorrectUsage.ets // 在@Builder装饰的函数内部修改入参内容反例
+| |---ChangingCorrectUsage.ets // 在@Builder装饰的函数内部修改入参内容正例
+| |---WatchIncorrectUsage.ets // 在@Watch函数中执行@Builder函数反例
+| |---WatchCorrectUsage.ets // 在@Watch函数中执行@Builder函数正例
+```
+
+### 具体实现
+
+* 私有实现自定义构建,能够在局部使用的自定义构建,源码参考[PrivateCustomConstructor.ets](./entry/src/main/ets/pages/PrivateCustomConstructor.ets);
+ * 在BuilderDemo中使用@Builder修饰函数showTextBuilder(),使其能以链式调用的方式配置并构建Text组件;
+ * 在BuilderDemo中使用@Builder修饰函数showTextValueBuilder(param: string),支持以参数方式传入内容,以达到修改构建内容;
+ * 在build()中分别调用上述两个自定义构建函数,可在页面看到'Hello World'和'Hello @Builder'字样;
+* 全局实现自定义构建,能够在全局使用的自定义构建,源码参考[GlobalCustomConstructor.ets](./entry/src/main/ets/pages/GlobalCustomConstructor.ets);
+ * 在BuilderDemo外部使用@Builder修饰函数showTextBuilder(),使其能以链式调用的方式配置并构建Text组件;
+ * 在build()中调用上述自定义构建函数,可在页面看到'Hello World'字样;
+* 参数传递规则
+ * 当@Builder修饰的自定义构建函数具备参数,其规则大致如下,源码参考[ParameterValue.ets](./entry/src/main/ets/pages/ParameterValue.ets)和[ParameterReference.ets](./entry/src/main/ets/pages/ParameterReference.ets)。
+ ```typescript
+ // 按值传递(无自动刷新)
+ @Builder function StaticText(content: string) {
+ Text(content).fontSize(14)
+ }
+
+ // 按引用传递(支持自动刷新)
+ @Builder function DynamicText($$: { content: string }) {
+ Text($$.content).fontColor('#FF0000')
+ }
+ ```
+
+### 相关权限
+
+无。
+
+### 依赖
+
+无。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备如:RK3568;
+2. 本示例为Stage模型,仅支持API20及以上版本SDK,SDK版本号(API Version 20 Release)及以上,镜像版本号(6.0Release)及以上;
+3. 本示例需要使用DevEco Studio 6.0.0 Canary1 (Build Version: 6.0.0.858, built on September 24, 2025)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,在本地目录使用git执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/ArkUISample/BuilderComponent > .git/info/sparse-checkout
+git remote add origin https://gitcode.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/build-profile.json5 b/ArkUIKit/BuilderComponent/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3ca5a93fb814017ac4c398aacbdf17b1d8b0a237
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/build-profile.json5
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": "6.0.0(20)",
+ "compatibleSdkVersion": "6.0.0(20)",
+ "targetSdkVersion": "6.0.0(20)",
+ "runtimeOS": "HarmonyOS",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/code-linter.json5 b/ArkUIKit/BuilderComponent/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/code-linter.json5
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/build-profile.json5 b/ArkUIKit/BuilderComponent/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9016faf39f8a65cf648bae246a53575510fe8b9f
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/build-profile.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "resOptions": {
+ "copyCodeResource": {
+ "enable": false
+ }
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/hvigorfile.ts b/ArkUIKit/BuilderComponent/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/obfuscation-rules.txt b/ArkUIKit/BuilderComponent/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/oh-package.json5 b/ArkUIKit/BuilderComponent/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..98182799de1294d4c21194646a0c30eff08aea33
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+const DOMAIN = 0x0000;
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ try {
+ this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
+ } catch (err) {
+ hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err));
+ }
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err));
+ return;
+ }
+ hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+const DOMAIN = 0x0000;
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(DOMAIN, 'testTag', 'onBackup ok');
+ await Promise.resolve();
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ await Promise.resolve();
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AccessorCorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AccessorCorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7c7f9170f81d83979d70b02e435d7d9412b50bb2
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AccessorCorrectUsage.ets
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start not_passed_set_accessor_builder_correct_usage]
+import { UIUtils, Binding, MutableBinding } from '@kit.ArkUI';
+
+@ObservedV2
+class GlobalTmp2 {
+ @Trace public strValue: string = 'Hello';
+}
+
+@Builder
+function builderWithTwoParams2(param1: Binding, param2: MutableBinding) {
+ Column() {
+ Text(`strValue: ${param1.value.strValue}`)
+ Button(`num: ${param2.value}`)
+ .onClick(() => {
+ param2.value += 1; // 修改了MutableBinding类型参数的value属性
+ })
+ }.borderWidth(1)
+}
+
+@Entry
+@ComponentV2
+struct MakeBindingTest2 {
+ @Local GlobalTmp2: GlobalTmp2 = new GlobalTmp2();
+ @Local num: number = 0;
+
+ build() {
+ Column() {
+ Text(`${this.GlobalTmp2.strValue}`)
+ builderWithTwoParams2(UIUtils.makeBinding(() => this.GlobalTmp2),
+ UIUtils.makeBinding(() => this.num,
+ val => {
+ this.num = val;
+ }))
+ Button('Update Values').onClick(() => {
+ this.GlobalTmp2.strValue = 'Hello World 2025';
+ this.num = 1;
+ })
+ }
+ }
+}
+// [End not_passed_set_accessor_builder_correct_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AccessorIncorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AccessorIncorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fb0e4552f0df64a18854afae14ecbb4f77c13f4f
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AccessorIncorrectUsage.ets
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start not_passed_set_accessor_builder_incorrect_usage]
+import { UIUtils, Binding, MutableBinding } from '@kit.ArkUI';
+@ObservedV2
+class GlobalTmp1 {
+ @Trace public strValue: string = 'Hello';
+}
+
+@Builder
+function builderWithTwoParams1(param1: Binding, param2: MutableBinding) {
+ Column() {
+ Text(`strValue: ${param1.value.strValue}`)
+ Button(`num: ${param2.value}`)
+ .onClick(()=>{
+ param2.value += 1; // 点击Button触发set访问器会造成运行时错误
+ })
+ }.borderWidth(1)
+}
+
+@Entry
+@ComponentV2
+struct MakeBindingTest1 {
+ @Local GlobalTmp1: GlobalTmp1 = new GlobalTmp1();
+ @Local num: number = 0;
+
+ build() {
+ Column() {
+ Text(`${this.GlobalTmp1.strValue}`)
+ builderWithTwoParams1(UIUtils.makeBinding(() => this.GlobalTmp1),
+ UIUtils.makeBinding(() => this.num)) // 构造MutableBinding类型参数时没有传SetterCallback
+ Button('Update Values').onClick(() => {
+ this.GlobalTmp1.strValue = 'Hello World 2025';
+ this.num = 1;
+ })
+ }
+ }
+}
+// [End not_passed_set_accessor_builder_incorrect_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AcrossComponents.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AcrossComponents.ets
new file mode 100644
index 0000000000000000000000000000000000000000..aac2e3cd7df48efb96d01787749129f083a1717e
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AcrossComponents.ets
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start global_builder_reused_across_components]
+class ReusableTmp {
+ public componentName: string = 'Child';
+}
+
+@Builder
+function itemBuilder(params: ReusableTmp) {
+ Column() {
+ Text(`Builder ===${params.componentName}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ }
+}
+
+@Entry
+@Component
+struct ReusablePage {
+ @State switchFlag: boolean = true;
+
+ build() {
+ Column() {
+ if (this.switchFlag) {
+ ReusableChildPage({ message: 'Child' })
+ } else {
+ ReusableChildTwoPage({ message: 'ChildTwo' })
+ }
+ Button('Click me')
+ .onClick(() => {
+ this.switchFlag = !this.switchFlag;
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+
+@Reusable
+@Component
+struct ReusableChildPage {
+ @State message: string = 'Child';
+
+ aboutToReuse(params: Record): void {
+ console.info('Recycle ====Child');
+ this.message = params.message;
+ }
+
+ build() {
+ Column() {
+ Text(`ReusableChildPage ===${this.message}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ itemBuilder({ componentName: this.message })
+ }
+ }
+}
+
+@Reusable
+@Component
+struct ReusableChildTwoPage {
+ @State message: string = 'ChildTwo';
+
+ aboutToReuse(params: Record): void {
+ console.info('Recycle ====ChildTwo');
+ this.message = params.message;
+ }
+
+ build() {
+ Column() {
+ Text(`ReusableChildTwoPage ===${this.message}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ itemBuilder({ componentName: this.message })
+ }
+ }
+}
+// [End global_builder_reused_across_components]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AsCustomBuilder.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AsCustomBuilder.ets
new file mode 100644
index 0000000000000000000000000000000000000000..852cdd828148b707ed36826bca03415828c29326
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/AsCustomBuilder.ets
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start using_function_decorated_with_builder_as_custom_builder]
+@Builder
+function overBuilderDemo() {
+ Row() {
+ Text('Global Builder')
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+ }
+}
+
+@Entry
+@Component
+struct customBuilderDemo {
+ @State arr: number[] = [0, 1, 2, 3, 4];
+
+ @Builder
+ privateBuilder() {
+ Row() {
+ Text('Private Builder')
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+ }
+ }
+
+ build() {
+ Column() {
+ List({ space: 10 }) {
+ ForEach(this.arr, (item: number) => {
+ ListItem() {
+ Text(`${item}`)
+ .width('100%')
+ .height(100)
+ .fontSize(16)
+ .textAlign(TextAlign.Center)
+ .borderRadius(10)
+ .backgroundColor(0xFFFFFF)
+ }
+ .swipeAction({
+ start: {
+ builder: overBuilderDemo() // 编译工具链会自动绑定this上下文
+ },
+ end: {
+ builder: () => {
+ // 在箭头函数中调用局部@Builder会自动绑定this上下文,无需编译工具链处理
+ this.privateBuilder()
+ }
+ }
+ })
+ }, (item: number) => JSON.stringify(item))
+ }
+ }
+ }
+}
+// [End using_function_decorated_with_builder_as_custom_builder]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCombined.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCombined.ets
new file mode 100644
index 0000000000000000000000000000000000000000..9bb7109cab1cdc94c0411f546d1f671fb08b7308
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCombined.ets
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start builder_function_combined_with_the_v2_decorator]
+@ObservedV2
+class Info {
+ @Trace public name: string;
+ @Trace public age: number;
+
+ constructor(name: string, age: number) {
+ this.name = name;
+ this.age = age;
+ }
+}
+
+@Builder
+function overBuilderTest(param: Info) {
+ Column() {
+ Text(`Global@Builder name: ${param.name}`)
+ Text(`Global@Builder age: ${param.age}`)
+ }
+ .width(230)
+ .height(40)
+ .margin(10)
+ .padding({ left: 20 })
+ .backgroundColor('#0d000000')
+ .borderRadius(20)
+}
+
+@ComponentV2
+struct ChildPage {
+ @Require @Param childInfo: Info;
+
+ build() {
+ Column() {
+ // 此处必须为值传递方式,如果使用引用传递的方式会被ArkTS语法拦截
+ overBuilderTest(this.childInfo)
+ }
+ }
+}
+
+@Entry
+@ComponentV2
+struct ParentPage {
+ info1: Info = new Info('Tom', 25);
+ info2: Info = new Info('Tom', 25);
+
+ @Builder
+ privateBuilder() {
+ Column() {
+ Text(`Private@Builder name: ${this.info1.name}`)
+ Text(`Private@Builder age: ${this.info1.age}`)
+ }
+ .width(230)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .borderRadius(20)
+ }
+
+ build() {
+ Column() {
+ Flex() {
+ Column() {
+ Text(`info1: ${this.info1.name} ${this.info1.age}`) // Text1
+ Text(`info2: ${this.info2.name} ${this.info2.age}`) // Text2
+ }
+ }
+ .width(230)
+ .height(40)
+ .margin(10)
+ .padding({ left: 60 })
+ .backgroundColor('#0d000000')
+ .borderRadius(20)
+
+ // 调用局部@Builder
+ this.privateBuilder()
+ // 调用全局@Builder, 此处必须为值传递方式,如果使用引用传递的方式会被ArkTS语法拦截
+ overBuilderTest(this.info2)
+ ChildPage({ childInfo: this.info1 }) // 调用自定义组件
+ ChildPage({ childInfo: this.info2 }) // 调用自定义组件
+ Button('change info1&info2')
+ .onClick(() => {
+ this.info1.name = 'Cat'; // 修改Text1显示的info1的name值
+ this.info1.age = 18; // 修改Text1显示的info1的age值
+ this.info2.name = 'Cat'; // 修改Text2显示的info2的name值
+ this.info2.age = 18; // 修改Text2显示的info2的age值
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+// [End builder_function_combined_with_the_v2_decorator]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCombinedLocal.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCombinedLocal.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bfd8e0d113b0087febd9e3fcdf6416ff8009a18a
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCombinedLocal.ets
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start builder_function_combined_with_the_v2_decorator_and_local]
+class LocalInfo {
+ public name: string = 'Tom';
+ public age: number = 25;
+}
+
+@Builder
+function overBuilderLocal(param: LocalInfo) {
+ Column() {
+ Text(`Global@Builder name: ${param.name}`)
+ Text(`Global@Builder age: ${param.age}`)
+ }
+ .width(230)
+ .height(40)
+ .margin(10)
+ .padding({ left: 20 })
+ .backgroundColor('#0d000000')
+ .borderRadius(20)
+}
+
+@ComponentV2
+struct ChildLocalPage {
+ @Require @Param childLocalInfo: LocalInfo;
+
+ build() {
+ Column() {
+ // 此处为引用传递方式
+ overBuilderLocal({ name: this.childLocalInfo.name, age: this.childLocalInfo.age })
+ }
+ }
+}
+
+@Entry
+@ComponentV2
+struct ParentLocalPage {
+ LocalInfo1: LocalInfo = { name: 'Tom', age: 25 };
+ @Local LocalInfo2: LocalInfo = { name: 'Tom', age: 25 };
+
+ @Builder
+ privateBuilder() {
+ Column() {
+ Text(`Private@Builder name: ${this.LocalInfo1.name}`)
+ Text(`Private@Builder age: ${this.LocalInfo1.age}`)
+ }
+ .width(230)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .borderRadius(20)
+ }
+
+ build() {
+ Column() {
+ Flex() {
+ Column() {
+ Text(`LocalInfo1: ${this.LocalInfo1.name} ${this.LocalInfo1.age}`) // Text1
+ Text(`LocalInfo2: ${this.LocalInfo2.name} ${this.LocalInfo2.age}`) // Text2
+ }
+ }
+ .width(230)
+ .height(40)
+ .margin(10)
+ .padding({ left: 60 })
+ .backgroundColor('#0d000000')
+ .borderRadius(20)
+
+ // 调用局部@Builder
+ this.privateBuilder()
+ // 调用全局@Builder, 此处为引用传递方式
+ overBuilderLocal({ name: this.LocalInfo2.name, age: this.LocalInfo2.age })
+ ChildLocalPage({ childLocalInfo: this.LocalInfo1 }) // 调用自定义组件
+ ChildLocalPage({ childLocalInfo: this.LocalInfo2 }) // 调用自定义组件
+ Button('change LocalInfo1&LocalInfo2')
+ .onClick(() => {
+ this.LocalInfo1 = { name: 'Cat', age: 18 }; // Text1不会刷新,原因是没有装饰器修饰监听不到值的改变
+ this.LocalInfo2 = { name: 'Cat', age: 18 }; // Text2会刷新,原因是有装饰器修饰,可以监听到值的改变
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+// [End builder_function_combined_with_the_v2_decorator_and_local]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5c66081aa2b77c4150ab56052ab065691a9dd2a4
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderCorrectUsage.ets
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start builder_parameter_update_propagation_correct_usage]
+class Tmp5 {
+ public name: string = 'Hello';
+ public age: number = 16;
+}
+
+@Builder
+function parentBuilder2(params: Tmp5) {
+ Row() {
+ Column() {
+ Text(`parentBuilder2===${params.name}===${params.age}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ // 将整个对象拆分开变成简单类型,属于按引用传递方式,更改属性能够触发UI刷新。
+ HelloComponent2({ childName: params.name, childAge: params.age })
+ }
+ }
+}
+
+@Component
+struct HelloComponent2 {
+ @Prop childName: string = '';
+ @Prop childAge: number = 0;
+
+ build() {
+ Row() {
+ Text(`HelloComponent2===${this.childName}===${this.childAge}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }
+ }
+}
+
+@Entry
+@Component
+struct ParentPage2 {
+ @State nameValue: string = 'Zhang San';
+ @State ageValue: number = 18;
+
+ build() {
+ Column() {
+ parentBuilder2({ name: this.nameValue, age: this.ageValue })
+ Button('Click me')
+ .onClick(() => {
+ // 此处修改内容时,会引起HelloComponent2处的变化
+ this.nameValue = 'Li Si';
+ this.ageValue = 20;
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+// [End builder_parameter_update_propagation_correct_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderIncorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderIncorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..2dbdcc302c71cb867b6633bf45cd102d70c3caaf
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderIncorrectUsage.ets
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start builder_parameter_update_propagation_incorrect_usage]
+class Tmp4 {
+ public name: string = 'Hello';
+ public age: number = 16;
+}
+
+@Builder
+function parentBuilder1(params: Tmp4) {
+ Row() {
+ Column() {
+ Text(`parentBuilder1===${params.name}===${params.age}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ // 此写法不属于按引用传递方式,用法错误导致UI不刷新。
+ HelloComponent1({ info: params })
+ }
+ }
+}
+
+@Component
+struct HelloComponent1 {
+ @Prop info: Tmp4 = new Tmp4();
+
+ build() {
+ Row() {
+ Text(`HelloComponent1===${this.info.name}===${this.info.age}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }
+ }
+}
+
+@Entry
+@Component
+struct ParentPage1 {
+ @State nameValue: string = 'Zhang San';
+ @State ageValue: number = 18;
+
+ build() {
+ Column() {
+ parentBuilder1({ name: this.nameValue, age: this.ageValue })
+ Button('Click me')
+ .onClick(() => {
+ // 此处修改内容时,不会引起HelloComponent1处的变化
+ this.nameValue = 'Li Si';
+ this.ageValue = 20;
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+// [End builder_parameter_update_propagation_incorrect_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderSupports.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderSupports.ets
new file mode 100644
index 0000000000000000000000000000000000000000..40a9ed356a3be125a24e7fc4de08a8fd0deb000e
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/BuilderSupports.ets
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start builder_supports_state_variable_refresh]
+import { Binding, MutableBinding, UIUtils } from '@kit.ArkUI';
+
+@ObservedV2
+class ClassA {
+ @Trace public props: string = 'Hello';
+}
+
+@Builder
+function customButton(num1: Binding, num2: MutableBinding) {
+ Row() {
+ Column() {
+ Text(`number1 === ${num1.value}, number2 === ${num2.value}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+
+ Button(`only change number2`)
+ .onClick(() => {
+ num2.value += 1;
+ })
+ }
+ }
+}
+
+@Builder
+function customButtonObj(obj1: MutableBinding) {
+ Row() {
+ Column() {
+ Text(`props === ${obj1.value.props}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+
+ Button(`change props`)
+ .onClick(() => {
+ obj1.value.props += 'Hi';
+ })
+ }
+ }
+}
+
+@Entry
+@ComponentV2
+struct Single {
+ @Local number1: number = 5;
+ @Local number2: number = 12;
+ @Local classA: ClassA = new ClassA();
+
+ build() {
+ Column() {
+ Button(`change both number1 and number2`)
+ .onClick(() => {
+ this.number1 += 1;
+ this.number2 += 2;
+ })
+ Text(`number1 === ${this.number1}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ Text(`number2 === ${this.number2}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ customButton(
+ UIUtils.makeBinding(() => this.number1),
+ UIUtils.makeBinding(
+ () => this.number2,
+ (val: number) => {
+ this.number2 = val;
+ })
+ )
+ Text(`classA.props === ${this.classA.props}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ customButtonObj(
+ UIUtils.makeBinding(
+ () => this.classA,
+ (val: ClassA) => {
+ this.classA = val;
+ })
+ )
+ }
+ .width('100%')
+ .height('100%')
+ .alignItems(HorizontalAlign.Center)
+ .justifyContent(FlexAlign.Center)
+ }
+}
+// [End builder_supports_state_variable_refresh]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingByDecorator.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingByDecorator.ets
new file mode 100644
index 0000000000000000000000000000000000000000..6b8b42de3ff2d94253e73a5d87debacf7e8ea308
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingByDecorator.ets
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start changing_by_the_decorator_triggers_ui_rerendering]
+class ChildrenTmp {
+ public strValue: string = 'Hello';
+}
+
+@Entry
+@Component
+struct ParentSample {
+ @State objParam: ChildrenTmp = new ChildrenTmp();
+ @State label: string = 'World';
+
+ @Builder
+ privateBuilder() {
+ Column() {
+ Text(`wrapBuilder strValue: ${this.objParam.strValue}`)
+ .width(350)
+ .height(40)
+ .margin(12)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ Text(`wrapBuilder num: ${this.label}`)
+ .width(350)
+ .height(40)
+ .margin(12)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ }
+ }
+
+ build() {
+ Column() {
+ Text('UI Rendered via @Builder')
+ .fontSize(20)
+ this.privateBuilder()
+ Button('Update Values').onClick(() => {
+ this.objParam.strValue = 'strValue Hello World';
+ this.label = 'label Hello World';
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+// [End changing_by_the_decorator_triggers_ui_rerendering]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingCorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingCorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cc0f15a79a0f2b9b0f0271060ebadbd45d9b6f91
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingCorrectUsage.ets
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start changing_input_parameters_builder_correct_usage]
+import { UIUtils, MutableBinding } from '@kit.ArkUI';
+
+// 使用MutableBinding在@Builder装饰的函数中修改参数值
+@Builder
+function myGlobalBuilderMod(str: MutableBinding) {
+ Column() {
+ Text(`Mod--MyGlobalBuilder: ${str.value}`)
+ .fontSize(16)
+ .onClick(() => {
+ str.value = 'value change mod';
+ })
+ }
+}
+
+interface TempMod2 {
+ paramA: string;
+}
+
+// 使用MutableBinding在@Builder装饰的函数内部修改参数值
+@Builder
+function overBuilderMod2(param: MutableBinding) {
+ Column() {
+ Button(`Mod--overBuilder === ${param.value.paramA}`)
+ .onClick(() => {
+ param.value.paramA = 'Yes';
+ })
+ Button(`change`)
+ .onClick(() => {
+ param.value = { paramA: 'trialOne' };
+ })
+ }
+}
+
+@Entry
+@Component
+struct ParentMod2 {
+ @State label: string = 'Hello';
+ @State message1: string = 'Value Passing';
+ @State objectOne: TempMod2 = {
+ paramA: this.label
+ };
+
+ @Builder
+ extendBlank() {
+ Row() {
+ Blank()
+ }
+ .height(20)
+ }
+
+ build() {
+ Column() {
+ // 使用MutableBinding时无法传对象字面量,需要先将字面量对象抽出为状态变量
+ overBuilderMod2(
+ UIUtils.makeBinding(
+ () => this.objectOne,
+ value => {
+ this.objectOne = value; // 必须要传SetterCallback,否则触发时会造成运行时错误
+ }
+ )
+ )
+ this.extendBlank();
+ Button('click me')
+ .onClick(() => {
+ this.objectOne.paramA = 'ArkUI';
+ })
+ this.extendBlank();
+ myGlobalBuilderMod(
+ UIUtils.makeBinding(
+ () => this.message1,
+ value => {
+ this.message1 = value; // 必须要传SetterCallback,否则触发时会造成运行时错误
+ }
+ )
+ );
+ }
+ }
+}
+// [End changing_input_parameters_builder_correct_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingIncorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingIncorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..196196884e6a575ecf18270bda090245e0c3f827
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ChangingIncorrectUsage.ets
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start changing_input_parameters_builder_incorrect_usage]
+@Builder
+function myGlobalBuilder(value: string) {
+ Column() {
+ Text(`myGlobalBuilder: ${value} `)
+ .fontSize(16)
+ .onClick(() => {
+ // 简单类型按值传递的@Builder函数中修改参数,不闪退但UI不刷新
+ value = 'value change';
+ })
+ }.borderWidth(1)
+}
+
+interface TempMod1 {
+ paramA: string;
+}
+
+@Builder
+function overBuilderMod1(param: TempMod1) {
+ Row() {
+ Column() {
+ Button(`overBuilderMod1 === ${param.paramA}`)
+ .onClick(() => {
+ // 错误写法,不允许在@Builder装饰的函数内部修改对象类型参数的属性,闪退且UI不刷新
+ param.paramA = 'Yes';
+ })
+ Button('change')
+ .onClick(() => {
+ // 错误写法,不允许在@Builder装饰的函数内部修改对象类型参数的引用,不闪退但UI不刷新
+ param = { paramA: 'change trial' };
+ })
+ }
+ }
+}
+
+@Entry
+@Component
+struct ParentMod1 {
+ @State label: string = 'Hello';
+ @State message1: string = 'Value Passing';
+
+ @Builder
+ extendBlank() {
+ Row() {
+ Blank()
+ }
+ .height(20)
+ }
+
+ build() {
+ Column() {
+ // 按引用传递能实现参数变化时的UI刷新,但不能在@Builder函数内部修改参数
+ overBuilderMod1({ paramA: this.label });
+ this.extendBlank();
+ Button('click me')
+ .onClick(() => {
+ this.label = 'ArkUI';
+ })
+ this.extendBlank();
+ myGlobalBuilder(this.message1);
+ }
+ }
+}
+// [End changing_input_parameters_builder_incorrect_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/DynamicCorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/DynamicCorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1dff29956b494036ed189f80d99c7733923c056e
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/DynamicCorrectUsage.ets
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start dynamic_rerendering_with_component_v2_correct_usage]
+@ObservedV2
+class ParamTmpClass {
+ @Trace public count : number = 0;
+}
+
+@Builder
+function renderText(param: ParamTmpClass) {
+ Column() {
+ Text(`param : ${param.count}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }
+}
+
+@Builder
+function renderMap(paramMap: Map) {
+ Text(`paramMap : ${paramMap.get('name')}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+}
+
+@Builder
+function renderSet(paramSet: Set) {
+ Text(`paramSet : ${paramSet.size}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+}
+
+@Builder
+function renderNumberArr(paramNumArr: number[]) {
+ Text(`paramNumArr : ${paramNumArr[0]}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+}
+
+@Entry
+@ComponentV2
+struct PageBuilderCorrectUsage {
+ @Local builderParams: ParamTmpClass = new ParamTmpClass();
+ @Local mapValue: Map = new Map();
+ @Local setValue: Set = new Set([0]);
+ @Local numArrValue: number[] = [0];
+ private progressTimer: number = -1;
+
+ aboutToAppear(): void {
+ this.progressTimer = setInterval(() => {
+ if (this.builderParams.count < 100) {
+ this.builderParams.count += 5;
+ this.mapValue.set('name', this.builderParams.count);
+ this.setValue.add(this.builderParams.count);
+ this.numArrValue[0] = this.builderParams.count;
+ } else {
+ clearInterval(this.progressTimer);
+ }
+ }, 500);
+ }
+
+ @Builder
+ localBuilder() {
+ Column() {
+ Text(`localBuilder : ${this.builderParams.count}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }
+ }
+
+ build() {
+ Column() {
+ this.localBuilder()
+ Text(`builderParams :${this.builderParams.count}`)
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ renderText(this.builderParams)
+ renderText({ count: this.builderParams.count })
+ renderMap(this.mapValue)
+ renderSet(this.setValue)
+ renderNumberArr(this.numArrValue)
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+// [Start dynamic_rerendering_with_component_v2_correct_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/DynamicIncorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/DynamicIncorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a97046380cb07d9832aa4065658f355fde26dd5d
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/DynamicIncorrectUsage.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start dynamic_rerendering_with_component_v2_incorrect_usage]
+@ObservedV2
+class ParamTemp {
+ @Trace public count : number = 0;
+}
+
+@Builder
+function renderNumber(paramNum: number) {
+ Text(`paramNum : ${paramNum}`)
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+}
+
+@Entry
+@ComponentV2
+struct PageBuilderIncorrectUsage {
+ @Local classValue: ParamTemp = new ParamTemp();
+ // 此处使用简单数据类型不支持刷新UI的能力。
+ @Local numValue: number = 0;
+ private progressTimer: number = -1;
+
+ aboutToAppear(): void {
+ this.progressTimer = setInterval(() => {
+ if (this.classValue.count < 100) {
+ this.classValue.count += 5;
+ this.numValue += 5;
+ } else {
+ clearInterval(this.progressTimer);
+ }
+ }, 500);
+ }
+
+ build() {
+ Column() {
+ renderNumber(this.numValue)
+ }
+ .width('100%')
+ .height('100%')
+ .padding(50)
+ }
+}
+// [Start dynamic_rerendering_with_component_v2_incorrect_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/GlobalCustomBuilder.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/GlobalCustomBuilder.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cea141be36473f5a0507a317bf11a741c8ac8fa2
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/GlobalCustomBuilder.ets
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start global_custom_builder_function]
+class ChildTmp {
+ public val: number = 1;
+}
+
+class ParamTmp {
+ public strValue: string = 'Hello';
+ public numValue: number = 0;
+ public tmpValue: ChildTmp = new ChildTmp();
+ public arrayTmpValue: Array = [];
+}
+
+@Builder
+function overBuilder(param: ParamTmp) {
+ Column() {
+ Text(`strValue: ${param.strValue}`)
+ .width(230)
+ .height(40)
+ .margin(12)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ Text(`numValue: ${param.numValue}`)
+ .width(230)
+ .height(40)
+ .margin(12)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ Text(`tmpValue: ${param.tmpValue.val}`)
+ .width(230)
+ .height(40)
+ .margin(12)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ ForEach(param.arrayTmpValue, (item: ChildTmp) => {
+ ListItem() {
+ Text(`arrayTmpValue: ${item.val}`)
+ .width(230)
+ .height(40)
+ .margin(12)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ }
+ }, (item: ChildTmp) => JSON.stringify(item))
+ }
+}
+
+@Entry
+@Component
+struct ParentDemo {
+ @State objParam: ParamTmp = new ParamTmp();
+
+ build() {
+ Column() {
+ Text('UI Rendered via @Builder')
+ .fontSize(20)
+ .margin(12)
+ overBuilder({
+ strValue: this.objParam.strValue,
+ numValue: this.objParam.numValue,
+ tmpValue: this.objParam.tmpValue,
+ arrayTmpValue: this.objParam.arrayTmpValue
+ })
+ Button('Update Values').onClick(() => {
+ this.objParam.strValue = 'Hello World';
+ this.objParam.numValue = 1;
+ this.objParam.tmpValue.val = 8;
+ const childValue: ChildTmp = {
+ val: 2
+ }
+ this.objParam.arrayTmpValue.push(childValue);
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+// [End global_custom_builder_function]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/GlobalCustomConstructor.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/GlobalCustomConstructor.ets
new file mode 100644
index 0000000000000000000000000000000000000000..28b14915eec30785536e8f6658d78e5efa85787b
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/GlobalCustomConstructor.ets
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start global_custom_constructor]
+@Builder
+function showTextBuilder() {
+ Text('Hello World')
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+}
+@Entry
+@Component
+struct BuilderSample {
+ build() {
+ Column() {
+ showTextBuilder()
+ }
+ }
+}
+// [End global_custom_constructor]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/InCustomComponent.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/InCustomComponent.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cb968771fb1840f5c2f2900c719760bf403b0ea3
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/InCustomComponent.ets
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start using_custom_builder_function_in_custom_component]
+@Entry
+@Component
+struct PrivateBuilder {
+ @State builderValue: string = 'Hello';
+
+ @Builder
+ builder() {
+ Column() {
+ Text(this.builderValue)
+ .width(230)
+ .height(40)
+ .backgroundColor('#ffeae5e5')
+ .borderRadius(20)
+ .margin(12)
+ .textAlign(TextAlign.Center)
+ }
+ }
+
+ aboutToAppear(): void {
+ setTimeout(() => {
+ this.builderValue = 'Hello World';
+ }, 2000);
+ }
+
+ build() {
+ Row() {
+ Column() {
+ Text(this.builderValue)
+ .width(230)
+ .height(40)
+ .backgroundColor('#ffeae5e5')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ this.builder()
+ Button('Click to change the builderValue')
+ .onClick(() => {
+ this.builderValue = 'builderValue was clicked';
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+ }
+}
+// [End using_custom_builder_function_in_custom_component]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/Index.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5d72f06bad5aa7f13090668f057e73035fb08241
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { Router } from '@kit.ArkUI';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../../ohosTest/ets/test/List.test';
+
+let router: Router;
+
+const pageArray: string[] = [
+ 'pages/PrivateCustomConstructor',
+ 'pages/GlobalCustomConstructor',
+ 'pages/ParameterValue',
+ 'pages/ParameterReference',
+ 'pages/InCustomComponent',
+ 'pages/GlobalCustomBuilder',
+ 'pages/ChangingByDecorator',
+ 'pages/AsCustomBuilder',
+ 'pages/NestedBuilderFunctions',
+ 'pages/BuilderCombined',
+ 'pages/BuilderCombinedLocal',
+ 'pages/AcrossComponents',
+ 'pages/BuilderSupports',
+ 'pages/MultipleIncorrectUsage1',
+ 'pages/MultipleIncorrectUsage2',
+ 'pages/MultipleCorrectUsage',
+ 'pages/DynamicIncorrectUsage',
+ 'pages/DynamicCorrectUsage',
+ 'pages/BuilderIncorrectUsage',
+ 'pages/BuilderCorrectUsage',
+ 'pages/OutsideIncorrectUsage',
+ 'pages/OutsideCorrectUsage',
+ 'pages/AccessorIncorrectUsage',
+ 'pages/AccessorCorrectUsage',
+ 'pages/ChangingIncorrectUsage',
+ 'pages/ChangingCorrectUsage',
+ 'pages/WatchIncorrectUsage',
+ 'pages/WatchCorrectUsage'
+];
+
+export const buttonArray: string[] = [
+ 'ButtonOne',
+ 'ButtonTwo',
+ 'ButtonThree',
+ 'ButtonTwentyEight',
+ 'ButtonFour',
+ 'ButtonFive',
+ 'ButtonSix',
+ 'ButtonSeven',
+ 'ButtonEight',
+ 'ButtonNine',
+ 'ButtonTen',
+ 'ButtonEleven',
+ 'ButtonTwelve',
+ 'ButtonThirteen',
+ 'ButtonFourteen',
+ 'ButtonFifteen',
+ 'ButtonSixteen',
+ 'ButtonSeventeen',
+ 'ButtonEighteen',
+ 'ButtonNineteen',
+ 'ButtonTwenty',
+ 'ButtonTwentyOne',
+ 'ButtonTwentyTwo',
+ 'ButtonTwentyThree',
+ 'ButtonTwentyFour',
+ 'ButtonTwentyFive',
+ 'ButtonTwentySix',
+ 'ButtonTwentySeven',
+];
+
+@Extend(Button)
+function buttonCustomStyle(id: string, page: string) {
+ .fontWeight(FontWeight.Bold)
+ .borderColor('#FF8040')
+ .borderWidth($r('sys.float.corner_radius_level1'))
+ .id(id)
+ .onClick(() => {
+ router.pushUrl({
+ url: page
+ })
+ })
+}
+
+@Entry
+@Component
+struct Index {
+
+ aboutToAppear(): void {
+ router = this.getUIContext().getRouter();
+ if (globalThis.autoTest) {
+ let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ let abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
+ console.info('start run testcase!!!');
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
+ }
+ }
+
+ build() {
+ Scroll() {
+ Column() {
+ ForEach(pageArray, (item: string, index: number) => {
+ Button($r(`app.string.${buttonArray[index]}`))
+ .buttonCustomStyle(`${buttonArray[index]}`, item)
+ }, (item: string) => item)
+ }
+ .width('100%')
+ }
+ .size({ width: '100%', height: '100%' })
+ .scrollBarWidth('5vp')
+ .id('rootScroll')
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleCorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleCorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cfaebc6b92aaa13a88409fa6a6489673556e5cb1
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleCorrectUsage.ets
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start multiple_parameters_in_builder_correct_usage]
+class GlobalTmp3 {
+ public strValue: string = 'Hello';
+ public numValue: number = 0;
+}
+@Builder function overBuilder3(param: GlobalTmp3) {
+ Column() {
+ Text(`strValue: ${param.strValue}`)
+ Text(`num: ${param.numValue}`)
+ }
+}
+
+@Entry
+@Component
+struct Parent3 {
+ @State objParam: GlobalTmp3 = new GlobalTmp3();
+ build() {
+ Column() {
+ Text('UI Rendered via @Builder')
+ .fontSize(20)
+ overBuilder3({strValue: this.objParam.strValue, numValue: this.objParam.numValue})
+ Line()
+ .width('100%')
+ .height(10)
+ .backgroundColor('#000000').margin(10)
+ Button('Update Values').onClick(() => {
+ this.objParam.strValue = 'Hello World';
+ this.objParam.numValue = 1;
+ })
+ }
+ }
+}
+// [End multiple_parameters_in_builder_correct_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleIncorrectUsage1.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleIncorrectUsage1.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c6b8c821023e7e89cb683c96add38671d322d50f
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleIncorrectUsage1.ets
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start multiple_parameters_in_builder_incorrect_usage_1]
+class GlobalTmp1 {
+ public strValue: string = 'Hello';
+}
+
+@Builder function overBuilder1(param: GlobalTmp1, num: number) {
+ Column() {
+ Text(`strValue: ${param.strValue}`)
+ Text(`num: ${num}`)
+ }
+}
+
+@Entry
+@Component
+struct Parent1 {
+ @State objParam: GlobalTmp1 = new GlobalTmp1();
+ @State num: number = 0;
+ build() {
+ Column() {
+ Text('UI Rendered via @Builder')
+ .fontSize(20)
+ // 使用了两个参数,用法错误。
+ overBuilder1({strValue: this.objParam.strValue}, this.num)
+ Line()
+ .width('100%')
+ .height(10)
+ .backgroundColor('#000000').margin(10)
+ Button('Update Values').onClick(() => {
+ this.objParam.strValue = 'Hello World';
+ this.num = 1;
+ })
+ }
+ }
+}
+// [End multiple_parameters_in_builder_incorrect_usage_1]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleIncorrectUsage2.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleIncorrectUsage2.ets
new file mode 100644
index 0000000000000000000000000000000000000000..8dcce85c64708ba84e21b34d96657dfde1425cbf
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/MultipleIncorrectUsage2.ets
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start multiple_parameters_in_builder_incorrect_usage_2]
+class GlobalTmp2 {
+ public strValue: string = 'Hello';
+}
+class SecondTmp {
+ public numValue: number = 0;
+}
+@Builder function overBuilder2(param: GlobalTmp2, num: SecondTmp) {
+ Column() {
+ Text(`strValue: ${param.strValue}`)
+ Text(`num: ${num.numValue}`)
+ }
+}
+
+@Entry
+@Component
+struct Parent2 {
+ @State strParam: GlobalTmp2 = new GlobalTmp2();
+ @State numParam: SecondTmp = new SecondTmp();
+ build() {
+ Column() {
+ Text('UI Rendered via @Builder')
+ .fontSize(20)
+ // 使用了两个参数,用法错误。
+ overBuilder2({strValue: this.strParam.strValue}, {numValue: this.numParam.numValue})
+ Line()
+ .width('100%')
+ .height(10)
+ .backgroundColor('#000000').margin(10)
+ Button('Update Values').onClick(() => {
+ this.strParam.strValue = 'Hello World';
+ this.numParam.numValue = 1;
+ })
+ }
+ }
+}
+// [End multiple_parameters_in_builder_incorrect_usage_2]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/NestedBuilderFunctions.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/NestedBuilderFunctions.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b4711492e0feb2bbf8b9566d87d62d76dd14f44f
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/NestedBuilderFunctions.ets
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start nested_builder_functions]
+class ThisTmp {
+ public paramA1: string = '';
+}
+
+@Builder
+function parentBuilder($$: ThisTmp) {
+ Row() {
+ Column() {
+ Text(`parentBuilder===${$$.paramA1}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ HelloComponent({ message: $$.paramA1 })
+ childBuilder({ paramA1: $$.paramA1 })
+ }
+ }
+}
+
+@Component
+struct HelloComponent {
+ @Prop message: string = '';
+
+ build() {
+ Row() {
+ Text(`HelloComponent===${this.message}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ }
+ }
+}
+
+@Builder
+function childBuilder($$: ThisTmp) {
+ Row() {
+ Column() {
+ Text(`childBuilder===${$$.paramA1}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ HelloChildComponent({ message: $$.paramA1 })
+ grandsonBuilder({ paramA1: $$.paramA1 })
+ }
+ }
+}
+
+@Component
+struct HelloChildComponent {
+ @Prop message: string = '';
+
+ build() {
+ Row() {
+ Text(`HelloChildComponent===${this.message}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ }
+ }
+}
+
+@Builder
+function grandsonBuilder($$: ThisTmp) {
+ Row() {
+ Column() {
+ Text(`grandsonBuilder===${$$.paramA1}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ HelloGrandsonComponent({ message: $$.paramA1 })
+ }
+ }
+}
+
+@Component
+struct HelloGrandsonComponent {
+ @Prop message: string;
+
+ build() {
+ Row() {
+ Text(`HelloGrandsonComponent===${this.message}`)
+ .width(300)
+ .height(40)
+ .margin(10)
+ .backgroundColor('#0d000000')
+ .fontColor('#e6000000')
+ .borderRadius(20)
+ .textAlign(TextAlign.Center)
+ }
+ }
+}
+
+@Entry
+@Component
+struct ParentExample {
+ @State label: string = 'Hello';
+
+ build() {
+ Column() {
+ parentBuilder({ paramA1: this.label })
+ Button('Click me').onClick(() => {
+ this.label = 'ArkUI';
+ })
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
+// [End nested_builder_functions]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/OutsideCorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/OutsideCorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cae7a38bf8fe3ae4128d381f1a8a3f9fddd33e8f
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/OutsideCorrectUsage.ets
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start calling_builder_outside_correct_usage]
+@Entry
+@Component
+struct BackGround2 {
+ @Builder
+ myImages() {
+ Column() {
+ Image($r('app.media.startIcon')).width('100%').height('100%')
+ }
+ }
+
+ @Builder
+ myImages2() {
+ Column() {
+ Image($r('app.media.startIcon')).width('100%').height('100%')
+ }
+ }
+
+ @State bgColor: ResourceColor = Color.Orange;
+ @State bgColor2: ResourceColor = Color.Orange;
+ @State index: number = 0;
+
+ build() {
+ Column({ space: 10 }) {
+ Text('1').width(100).height(50)
+ Text('2').width(100).height(50).background(this.myImages) // 直接传递@Builder方法
+ Text('3').width(100).height(50).background(this.myImages()) // 直接调用@Builder方法
+
+ Text('4-1').width(100).height(50).fontColor(this.bgColor)
+ Text('5-1').width(100).height(50)
+ Text('4-2').width(100).height(50)
+ Text('5-2').width(100).height(50)
+ Stack() {
+ Column() {
+ Text('Vsync2')
+ }
+ .size({ width: '100%', height: '100%' })
+ .border({ width: 1, color: Color.Black })
+ }
+ .size({ width: 100, height: 80 })
+ .backgroundColor('#ffbbd4bb')
+
+ Button('change').onClick((event: ClickEvent) => {
+ this.index = 1;
+ this.bgColor = Color.Red;
+ this.bgColor2 = Color.Red;
+ })
+ }
+ .margin(10)
+ }
+}
+// [End calling_builder_outside_correct_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/OutsideIncorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/OutsideIncorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5b54a54eacd0684878d877eac7ef9eed041a3b13
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/OutsideIncorrectUsage.ets
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start calling_builder_outside_incorrect_usage]
+@Entry
+@Component
+struct BackGround1 {
+ @Builder
+ myImages() {
+ Column() {
+ // 从应用media目录加载名为startIcon的图像资源。此处'app.media.startIcon'仅作示例,请开发者自行替换。
+ Image($r('app.media.startIcon')).width('100%').height('100%')
+ }
+ };
+
+ @Builder
+ myImages2() {
+ Column() {
+ Image($r('app.media.startIcon')).width('100%').height('100%')
+ }
+ };
+
+ private bgList: Array =[this.myImages(), this.myImages2()]; // 错误用法,应避免在UI方法外调用@Builder方法
+
+ @State bgBuilder: CustomBuilder = this.myImages(); // 错误用法,应避免在UI方法外调用@Builder方法
+ @State bgColor: ResourceColor = Color.Orange;
+ @State bgColor2: ResourceColor = Color.Orange;
+ @State index: number = 0;
+
+ build() {
+ Column({space: 10}) {
+ Text('1').width(100).height(50)
+ Text('2').width(100).height(50)
+ Text('3').width(100).height(50)
+
+ Text('4-1').width(100).height(50).fontColor(this.bgColor)
+ Text('5-1').width(100).height(50)
+ Text('4-2').width(100).height(50)
+ Text('5-2').width(100).height(50)
+ Stack() {
+ Column(){
+ Text('Vsync2')
+ }
+ .size({ width: '100%', height: '100%' })
+ .border({ width: 1, color: Color.Black })
+ }
+ .size({ width: 100, height: 80 })
+ .backgroundColor('#ffbbd4bb')
+
+ Button('change').onClick((event: ClickEvent) => {
+ this.index = 1;
+ this.bgColor = Color.Red;
+ this.bgColor2 = Color.Red;
+ })
+ }
+ .margin(10)
+ }
+}
+// [End calling_builder_outside_incorrect_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ParameterReference.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ParameterReference.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c3e857b3cfb9b07a22ed9beeb068e09e5c482c83
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ParameterReference.ets
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start by_reference_parameter_passing]
+class Tmp {
+ public paramA1: string = '';
+}
+
+@Builder
+function overBuilderByReference(params: Tmp) {
+ Row() {
+ Text(`UseStateVarByReference: ${params.paramA1} `)
+ }
+}
+
+@Entry
+@Component
+struct ParameterReference {
+ @State label: string = 'Hello';
+
+ build() {
+ Column() {
+ // 在父组件中调用overBuilderByReference组件时,
+ // 把this.label通过引用传递的方式传给overBuilderByReference组件。
+ overBuilderByReference({ paramA1: this.label })
+ Button('Click me').onClick(() => {
+ // 单击Click me后,UI文本从Hello更改为ArkUI。
+ this.label = 'ArkUI';
+ })
+ }
+ }
+}
+// [End by_reference_parameter_passing]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ParameterValue.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ParameterValue.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a6cd7315e17183096a6e69dc34afe86fed8574f4
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/ParameterValue.ets
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start by_value_parameter_passing]
+@Builder
+function overBuilderByValue(paramA1: string) {
+ Row() {
+ Text(`UseStateVarByValue: ${paramA1} `)
+ }
+}
+
+@Entry
+@Component
+struct ParameterValue {
+ @State label: string = 'Hello';
+
+ build() {
+ Column() {
+ overBuilderByValue(this.label)
+ }
+ }
+}
+// [End by_value_parameter_passing]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/PrivateCustomConstructor.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/PrivateCustomConstructor.ets
new file mode 100644
index 0000000000000000000000000000000000000000..02452c46c389fdf24af1f97ebebcc6e3e512d3cf
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/PrivateCustomConstructor.ets
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start private_custom_constructor]
+@Entry
+@Component
+struct BuilderDemo {
+ @Builder
+ showTextBuilder() {
+ // @Builder装饰此函数,使其能以链式调用的方式配置并构建Text组件
+ Text('Hello World')
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+ }
+
+ @Builder
+ showTextValueBuilder(param: string) {
+ Text(param)
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+ }
+
+ build() {
+ Column() {
+ // 无参数
+ this.showTextBuilder()
+ // 有参数
+ this.showTextValueBuilder('Hello @Builder')
+ }
+ }
+}
+// [End private_custom_constructor]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/WatchCorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/WatchCorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a923997dde64a49ba3416477ce2c24d55098f2d8
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/WatchCorrectUsage.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start executing_builder_function_watch_correct_usage]
+@Entry
+@Component
+struct Child2 {
+ @Provide @Watch('provideWatch') content: string = 'Index: hello world';
+
+ @Builder
+ watchBuilder(content: string) {
+ Row() {
+ Text(`${content}`)
+ }
+ }
+
+ provideWatch() {
+ console.info(`content value has changed.`);
+ }
+
+ build() {
+ Column() {
+ Button(`content value: ${this.content}`)
+ .onClick(() => {
+ this.content += '_world';
+ })
+ this.watchBuilder(this.content);
+ }
+ }
+}
+// [End executing_builder_function_watch_correct_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/WatchIncorrectUsage.ets b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/WatchIncorrectUsage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..67432387d2a27c199b99aa90d52b183cceb8b8ba
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/ets/pages/WatchIncorrectUsage.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start executing_builder_function_watch_incorrect_usage]
+@Entry
+@Component
+struct Child1 {
+ @Provide @Watch('provideWatch') content: string = 'Index: hello world';
+
+ @Builder
+ watchBuilder(content: string) {
+ Row() {
+ Text(`${content}`)
+ }
+ }
+
+ provideWatch() {
+ this.watchBuilder(this.content); // 错误写法,在@Watch函数中使用@Builder函数
+ }
+
+ build() {
+ Column() {
+ Button(`content value: ${this.content}`)
+ .onClick(() => {
+ this.content += '_world';
+ })
+ this.watchBuilder(this.content);
+ }
+ }
+}
+// [End executing_builder_function_watch_incorrect_usage]
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/module.json5 b/ArkUIKit/BuilderComponent/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..8563bfc20490e818aafbf09c5325fef3d30fcff0
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/module.json5
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "ohos.want.action.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/color.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/float.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..a0a93dd91fd48f08f3a9532c76e9b26e68d4c034
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/string.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..a04bb0a32221006af63c50537fd40e46aa3cb842
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,128 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "ButtonTwo",
+ "value": "Global custom constructor"
+ },
+ {
+ "name": "ButtonOne",
+ "value": "Private custom constructor"
+ },
+ {
+ "name": "ButtonThree",
+ "value": "Parameter passing by value"
+ },
+ {
+ "name": "ButtonFour",
+ "value": "Using custom builder function in custom component"
+ },
+ {
+ "name": "ButtonFive",
+ "value": "Global custom builder function"
+ },
+ {
+ "name": "ButtonSix",
+ "value": "Changing the variables decorated by the decorator triggers ui rerendering"
+ },
+ {
+ "name": "ButtonSeven",
+ "value": "Using a function decorated with @Builder as custombuilder"
+ },
+ {
+ "name": "ButtonEight",
+ "value": "Nested @Builder functions"
+ },
+ {
+ "name": "ButtonNine",
+ "value": "@Builder function combined with the V2 decorator"
+ },
+ {
+ "name": "ButtonTen",
+ "value": "@Builder function combined with the V2 decorator and @Local"
+ },
+ {
+ "name": "ButtonEleven",
+ "value": "Global @Builder reused across components"
+ },
+ {
+ "name": "ButtonTwelve",
+ "value": "@Builder supports state variable refresh"
+ },
+ {
+ "name": "ButtonThirteen",
+ "value": "Multiple parameters in @Builder [Incorrect Usage 1]"
+ },
+ {
+ "name": "ButtonFourteen",
+ "value": "Multiple parameters in @Builder [Incorrect Usage 2]"
+ },
+ {
+ "name": "ButtonFifteen",
+ "value": "Multiple parameters in @Builder [Correct Usage]"
+ },
+ {
+ "name": "ButtonSixteen",
+ "value": "Dynamic rerendering with @ComponentV2 [Incorrect Usage]"
+ },
+ {
+ "name": "ButtonSeventeen",
+ "value": "Dynamic rerendering with @ComponentV2 [Correct Usage]"
+ },
+ {
+ "name": "ButtonEighteen",
+ "value": "Component creation in @Builder prevents parameter update propagation [Incorrect Usage]"
+ },
+ {
+ "name": "ButtonNineteen",
+ "value": "Component creation in @Builder prevents parameter update propagation [Correct Usage]"
+ },
+ {
+ "name": "ButtonTwenty",
+ "value": "Calling the @Builder function or method outside the UI statement affects the normal refresh of nodes [Incorrect Usage]"
+ },
+ {
+ "name": "ButtonTwentyOne",
+ "value": "Calling the @Builder function or method outside the UI statement affects the normal refresh of nodes [Correct Usage]"
+ },
+ {
+ "name": "ButtonTwentyTwo",
+ "value": "MutableBinding not passed to the set accessor in the @Builder method [Incorrect Usage]"
+ },
+ {
+ "name": "ButtonTwentyThree",
+ "value": "MutableBinding not passed to the set accessor in the @Builder method [Correct Usage]"
+ },
+ {
+ "name": "ButtonTwentyFour",
+ "value": "Changing the input parameters in the @Builder decorated function [Incorrect Usage]"
+ },
+ {
+ "name": "ButtonTwentyFive",
+ "value": "Changing the input parameters in the @Builder decorated function [Correct Usage]"
+ },
+ {
+ "name": "ButtonTwentySix",
+ "value": "Executing the @Builder function in the @Watch function [Incorrect Usage]"
+ },
+ {
+ "name": "ButtonTwentySeven",
+ "value": "Executing the @Builder function in the @Watch function [Correct Usage]"
+ },
+ {
+ "name": "ButtonTwentyEight",
+ "value": "Parameter passing by reference"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/background.png b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/foreground.png b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f
Binary files /dev/null and b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/layered_image.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/startIcon.png b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/profile/backup_config.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..70109694c1c4303d8d73a1f776ac26ced7d95967
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,33 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/PrivateCustomConstructor",
+ "pages/GlobalCustomConstructor",
+ "pages/ParameterValue",
+ "pages/ParameterReference",
+ "pages/InCustomComponent",
+ "pages/GlobalCustomBuilder",
+ "pages/ChangingByDecorator",
+ "pages/AsCustomBuilder",
+ "pages/NestedBuilderFunctions",
+ "pages/BuilderCombined",
+ "pages/BuilderCombinedLocal",
+ "pages/AcrossComponents",
+ "pages/BuilderSupports",
+ "pages/MultipleIncorrectUsage1",
+ "pages/MultipleIncorrectUsage2",
+ "pages/MultipleCorrectUsage",
+ "pages/DynamicIncorrectUsage",
+ "pages/DynamicCorrectUsage",
+ "pages/BuilderIncorrectUsage",
+ "pages/BuilderCorrectUsage",
+ "pages/OutsideIncorrectUsage",
+ "pages/OutsideCorrectUsage",
+ "pages/AccessorIncorrectUsage",
+ "pages/AccessorCorrectUsage",
+ "pages/ChangingIncorrectUsage",
+ "pages/ChangingCorrectUsage",
+ "pages/WatchIncorrectUsage",
+ "pages/WatchCorrectUsage"
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/dark/element/color.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/resources/zh_CN/element/string.json b/ArkUIKit/BuilderComponent/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..002f11e0083b9aa9e0f8372a742a4669fa6ba90c
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,128 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "ButtonOne",
+ "value": "私有自定义构建函数"
+ },
+ {
+ "name": "ButtonTwo",
+ "value": "全局自定义构建函数"
+ },
+ {
+ "name": "ButtonThree",
+ "value": "按值传递参数"
+ },
+ {
+ "name": "ButtonFour",
+ "value": "自定义组件内使用自定义构建函数"
+ },
+ {
+ "name": "ButtonFive",
+ "value": "全局自定义构建函数"
+ },
+ {
+ "name": "ButtonSix",
+ "value": "修改装饰器修饰的变量触发UI刷新"
+ },
+ {
+ "name": "ButtonSeven",
+ "value": "将@Builder装饰的函数当作CustomBuilder类型使用"
+ },
+ {
+ "name": "ButtonEight",
+ "value": "多层@Builder函数嵌套"
+ },
+ {
+ "name": "ButtonNine",
+ "value": "@Builder函数联合V2装饰器"
+ },
+ {
+ "name": "ButtonTen",
+ "value": "@Builder函数联合V2装饰器,若参数为@Local装饰的对象"
+ },
+ {
+ "name": "ButtonEleven",
+ "value": "跨组件复用的全局@Builder"
+ },
+ {
+ "name": "ButtonTwelve",
+ "value": "@Builder支持状态变量刷新"
+ },
+ {
+ "name": "ButtonThirteen",
+ "value": "@Builder存在两个或两个以上参数【反例1】"
+ },
+ {
+ "name": "ButtonFourteen",
+ "value": "@Builder存在两个或两个以上参数【反例2】"
+ },
+ {
+ "name": "ButtonFifteen",
+ "value": "@Builder存在两个或两个以上参数【正例】"
+ },
+ {
+ "name": "ButtonSixteen",
+ "value": "使用@ComponentV2装饰器触发动态刷新【反例】"
+ },
+ {
+ "name": "ButtonSeventeen",
+ "value": "使用@ComponentV2装饰器触发动态刷新【正例】"
+ },
+ {
+ "name": "ButtonEighteen",
+ "value": "在@Builder内创建自定义组件传递参数不刷新问题【反例】"
+ },
+ {
+ "name": "ButtonNineteen",
+ "value": "在@Builder内创建自定义组件传递参数不刷新问题【正例】"
+ },
+ {
+ "name": "ButtonTwenty",
+ "value": "在UI语句外调用@Builder函数或方法影响节点正常刷新【反例】"
+ },
+ {
+ "name": "ButtonTwentyOne",
+ "value": "在UI语句外调用@Builder函数或方法影响节点正常刷新【正例】"
+ },
+ {
+ "name": "ButtonTwentyTwo",
+ "value": "在@Builder方法中使用MutableBinding未传递set访问器【反例】"
+ },
+ {
+ "name": "ButtonTwentyThree",
+ "value": "在@Builder方法中使用MutableBinding未传递set访问器【正例】"
+ },
+ {
+ "name": "ButtonTwentyFour",
+ "value": "在@Builder装饰的函数内部修改入参内容【反例】"
+ },
+ {
+ "name": "ButtonTwentyFive",
+ "value": "在@Builder装饰的函数内部修改入参内容【正例】"
+ },
+ {
+ "name": "ButtonTwentySix",
+ "value": "在@Watch函数中执行@Builder函数【反例】"
+ },
+ {
+ "name": "ButtonTwentySeven",
+ "value": "在@Watch函数中执行@Builder函数【正例】"
+ },
+ {
+ "name": "ButtonTwentyEight",
+ "value": "按引用传递参数"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/main/syscap.json b/ArkUIKit/BuilderComponent/entry/src/main/syscap.json
new file mode 100644
index 0000000000000000000000000000000000000000..1f94672e471ff27a6714c57c36eb1bff50e35ce7
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/main/syscap.json
@@ -0,0 +1,14 @@
+{
+ "devices": {
+ "general": [
+ "default"
+ ],
+ "custom": [
+ {
+ "xts": [
+ "SystemCapability.ArkUI.ArkUI.Full"
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/ohosTest/ets/test/List.test.ets b/ArkUIKit/BuilderComponent/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..8128b4f715ff9489e5e2d530404cab5c0ed3e67a
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import BuilderGuidesTest from './BuilderGuidesTest.test';
+
+export default function testsuite() {
+ BuilderGuidesTest();
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ArkUIKit/BuilderComponent/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6547893c4245b9ede642a7309256d016576c6f0c
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+import TestRunner from '@ohos.application.testRunner';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+var abilityDelegator = undefined
+var abilityDelegatorArguments = undefined
+
+async function onAbilityCreateCallback() {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
+}
+
+async function addAbilityMonitorCallback(err: any) {
+ hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
+}
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+ constructor() {
+ }
+
+ onPrepare() {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
+ }
+
+ async onRun() {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
+ globalThis.autoTest = true;
+ abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
+ let lMonitor = {
+ abilityName: testAbilityName,
+ onAbilityCreate: onAbilityCreateCallback,
+ };
+ abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
+ var cmd = 'aa start -d 0 -a EntryAbility' + ' -b ' + abilityDelegatorArguments.bundleName
+ var debug = abilityDelegatorArguments.parameters['-D']
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
+ abilityDelegator.executeShellCommand(cmd,
+ (err: any, d: any) => {
+ hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
+ hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
+ hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
+ })
+ hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
+ }
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/entry/src/ohosTest/module.json5 b/ArkUIKit/BuilderComponent/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..573e674ee5e4933dd48d4f08ccd84e4a948975d6
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/entry/src/ohosTest/module.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ }
+}
diff --git a/ArkUIKit/BuilderComponent/hvigor/hvigor-config.json5 b/ArkUIKit/BuilderComponent/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3b057578a1bb4d591ee53054e39ab0154fc2e43a
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ArkUIKit/BuilderComponent/hvigorfile.ts b/ArkUIKit/BuilderComponent/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae9086af35844176c08f1be3772d081d95d267c6
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/hvigorfile.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/oh-package.json5 b/ArkUIKit/BuilderComponent/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..837c0ff9f35a6bb9eea849fead7955c19bcdec8d
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/oh-package.json5
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{
+ "modelVersion": "6.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.24",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkUIKit/BuilderComponent/ohosTest.md b/ArkUIKit/BuilderComponent/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..f7874206c1de01ffd47ce37c800ed2d2fa481f05
--- /dev/null
+++ b/ArkUIKit/BuilderComponent/ohosTest.md
@@ -0,0 +1,4 @@
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 测试结果 |
+|-------------| ------------ |-----------|------------------| -------- |
+| 私有自定义构建函数 | 设备正常运行 | 点击"私有自定义构建函数" | 页面和私有自定义构建文本组件创建成功 | Pass |
+| 全局自定义构建函数 | 设备正常运行 | 点击"全局自定义构建函数" | 页面和全局自定义构建文本组件创建成功 | Pass |
\ No newline at end of file
diff --git a/ArkUIKit/BuilderComponent/screenshots/Index1.png b/ArkUIKit/BuilderComponent/screenshots/Index1.png
new file mode 100644
index 0000000000000000000000000000000000000000..5c534c93b45ae72127a0373742baa99354f601f3
Binary files /dev/null and b/ArkUIKit/BuilderComponent/screenshots/Index1.png differ
diff --git a/ArkUIKit/BuilderComponent/screenshots/Index2.png b/ArkUIKit/BuilderComponent/screenshots/Index2.png
new file mode 100644
index 0000000000000000000000000000000000000000..235aa06b6aeb7e527ef94e0f7fa2817b41a760c6
Binary files /dev/null and b/ArkUIKit/BuilderComponent/screenshots/Index2.png differ