- Replace volatile boolean with AtomicBoolean for thread-safe state access - Add a 500ms debounce to notification logic to account for delayed foreground transitions - Update ChatNotificationService unit tests to reflect the new AtomicBoolean state type This fixes a race condition where a message arriving just as the user opens the app would incorrectly trigger a foreground notification.