修复睡眠闹钟后面响铃时间越来越少的bug
authorCaisking <3449750381@qq.com>
Sat, 17 Aug 2024 10:23:26 +0000 (18:23 +0800)
committerCaisking <3449750381@qq.com>
Sat, 17 Aug 2024 10:23:26 +0000 (18:23 +0800)
code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp

index 10c4f28..b708ae7 100644 (file)
@@ -44,6 +44,7 @@ namespace OHOS
 #define CLOSEBUTTON "close_button"
 #define NOPBUTTON "nop_button"
 
+    static int countsleep = 0;
     /* -------------------------------------------------------------------------- */
 
     /*创建睡眠弹窗*/
@@ -250,6 +251,7 @@ namespace OHOS
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Free SleepView succeed!!");
             ScreenTurnOff();
         }
+        countsleep = 0; // 重置
         return;
     }
 
@@ -545,7 +547,6 @@ namespace OHOS
     void SleepRingPlayerCallbackImpl::OnPlaybackComplete(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnPlaybackComplete");
-        static int countsleep = 0;
         SleepViewEventListener::GetInstance().PopInterCancelMusic();
         /*达到最大次数不再播放*/
         if (countsleep <= MAX_SLEEP_RING)