Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for reconnecting when Android app comes to the foreground #8855

Merged
merged 1 commit into from Feb 3, 2022

Conversation

litclimbing
Copy link
Contributor

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)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 19, 2022

CLA Signed

The committers are authorized under a signed CLA.

@larssn
Copy link

larssn commented Feb 1, 2022

This might fix a long-standing issue downstream: firebase/flutterfire#6749

@dapengzhang0 dapengzhang0 added this to the v1.45 milestone Feb 1, 2022
@dapengzhang0 dapengzhang0 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 1, 2022
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 1, 2022
Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't entirely match our style, but the automated checker is happy so that can be fixed after it is merged.

@ejona86 ejona86 merged commit ca4a1d8 into grpc:master Feb 3, 2022
@ejona86
Copy link
Member

ejona86 commented Feb 3, 2022

Thank you! Great find!

@larssn
Copy link

larssn commented Feb 9, 2022

@ejona86 Any way this can find its way into a release before March 8th?

@ejona86
Copy link
Member

ejona86 commented Feb 9, 2022

@larssn, there'd be no problem backporting it to 1.44. We should do that.

But it is unclear when it'd be released. I'm not sure it is worth doing a release just for this improvement. While it looks like it would be quite beneficial, this has apparently been an issue for 2.5 years, which makes it a hard case for urgency. Due to some other events we're more limited on time than ordinarily.

Looking around, I see some other fixes that might deserve a backport that haven't been backported. There may be enough to make it worthwhile.

@larssn, I assume this is a "Gee, 1.45 is a month away. Sure would be nice to get it sooner." You have no hard deadline, but simply "sooner is better than later"? I could easily make a 1.44.1-SNAPSHOT release, but that probably doesn't excite you.

@ejona86 ejona86 added the TODO:backport PR needs to be backported. Removed after backport complete label Feb 9, 2022
@larssn
Copy link

larssn commented Feb 9, 2022

@ejona86 Appreciate the reply. We're in a situation currently where our product doesn't handle coming out of standby correctly on Android, which is unfortunate because we're dealing with money. This is all the way upstream in Flutter territory. I'm not even sure this fixes it, but I'm pretty confident it does.

But the main reason I'm asking is because it will also take time for the fix to propagate all the way upstream. So yeah, you're spot on about the "sooner is better than later"-part 🙂

Edit:
I think the problem might even be 4+ years old. A guy is talking about, what appears to be the same issue, here.

@ejona86
Copy link
Member

ejona86 commented Feb 9, 2022

@larssn, in asking around, it seems #8892 deserves backport and release(s?). So I'm expecting there's probably going to be a release of 1.44.1 within ~week.

@wu-hui
Copy link

wu-hui commented Feb 17, 2022

@larssn, in asking around, it seems #8892 deserves backport and release(s?). So I'm expecting there's probably going to be a release of 1.44.1 within ~week.

Do we have a tentative release date yet?

@ejona86
Copy link
Member

ejona86 commented Feb 17, 2022

@wu-hui, #8929 is out, which means the binaries will be available today or tomorrow and the announcement will probably be the day after.

@ejona86
Copy link
Member

ejona86 commented Feb 18, 2022

v1.44.1 is available on Maven Central. It isn't indexed by search.maven.org yet, but it is there.

@wu-hui
Copy link

wu-hui commented Feb 18, 2022

Thank you, will upgrade from our side!

@ejona86 ejona86 removed the TODO:backport PR needs to be backported. Removed after backport complete label Mar 1, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AndroidChannel fails to reconnect after block
6 participants