@hmos-library-adapter/fast 0.0.17-beta.0 → 0.0.17-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@hmos-library-adapter/executer/README.md +2 -2
- package/node_modules/@hmos-library-adapter/executer/shared/skill-map.json +5 -1
- package/node_modules/@hmos-library-adapter/executer/shared/skills/arkts-rules/SKILL.md +400 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/CHANGELOG.md +1391 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/COMPATIBILITY.md +53 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/README.md +123 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/SKILL.md +48 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/agents/upgrade-assess-change.md +37 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/agents/upgrade-fix-file.md +23 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/package.json +19 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/26.0.0/beta1-changes-for-all-apps.md +1793 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/26.0.0/beta1-ux-style-and-effect-changes.md +288 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/26.0.0/beta2-changes-for-all-apps.md +148 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/26.0.0/release-changes-for-all-apps.md +662 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.1(13)/beta3-os-api-behavior-changes.md +652 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.1(13)/beta3-ux-style-and-effect-changes.md +222 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.1(13)/release-os-api-behavior-changes.md +444 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.1(13)/release-ux-style-and-effect-changes.md +221 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.2(14)/os-api-behavior-changes.md +1767 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.2(14)/ux-style-and-effect-changes.md +134 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.3(15)/beta1-os-api-behavior-changes.md +430 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.3(15)/beta1-ux-style-and-effect-changes.md +49 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.3(15)/beta2-os-api-behavior-changes.md +240 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.3(15)/beta2-ux-style-and-effect-changes.md +90 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.0.3(15)/release-os-api-behavior-changes.md +69 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.1.0(18)/os-api-behavior-changes.md +1294 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/5.1.0(18)/ux-style-and-effect-changes.md +147 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/6.0.0(20)/beta1-os-api-behavior-changes.md +1019 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/6.0.0(20)/beta1-ux-style-and-effect-changes.md +153 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/6.0.0(20)/beta2-os-api-behavior-changes.md +662 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/6.0.0(20)/beta2-ux-style-and-effect-changes.md +78 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/6.0.0(20)/beta3-os-api-behavior-changes.md +167 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/6.0.0(20)/beta5-os-api-behavior-changes.md +52 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs/6.1.0(23)/changes-for-all-apps.md +397 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/changelogs-index.json +883 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/arkts-coding-standards.md +53 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/compatibility.md +207 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/native-adaptation.md +21 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/runtime-functional-tests.md +62 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/sdk-versions.md +77 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/troubleshooting.md +54 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/verification.md +79 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/common/workflow-scan.md +41 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/deprecated/context-migration.md +274 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/deprecated/deprecated-api-adaptation.md +157 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/deprecated/deprecated-api-examples.md +219 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/toolchain/hvigor.md +50 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/upgrade/har-upgrade.md +60 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/upgrade/scanner-missed-cases.md +171 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/upgrade/upgrade-compatibility.md +112 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/upgrade/upgrade-examples.md +289 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/references/upgrade/upgrade-workflow.md +122 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/references/generate-behavior-policy.mjs +96 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/references/references.mjs +9 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/regression/compare-deprecated.mjs +57 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/regression/compare-golden.mjs +130 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/regression/regress-deprecated.mjs +120 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/behavior-catalog-generation.test.mjs +59 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/behavior-local-sources.test.mjs +44 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/changelog-index.test.mjs +66 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/compare-golden.test.mjs +103 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/fixtures/behavior/local-sources.csv +5 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/references.test.mjs +16 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/skill-content.test.mjs +139 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/skill-frontmatter.test.mjs +11 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/test/test-suite.test.mjs +65 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/validation/skill-content.mjs +125 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/validation/skill-frontmatter.mjs +6 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/maintenance/validation/validate-skill.mjs +57 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/CHANGELOG.md +506 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/GOLDEN_VALIDATION.md +42 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/README.md +137 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/behavior/behavior-policy.mjs +117 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/behavior/upgrade-coverage.mjs +29 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/bin/deveco-worker-compat.cjs +21 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/bin/harmony-api-scan.mjs +17 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/core/cli.mjs +416 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/core/deveco.mjs +348 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/core/project.mjs +81 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/core/rules.mjs +425 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/core/runtime-identity.mjs +23 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/core/scan-runner.mjs +521 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/core/sdk-deprecations.mjs +204 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/data/behavior-change-policy.json +4378 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/deprecated/arkts-deprecations.mjs +363 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/deprecated/build-log.mjs +72 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/native/native.mjs +95 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/package.json +16 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/batch-layout.test.mjs +94 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/behavior-policy.test.mjs +75 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/build-log.test.mjs +69 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/cli.test.mjs +102 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/csv.test.mjs +35 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/deprecations.test.mjs +283 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/deveco.test.mjs +262 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/helpers/scan-batch.mjs +10 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/native.test.mjs +108 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/project.test.mjs +42 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/rules.test.mjs +190 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/runtime-identity.test.mjs +53 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/scan-mode.test.mjs +38 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/scan-runner.test.mjs +481 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/scan-scope.test.mjs +110 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/source-inputs.test.mjs +64 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/scanner/test/upgrade.test.mjs +164 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/format/args.mjs +66 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/format/csv.mjs +85 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/format/json5.mjs +92 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/format/upgrade-results.mjs +45 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/format/zip.mjs +87 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/io/fs-utils.mjs +60 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/artifact-layout.mjs +74 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/changelog-index.mjs +29 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/deveco-version.mjs +40 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/document-links.mjs +30 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/errors.mjs +41 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/fs.mjs +72 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/paths.mjs +34 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/process.mjs +154 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/scan-mode.mjs +7 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/scan-statistics.mjs +7 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/scan-version-catalog.json +43 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/scan-versions.mjs +51 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/sdk-layout.mjs +27 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/source-scope.mjs +108 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/source-types.mjs +7 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/platform/version.mjs +76 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/deveco-version.test.mjs +50 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/document-links.test.mjs +13 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/errors.test.mjs +40 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/fs-utils.test.mjs +31 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/platform-paths.test.mjs +19 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/process-utils.test.mjs +68 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/scan-versions.test.mjs +26 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/sdk-version.test.mjs +17 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/shared/test/upgrade-results.test.mjs +140 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/scripts/test-suite.mjs +29 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/templates/deprecated-report.md +86 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/templates/progress.md +150 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/templates/results.md +110 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/templates/upgrade-report.md +105 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/templates/upgrade-spec.md +58 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-api-upgrade-adapter/templates/upgrade-test-report.md +47 -0
- package/node_modules/@hmos-library-adapter/executer/shared/skills/harmonyos-knowledge/SKILL.md +70 -0
- package/node_modules/@hmos-library-adapter/executer/src/config.js +3 -4
- package/node_modules/@hmos-library-adapter/executer/src/doctor.js +1 -1
- package/node_modules/@hmos-library-adapter/executer/src/install.js +1 -1
- package/node_modules/@hmos-library-adapter/executer/src/paths.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,1793 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 针对所有应用的变更
|
|
3
|
+
source: https://developer.huawei.com/consumer/cn/doc/harmonyos-releases/changelogs-for-all-apps-7001
|
|
4
|
+
category: harmonyos-releases
|
|
5
|
+
downloaded_at: 2026-09-03
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 针对所有应用的变更
|
|
9
|
+
|
|
10
|
+
## Ability Kit
|
|
11
|
+
|
|
12
|
+
### 部分公共事件行为变更,增加管控
|
|
13
|
+
|
|
14
|
+
**变更原因**
|
|
15
|
+
|
|
16
|
+
Ability Kit部分公共事件中包含应用信息,存在信息泄露的安全风险,需要增加管控。
|
|
17
|
+
|
|
18
|
+
**变更影响**
|
|
19
|
+
|
|
20
|
+
此变更涉及应用适配。
|
|
21
|
+
|
|
22
|
+
**说明**
|
|
23
|
+
|
|
24
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
25
|
+
|
|
26
|
+
对于公共事件[COMMON\_EVENT\_PACKAGE\_ADDED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_added)、[COMMON\_EVENT\_PACKAGE\_REMOVED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_removed)、[COMMON\_EVENT\_PACKAGE\_CHANGED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_changed)、[COMMON\_EVENT\_PACKAGE\_CACHE\_CLEARED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_cache_cleared)的订阅方增加了管控。
|
|
27
|
+
|
|
28
|
+
- 变更前:系统应用和三方应用都可以监听到In-House应用相关事件。
|
|
29
|
+
|
|
30
|
+
- 变更后:系统应用可以监听In-House应用的相关事件,API版本26.0.0以下三方应用仍然可以监听In-House应用的相关事件,API版本26.0.0及以上三方应用如需监听In-House应用的相关事件则需要对应的In-House应用在app.json5的[allowListenBundleChangedEvent](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/app-configuration-file#配置文件标签)中配置本应用的[appIdentifier](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/common-problem-of-application#什么是appidentifier)。
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
**起始 API Level**
|
|
34
|
+
|
|
35
|
+
9
|
|
36
|
+
|
|
37
|
+
**变更的接口/组件**
|
|
38
|
+
|
|
39
|
+
变更的公共事件列表:
|
|
40
|
+
|
|
41
|
+
| 事件名称 | 描述 |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| [COMMON_EVENT_PACKAGE_ADDED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_added) | 应用安装完成的事件。 |
|
|
44
|
+
| [COMMON_EVENT_PACKAGE_REMOVED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_removed) | 应用卸载完成的事件。 |
|
|
45
|
+
| [COMMON_EVENT_PACKAGE_CHANGED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_changed) | 应用更新完成的事件。 |
|
|
46
|
+
| [COMMON_EVENT_PACKAGE_CACHE_CLEARED](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/commoneventmanager-definitions#common_event_package_cache_cleared) | 应用缓存数据清理完成的事件。 |
|
|
47
|
+
|
|
48
|
+
**适配指导**
|
|
49
|
+
|
|
50
|
+
API版本26.0.0及以上的三方应用如需监听In-House应用的相关事件,需要对应的In-House应用在app.json5的[allowListenBundleChangedEvent](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/app-configuration-file)中配置本应用的[appIdentifier](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/common-problem-of-application#什么是appidentifier)。
|
|
51
|
+
|
|
52
|
+
## ArkTS
|
|
53
|
+
|
|
54
|
+
### JSVM基于上游社区的Chromium/v8内核从132升级为144版本
|
|
55
|
+
|
|
56
|
+
**变更原因**
|
|
57
|
+
|
|
58
|
+
为了提升使用JSVM应用的安全性,为开发者提供最新的W3C HTML5特性,Chromium上游社区从133到144版本共发布300+项特性,带来了更多W3C特性、安全、性能、稳定性的提升,故本次进行内核升级 (132 -> 144)。
|
|
59
|
+
|
|
60
|
+
**变更影响**
|
|
61
|
+
|
|
62
|
+
从上游社区300+ issue说明、社区5000+ ReleaseNotes以及JSVM xts/tdd用例测试,当前共发现38项需要开发者注意的变更点,请参考[JSVM 132 内核升级 144 内核版本差异总结](https://gitcode.com/openharmony/arkcompiler_jsvm/blob/master/ReleaseNote/JSVM_132_144.md)。
|
|
63
|
+
|
|
64
|
+
**起始 API Level**
|
|
65
|
+
|
|
66
|
+
不涉及
|
|
67
|
+
|
|
68
|
+
**变更的接口/组件**
|
|
69
|
+
|
|
70
|
+
ArkTS/JSVM
|
|
71
|
+
|
|
72
|
+
**适配指导**
|
|
73
|
+
|
|
74
|
+
如果在应用中使用Web组件展示网页内容,则需要遵循[JSVM 132 内核升级 144 内核版本差异总结](https://gitcode.com/openharmony/arkcompiler_jsvm/blob/master/ReleaseNote/JSVM_132_144.md)中所涉及的最新W3C规格变更。
|
|
75
|
+
|
|
76
|
+
### async函数类型判定修复
|
|
77
|
+
|
|
78
|
+
**变更原因**
|
|
79
|
+
|
|
80
|
+
在类中getter/setter之后定义的async函数,实际被初始化的类型为普通函数,导致无法在运行时正确地判定函数类型。
|
|
81
|
+
|
|
82
|
+
**变更影响**
|
|
83
|
+
|
|
84
|
+
1. 由于async的行为并不依赖函数类型,而是通过特定的字节码实现的,此变更前后async的语义均无问题。
|
|
85
|
+
|
|
86
|
+
2. 该变更会修复在运行时对async函数进行的类型判定,具体行为变化如下:
|
|
87
|
+
|
|
88
|
+
变更前:
|
|
89
|
+
|
|
90
|
+
在类中getter/setter(@State变量经过编译也会在TS中生成对应的getter/setter)之后定义的async函数:
|
|
91
|
+
|
|
92
|
+
1. new util.types().isAsyncFunction 判断为false。
|
|
93
|
+
2. (async () => {}).constructor.name 的结果为:"Function"。
|
|
94
|
+
3. worker通过callGlobalCallObjectMethod调用返回的错误码及错误信息为:"10200006 An exception occurred during serialization"。
|
|
95
|
+
|
|
96
|
+
变更后:
|
|
97
|
+
|
|
98
|
+
在类中getter/setter(@State变量经过编译也会在TS中生成对应的getter/setter)之后定义的async函数:
|
|
99
|
+
|
|
100
|
+
1. new util.types().isAsyncFunction 判断为true。
|
|
101
|
+
2. (async () => {}).constructor.name 的结果为:"AsyncFunction"。
|
|
102
|
+
3. worker通过callGlobalCallObjectMethod调用返回的错误码及错误信息为:"10200020 The method to be called is not callable or is an async method or a generator"。
|
|
103
|
+
|
|
104
|
+
具体的代码示例如下:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { util } from '@kit.ArkTS';
|
|
108
|
+
|
|
109
|
+
class Model {
|
|
110
|
+
// 在类中getter setter之前定义的async function,类型正确。
|
|
111
|
+
async testFunction1() {}
|
|
112
|
+
get id() { return 1 }
|
|
113
|
+
set id(id) {}
|
|
114
|
+
// 在类中getter setter之后定义的async function,类型不正确,应当为AsyncFunction,实际为普通Function。
|
|
115
|
+
async testFunction2() {}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@Entry
|
|
119
|
+
@Component
|
|
120
|
+
struct Index {
|
|
121
|
+
// 在类中getter setter之前定义的async function,类型正确。
|
|
122
|
+
async testFunction1() {}
|
|
123
|
+
// 经过编译也会生成getter setter
|
|
124
|
+
@State message: string = 'Hello World';
|
|
125
|
+
// 在类中getter setter之后定义的async function,类型不正确,应当为AsyncFunction,实际为普通Function。
|
|
126
|
+
async testFunction2() {}
|
|
127
|
+
build() {
|
|
128
|
+
RelativeContainer() {
|
|
129
|
+
Text(this.message)
|
|
130
|
+
.onClick(() => {
|
|
131
|
+
let model: Model = new Model();
|
|
132
|
+
let type = new util.types();
|
|
133
|
+
|
|
134
|
+
// 输出true,行为是正确的,该变更无影响。
|
|
135
|
+
console.info(`${type.isAsyncFunction(this.testFunction1)}`);
|
|
136
|
+
console.info(`${type.isAsyncFunction(model.testFunction1)}`);
|
|
137
|
+
// 输出AsyncFunction,行为是正确的,该变更无影响。
|
|
138
|
+
console.info(this.testFunction1.constructor.name);
|
|
139
|
+
console.info(model.testFunction1.constructor.name);
|
|
140
|
+
|
|
141
|
+
// 输出false,变更后输出true。
|
|
142
|
+
console.info(`${type.isAsyncFunction(this.testFunction2)}`);
|
|
143
|
+
console.info(`${type.isAsyncFunction(model.testFunction2)}`);
|
|
144
|
+
// 输出Function,变更后输出AsyncFunction。
|
|
145
|
+
console.info(this.testFunction2.constructor.name);
|
|
146
|
+
console.info(model.testFunction2.constructor.name);
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**起始 API Level**
|
|
154
|
+
|
|
155
|
+
API 8
|
|
156
|
+
|
|
157
|
+
**变更的接口/组件**
|
|
158
|
+
|
|
159
|
+
1. new util.types().isAsyncFunction
|
|
160
|
+
2. Function.constructor.name
|
|
161
|
+
|
|
162
|
+
**适配指导**
|
|
163
|
+
|
|
164
|
+
默认行为变更,开发者需排查new util.types().isAsyncFunction和Function.constructor.name的调用点,审视接口输出结果的变化是否对自身相关业务代码逻辑产生影响,若有影响需根据自身业务代码进行相应的适配。
|
|
165
|
+
|
|
166
|
+
### JSVM支持Wasm解释器,jitless默认行为发生变更
|
|
167
|
+
|
|
168
|
+
**变更原因**
|
|
169
|
+
|
|
170
|
+
需要支持jitless条件下执行Wasm能力,支撑坚盾守护模式下特效/直播等业务场景。
|
|
171
|
+
|
|
172
|
+
**变更影响**
|
|
173
|
+
|
|
174
|
+
此变更涉及应用适配。
|
|
175
|
+
|
|
176
|
+
**说明**
|
|
177
|
+
|
|
178
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
179
|
+
|
|
180
|
+
JSVM Wasm相关接口补充了jitless下默认行为,不再返回错误码[JSVM\_JIT\_MODE\_EXPECTED](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-types-h#jsvm_status),Wasm解释器正常运行。
|
|
181
|
+
|
|
182
|
+
变更前:
|
|
183
|
+
|
|
184
|
+
[OH\_JSVM\_CompileWasmModule](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-h#oh_jsvm_compilewasmmodule),返回错误码 [JSVM\_JIT\_MODE\_EXPECTED](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-types-h#jsvm_status),并设置JSVM异常。
|
|
185
|
+
|
|
186
|
+
[OH\_JSVM\_CompileWasmFunction](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-h#oh_jsvm_compilewasmfunction),返回错误码 [JSVM\_JIT\_MODE\_EXPECTED](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-types-h#jsvm_status),并设置JSVM异常。
|
|
187
|
+
|
|
188
|
+
[OH\_JSVM\_CreateWasmCache](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-h#oh_jsvm_createwasmcache),返回错误码 [JSVM\_JIT\_MODE\_EXPECTED](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-types-h#jsvm_status),并设置JSVM异常。
|
|
189
|
+
|
|
190
|
+
变更后:
|
|
191
|
+
|
|
192
|
+
[OH\_JSVM\_CompileWasmModule](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-h#oh_jsvm_compilewasmmodule),WasmCache不生效,其他行为与JIT模式一致。
|
|
193
|
+
|
|
194
|
+
[OH\_JSVM\_CompileWasmFunction](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-h#oh_jsvm_compilewasmfunction),直接返回JSVM\_OK(解释执行不依赖当前接口)。
|
|
195
|
+
|
|
196
|
+
[OH\_JSVM\_CreateWasmCache](http://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-jsvm-h#oh_jsvm_createwasmcache),直接返回JSVM\_OK,并将WasmCache置为空。
|
|
197
|
+
|
|
198
|
+
**起始 API Level**
|
|
199
|
+
|
|
200
|
+
12
|
|
201
|
+
|
|
202
|
+
**变更的接口/组件**
|
|
203
|
+
|
|
204
|
+
ArkTS/JSVM
|
|
205
|
+
|
|
206
|
+
**适配指导**
|
|
207
|
+
|
|
208
|
+
开发者需要检视调用OH\_JSVM\_CompileWasmModule,OH\_JSVM\_CompileWasmFunction,OH\_JSVM\_CreateWasmCache三个接口的代码上下文,判断接口返回值从“返回错误码”变更为“返回JSVM\_OK”对代码逻辑造成的影响,按照代码预期修改代码。
|
|
209
|
+
|
|
210
|
+
### 修复ConvertXML的fastConvertToJSObject接口解析时丢失同级text节点的问题
|
|
211
|
+
|
|
212
|
+
**变更原因**
|
|
213
|
+
|
|
214
|
+
ConvertXML的[fastConvertToJSObject](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-convertxml#fastconverttojsobject14)接口在解析XML时,若XML内容包含子元素、与子元素同级的文本节点,会丢失与子元素同级的文本节点。此变更修复了该问题。
|
|
215
|
+
|
|
216
|
+
**变更影响**
|
|
217
|
+
|
|
218
|
+
此变更涉及应用适配。
|
|
219
|
+
|
|
220
|
+
变更前:fastConvertToJSObject接口在解析XML时,若XML内容包含子元素、与子元素同级的文本节点,会丢失与子元素同级的文本节点。例如解析 <root>text1<child>子元素</child>text2</root> 时,与子元素同级的文本节点"text1"和"text2"会丢失。
|
|
221
|
+
|
|
222
|
+
变更后:fastConvertToJSObject接口在解析XML时,若XML内容包含子元素、与子元素同级的文本节点,会正确保留与子元素同级的文本节点。
|
|
223
|
+
|
|
224
|
+
**起始 API Level**
|
|
225
|
+
|
|
226
|
+
14
|
|
227
|
+
|
|
228
|
+
**变更的接口/组件**
|
|
229
|
+
|
|
230
|
+
fastConvertToJSObject(xml: string, options?: ConvertOptions) : Object;
|
|
231
|
+
|
|
232
|
+
**适配指导**
|
|
233
|
+
|
|
234
|
+
排查应用中是否使用了fastConvertToJSObject接口解析XML内容有包含子元素、与子元素同级的文本节点数据,并检查解析结果是否依赖原有的丢失同级文本节点的行为。
|
|
235
|
+
|
|
236
|
+
例如:
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
import { convertxml } from '@kit.ArkTS';
|
|
240
|
+
|
|
241
|
+
let xml = '<wrapper>前缀文本<child>子内容</child>后缀文本</wrapper>';
|
|
242
|
+
let conv = new convertxml.ConvertXML();
|
|
243
|
+
let result = JSON.stringify(conv.fastConvertToJSObject(xml));
|
|
244
|
+
console.info(result);
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
变更前该用例输出为:
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
{"_elements":[{"_type":"element","_name":"wrapper","_elements":[{"_type":"element","_name":"child","_parent":"wrapper","_elements":[{"_type":"text","_text":"子内容"}]}]}]}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
变更后该用例输出为:
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
{"_elements":[{"_type":"element","_name":"wrapper","_elements":[{"_type":"text","_text":"前缀文本"},{"_type":"element","_name":"child","_parent":"wrapper","_elements":[{"_type":"text","_text":"子内容"}]},{"_type":"text","_text":"后缀文本"}]}]}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
本变更修复该问题,fastConvertToJSObject接口现在能够正确解析并保留与子元素同级的文本节点。
|
|
260
|
+
|
|
261
|
+
## ArkUI
|
|
262
|
+
|
|
263
|
+
### NodeAdapter的onAttachToNode回调触发时机变更
|
|
264
|
+
|
|
265
|
+
**变更原因**
|
|
266
|
+
|
|
267
|
+
NodeAdapter绑定的宿主节点在主树挂载时,ArkTS API会触发onAttachToNode回调,C API会触发OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver绑定的、事件类型为NODE\_APPEAR\_EVENT\_WILL\_ATTACH\_TO\_NODE的回调,与文档描述的在绑定时触发回调的时机不符。
|
|
268
|
+
|
|
269
|
+
**变更影响**
|
|
270
|
+
|
|
271
|
+
**说明**
|
|
272
|
+
|
|
273
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
274
|
+
|
|
275
|
+
变更前:NodeAdapter所绑定的宿主节点上主树时,ArkTS API会触发NodeAdapter的onAttachToNode回调,C API会触发OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver绑定的、事件类型为NODE\_APPEAR\_EVENT\_WILL\_ATTACH\_TO\_NODE的回调。
|
|
276
|
+
|
|
277
|
+
变更后:NodeAdapter被绑定到宿主节点时,ArkTS API触发onAttachToNode的回调,C API触发OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver绑定的、事件类型为NODE\_APPEAR\_EVENT\_WILL\_ATTACH\_TO\_NODE的回调。
|
|
278
|
+
|
|
279
|
+
**起始 API Level**
|
|
280
|
+
|
|
281
|
+
12
|
|
282
|
+
|
|
283
|
+
**变更的接口/组件**
|
|
284
|
+
|
|
285
|
+
[onAttachToNode](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-arkui-framenode#onattachtonode12)
|
|
286
|
+
|
|
287
|
+
[OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-native-node-h#oh_arkui_nodeadapter_registereventreceiver)
|
|
288
|
+
|
|
289
|
+
**适配指导**
|
|
290
|
+
|
|
291
|
+
- onAttachToNode触发时节点未上树
|
|
292
|
+
|
|
293
|
+
在使用[attachNodeAdapter](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-arkui-framenode#attachnodeadapter12)接口为FrameNode绑定NodeAdapter时,节点可能尚未完全挂载。因此,建议在FrameNode绑定NodeAdapter时的onAttachToNode回调中,注册[onAppear](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-events-show-hide#onappear),并将访问布局信息或执行动画等强依赖主树的操作放入其中,避免因节点未上树引发的执行异常。
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
import { NodeAdapter, NodeController, FrameNode, typeNode, UIContext } from '@kit.ArkUI';
|
|
297
|
+
import hilog from '@ohos.hilog';
|
|
298
|
+
|
|
299
|
+
class MyNodeAdapter extends NodeAdapter {
|
|
300
|
+
private rootNode: FrameNode | undefined;
|
|
301
|
+
|
|
302
|
+
setRootNode(node: FrameNode) {
|
|
303
|
+
this.rootNode = node;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// 从API版本26.0.0开始,当NodeAdapter绑定到宿主节点时,会调用如下回调
|
|
307
|
+
onAttachToNode(): void {
|
|
308
|
+
// 适配前:直接在此处执行依赖主树的逻辑,可能因节点未上树引发执行异常
|
|
309
|
+
// this.doWhenNodeAttached();
|
|
310
|
+
|
|
311
|
+
// 适配后:通过onAppear确保节点已挂载
|
|
312
|
+
this.rootNode?.commonEvent.setOnAppear(() => {
|
|
313
|
+
this.doWhenNodeAttached();
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
private doWhenNodeAttached() {
|
|
318
|
+
hilog.info(0x0000, 'testTag', 'Node is now attached to main tree');
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
class MyNodeController extends NodeController {
|
|
323
|
+
private adapter: MyNodeAdapter | undefined;
|
|
324
|
+
|
|
325
|
+
makeNode(uiContext: UIContext): FrameNode | null {
|
|
326
|
+
this.adapter = new MyNodeAdapter();
|
|
327
|
+
const rootNode = typeNode.createNode(uiContext, 'List');
|
|
328
|
+
rootNode.commonAttribute.width(200).height(200);
|
|
329
|
+
|
|
330
|
+
// 将宿主节点传递给adapter,以便在onAttachToNode中注册onAppear
|
|
331
|
+
this.adapter.setRootNode(rootNode);
|
|
332
|
+
|
|
333
|
+
// 绑定adapter,此时会触发onAttachToNode回调
|
|
334
|
+
NodeAdapter.attachNodeAdapter(this.adapter, rootNode);
|
|
335
|
+
|
|
336
|
+
return rootNode;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
- onAttachToNode回调在attachNodeAdapter前设置
|
|
342
|
+
|
|
343
|
+
变更前,onAttachToNode生命周期回调,是在通过attachNodeAdapter接口将节点成功挂载到主树之后触发,因此attachNodeAdapter的调用与onAttachToNode回调函数的设置之间并无严格的时序要求。变更后,调用attachNodeAdapter后会立即触发onAttachToNode回调。因此变更后必须在调用attachNodeAdapter之前,设置onAttachToNode回调,否则将导致回调无法被触发,适配指导如下。
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
import { FrameNode, NodeAdapter, NodeController, typeNode, UIContext } from '@kit.ArkUI';
|
|
347
|
+
|
|
348
|
+
class NodeAdapterTest extends NodeAdapter {
|
|
349
|
+
uiContext:UIContext;
|
|
350
|
+
frameNodeList:Array<FrameNode> = new Array();
|
|
351
|
+
totalNodeCount_:number;
|
|
352
|
+
public onAttachToNodeFunc:undefined|Function = undefined;
|
|
353
|
+
constructor(uiContext:UIContext) {
|
|
354
|
+
super();
|
|
355
|
+
this.uiContext = uiContext;
|
|
356
|
+
this.totalNodeCount_ = 10;
|
|
357
|
+
this.totalNodeCount = this.totalNodeCount_;
|
|
358
|
+
this.initItem();
|
|
359
|
+
}
|
|
360
|
+
initItem(){
|
|
361
|
+
for(let i=0;i<this.totalNodeCount;i++) {
|
|
362
|
+
let textNode = typeNode.createNode(this.uiContext,'Text');
|
|
363
|
+
textNode.initialize('this is '+i+' node');
|
|
364
|
+
this.frameNodeList.push(textNode);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
onAttachToNode():void {
|
|
368
|
+
if(this.onAttachToNodeFunc) {
|
|
369
|
+
this.onAttachToNodeFunc()
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
onGetChildId(index: number):number {
|
|
373
|
+
return index;
|
|
374
|
+
}
|
|
375
|
+
onCreateChild(index: number): FrameNode {
|
|
376
|
+
return this.frameNodeList[index];
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
}
|
|
380
|
+
class TestController extends NodeController {
|
|
381
|
+
nodeAdapterTest: NodeAdapterTest | undefined;
|
|
382
|
+
rootNode:FrameNode|undefined ;
|
|
383
|
+
makeNode(uiContext: UIContext): FrameNode | null {
|
|
384
|
+
this.nodeAdapterTest =new NodeAdapterTest(uiContext)
|
|
385
|
+
let rootNode = typeNode.createNode(uiContext, 'Column');
|
|
386
|
+
rootNode.commonAttribute.width(200);
|
|
387
|
+
rootNode.commonAttribute.height(200);
|
|
388
|
+
|
|
389
|
+
// 适配后,onAttachToNode中使用的变量必须在attachNodeAdapter前赋值
|
|
390
|
+
this.nodeAdapterTest.onAttachToNodeFunc = ()=>{
|
|
391
|
+
hilog.info(0x0000, 'testTag', 'on attach to NodeAdapter');
|
|
392
|
+
}
|
|
393
|
+
NodeAdapter.attachNodeAdapter(this.nodeAdapterTest, rootNode);
|
|
394
|
+
|
|
395
|
+
// 适配前,onAttachToNode中使用的变量可以在attachNodeAdapter后赋值
|
|
396
|
+
this.nodeAdapterTest.onAttachToNodeFunc = ()=>{
|
|
397
|
+
hilog.info(0x0000, 'testTag', 'on attach to NodeAdapter');
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return rootNode;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
@Entry
|
|
405
|
+
@Component
|
|
406
|
+
struct Index {
|
|
407
|
+
@State message: string = 'Hello World';
|
|
408
|
+
|
|
409
|
+
build() {
|
|
410
|
+
Row() {
|
|
411
|
+
Column() {
|
|
412
|
+
NodeContainer(new TestController())
|
|
413
|
+
}
|
|
414
|
+
.width('100%')
|
|
415
|
+
}
|
|
416
|
+
.height('100%')
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
- OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver绑定方法触发时节点未上树
|
|
422
|
+
|
|
423
|
+
在NDK开发中,如果通过[OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-native-node-h#oh_arkui_nodeadapter_registereventreceiver)注册了事件相关回调,并且回调事件枚举为NODE\_APPEAR\_EVENT\_WILL\_ATTACH\_TO\_NODE,该事件会在NodeAdapter绑定宿主节点后立即触发。由于此时节点可能尚未完全挂载,如果事件回调逻辑依赖宿主节点已挂载的状态(如访问布局信息或执行动画),需要将该部分逻辑迁移至宿主节点的onAppear回调中执行,具体示例如下。
|
|
424
|
+
|
|
425
|
+
```cpp
|
|
426
|
+
#include <arkui/native_node.h>
|
|
427
|
+
#include <arkui/native_interface.h>
|
|
428
|
+
#include <stdio.h>
|
|
429
|
+
#include <hilog/log.h>
|
|
430
|
+
|
|
431
|
+
// 组件挂载时的回调函数
|
|
432
|
+
static void OnAppear(ArkUI_NodeEvent* event) {
|
|
433
|
+
OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, LOG_PRINT_TEXT, "Node is now attached to main tree");
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// NodeAdapter事件监听器
|
|
437
|
+
static void OnNodeAdapterEvent(ArkUI_NodeAdapterEvent* event, void* userData) {
|
|
438
|
+
ArkUI_NodeAdapterEventType eventType = OH_ArkUI_NodeAdapterEvent_GetType(event);
|
|
439
|
+
|
|
440
|
+
if (eventType == NODE_ADAPTER_EVENT_ON_ADD_NODE_TO_ADAPTER) {
|
|
441
|
+
// 获取需要创建组件的索引位置
|
|
442
|
+
uint32_t index = OH_ArkUI_NodeAdapterEvent_GetItemIndex(event);
|
|
443
|
+
|
|
444
|
+
// 创建子组件
|
|
445
|
+
ArkUINodeHandle childNode = OH_ArkUI_Node_Create("Text");
|
|
446
|
+
|
|
447
|
+
// 获取NativeNodeAPI实例
|
|
448
|
+
ArkUI_NativeNodeAPI_1* nativeNodeAPI = OH_ArkUI_GetNativeNodeAPI();
|
|
449
|
+
|
|
450
|
+
// 设置子组件属性
|
|
451
|
+
ArkUI_NumberValue widthValue[] = {{.f32 = 100.0f}};
|
|
452
|
+
ArkUI_AttributeItem widthItem = {widthValue, 1, nullptr, nullptr};
|
|
453
|
+
nativeNodeAPI->setAttribute(childNode, NODE_WIDTH, &widthItem);
|
|
454
|
+
|
|
455
|
+
ArkUI_NumberValue heightValue[] = {{.f32 = 50.0f}};
|
|
456
|
+
ArkUI_AttributeItem heightItem = {heightValue, 1, nullptr, nullptr};
|
|
457
|
+
nativeNodeAPI->setAttribute(childNode, NODE_HEIGHT, &heightItem);
|
|
458
|
+
|
|
459
|
+
// 将创建的组件返回给Adapter
|
|
460
|
+
OH_ArkUI_NodeAdapterEvent_SetItem(event, childNode);
|
|
461
|
+
|
|
462
|
+
// 为子组件注册onAppear事件
|
|
463
|
+
nativeNodeAPI->registerNodeEvent(childNode, NODE_EVENT_ON_APPEAR, 0, NULL);
|
|
464
|
+
nativeNodeAPI->addNodeEventReceiver(childNode, OnAppear);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
ArkUINodeHandle CreateRootNode(ArkUINodeAdapterHandle adapter) {
|
|
469
|
+
// 1. 创建List容器节点
|
|
470
|
+
ArkUINodeHandle listNode = OH_ArkUI_Node_Create("List");
|
|
471
|
+
|
|
472
|
+
// 获取NativeNodeAPI实例
|
|
473
|
+
ArkUI_NativeNodeAPI_1* nativeNodeAPI = OH_ArkUI_GetNativeNodeAPI();
|
|
474
|
+
|
|
475
|
+
// 2. 设置List的基本属性
|
|
476
|
+
ArkUI_NumberValue widthValue[] = {{.f32 = 200.0f}};
|
|
477
|
+
ArkUI_AttributeItem widthItem = {widthValue, 1, nullptr, nullptr};
|
|
478
|
+
nativeNodeAPI->setAttribute(listNode, NODE_WIDTH, &widthItem);
|
|
479
|
+
|
|
480
|
+
ArkUI_NumberValue heightValue[] = {{.f32 = 200.0f}};
|
|
481
|
+
ArkUI_AttributeItem heightItem = {heightValue, 1, nullptr, nullptr};
|
|
482
|
+
nativeNodeAPI->setAttribute(listNode, NODE_HEIGHT, &heightItem);
|
|
483
|
+
|
|
484
|
+
// 3. 设置NodeAdapter的总节点数量
|
|
485
|
+
OH_ArkUI_NodeAdapter_SetTotalNodeCount(adapter, 100);
|
|
486
|
+
|
|
487
|
+
// 4. 注册NodeAdapter事件监听器
|
|
488
|
+
OH_ArkUI_NodeAdapter_RegisterEventReceiver(adapter, NULL, OnNodeAdapterEvent);
|
|
489
|
+
|
|
490
|
+
// 5. 将NodeAdapter作为属性绑定到List节点
|
|
491
|
+
// 不再使用OH_ArkUI_NodeAdapter_Attach,而是通过setAttribute设置
|
|
492
|
+
ArkUI_AttributeItem adapterItem = {nullptr, 0, nullptr, adapter};
|
|
493
|
+
nativeNodeAPI->setAttribute(listNode, NODE_LIST_NODE_ADAPTER, &adapterItem);
|
|
494
|
+
|
|
495
|
+
return listNode;
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
- OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver绑定方法在NodeAdapter绑定节点前设置
|
|
500
|
+
|
|
501
|
+
开发者在NodeAdapter绑定宿主节点时,必须提前为NodeAdapter注册相关回调事件。如果OH\_ArkUI\_NodeAdapter\_RegisterEventReceiver回调中包含NODE\_APPEAR\_EVENT\_WILL\_ATTACH\_TO\_NODE事件的处理逻辑,必须将这部分逻辑前移至绑定宿主节点前,以确保事件正常执行。
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
static void OnNodeAdapterEvent(ArkUINodeAdapterEvent* event, void* userData) {
|
|
505
|
+
if (event->type == NODE_APPEAR_EVENT_WILL_ATTACH_TO_NODE) {
|
|
506
|
+
// 处理添加节点事件
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
void SetupAdapter(ArkUINodeAdapterHandle adapter, ArkUINodeHandle rootNode) {
|
|
511
|
+
|
|
512
|
+
// 适配前,先绑定宿主节点再注册事件监听
|
|
513
|
+
ArkUI_AttributeItem adapterItem = {nullptr, 0, nullptr, adapter};
|
|
514
|
+
// 绑定宿主节点
|
|
515
|
+
nativeNodeAPI->setAttribute(listNode, NODE_LIST_NODE_ADAPTER, &adapterItem);
|
|
516
|
+
// 设置事件监听
|
|
517
|
+
OH_ArkUI_NodeAdapter_RegisterEventReceiver(adapter, OnNodeAdapterEvent, NULL);
|
|
518
|
+
|
|
519
|
+
// 适配后,先注册事件监听再绑定宿主节点
|
|
520
|
+
// 设置事件监听
|
|
521
|
+
OH_ArkUI_NodeAdapter_RegisterEventReceiver(adapter, OnNodeAdapterEvent, NULL);
|
|
522
|
+
ArkUI_AttributeItem adapterItem = {nullptr, 0, nullptr, adapter};
|
|
523
|
+
// 绑定宿主节点
|
|
524
|
+
nativeNodeAPI->setAttribute(listNode, NODE_LIST_NODE_ADAPTER, &adapterItem);
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
### 鼠标事件rawDeltaX和rawDeltaY的返回值变更
|
|
530
|
+
|
|
531
|
+
**变更原因**
|
|
532
|
+
|
|
533
|
+
鼠标事件rawDeltaX和rawDeltaY的返回值的含义为鼠标设备在二维平面的物理移动偏移量,其数值为鼠标硬件的原始移动数据,使用物理世界中鼠标移动的距离单位进行表示,上报由鼠标硬件本身决定。当前实现返回值并非是原始移动数据,而是原始移动数据缩小了X倍,X为系统的显示大小比例。因此需要变更返回值使其符合本身的含义。
|
|
534
|
+
|
|
535
|
+
**变更影响**
|
|
536
|
+
|
|
537
|
+
此变更涉及应用适配。
|
|
538
|
+
|
|
539
|
+
- 变更前:rawDeltaX和rawDeltaY的返回值并非鼠标硬件的原始移动数据,而是原始数据缩小了X倍,X为系统的显示大小比例。
|
|
540
|
+
|
|
541
|
+
- 变更后:rawDeltaX和rawDeltaY的返回值为鼠标硬件的原始移动数据。
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
**起始API Level**
|
|
545
|
+
|
|
546
|
+
15
|
|
547
|
+
|
|
548
|
+
**变更的接口/组件**
|
|
549
|
+
|
|
550
|
+
[rawDeltaX](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-mouse-key#mouseevent对象说明)、[rawDeltaY](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-mouse-key#mouseevent对象说明)、[OH\_ArkUI\_MouseEvent\_GetRawDeltaX](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-ui-input-event-h#oh_arkui_mouseevent_getrawdeltax)和[OH\_ArkUI\_MouseEvent\_GetRawDeltaY](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-ui-input-event-h#oh_arkui_mouseevent_getrawdeltay)。
|
|
551
|
+
|
|
552
|
+
**适配指导**
|
|
553
|
+
|
|
554
|
+
如需恢复为变更前的效果,可以使用[px2vp](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/arkts-apis-uicontext-uicontext#px2vp12)接口获取变更之前的值。
|
|
555
|
+
|
|
556
|
+
```
|
|
557
|
+
// xxx.ets
|
|
558
|
+
@Entry
|
|
559
|
+
@Component
|
|
560
|
+
struct MouseEventExample {
|
|
561
|
+
@State mouseText: string = '';
|
|
562
|
+
|
|
563
|
+
build() {
|
|
564
|
+
Column({ space: 20 }) {
|
|
565
|
+
Button('onMouse')
|
|
566
|
+
.width(180).height(80)
|
|
567
|
+
.fontSize(24)
|
|
568
|
+
.onMouse((event: MouseEvent): void => {
|
|
569
|
+
if (event) {
|
|
570
|
+
this.mouseText = 'rawDeltaX = ' + this.getUIContext().px2vp(event.rawDeltaX) +
|
|
571
|
+
'\nrawDeltaY = ' + this.getUIContext().px2vp(event.rawDeltaY);
|
|
572
|
+
}
|
|
573
|
+
})
|
|
574
|
+
Text(this.mouseText)
|
|
575
|
+
}.padding({ top: 30 }).width('100%')
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### 属性字符串段落首个占位为CustomSpan或ImageAttachment时,支持设置段落样式
|
|
581
|
+
|
|
582
|
+
**变更原因**
|
|
583
|
+
|
|
584
|
+
历史版本中,[CustomSpan](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#customspan)或[ImageAttachment](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#imageattachment)在创建时未拷贝段落样式。因此,当属性字符串段落的首个占位为[CustomSpan](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#customspan)或[ImageAttachment](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#imageattachment)时,段落样式不生效。
|
|
585
|
+
|
|
586
|
+
**变更影响**
|
|
587
|
+
|
|
588
|
+
此变更涉及应用适配。
|
|
589
|
+
|
|
590
|
+
**说明**
|
|
591
|
+
|
|
592
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
593
|
+
|
|
594
|
+
变更前:如果属性字符串段落内首个占位为[CustomSpan](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#customspan)或[ImageAttachment](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#imageattachment),设置在该段落上的段落样式不生效。
|
|
595
|
+
|
|
596
|
+
变更后:如果属性字符串段落内首个占位为[CustomSpan](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#customspan)或[ImageAttachment](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#imageattachment),设置在该段落上的段落样式生效。
|
|
597
|
+
|
|
598
|
+
**起始 API Level**
|
|
599
|
+
|
|
600
|
+
12
|
|
601
|
+
|
|
602
|
+
**变更的接口/组件**
|
|
603
|
+
|
|
604
|
+
[ParagraphStyle](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#paragraphstyle)
|
|
605
|
+
|
|
606
|
+
**适配指导**
|
|
607
|
+
|
|
608
|
+
接口默认效果变更,开发者需审视此变更是否对自身相关业务展示效果产生影响,若有影响需根据自身业务代码进行对应适配。
|
|
609
|
+
|
|
610
|
+
以下示例代码将属性字符串段落中类型为[ImageAttachment](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string#imageattachment)的首个占位,设置段落样式为[TextAlign](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-appendix-enums#textalign).End。
|
|
611
|
+
|
|
612
|
+
```typescript
|
|
613
|
+
// xxx.ets
|
|
614
|
+
import { LengthMetrics } from '@kit.ArkUI';
|
|
615
|
+
|
|
616
|
+
@Entry
|
|
617
|
+
@Component
|
|
618
|
+
struct styled_string_paraStyle_demo {
|
|
619
|
+
mutableStr: MutableStyledString = new MutableStyledString('TextAlign:End', [{
|
|
620
|
+
start: 0,
|
|
621
|
+
length: 5,
|
|
622
|
+
styledKey: StyledStringKey.PARAGRAPH_STYLE,
|
|
623
|
+
styledValue: new ParagraphStyle({
|
|
624
|
+
textAlign: TextAlign.End
|
|
625
|
+
})
|
|
626
|
+
}]);
|
|
627
|
+
mutableStr2: MutableStyledString = new MutableStyledString('TextAlign:End');
|
|
628
|
+
controller: TextController = new TextController();
|
|
629
|
+
controller2: TextController = new TextController();
|
|
630
|
+
|
|
631
|
+
build() {
|
|
632
|
+
Row() {
|
|
633
|
+
Column({ space: 5 }) {
|
|
634
|
+
Text(undefined, { controller: this.controller })
|
|
635
|
+
.copyOption(CopyOptions.InApp)
|
|
636
|
+
.draggable(true)
|
|
637
|
+
.fontSize(30)
|
|
638
|
+
.borderWidth(1)
|
|
639
|
+
.width(300)
|
|
640
|
+
.onAppear(() => {
|
|
641
|
+
this.controller.setStyledString(this.mutableStr);
|
|
642
|
+
})
|
|
643
|
+
Text(undefined, { controller: this.controller2 })
|
|
644
|
+
.copyOption(CopyOptions.InApp)
|
|
645
|
+
.draggable(true)
|
|
646
|
+
.fontSize(30)
|
|
647
|
+
.borderWidth(1)
|
|
648
|
+
.width(300)
|
|
649
|
+
.onAppear(() => {
|
|
650
|
+
this.mutableStr2.insertStyledString(0, new MutableStyledString(new ImageAttachment({
|
|
651
|
+
resourceValue: $r('app.media.startIcon'),
|
|
652
|
+
size: { width: 50, height: 50 },
|
|
653
|
+
layoutStyle: { borderRadius: LengthMetrics.vp(10) },
|
|
654
|
+
verticalAlign: ImageSpanAlignment.BASELINE,
|
|
655
|
+
objectFit: ImageFit.Contain,
|
|
656
|
+
syncLoad: true
|
|
657
|
+
})))
|
|
658
|
+
this.mutableStr2.setStyle({
|
|
659
|
+
start: 0,
|
|
660
|
+
length: 5,
|
|
661
|
+
styledKey: StyledStringKey.PARAGRAPH_STYLE,
|
|
662
|
+
styledValue: new ParagraphStyle({
|
|
663
|
+
textAlign: TextAlign.End
|
|
664
|
+
})
|
|
665
|
+
}) // API版本26.0.0前,设置的TextAlign.End不会生效
|
|
666
|
+
this.controller2.setStyledString(this.mutableStr2);
|
|
667
|
+
})
|
|
668
|
+
}
|
|
669
|
+
.width('100%')
|
|
670
|
+
}
|
|
671
|
+
.height('100%')
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
### LayoutPolicy.matchParent父组件为Row、Column、Flex组件时,单方向设置matchParent的子组件布局行为变更
|
|
677
|
+
|
|
678
|
+
**变更原因**
|
|
679
|
+
|
|
680
|
+
当前Row、Column、Flex组件布局过程中,单方向设置matchParent的子组件不会参与父组件的尺寸计算。变更后,Row、Column、Flex组件会自适应单方向matchParent子组件尺寸,布局效果更符合API语义。
|
|
681
|
+
|
|
682
|
+
**变更影响**
|
|
683
|
+
|
|
684
|
+
此变更涉及应用适配。
|
|
685
|
+
|
|
686
|
+
**说明**
|
|
687
|
+
|
|
688
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
689
|
+
|
|
690
|
+
变更前:当Row、Column、Flex组件主轴尺寸自适应子组件,且子组件A仅交叉轴设置matchParent时,子组件A不参与Row、Column、Flex组件的主轴尺寸测量过程,此时Row、Column、Flex组件主轴方向不自适应子组件A的尺寸。交叉轴方向同理。
|
|
691
|
+
|
|
692
|
+
变更后:当Row、Column、Flex组件主轴尺寸自适应子组件,且子组件A仅交叉轴设置matchParent时,子组件A会参与Row、Column、Flex组件的主轴尺寸测量过程,此时Row、Column、Flex组件主轴方向会自适应子组件A的尺寸。交叉轴方向同理。
|
|
693
|
+
|
|
694
|
+
例如:运行以下示例,进入页面后观察父组件Column的大小。变更前Column组件只会被第一个子组件撑大,变更后,Column组件高度自适应第一个和第二个子组件,宽度自适应第一个和第三个子组件。
|
|
695
|
+
|
|
696
|
+
```
|
|
697
|
+
@Entry
|
|
698
|
+
@Component
|
|
699
|
+
struct Demo {
|
|
700
|
+
build() {
|
|
701
|
+
Column() {
|
|
702
|
+
Column({space: "30px"}) {
|
|
703
|
+
Column()
|
|
704
|
+
.width("200px")
|
|
705
|
+
.height("200px")
|
|
706
|
+
.backgroundColor('rgb(0, 74, 175)')
|
|
707
|
+
|
|
708
|
+
Column()
|
|
709
|
+
.width(LayoutPolicy.matchParent)
|
|
710
|
+
.height("200px")
|
|
711
|
+
.backgroundColor('rgb(0, 74, 175)')
|
|
712
|
+
|
|
713
|
+
Column()
|
|
714
|
+
.width("400px")
|
|
715
|
+
.height(LayoutPolicy.matchParent)
|
|
716
|
+
.backgroundColor('rgb(0, 74, 175)')
|
|
717
|
+
}
|
|
718
|
+
.width(LayoutPolicy.wrapContent)
|
|
719
|
+
.height(LayoutPolicy.wrapContent)
|
|
720
|
+
.backgroundColor('rgb(39, 135, 217)')
|
|
721
|
+
.padding("30px")
|
|
722
|
+
}.width("100%")
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
变更前后效果如下:
|
|
728
|
+
|
|
729
|
+
| 变更前 | 变更后 |
|
|
730
|
+
| --- | --- |
|
|
731
|
+
|  |  |
|
|
732
|
+
|
|
733
|
+
**起始 API Level**
|
|
734
|
+
|
|
735
|
+
15
|
|
736
|
+
|
|
737
|
+
**变更的接口/组件**
|
|
738
|
+
|
|
739
|
+
涉及组件:[Row](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-row)、[Column](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-column)、[Flex](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-flex)。
|
|
740
|
+
|
|
741
|
+
涉及接口:[LayoutPolicy.matchParent](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-size#layoutpolicy15)。
|
|
742
|
+
|
|
743
|
+
**适配指导**
|
|
744
|
+
|
|
745
|
+
默认行为变更,但开发者需审视此变更是否对自身相关业务代码逻辑产生影响,若有影响需根据自身业务代码进行适配。如果开发者要用原先的布局效果,可以根据未设置matchParent的子组件手动设置父组件尺寸。
|
|
746
|
+
|
|
747
|
+
### EmbeddedComponent获焦能力变更
|
|
748
|
+
|
|
749
|
+
**变更原因**
|
|
750
|
+
|
|
751
|
+
[EmbeddedComponent](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-embedded-component)获焦后,其拉起的EmbeddedUIExtensionAbility窗口内焦点不会停留在容器组件,而是下发到容器内第一个可获焦子节点。当获焦节点为[TextInput](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-textinput)时,会出现软键盘被意外拉起的情况。
|
|
752
|
+
|
|
753
|
+
**变更影响**
|
|
754
|
+
|
|
755
|
+
此变更涉及应用适配。
|
|
756
|
+
|
|
757
|
+
**说明**
|
|
758
|
+
|
|
759
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
760
|
+
|
|
761
|
+
变更前:EmbeddedComponent获焦时,如果外部走焦到EmbeddedUIExtensionAbility,焦点正常下发到第一个可获焦子节点;如果由于层级页面切换导致焦点转移到EmbeddedUIExtensionAbility,在EmbeddedUIExtensionAbility页面内未设置[defaultFocus](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-focus#defaultfocus9)、未[主动请求焦点](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-common-events-focus-event#主动获焦失焦)时,焦点仍然下发到第一个可获焦子节点。
|
|
762
|
+
|
|
763
|
+
变更后:EmbeddedComponent获焦时,如果外部走焦到EmbeddedUIExtensionAbility,焦点正常下发到第一个可获焦子节点;如果由于层级页面切换导致焦点转移到EmbeddedUIExtensionAbility,则与UIAbility保持统一规则,两者在拉起一个层级页面且该页面未设置[defaultFocus](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-focus#defaultfocus9)、未[主动请求焦点](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-common-events-focus-event#主动获焦失焦)时,焦点均停留在根容器,不下发到子节点。
|
|
764
|
+
|
|
765
|
+
**起始 API Level**
|
|
766
|
+
|
|
767
|
+
18
|
|
768
|
+
|
|
769
|
+
**变更的接口/组件**
|
|
770
|
+
|
|
771
|
+
[EmbeddedComponent](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-embedded-component)
|
|
772
|
+
|
|
773
|
+
**适配指导**
|
|
774
|
+
|
|
775
|
+
在由于层级页面切换导致焦点转移到EmbeddedUIExtensionAbility的场景下,焦点默认停留在根容器。如果期望第一个可获焦子组件自动获焦,可以通过如下两种方式显式设置焦点。
|
|
776
|
+
|
|
777
|
+
- 方式一:在EmbeddedUIExtensionAbility的页面中,通过将[defaultFocus](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-focus#defaultfocus9)设置为true,使得第一个可获焦子组件成为层级页面的默认焦点。
|
|
778
|
+
```
|
|
779
|
+
@Entry
|
|
780
|
+
@Component
|
|
781
|
+
struct UIExtensionPage {
|
|
782
|
+
build() {
|
|
783
|
+
Column({ space: 20 }) {
|
|
784
|
+
TextInput({ placeholder: 'Input something...' })
|
|
785
|
+
.width(300)
|
|
786
|
+
.height(50)
|
|
787
|
+
.defaultFocus(true)
|
|
788
|
+
|
|
789
|
+
Button('Submit')
|
|
790
|
+
.width(200)
|
|
791
|
+
.height(50)
|
|
792
|
+
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
- 方式二:在EmbeddedUIExtensionAbility的页面中,通过[requestFocus](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-common-events-focus-event#主动获焦失焦)主动为第一个可获焦子组件请求焦点。
|
|
799
|
+
```
|
|
800
|
+
@Entry
|
|
801
|
+
@Component
|
|
802
|
+
struct UIExtensionPage {
|
|
803
|
+
build() {
|
|
804
|
+
Column({ space: 20 }) {
|
|
805
|
+
TextInput({ placeholder: 'Input something...' })
|
|
806
|
+
.width(300)
|
|
807
|
+
.height(50)
|
|
808
|
+
.id('targetInput')
|
|
809
|
+
|
|
810
|
+
Button('Submit')
|
|
811
|
+
.width(200)
|
|
812
|
+
.height(50)
|
|
813
|
+
}
|
|
814
|
+
.width('100%')
|
|
815
|
+
.height('100%')
|
|
816
|
+
.justifyContent(FlexAlign.Center)
|
|
817
|
+
.onAppear(() => {
|
|
818
|
+
this.getUIContext().getFocusController().requestFocus('targetInput');
|
|
819
|
+
})
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
### WithTheme相关组件行为变更
|
|
826
|
+
|
|
827
|
+
**变更原因**
|
|
828
|
+
|
|
829
|
+
为提升主题功能的一致性与完整性,对下述场景下的组件行为进行优化适配。
|
|
830
|
+
|
|
831
|
+
1. 当前已支持[WithTheme](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-with-theme)的组件,在特定场景下部分组件未能正确应用[WithTheme](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-with-theme)所设置的主题样式,与预期设计效果不符。
|
|
832
|
+
|
|
833
|
+
- 弹窗类组件不跟随宿主节点的局部主题或深浅色样式。
|
|
834
|
+
- 部分组件(组件范围见**场景二**)动态添加至[WithTheme](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-with-theme)中后,不会跟随局部主题或深浅色变化而变化(例如通过ForEach+ListItem,将组件添加到WithTheme组件下)。
|
|
835
|
+
2. 对于暂不支持[WithTheme](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-with-theme)的组件,其样式不会响应WithTheme或默认主题[setDefaultTheme](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-arkui-theme#setdefaulttheme)设置的主题样式。
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
**变更影响**
|
|
839
|
+
|
|
840
|
+
此变更涉及应用适配。
|
|
841
|
+
|
|
842
|
+
**说明**
|
|
843
|
+
|
|
844
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
845
|
+
|
|
846
|
+
**场景一:弹窗类组件跟随宿主节点的WithTheme样式**
|
|
847
|
+
|
|
848
|
+
变更前:宿主节点的[bindMenu](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-menu#bindmenu11)、[bindPopup](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-popup#bindpopup)、[bindSheet](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-sheet-transition#bindsheet)、[CalendarPicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-calendarpicker)弹窗类组件弹出时,不跟随宿主节点的局部主题或深浅色样式。
|
|
849
|
+
|
|
850
|
+
变更后:宿主节点的[bindMenu](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-menu#bindmenu11)、[bindPopup](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-popup#bindpopup)、[bindSheet](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-sheet-transition#bindsheet)、[CalendarPicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-calendarpicker)弹窗类组件弹出时,会跟随宿主节点的局部主题或深浅色样式。
|
|
851
|
+
|
|
852
|
+
**场景二:动态添加到WithTheme的组件响应主题变化**
|
|
853
|
+
|
|
854
|
+
变更前:当WithTheme的主题样式或深浅色发生动态变化时,后续动态添加到WithTheme中的组件不会同步响应这些变化。
|
|
855
|
+
|
|
856
|
+
变更后:当WithTheme的主题样式或深浅色发生动态变化时,后续动态添加到WithTheme中的组件会同步响应这些变化。
|
|
857
|
+
|
|
858
|
+
| 涉及场景 | 涉及组件 |
|
|
859
|
+
| --- | --- |
|
|
860
|
+
| 动态添加场景 | [Button](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-button)、[Menu](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-menu)、[DatePicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-datepicker)、[TextPicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-textpicker)、[TimePicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-timepicker)、[Counter](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-counter)、[Progress](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-progress)、[TextClock](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-textclock)、[LoadingProgress](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-loadingprogress)、[Scroll](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-scroll)、[AlphabetIndexer](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-alphabet-indexer)、[Tabs](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-tabs)、[TabContent](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-tabcontent)、[Swiper](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-swiper)、[Indicator](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-swiper-components-indicator)。 |
|
|
861
|
+
|
|
862
|
+
**场景三:组件新增WithTheme支持能力**
|
|
863
|
+
|
|
864
|
+
变更前:组件不受WithTheme或setDefaultTheme设置的样式影响,显示为系统默认样式。
|
|
865
|
+
|
|
866
|
+
变更后:组件会响应WithTheme或setDefaultTheme设置的样式,并优先显示对应的主题效果。
|
|
867
|
+
|
|
868
|
+
| 涉及场景 | 涉及组件 |
|
|
869
|
+
| --- | --- |
|
|
870
|
+
| 组件新增WithTheme支持能力 | [TextArea](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-textarea)、[Search](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-search)、[RichEditor](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-richeditor)、[Image](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-image)、[ImageAnimator](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-imageanimator)、[PatternLock](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-patternlock)、[QRCode](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-qrcode)、[DataPanel](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-datapanel)、[文本选择菜单](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-text)、[Badge](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-badge)、[styleString](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-styled-string)、[LocalBuilder](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-localbuilder)、[Tabs](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-tabs)、[TabContent](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-tabcontent)、[ListItemGroup](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-listitemgroup)、[ListItem](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-listitem)、[ArcListItem](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-arclistitem)、[GridItem](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-griditem)、[Refresh](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-refresh)、[TextPicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-textpicker)、[TimePicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-timepicker)、[DatePicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-datepicker)、[CalendarPicker](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-calendarpicker)、[UIPickerComponent](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-container-ui-picker-component)、[MenuItem](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-menuitem)和[menuItemGroup](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-menuitemgroup)。 |
|
|
871
|
+
|
|
872
|
+
**起始API Level**
|
|
873
|
+
|
|
874
|
+
12
|
|
875
|
+
|
|
876
|
+
**变更的接口/组件**
|
|
877
|
+
|
|
878
|
+
WithThemeInterface、setDefaultTheme。
|
|
879
|
+
|
|
880
|
+
**适配指导**
|
|
881
|
+
|
|
882
|
+
1. 若希望上述组件在WithTheme下保持变更前的行为,即继续跟随系统样式或系统深浅色模式,可将该组件放入WithTheme({ colorMode: ThemeColorMode.SYSTEM })组件下。
|
|
883
|
+
|
|
884
|
+
```
|
|
885
|
+
@Entry
|
|
886
|
+
@Component
|
|
887
|
+
struct WithThemeExample {
|
|
888
|
+
@State message: string = 'Hello World';
|
|
889
|
+
@State arr: number[] = [];
|
|
890
|
+
private index: number = 0;
|
|
891
|
+
build() {
|
|
892
|
+
Row() {
|
|
893
|
+
Column() {
|
|
894
|
+
Button("Add Element")
|
|
895
|
+
.onClick(() => {
|
|
896
|
+
this.arr.push(this.index++);
|
|
897
|
+
})
|
|
898
|
+
WithTheme({ colorMode: ThemeColorMode.DARK }) {
|
|
899
|
+
List() {
|
|
900
|
+
ForEach(this.arr, (item: number, index) => {
|
|
901
|
+
ListItem() {
|
|
902
|
+
Column() {
|
|
903
|
+
WithTheme({ colorMode: ThemeColorMode.SYSTEM }) {
|
|
904
|
+
Column() {
|
|
905
|
+
Button("Button In ForEach with COLOR_MODE_SYSTEM")
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
})
|
|
911
|
+
}
|
|
912
|
+
.width('100%')
|
|
913
|
+
.height('100%')
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
.width('100%')
|
|
917
|
+
}
|
|
918
|
+
.height('100%')
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
2. 如果WithTheme容器内的部分组件使用了固定颜色值,组件放入WithTheme中,生效WithTheme设置的样式时,可能影响显示效果。可通过将该组件放入新的WithTheme容器中,并将该容器的colorMode设置为ThemeColorMode.SYSTEM,恢复为变更前的行为。
|
|
924
|
+
|
|
925
|
+
```
|
|
926
|
+
@Entry
|
|
927
|
+
@Component
|
|
928
|
+
struct WithThemeExample {
|
|
929
|
+
@State arr: number[] = [];
|
|
930
|
+
private index: number = 0
|
|
931
|
+
|
|
932
|
+
build() {
|
|
933
|
+
Row() {
|
|
934
|
+
Column() {
|
|
935
|
+
Button("Add Element")
|
|
936
|
+
.onClick(() => {
|
|
937
|
+
this.arr.push(this.index++);
|
|
938
|
+
})
|
|
939
|
+
WithTheme({ colorMode: ThemeColorMode.DARK }) {
|
|
940
|
+
List() {
|
|
941
|
+
ForEach(this.arr, (item: number, index) => {
|
|
942
|
+
ListItem() {
|
|
943
|
+
WithTheme({ colorMode: ThemeColorMode.SYSTEM }) {
|
|
944
|
+
Column() {
|
|
945
|
+
Text("Set ColorMode SYSTEM")
|
|
946
|
+
.fontColor("#FF383838")
|
|
947
|
+
}
|
|
948
|
+
.backgroundColor($r('sys.color.background_primary'))
|
|
949
|
+
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
})
|
|
953
|
+
}
|
|
954
|
+
.width('100%')
|
|
955
|
+
.height('100%')
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
.width('100%')
|
|
959
|
+
}
|
|
960
|
+
.height('100%')
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
### ArkUI接口新增仅支持Stage模型的约束
|
|
967
|
+
|
|
968
|
+
**变更原因**
|
|
969
|
+
|
|
970
|
+
ArkUI存在API接口未明确标注所支持的模型标签,导致DevEco Studio和开发者无法准确感知FA模型和Stage模型的支持情况。
|
|
971
|
+
|
|
972
|
+
**变更影响**
|
|
973
|
+
|
|
974
|
+
此变更涉及应用适配。
|
|
975
|
+
|
|
976
|
+
变更前:ArkUI提供的API version 10及以上版本的接口,如果未明确标注模型标签,可在FA模型工程中使用。
|
|
977
|
+
|
|
978
|
+
变更后:ArkUI提供的API version 10及以上版本的接口,均补充仅支持Stage模型的标签,此时接口无法在FA模型中使用,会产生编译报错。
|
|
979
|
+
|
|
980
|
+
**起始 API Level**
|
|
981
|
+
|
|
982
|
+
10
|
|
983
|
+
|
|
984
|
+
**变更的接口/组件**
|
|
985
|
+
|
|
986
|
+
ArkUI API version 10及以上的全量接口。
|
|
987
|
+
|
|
988
|
+
**适配指导**
|
|
989
|
+
|
|
990
|
+
推荐使用Stage模型。Stage模型是当前系统主推的应用模型,请参考[应用模型开发概述](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/stage-model-development-overview)了解模型差异。
|
|
991
|
+
|
|
992
|
+
### 主页NavDestination中使用queryNavDestinationInfo接口和onResult接口的行为变更
|
|
993
|
+
|
|
994
|
+
**变更原因**
|
|
995
|
+
|
|
996
|
+
1. 通过queryNavDestinationInfo(isInner: Optional<boolean>)接口无法获取到主页NavDestination的信息,不符合接口设计规格。
|
|
997
|
+
2. 主页NavDestination的onResult接口在如下场景中表现不符合预期,具体场景为:开发者使用了主页NavDestination,且操作前栈为PageA(未设置onResult)、PageB。从PageB返回到PageA时,会触发主页NavDestination的onResult,不符合接口设计规格。
|
|
998
|
+
|
|
999
|
+
**变更影响**
|
|
1000
|
+
|
|
1001
|
+
变更前:
|
|
1002
|
+
|
|
1003
|
+
1. 通过入参包含HomePathInfo的Navigation接口,指定一个NavDestination作为Navigation主页后,通过[queryNavDestinationInfo](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-custom-component-api#querynavdestinationinfo18)接口无法获取主页NavDestination的信息。
|
|
1004
|
+
2. 通过入参包含HomePathInfo的Navigation接口,指定一个NavDestination作为Navigation主页后,栈操作的目标页面非主页面,且没有设置[onResult](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-navdestination#onresult15),返回该页面时会触发主页NavDestination的onResult。
|
|
1005
|
+
|
|
1006
|
+
变更后:
|
|
1007
|
+
|
|
1008
|
+
1. 通过[queryNavDestinationInfo](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-custom-component-api#querynavdestinationinfo18)接口能够获取主页NavDestination的信息。
|
|
1009
|
+
2. 栈操作的目标页面非主页面,且没有设置[onResult](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-navdestination#onresult15),返回该页面时不会触发主页NavDestination的onResult。
|
|
1010
|
+
|
|
1011
|
+
**起始 API Level**
|
|
1012
|
+
|
|
1013
|
+
20
|
|
1014
|
+
|
|
1015
|
+
**变更的接口/组件**
|
|
1016
|
+
|
|
1017
|
+
1. [queryNavDestinationInfo(isInner: Optional<boolean>)](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-custom-component-api#querynavdestinationinfo18)接口。
|
|
1018
|
+
2. NavDestination的[onResult](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-navdestination#onresult15)接口。
|
|
1019
|
+
|
|
1020
|
+
**适配指导**
|
|
1021
|
+
|
|
1022
|
+
开发者需要根据变更内容审视自身业务代码是否需要进行适配,下面的两段示例代码分别展示了:
|
|
1023
|
+
|
|
1024
|
+
1. 主页NavDestination中使用queryNavDestinationInfo接口在变更前后的差异。
|
|
1025
|
+
2. 主页NavDestination的onResult接口在如下场景中的变化:使用了主页NavDestination,栈中当前有PageA(未设置onResult)和PageB两个页面,然后从PageB返回到PageA,变更前会触发主页的NavDestination的onResult,变更后不会触发主页NavDestination的onResult。
|
|
1026
|
+
|
|
1027
|
+
示例代码1:
|
|
1028
|
+
|
|
1029
|
+
```typescript
|
|
1030
|
+
import hilog from '@ohos.hilog';
|
|
1031
|
+
|
|
1032
|
+
@Component
|
|
1033
|
+
struct MyPage {
|
|
1034
|
+
build() {
|
|
1035
|
+
NavDestination() {
|
|
1036
|
+
}
|
|
1037
|
+
.width('100%')
|
|
1038
|
+
.height('100%')
|
|
1039
|
+
.title('DetailPage')
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
@Component
|
|
1044
|
+
struct InnerCustomComponent {
|
|
1045
|
+
GetDestInfo() {
|
|
1046
|
+
// 向上查找当前自定义组件的所在的NavDestination
|
|
1047
|
+
let info = this.queryNavDestinationInfo(false);
|
|
1048
|
+
if (info) {
|
|
1049
|
+
// 变更后能够获取到主页NavDestination的信息,会走这个分支
|
|
1050
|
+
hilog.info(0x0000, 'testTag', `success to get HomeNavDestination's name: ${info.name}`)
|
|
1051
|
+
} else {
|
|
1052
|
+
// 变更前无法获取到主页NavDestination的信息,会走这个分支
|
|
1053
|
+
hilog.info(0x0000, 'testTag', `failed to get NavDestinationInfo for HomeNavDestination`)
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
build() {
|
|
1058
|
+
Column() {
|
|
1059
|
+
Button('queryOuterNavDestination').onClick(() => {
|
|
1060
|
+
this.GetDestInfo();
|
|
1061
|
+
})
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
@Component
|
|
1067
|
+
struct MyHomeDestination {
|
|
1068
|
+
GetDestInfo() {
|
|
1069
|
+
// 向下查找当前自定义组件内部的NavDestination
|
|
1070
|
+
let info = this.queryNavDestinationInfo(true);
|
|
1071
|
+
if (info) {
|
|
1072
|
+
// 变更后能够获取到主页NavDestination的信息,会走这个分支
|
|
1073
|
+
hilog.info(0x0000, 'testTag', `success to get HomeNavDestination's name: ${info.name}`)
|
|
1074
|
+
} else {
|
|
1075
|
+
// 变更前无法获取到主页NavDestination的信息,会走这个分支
|
|
1076
|
+
hilog.info(0x0000, 'testTag', `failed to get NavDestinationInfo for HomeNavDestination`)
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
build() {
|
|
1081
|
+
NavDestination() {
|
|
1082
|
+
Column() {
|
|
1083
|
+
Button('queryInnerNavDestination').onClick(() => {
|
|
1084
|
+
this.GetDestInfo();
|
|
1085
|
+
})
|
|
1086
|
+
InnerCustomComponent()
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
.width('100%')
|
|
1090
|
+
.height('100%')
|
|
1091
|
+
.title('HomePage')
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
@Entry
|
|
1096
|
+
@Component
|
|
1097
|
+
struct Index {
|
|
1098
|
+
private stack: NavPathStack = new NavPathStack();
|
|
1099
|
+
|
|
1100
|
+
@Builder
|
|
1101
|
+
MyPageName(name: string) {
|
|
1102
|
+
if (name === 'Home') {
|
|
1103
|
+
MyHomeDestination()
|
|
1104
|
+
} else {
|
|
1105
|
+
MyPage()
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
build() {
|
|
1110
|
+
// 使用主页NavDestination功能
|
|
1111
|
+
Navigation(this.stack, {name: 'Home'}) {
|
|
1112
|
+
}
|
|
1113
|
+
.width('100%')
|
|
1114
|
+
.height('100%')
|
|
1115
|
+
.navDestination(this.MyPageName)
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
```
|
|
1119
|
+
|
|
1120
|
+
示例代码2:
|
|
1121
|
+
|
|
1122
|
+
```typescript
|
|
1123
|
+
import hilog from '@ohos.hilog';
|
|
1124
|
+
|
|
1125
|
+
@Component
|
|
1126
|
+
struct MyPage {
|
|
1127
|
+
@State name: string = '';
|
|
1128
|
+
build() {
|
|
1129
|
+
// PageA不设置onResult事件
|
|
1130
|
+
NavDestination() {
|
|
1131
|
+
}
|
|
1132
|
+
.width('100%')
|
|
1133
|
+
.height('100%')
|
|
1134
|
+
.title(`${this.name}`)
|
|
1135
|
+
.onReady((ctx: NavDestinationContext) => {
|
|
1136
|
+
this.name = ctx.pathInfo.name;
|
|
1137
|
+
})
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
@Component
|
|
1142
|
+
struct MyHomeDestination {
|
|
1143
|
+
build() {
|
|
1144
|
+
NavDestination() {
|
|
1145
|
+
}
|
|
1146
|
+
.width('100%')
|
|
1147
|
+
.height('100%')
|
|
1148
|
+
.title('HomePage')
|
|
1149
|
+
.onResult((param: ESObject) => {
|
|
1150
|
+
// PageA未设置onResult事件,从PageB返回到PageA时,
|
|
1151
|
+
// 在变更前会触发主页NavDestination的onResult函数,在变更后不会触发主页NavDestination的onResult函数
|
|
1152
|
+
hilog.info(0x0000, 'testTag', `HomeDestination onResult`)
|
|
1153
|
+
})
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
@Entry
|
|
1158
|
+
@Component
|
|
1159
|
+
struct Index {
|
|
1160
|
+
private stack: NavPathStack = new NavPathStack();
|
|
1161
|
+
|
|
1162
|
+
@Builder
|
|
1163
|
+
MyPageName(name: string) {
|
|
1164
|
+
if (name === 'Home') {
|
|
1165
|
+
MyHomeDestination()
|
|
1166
|
+
} else {
|
|
1167
|
+
MyPage()
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
aboutToAppear(): void {
|
|
1172
|
+
this.stack.pushPath({name: 'PageA'})
|
|
1173
|
+
this.stack.pushPath({name: 'PageB'})
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
build() {
|
|
1177
|
+
// 使用主页NavDestination功能
|
|
1178
|
+
Navigation(this.stack, {name: 'Home'}) {
|
|
1179
|
+
}
|
|
1180
|
+
.width('100%')
|
|
1181
|
+
.height('100%')
|
|
1182
|
+
.navDestination(this.MyPageName)
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
### NODE\_SWIPER\_EVENT\_ON\_CONTENT\_DID\_SCROLL事件回调的返回值行为变更
|
|
1188
|
+
|
|
1189
|
+
**变更原因**
|
|
1190
|
+
|
|
1191
|
+
[NODE\_SWIPER\_EVENT\_ON\_CONTENT\_DID\_SCROLL](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-native-node-h#arkui_nodeeventtype)事件回调返回值中的主轴方向上页面的长度ArkUI\_NodeComponentEvent.data\[3\].f32,和实际长度不符。
|
|
1192
|
+
|
|
1193
|
+
**变更影响**
|
|
1194
|
+
|
|
1195
|
+
此变更涉及应用适配。
|
|
1196
|
+
|
|
1197
|
+
**说明**
|
|
1198
|
+
|
|
1199
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
1200
|
+
|
|
1201
|
+
- 变更前:NODE\_SWIPER\_EVENT\_ON\_CONTENT\_DID\_SCROLL的返回值中的ArkUI\_NodeComponentEvent.data\[3\].f32不符合页面的实际主轴长度。例如实际长度为100vp,开发者接收vp单位时,返回的值是100/屏幕像素密度,开发者接收px单位时,返回的值是100。
|
|
1202
|
+
|
|
1203
|
+
- 变更后:NODE\_SWIPER\_EVENT\_ON\_CONTENT\_DID\_SCROLL的返回值中的ArkUI\_NodeComponentEvent.data\[3\].f32符合页面的实际主轴长度。例如实际长度为100vp,开发者接收vp单位时,返回的值是100,开发者接收px单位时,返回的值是100\*屏幕像素密度。
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
**起始API Level**
|
|
1207
|
+
|
|
1208
|
+
12
|
|
1209
|
+
|
|
1210
|
+
**变更的接口/组件**
|
|
1211
|
+
|
|
1212
|
+
[NODE\_SWIPER\_EVENT\_ON\_CONTENT\_DID\_SCROLL](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-native-node-h#arkui_nodeeventtype)的返回参数值ArkUI\_NodeComponentEvent.data\[3\].f32。
|
|
1213
|
+
|
|
1214
|
+
**适配指导**
|
|
1215
|
+
|
|
1216
|
+
原先的返回值不符合实际页面主轴长度,开发者在使用时需要给获取的返回值\*屏幕像素密度。变更后可以直接使用正确的长度值进行业务开发。
|
|
1217
|
+
|
|
1218
|
+
```
|
|
1219
|
+
static ArkUI_NativeNodeAPI_1 *nodeAPI_ = reinterpret_cast<ArkUI_NativeNodeAPI_1 *>(
|
|
1220
|
+
OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1"));
|
|
1221
|
+
const unsigned int LOG_PRINT_DOMAIN = 0xFF00;
|
|
1222
|
+
|
|
1223
|
+
static napi_value CreateSwiperNode(napi_env env, napi_callback_info info) {
|
|
1224
|
+
const int size = 11;
|
|
1225
|
+
const char *arr[size] = {"0", "1", "2", "3"};
|
|
1226
|
+
static ArkUI_NodeHandle swiper = nodeAPI_->createNode(ARKUI_NODE_SWIPER);
|
|
1227
|
+
|
|
1228
|
+
for (int j = ConstIde::NUMBER_0; j < size; j++) {
|
|
1229
|
+
ArkUI_NodeHandle textNode = nodeAPI_->createNode(ARKUI_NODE_TEXT);
|
|
1230
|
+
ArkUI_AttributeItem content = {.string = arr[j]};
|
|
1231
|
+
nodeAPI_->setAttribute(textNode, NODE_TEXT_CONTENT, &content);
|
|
1232
|
+
|
|
1233
|
+
ArkUI_NumberValue value[] = {0};
|
|
1234
|
+
ArkUI_AttributeItem item = {.value = value, .size = 1};
|
|
1235
|
+
value[ConstIde::NUMBER_0].f32 = ConstIde::TEXT_HEIGHT_VP;
|
|
1236
|
+
nodeAPI_->setAttribute(textNode, NODE_HEIGHT, &item);
|
|
1237
|
+
value[ConstIde::NUMBER_0].u32 = ConstIde::TEXT_BG_COLOR;
|
|
1238
|
+
nodeAPI_->setAttribute(textNode, NODE_BACKGROUND_COLOR, &item);
|
|
1239
|
+
value[ConstIde::NUMBER_0].i32 = ConstIde::TEXT_ALIGN_CENTER;
|
|
1240
|
+
nodeAPI_->setAttribute(textNode, NODE_TEXT_ALIGN, &item);
|
|
1241
|
+
value[ConstIde::NUMBER_0].f32 = ConstIde::TEXT_FONT_SIZE_VP;
|
|
1242
|
+
nodeAPI_->setAttribute(textNode, NODE_FONT_SIZE, &item);
|
|
1243
|
+
|
|
1244
|
+
ArkUI_AttributeItem textId = {.string = "SwiperAutoPlayText"};
|
|
1245
|
+
nodeAPI_->setAttribute(textNode, NODE_ID, &textId);
|
|
1246
|
+
nodeAPI_->addChild(swiper, textNode);
|
|
1247
|
+
}
|
|
1248
|
+
ArkUI_NumberValue value[] = {};
|
|
1249
|
+
ArkUI_AttributeItem item = {.value = value, .size = 1};
|
|
1250
|
+
|
|
1251
|
+
value[0].f32 = 300;
|
|
1252
|
+
nodeAPI_->setAttribute(swiper, NODE_WIDTH, &item);
|
|
1253
|
+
|
|
1254
|
+
nodeAPI_->setLengthMetricUnit(swiper, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_PX);
|
|
1255
|
+
nodeAPI_->registerNodeEvent(swiper, NODE_SWIPER_EVENT_ON_CONTENT_DID_SCROLL, 0, nullptr);
|
|
1256
|
+
nodeAPI_->addNodeEventReceiver(swiper, [](ArkUI_NodeEvent *event) {
|
|
1257
|
+
ArkUI_NodeComponentEvent* compEvent = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event) ;
|
|
1258
|
+
int selectedIndex = compEvent->data[0].i32;
|
|
1259
|
+
int index = compEvent->data[1].i32;
|
|
1260
|
+
float position = compEvent->data[2].f32;
|
|
1261
|
+
float maxAxisLength = compEvent->data[3].f32;
|
|
1262
|
+
// 变更前页面真实的长度为maxAxisLength * 屏幕像素密度,变更后为maxAxisLength
|
|
1263
|
+
OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "Manager", "maxAxisLength: %{public}f", maxAxisLength);
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
### @ReusableV2组件复用的reuse属性支持动态复用标识
|
|
1269
|
+
|
|
1270
|
+
**变更原因**
|
|
1271
|
+
|
|
1272
|
+
当前[@ReusableV2](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-new-reusablev2)装饰器装饰的自定义组件的reuse属性不支持使用动态的reuseId,变更后可增强V2组件复用能力,支持动态复用标识。
|
|
1273
|
+
|
|
1274
|
+
**变更影响**
|
|
1275
|
+
|
|
1276
|
+
此变更涉及应用适配。
|
|
1277
|
+
|
|
1278
|
+
- 变更前:如果开发者使用了如下所示等非显式返回字符串字面量形式的reuseId,实际的复用标识ID为该可复用自定义组件的名称。
|
|
1279
|
+
|
|
1280
|
+
- 变更后:如果开发者使用了下述形式的reuseId,实际的复用标识ID为该回调的返回值。
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
```
|
|
1284
|
+
const globalReuseId: string = 'globalReuseId';
|
|
1285
|
+
@Entry
|
|
1286
|
+
@ComponentV2
|
|
1287
|
+
struct Index {
|
|
1288
|
+
getReuseIdInMethod(idNumber: number): string {
|
|
1289
|
+
return `reuseIdInMethod${idNumber}`;
|
|
1290
|
+
}
|
|
1291
|
+
build() {
|
|
1292
|
+
Column() {
|
|
1293
|
+
ReusableV2Component()
|
|
1294
|
+
// 变更前实际复用标识为自定义组件名称"ReusableV2Component"
|
|
1295
|
+
// 变更后实际复用标识为"globalReuseId"
|
|
1296
|
+
.reuse({reuseId: () => globalReuseId})
|
|
1297
|
+
ReusableV2Component()
|
|
1298
|
+
// 变更前实际复用标识为自定义组件名称"ReusableV2Component"
|
|
1299
|
+
// 变更后实际复用标识为"reuseIdInMethod1"
|
|
1300
|
+
.reuse({reuseId: () => this.getReuseIdInMethod(1)})
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
@ReusableV2
|
|
1305
|
+
@ComponentV2
|
|
1306
|
+
struct ReusableV2Component {
|
|
1307
|
+
build() {
|
|
1308
|
+
Column() {
|
|
1309
|
+
Text('ReusableV2Component')
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
**起始 API Level**
|
|
1316
|
+
|
|
1317
|
+
18
|
|
1318
|
+
|
|
1319
|
+
**变更的接口/组件**
|
|
1320
|
+
|
|
1321
|
+
涉及接口:[ReuseOptions](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-reuse#reuseoptions)里的reuseId参数。
|
|
1322
|
+
|
|
1323
|
+
变更前后会受到影响的组件为@ReusableV2装饰器装饰的自定义组件。该变更可能导致:
|
|
1324
|
+
|
|
1325
|
+
- 原本可以相互复用的自定义组件无法再相互复用:
|
|
1326
|
+
|
|
1327
|
+
```
|
|
1328
|
+
@Entry
|
|
1329
|
+
@ComponentV2
|
|
1330
|
+
struct Index {
|
|
1331
|
+
getReuseIdInMethod(idNumber: number): string {
|
|
1332
|
+
return `reuseIdInMethod${idNumber}`;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
build() {
|
|
1336
|
+
Column() {
|
|
1337
|
+
// 变更后,在API版本26.0.0及以上,下述两个ReusableComponentOne组件的实际复用标识不一致,无法相互复用。
|
|
1338
|
+
ReusableComponentOne()
|
|
1339
|
+
// 变更前实际复用标识为自定义组件名称"ReusableComponentOne"
|
|
1340
|
+
// 变更后实际复用标识为"reuseIdInMethod1"
|
|
1341
|
+
.reuse({reuseId: () => this.getReuseIdInMethod(1)})
|
|
1342
|
+
ReusableComponentOne()
|
|
1343
|
+
// 变更前实际复用标识为自定义组件名称"ReusableComponentOne"
|
|
1344
|
+
// 变更后实际复用标识为"reuseIdInMethod2"
|
|
1345
|
+
.reuse({reuseId: () => this.getReuseIdInMethod(2)})
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
@ReusableV2
|
|
1350
|
+
@ComponentV2
|
|
1351
|
+
struct ReusableComponentOne {
|
|
1352
|
+
build() {
|
|
1353
|
+
Column() {
|
|
1354
|
+
Text('ReusableComponentOne')
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
- 原本不可以相互复用的自定义组件可以相互复用:
|
|
1361
|
+
|
|
1362
|
+
```
|
|
1363
|
+
@Entry
|
|
1364
|
+
@ComponentV2
|
|
1365
|
+
struct Index {
|
|
1366
|
+
getReuseIdInMethod(idNumber: number): string {
|
|
1367
|
+
return `reuseIdInMethod${idNumber}`;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
build() {
|
|
1371
|
+
Column() {
|
|
1372
|
+
// 变更后,在API版本26.0.0及以上ReusableComponentOne和ReusableComponentTwo组件实际复用标识一致,可以相互复用
|
|
1373
|
+
ReusableComponentOne()
|
|
1374
|
+
// 变更前实际复用标识为自定义组件名称"ReusableComponentOne"
|
|
1375
|
+
// 变更后实际复用标识为"reuseIdInMethod1"
|
|
1376
|
+
.reuse({reuseId: () => this.getReuseIdInMethod(1)})
|
|
1377
|
+
ReusableComponentTwo()
|
|
1378
|
+
// 变更前实际复用标识为自定义组件名称"ReusableComponentTwo"
|
|
1379
|
+
// 变更后实际复用标识为"reuseIdInMethod1"
|
|
1380
|
+
.reuse({reuseId: () => this.getReuseIdInMethod(1)})
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
@ReusableV2
|
|
1385
|
+
@ComponentV2
|
|
1386
|
+
struct ReusableComponentOne {
|
|
1387
|
+
build() {
|
|
1388
|
+
Column() {
|
|
1389
|
+
Text('ReusableComponentOne')
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
@ReusableV2
|
|
1394
|
+
@ComponentV2
|
|
1395
|
+
struct ReusableComponentTwo {
|
|
1396
|
+
build() {
|
|
1397
|
+
Column() {
|
|
1398
|
+
Text('ReusableComponentTwo')
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
```
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
**适配指导**
|
|
1406
|
+
|
|
1407
|
+
对于不希望相互复用的V2复用组件,使用不同的复用标识reuseId;对于希望相互复用的组件,使用相同的复用标识reuseId。例如,当希望如下两个组件ComponentA和ComponentB组件可以相互复用时,设置同样的复用标识。点击按钮让两个组件消失,二者进入同一复用池中,可以相互复用。再次点击任一按钮,后进入复用池的组件先显示到页面上:
|
|
1408
|
+
|
|
1409
|
+
```
|
|
1410
|
+
const globalReuseId = 'globalReuseId';
|
|
1411
|
+
@Entry
|
|
1412
|
+
@ComponentV2
|
|
1413
|
+
struct Index {
|
|
1414
|
+
@Local condition1: boolean = true;
|
|
1415
|
+
@Local condition2: boolean = true;
|
|
1416
|
+
build() {
|
|
1417
|
+
Column({ space: 10 }) {
|
|
1418
|
+
// 变更后,在API版本26.0.0及以上ComponentA和ComponentB组件实际复用标识一致,均为'globalReuseId',可以相互复用。
|
|
1419
|
+
Button('change condition1')
|
|
1420
|
+
.onClick(() => { this.condition1 = !this.condition1; })
|
|
1421
|
+
Button('change condition2')
|
|
1422
|
+
.onClick(() => { this.condition2 = !this.condition2; })
|
|
1423
|
+
if (this.condition1) {
|
|
1424
|
+
ComponentA().reuse({ reuseId: () => globalReuseId })
|
|
1425
|
+
}
|
|
1426
|
+
if (this.condition2) {
|
|
1427
|
+
ComponentB().reuse({ reuseId: () => globalReuseId })
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
@ReusableV2
|
|
1433
|
+
@ComponentV2
|
|
1434
|
+
struct ComponentA {
|
|
1435
|
+
build() {
|
|
1436
|
+
Column() {
|
|
1437
|
+
Text('ComponentA')
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
@ReusableV2
|
|
1442
|
+
@ComponentV2
|
|
1443
|
+
struct ComponentB {
|
|
1444
|
+
build() {
|
|
1445
|
+
Column() {
|
|
1446
|
+
Text('ComponentB')
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
```
|
|
1451
|
+
|
|
1452
|
+
### 组件的阴影模糊半径规格变更
|
|
1453
|
+
|
|
1454
|
+
**变更原因**
|
|
1455
|
+
|
|
1456
|
+
修改阴影模糊半径生效范围,使shadow属性中的所有阴影类型新增支持模糊半径为0时的阴影能力。
|
|
1457
|
+
|
|
1458
|
+
**变更影响**
|
|
1459
|
+
|
|
1460
|
+
此变更涉及应用适配。
|
|
1461
|
+
|
|
1462
|
+
**说明**
|
|
1463
|
+
|
|
1464
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
1465
|
+
|
|
1466
|
+
变更前:通过shadow属性添加阴影效果,将参数ShadowOptions中的阴影模糊半径radius设置为0时,无阴影;设置为负数时按0处理,无阴影。
|
|
1467
|
+
|
|
1468
|
+
变更后:通过shadow属性添加阴影效果,将参数ShadowOptions中的阴影模糊半径radius设置为0时,存在阴影但不存在模糊效果;设置为负数时,无阴影。
|
|
1469
|
+
|
|
1470
|
+
例如使用以下代码片段,通过shadow设置Column组件的边框阴影效果,变更前radius设置0和-1效果一致,变更后radius设置0且带有偏移量[OffsetX](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-image-effect#shadowoptions对象说明)或[OffsetY](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-image-effect#shadowoptions对象说明)时会有无模糊阴影显示。
|
|
1471
|
+
|
|
1472
|
+
```
|
|
1473
|
+
// xxx.ets
|
|
1474
|
+
@Entry
|
|
1475
|
+
@Component
|
|
1476
|
+
struct Index {
|
|
1477
|
+
private shadowValue: Array<ShadowOptions> = [
|
|
1478
|
+
{ radius: -1 },
|
|
1479
|
+
{ radius: -1, offsetX: 20, offsetY: 20 },
|
|
1480
|
+
{ radius: 0 },
|
|
1481
|
+
{ radius: 0, offsetX: 20, offsetY: 20 },
|
|
1482
|
+
{ radius: 50 },
|
|
1483
|
+
{ radius: 50, offsetX: 20, offsetY: 20 },
|
|
1484
|
+
];
|
|
1485
|
+
|
|
1486
|
+
build() {
|
|
1487
|
+
Column() {
|
|
1488
|
+
Row({ space: 10 }) {
|
|
1489
|
+
Column({ space: 20 }) {
|
|
1490
|
+
Text('ShadowType.Color')
|
|
1491
|
+
|
|
1492
|
+
ForEach(this.shadowValue, (shadow: ShadowOptions) => {
|
|
1493
|
+
Column()
|
|
1494
|
+
.width(100)
|
|
1495
|
+
.height(50)
|
|
1496
|
+
.borderRadius(10)
|
|
1497
|
+
.backgroundColor(Color.Pink)
|
|
1498
|
+
.shadow({
|
|
1499
|
+
radius: shadow.radius,
|
|
1500
|
+
color: Color.Green,
|
|
1501
|
+
offsetX: shadow.offsetX,
|
|
1502
|
+
offsetY: shadow.offsetY
|
|
1503
|
+
})
|
|
1504
|
+
})
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
Column({ space: 20 }) {
|
|
1508
|
+
Text('ShadowType.Blur')
|
|
1509
|
+
|
|
1510
|
+
ForEach(this.shadowValue, (shadow: ShadowOptions) => {
|
|
1511
|
+
Column()
|
|
1512
|
+
.width(100)
|
|
1513
|
+
.height(50)
|
|
1514
|
+
.borderRadius(10)
|
|
1515
|
+
.backgroundColor(Color.Pink)
|
|
1516
|
+
.shadow({
|
|
1517
|
+
radius: shadow.radius,
|
|
1518
|
+
type: ShadowType.BLUR,
|
|
1519
|
+
offsetX: shadow.offsetX,
|
|
1520
|
+
offsetY: shadow.offsetY
|
|
1521
|
+
})
|
|
1522
|
+
})
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
.width('100%')
|
|
1527
|
+
.height('100%')
|
|
1528
|
+
.justifyContent(FlexAlign.Center)
|
|
1529
|
+
.alignItems(HorizontalAlign.Center)
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
```
|
|
1533
|
+
|
|
1534
|
+
| 变更前 | 变更后 |
|
|
1535
|
+
| --- | --- |
|
|
1536
|
+
|  |  |
|
|
1537
|
+
|
|
1538
|
+
**起始 API Level**
|
|
1539
|
+
|
|
1540
|
+
7
|
|
1541
|
+
|
|
1542
|
+
**变更的接口/组件**
|
|
1543
|
+
|
|
1544
|
+
通用属性[shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-image-effect#shadow)的[ShadowOptions.radius](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-image-effect#shadowoptions对象说明)参数。
|
|
1545
|
+
|
|
1546
|
+
列表选择弹窗组件的[actionsheetoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-action-sheet#actionsheetoptions对象说明)。
|
|
1547
|
+
|
|
1548
|
+
警告弹窗组件的[alertdialogparam.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-alert-dialog-box#alertdialogparam对象说明)。
|
|
1549
|
+
|
|
1550
|
+
日历选择器弹窗组件的[calendardialogoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-calendarpicker-dialog#calendardialogoptions对象说明)。
|
|
1551
|
+
|
|
1552
|
+
自定义弹窗组件的[customdialogcontrolleroptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-custom-dialog-box#customdialogcontrolleroptions对象说明)。
|
|
1553
|
+
|
|
1554
|
+
日期滑动选择器弹窗组件的[datepickerdialogoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-datepicker-dialog#datepickerdialogoptions对象说明)。
|
|
1555
|
+
|
|
1556
|
+
文本滑动选择器弹窗组件的[textpickerdialogoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-textpicker-dialog#textpickerdialogoptions对象说明)和[TextPickerDialogOptionsExt.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-textpicker-dialog#textpickerdialogoptionsext20对象说明)。
|
|
1557
|
+
|
|
1558
|
+
时间滑动选择器弹窗组件的[timepickerdialogoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-methods-timepicker-dialog#timepickerdialogoptions对象说明)。
|
|
1559
|
+
|
|
1560
|
+
半模态转场的[sheetoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-sheet-transition#sheetoptions)。
|
|
1561
|
+
|
|
1562
|
+
Popup控制的[popupoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-popup#popupoptions类型说明)、[custompopupoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-popup#custompopupoptions8类型说明)和[popupcommonoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-popup#popupcommonoptions18类型说明)。
|
|
1563
|
+
|
|
1564
|
+
弹窗的[showtoastoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-promptaction#showtoastoptions)、[showdialogoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-promptaction#showdialogoptions)和[customdialogoptions.shadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-promptaction#customdialogoptions11)。
|
|
1565
|
+
|
|
1566
|
+
SegmentButtonV2组件的[TabSegmentButtonV2.itemShadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ohos-arkui-advanced-segmentbuttonv2#tabsegmentbuttonv2)和[CapsuleSegmentButtonV2.itemShadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ohos-arkui-advanced-segmentbuttonv2#capsulesegmentbuttonv2)。
|
|
1567
|
+
|
|
1568
|
+
symbolglyph组件的[symbolShadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-symbolglyph#symbolshadow20)。
|
|
1569
|
+
|
|
1570
|
+
**适配指导**
|
|
1571
|
+
|
|
1572
|
+
如果应用在API版本26.0.0及之后期望阴影消失,需要将radius的取值从0调整为-1。如果期望保留阴影但不产生模糊效果,应将radius设置为0。
|
|
1573
|
+
|
|
1574
|
+
Text组件的[textShadow](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-text#textshadow10)不发生规格变更,仍然维持原有规格。
|
|
1575
|
+
|
|
1576
|
+
## ArkWeb
|
|
1577
|
+
|
|
1578
|
+
### ArkWeb基于上游社区的Chromium内核从132升级为144版本
|
|
1579
|
+
|
|
1580
|
+
**变更原因**
|
|
1581
|
+
|
|
1582
|
+
为了提升使用ArkWeb内核应用的安全性,开发者使用最新的W3C HTML5特性,以及获得Chromium上游社区最新的性能体验优化成果,故本次进行内核升级(132 -> 144)。
|
|
1583
|
+
|
|
1584
|
+
**变更影响**
|
|
1585
|
+
|
|
1586
|
+
从上游社区323项功能变更说明,以及社区1000+问题单分析,WPT测试集结果分析,当前共发现100+项需要开发者注意的变更点,请参考[ArkWeb 版本的差异总结](https://gitcode.com/openharmony-tpc/chromium_src/blob/master/web/ReleaseNote/ArkWeb_132_144.md)。
|
|
1587
|
+
|
|
1588
|
+
**起始 API Level**
|
|
1589
|
+
|
|
1590
|
+
不涉及
|
|
1591
|
+
|
|
1592
|
+
**变更的接口/组件**
|
|
1593
|
+
|
|
1594
|
+
ArkWeb
|
|
1595
|
+
|
|
1596
|
+
**适配指导**
|
|
1597
|
+
|
|
1598
|
+
如果在应用中使用Web组件展示网页内容,则需要遵循[ArkWeb 版本的差异总结](https://gitcode.com/openharmony-tpc/chromium_src/blob/master/web/ReleaseNote/ArkWeb_132_144.md)中所涉及的最新W3C规格变更。
|
|
1599
|
+
|
|
1600
|
+
## Media Library Kit
|
|
1601
|
+
|
|
1602
|
+
### 通过ohos.permission.READ\_IMAGEVIDEO权限可读取的媒体库文件的范围变更
|
|
1603
|
+
|
|
1604
|
+
**变更原因**
|
|
1605
|
+
|
|
1606
|
+
限制网盘等应用访问云图库的图片或视频,避免因为访问云图库资产导致隐私安全与设备功耗高、发热等问题。
|
|
1607
|
+
|
|
1608
|
+
**变更影响**
|
|
1609
|
+
|
|
1610
|
+
此变更涉及应用适配。
|
|
1611
|
+
|
|
1612
|
+
变更前:应用申请ohos.permission.READ\_IMAGEVIDEO权限,调用Media Library Kit接口可以获取云图库和本地图片或视频。
|
|
1613
|
+
|
|
1614
|
+
变更后:应用申请ohos.permission.READ\_IMAGEVIDEO权限,调用Media Library Kit接口仅可以获取本地图片或视频。
|
|
1615
|
+
|
|
1616
|
+
**起始 API Level**
|
|
1617
|
+
|
|
1618
|
+
API 9
|
|
1619
|
+
|
|
1620
|
+
**变更的接口/组件**
|
|
1621
|
+
|
|
1622
|
+
- PhotoAccessHelper.getAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<PhotoAsset>>): void;
|
|
1623
|
+
|
|
1624
|
+
- PhotoAccessHelper.getAssets(options: FetchOptions): Promise<FetchResult<PhotoAsset>>;
|
|
1625
|
+
|
|
1626
|
+
- PhotoAccessHelper.getBurstAssets(burstKey: string, options: FetchOptions): Promise<FetchResult<PhotoAsset>>;
|
|
1627
|
+
|
|
1628
|
+
- AbsAlbum.getAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<PhotoAsset>>): void;
|
|
1629
|
+
|
|
1630
|
+
- AbsAlbum.getAssets(options: FetchOptions): Promise<FetchResult<PhotoAsset>>;
|
|
1631
|
+
|
|
1632
|
+
- fileIo.open(path: string, mode?: number): Promise<File>;
|
|
1633
|
+
|
|
1634
|
+
- fileIo.open(path: string, callback: AsyncCallback<File>): void;
|
|
1635
|
+
|
|
1636
|
+
- fileIo.open(path: string, mode: number, callback: AsyncCallback<File>): void;
|
|
1637
|
+
|
|
1638
|
+
- fileIo.openSync(path: string, mode?: number): File;
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
**适配指导**
|
|
1642
|
+
|
|
1643
|
+
涉及默认行为变更:变更前应用能访问云图库和本地图片或视频,变更后应用仅能访问本地图片或视频。
|
|
1644
|
+
|
|
1645
|
+
如果应用需要访问云图库的图片或视频,请通过PhotoViewPicker进行访问。
|
|
1646
|
+
|
|
1647
|
+
## Network Kit
|
|
1648
|
+
|
|
1649
|
+
### getUidRxBytes、getUidTxBytes接口权限变更
|
|
1650
|
+
|
|
1651
|
+
**变更原因**
|
|
1652
|
+
|
|
1653
|
+
getUidRxBytes、getUidTxBytes接口需要添加权限管控。
|
|
1654
|
+
|
|
1655
|
+
**变更影响**
|
|
1656
|
+
|
|
1657
|
+
此变更涉及应用适配。
|
|
1658
|
+
|
|
1659
|
+
**说明**
|
|
1660
|
+
|
|
1661
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
1662
|
+
|
|
1663
|
+
变更前:应用可通过本接口传入指定Uid查询其上下行流量数据。
|
|
1664
|
+
|
|
1665
|
+
变更后:若接口传入的Uid为自身应用Uid,则无需申请权限,接口行为与变更前一致;若接口传入的Uid非自身应用Uid时,需要申请ohos.permission.GET\_NETWORK\_STATS权限,其授权方式为system\_grant,当前只允许MDM应用申请。
|
|
1666
|
+
|
|
1667
|
+
**起始 API Level**
|
|
1668
|
+
|
|
1669
|
+
API 10
|
|
1670
|
+
|
|
1671
|
+
**变更的接口/组件**
|
|
1672
|
+
|
|
1673
|
+
statistics.getUidRxBytes(uid: number, callback: AsyncCallback<number>): void
|
|
1674
|
+
|
|
1675
|
+
statistics.getUidRxBytes(uid: number): Promise<number>
|
|
1676
|
+
|
|
1677
|
+
statistics.getUidTxBytes(uid: number, callback: AsyncCallback<number>): void
|
|
1678
|
+
|
|
1679
|
+
statistics.getUidTxBytes(uid: number): Promise<number>
|
|
1680
|
+
|
|
1681
|
+
**适配指导**
|
|
1682
|
+
|
|
1683
|
+
1. 若应用仅使用上述接口查询自身流量,则无需适配;
|
|
1684
|
+
2. 若非MDM应用使用上述接口查询其他应用流量,则需审视调用场景,若有影响需根据自身业务代码进行对应适配;
|
|
1685
|
+
3. 若MDM应用使用上述接口查询其他应用流量,则需要申请ohos.permission.GET\_NETWORK\_STATS权限,接口其他行为与变更前一致。
|
|
1686
|
+
|
|
1687
|
+
## 权限管控
|
|
1688
|
+
|
|
1689
|
+
### 权限策略变更说明
|
|
1690
|
+
|
|
1691
|
+
**变更原因**
|
|
1692
|
+
|
|
1693
|
+
Binary(可执行二进制,以下简称bin)是操作系统中可通过execve系统调用创建为独立进程的文件,bin独立进程具备完整的程序入口点和运行时上下文,内核为其分配独立的地址空间、PID、文件描述符表等进程资源,同样它也具有独立的”进程身份”。
|
|
1694
|
+
|
|
1695
|
+
在历史版本中,系统已向应用开放了一些在内核进行权限管控的资源的权限,如ohos.permission.kernel.ALLOW\_WRITABLE\_CODE\_MEMORY(允许应用申请可执行的匿名内存)。这类权限在权限名中带有“.kernel”字段,这类权限被称为kernelpermission。
|
|
1696
|
+
|
|
1697
|
+
从ROM版本7.0开始,bin进程若想要使用kernelpermission的权限,需要应用主动为bin声明权限并签名。
|
|
1698
|
+
|
|
1699
|
+
**变更影响**
|
|
1700
|
+
|
|
1701
|
+
此变更涉及应用适配。
|
|
1702
|
+
|
|
1703
|
+
**说明**
|
|
1704
|
+
|
|
1705
|
+
此变更已做版本隔离,变更仅在应用的targetSdkVersion设置为大于等于26.0.0时生效。
|
|
1706
|
+
|
|
1707
|
+
变更后:
|
|
1708
|
+
|
|
1709
|
+
- 开发者使用的API版本小于26.0.0:应用不受影响,建议开发者尽早适配。
|
|
1710
|
+
- 开发者使用的API版本大于等于26.0.0:应用进程执行bin,bin不再自动继承应用的kernelpermission,需要bin主动声明权限。
|
|
1711
|
+
|
|
1712
|
+
**起始 API Level**
|
|
1713
|
+
|
|
1714
|
+
14
|
|
1715
|
+
|
|
1716
|
+
**变更的接口/组件**
|
|
1717
|
+
|
|
1718
|
+
不涉及
|
|
1719
|
+
|
|
1720
|
+
**适配指导**
|
|
1721
|
+
|
|
1722
|
+
1. 确认应用是否申请了权限名中带有”.kernel”的权限(kernelpermission),如果没有则不涉及本次适配。
|
|
1723
|
+
2. 该适配不涉及手机应用,手机应用不存在拉起bin独立进程的场景,但建议涉及kernelpermission的应用二次确认。
|
|
1724
|
+
3. 确认应用是否涉及拉起bin独立进程,没有则不涉及本次适配。
|
|
1725
|
+
4. 确认拉起的bin独立进程是否需要应用申请的kernelpermission,不需要则不涉及本次适配。
|
|
1726
|
+
|
|
1727
|
+
下图流程供应用参考进行排查,如果需要适配,则根据下文中的具体步骤进行适配。
|
|
1728
|
+
|
|
1729
|
+

|
|
1730
|
+
|
|
1731
|
+
适配步骤:
|
|
1732
|
+
|
|
1733
|
+
1. 设置bin需要的权限策略段。
|
|
1734
|
+
|
|
1735
|
+
新建一个json文件,下文称为example.json,开发者可根据需要自定义文件名。
|
|
1736
|
+
|
|
1737
|
+
该json文件格式如下:
|
|
1738
|
+
|
|
1739
|
+
```
|
|
1740
|
+
{
|
|
1741
|
+
// binary涉及的权限都需要填写,除权限名带kernel字段的kernelpermission外,需要的其他permission也要填写。
|
|
1742
|
+
"requestPermissions":[
|
|
1743
|
+
{
|
|
1744
|
+
"name": "ohos.permission.kernel.xxx"
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
"name": "ohos.permission.xxx"
|
|
1748
|
+
}
|
|
1749
|
+
]
|
|
1750
|
+
}
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
2. HNP中的bin授权。
|
|
1755
|
+
|
|
1756
|
+
1)HNP配置中配置"independentSign": true (API 23生效),配置该字段后HNP包中的bin为独立授权,需要主动配置需要的权限。
|
|
1757
|
+
|
|
1758
|
+
配置的权限除kernelpermission外,其余需要的权限也需要放入,如不确定权限策略文件中需要配置的权限,也可以直接配置ohos.permission.INHERIT\_PARENT\_PERMISSION,系统会自动帮bin进程继承可以继承的父进程权限,示例配置如下:
|
|
1759
|
+
|
|
1760
|
+
```
|
|
1761
|
+
{
|
|
1762
|
+
"requestPermissions":[
|
|
1763
|
+
{
|
|
1764
|
+
"name": "ohos.permission.INHERIT_PARENT_PERMISSION"
|
|
1765
|
+
}
|
|
1766
|
+
]
|
|
1767
|
+
}
|
|
1768
|
+
```
|
|
1769
|
+
|
|
1770
|
+
2)使用命令给bin文件(如下以myprogram举例)添加上权限段,然后重新打包。llvm-objcopy可通过[Command line tools](https://developer.huawei.com/consumer/cn/download/command-line-tools-for-hmos)获取。
|
|
1771
|
+
|
|
1772
|
+
使用步骤1中新建的example.json,执行如下命令:
|
|
1773
|
+
|
|
1774
|
+
```
|
|
1775
|
+
llvm-objcopy --add-section .permission=path/to/example.json myprogram myprogram_modified
|
|
1776
|
+
```
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
3. 非HNP的二进制授权方法。
|
|
1780
|
+
|
|
1781
|
+
1)获取二进制签名工具。签名工具获取地址:[binary-sign-tool](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/binary-sign-tool)
|
|
1782
|
+
|
|
1783
|
+
2)准备好证书、p12等文件后,使用二进制签名工具设置权限策略段,对应签名工具命令-moduleFile参数,json文件为[步骤1 - 设置bin需要的权限策略段](#li10472721191517)中新建的json文件。
|
|
1784
|
+
|
|
1785
|
+
```
|
|
1786
|
+
./binary-sign-tool sign -keyAlias "基于csr生成时的填写结果补充" -signAlg "SHA256withECDSA" -appCertFile "基于csr生成时的pem文件补充" -inFile "hello" -keystoreFile "基于csr生成时的p12文件名补充" -outFile "signed_hello_release" -keyPwd "基于csr文件密钥补充" -keystorePwd "基于csr文件密钥补充" -moduleFile "权限策略段json文件名" -selfSign 0
|
|
1787
|
+
```
|
|
1788
|
+
|
|
1789
|
+
样例:
|
|
1790
|
+
|
|
1791
|
+
```
|
|
1792
|
+
./binary-sign-tool sign -keyAlias "openharmony application release" -signAlg "SHA256withECDSA" -appCertFile "OpenHarmonyApplication-old-test-ou1031.pem" -inFile "hello" -keystoreFile "OpenHarmony.p12" -outFile "signed_hello_release" -keyPwd "123456" -keystorePwd "123456" -moduleFile "example.json" -selfSign 0
|
|
1793
|
+
```
|