use of com.google.android.exoplayer2.scheduler.Requirements in project ExoPlayer by google.
the class DownloadManager method setRequirements.
/**
* Sets the requirements that need to be met for downloads to progress.
*
* @param requirements A {@link Requirements}.
*/
public void setRequirements(Requirements requirements) {
if (requirements.equals(requirementsWatcher.getRequirements())) {
return;
}
requirementsWatcher.stop();
requirementsWatcher = new RequirementsWatcher(context, requirementsListener, requirements);
int notMetRequirements = requirementsWatcher.start();
onRequirementsStateChanged(requirementsWatcher, notMetRequirements);
}
use of com.google.android.exoplayer2.scheduler.Requirements in project ExoPlayer by google.
the class DownloadManager method onRequirementsStateChanged.
private void onRequirementsStateChanged(RequirementsWatcher requirementsWatcher, @Requirements.RequirementFlags int notMetRequirements) {
Requirements requirements = requirementsWatcher.getRequirements();
if (this.notMetRequirements != notMetRequirements) {
this.notMetRequirements = notMetRequirements;
pendingMessages++;
internalHandler.obtainMessage(MSG_SET_NOT_MET_REQUIREMENTS, notMetRequirements, /* unused */
0).sendToTarget();
}
boolean waitingForRequirementsChanged = updateWaitingForRequirements();
for (Listener listener : listeners) {
listener.onRequirementsStateChanged(this, requirements, notMetRequirements);
}
if (waitingForRequirementsChanged) {
notifyWaitingForRequirementsChanged();
}
}
Aggregations