use of androidx.media3.exoplayer.scheduler.RequirementsWatcher in project media by androidx.
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 androidx.media3.exoplayer.scheduler.RequirementsWatcher in project media by androidx.
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