fix unrelated build breaks blocking ML apps, use full ORT
- Commit
dce23df52b32d03efa27cb46d107d29aac6b0881- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-15 00:46 UTC (2 months ago)
- Parents
c20f1a1
Diff
games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt
diff --git a/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt b/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.ktindex 204fd7f8b5..1763e3d8ba 100644--- a/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt+++ b/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt@@ -23,6 +23,7 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.produceState@@ -36,7 +37,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.drawscope.DrawScope import androidx.compose.ui.graphics.drawscope.Stroke-import androidx.compose.ui.graphics.drawscope.StrokeCap+import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource
gradle/libs.versions.toml
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 212b5d6d9f..af95e88d49 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -109,6 +109,7 @@ apksig = "8.7.3" quickjs = "1.0.15" # On-device AI+onnxruntimeAndroid = "1.27.0" onnxruntimeReduced = "1.27.0-r1" litertlmAndroid = "0.14.0" @@ -295,10 +296,11 @@ quickjs-kt = { module = "io.github.dokar3:quickjs-kt", version.ref = "quickjs" } # On-device AI: reduced-operator ORT rebuild (arm64-only). Version tracks upstream plus an # -rN suffix for the operator-set revision, so a rebuild with different ops gets a new version.-# Same source as onnxruntime-android, built with --include_ops_by_config: 10 MB of native code-# instead of 28 MB. A model with an operator outside the configured set fails at session-# creation, not at inference — regenerate the AAR rather than falling back to a full build.+# CURRENTLY UNUSED: 1.27.0-r1 lacks Conv(11) and other vision ops. Kept pinned so the -r2+# rebuild has a base to extend. :library:ml uses the full build until then. onnxruntime-reduced-android = { module = "io.github.vayun-mathur:onnxruntime-reduced-android", version.ref = "onnxruntimeReduced" }+# Full ONNX Runtime: every op, ~28 MB native. Temporary until the -r2 reduced rebuild.+onnxruntime-android = { module = "com.microsoft.onnxruntime:onnxruntime-android", version.ref = "onnxruntimeAndroid" } # Conversational LLM (Gemma) via LiteRT-LM. litertlm 0.14.0 is compiled against coroutines # 1.11.0 (close$default moved onto the SendChannel interface via -Xjvm-default=all); older # versions crash its JNI callback with NoSuchMethodError, so keep kotlinxCoroutines at 1.11.0.
library/map/src/main/rust/src/bridge/workers.rs
diff --git a/library/map/src/main/rust/src/bridge/workers.rs b/library/map/src/main/rust/src/bridge/workers.rsindex 30977dd2f3..5bd2c05612 100644--- a/library/map/src/main/rust/src/bridge/workers.rs+++ b/library/map/src/main/rust/src/bridge/workers.rs@@ -6,8 +6,10 @@ use crate::tile::cache::{RangeCache, DEFAULT_MAX_BYTES}; use crate::tile::geometry; use crate::tile::select::TileId; use crate::tile::source::BASEMAP_ARCHIVE_URL;-use crate::tile::source::{basemap_origin, CachingRangeReader, JniRangeFetcher};+use crate::tile::source::{basemap_origin, CachingRangeReader, JniRangeFetcher, RangeFetcher};+use tilecodec::mamaps::header::Header; use tilecodec::mamaps::MamapsArchive;+use tilecodec::stream::OPEN_PREFIX_BYTES; use std::sync::mpsc::{Receiver, Sender}; use std::sync::{Arc, Mutex}; use super::handle::{OnlineFlag, TileResult, ZoomRange};@@ -34,9 +36,33 @@ pub(crate) fn spawn_worker( let started = std::thread::Builder::new() .name(format!("map-tiles-{index}")) .spawn(move || {- // Unchecked: the origin marker includes the archive's `build_id`, which is in the- // header, which is read through this cache. Checked below, once, when it is known.- let cache = RangeCache::open_unchecked(cache_dir, DEFAULT_MAX_BYTES);+ // Single open: the header prefix is fetched *before* the cache opens, the+ // `build_id` is read out of it, and the cache opens once with the full+ // origin marker — wiping on mismatch up front. No two-step reset.+ let build_id = match JniRangeFetcher.fetch(&archive_url, "bytes=0-127") {+ Ok(r) if r.status == 206 && r.body.len() == tilecodec::mamaps::header::HEADER_LEN => {+ match Header::parse(&r.body) {+ Ok(h) => h.build_id,+ Err(e) => {+ log(&format!("worker {index} cannot parse the mamaps header: {e}"));+ return;+ }+ }+ }+ Ok(r) => {+ log(&format!(+ "worker {index} cannot fetch the mamaps header: HTTP {}",+ r.status+ ));+ return;+ }+ Err(e) => {+ log(&format!("worker {index} cannot fetch the mamaps header: {e}"));+ return;+ }+ };+ let cache =+ RangeCache::open(cache_dir, &basemap_origin(&archive_url, build_id), DEFAULT_MAX_BYTES); let reader = CachingRangeReader::new(archive_url.clone(), cache, JniRangeFetcher); reader.set_online(online.get()); @@ -47,12 +73,6 @@ pub(crate) fn spawn_worker( return; } };- // Now the `build_id` is known, so the cache can be told which build it holds. A- // republish under the same name wipes it here rather than serving byte offsets from- // the build before.- archive- .reader()- .reset_origin(&basemap_origin(&archive_url, archive.header.build_id)); // Publish the real range. Until this lands the renderer works from a guess, and // a guess that is too high asks for a zoom the archive does not contain and // silently gets nothing back.@@ -104,104 +124,3 @@ pub(crate) fn spawn_worker( log(&format!("cannot start tile worker {index}")); } }--pub(crate) fn spawn_file_worker(- index: usize,- path: Option<std::path::PathBuf>,- queue: Arc<Mutex<Receiver<TileId>>>,- finished: Sender<(u64, TileResult)>,- zoom_range: Arc<ZoomRange>,- toggles: Arc<SharedToggles>,-) {- let Some(path) = path else {- // Empty archive_path == remote fallback already handled by caller printing a log,- // but keep symmetry for direct callers.- return;- };- let started = std::thread::Builder::new()- .name(format!("map-tiles-file-{index}"))- .spawn(move || {- let reader = match crate::tile::source::FileRangeReader::open(&path) {- Ok(r) => r,- Err(e) => {- log(&format!("file worker {index} cannot open {}: {e}", path.display()));- return;- }- };- let mut archive = match MamapsArchive::open(reader) {- Ok(a) => a,- Err(e) => {- log(&format!("file worker {index} cannot open mamaps archive {}: {e}", path.display()));- return;- }- };- zoom_range.set(archive.header.min_zoom, archive.header.max_zoom);- let layers = style::layers();- let rings_validated = archive.header.rings_validated();- loop {- let next = match queue.lock() {- Ok(guard) => guard.recv(),- Err(_) => return,- };- let Ok(tile) = next else { return };- let key = tile.key();- let (enabled, kinds, generation) = toggles.get();- let result = match archive.tile(tile.z, tile.x, tile.y) {- Ok(Some(body)) => TileResult::Ready(geometry::build_toggled(- &body, layers, tile.z, tile.x, tile.y, rings_validated, enabled, &kinds,- generation,- )),- Ok(None) => TileResult::Absent,- Err(e) => {- log(&format!("file tile {}/{}/{} failed: {e}", tile.z, tile.x, tile.y));- TileResult::Failed- }- };- if finished.send((key, result)).is_err() {- return;- }- }- })- .is_ok();- if !started {- log(&format!("cannot start file tile worker {index}"));- }-}--pub(crate) enum ArchiveSource {- Default,- RemoteUrl(String),- LocalFile(std::path::PathBuf),-}--pub(crate) fn normalize_local_archive_path(raw: &str) -> ArchiveSource {- let trimmed = raw.trim();- if trimmed.is_empty() {- return ArchiveSource::Default;- }- let stripped = if let Some(rest) = trimmed.strip_prefix("file://") {- rest- } else {- trimmed- };- let stripped = stripped.trim();- if stripped.is_empty() {- return ArchiveSource::Default;- }- if stripped.starts_with("http://") || stripped.starts_with("https://") {- return ArchiveSource::RemoteUrl(stripped.to_string());- }- if stripped.contains("://") {- return ArchiveSource::Default;- }- let looks_local = stripped.starts_with('/')- || stripped.starts_with("C:\\")- || stripped.starts_with("C:/")- || stripped.starts_with("/sdcard")- || stripped.starts_with("/data/")- || stripped.starts_with("/storage/");- if looks_local {- return ArchiveSource::LocalFile(std::path::PathBuf::from(stripped));- }- ArchiveSource::Default-}
library/ml/build.gradle.kts
diff --git a/library/ml/build.gradle.kts b/library/ml/build.gradle.ktsindex 65d351e9a7..a239838dd9 100644--- a/library/ml/build.gradle.kts+++ b/library/ml/build.gradle.kts@@ -3,8 +3,7 @@ plugins { } dependencies {- // On-device inference executor: reduced-operator ONNX Runtime rebuild (arm64-only,- // 10 MB native). All models run as `.onnx` through the handles in this module; the old- // Vulkan `modelrunner` crate is deleted.- implementation(libs.onnxruntime.reduced.android)+ // On-device inference executor: full ONNX Runtime (the reduced 1.27.0-r1 rebuild lacks+ // Conv(11) and other vision ops; it returns as -r2 with the full op set).+ implementation(libs.onnxruntime.android) }
photos/src/main/java/com/vayunmathur/photos/ui/PhotoViewerActions.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoViewerActions.kt b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoViewerActions.ktindex 78ad0142ea..b67edd597c 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoViewerActions.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoViewerActions.kt@@ -1,6 +1,7 @@ package com.vayunmathur.photos.ui import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable@@ -20,7 +21,7 @@ import com.vayunmathur.photos.R * chrome that triggers it, so the viewer body keeps one public composable. */ @Composable-fun PhotoViewerActions(+fun BoxScope.PhotoViewerActions( isPanorama: Boolean, isSphere: Boolean, isMotionPhoto: Boolean,
translate/src/main/java/com/vayunmathur/translate/ui/CameraBinding.kt
diff --git a/translate/src/main/java/com/vayunmathur/translate/ui/CameraBinding.kt b/translate/src/main/java/com/vayunmathur/translate/ui/CameraBinding.ktindex 40972bf295..764e6f5573 100644--- a/translate/src/main/java/com/vayunmathur/translate/ui/CameraBinding.kt+++ b/translate/src/main/java/com/vayunmathur/translate/ui/CameraBinding.kt@@ -32,8 +32,6 @@ import com.vayunmathur.translate.platform.TranslateViewModel import kotlin.concurrent.atomics.AtomicBoolean import kotlin.concurrent.atomics.AtomicLong import kotlin.concurrent.atomics.ExperimentalAtomicApi-import kotlin.concurrent.atomics.load-import kotlin.concurrent.atomics.store import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay
translate/src/main/java/com/vayunmathur/translate/ui/CameraPreviewLayer.kt
diff --git a/translate/src/main/java/com/vayunmathur/translate/ui/CameraPreviewLayer.kt b/translate/src/main/java/com/vayunmathur/translate/ui/CameraPreviewLayer.ktindex 54df0247da..811db21f2e 100644--- a/translate/src/main/java/com/vayunmathur/translate/ui/CameraPreviewLayer.kt+++ b/translate/src/main/java/com/vayunmathur/translate/ui/CameraPreviewLayer.kt@@ -1,3 +1,5 @@+@file:OptIn(kotlin.concurrent.atomics.ExperimentalAtomicApi::class)+ package com.vayunmathur.translate.ui import androidx.compose.foundation.Image