From: luozheng <1732036298@qq.com> Date: Sat, 14 Sep 2024 03:10:01 +0000 (+0800) Subject: #656,解决,手表,闹钟偶现0000闹钟提醒bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=887220a9bad8d14c9ca089a5606adff1105e4625;p=mirrors%2FFD230.git #656,解决,手表,闹钟偶现0000闹钟提醒bug --- 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/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..4ee3333bb 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(); } } @@ -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..d1585d6c6 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,11 +99,7 @@ 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 { @@ -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