Add Download Manager release and recreate support to DownloadService
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
### [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
```
public static Intent buildReleaseDownloadManager(
Context context, Class clazz, boolean foreground) {
return getIntent(context, clazz, ACTION_RELEASE_DOWNLOAD_MANAGER, foreground);
}
```
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](https://github.com/google/ExoPlayer/blob/r2.18.0/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java#L955-L964) evaluates to false
We will in the short term use our own service copied from your code with this feature added.
Contributor guide
Assessment
This issue has not been assessed yet.