From 5e1340393f3c522b3b8e1d34d2aa0be5b3883dd0 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Mon, 15 Jul 2024 17:57:34 +0800 Subject: [PATCH] =?utf8?q?=E7=9D=A1=E7=9C=A0=20=E6=B6=88=E6=81=AF=E5=BC=B9?= =?utf8?q?=E7=AA=97=E5=8E=BB=E9=99=A4=E5=A4=96=E9=83=A8=E4=BA=AE=E5=B1=8F?= =?utf8?q?=E5=87=BD=E6=95=B0=EF=BC=8C=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8U?= =?utf8?q?IService=E4=BA=AE=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../msg_center/src/msg_center_customer.cpp | 33 ++++++++----------- .../src/notify/message_notification.cpp | 4 +++ .../src/notify/sleep_notification.cpp | 10 +++--- 3 files changed, 23 insertions(+), 24 deletions(-) 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 9d5dbf9af..cbab6a0e3 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 @@ -270,6 +270,8 @@ static OHOS::UIViewGroup* showSleepNotify(void) { return OHOS::CreateSleepNotifyView(); } + + void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) { unused(req); @@ -286,7 +288,6 @@ void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) } } - void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) { unused(req); @@ -447,7 +448,7 @@ void MsgCenterNotifyNextDayProc(const Topic topic, Request* req) if(!ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP)) { - //未设置睡眠监控 nextday进行清除消息。 + //未设置睡眠监控 nextday进行清除睡眠数据。 SleepModel::GetInstance().DeleteSleepData(); } @@ -640,15 +641,9 @@ void MsgCenterNotifyMessageProc(const Topic topic, Request* req) unused(topic); unused(req); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyMessageProc !"); - //亮屏显示新信息弹窗 - 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); - // NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); - NotificationManager::GetInstance()->ShowNotify(showMessageNotify, (uint16_t)topic, true); + if (CheckPriority(topic)) { + NotificationManager::GetInstance()->ShowNotify(showMessageNotify, (uint16_t)topic, true); + } } //睡眠提醒通知 @@ -656,15 +651,13 @@ void MsgCenterNotifySleepProc(const Topic topic, Request* req) { unused(topic); unused(req); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifySleepProc !"); - //亮屏显示新信息弹窗 - 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); - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifySleepProc %d!",SleepModel::GetInstance().get_sleep_state()); + + if(SleepModel::GetInstance().get_sleep_state()==SLEEPSTATE::WAKE) + { + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + AlarmClockModel::GetInstance()->PopInterPlayMusic(); + } NotificationManager::GetInstance()->ShowNotify(showSleepNotify, (uint16_t)topic, true); } #endif diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp index b5d24a62a..0a1f7ff5b 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp @@ -199,6 +199,9 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create MessageGroupView succeed!!"); // 震动提醒 custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); + // 亮屏操作 + int32_t timeout = -1; + SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t)); return MessageGroupView; } /*释放消息弹窗视图*/ @@ -226,6 +229,7 @@ namespace OHOS MessageGroupView = nullptr; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Free MessageView succeed!!"); } + SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, NULL, 0); return; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp index b461244d3..64a3e0252 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp @@ -78,14 +78,12 @@ namespace OHOS break; case SLEEPSTATE::SLEPP: titleStr = SleepModel::GetInstance().get_sleep_notifiy(); - textId = STR_DISTURBNOTE; + textId = STR_DISTURBNOTE; break; case SLEEPSTATE::WAKE: titleStr = SleepModel::GetInstance().get_wake_notifiy(); textId = STR_MORNNING; - SetAlarmClockView(); // 设置为早安视图 - SleepViewEventListener::GetInstance().PopInterPlayMusic(); - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + SetAlarmClockView(); // 设置为早安视图 return SleepGroupView; break; default: @@ -149,6 +147,9 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create SleepGroupView succeed!!"); custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 + // 亮屏操作 + int32_t timeout = -1; + SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t)); return SleepGroupView; } @@ -236,6 +237,7 @@ namespace OHOS delete SleepGroupView; SleepGroupView = nullptr; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Free SleepView succeed!!"); + SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, NULL, 0); } return; } -- 2.17.1