From bc56909b1e35e0a1b1e3911f3b323947af34dcdb Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Wed, 18 Sep 2024 02:52:42 +0000 Subject: [PATCH] Merge #977 into sdk602patch0626 from refs/changes/977/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/977/head: (8 commits squashed) - #524,解决:录音删除,删除后不是返回到录音列表界面,返回的是录音界面bug #658,解决,手表,录音频繁点击会有蓝色效果 - #656,解决,手表,闹钟偶现0000闹钟提醒bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 4G界面添加“注:启用4G,可能会加速消耗电量”提醒 - 运动识别界面添加提醒标签,#192,解决,运动识别界面单一bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 根据禅道上期望:APP查找手表和闹钟,勿扰睡眠静音模式下都有响铃和震动提醒 #421解决, 睡眠模式,闹钟无响铃震动bug - 解决静音模式错误开启后会全局静音bug,根据禅道期望“来电铃声、短信消息提醒,勿扰睡眠静音模式下只有亮屏提醒” Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/977 --- .../nativeui/alarm/include/AlarmClockModel.h | 1 + .../nativeui/alarm/src/AlarmClockModel.cpp | 12 +++ .../nativeui/key/src/KeyInputListener.cpp | 7 +- .../include/MotionRecognitionView.h | 3 +- .../src/MotionRecognitionView.cpp | 26 +++++- .../include/NetworkAndCallView.h | 5 +- .../networkandcall/src/NetworkAndCallView.cpp | 84 +++++++++++++------ .../nativeui/record/src/RecordGoingView.cpp | 2 +- .../nativeui/record/src/RecordingModel.cpp | 2 +- .../record/src/RecordingPresenter.cpp | 11 ++- .../include/SoundAndVibrationVolumeSettingC.h | 3 +- .../src/SoundAndVibrationPresenter.cpp | 4 +- ...oundAndVibrationVolumeSettingPresenter.cpp | 9 +- .../service/ble_service/blemoder/bletest.cpp | 1 - .../include/notify/alarm_notification.h | 3 + .../msg_center/src/msg_center_customer.cpp | 15 ++-- .../src/notify/alarm_notification.cpp | 46 ++++++---- .../src/notify/findwatch_notification.cpp | 18 ++-- .../peripheral/config/src/ConfigModel.cpp | 2 - .../drivers/peripheral/utils/custom_utils.c | 7 -- .../drivers/peripheral/utils/custom_utils.h | 1 - 21 files changed, 167 insertions(+), 95 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h index 6bb071bed..536197537 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h @@ -124,6 +124,7 @@ public: void UpdateAlarmInfoByAppSet(void); void CancelAlarmRing(); + void DelayAlarmRing(); private: void SetAlarmId(uint8_t id); diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index c0cb884fd..d3387cb04 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -1097,6 +1097,18 @@ void AlarmClockModel::CancelAlarmRing() } } +void AlarmClockModel::DelayAlarmRing() +{ + uint8_t alarmId = 0; + bool alarmStatus; + alarmStatus = AlarmClockModel::GetInstance()->GetListenClockId(&alarmId); + if (!alarmStatus) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::DelayAlarmRing get alarm Id false!"); + return; + } + AlarmClockModel::GetInstance()->SetDelayAlarm(alarmId); +} + bool AlarmPlayerListener::IsPaused() { return isPaused_; diff --git a/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp b/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp index 7b8214e11..8a3f4ff75 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp @@ -46,9 +46,10 @@ namespace OHOS uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); if (NotificationManager::GetInstance()->HasNotifyShowing() && notifyId == TOPIC_EVENT_ALARM_RING) { - AlarmClockModel::GetInstance()->AlarmGetClockNum(); - AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); - NotificationManager::GetInstance()->StopNotify(); + // AlarmClockModel::GetInstance()->AlarmGetClockNum(); + // AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); + // NotificationManager::GetInstance()->StopNotify(); + return; } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h index 58cb3e3db..8e80ddada 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 17:29:18 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-24 18:03:56 + * @LastEditTime: 2024-09-14 15:56:07 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h */ #ifndef MOTION_RECOGNITION_VIEW_H @@ -39,6 +39,7 @@ namespace OHOS UIImageView *MotionRecognitionImage = nullptr; UILabelExt *MotionRecognitionLabel = nullptr; UIToggleButton *MotionRecognitionToggleButton = nullptr; + UILabelExt *note{nullptr}; bool viewInitStatus{false}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp index 8d7780107..638232318 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 17:28:52 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-24 18:16:10 + * @LastEditTime: 2024-09-14 16:14:37 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp */ #include "motionrecognition/include/MotionRecognitionPresenter.h" @@ -62,6 +62,11 @@ namespace OHOS delete MotionRecognitionToggleButton; MotionRecognitionToggleButton = nullptr; } + if (note != nullptr) + { + delete note; + note = nullptr; + } delete scrollView; scrollView = nullptr; @@ -133,6 +138,24 @@ namespace OHOS /* ----------------------------- onclickListener ---------------------------- */ // MotionRecognitionToggleButton->SetOnClickListener(presenter_); MotionRecognitionToggleButton->SetOnChangeListener(presenter_); + /* -------------------------------------------------------------------------- */ + if (note == nullptr) + { + note = new UILabelExt(); + if (note == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::note can not be nullptr!"); + return; + } + } + note->SetPosition(63, MotionRecognitionImage->GetY() + MotionRecognitionImage->GetHeight() + 20, 340, 80); + note->SetStyle(STYLE_TEXT_FONT, 26); + note->SetStyle(STYLE_LINE_HEIGHT, 40); + note->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); + note->SetText("开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、骑车、划船机、椭圆机。"); /*自动识别*/ + note->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); + /* -------------------------------------------------------------------------- */ viewInitStatus = true; /* -------------------------------------------------------------------------- */ @@ -170,6 +193,7 @@ namespace OHOS scrollView->Add(MotionRecognitionImage); scrollView->Add(MotionRecognitionLabel); scrollView->Add(MotionRecognitionToggleButton); + scrollView->Add(note); container_->Add(scrollView); Draw(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h index 9fa161cb9..30db15352 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 09:57:53 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-08-24 06:05:58 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-09-14 14:30:20 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h */ @@ -67,6 +67,7 @@ namespace OHOS UILabelExt *NetworkAndCallLabel[ITEM_NUM]{nullptr}; UIToggleButton *VoLTE_toggleButton{nullptr}; // VoLTE通话开关 UIToggleButton *MobileData_toggleButton{nullptr}; // 移动数据开关 + UILabelExt *note{nullptr}; // UIImageView *NextImage{nullptr}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp index 94530d17c..9b2ac3a69 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp @@ -62,8 +62,11 @@ namespace OHOS MobileData_toggleButton = nullptr; } - // delete NextImage; - // NextImage = nullptr; + if (note != nullptr) + { + delete note; + note = nullptr; + } delete NetworkAndCallScrollView[NETWORKANDCALLVIEW]; NetworkAndCallScrollView[NETWORKANDCALLVIEW] = nullptr; @@ -80,10 +83,11 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::NetworkAndCallScrollView[NETWORKANDCALLVIEW] new fail!"); return; } - NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()-30); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetOnDragListener(presenter_); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetReboundSize(35); - NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetHorizontalScrollState(false); + NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetScrollBlankSize(30); + // NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetHorizontalScrollState(false); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetTouchable(true); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetDraggable(true); /* ---------------------------------- Title --------------------------------- */ @@ -134,6 +138,22 @@ namespace OHOS NetworkAndCallLabel[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); } /* -------------------------------------------------------------------------- */ +#if defined(SUPPORT_CHINA_MOBILE_DMP) + if (VoLTE_toggleButton == nullptr) + { + VoLTE_toggleButton = new UIToggleButton(); + if (VoLTE_toggleButton == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!"); + return; + } + } + VoLTE_toggleButton->SetPosition(298, 145, 100, 50); + VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + VoLTE_toggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE); + VoLTE_toggleButton->SetOnClickListener(presenter_); +#endif + /* --------------------------------- 移动数据开关 --------------------------------- */ if (MobileData_toggleButton == nullptr) { MobileData_toggleButton = new UIToggleButton(); @@ -143,37 +163,43 @@ namespace OHOS return; } } - MobileData_toggleButton->SetPosition(298, 145, 100, 50); + if (VoLTE_toggleButton != nullptr) + { + MobileData_toggleButton->SetPosition(298, VoLTE_toggleButton->GetY() + 120, 100, 50); + } + else + { + MobileData_toggleButton->SetPosition(298, 145, 100, 50); + } MobileData_toggleButton->SetState(uapi_cat1_get_power_stat()); MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); MobileData_toggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE); MobileData_toggleButton->SetOnClickListener(presenter_); -/* -------------------------------------------------------------------------- */ -#if defined(SUPPORT_CHINA_MOBILE_DMP) - if (VoLTE_toggleButton == nullptr) + /* -------------------------------------------------------------------------- */ + if (note == nullptr) { - VoLTE_toggleButton = new UIToggleButton(); - if (VoLTE_toggleButton == nullptr) + note = new UILabelExt(); // Create a new UILabel for each iteration + if (note == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "note is nullptr!"); return; } } - VoLTE_toggleButton->SetPosition(298, 265, 100, 50); - VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - VoLTE_toggleButton->SetState(MobileData_toggleButton->GetState() == true && ConfigModel::GetInstance()->GetVoLTE_Call()); - VoLTE_toggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE); - VoLTE_toggleButton->SetOnClickListener(presenter_); -#endif - /* -------------------------------------------------------------------------- */ - // NextImage = new UIImageView(); - // if (NextImage == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::NextImage is nullptr!"); - // return; - // } - // NextImage->SetPosition(369, 397); - // NextImage->SetSrc(PNG_SETTING_NEXT_IMAGE); + if (VoLTE_toggleButton != nullptr) + { + note->SetPosition(63, NetworkAndCallImage[1]->GetY() + NetworkAndCallImage[1]->GetHeight() + 20, 340, 80); + } + else + { + note->SetPosition(63, NetworkAndCallImage[0]->GetY() + NetworkAndCallImage[0]->GetHeight() + 20, 340, 80); + } + note->SetStyle(STYLE_TEXT_FONT, 26); + note->SetStyle(STYLE_LINE_HEIGHT, 40); + note->SetText("注:启用4G,可能会加速消耗电量"); + note->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); + note->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + note->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); + note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); } } @@ -194,10 +220,14 @@ namespace OHOS NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(NetworkAndCallLabel[i]); } #if defined(SUPPORT_CHINA_MOBILE_DMP) + if (MobileData_toggleButton != nullptr) + { + VoLTE_toggleButton->SetState(MobileData_toggleButton->GetState() == true && ConfigModel::GetInstance()->GetVoLTE_Call()); + } NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(VoLTE_toggleButton); #endif NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(MobileData_toggleButton); - // NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(NextImage); + NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(note); RootView::GetInstance()->Add(NetworkAndCallScrollView[NETWORKANDCALLVIEW]); Draw(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp index 19fcf2016..0f7ddf896 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp @@ -228,7 +228,7 @@ namespace OHOS RECORD_GOING_BUTTON->SetViewId(RECORD_GOING_BUTTON_VIEWID); RECORD_GOING_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36); RECORD_GOING_BUTTON->SetStyle(STYLE_BORDER_RADIUS, 20); - RECORD_GOING_BUTTON->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + RECORD_GOING_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffff5a36, UIButton::PRESSED); RECORD_GOING_BUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 20, UIButton::PRESSED); UIView::OnClickListener *clickListener = static_cast(RecordingPresenter::GetInstance()); RECORD_GOING_BUTTON->SetOnClickListener(clickListener); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp index 10d452c2c..6815da00e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp @@ -179,7 +179,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uri: %s,line = %d", GetRecordingPlayerUri().c_str(), __LINE__); state = p_RecordingPlayerView->GetPlayerButtonState(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "state %d,line = ", state, __LINE__); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "state %d,line = %d", state, __LINE__); if (state == UICheckBox::UICheckBoxState::UNSELECTED) { p_RecordingPlayerView->SetPlayerButtonState(UICheckBox::UICheckBoxState::SELECTED); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp index fffd42ef4..09016c40c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-06 11:51:33 + * @LastEditTime: 2024-09-13 19:51:27 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp */ @@ -270,7 +270,7 @@ namespace OHOS // uapi_delete_files(fileName.c_str());//删除录音文件 p_RecordingModel->UpdateRecordingInfo(); - p_RecordingView->ChangeView(RECORDINGDELETEVIEW, RECORDINGVIEW); + p_RecordingView->ChangeView(RECORDINGDELETEVIEW, RECORDINGLISTVIEW); return true; } else if (strcmp(view.GetViewId(), RECORD_DELETE_OFF_BUTTON_VIEWID) == 0) @@ -383,6 +383,13 @@ namespace OHOS return false; } p_RecordingView->ChangeView(RECORDINGLISTVIEW, RECORDINGPLAYERVIEW); // 切换到录音播放界面 + RecordingPlayerView *p_RecordingPlayerView = RecordingPlayerView::GetInstance(); + if (p_RecordingPlayerView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPlayerView GetInstance fail"); + return false; + } + p_RecordingPlayerView->ResetComponentStatus(); /* ------------------------ 播放录音 ------------------------ */ if (p_RecordingModel->RecordingListOnClickPlay() != OHOS_SUCCESS) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h index ecb05a39d..18042a462 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-19 18:59:49 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-06 14:43:29 + * @LastEditTime: 2024-09-14 18:28:53 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h */ #ifndef SOUND_AND_VIBRATION_VOLUME_SETTINGC_H @@ -22,7 +22,6 @@ extern "C" void CallVolumeSet(int32_t sounding); int CallVolumeGet(void); // void VibationModeSet(int value); - void SilentModelSet(bool isopen); #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp index 159ab1222..29bcc4f4d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-19 10:39:11 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-16 17:04:06 + * @LastEditTime: 2024-09-14 18:28:58 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp */ @@ -152,12 +152,10 @@ namespace OHOS { case UICheckBox::SELECTED: WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SilentMode is enable!"); - SilentModelSet(true); p_SoundAndVibrationModel->SetSilentModeToggleButtonStatus(true); break; case UICheckBox::UNSELECTED: WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SilentMode is disable!"); - SilentModelSet(false); p_SoundAndVibrationModel->SetSilentModeToggleButtonStatus(false); break; default: diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp index 8b6e66162..eda49f13e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-19 10:08:31 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-13 18:31:03 + * @LastEditTime: 2024-09-14 18:27:21 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp */ #include "soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h" @@ -241,13 +241,6 @@ extern "C" return GetCallCurrVolume(); } - /* - * @brief 静音模式设置 - */ - void SilentModelSet(bool isopen) - { - AudioServiceSetMasterMute(isopen); - } #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index d62fd87ec..965b740a6 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -1869,7 +1869,6 @@ void set_SilentMode(uint8_t falg)//设置静音模式 { OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetSilentMode(falg); - uapi_setSilentMode(falg); #ifdef FD230 SendMsgToUIService(UI_UPDATE_SILENT_MODE,0,nullptr,0); #endif diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h index 7fe74358d..48a98bdff 100755 --- a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h @@ -39,6 +39,9 @@ public: AlarmViewEventListener(); virtual ~AlarmViewEventListener(); static AlarmViewEventListener *GetInstance(void); + void PopAlarmRing(); + void CancelAlarmRing(); + void DelayAlarmRing(); bool OnDrag(UIView& view, const DragEvent& event) override; bool OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event) override; bool OnClick(OHOS::UIView& view, const OHOS::ClickEvent& event) override; 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 aa954beb8..0e4f5118e 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 @@ -316,14 +316,15 @@ void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) // The alarm notification is not displayed if the incoming call notification is already being processed if (CheckPriority(topic)) { // AlarmClockModel::GetInstance()->PopInterPlayMusic(); - FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/music/ring/alarm.mp3");//播放铃声 + AlarmViewEventListener::GetInstance()->PopAlarmRing(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(ShowAlarmNotify, static_cast(topic), true); } else { // just delay the alarm WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "just delay the alarm"); - AlarmClockModel::GetInstance()->AlarmGetClockNum(); - AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); + // AlarmClockModel::GetInstance()->AlarmGetClockNum(); + // AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); + AlarmViewEventListener::GetInstance()->DelayAlarmRing(); } } @@ -853,7 +854,7 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req) { display_api->turn_on_screen(); } - if(true != ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + if(true != ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()) && true != ConfigModel::GetInstance()->GetSilentMode()) { AlarmClockModel::GetInstance()->testPlayerStart("/music/ring/ring.mp3"); } @@ -880,7 +881,8 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) return; } SetMicMute(false); - AlarmClockModel::GetInstance()->AlarmPlayerStop(); + // AlarmClockModel::GetInstance()->AlarmPlayerStop() + AlarmViewEventListener::GetInstance()->CancelAlarmRing(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE); CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); @@ -928,7 +930,8 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req) unused(topic); unused(req); // just stop the notify - AlarmClockModel::GetInstance()->AlarmPlayerStop(); + // AlarmClockModel::GetInstance()->AlarmPlayerStop(); + AlarmViewEventListener::GetInstance()->CancelAlarmRing(); if(!NotificationManager::GetInstance()->GetWatchCallStatus()) { return; diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp index db4838da5..4b81510bd 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp @@ -99,18 +99,14 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NoOperateCallback popalarm_time = %d",popalarm_time); if (popalarm_time <= 0) { - DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); - // AlarmPopUpPresenter::GetInstance()->CancelAlarmRing(); - AlarmClockModel::GetInstance()->CancelAlarmRing(); - FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); - NotificationManager::GetInstance()->StopNotify(); + AlarmViewEventListener::GetInstance()->CancelAlarmRing(); } else { - if (true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get())) - { - return; - } + // if (true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get())) + // { + // return; + // } if (g_alarmView) { ui_api_vibrate_once_func(); @@ -594,11 +590,8 @@ namespace OHOS if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { if (strcmp(view.GetViewId(), ALARM_VIEW_POPUP) == 0) - { - DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); - AlarmClockModel::GetInstance()->CancelAlarmRing(); - FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); - NotificationManager::GetInstance()->StopNotify(); + { + CancelAlarmRing(); } } return true; @@ -635,12 +628,29 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlamNotify ClickListener %s", view.GetViewId()); if (strcmp(view.GetViewId(), ALARM_IMAGE_STOP) == 0) // 点击停止闹钟响铃 { - DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); // AlarmPopUpPresenter::GetInstance()->CancelAlarmRing(); - AlarmClockModel::GetInstance()->CancelAlarmRing(); - FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); - NotificationManager::GetInstance()->StopNotify(); + CancelAlarmRing(); } return true; } + + void AlarmViewEventListener::PopAlarmRing() + { + FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/music/ring/alarm.mp3");//播放铃声 + } + + void AlarmViewEventListener::CancelAlarmRing() + { + DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); + FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); + AlarmClockModel::GetInstance()->CancelAlarmRing(); + NotificationManager::GetInstance()->StopNotify(); + } + + void AlarmViewEventListener::DelayAlarmRing() + { + CancelAlarmRing();//先取消闹铃 + AlarmClockModel::GetInstance()->AlarmGetClockNum(); + AlarmClockModel::GetInstance()->DelayAlarmRing(); + } } // namespace OHOS diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 439d3a34a..3db3e3ad6 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-09 21:29:58 + * @LastEditTime: 2024-09-14 17:31:21 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。 * 以下是基本的实现步骤: @@ -131,10 +131,10 @@ namespace OHOS void FindWatchViewEventListener::SetVibration(void) { - if(true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get())) - { - return; - } + // if(true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get())) + // { + // return; + // } if(nullptr != FindWatchGroupView) { @@ -321,10 +321,10 @@ namespace OHOS path_ = path; ScreenTurnOn(-1); // 亮屏操作 - if(true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get())) - { - return; - } + // if(true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get())) + // { + // return; + // } // 将"开启查找手表铃声"任务发布到异步线程 GraphicService::GetInstance()->PostGraphicEvent( diff --git a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp index f1eeac91e..34dd6ab03 100644 --- a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp +++ b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp @@ -1052,7 +1052,6 @@ namespace OHOS void ConfigModel::SetSilentMode(bool state) { set_condigData_Bool(CONFIGMODEL_ITEM_SILENT_MODE,state); - //uapi_setSilentMode(state); } /*获取静音模式是否开启*/ @@ -1370,7 +1369,6 @@ void cm_initializeSilentModel(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cm_initializeSilentModel"); bool isopen = OHOS::ConfigModel::GetInstance()->GetSilentMode(); - uapi_setSilentMode(isopen); } void cm_initializeVoLTECall(void) diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 697101f58..75668456e 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1169,13 +1169,6 @@ int uapi_callVolumeGet(void) } -//设置是否静音 -void uapi_setSilentMode(bool isopen) -{ - #ifdef FD230 - SilentModelSet(isopen); - #endif -} void power_on_cat1(void) { uapi_cat1_power_on(1); diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 7be63e2da..7cf7933ef 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -118,7 +118,6 @@ int uapi_systemVolumeGet(void); void uapi_callVolumeSet(int32_t sounding); int uapi_callVolumeGet(void); // void uapi_vibrationModeSet(int value); -void uapi_setSilentMode(bool isopen); void uapi_set4GCapability(bool isopen); errcode_t uapi_get_btaddr(uint8_t *buf_btaddr, uint32_t *len_btaddr); -- 2.17.1