Modern Apps git

← Modern-Apps.git

maps: start wear companion sync after the first frame

Commit
0482b875b6d1269c0d5cfa95831b94226cf01c60
Author
Vayun Mathur <[email protected]>
When
2026-12-05 18:26 UTC (18 hours ago)
Parents
cb8ee3b
WearMapsSync.start ran synchronously in onCreateBeforeContent
(conduit client registration before setContent), although the sync
is not first-frame content and stays idle when the Watch app is
absent. It now starts via MaActivity.deferAfterFirstFrame.
NetworkClient.init stays synchronous on purpose: the first tile
and search requests need the FIRST_PARTY trust factory, and an
async init would race them onto the uninitialised fallback.

Verified: :maps:lint :maps:lintVitalRelease :maps:testDevUnitTest pass.

Diff

maps/src/main/java/com/vayunmathur/maps/MainActivity.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/MainActivity.kt b/maps/src/main/java/com/vayunmathur/maps/MainActivity.ktindex 667dc64b51..62a1d20f1e 100644--- a/maps/src/main/java/com/vayunmathur/maps/MainActivity.kt+++ b/maps/src/main/java/com/vayunmathur/maps/MainActivity.kt@@ -114,7 +114,9 @@ class MainActivity : MaActivity() {         // app's job; see platform/WearMapsSync). With the Watch app         // absent the client reports NotInstalled/Unavailable and the         // sync stays idle; delivery is app-lifecycle-bound.-        com.vayunmathur.maps.platform.WearMapsSync.start(this)+        // Companion sync is not first-frame content (it stays idle with+        // the Watch app absent); start it once the first frame is drawn.+        deferAfterFirstFrame { com.vayunmathur.maps.platform.WearMapsSync.start(this) }         intentLauncher = IntentLauncher(this)         // Deferred off the startup path: neither the legacy-file delete nor         // the overlay-schedule check gates the first frame (the theme reads