Fix two bugs in Android connectivity detection logic for Android R
This change implements a new NetworkCallback class used for listening to changes to the default network on Android. It includes two fixes: 1. Avoids calling synchronous ConnectivityManager methods which is prohibited inside NetworkCallbacks. This is a preemptive fix, not known to actually be causing issues. 2. Catches onCapabilitiesChanged() which includes cellular connections transitioning to and from SUSPENDED states. Failing to catch this could leave the NetworkChangeNotifier in an incorrect disconnected state, see crbug.com/1120144. This new NetworkCallback is used on Android R and newer versions to limit retesting and as these are the only versions experiencing issues. I've tested this thoroughly on Android R. Additional automated testing isn't feasible given the code's closeness with Android APIs involving immutable classes with no public constructors (e.g. NetworkCapabilities). Bug: 1120144 Change-Id: If77d4524f8f8e0be78563412176c2ea2d07f00c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2605304 Commit-Queue: Paul Jensen <pauljensen@chromium.org> Commit-Queue: Richard Coles <torne@chromium.org> Auto-Submit: Paul Jensen <pauljensen@chromium.org> Reviewed-by:Richard Coles <torne@chromium.org> Cr-Commit-Position: refs/heads/master@{#840324}
Showing
Please register or sign in to comment