Commit d85ee01a by eguven Committed by Oliver Woodman

Convert DownloadManager.Listener methods no-op default methods

PiperOrigin-RevId: 239019504
parent d229e1f4
...@@ -35,7 +35,6 @@ import com.google.android.exoplayer2.offline.DownloadService; ...@@ -35,7 +35,6 @@ import com.google.android.exoplayer2.offline.DownloadService;
import com.google.android.exoplayer2.offline.DownloadState; import com.google.android.exoplayer2.offline.DownloadState;
import com.google.android.exoplayer2.offline.DownloadStateCursor; import com.google.android.exoplayer2.offline.DownloadStateCursor;
import com.google.android.exoplayer2.offline.StreamKey; 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.trackselection.MappingTrackSelector.MappedTrackInfo;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.util.Log; import com.google.android.exoplayer2.util.Log;
...@@ -130,11 +129,6 @@ public class DownloadTracker implements DownloadManager.Listener { ...@@ -130,11 +129,6 @@ public class DownloadTracker implements DownloadManager.Listener {
// DownloadManager.Listener // DownloadManager.Listener
@Override @Override
public void onInitialized(DownloadManager downloadManager) {
// Do nothing.
}
@Override
public void onDownloadStateChanged(DownloadManager downloadManager, DownloadState downloadState) { public void onDownloadStateChanged(DownloadManager downloadManager, DownloadState downloadState) {
if (downloadState.state == DownloadState.STATE_REMOVED if (downloadState.state == DownloadState.STATE_REMOVED
|| downloadState.state == DownloadState.STATE_FAILED) { || downloadState.state == DownloadState.STATE_FAILED) {
...@@ -145,19 +139,6 @@ public class DownloadTracker implements DownloadManager.Listener { ...@@ -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 // Internal methods
private void loadTrackedActions() { private void loadTrackedActions() {
......
...@@ -68,21 +68,23 @@ public final class DownloadManager { ...@@ -68,21 +68,23 @@ public final class DownloadManager {
* *
* @param downloadManager The reporting instance. * @param downloadManager The reporting instance.
*/ */
void onInitialized(DownloadManager downloadManager); default void onInitialized(DownloadManager downloadManager) {}
/** /**
* Called when the state of a download changes. * Called when the state of a download changes.
* *
* @param downloadManager The reporting instance. * @param downloadManager The reporting instance.
* @param downloadState The state of the download. * @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. * Called when there is no active download left.
* *
* @param downloadManager The reporting instance. * @param downloadManager The reporting instance.
*/ */
void onIdle(DownloadManager downloadManager); default void onIdle(DownloadManager downloadManager) {}
/** /**
* Called when the download requirements state changed. * Called when the download requirements state changed.
...@@ -92,10 +94,10 @@ public final class DownloadManager { ...@@ -92,10 +94,10 @@ public final class DownloadManager {
* @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not * @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not
* met, or 0. * met, or 0.
*/ */
void onRequirementsStateChanged( default void onRequirementsStateChanged(
DownloadManager downloadManager, DownloadManager downloadManager,
Requirements requirements, Requirements requirements,
@Requirements.RequirementFlags int notMetRequirements); @Requirements.RequirementFlags int notMetRequirements) {}
} }
/** The default maximum number of simultaneous downloads. */ /** The default maximum number of simultaneous downloads. */
......
...@@ -533,11 +533,6 @@ public abstract class DownloadService extends Service { ...@@ -533,11 +533,6 @@ public abstract class DownloadService extends Service {
} }
@Override @Override
public void onInitialized(DownloadManager downloadManager) {
// Do nothing.
}
@Override
public void onDownloadStateChanged( public void onDownloadStateChanged(
DownloadManager downloadManager, DownloadState downloadState) { DownloadManager downloadManager, DownloadState downloadState) {
if (downloadService != null) { if (downloadService != null) {
......
...@@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat; ...@@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat;
import android.os.ConditionVariable; import android.os.ConditionVariable;
import com.google.android.exoplayer2.offline.DownloadManager; import com.google.android.exoplayer2.offline.DownloadManager;
import com.google.android.exoplayer2.offline.DownloadState; import com.google.android.exoplayer2.offline.DownloadState;
import com.google.android.exoplayer2.scheduler.Requirements;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
...@@ -83,12 +82,6 @@ public final class TestDownloadManagerListener implements DownloadManager.Listen ...@@ -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 * Blocks until all remove and download tasks are complete and throws an exception if there was an
* error. * error.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment