From caa2bbaa44e42dcdf039e6fb44f7975abf8ca7f4 Mon Sep 17 00:00:00 2001 From: kari-ts Date: Wed, 18 Feb 2026 18:11:53 -0800 Subject: [PATCH] android: debounce health notifications by identity not count The current approach will debounce notifications based on the number, even if the notifications are different. Also, move the debounce before the combine to smooth out health warning churn rather than both health warning or ipn state changes. Updates tailscale/tailscale#13378 Signed-off-by: kari-ts --- .../java/com/tailscale/ipn/ui/notifier/HealthNotifier.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/tailscale/ipn/ui/notifier/HealthNotifier.kt b/android/src/main/java/com/tailscale/ipn/ui/notifier/HealthNotifier.kt index 60a0210f5c..1030d217b4 100644 --- a/android/src/main/java/com/tailscale/ipn/ui/notifier/HealthNotifier.kt +++ b/android/src/main/java/com/tailscale/ipn/ui/notifier/HealthNotifier.kt @@ -49,9 +49,11 @@ class HealthNotifier( // health warnings in various states. scope.launch { healthStateFlow - .distinctUntilChanged { old, new -> old?.Warnings?.count() == new?.Warnings?.count() } - .combine(ipnStateFlow, ::Pair) + .distinctUntilChanged { old, new -> + old?.Warnings?.keys.orEmpty() == new?.Warnings?.keys.orEmpty() + } .debounce(3000) + .combine(ipnStateFlow, ::Pair) .collect { pair -> val health = pair.first // Only deliver health notifications when the client is Running