From ca4a1d8ca38d4f9595692a788ba31111e829dbcc Mon Sep 17 00:00:00 2001 From: litclimbing <94636143+litclimbing@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:56:43 -0700 Subject: [PATCH] android: fix for app coming to foreground When an app goes to the background, onBlockedStatusChanged is called with true and then called with false when it comes back to the foreground. The function onAvailable isn't called in this case and the connection wasn't being reset. Closes #8850 I noticed the comment that this is used for API versions 24+ but onBlockedStatusChanged was added in 29. I'm not sure if some kind of guard needs to be added or not. https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback#onBlockedStatusChanged(android.net.Network,%20boolean) --- .../src/main/java/io/grpc/android/AndroidChannelBuilder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java b/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java index 19b2b1a234..e76b9d4ff8 100644 --- a/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java +++ b/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java @@ -297,6 +297,11 @@ public final class AndroidChannelBuilder extends ForwardingChannelBuilder