已合并
提交UIExtensionContentSessionTest case #22908
Dongwei创建于 2025年3月31日
提交UIExtensionContentSessionTest case #22908
已合并
Dongwei创建于 2025年3月31日
refs/pull/22908/head合入到master
77 个文件变更+1037-84
@@ -1,4 +1,4 @@
1-# Copyright (c) 2023 Huawei Device Co., Ltd.1+# Copyright (c) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (c) 2024 Huawei Device Co., Ltd.1+# Copyright (c) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -13,8 +13,11 @@
13 * limitations under the License.13 * limitations under the License.
14 */14 */
15import sendableContextManagerTest from './sendableContextManager.test'15import sendableContextManagerTest from './sendableContextManager.test'
16-import UIAbilityContex from './UIAbilityContex.test';16+import UIAbilityContext from './UIAbilityContext.test';
17+import UIExtensionContentSessionTest from './UIExtensionContentSession.test'
18+ 
17export default function testsuite() {19export default function testsuite() {
18 sendableContextManagerTest();20 sendableContextManagerTest();
19- UIAbilityContex();21+ UIExtensionContentSessionTest()
22+ UIAbilityContext();
20}23}
@@ -31,7 +31,7 @@ export default class MainAbility1 extends UIAbility {
31 // Main window is created, set main page for this ability31 // Main window is created, set main page for this ability
32 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');32 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
33 33 
34- windowStage.loadContent('MainAbility/MainAbility1_pages', (err, data) => {34+ windowStage.loadContent('testability/pages/MainAbility/MainAbility1_pages', (err, data) => {
35 if (err.code) {35 if (err.code) {
36 hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');36 hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
37 return;37 return;
@@ -31,7 +31,7 @@ export default class MainAbility2 extends UIAbility {
31 // Main window is created, set main page for this ability31 // Main window is created, set main page for this ability
32 hilog.info(0x0000, 'testTag', '%{public}s', 'MainAbility2 onWindowStageCreate');32 hilog.info(0x0000, 'testTag', '%{public}s', 'MainAbility2 onWindowStageCreate');
33 33 
34- windowStage.loadContent('MainAbility/MainAbility2_pages', (err, data) => {34+ windowStage.loadContent('testability/pages/MainAbility/MainAbility2_pages', (err, data) => {
Dongwei
DongweiDongwei2025年6月11日

为啥提供的页面搜不到呢??

输入图片说明

likedislike
35 if (err.code) {35 if (err.code) {
36 hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');36 hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
37 return;37 return;
Rability/ability_runtime/actsabilityerrcodequery/actsabilityerrcodequerytest/entry/src/ohosTest/ets/test/UIAbilityContex.test.etsability/ability_runtime/actsabilityerrcodequery/actsabilityerrcodequerytest/entry/src/ohosTest/ets/test/UIAbilityContext.test.ets+37-6
@@ -46,8 +46,8 @@ function generateLargeString(length: number): string {
46}46}
47let TestAbilityContext:common.UIAbilityContext;47let TestAbilityContext:common.UIAbilityContext;
48let mpEnable="";48let mpEnable="";
49-export default function UIAbilityContex() {49+export default function UIAbilityContext() {
50- describe('ActsAbilityTest', () => {50+ describe('UIAbilityContext', () => {
51 // Defines a test suite. Two parameters are supported: test suite name and test suite function.51 // Defines a test suite. Two parameters are supported: test suite name and test suite function.
52 beforeAll(() => {52 beforeAll(() => {
53 // Presets an action, which is performed only once before all test cases of the test suite start.53 // Presets an action, which is performed only once before all test cases of the test suite start.
@@ -123,7 +123,7 @@ export default function UIAbilityContex() {
123 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_startupManager_isStartupTaskInitialized_0100123 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_startupManager_isStartupTaskInitialized_0100
124 * @tc.desc: isStartupTaskInitialized parameter error, pass undefined124 * @tc.desc: isStartupTaskInitialized parameter error, pass undefined
125 */125 */
126- it('SUB_Ability_AbilityRuntime_ErrorCode_startupManager_isStartupTaskInitialized_0100', 0,126+ it('SUB_Ability_AbilityRuntime_ErrorCode_startupManager_isStartupTaskInitialized_0100', Level.LEVEL0,
127 async (done: Function) => {127 async (done: Function) => {
128 try {128 try {
129 const data = startupManager.isStartupTaskInitialized(undefined)129 const data = startupManager.isStartupTaskInitialized(undefined)
@@ -139,7 +139,7 @@ export default function UIAbilityContex() {
139 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_startupManager_removeStartupTaskResult_0100139 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_startupManager_removeStartupTaskResult_0100
140 * @tc.desc: removeStartupTaskResult parameter error, pass undefined140 * @tc.desc: removeStartupTaskResult parameter error, pass undefined
141 */141 */
142- it('SUB_Ability_AbilityRuntime_ErrorCode_startupManager_removeStartupTaskResult_0100', 0,142+ it('SUB_Ability_AbilityRuntime_ErrorCode_startupManager_removeStartupTaskResult_0100', Level.LEVEL0,
143 async (done: Function) => {143 async (done: Function) => {
144 try {144 try {
145 const data = startupManager.removeStartupTaskResult(undefined)145 const data = startupManager.removeStartupTaskResult(undefined)
@@ -463,7 +463,7 @@ export default function UIAbilityContex() {
463 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0300463 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0300
464 * @tc.desc: startAbilityForResult set flags=-1 Async464 * @tc.desc: startAbilityForResult set flags=-1 Async
465 */465 */
466- it('SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0300', 0,466+ it('SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0300', Level.LEVEL0,
467 async (done: Function) => {467 async (done: Function) => {
468 let startWant: Want = {468 let startWant: Want = {
469 bundleName: 'com.test.actsabilityerrcodequerytest',469 bundleName: 'com.test.actsabilityerrcodequerytest',
@@ -491,7 +491,7 @@ export default function UIAbilityContex() {
491 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0800491 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0800
492 * @tc.desc: startAbilityForResult set flags=-1 Promise492 * @tc.desc: startAbilityForResult set flags=-1 Promise
493 */493 */
494- it('SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0800', 0,494+ it('SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbilityForResult_0800', Level.LEVEL0,
495 async (done: Function) => {495 async (done: Function) => {
496 let startWant: Want = {496 let startWant: Want = {
497 bundleName: 'com.test.actsabilityerrcodequerytest',497 bundleName: 'com.test.actsabilityerrcodequerytest',
@@ -518,6 +518,37 @@ export default function UIAbilityContex() {
518 }518 }
519 })519 })
520 520 
521+ /**
522+ * @tc.number: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbility_0500
523+ * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbility_0500
524+ * @tc.desc: The premeters within the Want carry parameters with a size of more than 200k
525+ */
526+ it('SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbility_0500', Level.LEVEL0, async (done: Function) => {
527+ // 构造一个超过 200KB 的对象
528+ const largeObject = generateLargeString(TWO_HUNDRED_KB + 100)
529+ let startWant: Want = {
530+ bundleName: 'com.test.actsabilityerrcodequerytest',
531+ abilityName: 'MainAbility1',
532+ parameters: {
533+ key: largeObject
534+ }
535+ };
536+ try {
537+ globalThis.context.startAbility(startWant, (err: BusinessError) => {
538+ if (err.code) {
539+ console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
540+ expect(err.code).assertEqual(16000050)
541+ done();
542+ }
543+ console.info('startAbility succeed');
544+ });
545+ } catch (err) {
546+ let code = (err as BusinessError).code;
547+ let message = (err as BusinessError).message;
548+ console.error(`startAbility failed, code is ${code}, message is ${message}`);
549+ }
550+ })
551+ 
521 /**552 /**
522 * @tc.number: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbility_0100553 * @tc.number: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbility_0100
523 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbility_0100554 * @tc.name: SUB_Ability_AbilityRuntime_ErrorCode_UIAbilityContext_startAbility_0100
@@ -0,0 +1,476 @@
1+/**
2+ * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3+ * Licensed under the Apache License, Version 2.0 (the "License");
4+ * you may not use this file except in compliance with the License.
5+ * You may obtain a copy of the License at
6+ *
7+ * http://www.apache.org/licenses/LICENSE-2.0
8+ *
9+ * Unless required by applicable law or agreed to in writing, software
10+ * distributed under the License is distributed on an "AS IS" BASIS,
11+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ * See the License for the specific language governing permissions and
13+ * limitations under the License.
14+ */
15+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, Level, expect } from '@ohos/hypium';
16+import { commonEventManager, systemParameterEnhance } from '@kit.BasicServicesKit';
17+import base, { BusinessError } from '@ohos.base';
18+import { abilityAccessCtrl, common } from '@kit.AbilityKit';
19+import { router } from '@kit.ArkUI';
20+import { bundleManager } from '@kit.AbilityKit';
21+ 
22+let ACTS_EVENT: commonEventManager.CommonEventSubscribeInfo = {
23+ events: ['ACTS_TEST_LOADCONTENT',
24+ 'ACTS_TEST_IN_USER',
25+ 'ACTS_TEST_IN_PROVIDER',
26+ 'ACTS_TEST_TERMINATE',
27+ 'ACTS_TEST_DESTROY']
28+};
29+let subscriber: commonEventManager.CommonEventSubscriber;
30+let context = getContext(this) as common.UIAbilityContext;
31+let mpEnable: string;
32+ 
33+class MyRouterParam {
34+ constructor(from: string) {
35+ this.fromPage = from;
36+ }
37+ 
38+ fromPage: string = "";
39+}
40+ 
41+export default function UIExtensionContentSessionTest() {
42+ describe('UIExtensionContentSessionTest', () => {
43+ 
44+ beforeAll(() => {
45+ context = globalThis.context
46+ try {
47+ mpEnable = systemParameterEnhance.getSync('persist.sys.abilityms.multi_process_model');
48+ } catch (err) {
49+ console.error(`ACTS_NativeStartChildProcess Get system parameter error: ${JSON.stringify(err)}`);
50+ mpEnable = 'fail';
51+ }
52+ })
53+ beforeEach(() => {
54+ })
55+ afterEach(() => {
56+ })
57+ afterAll(() => {
58+ })
59+ 
60+ /*
61+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0100
62+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0100
63+ * @tc.desc : session.loadContent
64+ * @tc.size: MediumTest
65+ * @tc.type: Function
66+ * @tc.level : 0
67+ */
68+ it('Sub_UIExtensionContentSession_errorCode_0100', Level.LEVEL0, (done: Function) => {
69+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0100`;
70+ commonEventManager.createSubscriber(ACTS_EVENT)
71+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
72+ subscriber = commonEventSubscriber;
73+ let unSubscribeCallback = () => {
74+ setTimeout(async () => {
75+ console.info(`====>${tag} unSubscribeCallback`);
76+ if (mpEnable == 'true') {
77+ expect(globalThis.errCode).assertEqual(401)
78+ done();
79+ } else if (mpEnable == 'false') {
80+ done();
81+ }
82+ }, 1000);
83+ }
84+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
85+ console.log("subscribeCallBack success")
86+ if (data.event == 'ACTS_TEST_DESTROY') {
87+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
88+ setTimeout(() => {
89+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
90+ }, 500);
91+ }
92+ }
93+ commonEventManager.subscribe(subscriber, subscribeCallBack);
94+ setTimeout(async () => {
95+ if (mpEnable == 'true') {
96+ try {
97+ router.pushUrl({
98+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
99+ params: new MyRouterParam(tag)
100+ });
101+ console.info(tag, 'push page UIExtensionPage success');
102+ } catch (err) {
103+ console.info(tag, 'push page err,err is :', err);
104+ }
105+ } else if (mpEnable == 'false') {
106+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
107+ }
108+ }, 1000);
109+ })
110+ })
111+ 
112+ /*
113+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0200
114+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0200
115+ * @tc.desc : session.loadContentByName
116+ * @tc.size: MediumTest
117+ * @tc.type: Function
118+ * @tc.level : 0
119+ */
120+ it('Sub_UIExtensionContentSession_errorCode_0200', Level.LEVEL0, (done: Function) => {
121+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0200`;
122+ commonEventManager.createSubscriber(ACTS_EVENT)
123+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
124+ subscriber = commonEventSubscriber;
125+ let unSubscribeCallback = () => {
126+ setTimeout(async () => {
127+ console.info(`====>${tag} unSubscribeCallback`);
128+ if (mpEnable == 'true') {
129+ expect(globalThis.errCode).assertEqual(401)
130+ done();
131+ } else if (mpEnable == 'false') {
132+ done();
133+ }
134+ }, 1000);
135+ }
136+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
137+ console.log("subscribeCallBack success")
138+ if (data.event == 'ACTS_TEST_DESTROY') {
139+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
140+ setTimeout(() => {
141+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
142+ }, 500);
143+ }
144+ }
145+ commonEventManager.subscribe(subscriber, subscribeCallBack);
146+ setTimeout(async () => {
147+ if (mpEnable == 'true') {
148+ try {
149+ router.pushUrl({
150+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
151+ params: new MyRouterParam(tag)
152+ });
153+ console.info(tag, 'push page UIExtensionPage success');
154+ } catch (err) {
155+ console.info(tag, 'push page err,err is :', err);
156+ }
157+ } else if (mpEnable == 'false') {
158+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
159+ }
160+ }, 1000);
161+ })
162+ })
163+ 
164+ /*
165+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0300
166+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0300
167+ * @tc.desc : session.terminateSelfWithResult callback
168+ * @tc.size: MediumTest
169+ * @tc.type: Function
170+ * @tc.level : 0
171+ */
172+ it('Sub_UIExtensionContentSession_errorCode_0300', Level.LEVEL0, (done: Function) => {
173+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0300`;
174+ commonEventManager.createSubscriber(ACTS_EVENT)
175+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
176+ subscriber = commonEventSubscriber;
177+ let unSubscribeCallback = () => {
178+ setTimeout(async () => {
179+ console.info(`====>${tag} unSubscribeCallback`);
180+ if (mpEnable == 'true') {
181+ expect(globalThis.errCode).assertEqual(401)
182+ done();
183+ } else if (mpEnable == 'false') {
184+ done();
185+ }
186+ }, 1000);
187+ }
188+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
189+ console.log("subscribeCallBack success")
190+ if (data.event == 'ACTS_TEST_DESTROY') {
191+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
192+ setTimeout(() => {
193+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
194+ }, 500);
195+ }
196+ }
197+ commonEventManager.subscribe(subscriber, subscribeCallBack);
198+ setTimeout(async () => {
199+ if (mpEnable == 'true') {
200+ try {
201+ router.pushUrl({
202+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
203+ params: new MyRouterParam(tag)
204+ });
205+ console.info(tag, 'push page UIExtensionPage success');
206+ } catch (err) {
207+ console.info(tag, 'push page err,err is :', err);
208+ }
209+ } else if (mpEnable == 'false') {
210+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
211+ }
212+ }, 1000);
213+ })
214+ })
215+ 
216+ /*
217+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0400
218+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0400
219+ * @tc.desc : session.terminateSelfWithResult promise
220+ * @tc.size: MediumTest
221+ * @tc.type: Function
222+ * @tc.level : 0
223+ */
224+ it('Sub_UIExtensionContentSession_errorCode_0400', Level.LEVEL0, (done: Function) => {
225+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0400`;
226+ commonEventManager.createSubscriber(ACTS_EVENT)
227+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
228+ subscriber = commonEventSubscriber;
229+ let unSubscribeCallback = () => {
230+ setTimeout(async () => {
231+ console.info(`====>${tag} unSubscribeCallback`);
232+ if (mpEnable == 'true') {
233+ expect(globalThis.errCode).assertEqual(401)
234+ done();
235+ } else if (mpEnable == 'false') {
236+ done();
237+ }
238+ }, 1000);
239+ }
240+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
241+ console.log("subscribeCallBack success")
242+ if (data.event == 'ACTS_TEST_DESTROY') {
243+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
244+ setTimeout(() => {
245+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
246+ }, 500);
247+ }
248+ }
249+ commonEventManager.subscribe(subscriber, subscribeCallBack);
250+ setTimeout(async () => {
251+ if (mpEnable == 'true') {
252+ try {
253+ router.pushUrl({
254+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
255+ params: new MyRouterParam(tag)
256+ });
257+ console.info(tag, 'push page UIExtensionPage success');
258+ } catch (err) {
259+ console.info(tag, 'push page err,err is :', err);
260+ }
261+ } else if (mpEnable == 'false') {
262+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
263+ }
264+ }, 1000);
265+ })
266+ })
267+ 
268+ /*
269+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0500
270+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0500
271+ * @tc.desc : session.setWindowPrivacyMode promise
272+ * @tc.size: MediumTest
273+ * @tc.type: Function
274+ * @tc.level : 0
275+ */
276+ it('Sub_UIExtensionContentSession_errorCode_0500', Level.LEVEL0, (done: Function) => {
277+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0500`;
278+ commonEventManager.createSubscriber(ACTS_EVENT)
279+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
280+ subscriber = commonEventSubscriber;
281+ let unSubscribeCallback = () => {
282+ setTimeout(async () => {
283+ console.info(`====>${tag} unSubscribeCallback`);
284+ if (mpEnable == 'true') {
285+ expect(globalThis.errCode).assertEqual(401)
286+ done();
287+ } else if (mpEnable == 'false') {
288+ done();
289+ }
290+ }, 1000);
291+ }
292+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
293+ console.log("subscribeCallBack success")
294+ if (data.event == 'ACTS_TEST_DESTROY') {
295+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
296+ setTimeout(() => {
297+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
298+ }, 500);
299+ }
300+ }
301+ commonEventManager.subscribe(subscriber, subscribeCallBack);
302+ setTimeout(async () => {
303+ if (mpEnable == 'true') {
304+ try {
305+ router.pushUrl({
306+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
307+ params: new MyRouterParam(tag)
308+ });
309+ console.info(tag, 'push page UIExtensionPage success');
310+ } catch (err) {
311+ console.info(tag, 'push page err,err is :', err);
312+ }
313+ } else if (mpEnable == 'false') {
314+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
315+ }
316+ }, 1000);
317+ })
318+ })
319+ 
320+ /*
321+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0600
322+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0600
323+ * @tc.desc : session.setWindowPrivacyMode callback
324+ * @tc.size: MediumTest
325+ * @tc.type: Function
326+ * @tc.level : 0
327+ */
328+ it('Sub_UIExtensionContentSession_errorCode_0600', Level.LEVEL0, (done: Function) => {
329+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0600`;
330+ commonEventManager.createSubscriber(ACTS_EVENT)
331+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
332+ subscriber = commonEventSubscriber;
333+ let unSubscribeCallback = () => {
334+ setTimeout(async () => {
335+ console.info(`====>${tag} unSubscribeCallback`);
336+ if (mpEnable == 'true') {
337+ expect(globalThis.errCode).assertEqual(401)
338+ done();
339+ } else if (mpEnable == 'false') {
340+ done();
341+ }
342+ }, 1000);
343+ }
344+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
345+ console.log("subscribeCallBack success")
346+ if (data.event == 'ACTS_TEST_DESTROY') {
347+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
348+ setTimeout(() => {
349+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
350+ }, 500);
351+ }
352+ }
353+ commonEventManager.subscribe(subscriber, subscribeCallBack);
354+ setTimeout(async () => {
355+ if (mpEnable == 'true') {
356+ try {
357+ router.pushUrl({
358+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
359+ params: new MyRouterParam(tag)
360+ });
361+ console.info(tag, 'push page UIExtensionPage success');
362+ } catch (err) {
363+ console.info(tag, 'push page err,err is :', err);
364+ }
365+ } else if (mpEnable == 'false') {
366+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
367+ }
368+ }, 1000);
369+ })
370+ })
371+ 
372+ /*
373+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0700
374+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0700
375+ * @tc.desc : session.startAbilityByType callback
376+ * @tc.size: MediumTest
377+ * @tc.type: Function
378+ * @tc.level : 0
379+ */
380+ it('Sub_UIExtensionContentSession_errorCode_0700', Level.LEVEL0, (done: Function) => {
381+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0700`;
382+ commonEventManager.createSubscriber(ACTS_EVENT)
383+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
384+ subscriber = commonEventSubscriber;
385+ let unSubscribeCallback = () => {
386+ setTimeout(async () => {
387+ console.info(`====>${tag} unSubscribeCallback`);
388+ if (mpEnable == 'true') {
389+ expect(globalThis.errCode).assertEqual(16000050)
390+ done();
391+ } else if (mpEnable == 'false') {
392+ done();
393+ }
394+ }, 1000);
395+ }
396+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
397+ console.log("subscribeCallBack success")
398+ if (data.event == 'ACTS_TEST_DESTROY') {
399+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
400+ setTimeout(() => {
401+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
402+ }, 500);
403+ }
404+ }
405+ commonEventManager.subscribe(subscriber, subscribeCallBack);
406+ setTimeout(async () => {
407+ if (mpEnable == 'true') {
408+ try {
409+ router.pushUrl({
410+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
411+ params: new MyRouterParam(tag)
412+ });
413+ console.info(tag, 'push page UIExtensionPage success');
414+ } catch (err) {
415+ console.info(tag, 'push page err,err is :', err);
416+ }
417+ } else if (mpEnable == 'false') {
418+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
419+ }
420+ }, 1000);
421+ })
422+ })
423+ 
424+ /*
425+ * @tc.number : Sub_UIExtensionContentSession_errorCode_0800
426+ * @tc.name : Sub_UIExtensionContentSession_errorCode_0800
427+ * @tc.desc : session.startAbilityByType promise
428+ * @tc.size: MediumTest
429+ * @tc.type: Function
430+ * @tc.level : 0
431+ */
432+ it('Sub_UIExtensionContentSession_errorCode_0800', Level.LEVEL0, (done: Function) => {
433+ let tag: string = `Sub_UIExtensionContentSession_errorCode_0800`;
434+ commonEventManager.createSubscriber(ACTS_EVENT)
435+ .then(async (commonEventSubscriber: commonEventManager.CommonEventSubscriber) => {
436+ subscriber = commonEventSubscriber;
437+ let unSubscribeCallback = () => {
438+ setTimeout(async () => {
439+ console.info(`====>${tag} unSubscribeCallback`);
440+ if (mpEnable == 'true') {
441+ expect(globalThis.errCode).assertEqual(16000050)
442+ done();
443+ } else if (mpEnable == 'false') {
444+ done();
445+ }
446+ }, 1000);
447+ }
448+ let subscribeCallBack = async (err: base.BusinessError, data: commonEventManager.CommonEventData) => {
449+ console.log("subscribeCallBack success")
450+ if (data.event == 'ACTS_TEST_DESTROY') {
451+ console.log("subscribeCallBack ACTS_TEST_DESTROY")
452+ setTimeout(() => {
453+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
454+ }, 500);
455+ }
456+ }
457+ commonEventManager.subscribe(subscriber, subscribeCallBack);
458+ setTimeout(async () => {
459+ if (mpEnable == 'true') {
460+ try {
461+ router.pushUrl({
462+ url: 'testability/pages/UIExtensionContentSession/UIExtensionPage',
463+ params: new MyRouterParam(tag)
464+ });
465+ console.info(tag, 'push page UIExtensionPage success');
466+ } catch (err) {
467+ console.info(tag, 'push page err,err is :', err);
468+ }
469+ } else if (mpEnable == 'false') {
470+ commonEventManager.unsubscribe(subscriber, unSubscribeCallback);
471+ }
472+ }, 1000);
473+ })
474+ })
475+ })
476+}
@@ -0,0 +1,308 @@
1+/**
2+ * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3+ * Licensed under the Apache License, Version 2.0 (the "License");
4+ * you may not use this file except in compliance with the License.
5+ * You may obtain a copy of the License at
6+ *
7+ * http://www.apache.org/licenses/LICENSE-2.0
8+ *
9+ * Unless required by applicable law or agreed to in writing, software
10+ * distributed under the License is distributed on an "AS IS" BASIS,
11+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ * See the License for the specific language governing permissions and
13+ * limitations under the License.
14+ */
15+import { Want, UIExtensionAbility, UIExtensionContentSession, common,
16+ EmbeddedUIExtensionAbility } from '@kit.AbilityKit';
17+import { BusinessError, commonEventManager } from '@kit.BasicServicesKit';
18+ 
19+let TAG: string = 'UIExtensionContentSession UIExtAbility';
20+let caseTag: string = 'Sub_UIExtensionContentSession_errorCode_0100';
21+ 
22+export default class UIExtensionProvider extends UIExtensionAbility {
23+ onCreate() {
24+ console.log(TAG, `onCreate`);
25+ }
26+ 
27+ onForeground() {
28+ console.log(TAG, `onForeground`);
29+ }
30+ 
31+ onBackground() {
32+ console.log(TAG, `onBackground`);
33+ }
34+ 
35+ onDestroy() {
36+ console.log(TAG, `onDestroy`);
37+ }
38+ 
39+ onSessionCreate(want: Want, session: UIExtensionContentSession) {
40+ caseTag = want.action
41+ TAG = caseTag
42+ console.log(`${caseTag} onSessionCreate, want: ${JSON.stringify(want)}}`);
43+ let storage: LocalStorage = new LocalStorage();
44+ storage.setOrCreate('session', session);
45+ 
46+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0100') {
47+ try {
48+ session.loadContent(undefined);
49+ console.info(`${caseTag} session.loadContent success`);
50+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
51+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
52+ });
53+ } catch (error) {
54+ console.error(`session.loadContent fail, error: ${JSON.stringify(error)}`);
55+ if (error.code == 401) {
56+ globalThis.errCode = error.code
57+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
58+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
59+ setTimeout(() => {
60+ session?.terminateSelf((err: BusinessError) => {
61+ if (err) {
62+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
63+ return;
64+ }
65+ console.info(`Successed in terminating self.`);
66+ });
67+ },500)
68+ });
69+ }
70+ }
71+ }
72+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0200') {
73+ try {
74+ session.loadContentByName(undefined);
75+ console.info('loadContentByName session.loadContentByName success');
76+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
77+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
78+ });
79+ } catch (error) {
80+ console.error(`session.loadContentByName fail, error: ${JSON.stringify(error)}`);
81+ if (error.code == 401) {
82+ globalThis.errCode = error.code
83+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
84+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
85+ setTimeout(() => {
86+ session?.terminateSelf((err: BusinessError) => {
87+ if (err) {
88+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
89+ return;
90+ }
91+ console.info(`Successed in terminating self.`);
92+ });
93+ },500)
94+ });
95+ }
96+ }
97+ }
98+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0300') {
99+ try {
100+ session?.terminateSelfWithResult(undefined, (err: BusinessError) => {
101+ if (err) {
102+ console.error(`Failed to terminate self with result, code: ${err.code}, msg: ${err.message}`);
103+ return;
104+ }
105+ console.info(`Successed in terminateSelf with result.`);
106+ console.error(`Test case execution results do not match expected outcomes.`);
107+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
108+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
109+ });
110+ });
111+ } catch (error) {
112+ console.error(`session.terminateSelfWithResult fail, error: ${JSON.stringify(error)}`);
113+ if (error.code == 401) {
114+ globalThis.errCode = error.code
115+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
116+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
117+ setTimeout(() => {
118+ session?.terminateSelf((err: BusinessError) => {
119+ if (err) {
120+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
121+ return;
122+ }
123+ console.info(`Successed in terminating self.`);
124+ });
125+ },500)
126+ });
127+ }
128+ }
129+ }
130+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0400') {
131+ try {
132+ session?.terminateSelfWithResult(undefined)
133+ .then(() => {
134+ console.info(`Successed in terminateSelf with result.`);
135+ console.error(`Test case execution results do not match expected outcomes.`);
136+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
137+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
138+ });
139+ })
140+ .catch((err: BusinessError) => {
141+ console.error(`Failed to terminate self with result, code: ${err.code}, msg: ${err.message}`);
142+ });
143+ } catch (error) {
144+ console.error(`session.terminateSelfWithResult fail, error: ${JSON.stringify(error)}`);
145+ if (error.code == 401) {
146+ globalThis.errCode = error.code
147+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
148+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
149+ setTimeout(() => {
150+ session?.terminateSelf((err: BusinessError) => {
151+ if (err) {
152+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
153+ return;
154+ }
155+ console.info(`Successed in terminating self.`);
156+ });
157+ },500)
158+ });
159+ }
160+ }
161+ }
162+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0500') {
163+ try {
164+ session.setWindowPrivacyMode(undefined)
165+ .then(() => {
166+ console.info(`Successed in setting window to privacy mode.`);
167+ console.error(`Test case execution results do not match expected outcomes.`);
168+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
169+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
170+ });
171+ })
172+ .catch((err: BusinessError) => {
173+ console.error(`Failed to set window to privacy mode, code: ${err.code}, msg: ${err.message}`);
174+ });
175+ } catch (error) {
176+ console.error(`session.setWindowPrivacyMode fail, error: ${JSON.stringify(error)}`);
177+ if (error.code == 401) {
178+ globalThis.errCode = error.code
179+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
180+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
181+ setTimeout(() => {
182+ session?.terminateSelf((err: BusinessError) => {
183+ if (err) {
184+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
185+ return;
186+ }
187+ console.info(`Successed in terminating self.`);
188+ });
189+ },500)
190+ });
191+ }
192+ }
193+ }
194+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0600') {
195+ try {
196+ session.setWindowPrivacyMode(undefined, (err: BusinessError) => {
197+ if (err) {
198+ console.error(`Failed to set window to privacy mode, code: ${err.code}, msg: ${err.message}`);
199+ return;
200+ }
201+ console.info(`Successed in setting window to privacy mode.`);
202+ console.error(`Test case execution results do not match expected outcomes.`);
203+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
204+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
205+ });
206+ });
207+ } catch (error) {
208+ console.error(`session.setWindowPrivacyMode fail, error: ${JSON.stringify(error)}`);
209+ if (error.code == 401) {
210+ globalThis.errCode = error.code
211+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
212+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
213+ setTimeout(() => {
214+ session?.terminateSelf((err: BusinessError) => {
215+ if (err) {
216+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
217+ return;
218+ }
219+ console.info(`Successed in terminating self.`);
220+ });
221+ },500)
222+ });
223+ }
224+ }
225+ }
226+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0700') {
227+ let wantParams: Record<string, Object> = {
228+ 'sceneType': 1
229+ };
230+ let abilityStartCallback: common.AbilityStartCallback = {
231+ onError: (code: number, name: string, message: string) => {
232+ console.error(`onError, code: ${code}, name: ${name}, msg: ${message}`);
233+ },
234+ onResult: (result: common.AbilityResult) => {
235+ console.info(`onResult, result: ${JSON.stringify(result)}`);
236+ console.error(`Test case execution results do not match expected outcomes.`);
237+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
238+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
239+ });
240+ }
241+ };
242+ session.startAbilityByType('xxxxx', wantParams, abilityStartCallback, (err: BusinessError) => {
243+ if (err) {
244+ console.error(`Failed to startAbilityByType, code: ${err.code}, msg: ${err.message}`);
245+ if (err.code == 16000050) {
246+ globalThis.errCode = err.code
247+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
248+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
249+ setTimeout(() => {
250+ session?.terminateSelf((err: BusinessError) => {
251+ if (err) {
252+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
253+ return;
254+ }
255+ console.info(`Successed in terminating self.`);
256+ });
257+ },500)
258+ });
259+ }
260+ }
261+ console.info(`Successed in startAbilityByType`);
262+ });
263+ }
264+ if (want.action == 'Sub_UIExtensionContentSession_errorCode_0800') {
265+ let wantParams: Record<string, Object> = {
266+ 'sceneType': 1
267+ };
268+ let abilityStartCallback: common.AbilityStartCallback = {
269+ onError: (code: number, name: string, message: string) => {
270+ console.error(`onError, code: ${code}, name: ${name}, msg: ${message}`);
271+ },
272+ onResult: (result: common.AbilityResult) => {
273+ console.info(`onResult, result: ${JSON.stringify(result)}`);
274+ console.error(`Test case execution results do not match expected outcomes.`);
275+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
276+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
277+ });
278+ }
279+ };
280+ session.startAbilityByType('xxxxxx', wantParams, abilityStartCallback)
281+ .then(() => {
282+ console.info(`Successed in startAbilityByType`);
283+ })
284+ .catch((err: BusinessError) => {
285+ console.error(`Failed to startAbilityByType, code: ${err.code}, msg: ${err.message}`);
286+ if (err.code == 16000050) {
287+ globalThis.errCode = err.code
288+ commonEventManager.publish('ACTS_TEST_DESTROY', function () {
289+ console.info(`${caseTag} publish ACTS_TEST_DESTROY`);
290+ setTimeout(() => {
291+ session?.terminateSelf((err: BusinessError) => {
292+ if (err) {
293+ console.error(`Failed to terminate self, code: ${err.code}, msg: ${err.message}`);
294+ return;
295+ }
296+ console.info(`Successed in terminating self.`);
297+ });
298+ },500)
299+ });
300+ }
301+ });
302+ }
303+ }
304+ 
305+ onSessionDestroy(session: UIExtensionContentSession) {
306+ console.log(TAG, `onSessionDestroy`);
307+ }
308+}
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2023 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the 'License');3 * Licensed under the Apache License, Version 2.0 (the 'License');
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2023 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the 'License');3 * Licensed under the Apache License, Version 2.0 (the 'License');
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2023 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the 'License');3 * Licensed under the Apache License, Version 2.0 (the 'License');
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2023 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the 'License');3 * Licensed under the Apache License, Version 2.0 (the 'License');
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2023 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the 'License');3 * Licensed under the Apache License, Version 2.0 (the 'License');
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.2+ * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -0,0 +1,79 @@
1+/**
2+ * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3+ * Licensed under the Apache License, Version 2.0 (the "License");
4+ * you may not use this file except in compliance with the License.
5+ * You may obtain a copy of the License at
6+ *
7+ * http://www.apache.org/licenses/LICENSE-2.0
8+ *
9+ * Unless required by applicable law or agreed to in writing, software
10+ * distributed under the License is distributed on an "AS IS" BASIS,
11+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ * See the License for the specific language governing permissions and
13+ * limitations under the License.
14+ */
15+ 
16+import { router } from '@kit.ArkUI';
17+ 
18+let tag = 'UIExtensionPage'
19+ 
20+class MyRouterParam {
21+ constructor(from: string) {
22+ this.fromPage = from;
23+ }
24+ public fromPage: string = "";
25+}
26+@Entry
27+@Component
28+struct UIExtensionPage {
29+ @State message: string = 'UIExtension User';
30+ private myProxy: UIExtensionProxy | undefined = undefined;
31+ public params:string = ''
32+ 
33+ aboutToAppear(): void {
34+ this.params = (router.getParams() as MyRouterParam).fromPage;
35+ }
36+ 
37+ build() {
38+ Row() {
39+ Column() {
40+ Text(this.message)
41+ .fontSize(30)
42+ .size({ width: '100%', height: '50' })
43+ .fontWeight(FontWeight.Bold)
44+ .textAlign(TextAlign.Center)
45+ 
46+ EmbeddedComponent(
47+ {
48+ bundleName: 'com.test.actsabilityerrcodequerytest',
49+ abilityName: 'UIExtensionProvider',
50+ moduleName: 'entry_test',
51+ action:this.params,
52+ }, EmbeddedType.EMBEDDED_UI_EXTENSION)
53+ .focusable(true)
54+ .offset({ x: 0, y: 30 })
55+ .size({ width: 300, height: 300 })
56+ .border({ width: 5, color: 0x317AF7, radius: 10, style: BorderStyle.Dotted })
57+ 
58+ Button("sendData")
Dongwei
DongweiDongwei2025年6月11日

按钮大调整至1%

宽度高度都设置成1%嘛

likedislike
59+ .id('userSendData')
60+ .type(ButtonType.Capsule)
61+ .offset({ x: 0, y: 60 })
62+ .width('1%')
63+ .height('1%')
64+ .type(ButtonType.Capsule)
65+ .margin({
66+ top: 20
67+ })
68+ .onClick(() => {
69+ this.myProxy?.send({
70+ "data": 123456,
71+ "message": "data from component"
72+ })
73+ })
74+ }
75+ .width('100%')
76+ }
77+ .height('100%')
78+ }
79+}
@@ -0,0 +1,43 @@
1+/**
2+ * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3+ * Licensed under the Apache License, Version 2.0 (the "License");
4+ * you may not use this file except in compliance with the License.
5+ * You may obtain a copy of the License at
6+ *
7+ * http://www.apache.org/licenses/LICENSE-2.0
8+ *
9+ * Unless required by applicable law or agreed to in writing, software
10+ * distributed under the License is distributed on an "AS IS" BASIS,
11+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ * See the License for the specific language governing permissions and
13+ * limitations under the License.
14+ */
15+ 
16+import { UIExtensionContentSession } from '@kit.AbilityKit';
17+import { commonEventManager } from '@kit.BasicServicesKit';
18+ 
19+let storage = LocalStorage.GetShared();
20+const tag: string = `UIExtensionProvider`;
21+ 
22+@Entry(storage)
23+@Component
24+struct Extension {
25+ @State message: string = `UIExtension provider`;
26+ private session: UIExtensionContentSession | undefined = storage.get<UIExtensionContentSession>('session');
27+ 
28+ onPageShow() {
29+ console.info(tag, 'show');
30+ }
31+ 
32+ build() {
33+ Row() {
34+ Column() {
35+ Text(this.message)
36+ .fontSize(30)
37+ .fontWeight(FontWeight.Bold)
38+ .textAlign(TextAlign.Center)
39+ }
40+ }
41+ .height('100%')
42+ }
43+}
@@ -241,6 +241,13 @@
241 }241 }
242 ],242 ],
243 "extensionAbilities": [243 "extensionAbilities": [
244+ {
245+ "name": "UIExtensionProvider",
246+ "srcEntry": "./ets/test/UIExtensionContentSession/UIExtensionContentSession.ts",
247+ "description": "UIExtensionAbility",
248+ "type": "embeddedUI",
249+ "exported": true
250+ }
244 ],251 ],
245 "requestPermissions": [252 "requestPermissions": [
246 {253 {
@@ -1,6 +1,8 @@
1{1{
2 "src": [2 "src": [
3 "testability/pages/Index",3 "testability/pages/Index",
4+ "testability/pages/UIExtensionContentSession/UIExtensionPage",
5+ "testability/pages/UIExtensionContentSession/extension",
4 "testability/pages/UiAbility/UiAbility012",6 "testability/pages/UiAbility/UiAbility012",
5 "testability/pages/MainAbility/MainAbility1_pages",7 "testability/pages/MainAbility/MainAbility1_pages",
6 "testability/pages/MainAbility/MainAbility2_pages"8 "testability/pages/MainAbility/MainAbility2_pages"
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (C) 2024 Huawei Device Co., Ltd.1+# Copyright (C) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-@rem Copyright (C) 2024 Huawei Device Co., Ltd.1+@rem Copyright (C) 2025 Huawei Device Co., Ltd.
2@rem Licensed under the Apache License, Version 2.0 (the "License");2@rem Licensed under the Apache License, Version 2.0 (the "License");
3@rem you may not use this file except in compliance with the License.3@rem you may not use this file except in compliance with the License.
4@rem You may obtain a copy of the License at4@rem You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (c) 2024 Huawei Device Co., Ltd.1+# Copyright (c) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (C) 2024 Huawei Device Co., Ltd.1+# Copyright (C) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-@rem Copyright (C) 2024 Huawei Device Co., Ltd.1+@rem Copyright (C) 2025 Huawei Device Co., Ltd.
2@rem Licensed under the Apache License, Version 2.0 (the "License");2@rem Licensed under the Apache License, Version 2.0 (the "License");
3@rem you may not use this file except in compliance with the License.3@rem you may not use this file except in compliance with the License.
4@rem You may obtain a copy of the License at4@rem You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (c) 2024 Huawei Device Co., Ltd.1+# Copyright (c) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (C) 2024 Huawei Device Co., Ltd.1+# Copyright (C) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-@rem Copyright (C) 2024 Huawei Device Co., Ltd.1+@rem Copyright (C) 2025 Huawei Device Co., Ltd.
2@rem Licensed under the Apache License, Version 2.0 (the "License");2@rem Licensed under the Apache License, Version 2.0 (the "License");
3@rem you may not use this file except in compliance with the License.3@rem you may not use this file except in compliance with the License.
4@rem You may obtain a copy of the License at4@rem You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -32,13 +32,13 @@ struct IndexA {
32 .fontSize(50)32 .fontSize(50)
33 .fontWeight(FontWeight.Bold)33 .fontWeight(FontWeight.Bold)
34 Button('Terminate AAA')34 Button('Terminate AAA')
35+ .width('1%')
36+ .height('1%')
35 .type(ButtonType.Capsule)37 .type(ButtonType.Capsule)
36 .margin({38 .margin({
37 top: 2039 top: 20
38 })40 })
39 .backgroundColor('#0D9FFB')41 .backgroundColor('#0D9FFB')
40- .width('35%')
41- .height('5%')
42 .onClick(() => {42 .onClick(() => {
43 try {43 try {
44 let context = getContext(this) as common.UIAbilityContext;44 let context = getContext(this) as common.UIAbilityContext;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -37,8 +37,8 @@ struct IndexB {
37 top: 2037 top: 20
38 })38 })
39 .backgroundColor('#0D9FFB')39 .backgroundColor('#0D9FFB')
40- .width('35%')40+ .width('1%')
41- .height('5%')41+ .height('1%')
42 .onClick(() => {42 .onClick(() => {
43 try {43 try {
44 let context = getContext(this) as common.UIAbilityContext;44 let context = getContext(this) as common.UIAbilityContext;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -44,8 +44,8 @@ struct IndexC {
44 top: 2044 top: 20
45 })45 })
46 .backgroundColor('#0D9FFB')46 .backgroundColor('#0D9FFB')
47- .width('35%')47+ .width('1%')
48- .height('5%')48+ .height('1%')
49 .onClick(() => {49 .onClick(() => {
50 try {50 try {
51 let context = getContext(this) as common.UIAbilityContext;51 let context = getContext(this) as common.UIAbilityContext;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -44,8 +44,8 @@ struct IndexD {
44 top: 2044 top: 20
45 })45 })
46 .backgroundColor('#0D9FFB')46 .backgroundColor('#0D9FFB')
47- .width('35%')47+ .width('1%')
48- .height('5%')48+ .height('1%')
49 .onClick(() => {49 .onClick(() => {
50 try {50 try {
51 let context = getContext(this) as common.UIAbilityContext;51 let context = getContext(this) as common.UIAbilityContext;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -32,6 +32,8 @@ struct IndexE {
32 .fontSize(50)32 .fontSize(50)
33 .fontWeight(FontWeight.Bold)33 .fontWeight(FontWeight.Bold)
34 Button('Terminate EEE')34 Button('Terminate EEE')
35+ .width('1%')
36+ .height('1%')
35 .type(ButtonType.Capsule)37 .type(ButtonType.Capsule)
36 .margin({38 .margin({
37 top: 2039 top: 20
@@ -32,6 +32,8 @@ struct Index {
32 })32 })
33 33 
34 Button('Start Ability')34 Button('Start Ability')
35+ .width('1%')
36+ .height('1%')
35 .fontSize(50)37 .fontSize(50)
36 .fontWeight(FontWeight.Bold)38 .fontWeight(FontWeight.Bold)
37 .onClick(() => {39 .onClick(() => {
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (C) 2024 Huawei Device Co., Ltd.1+# Copyright (C) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-@rem Copyright (C) 2024 Huawei Device Co., Ltd.1+@rem Copyright (C) 2025 Huawei Device Co., Ltd.
2@rem Licensed under the Apache License, Version 2.0 (the "License");2@rem Licensed under the Apache License, Version 2.0 (the "License");
3@rem you may not use this file except in compliance with the License.3@rem you may not use this file except in compliance with the License.
4@rem You may obtain a copy of the License at4@rem You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (c) 2024 Huawei Device Co., Ltd.1+# Copyright (c) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/**1/**
2- * Copyright (c) 2024 Huawei Device Co., Ltd.2+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-# Copyright (C) 2024 Huawei Device Co., Ltd.1+# Copyright (C) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at4# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1-@rem Copyright (C) 2024 Huawei Device Co., Ltd.1+@rem Copyright (C) 2025 Huawei Device Co., Ltd.
2@rem Licensed under the Apache License, Version 2.0 (the "License");2@rem Licensed under the Apache License, Version 2.0 (the "License");
3@rem you may not use this file except in compliance with the License.3@rem you may not use this file except in compliance with the License.
4@rem You may obtain a copy of the License at4@rem You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (C) 2024 Huawei Device Co., Ltd.2+ * Copyright (C) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at5 * You may obtain a copy of the License at