mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

The only state DownloadInternal holds is duplicate of state contained in Download, but can confusingly be temporarily out of sync. This is error prone because it's easy to use the wrong variable (e.g. download.state vs state). DownloadInternals methods are called into and call out into DownloadManager, which makes some code paths that are quite hard to follow. It's possible to simplify DownloadManager quite a lot by removing the duplicated state in DownloadInternal, at which point DownloadInternal's methods flatten into DownloadManager, which can just hold an internal list of Downloads directly. This is a first step, which makes it clear that DownloadThready only needs its immutable DownloadAction + an isRemove flag. PiperOrigin-RevId: 243245288