From 464ab2119a35509192824c4ffba9258ae4060206 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 29 Jun 2024 14:06:41 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E4=BD=8E=E7=94=B5=E9=87=8F?= =?utf8?q?=E5=85=B3=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../msg_center/src/msg_center_customer.cpp | 1 + .../src/notify/charge_notification.cpp | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 146972a6b..af96aa7f0 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -386,6 +386,7 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) else { //电量过低,直接提醒关机 + display_api->turn_on_screen(); display_api->set_auto_timeout_function(1000*10); set_lowpower_falg(1); if (NotificationManager::GetInstance()->HasNotifyShowing()) diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp index deb75d3a1..5bb1d33ca 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp @@ -9,6 +9,8 @@ #include "battery_service.h" #include "NativeAbility.h" #include "custom_utils.h" +#include "cmsis_os2.h" +#include "linux/delay.h" namespace OHOS { UIImageView *imageCharge = nullptr; @@ -19,15 +21,15 @@ namespace OHOS UIViewGroup *group=nullptr; UIImageAnimatorView *ShutDownImageAnimatorView=nullptr; static constexpr char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; //关机图片路径 - static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数 - static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔 - ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息 + #define SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES 30 // 图片帧数 + static int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 130; // 图片更新间隔 + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_X = 0; static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y = 0; static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_W = 466; static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 466; const char **ShutDownPathsArray{nullptr}; // 关机图片路径数组 - + ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息 #define LOW_POWER_BUTTON "LOW_POWER_BUTTON" // UIViewGroup *ChargingStatuShow() // { @@ -97,6 +99,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView new ShutDownImageAnimatorView fail"); return ; } + for (uint8_t i = 0; i < SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { ShutDownImageInfo[i].imagePath = (ShutDownPathsArray[i]); @@ -109,7 +112,7 @@ namespace OHOS ShutDownImageAnimatorView->SetPosition(SHUTDOWN_IMAGE_ANIMATOR_VIEW_X, SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y, SHUTDOWN_IMAGE_ANIMATOR_VIEW_W, SHUTDOWN_IMAGE_ANIMATOR_VIEW_H); ShutDownImageAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); ShutDownImageAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - ShutDownImageAnimatorView->SetImageAnimatorSrc(ShutDownImageInfo, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, 100); + ShutDownImageAnimatorView->SetImageAnimatorSrc(ShutDownImageInfo, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, SHUTDOWN_IMAGE_ANIMATOR_TIME); ShutDownImageAnimatorView->SetRepeat(false); ShutDownImageAnimatorView->SetRepeatTimes(1); @@ -159,6 +162,7 @@ namespace OHOS if(group) { group->RemoveAll(); + ShutDownImageAnimatorView->Stop(); if(ShutDownImageAnimatorView) { delete ShutDownImageAnimatorView; @@ -357,9 +361,9 @@ namespace OHOS void lowppowrAnimatorStopListener::OnAnimatorStop(UIView &view) { //UNUSED(view); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxxxxxxxxxOnAnimatorStop"); - NotificationManager::GetInstance()->StopNotify(); + msleep(500); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxxxxxxxxxOnAnimatorStop"); if(battery_falg==4) uapi_reboot_device(); -- 2.17.1