Model Downloads
Starts, tracks and cancels model downloads. Each ModelPack is asked for on its own; a single transfer works through the queue (AiState.modelQueue) one pack after another. The transfer runs in a user-initiated data transfer job on Android 14+ (exempt from job quotas, survives leaving the app), and in a WorkManager foreground worker on Android 11–13. Both call run.
Functions
Link copied to clipboard
Link copied to clipboard
Bytes still to fetch for pack, counting partial files already on disk.
Link copied to clipboard
suspend fun run(context: Context, onProgress: (pack: ModelPack, done: Long, total: Long) -> Unit): Boolean?
Downloads the queue, one pack at a time, each taken off once complete. Returns null when done, else whether to retry later (false: a pack failed for good, the rest were fetched). Cancellation propagates, leaving .part files to resume from.