Просмотр исходного кода

修复播控中心播放下一首的时候,多个地方同时更新状态导致的闪跳

chendeben 1 год назад
Родитель
Сommit
2b7a06c167

+ 57 - 58
entry/src/main/ets/common/service/DataPersistenceService.ets

@@ -1,7 +1,6 @@
 import { VideoItem } from '../../viewmodel/VideoItem';
 import { PlayerState, PlayMode } from './PlayerStateModel';
 import { PreferencesUtil } from '@pura/harmony-utils';
-import { LogUtils } from '@ohos/ijkplayer';
 import { common } from '@kit.AbilityKit';
 
 /**
@@ -114,7 +113,7 @@ export class DataPersistenceService implements IDataPersistenceService {
   private static readonly COMPLETION_THRESHOLD = 5000;
 
   private constructor() {
-    LogUtils.getInstance().LOGI('DataPersistenceService: Instance created');
+    
   }
 
   public static getInstance(): DataPersistenceService {
@@ -127,7 +126,7 @@ export class DataPersistenceService implements IDataPersistenceService {
   async initialize(context: common.UIAbilityContext): Promise<void> {
     if (this.isInitialized && this.context) {
       console.log('Heanup2 DataPersistenceService: Already initialized with valid context');
-      LogUtils.getInstance().LOGI('DataPersistenceService: Already initialized');
+      
       return;
     }
 
@@ -142,10 +141,10 @@ export class DataPersistenceService implements IDataPersistenceService {
       this.isInitialized = true;
 
       console.log('Heanup2 DataPersistenceService: Initialize successfully with context');
-      LogUtils.getInstance().LOGI('DataPersistenceService: Initialized successfully');
+      
     } catch (error) {
       console.log(`Heanup2 DataPersistenceService: Initialize error: ${error}`);
-      LogUtils.getInstance().LOGI(`DataPersistenceService initialization error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -166,10 +165,10 @@ export class DataPersistenceService implements IDataPersistenceService {
       this.isInitialized = true;
 
       console.log('Heanup2 DataPersistenceService: Reinitialize successfully');
-      LogUtils.getInstance().LOGI('DataPersistenceService: Reinitialized successfully');
+      
     } catch (error) {
       console.log(`Heanup2 DataPersistenceService: Reinitialize error: ${error}`);
-      LogUtils.getInstance().LOGI(`DataPersistenceService reinitialize error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -216,7 +215,7 @@ export class DataPersistenceService implements IDataPersistenceService {
           PreferencesUtil.putSync(key, JSON.stringify(progressData));
         } catch (error) {
           console.log(`Heanup2 DataPersistenceService: 保存播放进度到PreferencesUtil失败: ${error}`);
-          LogUtils.getInstance().LOGI(`DataPersistenceService: Failed to save progress to PreferencesUtil: ${error}`);
+          
           // 即使PreferencesUtil失败,AppStorage已保存,不抛出异常
         }
       }
@@ -226,9 +225,9 @@ export class DataPersistenceService implements IDataPersistenceService {
         await this.addToCompletedSongs(songId);
       }
 
-      LogUtils.getInstance().LOGI(`DataPersistenceService: Saved progress for ${songId}: ${position}ms (completed: ${isCompleted})`);
+      
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService savePlaybackProgress error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -264,7 +263,7 @@ export class DataPersistenceService implements IDataPersistenceService {
                 AppStorage.setOrCreate(key, progressData);
                 break; // 成功,跳出循环
               } catch (parseError) {
-                LogUtils.getInstance().LOGI(`DataPersistenceService: Failed to parse progress data for ${songId}: ${parseError}`);
+                
                 return null;
               }
             } else {
@@ -285,13 +284,13 @@ export class DataPersistenceService implements IDataPersistenceService {
       }
 
       if (progressData) {
-        LogUtils.getInstance().LOGI(`DataPersistenceService: Loaded progress for ${songId}: ${progressData.position}ms`);
+        
         return progressData;
       }
 
       return null;
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService loadPlaybackProgress error: ${error}`);
+      
       return null;
     }
   }
@@ -314,9 +313,9 @@ export class DataPersistenceService implements IDataPersistenceService {
       // 从AppStorage删除
       AppStorage.delete(key);
 
-      LogUtils.getInstance().LOGI(`DataPersistenceService: Cleared progress for ${songId}`);
+      
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService clearPlaybackProgress error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -342,9 +341,9 @@ export class DataPersistenceService implements IDataPersistenceService {
        PreferencesUtil.deleteSync(DataPersistenceService.KEYS.COMPLETED_SONGS);
       AppStorage.delete(DataPersistenceService.KEYS.COMPLETED_SONGS);
 
-      LogUtils.getInstance().LOGI(`DataPersistenceService: Cleared ${completedSongs.length} completed progress records`);
+      
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService clearCompletedProgress error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -361,7 +360,7 @@ export class DataPersistenceService implements IDataPersistenceService {
         AppStorage.setOrCreate(DataPersistenceService.KEYS.COMPLETED_SONGS, completedSongs);
       }
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService addToCompletedSongs error: ${error}`);
+      
     }
   }
 
@@ -381,14 +380,14 @@ export class DataPersistenceService implements IDataPersistenceService {
           completedSongs = parsedData;
           AppStorage.setOrCreate(DataPersistenceService.KEYS.COMPLETED_SONGS, completedSongs);
         } catch (parseError) {
-          LogUtils.getInstance().LOGI(`DataPersistenceService: Failed to parse completed songs: ${parseError}`);
+          
           completedSongs = [];
         }
       }
 
       return completedSongs || [];
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService getCompletedSongs error: ${error}`);
+      
       return [];
     }
   }
@@ -444,16 +443,16 @@ export class DataPersistenceService implements IDataPersistenceService {
 
         if (retryCount >= maxRetries && lastError) {
           console.log(`Heanup2 DataPersistenceService: PreferencesUtil保存所有重试都失败,但AppStorage已保存`);
-          LogUtils.getInstance().LOGI(`DataPersistenceService: Failed to save to PreferencesUtil after retries, but saved to AppStorage`);
+          
         }
       } else {
         console.log('Heanup2 DataPersistenceService: context无效,仅保存到AppStorage');
       }
 
-      LogUtils.getInstance().LOGI(`DataPersistenceService: Saved playlist with ${playlist.length} songs, index ${currentIndex}, mode ${playMode}`);
+      
     } catch (error) {
       console.log(`Heanup2 DataPersistenceService: 保存播放列表出错: ${error}`);
-      LogUtils.getInstance().LOGI(`DataPersistenceService savePlaylist error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -503,7 +502,7 @@ export class DataPersistenceService implements IDataPersistenceService {
                 break; // 成功,跳出循环
               } catch (parseError) {
                 console.log(`Heanup2 DataPersistenceService: JSON解析失败: ${parseError}`);
-                LogUtils.getInstance().LOGI(`DataPersistenceService: Failed to parse playlist data: ${parseError}`);
+                
                 return null;
               }
             } else {
@@ -536,7 +535,7 @@ export class DataPersistenceService implements IDataPersistenceService {
 
       if (playlistData) {
         console.log(`Heanup2 DataPersistenceService: 最终加载成功,播放列表歌曲数量: ${playlistData.songs.length}`);
-        LogUtils.getInstance().LOGI(`DataPersistenceService: Loaded playlist with ${playlistData.songs.length} songs`);
+        
         return playlistData;
       }
 
@@ -544,7 +543,7 @@ export class DataPersistenceService implements IDataPersistenceService {
       return null;
     } catch (error) {
       console.log(`Heanup2 DataPersistenceService: 加载播放列表出错: ${error}`);
-      LogUtils.getInstance().LOGI(`DataPersistenceService loadPlaylist error: ${error}`);
+      
       return null;
     }
   }
@@ -604,16 +603,16 @@ export class DataPersistenceService implements IDataPersistenceService {
 
         if (retryCount >= maxRetries && lastError) {
           console.log(`Heanup2 DataPersistenceService: 播放状态PreferencesUtil保存所有重试都失败,但AppStorage已保存`);
-          LogUtils.getInstance().LOGI(`DataPersistenceService: Failed to save player state to PreferencesUtil after retries, but saved to AppStorage`);
+          
         }
       } else {
         console.log('Heanup2 DataPersistenceService: context无效,播放状态仅保存到AppStorage');
       }
 
-      LogUtils.getInstance().LOGI(`DataPersistenceService: Saved player state - playing: ${state.isPlaying}, paused: ${state.isPaused}, index: ${state.currentIndex}`);
+      
     } catch (error) {
       console.log(`Heanup2 DataPersistenceService: 保存播放状态出错: ${error}`);
-      LogUtils.getInstance().LOGI(`DataPersistenceService savePlayerState error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -663,7 +662,7 @@ export class DataPersistenceService implements IDataPersistenceService {
                 break; // 成功,跳出循环
               } catch (parseError) {
                 console.log(`Heanup2 DataPersistenceService: 播放状态JSON解析失败: ${parseError}`);
-                LogUtils.getInstance().LOGI(`DataPersistenceService: Failed to parse state data: ${parseError}`);
+                
                 return null;
               }
             } else {
@@ -696,7 +695,7 @@ export class DataPersistenceService implements IDataPersistenceService {
 
       if (stateData) {
         console.log(`Heanup2 DataPersistenceService: 最终播放状态加载成功 - playing: ${stateData.isPlaying}, paused: ${stateData.isPaused}, index: ${stateData.currentIndex}`);
-        LogUtils.getInstance().LOGI(`DataPersistenceService: Loaded player state - playing: ${stateData.isPlaying}, paused: ${stateData.isPaused}, index: ${stateData.currentIndex}`);
+        
         return stateData;
       }
 
@@ -704,7 +703,7 @@ export class DataPersistenceService implements IDataPersistenceService {
       return null;
     } catch (error) {
       console.log(`Heanup2 DataPersistenceService: 加载播放状态出错: ${error}`);
-      LogUtils.getInstance().LOGI(`DataPersistenceService loadPlayerState error: ${error}`);
+      
       return null;
     }
   }
@@ -731,9 +730,9 @@ export class DataPersistenceService implements IDataPersistenceService {
       // 清除所有播放进度
       await this.clearCompletedProgress();
 
-      LogUtils.getInstance().LOGI('DataPersistenceService: All data cleared');
+      
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService clearAllData error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -760,9 +759,9 @@ export class DataPersistenceService implements IDataPersistenceService {
         AppStorage.setOrCreate(DataPersistenceService.KEYS.PLAYER_STATE, stateData);
       }
 
-      LogUtils.getInstance().LOGI('DataPersistenceService: Data synchronized');
+      
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService syncData error: ${error}`);
+      
     }
   }
 
@@ -785,7 +784,7 @@ export class DataPersistenceService implements IDataPersistenceService {
       };
       return stats;
     } catch (error) {
-      LogUtils.getInstance().LOGI(`DataPersistenceService getDataStats error: ${error}`);
+      
       const errorStats: DataStats = {
         playlistSize: 0,
         progressRecords: 0,
@@ -814,7 +813,7 @@ export class PlaylistSyncService {
 
   private constructor() {
     this.dataPersistence = DataPersistenceService.getInstance();
-    LogUtils.getInstance().LOGI('PlaylistSyncService: Instance created');
+    
   }
 
   public static getInstance(): PlaylistSyncService {
@@ -835,9 +834,9 @@ export class PlaylistSyncService {
         this.startAutoSync();
       }
 
-      LogUtils.getInstance().LOGI('PlaylistSyncService: Initialized successfully');
+      
     } catch (error) {
-      LogUtils.getInstance().LOGI(`PlaylistSyncService initialization error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -857,9 +856,9 @@ export class PlaylistSyncService {
       // 通知监听器
       this.notifyPlaylistSynced(playlist, currentIndex, playMode);
 
-      LogUtils.getInstance().LOGI(`PlaylistSyncService: Synced playlist with ${playlist.length} songs to storage`);
+      
     } catch (error) {
-      LogUtils.getInstance().LOGI(`PlaylistSyncService syncPlaylistToStorage error: ${error}`);
+      
       throw new Error;
     }
   }
@@ -874,12 +873,12 @@ export class PlaylistSyncService {
       if (playlistData) {
         // 通知监听器
         this.notifyPlaylistLoaded(playlistData);
-        LogUtils.getInstance().LOGI(`PlaylistSyncService: Synced playlist with ${playlistData.songs.length} songs from storage`);
+        
       }
 
       return playlistData;
     } catch (error) {
-      LogUtils.getInstance().LOGI(`PlaylistSyncService syncPlaylistFromStorage error: ${error}`);
+      
       return null;
     }
   }
@@ -908,12 +907,12 @@ export class PlaylistSyncService {
 
       if (storedData.timestamp > localTimestamp) {
         // 存储的数据更新,使用存储的数据
-        LogUtils.getInstance().LOGI('PlaylistSyncService: Using stored playlist (newer)');
+        
         return storedData;
       } else {
         // 本地数据更新,同步到存储
         await this.syncPlaylistToStorage(localPlaylist, localIndex, localPlayMode);
-        LogUtils.getInstance().LOGI('PlaylistSyncService: Using local playlist (newer)');
+        
         return {
           songs: localPlaylist,
           currentIndex: localIndex,
@@ -922,7 +921,7 @@ export class PlaylistSyncService {
         };
       }
     } catch (error) {
-      LogUtils.getInstance().LOGI(`PlaylistSyncService bidirectionalSync error: ${error}`);
+      
       // 出错时返回本地数据
       return {
         songs: localPlaylist,
@@ -945,11 +944,11 @@ export class PlaylistSyncService {
       try {
         await this.performAutoSync();
       } catch (error) {
-        LogUtils.getInstance().LOGI(`PlaylistSyncService auto sync error: ${error}`);
+        
       }
     }, PlaylistSyncService.SYNC_INTERVAL);
 
-    LogUtils.getInstance().LOGI('PlaylistSyncService: Auto sync started');
+    
   }
 
   /**
@@ -959,7 +958,7 @@ export class PlaylistSyncService {
     if (this.syncTimer !== -1) {
       clearInterval(this.syncTimer);
       this.syncTimer = -1;
-      LogUtils.getInstance().LOGI('PlaylistSyncService: Auto sync stopped');
+      
     }
   }
 
@@ -974,7 +973,7 @@ export class PlaylistSyncService {
       // 通知监听器执行同步检查
       this.notifyAutoSyncPerformed();
     } catch (error) {
-      LogUtils.getInstance().LOGI(`PlaylistSyncService performAutoSync error: ${error}`);
+      
     }
   }
 
@@ -990,7 +989,7 @@ export class PlaylistSyncService {
       this.stopAutoSync();
     }
 
-    LogUtils.getInstance().LOGI(`PlaylistSyncService: Auto sync ${enabled ? 'enabled' : 'disabled'}`);
+    
   }
 
   /**
@@ -998,7 +997,7 @@ export class PlaylistSyncService {
    */
   addSyncListener(listener: PlaylistSyncListener): void {
     this.syncListeners.add(listener);
-    LogUtils.getInstance().LOGI('PlaylistSyncService: Sync listener added');
+    
   }
 
   /**
@@ -1006,7 +1005,7 @@ export class PlaylistSyncService {
    */
   removeSyncListener(listener: PlaylistSyncListener): void {
     this.syncListeners.delete(listener);
-    LogUtils.getInstance().LOGI('PlaylistSyncService: Sync listener removed');
+    
   }
 
   /**
@@ -1017,7 +1016,7 @@ export class PlaylistSyncService {
       try {
         listener.onPlaylistSynced?.(playlist, currentIndex, playMode);
       } catch (error) {
-        LogUtils.getInstance().LOGI(`PlaylistSyncService: Error notifying playlist synced: ${error}`);
+        
       }
     });
   }
@@ -1030,7 +1029,7 @@ export class PlaylistSyncService {
       try {
         listener.onPlaylistLoaded?.(playlistData);
       } catch (error) {
-        LogUtils.getInstance().LOGI(`PlaylistSyncService: Error notifying playlist loaded: ${error}`);
+        
       }
     });
   }
@@ -1043,7 +1042,7 @@ export class PlaylistSyncService {
       try {
         listener.onAutoSyncPerformed?.();
       } catch (error) {
-        LogUtils.getInstance().LOGI(`PlaylistSyncService: Error notifying auto sync: ${error}`);
+        
       }
     });
   }
@@ -1066,7 +1065,7 @@ export class PlaylistSyncService {
   release(): void {
     this.stopAutoSync();
     this.syncListeners.clear();
-    LogUtils.getInstance().LOGI('PlaylistSyncService: Resources released');
+    
   }
 }
 

+ 23 - 11
entry/src/main/ets/common/service/PlayerManager.ets

@@ -8,7 +8,6 @@ import {
   OnErrorListener
 } from '@ohos/ijkplayer';
 import { common } from '@kit.AbilityKit';
-import { PreferencesUtil } from '@pura/harmony-utils';
 
 /**
  * 播放器状态回调接口
@@ -44,6 +43,7 @@ export interface IPlayerManager {
   
   // 状态查询
   isPausedState(): boolean;
+  clearPausedState(): void;
   
   // 清理资源
   release(): void;
@@ -56,7 +56,6 @@ export interface IPlayerManager {
 export class PlayerManager implements IPlayerManager {
   private static instance: PlayerManager | null = null;
   private mIjkMediaPlayer: IjkMediaPlayer;
-  private mContext: common.UIAbilityContext | null = null;
   private audioInterruptCallback: ((event: InterruptEvent) => void) | null = null;
   private stateCallback: PlayerStateCallback | null = null;
   private isPaused: boolean = false; // 跟踪暂停状态
@@ -73,15 +72,10 @@ export class PlayerManager implements IPlayerManager {
   }
 
   async initialize(context: common.UIAbilityContext): Promise<void> {
-    this.mContext = context;
-    
-    // 设置为音频模式 - 关键修复
+
     this.mIjkMediaPlayer.setAudioId('unifiedPlayer');
-    LogUtils.getInstance().LOGI('PlayerManager: Set audio mode with ID unifiedPlayer');
-    
     this.setupIjkPlayerOptions();
     this.setupPlayerCallbacks();
-    LogUtils.getInstance().LOGI('PlayerManager initialized');
   }
 
   getIjkPlayer(): IjkMediaPlayer | null {
@@ -275,10 +269,23 @@ export class PlayerManager implements IPlayerManager {
       LogUtils.getInstance().LOGI(`PlayerManager stopPlayback error: ${error}`);
     }
   } 
- async seekToPosition(position: string): Promise<void> {
+ async seekToPosition(value: string): Promise<void> {
+    //private seekTo(value: string) {
+   //     if (StrUtil.isNotEmpty(this.videoUrl) && this.videoUrl.toLowerCase().endsWith('.wma')) {
+   //       ToastUtil.showToast('wma格式不支持拖动快进。')
+   //       return
+   //     }
+   //
+   //     this.mIjkMediaPlayer.seekTo(value);
+   //     // this.startPlayOrResumePlay()
+   //     // 在这里恢复计时器状态
+   //     this.setProgress()
+   //     // this.startProgressTask();
+
+
     try {
-      this.mIjkMediaPlayer.seekTo(position);
-      LogUtils.getInstance().LOGI(`PlayerManager: Seeked to position ${position}`);
+      this.mIjkMediaPlayer.seekTo(value);
+      LogUtils.getInstance().LOGI(`PlayerManager: Seeked to position ${value}`);
     } catch (error) {
       LogUtils.getInstance().LOGI(`PlayerManager seekToPosition error: ${error}`);
       throw new Error(`Failed to seek to position: ${error}`);
@@ -328,6 +335,11 @@ export class PlayerManager implements IPlayerManager {
     }
   }
 
+  clearPausedState(): void {
+    LogUtils.getInstance().LOGI(`PlayerManager clearPausedState: clearing paused flag (was ${this.isPaused})`);
+    this.isPaused = false;
+  }
+
   release(): void {
     try {
       // 移除音频中断监听

+ 3 - 3
entry/src/main/ets/common/service/StateSyncService.ets

@@ -168,7 +168,7 @@ export class StateSyncService implements IStateSyncService {
 
     try {
       this.context = context;
-      
+
       // 注册状态请求事件监听器
       await this.registerStateRequestListener();
       
@@ -281,7 +281,7 @@ export class StateSyncService implements IStateSyncService {
         data: JSON.stringify(broadcastData)
       };
 
-      await commonEventManager.publish(PLAYER_SONG_CHANGED_EVENT, publishInfo, (err) => {
+      commonEventManager.publish(PLAYER_SONG_CHANGED_EVENT, publishInfo, (err) => {
         if (err) {
           hilog.error(0x0000, TAG, `Failed to broadcast song change: ${err}`);
         } else {
@@ -430,7 +430,7 @@ export class StateSyncService implements IStateSyncService {
 
       const subscriber = await commonEventManager.createSubscriber(subscribeInfo);
       
-      await commonEventManager.subscribe(subscriber, (err, data: commonEventManager.CommonEventData) => {
+      commonEventManager.subscribe(subscriber, (err, data: commonEventManager.CommonEventData) => {
         if (!err) {
           hilog.info(0x0000, TAG, `Received widget control command: ${data.event}`);
           this.handleWidgetControlCommand(data);

Разница между файлами не показана из-за своего большого размера
+ 572 - 215
entry/src/main/ets/common/service/UnifiedPlayerService.ets


+ 163 - 50
entry/src/main/ets/entryability/EntryAbility.ets

@@ -393,61 +393,88 @@ export default class EntryAbility extends UIAbility {
 
 
     /**
-     * 注册卡片call事件监听器
+     * 注册卡片call事件监听器(增强版本:服务就绪检查)
      */
     private registerWidgetCallListeners(): void {
         try {
             // 监听播放/暂停事件
             this.callee.on('playPause', (data: rpc.MessageSequence) => {
-                hilog.info(0x0000, 'Heanup2', `Widget call: playPause received`);
-                const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
-                hilog.info(0x0000, 'Heanup2', `Widget playPause params: ${JSON.stringify(params)}`);
-                
-                // 发送播放/暂停事件到主应用
-                this.sendWidgetControlEvent('PLAY_PAUSE', params);
-                
-                return new MyParcelable(1, 'playPause_success');
+                try {
+                    const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
+                    hilog.info(0x0000, 'Heanup2', `🎵 Widget call: playPause received`);
+                    
+                    // 异步发送播放/暂停事件到主应用(包含服务就绪检查)
+                    this.sendWidgetControlEvent('PLAY_PAUSE', params).catch((error: Error) => {
+                        hilog.error(0x0000, 'Heanup2', `❌ playPause async error: ${error}`);
+                    });
+                    
+                    return new MyParcelable(1, 'playPause_success');
+                } catch (error) {
+                    hilog.error(0x0000, 'Heanup2', `❌ playPause handler error: ${error}`);
+                    return new MyParcelable(-1, 'playPause_error');
+                }
             });
 
             // 监听下一首事件
             this.callee.on('nextSong', (data: rpc.MessageSequence) => {
-                hilog.info(0x0000, 'Heanup2', `Widget call: nextSong received`);
-                const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
-                hilog.info(0x0000, 'Heanup2', `Widget nextSong params: ${JSON.stringify(params)}`);
-                
-                // 发送下一首事件到主应用
-                this.sendWidgetControlEvent('NEXT_SONG', params);
-                
-                return new MyParcelable(2, 'nextSong_success');
+                try {
+                    hilog.info(0x0000, 'Heanup2', `🎵 Widget call: nextSong received`);
+                    const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
+                    hilog.info(0x0000, 'Heanup2', `Widget nextSong params: ${JSON.stringify(params)}`);
+                    
+                    // 异步发送下一首事件到主应用(包含服务就绪检查)
+                    this.sendWidgetControlEvent('NEXT_SONG', params).catch((error: Error) => {
+                        hilog.error(0x0000, 'Heanup2', `❌ nextSong async error: ${error}`);
+                    });
+                    
+                    return new MyParcelable(2, 'nextSong_success');
+                } catch (error) {
+                    hilog.error(0x0000, 'Heanup2', `❌ nextSong handler error: ${error}`);
+                    return new MyParcelable(-2, 'nextSong_error');
+                }
             });
 
             // 监听上一首事件
             this.callee.on('prevSong', (data: rpc.MessageSequence) => {
-                hilog.info(0x0000, 'Heanup2', `Widget call: prevSong received`);
-                const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
-                hilog.info(0x0000, 'Heanup2', `Widget prevSong params: ${JSON.stringify(params)}`);
-                
-                // 发送上一首事件到主应用
-                this.sendWidgetControlEvent('PREV_SONG', params);
-                
-                return new MyParcelable(3, 'prevSong_success');
+                try {
+                    hilog.info(0x0000, 'Heanup2', `🎵 Widget call: prevSong received`);
+                    const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
+                    hilog.info(0x0000, 'Heanup2', `Widget prevSong params: ${JSON.stringify(params)}`);
+                    
+                    // 异步发送上一首事件到主应用(包含服务就绪检查)
+                    this.sendWidgetControlEvent('PREV_SONG', params).catch((error: Error) => {
+                        hilog.error(0x0000, 'Heanup2', `❌ prevSong async error: ${error}`);
+                    });
+                    
+                    return new MyParcelable(3, 'prevSong_success');
+                } catch (error) {
+                    hilog.error(0x0000, 'Heanup2', `❌ prevSong handler error: ${error}`);
+                    return new MyParcelable(-3, 'prevSong_error');
+                }
             });
 
             // 监听打开应用事件
             this.callee.on('openApp', (data: rpc.MessageSequence) => {
-                hilog.info(0x0000, 'Heanup2', `Widget call: openApp received`);
-                const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
-                hilog.info(0x0000, 'Heanup2', `Widget openApp params: ${JSON.stringify(params)}`);
-                
-                // 发送打开应用事件到主应用
-                this.sendWidgetControlEvent('OPEN_APP', params);
-                
-                return new MyParcelable(4, 'openApp_success');
+                try {
+                    hilog.info(0x0000, 'Heanup2', `🎵 Widget call: openApp received`);
+                    const params: Record<string, Object> = JSON.parse(data.readString()) as Record<string, Object>;
+                    hilog.info(0x0000, 'Heanup2', `Widget openApp params: ${JSON.stringify(params)}`);
+                    
+                    // 异步发送打开应用事件到主应用
+                    this.sendWidgetControlEvent('OPEN_APP', params).catch((error: Error) => {
+                        hilog.error(0x0000, 'Heanup2', `❌ openApp async error: ${error}`);
+                    });
+                    
+                    return new MyParcelable(4, 'openApp_success');
+                } catch (error) {
+                    hilog.error(0x0000, 'Heanup2', `❌ openApp handler error: ${error}`);
+                    return new MyParcelable(-4, 'openApp_error');
+                }
             });
 
-            hilog.info(0x0000, 'Heanup2', 'Widget call listeners registered successfully');
+            hilog.info(0x0000, 'Heanup2', '🎵 Widget call listeners registered successfully (Enhanced)');
         } catch (err) {
-            hilog.error(0x0000, 'Heanup2', `Failed to register widget call listeners: ${JSON.stringify(err as BusinessError)}`);
+            hilog.error(0x0000, 'Heanup2', `Failed to register widget call listeners: ${JSON.stringify(err as BusinessError)}`);
         }
     }
 
