-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Download RequirementWatcher misses network transition #6733
Comments
I think this is working as intended, because both WiFi and the LTE network are already available. The problem is that when we see the WiFi network's I think switching to |
I see. Then let's use Is this open for contributions? I can prepare a PR :) |
It would be except that I already have one ;). |
Nice 👍 |
Issue: #6733 PiperOrigin-RevId: 286621715
Please see the patch referenced above. It would be great if you could test it out on the |
I've just tested it on my Pixel, it worked 10/10 :) |
Issue: #6733 PiperOrigin-RevId: 286621715
[REQUIRED] Issue description
The
RequirementWatcher
of downloads sometimes misses to detect that a network is available and because of this the download will go back to queue incorrectly.[REQUIRED] Reproduction steps
The issue can be reproduced with ExoPlayer's demo app. The default requirement of downloads in the demo app is
com.google.android.exoplayer2.scheduler.Requirements#NETWORK
, which should allow to download on Wifi and cellular network.Expected result:
The phone switches to mobile data and the download continues.
Actual result:
The phone switches to mobile data but the download stops (goes into queue and reporting that the network requirement is not met).
Note: this behavior can be seen only approx. 7/10 times, sometimes works as expected.
[REQUIRED] Link to test content
Any content in the demo app.
[REQUIRED] A full bug report captured from the device
N/A
[REQUIRED] Version of ExoPlayer being used
Version 2.10.2, but also branch dev-v2.
[REQUIRED] Device(s) and version(s) of Android being used
Additional info:
The root cause seems to be that after turning off the Wifi
RequirementsWatcher.CapabilityValidatedCallback#onLost
is called correctly butRequirementsWatcher.CapabilityValidatedCallback#onAvailable
is not called when goes over to mobile network.Using
connectivityManager.registerDefaultNetworkCallback(networkCallback)
instead ofconnectivityManager.registerNetworkCallback(request, networkCallback)
solves the problem (at least in my tests it worked 10/10) but then we will miss the internet connectivity validation (same when API < 23).The text was updated successfully, but these errors were encountered: