From: hcj <1224667075@qq.com> Date: Sat, 29 Jun 2024 06:06:41 +0000 (+0800) Subject: 优化低电量关机 X-Git-Tag: release_V1.2.70_20241020_135402~895^2~17 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F416%2F2;p=mirrors%2FFD230.git 优化低电量关机 --- 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();