From: 袁清梦 <3449750381@qq.com> Date: Thu, 26 Sep 2024 12:23:50 +0000 (+0000) Subject: Merge #1022 into sdk602patch0626 from refs/changes/1022/head X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=2a8a11a3d735870df344b2ff0aa9a24a6d8277f1;p=mirrors%2FFD230.git Merge #1022 into sdk602patch0626 from refs/changes/1022/head Code review from 袁清梦 * refs/changes/1022/head: (3 commits squashed) - app发起运动进行状态改变的时候进行时长校验 - #660 手表,已经设置密码锁,关机后在开机、重启、长按电源键10S强制重启,现在需要等手表自动息屏后才会上锁 - scrollview里面添加list,如果list item较少,滑动会有大片空白出现。 Signed-off-by: Caisking <3449750381@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1022 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 0bdcea9e9..5d58f7281 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -274,6 +274,10 @@ #include "schedule/include/ScheduleData.h" #include "sleepmode/include/SleepModePresenter.h" +#include "ui_service.h" +extern "C" void uapi_dev_runtime_set_lock_status(uint8_t status); +extern "C" uint8_t uapi_dev_runtime_get_lock_status(void); + #ifdef SUPPORT_ALIPAY_SEC #include "AlipayMainView.h" #include "AlipayPresenter.h" @@ -529,10 +533,25 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Power is Charging!"); DialModelCharge::GetInstance()->UpdatechargeStatus(1); } + /*开机读取天气历史数据*/ - C_ScheduleDataReadFromFile(); mmi_sleep_mode_switch_read(); + + /*开机如果设置了密码锁,进行锁屏*/ + int lockstate = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_PASSWORD_SWITCH); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "lockstate = %d", lockstate); + // 打印锁定状态判断 + if (lockstate == 1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Native ability state is active."); + if (uapi_dev_runtime_get_lock_status() == 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Device is unlocked (lock status == 0)."); + uapi_dev_runtime_set_lock_status(1); // 上锁 + OHOS::MainModel::GetInstance().setDialState(OHOS::DialState::LOCK, true); + } + } } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h index 2231fc5ed..887efca21 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h @@ -243,6 +243,7 @@ namespace OHOS SportData *GetSportdata(); /*获取训练数据*/ void SetIntensity(int heart); /*设置训练强度*/ UIResourceTextId GetIntensity(); /*获取训练强度STR*/ + uint32_t GetSportTime(); /*获取目前运动时长*/ bool SaveSportData(); /*保存数据*/ void SendLiveData(); /*发送实时数据*/ int CalculateAverageHeartRate(int newHeartRate); /*平均心率计算*/ diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index 3998ebb47..fc3b2da5f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -1230,7 +1230,11 @@ namespace OHOS { return Openstate; } - + /*获取运动时长*/ + uint32_t TraingModel::GetSportTime() + { + return sportdata->duration; + } /*获取训练量是否达标*/ bool TraingModel::GetMomentum() { #if 0 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp index 9d1ea290c..725313ab2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -26,6 +26,7 @@ #include "traing/training_card/include/TrainingControlView.h" #include "uicomponents/UIComponents.h" #include "vibrator_service.h" + #include #include #include @@ -420,14 +421,20 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ExerciseState::End [%d]\r\n", cmdState); + uint32_t sport_time = TraingModel::GetInstance()->GetSportTime(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sport_time[%d]\r\n", sport_time); + switch (cmdState) { case ExerciseState::End: + reply_APP_SportStopModeCmd(sport_time); handleEndState(); break; case ExerciseState::Pause: + reply_APP_SportPasueResetCmd(sport_time); handlePauseState(); break; case ExerciseState::Continue: + reply_APP_SportPasueResetCmd(sport_time); handleContinueState(); break; case ExerciseState::Start: diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 4e55dca60..a3914a4bf 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -3899,7 +3899,7 @@ static void OpenSportModeCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *to } } -void reply_APP_StopSportModeCmd(uint16_t time) +void reply_APP_SportStopModeCmd(uint16_t time) { char data[3]={0}; uint32_t data_len=3; diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index 0afd573dd..7b8b25df7 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -828,7 +828,7 @@ void GetwatchSaveMac(uint8_t *mac,uint8_t *mactype); void reply_APP_SportPasueResetCmd(uint16_t time); -void reply_APP_StopSportModeCmd(uint16_t time); +void reply_APP_SportStopModeCmd(uint16_t time); ///////////////////////////自定义文件传输协议///////////////////////////// #define OTA_FILE_MSG_CMD 0x0601 diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp index 242f67e9a..675690547 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp @@ -380,13 +380,35 @@ bool UIList::DragYInner(int16_t distance) } distance = CalculateElasticDragLen(reboundSize, offset, distance); } - if ((childrenTail_->GetRelativeRect().GetBottom() + distance) < + if (childrenTail_->GetRelativeRect().GetBottom() < + (listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM))) { + distance = 0; + } else if ((childrenTail_->GetRelativeRect().GetBottom() + distance) < (listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM))) { distance = listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM) - childrenTail_->GetRelativeRect().GetBottom(); } } } + // } else { + // if (childrenTail_ != nullptr) { + // if (isElastic_ && (reboundSize > 0) && + // (childrenTail_->GetRelativeRect().GetBottom() < + // (listHeight - scrollBlankSize_ - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM)))) { + // int16_t offset = (listHeight - scrollBlankSize_ - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM)) + // - (childrenTail_->GetRelativeRect().GetBottom()); + // if (offset > reboundSize) { + // offset = reboundSize; + // } + // distance = CalculateElasticDragLen(reboundSize, offset, distance); + // } + // if ((childrenTail_->GetRelativeRect().GetBottom() + distance) < + // (listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM))) { + // distance = listHeight - scrollBlankSize_ - reboundSize - childrenTail_->GetStyle(STYLE_MARGIN_BOTTOM) + // - childrenTail_->GetRelativeRect().GetBottom(); + // } + // } + // } return MoveOffset(0, distance); }