Merge #977 into sdk602patch0626 from refs/changes/977/head 979/target/1
author罗正 <1732036298@qq.com>
Wed, 18 Sep 2024 02:52:42 +0000 (02:52 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Wed, 18 Sep 2024 02:52:42 +0000 (02:52 +0000)
Code review from 罗正

* refs/changes/977/head: (8 commits squashed)

  - #524,解决:录音删除,删除后不是返回到录音列表界面,返回的是录音界面bug
    #658,解决,手表,录音频繁点击会有蓝色效果

  - #656,解决,手表,闹钟偶现0000闹钟提醒bug

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - 4G界面添加“注:启用4G,可能会加速消耗电量”提醒

  -  运动识别界面添加提醒标签,#192,解决,运动识别界面单一bug

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - 根据禅道上期望:APP查找手表和闹钟,勿扰睡眠静音模式下都有响铃和震动提醒
    #421解决, 睡眠模式,闹钟无响铃震动bug

  - 解决静音模式错误开启后会全局静音bug,根据禅道期望“来电铃声、短信消息提醒,勿扰睡眠静音模式下只有亮屏提醒”

Signed-off-by: 罗正 <1732036298@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/977
21 files changed:
code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp
code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h
code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp
code/sdk/drivers/peripheral/config/src/ConfigModel.cpp
code/sdk/drivers/peripheral/utils/custom_utils.c
code/sdk/drivers/peripheral/utils/custom_utils.h

index 6bb071b..5361975 100644 (file)
@@ -124,6 +124,7 @@ public:
 \r
     void UpdateAlarmInfoByAppSet(void);\r
     void CancelAlarmRing();\r
+    void DelayAlarmRing();\r
 \r
 private:\r
     void SetAlarmId(uint8_t id);\r
index c0cb884..d3387cb 100644 (file)
@@ -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_;
index 7b8214e..8a3f4ff 100644 (file)
@@ -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;
         }
     }
 
index 58cb3e3..8e80dda 100644 (file)
@@ -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};
     };
 }
index 8d77801..6382323 100644 (file)
@@ -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();
     }
index 9fa161c..30db153 100644 (file)
@@ -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};
     };
 }
index 94530d1..9b2ac3a 100644 (file)
@@ -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();
     }
index 19fcf20..0f7ddf8 100644 (file)
@@ -228,7 +228,7 @@ namespace OHOS
         RECORD_GOING_BUTTON->SetViewId(RECORD_GOING_BUTTON_VIEWID);\r
         RECORD_GOING_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36);\r
         RECORD_GOING_BUTTON->SetStyle(STYLE_BORDER_RADIUS, 20);\r
-        RECORD_GOING_BUTTON->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        RECORD_GOING_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffff5a36, UIButton::PRESSED);\r
         RECORD_GOING_BUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 20, UIButton::PRESSED);\r
         UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(RecordingPresenter::GetInstance());\r
         RECORD_GOING_BUTTON->SetOnClickListener(clickListener);\r
index 10d452c..6815da0 100644 (file)
@@ -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);
index fffd42e..09016c4 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-03-30 09:14:38\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-09-06 11:51:33\r
+ * @LastEditTime: 2024-09-13 19:51:27\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp\r
  */\r
 \r
@@ -270,7 +270,7 @@ namespace OHOS
             // uapi_delete_files(fileName.c_str());//删除录音文件\r
             p_RecordingModel->UpdateRecordingInfo();\r
 \r
-            p_RecordingView->ChangeView(RECORDINGDELETEVIEW, RECORDINGVIEW);\r
+            p_RecordingView->ChangeView(RECORDINGDELETEVIEW, RECORDINGLISTVIEW);\r
             return true;\r
         }\r
         else if (strcmp(view.GetViewId(), RECORD_DELETE_OFF_BUTTON_VIEWID) == 0)\r
@@ -383,6 +383,13 @@ namespace OHOS
             return false;\r
         }\r
         p_RecordingView->ChangeView(RECORDINGLISTVIEW, RECORDINGPLAYERVIEW); // 切换到录音播放界面\r
+        RecordingPlayerView *p_RecordingPlayerView = RecordingPlayerView::GetInstance();\r
+        if (p_RecordingPlayerView == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPlayerView GetInstance fail");\r
+            return false;\r
+        }\r
+        p_RecordingPlayerView->ResetComponentStatus();\r
         /* ------------------------ 播放录音 ------------------------ */\r
         if (p_RecordingModel->RecordingListOnClickPlay() != OHOS_SUCCESS)\r
         {\r
index ecb05a3..18042a4 100644 (file)
@@ -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
 }
index 159ab12..29bcc4f 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-02-19 10:39:11\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-07-16 17:04:06\r
+ * @LastEditTime: 2024-09-14 18:28:58\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp\r
  */\r
 \r
@@ -152,12 +152,10 @@ namespace OHOS
         {\r
         case UICheckBox::SELECTED:\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SilentMode is enable!");\r
-            SilentModelSet(true);\r
             p_SoundAndVibrationModel->SetSilentModeToggleButtonStatus(true);\r
             break;\r
         case UICheckBox::UNSELECTED:\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SilentMode is disable!");\r
-            SilentModelSet(false);\r
             p_SoundAndVibrationModel->SetSilentModeToggleButtonStatus(false);\r
             break;\r
         default:\r
index 8b6e661..eda49f1 100644 (file)
@@ -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
 }
index d62fd87..965b740 100644 (file)
@@ -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
index 7fe7435..48a98bd 100755 (executable)
@@ -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;
index aa954be..0e4f511 100644 (file)
@@ -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<uint16_t>(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;
index db4838d..4b81510 100755 (executable)
@@ -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
index 439d3a3..3db3e3a 100644 (file)
@@ -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(
index f1eeac9..34dd6ab 100644 (file)
@@ -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)
index 697101f..7566845 100644 (file)
@@ -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);
index 7be63e2..7cf7933 100644 (file)
@@ -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);