@@ -471,42 +498,75 @@ export default class EntryAbility extends UIAbility {
 
 
     /**
-     * 发送卡片控制事件到主应用
+     * 发送卡片控制事件到主应用(增强版本,确保服务已初始化)
      */
     private async sendWidgetControlEvent(command: string, params: Record<string, Object>): Promise<void> {
         try {
-            hilog.info(0x0000, 'Heanup2', `🎵 Processing widget control command: ${command}`);
+            hilog.info(0x0000, 'Heanup2', `🎵 收到桌面卡片指令: ${command}`);
             
             // 获取UnifiedPlayerService实例
             const unifiedService = UnifiedPlayerService.getInstance();
             
             // 确保服务已经初始化
             if (!unifiedService) {
-                hilog.error(0x0000, 'Heanup2', '❌ UnifiedPlayerService not available');
+                hilog.error(0x0000, 'Heanup2', '❌ UnifiedPlayerService 未初始化');
                 return;
             }
             
-            // 在处理卡片控制前,确保服务完全初始化
-            try {
-                await unifiedService.initialize(this.context);
-                hilog.info(0x0000, 'Heanup2', '🔄 UnifiedPlayerService re-initialized for widget command');
-            } catch (error) {
-                hilog.error(0x0000, 'Heanup2', `❌ Failed to re-initialize UnifiedPlayerService: ${error}`);
+            // 获取详细的服务就绪状态信息
+            const readinessInfo = unifiedService.getServiceReadinessInfo();
+            hilog.info(0x0000, 'Heanup2', `🔍 Service readiness: ${JSON.stringify(readinessInfo.details)}`);
+            
+            // 智能等待服务完全就绪(多级检查)
+            hilog.info(0x0000, 'Heanup2', '🔄 检查服务就绪状态...');
+            let ready = await this.waitForServiceReady(unifiedService);
+            
+            if (ready) {
+                hilog.info(0x0000, 'Heanup2', '✅ UnifiedPlayerService 已就绪');
+            } else {
+                hilog.warn(0x0000, 'Heanup2', '⚠️ UnifiedPlayerService 未完全就绪,尝试执行基础操作');
+                
+                // 检查是否至少可以进行基础操作
+                if (!unifiedService.isAllServicesReady()) {
+                    const finalReadinessInfo = unifiedService.getServiceReadinessInfo();
+                    hilog.error(0x0000, 'Heanup2', `❌ 基础服务未就绪,无法执行操作: ${JSON.stringify(finalReadinessInfo.details)}`);
+                    return;
+                }
             }
             
             // 检查初始化状态
             const currentState = unifiedService.getCurrentState();
-            hilog.info(0x0000, 'Heanup2', `🎵 Widget command - Service state: isPlaying=${currentState.isPlaying}, currentIndex=${currentState.currentIndex}`);
+            const playlist = unifiedService.getPlaylist();
+            hilog.info(0x0000, 'Heanup2', `🎵 Widget command - Service state: isPlaying=${currentState.isPlaying}, currentIndex=${currentState.currentIndex}, playlistSize=${playlist.length}`);
+            
+            // 对于播放控制操作,检查是否有可播放内容
+            if ((command === 'PLAY_PAUSE' || command === 'NEXT_SONG' || command === 'PREV_SONG') && playlist.length === 0) {
+                hilog.warn(0x0000, 'Heanup2', '⚠️ 播放列表为空,尝试等待数据恢复');
+                
+                // 当播放列表为空时,可能是数据还没恢复完成,等待一下
+                await new Promise<void>(resolve => setTimeout(resolve, 1000));
+                
+                // 重新检查播放列表
+                const updatedPlaylist = unifiedService.getPlaylist();
+                if (updatedPlaylist.length === 0) {
+                    hilog.warn(0x0000, 'Heanup2', '⚠️ 等待后播放列表仍为空,无法执行播放控制操作');
+                    return;
+                }
+                hilog.info(0x0000, 'Heanup2', `✅ 数据恢复完成,播放列表大小: ${updatedPlaylist.length}`);
+            }
             
             // 根据命令执行相应的播放控制
             switch (command) {
                 case 'PLAY_PAUSE':
-                    if (currentState.isPlaying) {
-                         unifiedService.pause();
-                        hilog.info(0x0000, 'Heanup2', '✅ Widget command: Paused playback');
+                    // 重新获取最新状态,因为可能在等待过程中发生了变化
+                    const latestState = unifiedService.getCurrentState();
+                    if (latestState.isPlaying) {
+                        await unifiedService.pause();
+                        hilog.info(0x0000, 'Heanup2', '✅ 卡片状态:暂停');
                     } else {
-                         unifiedService.startPlayOrResumePlay();
-                        hilog.info(0x0000, 'Heanup2', '✅ Widget command: Started/resumed playback');
+                        hilog.info(0x0000, 'Heanup2', '🔄 卡片请求:开始播放');
+                        await unifiedService.startPlayOrResumePlay();
+                        hilog.info(0x0000, 'Heanup2', '✅ 卡片状态:播放');
                     }
                     break;
                     
@@ -536,6 +596,59 @@ export default class EntryAbility extends UIAbility {
         }
     }
 
+    /**
+     * 智能等待服务就绪(增强版本)
+     */
+    private async waitForServiceReady(unifiedService: UnifiedPlayerService): Promise<boolean> {
+        try {
+            hilog.info(0x0000, 'Heanup2', '🔄 开始等待UnifiedPlayerService完全就绪');
+            
+            // 检查是否是刚启动的应用(数据还没恢复)
+            const currentPlaylist = unifiedService.getPlaylist();
+            const isJustStarted = currentPlaylist.length === 0;
+            
+            if (isJustStarted) {
+                hilog.info(0x0000, 'Heanup2', '🔄 检测到应用刚启动,给数据恢复更多时间');
+                // 给刚启动的应用更多时间来恢复数据
+                const isReady = await unifiedService.waitForAllServicesReady(8000, true);
+                
+                if (isReady) {
+                    hilog.info(0x0000, 'Heanup2', '✅ UnifiedPlayerService完全就绪(刚启动)');
+                    return true;
+                }
+            } else {
+                // 对于已经有数据的情况,使用正常的等待时间
+                const isReady = await unifiedService.waitForAllServicesReady(5000, true);
+                
+                if (isReady) {
+                    hilog.info(0x0000, 'Heanup2', '✅ UnifiedPlayerService完全就绪');
+                    return true;
+                }
+            }
+            
+            // 如果主要服务就绪但数据未恢复,再做一次宽松检查
+            hilog.info(0x0000, 'Heanup2', '⚠️ 主要检查超时,进行备用检查');
+            const basicReady = await unifiedService.waitForAllServicesReady(2000, false);
+            
+            if (basicReady) {
+                // 检查是否至少有播放数据
+                const currentState = unifiedService.getCurrentState();
+                const playlist = unifiedService.getPlaylist();
+                
+                if (playlist.length > 0 || currentState.currentIndex >= 0) {
+                    hilog.info(0x0000, 'Heanup2', `✅ 基础服务就绪,播放列表: ${playlist.length} 首歌曲`);
+                    return true;
+                }
+            }
+            
+            hilog.warn(0x0000, 'Heanup2', '⚠️ Service readiness check timeout, proceeding with limited functionality');
+            return false;
+        } catch (error) {
+            hilog.error(0x0000, 'Heanup2', `❌ Error waiting for service ready: ${error}`);
+            return false;
+        }
+    }
+
     /**
      * 异步初始化播放器服务,避免阻塞生命周期
      */

+ 247 - 334
entry/src/main/ets/entryformability/EntryFormAbility.ets

@@ -13,8 +13,7 @@ import { GlobalWidgetManager } from '../common/widget/GlobalWidgetManager';
 import { WidgetSizeAdapter, SizeChangeListener } from '../common/widget/WidgetSizeAdapter';
 import { PreferencesUtil } from '../common/utils/PreferencesUtil';
 
-const TAG = 'Heanup';
-
+const TAG = 'Heanup EntryFormAbility';
 
 
 /**
@@ -38,7 +37,8 @@ function copyWidgetData(target: ExtendedWidgetData, overrides: Partial<ExtendedW
     coverImage: overrides.coverImage !== undefined ? overrides.coverImage : target.coverImage,
     currentTime: overrides.currentTime !== undefined ? overrides.currentTime : target.currentTime,
     totalTime: overrides.totalTime !== undefined ? overrides.totalTime : target.totalTime,
-    progressPercentage: overrides.progressPercentage !== undefined ? overrides.progressPercentage : target.progressPercentage,
+    progressPercentage: overrides.progressPercentage !== undefined ? overrides.progressPercentage :
+    target.progressPercentage,
     hasNext: overrides.hasNext !== undefined ? overrides.hasNext : target.hasNext,
     hasPrevious: overrides.hasPrevious !== undefined ? overrides.hasPrevious : target.hasPrevious,
     showProgress: overrides.showProgress !== undefined ? overrides.showProgress : target.showProgress,
@@ -62,42 +62,223 @@ implements SizeChangeListener {
   private layoutManager: FormLayoutManager = FormLayoutManager.getInstance();
   private sizeAdapter: WidgetSizeAdapter = WidgetSizeAdapter.getInstance();
   private globalWidgetManager: GlobalWidgetManager = GlobalWidgetManager.getInstance();
-
   // 使用实例变量而不是静态变量,确保每个进程都能正确设置监听器
   private globalListenerSetup: boolean = false;
-
   // 防抖机制:避免短时间内重复更新
   private lastUpdateTime: number = 0;
-  private updateDebounceDelay: number = 100; // 100ms防抖延迟
+  private updateDebounceDelay: number = 100;
+  // 100ms防抖延迟
 
   // 进程启动时间,用于检测进程重启
   private processStartTime: number = Date.now();
-  private lastHealthCheck: number = 0;
-
   // 图片下载缓存
   private downloadingImages: Map<string, Promise<string | null>> = new Map();
-  private imageCache: Map<string, string> = new Map(); // url -> fileName映射
+  private imageCache: Map<string, string> = new Map();
+
+  // url -> fileName映射
+
+  /**
+   * 卡片创建时调用
+   */
+  onAddForm(want: Want): formBindingData.FormBindingData {
+
+
+    // 检查参数有效性
+    if (!want || !want.parameters) {
+      hilog.error(0x0000, TAG, 'FormAbility onAddForm want or want.parameters is undefined');
+      return formBindingData.createFormBindingData('');
+    }
+
+    // 初始化服务
+    try {
+
+      this.initializeServices();
+
+    } catch (error) {
+      hilog.error(0x0000, TAG, `Heanup EntryFormAbility failed to initialize services: ${error}`);
+    }
+
+    const formId = want.parameters?.['ohos.extra.param.key.form_identity'] as string;
+    const formName = want.parameters?.['ohos.extra.param.key.form_name'] as string;
+    const formDimension = want.parameters?.['ohos.extra.param.key.form_dimension'] as string;
+    const tempFlag = want.parameters?.['ohos.extra.param.key.form_temporary'] as boolean;
+
+
+    // 持久化保存 Form ID(异步执行,不阻塞返回)
+    this.saveFormIdToPersistence(formId).then(() => {
+
+    })
+
+    // 检测卡片尺寸并注册到全局管理器
+    const widgetSize = this.sizeAdapter.detectSizeFromWant(want);
+    try {
+      this.globalWidgetManager.registerWidget(formId, widgetSize);
+
+    } catch (error) {
+      hilog.error(0x0000, TAG, `Failed to register widget: ${error}`);
+    }
+
+
+    // 注册各种监听器
+    this.sizeAdapter.registerSizeChangeListener(formId, this);
+
+    // 初始化卡片数据
+    this.initializeWidget(formId, widgetSize);
+
+    // 验证监听器设置状态
+    setTimeout(() => {
+      const avSessionListener = AvSessionWidgetListener.getInstance();
+      const listenerCount = avSessionListener.getListenerCount();
+
+
+      if (listenerCount === 0) {
+        hilog.warn(0x0000, TAG, `⚠️ No listeners found! Form process may not receive data updates!`);
+      } else {
+
+      }
+    }, 2000);
+
+    // 获取当前播放状态而不是初始数据
+    this.playerControlService.getCurrentPlayState().then((currentState: WidgetData) => {
+      const adaptedData = this.layoutManager.adaptDataForSize(currentState, widgetSize);
+      const formData = formBindingData.createFormBindingData(adaptedData);
+      // 立即更新卡片以显示当前状态
+      formProvider.updateForm(formId, formData);
+
+    });
+
+    // 返回初始数据作为临时显示
+    const initialData = this.widgetDataManager?.getInitialWidgetData() || this.getDefaultWidgetData();
+    const adaptedData = this.layoutManager.adaptDataForSize(initialData, widgetSize);
+
+    return formBindingData.createFormBindingData(adaptedData);
+  }
+
+  /**
+   * 卡片更新时调用
+   */
+  onUpdateForm(formId: string): void {
+
+
+    // 确保服务已初始化
+    if (!this.globalListenerSetup) {
+
+      this.initializeServices();
+    }
+
+    // 确保widget已注册到GlobalWidgetManager
+    if (!this.globalWidgetManager.hasWidget(formId)) {
+
+      this.globalWidgetManager.registerWidget(formId, 'medium' as WidgetSize);
+    }
+
+    // 只更新指定的卡片,避免重复更新
+    this.updateWidgetData(formId);
+  }
+
+  /**
+   * 卡片删除时调用
+   */
+  onRemoveForm(formId: string): void {
+
+
+    // 从持久化存储中移除 Form ID(异步执行)
+    this.removeFormIdFromPersistence(formId).then(() => {
+
+    });
+
+
+    // 注销各种监听器
+    this.sizeAdapter.unregisterSizeChangeListener(formId);
+
+    // 从全局管理器中注销卡片
+    this.globalWidgetManager.unregisterWidget(formId);
+
+    // 清理卡片相关数据和配置
+    this.widgetDataManager?.removeWidgetData(formId);
+  }
+
+  /**
+   * 卡片可见性变化时调用
+   */
+  onVisibilityChange(newStatus: Record<string, number>): void {
+
+
+    const formIds = Object.keys(newStatus);
+    for (let i = 0; i < formIds.length; i++) {
+      const formId = formIds[i];
+      const isVisible = newStatus[formId] === 1;
+
+
+      if (isVisible) {
+        // 卡片变为可见时,更新数据
+        this.updateWidgetData(formId);
+      }
+    }
+  }
+
+
+  /**
+   * 卡片配置更新时调用
+   */
+  onConfigurationUpdate(newConfig: Object): void {
+
+
+    // 更新所有卡片以适应新配置
+    this.widgetDataManager?.updateAllWidgets();
+  }
+
+  /**
+   * 实现SizeChangeListener接口
+   * 处理卡片尺寸变化事件
+   */
+  onSizeChanged(formId: string, oldSize: WidgetSize, newSize: WidgetSize): void {
+
+
+    // 更新全局管理器中的尺寸记录
+    this.globalWidgetManager.updateWidgetSize(formId, newSize);
+
+    // 立即更新卡片数据以适应新尺寸
+    this.updateWidgetData(formId);
+  }
+
+  /**
+   * 处理卡片尺寸变化(系统调用)
+   * @param newStatus 新的尺寸状态
+   */
+  onAcquireFormState(want: Want): number {
+
+
+    const formId = want.parameters?.['ohos.extra.param.key.form_identity'] as string;
+
+    if (formId) {
+      // 检测新的尺寸
+      const newSize = this.sizeAdapter.detectSizeFromWant(want);
+      const oldSize = this.globalWidgetManager.getWidgetSize(formId);
+
+      if (oldSize && this.sizeAdapter.validateSizeChange(oldSize, newSize)) {
+        // 处理尺寸变化
+        this.handleFormSizeChange(formId, oldSize, newSize);
+      }
+    }
+
+    // 返回卡片状态 - 使用数字常量代替枚举
+    return 1; // READY状态
+  }
 
   /**
    * 初始化服务
    */
   private initializeServices(): void {
-    hilog.info(0x0000, TAG, 'Heanup EntryFormAbility initializeServices called');
 
     if (!this.widgetDataManager) {
       this.widgetDataManager = new WidgetDataManager();
-      hilog.info(0x0000, TAG, 'Heanup EntryFormAbility WidgetDataManager initialized');
     }
 
     // 设置全局状态监听器(每个进程实例设置一次)
-    hilog.info(0x0000, TAG, `Heanup EntryFormAbility checking global listener setup: ${this.globalListenerSetup}`);
     if (!this.globalListenerSetup) {
-      hilog.info(0x0000, TAG, 'Heanup EntryFormAbility setting up global listener...');
       this.setupGlobalStateListener();
       this.globalListenerSetup = true;
-      hilog.info(0x0000, TAG, 'Heanup EntryFormAbility global listener setup flag set to true');
-    } else {
-      hilog.info(0x0000, TAG, 'Heanup EntryFormAbility global listener already setup, skipping');
     }
   }
 
@@ -106,89 +287,29 @@ implements SizeChangeListener {
    */
   private setupGlobalStateListener(): void {
     try {
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] getting AvSessionWidgetListener instance...`);
       const avSessionListener = AvSessionWidgetListener.getInstance();
-      
-      // 检查当前监听器数量
-      const currentListenerCount = avSessionListener.getListenerCount();
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] current listener count before adding: ${currentListenerCount}`);
-      
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] adding state listener...`);
-      
       avSessionListener.addStateListener((data: WidgetData) => {
-        const now = Date.now();
-        hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] global listener received state update: isPlaying=${data.playState.isPlaying}, title=${data.currentSong.title}, age=${now - this.processStartTime}ms`);
-
-        // 更新健康检查时间
-        this.lastHealthCheck = now;
-
-        // 总是尝试更新,让updateAllWidgetsWithData自己检查
         this.updateAllWidgetsWithData(data);
       });
-      
-      // 验证监听器是否成功注册
-      const listenerCount = avSessionListener.getListenerCount();
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] listener registered successfully, total listeners: ${listenerCount}`);
-
-      // 启动健康检查定时器
-      this.startHealthCheck();
-
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] global state listener setup successfully`);
     } catch (error) {
-      hilog.error(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] failed to setup global listener: ${error}`);
+      hilog.error(0x0000, TAG,
+        `Heanup EntryFormAbility [Process:${this.processStartTime}] failed to setup global listener: ${error}`);
     }
   }
 
-  /**
-   * 启动健康检查,定期检测监听器是否还在工作
-   */
-  private startHealthCheck(): void {
-    setInterval(() => {
-      const now = Date.now();
-      const timeSinceLastUpdate = now - this.lastHealthCheck;
-
-      // 如果超过30秒没有收到任何状态更新,可能监听器失效了
-      if (timeSinceLastUpdate > 30000) {
-        hilog.warn(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] health check failed: ${timeSinceLastUpdate}ms since last update`);
-
-        // 尝试强制重连和重新请求当前状态
-        this.playerControlService.forceReconnect().then(() => {
-          return this.playerControlService.getCurrentPlayState();
-        }).then((currentState) => {
-          hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] health check recovery: got current state`);
-          this.updateAllWidgetsWithData(currentState);
-        }).catch(() => {
-          hilog.error(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] health check recovery failed:`);
-        });
-      } else {
-        hilog.info(0x0000, TAG, `Heanup EntryFormAbility [Process:${this.processStartTime}] health check OK: ${timeSinceLastUpdate}ms since last update`);
-      }
-    }, 15000); // 每15秒检查一次
-  }
-
   /**
    * 使用指定数据更新所有卡片
    */
   private updateAllWidgetsWithData(data: WidgetData): void {
-    hilog.info(0x0000, TAG, `Heanup EntryFormAbility updateAllWidgetsWithData called with isPlaying=${data.playState.isPlaying}, title=${data.currentSong.title}`);
-
     // 防抖机制:避免短时间内重复更新
     const now = Date.now();
     if (now - this.lastUpdateTime < this.updateDebounceDelay) {
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility update debounced, skipping (${now - this.lastUpdateTime}ms since last update)`);
       return;
     }
     this.lastUpdateTime = now;
 
     const activeWidgets = this.globalWidgetManager.getActiveWidgets();
-    hilog.info(0x0000, TAG, `Heanup EntryFormAbility active widgets count: ${activeWidgets.size}`);
 
-    // 打印所有活跃的widget ID
-    if (activeWidgets.size > 0) {
-      activeWidgets.forEach((size: WidgetSize, formId: string) => {
-        hilog.info(0x0000, TAG, `Heanup EntryFormAbility found active widget: ${formId}, size: ${size}`);
-      });
-    }
 
     if (activeWidgets.size === 0) {
       hilog.warn(0x0000, TAG, 'Heanup EntryFormAbility no widgets to update in this process, skipping');
@@ -196,11 +317,10 @@ implements SizeChangeListener {
     }
 
     activeWidgets.forEach((size: WidgetSize, formId: string) => {
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility updating widget: ${formId}`);
       this.updateSingleWidget(formId, size, data);
     });
 
-    hilog.info(0x0000, TAG, `Heanup EntryFormAbility batch update completed for ${activeWidgets.size} widgets`);
+
   }
 
   /**
@@ -233,7 +353,6 @@ implements SizeChangeListener {
         formImages: formattedData.formImages
       };
 
-      hilog.info(0x0000, TAG, `Heanup widget ${formId} calling formProvider.updateForm with isPlaying=${adaptedData.isPlaying}, hasNext=${adaptedData.hasNext}, hasPrevious=${adaptedData.hasPrevious}, coverImage=${adaptedData.coverImage || 'empty'}`);
 
       // 使用统一的图片处理方法
       this.updateWidgetWithImage(formId, adaptedData, retryCount);
@@ -255,7 +374,7 @@ implements SizeChangeListener {
   private updateWidgetDirectly(formId: string, adaptedData: ExtendedWidgetData, retryCount: number = 0): void {
     const formData = formBindingData.createFormBindingData(adaptedData);
     formProvider.updateForm(formId, formData).then(() => {
-      hilog.info(0x0000, TAG, `Heanup widget ${formId} updated successfully: isPlaying=${adaptedData.isPlaying}, title=${adaptedData.songTitle}, hasNext=${adaptedData.hasNext}, hasPrevious=${adaptedData.hasPrevious}`);
+
     }).catch(() => {
       hilog.error(0x0000, TAG, `Heanup widget ${formId} update failed, retry count: ${retryCount}`);
 
@@ -271,7 +390,8 @@ implements SizeChangeListener {
   /**
    * 统一处理图片更新
    */
