google / google/ExoPlayer

Add Download Manager release and recreate support to DownloadService

Open
#10,395 3 comments 0 reactions 1 assignee Claimed by @marcbaechinger View on GitHub
enhancement needs triage
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.