优化勿扰场景
authorcheng <chengyf@zhihuishixun.com>
Tue, 6 Aug 2024 10:23:25 +0000 (18:23 +0800)
committercheng <chengyf@zhihuishixun.com>
Tue, 6 Aug 2024 10:23:25 +0000 (18:23 +0800)
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp
code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp

index 1dd336c..ea88e66 100644 (file)
@@ -18,6 +18,7 @@
 #include "PlayersModel.h"
 #include "PhoneService.h"
 #include "ui_service.h"
+#include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -691,8 +692,12 @@ void AlarmClockModel::PopInterPlayMusic()
 {
     int32_t timeout = -1;
     SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t));
-    GraphicService::GetInstance()->PostGraphicEvent(
-        std::bind(&AlarmClockModel::AlarmPlayerStart, AlarmClockModel::GetInstance()));
+
+    if(true != ConfigModel::GetInstance()->GetDnotdisturb())
+    {
+        GraphicService::GetInstance()->PostGraphicEvent(
+            std::bind(&AlarmClockModel::AlarmPlayerStart, AlarmClockModel::GetInstance()));
+    }
 }
 
 void AlarmClockModel::SetSliceId()
index a0d8939..b93a47f 100644 (file)
@@ -12,6 +12,8 @@
 #include "wearable_log.h"\r
 #include "countdown/include/MainCountDownView.h"\r
 #include <cmsis_os.h>\r
+#include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h"\r
+\r
 namespace OHOS\r
 {\r
     /* -------------------------------------------------------------------------- */\r
@@ -306,7 +308,10 @@ namespace OHOS
     /*触发铃声的开始*/\r
     void CountDownModel::RequestStartRingtone(void)\r
     {\r
-        PostRingtoneEvent(&CountDownModel::StartRingtonePlayback);\r
+        if(true != ConfigModel::GetInstance()->GetDnotdisturb())\r
+        {\r
+            PostRingtoneEvent(&CountDownModel::StartRingtonePlayback);\r
+        }\r
     }\r
 \r
     /*触发铃声的停止*/\r
index a0a6bd9..fc845eb 100644 (file)
@@ -216,7 +216,10 @@ namespace OHOS
         }
         SetViewData();
 
-        custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        {
+            custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+        }
 
         RootView::GetInstance()->Add(container_);
         SetContainerView(container_);
index d854077..f4e80af 100644 (file)
@@ -457,7 +457,10 @@ namespace OHOS
         if (sportdata->heart >= maxHeartRate)
         {
             uapi_set_screen_on_api();                             // 亮屏检测
-            custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+            if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+            {
+                custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+            }
             TraingCardView::GetInstance()->SetPopupViewStatus(HeartPopup, true);
         }
 
@@ -471,7 +474,10 @@ namespace OHOS
             {
                 // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "currentdata%d", currentdata);
                 uapi_set_screen_on_api(); // 亮屏检测
-                custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO);
+                if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+                {
+                    custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO);
+                }
                 TraingCardView::GetInstance()->SetPopupViewStatus(GetTagPopup, true);
                 TraingCardView::GetInstance()->GetAnimator()->Start();
                 Gettagstuats = true;
index 1f8eca0..90b0d60 100644 (file)
@@ -701,7 +701,10 @@ void MsgCenterNotifySleepProc(const Topic topic, Request* req)
     if(SleepModel::GetInstance().get_sleep_state()==SLEEPSTATE::WAKE)
     {
         NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
-        AlarmClockModel::GetInstance()->PopInterPlayMusic();
+        if(true != ConfigModel::GetInstance()->GetDnotdisturb())
+        {
+            AlarmClockModel::GetInstance()->PopInterPlayMusic();
+        }
     }
     else
     {
@@ -731,7 +734,10 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
          }  
         display_api->set_screen_set_keepon_timeout(10);
         
-        AlarmClockModel::GetInstance()->AlarmPlayerStart();
+        if(true != ConfigModel::GetInstance()->GetDnotdisturb())
+        {
+            AlarmClockModel::GetInstance()->AlarmPlayerStart();
+        }
         
         CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
         CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
index b07167d..5ce3ae9 100644 (file)
@@ -89,7 +89,10 @@ namespace OHOS
     {
         /*亮屏加震动*/
         uapi_set_screen_on_api();
-        uapi_vibrationModeSet(ConfigModel::GetInstance()->GetVibrationReminder());
+        if(true != ConfigModel::GetInstance()->GetDnotdisturb())
+        {
+            uapi_vibrationModeSet(ConfigModel::GetInstance()->GetVibrationReminder());
+        }
     }
 
     /*创建喝水提醒视图*/
index 868a62c..dafc878 100644 (file)
@@ -14,6 +14,7 @@
 #include "string"
 #include "vibrator_service.h"
 extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType);
+#include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h"
 
 namespace OHOS
 {
@@ -198,8 +199,12 @@ namespace OHOS
         MessageGroupView->Add(messageLabel);
         MessageGroupView->Add(deleteButton);
 
-        // 震动提醒
-        custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO);
+        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        {
+            // 震动提醒
+            custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO);
+        }
+        
         int32_t timeout = 2000; // 亮屏操作 2000ms 2秒关闭
         SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t));
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create MessageGroupView succeed!!");
index 4caa98e..adf5247 100644 (file)
@@ -146,7 +146,11 @@ namespace OHOS
         SleepGroupView->Add(sleepbutton);
 
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create SleepGroupView succeed!!");
-        custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+        
+        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        {
+            custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+        }
 
         int32_t timeout = 5000; // 亮屏操作 5000ms 5秒关闭
         SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t));
@@ -188,7 +192,10 @@ namespace OHOS
         SleepGroupView->Add(closebutton);
 
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create SleepGroupView succeed!!");
-        custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        {
+            custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+        }
     }
     /*释放消息弹窗视图*/
     void FreeSleepView(void)