MediaPipeModelManager

class MediaPipeModelManager(context: Context, spec: ModelManifestEntry = GEMMA_3_1B, downloader: ResumableModelDownloader = ResumableModelDownloader()) : ModelManager

Manages the on-demand MediaPipe Gemma model file in app-private storage. The model binary is NEVER committed to the repo — download is user-triggered (surfaced on the settings screen via ModelManager) and lands in filesDir/models/, resuming from a .tmp if a prior attempt was cut off.

The URL is manifest-derived (ModelManifestEntry, gallery A5) and the fetch is a real resumable transfer (ResumableModelDownloader, gallery A4). The CALLER is responsible for user consent (see ModelManifestEntry.requiresLicenseAck) and for running download inside a wifi-only WorkManager foreground job — this class owns file state + progress, not scheduling.

Constructors

Link copied to clipboard
constructor(context: Context, spec: ModelManifestEntry = GEMMA_3_1B, downloader: ResumableModelDownloader = ResumableModelDownloader())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun delete(modelId: String)

Remove a downloaded model from app-private storage.

Link copied to clipboard
open suspend override fun download(modelId: String)

Start (or resume) downloading modelId. Suspends until it completes or fails.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun models(): List<ModelInfo>

Current snapshot of every manageable model.

Link copied to clipboard
open override fun observe(modelId: String): StateFlow<ModelInfo>

Observe one model's state (drives the download-progress UI).