From: hcj <1224667075@qq.com> Date: Sat, 30 Mar 2024 02:10:27 +0000 (+0800) Subject: 低电量修改 X-Git-Tag: release_V1.2.70_20241020_135402~1241^2~9 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=cda1145d3e262761a5d34807968743b9039f481d;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 e753139bd..772cacc89 100755 --- 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 @@ -261,6 +261,12 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !"); //if(req->data); uint8 *x= (uint8 *)(req->data); + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (display_api->get_screen_state() != SCREEN_ON) + { + display_api->turn_on_screen(); + } + display_api->set_screen_set_keepon_timeout(1000*5); if(*x==3) { //倒计时结束后,直接执行关机动画 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 70707dfcf..1313f14b5 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 @@ -19,7 +19,7 @@ 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 = 36; // 图片帧数 + 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]; // 关机图像的信息 static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_X = 0; @@ -155,11 +155,25 @@ namespace OHOS UIViewGroup_lowpower = nullptr; } } - + static uint8_t timer_falg_low_power=5; void low_power_TimerCallBack(int data) { //uapi_poweroff_device(); // 关机 - low_power_play_toUI(3); + if(timer_falg_low_power) + { + timer_falg_low_power--; + char buf[34]={0}; + sprintf(buf,"电量过低%ds后将自动关机",timer_falg_low_power); + alarm_UILabel->SetText(buf); + RootView::GetInstance()->Invalidate(); + if(timer_falg_low_power==0) + { + alarm_UILabel->SetVisible(false); + low_power_play_toUI(3); + } + + } + } void low_power_paly(void) { @@ -221,21 +235,24 @@ namespace OHOS // Set additional property if(battery_falg==true) { - alarm_UILabel->SetPosition(84, 215); - alarm_UILabel->SetText("电量过低将自动关机"); + alarm_UILabel->SetPosition(50, 215); + alarm_UILabel->SetText("电量过低5s后将自动关机"); alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); alarm_UILabel->SetRollSpeed(0); alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33); osStatus_t retTimer; - low_power_timer = osTimerNew((osTimerFunc_t)low_power_TimerCallBack, osTimerOnce, NULL, NULL); - retTimer = osTimerStart(low_power_timer, 1000*5); + low_power_timer = osTimerNew((osTimerFunc_t)low_power_TimerCallBack, osTimerPeriodic, NULL, NULL); + retTimer = osTimerStart(low_power_timer, 1000*1); if (retTimer != osOK && low_power_timer != NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); osTimerDelete(low_power_timer); low_power_timer = NULL; } + timer_falg_low_power=5; + + } // Add to rootView @@ -265,9 +282,10 @@ namespace OHOS alarm_labelbutton->SetVisible(true); UIViewGroup_lowpower->SetTouchable(true); alarm_labelbutton->SetTouchable(true); + ShowUpShutDownAnimatorView(); + if(group) UIViewGroup_lowpower->Add(group); - return UIViewGroup_lowpower; }