From 4ffd4d874e122d6ab635e28d35d0e4051d2c143f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Sevilla?= <24dasemu@gmail.com> Date: Tue, 13 Oct 2026 09:48:19 +0000 Subject: [PATCH] feat: require precise GPS for imported routes and release 0.13.4 --- README.md | 6 ++- app/build.gradle.kts | 4 +- .../java/dev/navframe/app/MainActivity.kt | 7 +++- .../main/java/dev/navframe/app/TftService.kt | 2 +- .../dev/navframe/app/ImportedRouteTest.kt | 40 +++++++++++++++++++ 5 files changed, 53 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 78979af..129b11c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ NavFrame is an experimental Android navigation app that renders its own 480×240 The owner has confirmed static and synthetic NavFrame frames on a Xiaomi 11 Lite 5G NE running Android 14 and a 2026 Yamaha MT-07, and the bundled Asturias map working offline on the phone. On 2026-10-12, the owner reported that the latest version displayed the map on the TFT for about 20 minutes, then showed `Mapa no disponible` in La Corredoria (Oviedo) for the rest of the trip while the phone map continued working. An offline map was installed. The exact installed build, diagnostic code and background state were not recorded; the cause is under investigation. This establishes a successful map display followed by a persistent failure, not sustained TFT reliability. -The current checkout is version 0.13.1. The 0.13 series adds voice/routing language selection for Spanish, English, German, French, and Italian, plus a system-language option; unsupported system locales resolve to English. Speech still depends on the Android TextToSpeech engine and its installed voice data. The app includes offline map and place data for Asturias, plus installable regional packages. Worldwide regions can be discovered and built on demand through the [regional package workflow](docs/GLOBAL_OFFLINE.md); this is not complete worldwide coverage. Installed packages currently provide map and local place/camera data. Offline route calculation, global camera completeness, and complete worldwide font coverage are not provided. +The current checkout is version 0.13.4. The 0.13 series adds voice/routing language selection for Spanish, English, German, French, and Italian, plus a system-language option; unsupported system locales resolve to English. Speech still depends on the Android TextToSpeech engine and its installed voice data. The app includes offline map and place data for Asturias, plus installable regional packages. Worldwide regions can be discovered and built on demand through the [regional package workflow](docs/GLOBAL_OFFLINE.md); this is not complete worldwide coverage. Installed packages currently provide map and local place/camera data. Offline route calculation, global camera completeness, and complete worldwide font coverage are not provided. Route calculation and address search use configurable online services. Spoken output uses the selected language when Android provides voice data; voice availability and offline behavior depend on the device's TextToSpeech engine. Physical validation of route guidance, voice playback, camera alerts, sustained TFT map rendering, and a 30-minute screen-off session remains pending unless a newer test report says otherwise. @@ -39,6 +39,10 @@ Version 0.13.2 automatically saves the latest 100 TFT map failures and recoverie GitHub Actions uploads a debug APK artifact for pushes to `development`. Pushes to `main` publish a signed production APK release after build, tests, lint and signature checks pass. Production signing requires the repository secrets described in [Android builds and releases](docs/ANDROID_RELEASES.md). Pull requests run checks without publishing releases. +## Imported routes + +Choose **☰ → Cargar ruta GPX** to load a standard GPX route or track and start following it once precise GPS is available. Imported traces retain their geometry without online recalculation or invented turn announcements. See [GPX import](docs/IMPORTED_ROUTES.md). + ## Documentation - [Documentation index](docs/README.md) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ded0b2d..3860d60 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,8 +15,8 @@ android { applicationId = "dev.navframe.app" minSdk = 26 targetSdk = 35 - versionName = "0.13.3" - versionCode = 19 + versionName = "0.13.4" + versionCode = 20 } if (hasReleaseSigning) { signingConfigs.create("production") { diff --git a/app/src/main/java/dev/navframe/app/MainActivity.kt b/app/src/main/java/dev/navframe/app/MainActivity.kt index 25be8c6..b9b6d49 100644 --- a/app/src/main/java/dev/navframe/app/MainActivity.kt +++ b/app/src/main/java/dev/navframe/app/MainActivity.kt @@ -387,14 +387,17 @@ open class MainActivity : Activity() { val current = service ?: return if (!current.preparedRouteIsImported()) { hint.text = "Vuelve a cargar la ruta GPX"; return } positionWait?.cancel() - if (current.hasFreshGpsFix()) { perform(Action.ROUTE); return } + if (current.hasGuidanceGpsFix()) { perform(Action.ROUTE); return } current.setPhoneVisible(true) hint.text = "Esperando GPS preciso para iniciar el GPX…" routeLoading?.visibility = View.VISIBLE startButton?.isEnabled = false positionWait = scope.launch { try { - withTimeout(60_000) { current.gpsReady.first { it && current.hasFreshGpsFix() } } + withTimeout(60_000) { + // Map readiness stays true while accuracy improves from 100 m to 25 m. + while (!current.hasGuidanceGpsFix()) delay(200) + } ensureActive() if (current.preparedRouteIsImported()) perform(Action.ROUTE) } catch (_: TimeoutCancellationException) { hint.text = "Sin GPS preciso · activa ubicación y pulsa Iniciar navegación de nuevo" } diff --git a/app/src/main/java/dev/navframe/app/TftService.kt b/app/src/main/java/dev/navframe/app/TftService.kt index 08a48ce..168fac5 100644 --- a/app/src/main/java/dev/navframe/app/TftService.kt +++ b/app/src/main/java/dev/navframe/app/TftService.kt @@ -723,7 +723,7 @@ class TftService : Service() { fun isGpsSessionActive(): Boolean = gpsRequested fun hasFreshGpsFix(): Boolean = usableGpsFix(AndroidLocationProvider.MAP_ACCURACY_METERS) fun usesCompassHeading(): Boolean = (locationProvider ?: visibleGpsProvider)?.headingFromCompass == true - private fun hasGuidanceGpsFix(): Boolean = usableGpsFix(AndroidLocationProvider.GUIDANCE_ACCURACY_METERS) + fun hasGuidanceGpsFix(): Boolean = usableGpsFix(AndroidLocationProvider.GUIDANCE_ACCURACY_METERS) private fun usableGpsFix(maxAccuracy: Float): Boolean = lastGpsFix?.let { it.accuracyMeters.isFinite() && it.accuracyMeters in 0f..maxAccuracy && SystemClock.elapsedRealtime() - lastGpsElapsed in 0..15_000 && (locationProvider?.providerEnabled?.value == true || (phoneVisible && visibleGpsProvider?.providerEnabled?.value == true)) } == true private fun stopVisibleGps() { visibleGpsJob?.cancel(); visibleGpsJob = null diff --git a/app/src/test/java/dev/navframe/app/ImportedRouteTest.kt b/app/src/test/java/dev/navframe/app/ImportedRouteTest.kt index 4f04f56..037f9f3 100644 --- a/app/src/test/java/dev/navframe/app/ImportedRouteTest.kt +++ b/app/src/test/java/dev/navframe/app/ImportedRouteTest.kt @@ -157,4 +157,44 @@ class ImportedRouteTest { } finally { activityController.destroy(); serviceController.destroy() } } + @Test fun importedStartWaitsForGuidanceAccuracyEvenWhenMapReadinessStaysTrue() { + val activityController = Robolectric.buildActivity(PhoneWithoutGpu::class.java).create() + val serviceController = Robolectric.buildService(TftService::class.java).create() + val activity = activityController.get() + val service = serviceController.get() + service.mapRenderOverride = { _, _ -> TftFrame(encodedBytes = byteArrayOf(1), timestampMs = 0) } + try { + val application = RuntimeEnvironment.getApplication() + shadowOf(application).grantPermissions(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION) + field("service").set(activity, service) + val manager = application.getSystemService(LocationManager::class.java) + shadowOf(manager).setProviderEnabled(LocationManager.GPS_PROVIDER, true) + service.prepareImportedRoute(imported()); tick() + service.setPhoneVisible(true); tick() + fun fix(accuracy: Float) { + shadowOf(manager).simulateLocation(Location(LocationManager.GPS_PROVIDER).apply { + latitude = 43.36; longitude = -5.85; this.accuracy = accuracy + time = System.currentTimeMillis(); elapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos() + }) + tick() + } + fix(80f) + assertTrue(service.gpsReady.value) + assertTrue(service.hasFreshGpsFix()) + assertFalse(service.hasGuidanceGpsFix()) + MainActivity::class.java.getDeclaredMethod("startImportedRoute").apply { isAccessible = true }.invoke(activity) + val pending = field("positionWait").get(activity) as kotlinx.coroutines.Job + shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(600)) + assertTrue(pending.isActive) + assertNull(shadowOf(activity).nextStartedService) + assertFalse(service.hasActiveGuidance()) + fix(20f) + assertTrue(service.gpsReady.value) + assertTrue(service.hasGuidanceGpsFix()) + shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(400)) + assertTrue(pending.isCompleted) + assertEquals(TftService.ACTION_ROUTE_GPS, shadowOf(activity).nextStartedService.action) + } finally { activityController.destroy(); serviceController.destroy() } + } + }