From 893adea13910b97c2b1979036648445727d7e3ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=A2=81=E6=B8=85=E6=A2=A6?= <3449750381@qq.com> Date: Sat, 20 Dec 2025 08:17:13 +0000 Subject: [PATCH] Merge #2952 into sdk650pathc0423 from refs/changes/2952/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 袁清梦 * refs/changes/2952/head: (18 commits squashed) - release V1.3.114 FD272 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - 272 优化动画效果 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - release V1.3.115 -FD272 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 - 修复SOS储存 - 优化时间刷新 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 Signed-off-by: Caisking <3449750381@qq.com> Merged-by: Caisking <3449750381@qq.com> CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/2952 --- autobuild.sh | 2 +- .../nativeui/clock/src/MainClockView.cpp | 346 +++++++++--------- .../nativeui/main/src/MainPresenterSample.cpp | 7 +- .../include/ShutDownImageAnimatorView.h | 2 +- .../src/notify/charge_notification.cpp | 2 +- .../msg_center/src/notify/transmitting.cpp | 2 +- .../service/src/graphic_service_wrapper.cpp | 2 +- .../src/kvstore_impl_posix/kv_store.c | 2 +- code/sdk/zhihui/utils/custom_utils.c | 4 +- 9 files changed, 192 insertions(+), 177 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index bb78542b1..fa768e729 100644 --- a/autobuild.sh +++ b/autobuild.sh @@ -49,7 +49,7 @@ DEFAULT_SSB_NAME=$DEFAULT_APPLICATION_NAME-ssb declare -A PROJECT_VERSIONS=( # 基础项目版本 ["fd230"]="1.3.107" - ["fd272"]="1.3.112" + ["fd272"]="1.3.115" ["user"]="1.3.107" ["fd230_user"]="1.3.107" diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/clock/src/MainClockView.cpp index da206580d..e69a6069c 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/clock/src/MainClockView.cpp @@ -597,176 +597,186 @@ UpdateTime(); } - /* 更新时间 */ - void MainClockView::UpdateTime(void) { - struct tm local_time = {0}; - time_t seconds = time(nullptr); - - if (localtime_r(&seconds, &local_time) == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get localtime error!"); - return; - } - - uint8_t hour = local_time.tm_hour % HOURS_IN_DAY; - uint8_t minute = local_time.tm_min % MINUTES_IN_HOUR; - char timebuf[64] = {0}; - //时间显示样式 - #if TIMEFORMAT - if (uapi_dev_runtime_get_time_hour_show_model() == HOUR_FORMAT_12) { - if (hour > HOUR_FORMAT_12) { - hour -= HOUR_FORMAT_12; - } - } - #endif - //是否显示秒 - #if SECONDTEST - uint8_t second = local_time.tm_sec; - sprintf(timebuf, "%02d:%02d:%02d", hour, minute, second); - #else - sprintf_s(timebuf, sizeof(timebuf), "%02d:%02d", hour, minute); - #endif - - if (timerlabel != nullptr) - timerlabel->SetText(timebuf); - - - std::string weekStr = Cnweekdays[local_time.tm_wday]; - std::string dateStr = std::to_string(local_time.tm_mon + 1) + "月" + - std::to_string(local_time.tm_mday) + "号 " + weekStr; - - if (datelabel != nullptr) - datelabel->SetText(dateStr.c_str()); - - - //电量显示配置 - if (batterySetting == BATTERY_DISPLAY_NONE) - return; - - - UpdateBatteryColor(); - - float voltage = 0.0F; - int power = 0; - #ifdef SUPPORT_BATTERY_SERVICE - power = battery_get_voltage(&voltage); - #endif - if (power == power_) - return; - - power_ = power; - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryprogress power_:%d", power_); - - if (batteryprogress != nullptr && batterylabel != nullptr) { - batteryprogress->SetValue(power_); - std::string batteryStr = std::to_string(power_) + "%"; - batterylabel->SetText(batteryStr.c_str()); - } - } - - void MainClockView::UpdateBatteryColor(void) - { - bool isCharging = false; - #ifdef SUPPORT_BATTERY_SERVICE - isCharging = get_charge_stat(); // 获取充电状态 + /* 更新时间 */ + void MainClockView::UpdateTime(void) { + struct tm local_time = {0}; + time_t seconds = time(nullptr); + + if (localtime_r(&seconds, &local_time) == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get localtime error!"); + return; + } + + uint8_t hour = local_time.tm_hour % HOURS_IN_DAY; + uint8_t minute = local_time.tm_min % MINUTES_IN_HOUR; + char timebuf[64] = {0}; + //时间显示样式 + #if TIMEFORMAT + if (uapi_dev_runtime_get_time_hour_show_model() == HOUR_FORMAT_12) { + if (hour > HOUR_FORMAT_12) { + hour -= HOUR_FORMAT_12; + } + } #endif + //是否显示秒 + #if SECONDTEST + uint8_t second = local_time.tm_sec; + sprintf(timebuf, "%02d:%02d:%02d", hour, minute, second); + #else + sprintf_s(timebuf, sizeof(timebuf), "%02d:%02d", hour, minute); + #endif + + if (timerlabel != nullptr) + timerlabel->SetText(timebuf); + + + // 防止数组越界:确保 tm_wday 在有效范围内 (0-6) + int wday = local_time.tm_wday; + if (wday < 0 || wday > 6) { + wday = 0; // 默认使用星期天 + } + std::string weekStr = Cnweekdays[wday]; + std::string dateStr = std::to_string(local_time.tm_mon + 1) + "月" + + std::to_string(local_time.tm_mday) + "号 " + weekStr; + + if (datelabel != nullptr) + datelabel->SetText(dateStr.c_str()); + + //电量显示配置 + if (batterySetting == BATTERY_DISPLAY_NONE) + return; + + UpdateBatteryColor(); + + float voltage = 0.0F; + int power = 0; + #ifdef SUPPORT_BATTERY_SERVICE + power = battery_get_voltage(&voltage); + #endif + if (power == power_) + return; + + power_ = power; + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryprogress power_:%d", power_); + + if (batteryprogress != nullptr && batterylabel != nullptr) { + batteryprogress->SetValue(power_); + std::string batteryStr = std::to_string(power_) + "%"; + batterylabel->SetText(batteryStr.c_str()); + } + } + + void MainClockView::UpdateBatteryColor(void) + { + bool isCharging = false; + #ifdef SUPPORT_BATTERY_SERVICE + isCharging = get_charge_stat(); // 获取充电状态 + #endif + + if (isCharging) + { + if (!isBatteryIconVisible) + { + if (batteryicon != nullptr) { + batteryicon->SetVisible(true); + isBatteryIconVisible = true; + } + } + SetViewColor(Color::Green().full); // 充电状态为绿色 + return; + } + else + { + if (isBatteryIconVisible) + { + if (batteryicon != nullptr) { + batteryicon->SetVisible(false); + isBatteryIconVisible = false; + } + } + + if (power_ <= BATTERY_LOW_THRESHOLD) + { + SetViewColor(Color::Red().full); + } + else if (power_ <= BATTERY_MEDIUM_THRESHOLD) + { + SetViewColor(Color::Yellow().full); + } + else + { + if (batterySetting == BATTERY_DISPLAY_BLACK) + { + SetViewColor(Color::Black().full); + } + else + { + SetViewColor(Color::White().full); + } + } + } + } + + void MainClockView::SetViewColor(int64_t color) + { + if (color == color_) + { + return; + } + color_ = color; + if (batteryprogress != nullptr) { + batteryprogress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, color_); + } + } + + /*刷新步数*/ + void MainClockView::RefreshStep(int step) + { + if (stepLabel == nullptr) + return; + + char stepChar[STEP_CHAR_NUM] = {0}; + (void)sprintf_s(stepChar, STEP_CHAR_NUM, "%d", step); + stepLabel->SetText(stepChar); + } + + /*刷新心率*/ + void MainClockView::RefreshHeartRate(int value) + { + if (heartlabel == nullptr) + return; + + if (value == 0) + { + heartlabel->SetText("--"); + return; + } + char heartRateChar[STEP_CHAR_NUM] = {0}; + (void)sprintf_s(heartRateChar, STEP_CHAR_NUM, "%d", value); + heartlabel->SetText(heartRateChar); + } + + /*初始化步数*/ + void MainClockView::InitStepValue() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainClockView::InitStepValue"); + uint32_t stepValue; + int weekToday = ActivityModel::GetInstance()->GetWeekToday(); + ActivityModel::GetInstance()->GetStepData((StepDataDistribute)weekToday, &stepValue); + char stepChar[STEP_CHAR_NUM] = {0}; + if (sprintf_s(stepChar, STEP_CHAR_NUM, "%d", stepValue) == -1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView::InitStepValue error"); + return; + } + if (stepLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView::InitStepValue nullptr"); + return; + } + stepLabel->SetText(stepChar); + } - if (isCharging) - { - if (!isBatteryIconVisible) - { - batteryicon->SetVisible(true); - isBatteryIconVisible = true; - } - SetViewColor(Color::Green().full); // 充电状态为绿色 - return; - } - else - { - if (isBatteryIconVisible) - { - batteryicon->SetVisible(false); - isBatteryIconVisible = false; - } - - if (power_ <= BATTERY_LOW_THRESHOLD) - { - SetViewColor(Color::Red().full); - } - else if (power_ <= BATTERY_MEDIUM_THRESHOLD) - { - SetViewColor(Color::Yellow().full); - } - else - { - if (batterySetting == BATTERY_DISPLAY_BLACK) - { - SetViewColor(Color::Black().full); - } - else - { - SetViewColor(Color::White().full); - } - } - } - } - - void MainClockView::SetViewColor(int64_t color) - { - if (color == color_) - { - return; - } - color_ = color; - batteryprogress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, color_); - } - - /*刷新步数*/ - void MainClockView::RefreshStep(int step) - { - if (stepLabel == nullptr) - return; - - char stepChar[STEP_CHAR_NUM] = {0}; - (void)sprintf_s(stepChar, STEP_CHAR_NUM, "%d", step); - stepLabel->SetText(stepChar); - } - - /*刷新心率*/ - void MainClockView::RefreshHeartRate(int value) - { - if (heartlabel == nullptr) - return; - - if (value == 0) - { - heartlabel->SetText("--"); - return; - } - char heartRateChar[STEP_CHAR_NUM] = {0}; - (void)sprintf_s(heartRateChar, STEP_CHAR_NUM, "%d", value); - heartlabel->SetText(heartRateChar); - } - - /*初始化步数*/ - void MainClockView::InitStepValue() - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainClockView::InitStepValue"); - uint32_t stepValue; - int weekToday = ActivityModel::GetInstance()->GetWeekToday(); - ActivityModel::GetInstance()->GetStepData((StepDataDistribute)weekToday, &stepValue); - char stepChar[STEP_CHAR_NUM] = {0}; - if (sprintf_s(stepChar, STEP_CHAR_NUM, "%d", stepValue) == -1) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView::InitStepValue error"); - return; - } - if (stepLabel == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView::InitStepValue nullptr"); - return; - } - stepLabel->SetText(stepChar); - } /*初始化指针图片*/ bool MainClockView::InitCenterCircleView(void) { diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/main/src/MainPresenterSample.cpp index 714dacec8..dad1bdbb4 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -488,7 +488,7 @@ break; case GOAL: - // Updategoal(); + Updategoal(); break; case SLEEP: @@ -557,6 +557,11 @@ /*主表盘*/ void MainPresenterSample::UpdateWatchFace() { + if(view_ == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "view_ is nullptr"); + return; + } DialSetting &setting = GetDialSetting(); if (setting.dialFlag) { diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h index 90011ab2e..a350e4be3 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h @@ -19,7 +19,7 @@ namespace OHOS static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_W = 466; static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 466; static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 44; // 图片帧数 - static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔 + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 130; // 图片更新间隔 static constexpr const char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; // 关机图片路径 class ShutDownImageAnimatorView : public UIImageAnimatorView::AnimatorStopListener diff --git a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/charge_notification.cpp b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/charge_notification.cpp index 82e4deedc..39581c92b 100644 --- a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/charge_notification.cpp +++ b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/charge_notification.cpp @@ -30,7 +30,7 @@ namespace OHOS UIViewGroup *group=nullptr; UIImageAnimatorView *ShutDownImageAnimatorView=nullptr; static constexpr char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; //关机图片路径 - #define SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES 30 // 图片帧数 + #define SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES 45 // 图片帧数 static int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 130; // 图片更新间隔 static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_X = 0; diff --git a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/transmitting.cpp b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/transmitting.cpp index ab3ed1282..e4d3cc883 100644 --- a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/transmitting.cpp +++ b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/transmitting.cpp @@ -55,7 +55,7 @@ namespace OHOS #define TRANSMITTING_SUCC_PATH PNG_SUCC_IMAGE; #define TRANSMITTING_FAIL_PATH PNG_ATTENTION_IMAGE; - #define TRANSMITTING_OTA_DOWN "/user/res/system/FOOINGLOGO.bin" + #define TRANSMITTING_OTA_DOWN "/user/system/FOOINGLOGO.bin" diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp index 4a9684eda..7221f258f 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp @@ -90,7 +90,7 @@ extern "C" static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 36; // 图片帧数 #endif - static constexpr int16_t REBOOT_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔 + static constexpr int16_t REBOOT_IMAGE_ANIMATOR_TIME = 130; // 图片更新间隔 static OHOS::ImageAnimatorInfo ReBootImageInfo[REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 开机图像的信息 static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_X = 0; static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_Y = 0; diff --git a/code/sdk/open_source/openharmony/utils/native/lite/kv_store/src/kvstore_impl_posix/kv_store.c b/code/sdk/open_source/openharmony/utils/native/lite/kv_store/src/kvstore_impl_posix/kv_store.c index 86b238a94..6f0f3db89 100644 --- a/code/sdk/open_source/openharmony/utils/native/lite/kv_store/src/kvstore_impl_posix/kv_store.c +++ b/code/sdk/open_source/openharmony/utils/native/lite/kv_store/src/kvstore_impl_posix/kv_store.c @@ -270,7 +270,7 @@ int UtilsSetValue(const char* key, const char* value) } g_getKvSum = TRUE; } - printf("dataPath: %s\n", dataPath); + printf("dataPath: %s key: %s value: %s\n", dataPath, key, value); boolean newItem = NewItem(dataPath, key); if ((g_kvSum >= MAX_KV_SUM) && newItem) { pthread_mutex_unlock(&g_kvGlobalMutex); diff --git a/code/sdk/zhihui/utils/custom_utils.c b/code/sdk/zhihui/utils/custom_utils.c index 666688c6f..e0b68e933 100644 --- a/code/sdk/zhihui/utils/custom_utils.c +++ b/code/sdk/zhihui/utils/custom_utils.c @@ -734,14 +734,14 @@ void startup_post_init_task(void) #endif #endif - // ble_SOS_data_init();//开启会死机需适配 + ble_SOS_data_init(); #ifdef SUPPORT_CAT1_SERVICE // up_report_timer(); #endif read_jsonHistory_weather(); - // ota_updata_init();//开启会死机需适配 + // ota_updata_init(); #ifdef CUSTOM_ZHIHUI system_init_uart();//配置uartat -- 2.17.1