From 029b73ee6607f52e9f2ca9a9eb698d792908be24 Mon Sep 17 00:00:00 2001 From: yanmengzhao Date: Sat, 26 Jul 2025 10:10:06 +0800 Subject: [PATCH] feat: update dfx power sample code. Signed-off-by: yanmengzhao --- .../ets/pages/background_power_example.ets | 133 ------------ .../main/ets/pages/buffer_power_example.ets | 49 ----- .../main/ets/pages/display_sync_example.ets | 25 --- PowerAnalysis/InvisibleSample/README.md | 0 .../entry/oh-package-lock.json5 | 3 +- .../src/main/ets/pages/nonvisible_page1.ets | 15 ++ .../src/main/ets/pages/nonvisible_page2.ets | 15 ++ .../src/main/ets/pages/visible_example.ets | 15 ++ .../InvisibleSample/oh-package-lock.json5 | 11 +- .../InvisibleSample/oh-package.json5 | 1 + .../.gitignore | 0 .../AppScope/app.json5 | 2 +- .../resources/base/element/string.json | 2 +- .../resources/base/media/background.png | Bin .../resources/base/media/foreground.png | Bin .../resources/base/media/layered_image.json | 0 .../build-profile.json5 | 0 .../code-linter.json5 | 0 .../entry/.gitignore | 0 .../entry/build-profile.json5 | 0 .../entry/hvigorfile.ts | 0 .../entry/obfuscation-rules.txt | 0 .../entry/oh-package-lock.json5 | 3 +- .../entry/oh-package.json5 | 0 .../entry/src/main/cpp/CMakeLists.txt | 0 .../entry/src/main/cpp/napi_init.cpp | 0 .../src/main/cpp/types/libentry/index.d.ts | 0 .../main/cpp/types/libentry/oh-package.json5 | 0 .../main/ets/entryability/EntryAbility.ets | 0 .../entrybackupability/EntryBackupAbility.ets | 0 .../entry/src/main/ets/pages/Index.ets | 0 .../main/ets/pages/buffer_power_example.ets | 91 ++++++++ .../main/ets/pages/display_sync_example.ets | 201 ++++++++++++++++++ .../entry/src/main/module.json5 | 0 .../main/resources/base/element/color.json | 0 .../main/resources/base/element/float.json | 0 .../main/resources/base/element/string.json | 0 .../main/resources/base/media/background.png | Bin .../main/resources/base/media/foreground.png | Bin .../resources/base/media/layered_image.json | 0 .../main/resources/base/media/startIcon.png | Bin .../resources/base/profile/backup_config.json | 0 .../resources/base/profile/main_pages.json | 0 .../main/resources/dark/element/color.json | 0 .../entry/src/mock/mock-config.json5 | 0 .../src/ohosTest/ets/test/Ability.test.ets | 0 .../entry/src/ohosTest/ets/test/List.test.ets | 0 .../entry/src/ohosTest/module.json5 | 0 .../entry/src/test/List.test.ets | 0 .../entry/src/test/LocalUnit.test.ets | 0 .../hvigor/hvigor-config.json5 | 0 .../hvigorfile.ts | 0 .../oh-package-lock.json5 | 3 +- .../oh-package.json5 | 0 54 files changed, 356 insertions(+), 213 deletions(-) delete mode 100644 PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/background_power_example.ets delete mode 100644 PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/buffer_power_example.ets delete mode 100644 PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/display_sync_example.ets create mode 100644 PowerAnalysis/InvisibleSample/README.md rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/.gitignore (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/AppScope/app.json5 (77%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/AppScope/resources/base/element/string.json (64%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/AppScope/resources/base/media/background.png (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/AppScope/resources/base/media/foreground.png (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/AppScope/resources/base/media/layered_image.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/build-profile.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/code-linter.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/.gitignore (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/build-profile.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/hvigorfile.ts (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/obfuscation-rules.txt (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/oh-package-lock.json5 (88%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/oh-package.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/cpp/CMakeLists.txt (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/cpp/napi_init.cpp (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/cpp/types/libentry/index.d.ts (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/cpp/types/libentry/oh-package.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/ets/entryability/EntryAbility.ets (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/ets/pages/Index.ets (100%) create mode 100644 PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets create mode 100644 PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/display_sync_example.ets rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/module.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/element/color.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/element/float.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/element/string.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/media/background.png (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/media/foreground.png (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/media/layered_image.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/media/startIcon.png (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/profile/backup_config.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/base/profile/main_pages.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/main/resources/dark/element/color.json (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/mock/mock-config.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/ohosTest/ets/test/Ability.test.ets (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/ohosTest/ets/test/List.test.ets (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/ohosTest/module.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/test/List.test.ets (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/entry/src/test/LocalUnit.test.ets (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/hvigor/hvigor-config.json5 (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/hvigorfile.ts (100%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/oh-package-lock.json5 (93%) rename PowerAnalysis/{BackgroundPowerSample => LowerPowerSample}/oh-package.json5 (100%) diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/background_power_example.ets b/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/background_power_example.ets deleted file mode 100644 index 14c56ed9..00000000 --- a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/background_power_example.ets +++ /dev/null @@ -1,133 +0,0 @@ -/** - * 最佳实践:应用后台功耗场景优化 - */ - -import hilog from '@ohos.hilog'; -import json from '@ohos.util.json'; - -let TAG = "Test" - -// [Start background_power_case1] -// 定义短时任务信息SuspendTaskInfo接口 -// BackTaskImplement/entry/src/main/ets/viewModel/SuspendTaskInfo.ets -export interfaces SuspendTaskInfo { - id: number; // 短时任务 ID - delayTime: number; // 短时任务剩余时间 -} -// [End background_power_case1] - -// [Start background_power_case2] -// 模拟应用后台任务 -// BackTaskImplement/entry/src/main/ets/view/ShortTermTaskPage.ets -NavDestination() { - // ... -} -.title(this.builderTitle()) -.onAppear(() => { - this.ShortTermTaskModel.subscribeStateChange(); - // 启动计时器,每2秒发送一条消息,以模拟应用程序的后台任务 - this.taskTimer = getInterval(() => { - this.messageCount++; - hilog.info(0x0000, TAG, `already sent : ${this.messageCount} messages`); - }, 2000); -}) -// [End background_power_case2] - -// [Start background_power_case3] -// 注册前后台变化监听 -// BackTaskImplement/entry/src/main/ets/viewModel/ShortTermTaskModel.ets -subscribeStateChange() { - let that = this; - // 获取applicationContext - let applicationContext = this.context.getApplicationContext(); - let applicationStateChangeCallback : ApplicationStateChangeCallback = { - onApplicationForeground() { - hilog.info(0x0000, TAG, `applicationStateChangeCallback onApplicationForeground`); - }, - onApplicationBackground() { - hilog.info(0x0000, TAG, `applicationStateChangeCallback onApplicationBackground`); - // 当应用程序从前台切换到后台时,申请短时任务 - that.suspendTaskInfo = SuspendTaskUtils.requestSuspendDelay(`Suspend Task`); - hilog.info(0x0000, TAG, - `requestSuspendDelay, id:${that.suspendTaskInfo.id}, delayTime:${that.suspendTaskInfo.delayTime}`); - } - } - try { - // 通过 applicationContext 注册前后台状态监听 - applicationContext.on('applicationStateChange', applicationStateChangeCallback); - } catch(paramError) { - hilog.error(0x0000, TAG, - `error: ${(paramError as BusinessError).code}, ${(paramError as BusinessError).message}`); - } -} -// [End background_power_case3] - -// [Start background_power_case4] -// 申请短时任务 -// BackTaskImplement/entry/src/main/ets/utils/SuspendTaskUtils.ets -/** - * @param reason Set the delay task suspension reason - * @returns Reason for Application - */ -requestSuspendDelay(reason: string): SuspendTaskInfo { - let id: number; // 短时任务 ID - let delayTime: number; // 短时任务剩余时间 - try { - // Request deferred task - let delayInfo = backgroundTaskManager.requestSuspendDelay(reason, () => { - // 当应用程序申请的短时任务即将超时时回调应用 - hilog.info(0x0000, TAG, `Request suspension delay will time out.`); - backgroundTaskManager.cancelSuspendDelay(delayInfo.requestId); - }) - id = delayInfo.requestId; - delayTime = delayInfo.actualDelayTime; - let taskInfo = { - id: id, - delayTime: delayTime - } as SuspendTaskInfo; - return taskInfo; - } catch (err) { - let taskInfo = { - id: 0, - delayTime: 0 - } as SuspendTaskInfo; - return taskInfo; - } -} -// [End background_power_case4] - -// [Start background_power_case5] -// 获取短时任务剩余时间 -// BackTaskImplement/entry/src/main/ets/utils/SuspendTaskUtils.ets -/** - * Obtains the remaining time of a specified short-term task. - * @param id ID of the short-term task to be queried - */ -async getRemainingDelayTime(id: number): Promise { - let delayTime: number = -1; - await backgroundTaskManager.getRemainingDelayTime(id).then((res: number) => { - delayTime = res; - hilog.info(0x0000, TAG, 'Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res)); - }).catch ((err: BusinessError) => { - hilog.error(0x0000, TAG, 'Operation getRemainingDelayTime failed. Cause: ' + err.code); - }); - return delayTime; -} -// [End background_power_case5] - -// [Start background_power_case6] -// 取消短时任务 -// BackTaskImplement/entry/src/main/ets/utils/SuspendTaskUtils.ets -/** - * Cancel a short-term task - * @param id ID of the short-term task to be canceled. - */ -cancelSuspendDelay(id: number): boolean { - try { - backgroundTaskManager.cancelSuspendDelay(id); - hilog.info(0x0000, TAG, 'cancelSuspendDelay succeeded.'); - } catch (err) { - hilog.error(0x0000, TAG, 'cancelSuspendDelay failed. Cause: ' + ${JSON.stringify(err)}); - } -} -// [End background_power_case6] \ No newline at end of file diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/buffer_power_example.ets b/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/buffer_power_example.ets deleted file mode 100644 index 549b936f..00000000 --- a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/buffer_power_example.ets +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 最佳实践:Buffer低功耗优化 - */ - -import webview from '@ohos.web.webview'; - -// [Start buffer_power_case_1] -@Component -struct MyWebComponent { - private src: string = "" - private controller1: webview.WebviewController = new webview.WebviewController(); - shouldDraw: boolean = true; - build() { - Web({ src: this.src, controller: this.controller1 }) - .onPageBegin(() => { - console.log(this.src, "webpage is onActive") - this.controller1.onActive(); - }) - - .onFirstMeaningfulPaint(() => { - if (!this.shouldDraw) { - return; - } - console.log(this.src, "webpage is onInactive") - this.controller1.onInactive() - this.shouldDraw = false - }) - } -} -// [End buffer_power_case_1] - -// [Start buffer_power_case_2] -Video() -// ... -.onVisibleAreaChange({ratios: [0.0, 1.0], expectedUpdateInterval: 1000}, (isExpanding: boolean, currentRatio: number) => { - if (isExpanding && currentRatio >= 1.0) { - console.info('Component is completely visiable.'); - if (this.controller) { - this.controller.start(); - } - } - if (!isExpanding && currentRatio <= 0.0) { - console.info('Component is completely invisible.'); - if (this.controller) { - this.controller.pause(); - } - } -}) -// [End buffer_power_case_2] \ No newline at end of file diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/display_sync_example.ets b/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/display_sync_example.ets deleted file mode 100644 index 784d89cb..00000000 --- a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/display_sync_example.ets +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 最佳实践:Vsync低功耗优化 - */ - -// [Start vsync_power_case_1] -aboutToDisappear() { - if (this.backDisplaySyncSlow) { - this.backDisplaySyncSlow.stop(); - this.backDisplaySyncSlow = undefined; - } -} -// [End vsync_power_case_1] - -// [Start vsync_power_case_2] -Index() -// ... -.onVisibleAreaChange({ratios: [0.0, 1.0], expectedUpdateInterval: 1000}, (isExpanding: boolean, currentRatio: number) => { - if (!isExpanding && currentRatio <= 0.0) { - console.info(`Component is completely invisible.`); - if (this.backDisplaySyncSlow) { - this.backDisplaySyncSlow.stop(); - } - } -}) -// [End vsync_power_case_2] \ No newline at end of file diff --git a/PowerAnalysis/InvisibleSample/README.md b/PowerAnalysis/InvisibleSample/README.md new file mode 100644 index 00000000..e69de29b diff --git a/PowerAnalysis/InvisibleSample/entry/oh-package-lock.json5 b/PowerAnalysis/InvisibleSample/entry/oh-package-lock.json5 index 5c8c8d64..7c36300c 100644 --- a/PowerAnalysis/InvisibleSample/entry/oh-package-lock.json5 +++ b/PowerAnalysis/InvisibleSample/entry/oh-package-lock.json5 @@ -1,6 +1,7 @@ { "meta": { - "stableOrder": true + "stableOrder": true, + "enableUnifiedLockfile": false }, "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", diff --git a/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page1.ets b/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page1.ets index 8097d9e2..237fef2f 100644 --- a/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page1.ets +++ b/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page1.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * 最佳实践:不可见组件低功耗建议 */ diff --git a/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page2.ets b/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page2.ets index c5dc3a11..08ad780f 100644 --- a/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page2.ets +++ b/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/nonvisible_page2.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * 最佳实践:不可见组件低功耗建议 */ diff --git a/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/visible_example.ets b/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/visible_example.ets index 0415e491..d509f30e 100644 --- a/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/visible_example.ets +++ b/PowerAnalysis/InvisibleSample/entry/src/main/ets/pages/visible_example.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * 最佳实践:不可见组件低功耗建议 */ diff --git a/PowerAnalysis/InvisibleSample/oh-package-lock.json5 b/PowerAnalysis/InvisibleSample/oh-package-lock.json5 index c6f99f5c..a247a3a8 100644 --- a/PowerAnalysis/InvisibleSample/oh-package-lock.json5 +++ b/PowerAnalysis/InvisibleSample/oh-package-lock.json5 @@ -1,14 +1,23 @@ { "meta": { - "stableOrder": true + "stableOrder": true, + "enableUnifiedLockfile": false }, "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { + "@ohos/apng@^1.1.1": "@ohos/apng@1.1.2", "@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0", "@ohos/hypium@1.0.21": "@ohos/hypium@1.0.21" }, "packages": { + "@ohos/apng@1.1.2": { + "name": "@ohos/apng", + "version": "1.1.2", + "integrity": "sha512-AgxBwBrxDga6mJatu0a3sjcz4Q9rUBhpN+OhF22NhiujaRNFVegnecGjAHQ9IWpDkfnW3Nr0wXzK/tDooCI0/g==", + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/apng/-/apng-1.1.2.har", + "registryType": "ohpm" + }, "@ohos/hamock@1.0.0": { "name": "@ohos/hamock", "version": "1.0.0", diff --git a/PowerAnalysis/InvisibleSample/oh-package.json5 b/PowerAnalysis/InvisibleSample/oh-package.json5 index a8aff0c5..5934c3b6 100644 --- a/PowerAnalysis/InvisibleSample/oh-package.json5 +++ b/PowerAnalysis/InvisibleSample/oh-package.json5 @@ -2,6 +2,7 @@ "modelVersion": "5.0.5", "description": "Please describe the basic information.", "dependencies": { + "@ohos/apng": "^1.1.1" }, "devDependencies": { "@ohos/hypium": "1.0.21", diff --git a/PowerAnalysis/BackgroundPowerSample/.gitignore b/PowerAnalysis/LowerPowerSample/.gitignore similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/.gitignore rename to PowerAnalysis/LowerPowerSample/.gitignore diff --git a/PowerAnalysis/BackgroundPowerSample/AppScope/app.json5 b/PowerAnalysis/LowerPowerSample/AppScope/app.json5 similarity index 77% rename from PowerAnalysis/BackgroundPowerSample/AppScope/app.json5 rename to PowerAnalysis/LowerPowerSample/AppScope/app.json5 index eddb70c6..045b9a33 100644 --- a/PowerAnalysis/BackgroundPowerSample/AppScope/app.json5 +++ b/PowerAnalysis/LowerPowerSample/AppScope/app.json5 @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.backgroundpower", + "bundleName": "com.example.lowerpower", "vendor": "example", "versionCode": 1000000, "versionName": "1.0.0", diff --git a/PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/element/string.json b/PowerAnalysis/LowerPowerSample/AppScope/resources/base/element/string.json similarity index 64% rename from PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/element/string.json rename to PowerAnalysis/LowerPowerSample/AppScope/resources/base/element/string.json index 683a57db..ba9205db 100644 --- a/PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/element/string.json +++ b/PowerAnalysis/LowerPowerSample/AppScope/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "BackgroundPower" + "value": "LowerPower" } ] } diff --git a/PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/media/background.png b/PowerAnalysis/LowerPowerSample/AppScope/resources/base/media/background.png similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/media/background.png rename to PowerAnalysis/LowerPowerSample/AppScope/resources/base/media/background.png diff --git a/PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/media/foreground.png b/PowerAnalysis/LowerPowerSample/AppScope/resources/base/media/foreground.png similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/media/foreground.png rename to PowerAnalysis/LowerPowerSample/AppScope/resources/base/media/foreground.png diff --git a/PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/media/layered_image.json b/PowerAnalysis/LowerPowerSample/AppScope/resources/base/media/layered_image.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/AppScope/resources/base/media/layered_image.json rename to PowerAnalysis/LowerPowerSample/AppScope/resources/base/media/layered_image.json diff --git a/PowerAnalysis/BackgroundPowerSample/build-profile.json5 b/PowerAnalysis/LowerPowerSample/build-profile.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/build-profile.json5 rename to PowerAnalysis/LowerPowerSample/build-profile.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/code-linter.json5 b/PowerAnalysis/LowerPowerSample/code-linter.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/code-linter.json5 rename to PowerAnalysis/LowerPowerSample/code-linter.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/entry/.gitignore b/PowerAnalysis/LowerPowerSample/entry/.gitignore similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/.gitignore rename to PowerAnalysis/LowerPowerSample/entry/.gitignore diff --git a/PowerAnalysis/BackgroundPowerSample/entry/build-profile.json5 b/PowerAnalysis/LowerPowerSample/entry/build-profile.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/build-profile.json5 rename to PowerAnalysis/LowerPowerSample/entry/build-profile.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/entry/hvigorfile.ts b/PowerAnalysis/LowerPowerSample/entry/hvigorfile.ts similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/hvigorfile.ts rename to PowerAnalysis/LowerPowerSample/entry/hvigorfile.ts diff --git a/PowerAnalysis/BackgroundPowerSample/entry/obfuscation-rules.txt b/PowerAnalysis/LowerPowerSample/entry/obfuscation-rules.txt similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/obfuscation-rules.txt rename to PowerAnalysis/LowerPowerSample/entry/obfuscation-rules.txt diff --git a/PowerAnalysis/BackgroundPowerSample/entry/oh-package-lock.json5 b/PowerAnalysis/LowerPowerSample/entry/oh-package-lock.json5 similarity index 88% rename from PowerAnalysis/BackgroundPowerSample/entry/oh-package-lock.json5 rename to PowerAnalysis/LowerPowerSample/entry/oh-package-lock.json5 index 5c8c8d64..7c36300c 100644 --- a/PowerAnalysis/BackgroundPowerSample/entry/oh-package-lock.json5 +++ b/PowerAnalysis/LowerPowerSample/entry/oh-package-lock.json5 @@ -1,6 +1,7 @@ { "meta": { - "stableOrder": true + "stableOrder": true, + "enableUnifiedLockfile": false }, "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", diff --git a/PowerAnalysis/BackgroundPowerSample/entry/oh-package.json5 b/PowerAnalysis/LowerPowerSample/entry/oh-package.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/oh-package.json5 rename to PowerAnalysis/LowerPowerSample/entry/oh-package.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/CMakeLists.txt b/PowerAnalysis/LowerPowerSample/entry/src/main/cpp/CMakeLists.txt similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/CMakeLists.txt rename to PowerAnalysis/LowerPowerSample/entry/src/main/cpp/CMakeLists.txt diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/napi_init.cpp b/PowerAnalysis/LowerPowerSample/entry/src/main/cpp/napi_init.cpp similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/napi_init.cpp rename to PowerAnalysis/LowerPowerSample/entry/src/main/cpp/napi_init.cpp diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/types/libentry/index.d.ts b/PowerAnalysis/LowerPowerSample/entry/src/main/cpp/types/libentry/index.d.ts similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/types/libentry/index.d.ts rename to PowerAnalysis/LowerPowerSample/entry/src/main/cpp/types/libentry/index.d.ts diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/types/libentry/oh-package.json5 b/PowerAnalysis/LowerPowerSample/entry/src/main/cpp/types/libentry/oh-package.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/cpp/types/libentry/oh-package.json5 rename to PowerAnalysis/LowerPowerSample/entry/src/main/cpp/types/libentry/oh-package.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/entryability/EntryAbility.ets b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/entryability/EntryAbility.ets similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/entryability/EntryAbility.ets rename to PowerAnalysis/LowerPowerSample/entry/src/main/ets/entryability/EntryAbility.ets diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets rename to PowerAnalysis/LowerPowerSample/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/Index.ets b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/Index.ets similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/ets/pages/Index.ets rename to PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/Index.ets diff --git a/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets new file mode 100644 index 00000000..0155fca9 --- /dev/null +++ b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * 最佳实践:Buffer低功耗优化 + */ + +import webview from '@ohos.web.webview'; +import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData'; + +// [Start buffer_power_case_1] +@Component +struct MyWebComponent { + private src: string = "" + private controller1: webview.WebviewController = new webview.WebviewController(); + shouldDraw: boolean = true; + build() { + Web({ src: this.src, controller: this.controller1 }) + .onPageBegin(() => { + console.log(this.src, "webpage is onActive") + this.controller1.onActive(); + }) + + .onFirstMeaningfulPaint(() => { + if (!this.shouldDraw) { + return; + } + console.log(this.src, "webpage is onInactive") + this.controller1.onInactive() + this.shouldDraw = false + }) + } +} +// [End buffer_power_case_1] + +// [Start buffer_power_case_2] +@Component +struct MyVideoComponent { + @State videoSrc: Resource | string = $r('app.media.background'); + private controller: VideoController = new VideoController(); + + + build() { + Column() { + Video({ + src: this.videoSrc, + controller: this.controller + }) + .width('100%') + .height(600) + .onPrepared(() => { + this.controller.start(); + }) + .onDrop((e: DragEvent) => { + let record = e.getData().getRecords()[0]; + if (record.getType() == uniformTypeDescriptor.UniformDataType.VIDEO) { + let videoInfo = record as unifiedDataChannel.Video; + this.videoSrc = videoInfo.videoUri; + } + }) + // 确保视频组件完全可见时播放,完全不可见时停止 + .onVisibleAreaChange([0.0], (isExpanding: boolean, currentRatio: number) => { + if (isExpanding && currentRatio >= 1.0) { + console.info('Component is completely visiable.'); + if (this.controller) { + this.controller.start(); + } + } + if (!isExpanding && currentRatio <= 0.0) { + console.info('Component is completely invisible.'); + if (this.controller) { + this.controller.pause(); + } + } + }) + } + } +} +// [End buffer_power_case_2] \ No newline at end of file diff --git a/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/display_sync_example.ets b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/display_sync_example.ets new file mode 100644 index 00000000..b8823132 --- /dev/null +++ b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/display_sync_example.ets @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * 最佳实践:Vsync低功耗优化 + */ + +import { displaySync } from '@kit.ArkGraphics2D'; + +@Entry +@Component +struct MyDisplaySyncComponent { + @State drawFirstSize: number = 25; + @State drawSecondSize: number = 25; + private backDisplaySyncSlow: displaySync.DisplaySync | undefined = undefined; + private backDisplaySyncFast: displaySync.DisplaySync | undefined = undefined; + private isBigger_30: boolean = true; + private isBigger_60: boolean = true; + + @Builder doSomeRenderFirst() { + Text('30') + .fontSize(this.drawFirstSize) + } + + @Builder doSomeRenderSecond() { + Text('60') + .fontSize(this.drawSecondSize) + } + + CreateDisplaySyncSlow() { + let range: ExpectedFrameRateRange = { + expected: 30, + min: 0, + max: 120 + }; + + let draw30 = (intervalInfo: displaySync.IntervalInfo) => { + if (this.isBigger_30) { + this.drawFirstSize += 1; + if (this.drawFirstSize > 150) { + this.isBigger_30 = false; + } + } else { + this.drawFirstSize -= 1; + if (this.drawFirstSize < 25) { + this.isBigger_30 = true; + } + } + }; + + this.backDisplaySyncSlow = displaySync.create(); + this.backDisplaySyncSlow.setExpectedFrameRateRange(range); + this.backDisplaySyncSlow.on("frame", draw30); + } + + CreateDisplaySyncFast() { + let range: ExpectedFrameRateRange = { + expected: 60, + min: 0, + max: 120 + }; + + let draw60 = (intervalInfo: displaySync.IntervalInfo) => { + if (this.isBigger_60) { + this.drawSecondSize += 1; + if (this.drawSecondSize > 150) { + this.isBigger_60 = false; + } + } else { + this.drawSecondSize -= 1; + if (this.drawSecondSize < 25) { + this.isBigger_60 = true; + } + } + }; + + this.backDisplaySyncFast = displaySync.create(); + this.backDisplaySyncFast.setExpectedFrameRateRange(range); + this.backDisplaySyncFast.on("frame", draw60); + } + + // [Start vsync_power_case_1] + aboutToDisappear() { + if (this.backDisplaySyncSlow) { + this.backDisplaySyncSlow.stop(); + this.backDisplaySyncSlow = undefined; + } + if (this.backDisplaySyncFast) { + this.backDisplaySyncFast.stop(); + this.backDisplaySyncFast = undefined; + } + } + // [End vsync_power_case_1] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + // 30FPS 动态文本 + Row() { + this.doSomeRenderFirst() + } + .width('80%') + .height('auto') + .justifyContent(FlexAlign.Center) + .margin({ top: 10 }) + + // 60FPS 动态文本 + Row() { + this.doSomeRenderSecond() + } + .width('80%') + .height('auto') + .justifyContent(FlexAlign.Center) + .margin({ top: 10 }) + + // 操作按钮区域 + Row() { + Button('Start') + .id('CustomDrawStart') + .fontSize(14) + .fontWeight(500) + .margin({ left: 10 }) + .fontColor(Color.White) + .onClick((): void => { + if (this.backDisplaySyncSlow == undefined) { + this.CreateDisplaySyncSlow(); + } + if (this.backDisplaySyncFast == undefined) { + this.CreateDisplaySyncFast(); + } + if (this.backDisplaySyncSlow) { + this.backDisplaySyncSlow.start(); + } + if (this.backDisplaySyncFast) { + this.backDisplaySyncFast.start(); + } + }) + .layoutWeight(1) + .height(40) + .shadow(ShadowStyle.OUTER_DEFAULT_LG) + + Button('Stop') + .id('CustomDrawStop') + .fontSize(14) + .fontWeight(500) + .margin({ left: 10 }) + .fontColor(Color.White) + .onClick((): void => { + if (this.backDisplaySyncSlow) { + this.backDisplaySyncSlow.stop(); + } + if (this.backDisplaySyncFast) { + this.backDisplaySyncFast.stop(); + } + }) + .layoutWeight(1) + .height(40) + .shadow(ShadowStyle.OUTER_DEFAULT_LG) + } + .width('80%') + .justifyContent(FlexAlign.SpaceEvenly) + .margin({ top: 30 }) + } + .width('100%') + .height('100%') + .padding(16) + // [Start vsync_power_case_2] + .onVisibleAreaChange([0.0, 1.0], (isExpanding: boolean, currentRatio: number) => { + if (isExpanding && currentRatio >= 1.0) { + console.info('Component is fully visible. currentRatio:' + currentRatio); + if (this.backDisplaySyncSlow == undefined) { + this.backDisplaySyncSlow = displaySync.create(); + } + } + + if (!isExpanding && currentRatio <= 0.0) { + console.info('Component is completely invisible.'); + if (this.backDisplaySyncSlow) { + this.backDisplaySyncSlow.stop(); + this.backDisplaySyncSlow = undefined; + } + if (this.backDisplaySyncFast) { + this.backDisplaySyncFast.stop(); + this.backDisplaySyncFast = undefined; + } + } + }) + // [End vsync_power_case_2] + } +} \ No newline at end of file diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/module.json5 b/PowerAnalysis/LowerPowerSample/entry/src/main/module.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/module.json5 rename to PowerAnalysis/LowerPowerSample/entry/src/main/module.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/element/color.json b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/element/color.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/element/color.json rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/element/color.json diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/element/float.json b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/element/float.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/element/float.json rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/element/float.json diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/element/string.json b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/element/string.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/element/string.json rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/element/string.json diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/background.png b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/background.png similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/background.png rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/background.png diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/foreground.png b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/foreground.png similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/foreground.png rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/foreground.png diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/layered_image.json b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/layered_image.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/layered_image.json rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/layered_image.json diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/startIcon.png b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/startIcon.png similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/media/startIcon.png rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/media/startIcon.png diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/profile/backup_config.json b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/profile/backup_config.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/profile/backup_config.json rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/profile/backup_config.json diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/profile/main_pages.json b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/base/profile/main_pages.json rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/base/profile/main_pages.json diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/dark/element/color.json b/PowerAnalysis/LowerPowerSample/entry/src/main/resources/dark/element/color.json similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/main/resources/dark/element/color.json rename to PowerAnalysis/LowerPowerSample/entry/src/main/resources/dark/element/color.json diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/mock/mock-config.json5 b/PowerAnalysis/LowerPowerSample/entry/src/mock/mock-config.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/mock/mock-config.json5 rename to PowerAnalysis/LowerPowerSample/entry/src/mock/mock-config.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/ohosTest/ets/test/Ability.test.ets b/PowerAnalysis/LowerPowerSample/entry/src/ohosTest/ets/test/Ability.test.ets similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/ohosTest/ets/test/Ability.test.ets rename to PowerAnalysis/LowerPowerSample/entry/src/ohosTest/ets/test/Ability.test.ets diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/ohosTest/ets/test/List.test.ets b/PowerAnalysis/LowerPowerSample/entry/src/ohosTest/ets/test/List.test.ets similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/ohosTest/ets/test/List.test.ets rename to PowerAnalysis/LowerPowerSample/entry/src/ohosTest/ets/test/List.test.ets diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/ohosTest/module.json5 b/PowerAnalysis/LowerPowerSample/entry/src/ohosTest/module.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/ohosTest/module.json5 rename to PowerAnalysis/LowerPowerSample/entry/src/ohosTest/module.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/test/List.test.ets b/PowerAnalysis/LowerPowerSample/entry/src/test/List.test.ets similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/test/List.test.ets rename to PowerAnalysis/LowerPowerSample/entry/src/test/List.test.ets diff --git a/PowerAnalysis/BackgroundPowerSample/entry/src/test/LocalUnit.test.ets b/PowerAnalysis/LowerPowerSample/entry/src/test/LocalUnit.test.ets similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/entry/src/test/LocalUnit.test.ets rename to PowerAnalysis/LowerPowerSample/entry/src/test/LocalUnit.test.ets diff --git a/PowerAnalysis/BackgroundPowerSample/hvigor/hvigor-config.json5 b/PowerAnalysis/LowerPowerSample/hvigor/hvigor-config.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/hvigor/hvigor-config.json5 rename to PowerAnalysis/LowerPowerSample/hvigor/hvigor-config.json5 diff --git a/PowerAnalysis/BackgroundPowerSample/hvigorfile.ts b/PowerAnalysis/LowerPowerSample/hvigorfile.ts similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/hvigorfile.ts rename to PowerAnalysis/LowerPowerSample/hvigorfile.ts diff --git a/PowerAnalysis/BackgroundPowerSample/oh-package-lock.json5 b/PowerAnalysis/LowerPowerSample/oh-package-lock.json5 similarity index 93% rename from PowerAnalysis/BackgroundPowerSample/oh-package-lock.json5 rename to PowerAnalysis/LowerPowerSample/oh-package-lock.json5 index c6f99f5c..a3925056 100644 --- a/PowerAnalysis/BackgroundPowerSample/oh-package-lock.json5 +++ b/PowerAnalysis/LowerPowerSample/oh-package-lock.json5 @@ -1,6 +1,7 @@ { "meta": { - "stableOrder": true + "stableOrder": true, + "enableUnifiedLockfile": false }, "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", diff --git a/PowerAnalysis/BackgroundPowerSample/oh-package.json5 b/PowerAnalysis/LowerPowerSample/oh-package.json5 similarity index 100% rename from PowerAnalysis/BackgroundPowerSample/oh-package.json5 rename to PowerAnalysis/LowerPowerSample/oh-package.json5 -- Gitee