mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Remove index modifier methods from DownloadIndex interface
PiperOrigin-RevId: 239045412
This commit is contained in:
parent
d85ee01ae7
commit
b5e4523b58
4 changed files with 15 additions and 20 deletions
|
|
@ -29,7 +29,6 @@ import com.google.android.exoplayer2.offline.ActionFile;
|
||||||
import com.google.android.exoplayer2.offline.DefaultDownloadIndex;
|
import com.google.android.exoplayer2.offline.DefaultDownloadIndex;
|
||||||
import com.google.android.exoplayer2.offline.DownloadAction;
|
import com.google.android.exoplayer2.offline.DownloadAction;
|
||||||
import com.google.android.exoplayer2.offline.DownloadHelper;
|
import com.google.android.exoplayer2.offline.DownloadHelper;
|
||||||
import com.google.android.exoplayer2.offline.DownloadIndex;
|
|
||||||
import com.google.android.exoplayer2.offline.DownloadManager;
|
import com.google.android.exoplayer2.offline.DownloadManager;
|
||||||
import com.google.android.exoplayer2.offline.DownloadService;
|
import com.google.android.exoplayer2.offline.DownloadService;
|
||||||
import com.google.android.exoplayer2.offline.DownloadState;
|
import com.google.android.exoplayer2.offline.DownloadState;
|
||||||
|
|
@ -68,7 +67,7 @@ public class DownloadTracker implements DownloadManager.Listener {
|
||||||
private final DataSource.Factory dataSourceFactory;
|
private final DataSource.Factory dataSourceFactory;
|
||||||
private final CopyOnWriteArraySet<Listener> listeners;
|
private final CopyOnWriteArraySet<Listener> listeners;
|
||||||
private final HashMap<Uri, DownloadState> trackedDownloadStates;
|
private final HashMap<Uri, DownloadState> trackedDownloadStates;
|
||||||
private final DownloadIndex downloadIndex;
|
private final DefaultDownloadIndex downloadIndex;
|
||||||
private final Handler indexHandler;
|
private final Handler indexHandler;
|
||||||
|
|
||||||
@Nullable private StartDownloadDialogHelper startDownloadDialogHelper;
|
@Nullable private StartDownloadDialogHelper startDownloadDialogHelper;
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,12 @@ public final class DefaultDownloadIndex implements DownloadIndex {
|
||||||
return new DownloadStateCursorImpl(cursor);
|
return new DownloadStateCursorImpl(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
|
* Adds or replaces a {@link DownloadState}.
|
||||||
|
*
|
||||||
|
* @param downloadState The {@link DownloadState} to be added.
|
||||||
|
* @throws DatabaseIOException If an error occurs setting the state.
|
||||||
|
*/
|
||||||
public void putDownloadState(DownloadState downloadState) throws DatabaseIOException {
|
public void putDownloadState(DownloadState downloadState) throws DatabaseIOException {
|
||||||
ensureInitialized();
|
ensureInitialized();
|
||||||
Assertions.checkState(downloadState.state != DownloadState.STATE_REMOVED);
|
Assertions.checkState(downloadState.state != DownloadState.STATE_REMOVED);
|
||||||
|
|
@ -212,7 +217,11 @@ public final class DefaultDownloadIndex implements DownloadIndex {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
|
* Removes the {@link DownloadState} with the given {@code id}.
|
||||||
|
*
|
||||||
|
* @throws DatabaseIOException If an error occurs removing the state.
|
||||||
|
*/
|
||||||
public void removeDownloadState(String id) throws DatabaseIOException {
|
public void removeDownloadState(String id) throws DatabaseIOException {
|
||||||
ensureInitialized();
|
ensureInitialized();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -41,18 +41,4 @@ public interface DownloadIndex {
|
||||||
*/
|
*/
|
||||||
DownloadStateCursor getDownloadStates(@DownloadState.State int... states) throws IOException;
|
DownloadStateCursor getDownloadStates(@DownloadState.State int... states) throws IOException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds or replaces a {@link DownloadState}.
|
|
||||||
*
|
|
||||||
* @param downloadState The {@link DownloadState} to be added.
|
|
||||||
* @throws IOException If an error occurs setting the state.
|
|
||||||
*/
|
|
||||||
void putDownloadState(DownloadState downloadState) throws IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the {@link DownloadState} with the given {@code id}.
|
|
||||||
*
|
|
||||||
* @throws IOException If an error occurs removing the state.
|
|
||||||
*/
|
|
||||||
void removeDownloadState(String id) throws IOException;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public final class DownloadIndexUtil {
|
||||||
*/
|
*/
|
||||||
public static void upgradeActionFile(
|
public static void upgradeActionFile(
|
||||||
ActionFile actionFile,
|
ActionFile actionFile,
|
||||||
DownloadIndex downloadIndex,
|
DefaultDownloadIndex downloadIndex,
|
||||||
@Nullable DownloadIdProvider downloadIdProvider)
|
@Nullable DownloadIdProvider downloadIdProvider)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (downloadIdProvider == null) {
|
if (downloadIdProvider == null) {
|
||||||
|
|
@ -72,7 +72,8 @@ public final class DownloadIndexUtil {
|
||||||
* @throws IOException If an error occurs storing the state in the {@link DownloadIndex}.
|
* @throws IOException If an error occurs storing the state in the {@link DownloadIndex}.
|
||||||
*/
|
*/
|
||||||
public static void addAction(
|
public static void addAction(
|
||||||
DownloadIndex downloadIndex, @Nullable String id, DownloadAction action) throws IOException {
|
DefaultDownloadIndex downloadIndex, @Nullable String id, DownloadAction action)
|
||||||
|
throws IOException {
|
||||||
DownloadState downloadState = downloadIndex.getDownloadState(id != null ? id : action.id);
|
DownloadState downloadState = downloadIndex.getDownloadState(id != null ? id : action.id);
|
||||||
if (downloadState != null) {
|
if (downloadState != null) {
|
||||||
downloadState = downloadState.mergeAction(action);
|
downloadState = downloadState.mergeAction(action);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue