Open rossbeazley opened 2 years ago
Thanks Ross for the feature request!
I'm not sure when we have a chance to look into this. If you want to do a pull request in the meantime. please do! :) If possible this PR should be done in the new repo against the main
branch: https://github.com/androidx/media/tree/main
ah yes, sorry, do you want me to move the issue to that repo instead?
Nah, fine to have the issue here. If you do a pull request, handling it is much easier for us when you use the other repo as we internally use the new module/package structure.
[REQUIRED] Use case description
Within the life of one application process we would like to release DownloadManager in order to significantly reconfigure the Download Managers databases etc to support user logout / login. It looks like by design the expectation is to only support one instance of Download Manager per application process https://github.com/google/ExoPlayer/blob/r2.18.0/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java#L173-L177
Proposed solution
Permit the release of DownloadManager by the DownloadService, add a Command to the DownloadService for release eg
Upon processing this command, clear the reference from the DownloadManagerHelpers and release the DownloadManager (it helps)
Alternatives considered
Alter DownloadManagerHelper to clear itself down if this block evaluates to false
We will in the short term use our own service copied from your code with this feature added.