-  private async updateWidgetWithImage(formId: string, adaptedData: ExtendedWidgetData, retryCount: number = 0): Promise<void> {
+  private async updateWidgetWithImage(formId: string, adaptedData: ExtendedWidgetData,
+    retryCount: number = 0): Promise<void> {
     try {
       if (!adaptedData.coverImage || adaptedData.coverImage.trim() === '') {
         // 没有封面图片,直接更新
@@ -279,7 +399,6 @@ implements SizeChangeListener {
         return;
       }
 
-      hilog.info(0x0000, TAG, `Heanup widget ${formId} processing image: ${adaptedData.coverImage}`);
 
       if (this.isNetworkUrl(adaptedData.coverImage)) {
         // 处理网络图片
@@ -289,7 +408,7 @@ implements SizeChangeListener {
         await this.updateWidgetWithLocalImage(formId, adaptedData, retryCount);
       } else {
         // 其他情况,可能是相对路径或其他格式,直接使用
-        hilog.info(0x0000, TAG, `Heanup widget ${formId} using image path as-is: ${adaptedData.coverImage}`);
+
         this.updateWidgetDirectly(formId, adaptedData, retryCount);
       }
     } catch (error) {
@@ -303,16 +422,17 @@ implements SizeChangeListener {
   /**
    * 处理本地文件URI图片
    */
-  private async updateWidgetWithLocalImage(formId: string, adaptedData: ExtendedWidgetData, retryCount: number = 0): Promise<void> {
+  private async updateWidgetWithLocalImage(formId: string, adaptedData: ExtendedWidgetData,
+    retryCount: number = 0): Promise<void> {
     try {
       const localFileUri: string = adaptedData.coverImage;
-      hilog.info(0x0000, TAG, `Heanup widget ${formId} processing local image: ${localFileUri}`);
+
 
       // 先用无图片的数据快速更新一次,确保界面响应性
-      const dataWithoutImage: ExtendedWidgetData = copyWidgetData(adaptedData, { 
+      const dataWithoutImage: ExtendedWidgetData = copyWidgetData(adaptedData, {
         coverImage: '',
         imgName: '',
-        formImages: undefined 
+        formImages: undefined
       });
       this.updateWidgetDirectly(formId, dataWithoutImage, 0);
 
@@ -328,15 +448,15 @@ implements SizeChangeListener {
 
           // 按照官方文档要求,imgName 必须与 formImages 中的 key 相同
           const dataWithImage: ExtendedWidgetData = copyWidgetData(adaptedData, {
-            coverImage: '',  // 清空原路径
-            imgName: fileName,  // 设置图片名称用于 memory:// 协议
+            coverImage: '', // 清空原路径
+            imgName: fileName, // 设置图片名称用于 memory:// 协议
             formImages: imageMap  // 必填字段,不可缺省
           });
 
           const formDataWithImage = formBindingData.createFormBindingData(dataWithImage);
           await formProvider.updateForm(formId, formDataWithImage);
 
-          hilog.info(0x0000, TAG, `Heanup widget ${formId} updated with local image: ${fileName}, fd: ${fileDescriptor}`);
+
         } catch (fdError) {
           hilog.error(0x0000, TAG, `Heanup widget ${formId} failed to get file descriptor: ${fdError}`);
           // 文件描述符获取失败,使用默认图片
@@ -351,10 +471,10 @@ implements SizeChangeListener {
       hilog.error(0x0000, TAG, `Heanup widget ${formId} local image update error: ${error}`);
 
       // 失败后回退到无图片模式
-      const dataWithoutImage: ExtendedWidgetData = copyWidgetData(adaptedData, { 
+      const dataWithoutImage: ExtendedWidgetData = copyWidgetData(adaptedData, {
         coverImage: '',
         imgName: '',
-        formImages: undefined 
+        formImages: undefined
       });
       this.updateWidgetDirectly(formId, dataWithoutImage, retryCount);
     }
@@ -363,10 +483,11 @@ implements SizeChangeListener {
   /**
    * 使用网络图片更新卡片
    */
-  private async updateWidgetWithNetworkImage(formId: string, adaptedData: ExtendedWidgetData, retryCount: number = 0): Promise<void> {
+  private async updateWidgetWithNetworkImage(formId: string, adaptedData: ExtendedWidgetData,
+    retryCount: number = 0): Promise<void> {
     try {
       const imageUrl: string = adaptedData.coverImage;
-      hilog.info(0x0000, TAG, `Heanup widget ${formId} downloading network image: ${imageUrl}`);
+
 
       // 先用无图片的数据快速更新一次
       const dataWithoutImage: ExtendedWidgetData = copyWidgetData(adaptedData, { coverImage: '' });
@@ -381,15 +502,15 @@ implements SizeChangeListener {
         imageMap[fileName] = await this.getImageFileDescriptor(fileName);
 
         const dataWithImage: ExtendedWidgetData = copyWidgetData(adaptedData, {
-          coverImage: '',  // 清空URL
-          imgName: fileName,  // 设置图片名称用于memory://协议
+          coverImage: '', // 清空URL
+          imgName: fileName, // 设置图片名称用于memory://协议
           formImages: imageMap
         });
 
         const formDataWithImage = formBindingData.createFormBindingData(dataWithImage);
         await formProvider.updateForm(formId, formDataWithImage);
 
-        hilog.info(0x0000, TAG, `Heanup widget ${formId} updated with network image: ${fileName}`);
+
       } else {
         hilog.warn(0x0000, TAG, `Heanup widget ${formId} failed to download image, using default`);
         // 图片下载失败,使用默认图片
@@ -423,13 +544,13 @@ implements SizeChangeListener {
    */
   private async processLocalImageFile(fileUri: string): Promise<string | null> {
     try {
-      hilog.info(0x0000, TAG, `Processing local image file: ${fileUri}`);
+
 
       // 检查缓存
       if (this.imageCache.has(fileUri)) {
         const fileName = this.imageCache.get(fileUri)!;
-        hilog.info(0x0000, TAG, `Using cached local image: ${fileName} for ${fileUri}`);
-        
+
+
         // 验证缓存文件是否仍然存在 - 使用 FormExtensionAbility 的 tempDir
         const formTempDir = this.context.getApplicationContext().tempDir;
         const tempFilePath = `${formTempDir}/${fileName}`;
@@ -444,7 +565,7 @@ implements SizeChangeListener {
 
       // 检查是否正在处理
       if (this.downloadingImages.has(fileUri)) {
-        hilog.info(0x0000, TAG, `Local image already processing, waiting: ${fileUri}`);
+
         const existingPromise = this.downloadingImages.get(fileUri);
         if (existingPromise) {
           return await existingPromise;
@@ -462,7 +583,7 @@ implements SizeChangeListener {
 
       if (fileName) {
         this.imageCache.set(fileUri, fileName);
-        hilog.info(0x0000, TAG, `Local image processed successfully: ${fileName}`);
+
       }
 
       return fileName;
@@ -478,11 +599,11 @@ implements SizeChangeListener {
    */
   private async performLocalImageCopy(fileUri: string): Promise<string | null> {
     try {
-      hilog.info(0x0000, TAG, `Copying local image file: ${fileUri}`);
+
 
       // 转换 file:// URI 为实际文件路径
       const realPath = fileUri.replace('file://', '');
-      
+
       // 检查源文件是否存在
       if (!fileIo.accessSync(realPath)) {
         hilog.error(0x0000, TAG, `Source image file does not exist: ${realPath}`);
@@ -492,17 +613,16 @@ implements SizeChangeListener {
       // 生成目标文件名(包含时间戳和随机数,确保每次都不同)
       const fileExtension = this.getFileExtension(realPath) || 'jpg';
       const fileName = `widget_local_${Date.now()}_${Math.random().toString(36).substr(2, 9)}.${fileExtension}`;
-      
+
       // 使用 FormExtensionAbility 的 tempDir(官方文档要求)
       const formTempDir = this.context.getApplicationContext().tempDir;
       const tempFilePath = `${formTempDir}/${fileName}`;
 
-      hilog.info(0x0000, TAG, `Using FormExtensionAbility tempDir: ${formTempDir}`);
 
       // 复制文件到临时目录
       fileIo.copyFileSync(realPath, tempFilePath);
 
-      hilog.info(0x0000, TAG, `Local image copied successfully: ${realPath} -> ${tempFilePath}`);
+
       return fileName;
 
     } catch (error) {
@@ -530,13 +650,13 @@ implements SizeChangeListener {
       // 检查缓存
       if (this.imageCache.has(imageUrl)) {
         const fileName = this.imageCache.get(imageUrl)!;
-        hilog.info(0x0000, TAG, `Using cached image: ${fileName} for ${imageUrl}`);
+
         return fileName;
       }
 
       // 检查是否正在下载
       if (this.downloadingImages.has(imageUrl)) {
-        hilog.info(0x0000, TAG, `Image already downloading, waiting: ${imageUrl}`);
+
         const existingPromise = this.downloadingImages.get(imageUrl);
         if (existingPromise) {
           return await existingPromise;
@@ -583,19 +703,18 @@ implements SizeChangeListener {
       if (response.responseCode === http.ResponseCode.OK && response.result) {
         // 生成文件名(确保每次都不同,符合官方文档要求)
         const fileName = `widget_cover_${Date.now()}_${Math.random().toString(36).substr(2, 9)}.jpg`;
-        
+
         // 使用 FormExtensionAbility 的 tempDir(官方文档要求)
         const formTempDir = this.context.getApplicationContext().tempDir;
         const filePath = `${formTempDir}/${fileName}`;
 
-        hilog.info(0x0000, TAG, `Using FormExtensionAbility tempDir for download: ${formTempDir}`);
 
         // 保存文件
         const file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
         await fileIo.write(file.fd, response.result as ArrayBuffer);
         fileIo.closeSync(file);
-        
-        hilog.info(0x0000, TAG, `Network image downloaded successfully: ${fileName}`);
+
+
         httpRequest.destroy();
         return fileName;
       } else {
@@ -617,13 +736,13 @@ implements SizeChangeListener {
       // 使用 FormExtensionAbility 的 tempDir(官方文档要求)
       const formTempDir = this.context.getApplicationContext().tempDir;
       const filePath = `${formTempDir}/${fileName}`;
-      
-      hilog.info(0x0000, TAG, `Opening file for descriptor: ${filePath}`);
+
+
       const file = fileIo.openSync(filePath, fileIo.OpenMode.READ_ONLY);
-      
+
       // 注意:文件描述符会被系统自动管理,不需要手动关闭
       // 系统会在卡片更新完成后自动关闭文件描述符
-      hilog.info(0x0000, TAG, `Got file descriptor for ${fileName}: ${file.fd}`);
+
       return file.fd;
     } catch (error) {
       hilog.error(0x0000, TAG, `Failed to get file descriptor for ${fileName}: ${error}`);
@@ -631,86 +750,6 @@ implements SizeChangeListener {
     }
   }
 
-  /**
-   * 卡片创建时调用
-   */
-  onAddForm(want: Want): formBindingData.FormBindingData {
-    hilog.info(0x0000, TAG, 'Heanup EntryFormAbility onAddForm called');
-    
-    // 检查参数有效性
-    if (!want || !want.parameters) {
-      hilog.error(0x0000, TAG, 'FormAbility onAddForm want or want.parameters is undefined');
-      return formBindingData.createFormBindingData('');
-    }
-    
-    // 初始化服务
-    try {
-      hilog.info(0x0000, TAG, 'Heanup EntryFormAbility initializing services...');
-      this.initializeServices();
-      hilog.info(0x0000, TAG, 'Heanup EntryFormAbility services initialized successfully');
-    } catch (error) {
-      hilog.error(0x0000, TAG, `Heanup EntryFormAbility failed to initialize services: ${error}`);
-    }
-
-    const formId = want.parameters?.['ohos.extra.param.key.form_identity'] as string;
-    const formName = want.parameters?.['ohos.extra.param.key.form_name'] as string;
-    const formDimension = want.parameters?.['ohos.extra.param.key.form_dimension'] as string;
-    const tempFlag = want.parameters?.['ohos.extra.param.key.form_temporary'] as boolean;
-
-    hilog.info(0x0000, TAG, `Form added: ${formId}, name: ${formName}, dimension: ${formDimension}, temp: ${tempFlag}`);
-
-    // 持久化保存 Form ID(异步执行,不阻塞返回)
-    this.saveFormIdToPersistence(formId).then(() => {
-      hilog.info(0x0000, TAG, `💾 Form ID persistence completed for: ${formId}`);
-    })
-
-    // 检测卡片尺寸并注册到全局管理器
-    const widgetSize = this.sizeAdapter.detectSizeFromWant(want);
-    try {
-      this.globalWidgetManager.registerWidget(formId, widgetSize);
-      hilog.info(0x0000, TAG, `Widget registered successfully: ${formId}, size: ${widgetSize}`);
-    } catch (error) {
-      hilog.error(0x0000, TAG, `Failed to register widget: ${error}`);
-    }
-
-
-    hilog.info(0x0000, TAG, `Detected widget size: ${widgetSize} for form: ${formId}`);
-
-    // 注册各种监听器
-    this.sizeAdapter.registerSizeChangeListener(formId, this);
-
-    // 初始化卡片数据
-    this.initializeWidget(formId, widgetSize);
-
-    // 验证监听器设置状态
-    setTimeout(() => {
-      const avSessionListener = AvSessionWidgetListener.getInstance();
-      const listenerCount = avSessionListener.getListenerCount();
-      hilog.info(0x0000, TAG, `📊 Form process listener status check: ${listenerCount} listeners registered in AvSessionWidgetListener`);
-      
-      if (listenerCount === 0) {
-        hilog.warn(0x0000, TAG, `⚠️ No listeners found! Form process may not receive data updates!`);
-      } else {
-        hilog.info(0x0000, TAG, `✅ Form process has ${listenerCount} listeners, should receive data updates`);
-      }
-    }, 2000);
-
-    // 获取当前播放状态而不是初始数据
-    this.playerControlService.getCurrentPlayState().then((currentState: WidgetData) => {
-      const adaptedData = this.layoutManager.adaptDataForSize(currentState, widgetSize);
-      const formData = formBindingData.createFormBindingData(adaptedData);
-      // 立即更新卡片以显示当前状态
-      formProvider.updateForm(formId, formData);
-      hilog.info(0x0000, TAG, `Widget ${formId} initialized with current state`);
-    });
-
-    // 返回初始数据作为临时显示
-    const initialData = this.widgetDataManager?.getInitialWidgetData() || this.getDefaultWidgetData();
-    const adaptedData = this.layoutManager.adaptDataForSize(initialData, widgetSize);
-
-    return formBindingData.createFormBindingData(adaptedData);
-  }
-
   /**
    * 获取默认卡片数据
    */
@@ -751,135 +790,12 @@ implements SizeChangeListener {
     };
   }
 
-  /**
-   * 卡片更新时调用
-   */
-  onUpdateForm(formId: string): void {
-    hilog.info(0x0000, TAG, `Heanup EntryFormAbility onUpdateForm called: ${formId}`);
-
-    // 确保服务已初始化
-    if (!this.globalListenerSetup) {
-      hilog.info(0x0000, TAG, 'Heanup EntryFormAbility services not initialized, initializing now...');
-      this.initializeServices();
-    }
-
-    // 确保widget已注册到GlobalWidgetManager
-    if (!this.globalWidgetManager.hasWidget(formId)) {
-      hilog.info(0x0000, TAG, `Heanup EntryFormAbility widget ${formId} not registered in onUpdateForm, registering as MEDIUM size`);
-      this.globalWidgetManager.registerWidget(formId, 'medium' as WidgetSize);
-    }
-
-    // 只更新指定的卡片,避免重复更新
-    this.updateWidgetData(formId);
-  }
-
-  /**
-   * 卡片删除时调用
-   */
-  onRemoveForm(formId: string): void {
-    hilog.info(0x0000, TAG, `onRemoveForm called: ${formId}`);
-
-    // 从持久化存储中移除 Form ID(异步执行)
-    this.removeFormIdFromPersistence(formId).then(() => {
-      hilog.info(0x0000, TAG, `🗑️ Form ID removal completed for: ${formId}`);
-    });
-
-
-    // 注销各种监听器
-    this.sizeAdapter.unregisterSizeChangeListener(formId);
-
-    // 从全局管理器中注销卡片
-    this.globalWidgetManager.unregisterWidget(formId);
-
-    // 清理卡片相关数据和配置
-    this.widgetDataManager?.removeWidgetData(formId);
-  }
-
-  /**
-   * 卡片可见性变化时调用
-   */
-  onVisibilityChange(newStatus: Record<string, number>): void {
-    hilog.info(0x0000, TAG, 'onVisibilityChange called');
-
-    const formIds = Object.keys(newStatus);
-    for (let i = 0; i < formIds.length; i++) {
-      const formId = formIds[i];
-      const isVisible = newStatus[formId] === 1;
-      hilog.info(0x0000, TAG, `Form ${formId} visibility: ${isVisible}`);
-
-      if (isVisible) {
-        // 卡片变为可见时,更新数据
-        this.updateWidgetData(formId);
-      }
-    }
-  }
-
-  /**
-   * 处理卡片事件(用户交互)
-   * 注意:由于改用call方式,此方法不再被调用,保留用于兼容性
-   */
-  onFormEvent(formId: string, message: string): void {
-    hilog.info(0x0000, TAG, `onFormEvent called but ignored (using call method): ${formId}`);
-    // 由于改用call方式,此方法不再处理事件
-  }
-
-  /**
-   * 卡片配置更新时调用
-   */
-  onConfigurationUpdate(newConfig: Object): void {
-    hilog.info(0x0000, TAG, 'onConfigurationUpdate called');
-
-    // 更新所有卡片以适应新配置
-    this.widgetDataManager?.updateAllWidgets();
-  }
-
-  /**
-   * 实现SizeChangeListener接口
-   * 处理卡片尺寸变化事件
-   */
-  onSizeChanged(formId: string, oldSize: WidgetSize, newSize: WidgetSize): void {
-    hilog.info(0x0000, TAG, `Size changed for form ${formId}: ${oldSize} -> ${newSize}`);
-
-    // 更新全局管理器中的尺寸记录
-    this.globalWidgetManager.updateWidgetSize(formId, newSize);
-
-    // 立即更新卡片数据以适应新尺寸
-    this.updateWidgetData(formId);
-  }
-
-  /**
-   * 处理卡片尺寸变化(系统调用)
-   * @param newStatus 新的尺寸状态
-   */
-  onAcquireFormState(want: Want): number {
-    hilog.info(0x0000, TAG, 'onAcquireFormState called');
-
-    const formId = want.parameters?.['ohos.extra.param.key.form_identity'] as string;
-
-    if (formId) {
-      // 检测新的尺寸
-      const newSize = this.sizeAdapter.detectSizeFromWant(want);
-      const oldSize = this.globalWidgetManager.getWidgetSize(formId);
-
-      if (oldSize && this.sizeAdapter.validateSizeChange(oldSize, newSize)) {
-        // 处理尺寸变化
-        this.handleFormSizeChange(formId, oldSize, newSize);
-      }
-    }
-
-    // 返回卡片状态 - 使用数字常量代替枚举
-    return 1; // READY状态
-  }
-
-
-
-
   /**
    * 初始化卡片
    */
   private async initializeWidget(formId: string, widgetSize: WidgetSize): Promise<void> {
     try {
-      hilog.info(0x0000, TAG, `Heanup widget initializing: ${formId} with size: ${widgetSize}`);
+
 
       // 获取当前播放状态
       const currentState = await this.playerControlService.getCurrentPlayState();
@@ -892,7 +808,7 @@ implements SizeChangeListener {
       // 立即更新一次卡片数据
       await this.updateWidgetData(formId);
 
-      hilog.info(0x0000, TAG, `Heanup widget ${formId} initialized successfully with size: ${widgetSize}`);
+
     } catch (error) {
       hilog.error(0x0000, TAG, `Failed to initialize widget ${formId}: ${error}`);
     }
@@ -913,20 +829,19 @@ implements SizeChangeListener {
       const formData = formBindingData.createFormBindingData(adaptedData);
       await formProvider.updateForm(formId, formData);
 
-      hilog.info(0x0000, TAG, `Heanup widget ${formId} updated successfully with size: ${currentSize}, isPlaying=${adaptedData.isPlaying}`);
+
     } catch (error) {
       hilog.error(0x0000, TAG, `Failed to update widget ${formId}: ${error}`);
     }
   }
 
 
-
   /**
    * 处理表单尺寸变化
    */
   private async handleFormSizeChange(formId: string, oldSize: WidgetSize, newSize: WidgetSize): Promise<void> {
     try {
-      hilog.info(0x0000, TAG, `Handling form size change: ${formId} from ${oldSize} to ${newSize}`);
+
 
       // 获取当前播放状态
       const currentState = await this.playerControlService.getCurrentPlayState();
@@ -937,25 +852,23 @@ implements SizeChangeListener {
       // 更新卡片数据
       await this.widgetDataManager?.updateWidget(formId, adaptedData);
 
-      hilog.info(0x0000, TAG, `Form size change handled successfully for: ${formId}`);
+
     } catch (error) {
       hilog.error(0x0000, TAG, `Failed to handle form size change: ${error}`);
     }
   }
 
 
-
-
   /**
    * 保存 Form ID 到持久化存储
    */
   private async saveFormIdToPersistence(formId: string): Promise<void> {
     try {
-      hilog.info(0x0000, TAG, `💾 Saving Form ID to persistence: ${formId}`);
+
       const preferencesUtil = PreferencesUtil.getInstance();
       const prefs = await preferencesUtil.getPreferences(this.context);
       await preferencesUtil.addFormId(prefs, formId);
-      hilog.info(0x0000, TAG, `✅ Form ID saved successfully: ${formId}`);
+
     } catch (error) {
       hilog.error(0x0000, TAG, `❌ Failed to save Form ID: ${error}`);
     }
@@ -966,11 +879,11 @@ implements SizeChangeListener {
    */
   private async removeFormIdFromPersistence(formId: string): Promise<void> {
     try {
-      hilog.info(0x0000, TAG, `🗑️ Removing Form ID from persistence: ${formId}`);
+
       const preferencesUtil = PreferencesUtil.getInstance();
       const prefs = await preferencesUtil.getPreferences(this.context);
       await preferencesUtil.removeFormId(prefs, formId);
-      hilog.info(0x0000, TAG, `✅ Form ID removed successfully: ${formId}`);
+
     } catch (error) {
       hilog.error(0x0000, TAG, `❌ Failed to remove Form ID: ${error}`);
     }

Некоторые файлы не были показаны из-за большого количества измененных файлов