mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Convert DownloadManager.Listener methods no-op default methods
PiperOrigin-RevId: 239019504
This commit is contained in:
parent
d229e1f405
commit
d85ee01ae7
@ -35,7 +35,6 @@ import com.google.android.exoplayer2.offline.DownloadService;
|
||||
import com.google.android.exoplayer2.offline.DownloadState;
|
||||
import com.google.android.exoplayer2.offline.DownloadStateCursor;
|
||||
import com.google.android.exoplayer2.offline.StreamKey;
|
||||
import com.google.android.exoplayer2.scheduler.Requirements;
|
||||
import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
@ -129,11 +128,6 @@ public class DownloadTracker implements DownloadManager.Listener {
|
||||
|
||||
// DownloadManager.Listener
|
||||
|
||||
@Override
|
||||
public void onInitialized(DownloadManager downloadManager) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadStateChanged(DownloadManager downloadManager, DownloadState downloadState) {
|
||||
if (downloadState.state == DownloadState.STATE_REMOVED
|
||||
@ -145,19 +139,6 @@ public class DownloadTracker implements DownloadManager.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIdle(DownloadManager downloadManager) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequirementsStateChanged(
|
||||
DownloadManager downloadManager,
|
||||
Requirements requirements,
|
||||
@Requirements.RequirementFlags int notMetRequirements) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
// Internal methods
|
||||
|
||||
private void loadTrackedActions() {
|
||||
|
@ -68,21 +68,23 @@ public final class DownloadManager {
|
||||
*
|
||||
* @param downloadManager The reporting instance.
|
||||
*/
|
||||
void onInitialized(DownloadManager downloadManager);
|
||||
default void onInitialized(DownloadManager downloadManager) {}
|
||||
|
||||
/**
|
||||
* Called when the state of a download changes.
|
||||
*
|
||||
* @param downloadManager The reporting instance.
|
||||
* @param downloadState The state of the download.
|
||||
*/
|
||||
void onDownloadStateChanged(DownloadManager downloadManager, DownloadState downloadState);
|
||||
default void onDownloadStateChanged(
|
||||
DownloadManager downloadManager, DownloadState downloadState) {}
|
||||
|
||||
/**
|
||||
* Called when there is no active download left.
|
||||
*
|
||||
* @param downloadManager The reporting instance.
|
||||
*/
|
||||
void onIdle(DownloadManager downloadManager);
|
||||
default void onIdle(DownloadManager downloadManager) {}
|
||||
|
||||
/**
|
||||
* Called when the download requirements state changed.
|
||||
@ -92,10 +94,10 @@ public final class DownloadManager {
|
||||
* @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not
|
||||
* met, or 0.
|
||||
*/
|
||||
void onRequirementsStateChanged(
|
||||
default void onRequirementsStateChanged(
|
||||
DownloadManager downloadManager,
|
||||
Requirements requirements,
|
||||
@Requirements.RequirementFlags int notMetRequirements);
|
||||
@Requirements.RequirementFlags int notMetRequirements) {}
|
||||
}
|
||||
|
||||
/** The default maximum number of simultaneous downloads. */
|
||||
|
@ -532,11 +532,6 @@ public abstract class DownloadService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialized(DownloadManager downloadManager) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadStateChanged(
|
||||
DownloadManager downloadManager, DownloadState downloadState) {
|
||||
|
@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.os.ConditionVariable;
|
||||
import com.google.android.exoplayer2.offline.DownloadManager;
|
||||
import com.google.android.exoplayer2.offline.DownloadState;
|
||||
import com.google.android.exoplayer2.scheduler.Requirements;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
@ -83,12 +82,6 @@ public final class TestDownloadManagerListener implements DownloadManager.Listen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequirementsStateChanged(
|
||||
DownloadManager downloadManager, Requirements requirements, int notMetRequirements) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks until all remove and download tasks are complete and throws an exception if there was an
|
||||
* error.
|
||||
|
Loading…
x
Reference in New Issue
Block a user