fe13b77e22
Three issues addressed: 1. Make cleanup() exception-safe: wrap each WebRTC dispose call in its own try-catch so that a failure in one (e.g. native crash disposing a PeerConnection) does not skip releasing the camera, audio mode, foreground service, or EGL context. 2. Upgrade the Idle safety net to call cleanup() instead of only stopping ringing/notifications. If the Ended state is missed due to StateFlow conflation, the Idle handler now performs full resource cleanup (camera, WebRTC, audio mode, foreground service, proximity wake lock). cleanup() is idempotent since all resources are null-checked and nulled out. 3. Call cleanup() in AccountViewModel.onCleared() so that WebRTC resources, camera, audio mode, and foreground service are released when the ViewModel is destroyed (e.g. logout, activity recreation). 4. Clear processedEventIds when transitioning to Idle to prevent unbounded memory growth across calls. https://claude.ai/code/session_01GWRdrVAa29BsDkv8R7Z3Y9