优化查找手表的播放音频逻辑
authorluozheng <1732036298@qq.com>
Tue, 22 Oct 2024 06:38:29 +0000 (14:38 +0800)
committerluozheng <1732036298@qq.com>
Tue, 22 Oct 2024 06:38:29 +0000 (14:38 +0800)
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp

index 3a58e67..e9add81 100644 (file)
@@ -1254,7 +1254,7 @@ void MsgCenterNotifyCanCelFindWatchProc(const Topic topic, Request* req)
     unused(topic);
     unused(req);
     WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyCanCelFindWatchProc !");
-    FindWatchViewEventListener::GetInstance().PopInterCancelMusic();
+    // FindWatchViewEventListener::GetInstance().PopInterCancelMusic();
     if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) {
         NotificationManager::GetInstance()->StopNotify();
     }
index 0f6e128..a6481f7 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-10-18 18:02:00
+ * @LastEditTime: 2024-10-22 10:23:38
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp
  * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。
  * 以下是基本的实现步骤:
@@ -69,7 +69,7 @@ namespace OHOS
 #ifdef SUPPORT_BLE_SERVICE
             setFindWatchFlag(2); // 表示已找到手表
 #endif
-            FindWatchRingPlayStop();
+            // FindWatchRingPlayStop();
             NotificationManager::GetInstance()->StopNotify();
             SetFindWatchNotifyFlag(false);
             // ResumeScreenBrightness();
@@ -96,7 +96,7 @@ namespace OHOS
 #ifdef SUPPORT_BLE_SERVICE
             setFindWatchFlag(2); // 表示已找到手表
 #endif
-            FindWatchRingPlayStop();
+            // FindWatchRingPlayStop();
             NotificationManager::GetInstance()->StopNotify();
             SetFindWatchNotifyFlag(false);
             // ResumeScreenBrightness();
@@ -292,6 +292,7 @@ namespace OHOS
      */
     int FindWatchViewEventListener::FindWatchRingPlayStart(const char *path)
     {
+        FindWatchRingPlayStop(); // 如果playerCtr上音频资源没被释放,先释放
         FindWatchRingPlayerInit(((path == nullptr) ? RingMusicName : path));
         FindWatchRingPlayerStat();
         return OHOS_SUCCESS;
@@ -476,6 +477,7 @@ namespace OHOS
             FindWatchGroupView = nullptr;
         }
 
+        FindWatchViewEventListener::GetInstance().FindWatchRingPlayStop();
         FindWatchViewEventListener::GetInstance().ResumeScreenBrightness();
         FindWatchViewEventListener::GetInstance().FindWatch_StopTimer();
     }