Modern Apps git

← Modern-Apps.git

library: findfamily wear protocol moves into wearlink, test pair unified

Commit
f207b5d265cac03bbc8864c086f2db2ad998b695
Author
Vayun Mathur <[email protected]>
When
2026-12-01 17:33 UTC (4 days ago)
Parents
9121c13
LOC Phase 2. Main copies verified identical modulo
package; moved to com.vayunmathur.library.wearlink.
findfamily, both app copies deleted, consumers rewired
(zero old-FQN protocol hits afterwards; WearRelative
correctly stayed wear-side, with one smart-cast adaptation
the module boundary forced).

The diverged test pair is unified first, per the audit:
six protocol tests ported/expanded to the phone suite
(6 -> 12: round-trips, field caps, region centring,
completeness, staleness/relative/motion split out), while
three genuinely wear-only WearRelative tests stay
wear-side (15 = same 12 + 3). Net -178 lines (dedup alone
-311). Verified: wearlink 9/9, wear 15/15, phone protocol
12/12 and full findfamily 354 tests, compiles/assembles/
screenshot compiles; structure_check wear: 3 pairs remain
(camera, communicate, todo). findfamily lint red only on
pre-existing errors in unmodified files.

Diff

docs/structure/wear-protocol-pairs.tsv
diff --git a/docs/structure/wear-protocol-pairs.tsv b/docs/structure/wear-protocol-pairs.tsvindex db43921966..63e69e25cb 100644--- a/docs/structure/wear-protocol-pairs.tsv+++ b/docs/structure/wear-protocol-pairs.tsv@@ -14,8 +14,8 @@ # (com.vayunmathur.library.wearlink.notes), maps # (com.vayunmathur.library.wearlink.maps), appstore # (com.vayunmathur.library.wearlink.appstore), contacts-# (com.vayunmathur.library.wearlink.contacts).+# (com.vayunmathur.library.wearlink.contacts), findfamily+# (com.vayunmathur.library.wearlink.findfamily). camera	camera/src/main/java/com/vayunmathur/camera/domain/WearCameraProtocol.kt	camera-wear/src/main/java/com/vayunmathur/camera/wear/domain/WearCameraProtocol.kt communicate	communicate/src/main/java/com/vayunmathur/communicate/domain/WearCommunicateProtocol.kt	communicate-wear/src/main/java/com/vayunmathur/communicate/wear/domain/WearCommunicateProtocol.kt-findfamily	findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocol.kt	findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocol.kt todo	todo/src/main/java/com/vayunmathur/todo/domain/WearTodoProtocol.kt	todo-wear/src/main/java/com/vayunmathur/todo/wear/domain/WearTodoProtocol.kt
findfamily-wear/AGENTS.md
diff --git a/findfamily-wear/AGENTS.md b/findfamily-wear/AGENTS.mdindex b7679e59be..6547912aa6 100644--- a/findfamily-wear/AGENTS.md+++ b/findfamily-wear/AGENTS.md@@ -16,9 +16,12 @@ certificate on both sides, so changing either breaks phone<->watch sync. Bootstrap is a one-time ADB sideload of this APK onto the watch.  ## Protocol-`domain/WearFindFamilyProtocol.kt` is a copy of the phone's file (Gradle-cannot depend on another app module). Change both copies together; each-side's `WearFindFamilyProtocolTest` pins the same golden JSON.+The wire protocol lives in `:library:wearlink` at+`com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol` (shared by+`:findfamily` and `:findfamily-wear`; neither app module depends on the other).+Each side's `WearFindFamilyProtocolTest` pins the same golden JSON against+that shared code. Wear-only presentation helpers stay in+`domain/WearRelative.kt`.  - Snapshot: WearLink data item (`/findfamily/snapshot`, phone -> watch) —   ALL people in the circle as location summaries (place label, E7 coord,
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.ktindex 4755ee0b6f..20cb3a3091 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.kt+++ b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.kt@@ -1,8 +1,8 @@ package com.vayunmathur.findfamily.wear.data  import android.content.Context-import com.vayunmathur.findfamily.wear.domain.WearFindFamilyProtocol-import com.vayunmathur.findfamily.wear.domain.WearFindFamilySnapshot+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot import com.vayunmathur.library.log.Log import java.io.File import kotlinx.coroutines.flow.MutableStateFlow
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocol.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocol.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocol.ktdeleted file mode 100644index 83f8c51ce5..0000000000--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocol.kt+++ /dev/null@@ -1,308 +0,0 @@-package com.vayunmathur.findfamily.wear.domain--import kotlinx.serialization.Serializable-import kotlinx.serialization.encodeToString-import kotlinx.serialization.json.Json-import kotlin.math.atan2-import kotlin.math.cos-import kotlin.math.sin-import kotlin.math.sqrt--/**- * Phone <-> watch protocol for the Wear OS FindFamily companion.- *- * SINGLE SOURCE OF TRUTH, DELIBERATELY DUPLICATED: Gradle cannot let one- * application module depend on another, so the wear module- * (`:findfamily-wear`, applicationId `com.vayunmathur.findfamily`) carries- * a copy of this file under `com.vayunmathur.findfamily.wear.domain`.- * Change both copies together; each side's unit tests pin the same golden- * JSON so a one-sided edit fails loudly.- *- * Transport (WearLink, :library:wearlink — RFCOMM, no Play services):- * - Presence is a completed handshake for [CAPABILITY] (the appId).- * - Data items: [SNAPSHOT_PATH] phone -> watch (all-people location- *   summaries) and [WATCH_STATE_PATH] watch -> phone.- * - Messages: [OP_PATH] watch -> phone (stop-sharing / request-refresh)- *   and [REQUEST_SYNC_PATH] watch -> phone (ask for a fresh snapshot).- *   Delivery needs a live session; nothing wakes a dead phone process.- *- * Owner rule: the watch shows ALL people in the phone circle. The payload- * is bounded by summarising (short labels, E7 coordinates, no history),- * never by a top-N people cap in normal operation. Only if the byte cap- * still cannot fit everyone does [buildWearSnapshot] drop the- * least-recently-updated people, and then it says so honestly via- * `truncated` + `droppedCount`, keeping most-recent first.- *- * Privacy: a person entry is exactly what the phone's own cards show —- * current place label, current coordinate at E7 precision, fix/report- * times, accuracy, speed-derived motion, battery. No location history,- * no track, no keys, no pair ids. E2EE stays phone-side: the phone- * decrypts peer reports into its Room store and only these already-- * decrypted summaries cross WearLink (Bluetooth-bonded, cert-bound).- */-object WearFindFamilyProtocol {-    /** WearLink appId the phone requires in the peer handshake. */-    const val CAPABILITY = "findfamily_wear_companion"--    /** Data-item path (phone -> watch): the [WearFindFamilySnapshot] JSON. */-    const val SNAPSHOT_PATH = "/findfamily/snapshot"--    /** Data-item path (watch -> phone): the [WearWatchState] JSON. */-    const val WATCH_STATE_PATH = "/findfamily/watch-state"--    /** Message path (watch -> phone): one [WearFindFamilyOp] JSON. */-    const val OP_PATH = "/findfamily/op"--    /** Message path (watch -> phone): ask the phone to publish a fresh snapshot. */-    const val REQUEST_SYNC_PATH = "/findfamily/request-sync"--    /** Largest snapshot JSON in UTF-8 bytes; summarise/drop-oldest to fit. */-    const val MAX_JSON_BYTES = 90_000--    /** Field caps applied when a snapshot is built. */-    const val MAX_NAME_CHARS = 60-    const val MAX_PLACE_CHARS = 80--    /** Tighter caps used as the first summarising step before anyone is dropped. */-    const val SUMMARISED_NAME_CHARS = 24-    const val SUMMARISED_PLACE_CHARS = 24--    /** A fix older than this (watch clock vs fix time) reads stale, never live. */-    const val STALE_AFTER_MS = 30 * 60_000L--    /** Speed (m/s) at/above which a person counts as moving for the watch summary. */-    const val MOVING_SPEED_MPS = 1.0--    /** Wire JSON: unknown keys ignored so a newer side never breaks an older one. */-    val json: Json = Json { ignoreUnknownKeys = true }-}--/** Motion summary derived phone-side from the fix's reported speed. */-@Serializable-enum class WearMotion { MOVING, STATIONARY, UNKNOWN }--/** Kind of watch-readable alert state carried in a snapshot. */-@Serializable-enum class WearAlertKind { AT_PLACE, NOSHOW }--/** One person trimmed to watch size: the phone card, summarised. No history. */-@Serializable-data class WearPerson(-    val id: Long,-    val name: String,-    /** Saved-place/locality label the phone UI shows ("Home"), "" when unnamed. */-    val placeLabel: String = "",-    /** When the person arrived at [placeLabel] (phone `lastLocationChangeTime`), 0 unknown. */-    val placeSinceMillis: Long = 0L,-    /** Current coordinate, degrees * 1e7 (the precision the phone map shows); null = no fix. */-    val latE7: Int? = null,-    val lonE7: Int? = null,-    /** Fix accuracy radius (m); -1 when the source gives none (e.g. network sighting). */-    val accuracyMeters: Int = -1,-    /** When the position was measured (epoch millis); 0 = no fix. */-    val updatedAtMillis: Long = 0L,-    /** When the report was sent; differs from measured time on parting reports. */-    val reportedAtMillis: Long = 0L,-    /** Battery percent 0..100; -1 when unavailable (incl. network sightings). */-    val batteryPercent: Int = -1,-    val motion: WearMotion = WearMotion.UNKNOWN,-    /** Wire source name (LIVE/SHUTDOWN/BATTERY_LOW/NETWORK_SIGHTING); "" when no fix. */-    val source: String = "",-    /** Whether the phone is sharing this device's location with this person. */-    val sharingEnabled: Boolean = true,-    val isSelf: Boolean = false,-)--/**- * Watch-readable alert state. The phone persists current place + since- * (not an enter/leave event log), so AT_PLACE is the honest enter state;- * NOSHOW mirrors the phone's no-show rows (pending and fired).- */-@Serializable-data class WearAlert(-    val kind: WearAlertKind,-    val personId: Long,-    val placeLabel: String = "",-    val atMillis: Long = 0L,-    val fired: Boolean = false,-)--/** Bounded region around the snapshot centre with everyone's markers relative to it. */-@Serializable-data class WearRegion(-    val centerLatE7: Int = 0,-    val centerLonE7: Int = 0,-    /** Radius (m) covering centre -> farthest located person, clamped for rendering. */-    val radiusM: Int = 200,-    val hasCenter: Boolean = false,-)--/** The phone's all-people snapshot for the watch ([WearFindFamilyProtocol.SNAPSHOT_PATH]). */-@Serializable-data class WearFindFamilySnapshot(-    val generatedAtMillis: Long = 0L,-    /** Every person in the circle, most recently updated first. */-    val people: List<WearPerson> = emptyList(),-    val alerts: List<WearAlert> = emptyList(),-    /** Global sharing switch on the phone (Quick Settings tile semantics). */-    val sharingEnabled: Boolean = true,-    val region: WearRegion = WearRegion(),-    /** True only when the byte cap forced people out; see [droppedCount]. */-    val truncated: Boolean = false,-    val droppedCount: Int = 0,-    /** People before any cap drop, so the watch can state the full circle size. */-    val totalPeople: Int = 0,-)--/** What the watch last applied, published at [WearFindFamilyProtocol.WATCH_STATE_PATH]. */-@Serializable-data class WearWatchState(-    val appliedGeneratedAtMillis: Long = 0L,-    val peopleCount: Int = 0,-)--/** Watch-originated actions; the phone remains the source of truth for both. */-@Serializable-enum class WearOpKind { STOP_SHARING_NOW, REQUEST_REFRESH }--/** One watch-originated action, as [WearFindFamilyProtocol.OP_PATH]. */-@Serializable-data class WearFindFamilyOp(-    val kind: WearOpKind,-    val requestedAtMillis: Long = 0L,-)--/** Motion from reported speed; no speed (or a sighting) is honestly UNKNOWN. */-fun wearMotionFor(speedMps: Float?, hasFix: Boolean): WearMotion = when {-    !hasFix || speedMps == null || !speedMps.isFinite() -> WearMotion.UNKNOWN-    speedMps >= WearFindFamilyProtocol.MOVING_SPEED_MPS -> WearMotion.MOVING-    else -> WearMotion.STATIONARY-}--/** True when a person's fix is missing or older than the stale window. */-fun wearIsStale(person: WearPerson, nowMillis: Long): Boolean =-    person.updatedAtMillis <= 0L || nowMillis - person.updatedAtMillis > WearFindFamilyProtocol.STALE_AFTER_MS--/** True when the whole snapshot has aged out (offline reading must label it). */-fun wearSnapshotIsStale(snapshot: WearFindFamilySnapshot?, nowMillis: Long): Boolean =-    snapshot == null || nowMillis - snapshot.generatedAtMillis > WearFindFamilyProtocol.STALE_AFTER_MS--/** Haversine distance (m) between two E7 positions. */-fun wearDistanceMeters(lat1E7: Int, lon1E7: Int, lat2E7: Int, lon2E7: Int): Double {-    val r = 6_371_000.0-    val dLat = Math.toRadians((lat2E7 - lat1E7) / 1e7)-    val dLon = Math.toRadians((lon2E7 - lon1E7) / 1e7)-    val a = sin(dLat / 2) * sin(dLat / 2) +-        cos(Math.toRadians(lat1E7 / 1e7)) * cos(Math.toRadians(lat2E7 / 1e7)) *-        sin(dLon / 2) * sin(dLon / 2)-    return 2 * r * kotlin.math.asin(sqrt(a.coerceIn(0.0, 1.0)))-}--/** Initial bearing (degrees clockwise from north, 0..359) from first E7 point to second. */-fun wearBearingDegrees(lat1E7: Int, lon1E7: Int, lat2E7: Int, lon2E7: Int): Int {-    val lat1 = Math.toRadians(lat1E7 / 1e7)-    val lat2 = Math.toRadians(lat2E7 / 1e7)-    val dLon = Math.toRadians((lon2E7 - lon1E7) / 1e7)-    val y = sin(dLon) * cos(lat2)-    val x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dLon)-    val deg = Math.toDegrees(atan2(y, x))-    return ((deg % 360.0) + 360.0).toInt() % 360-}--/** 8-wind compass label for a bearing ("N", "NE", ...). */-fun wearCompass(bearingDeg: Int): String {-    val winds = arrayOf("N", "NE", "E", "SE", "S", "SW", "W", "NW")-    return winds[(((bearingDeg % 360) + 360) % 360 + 22) / 45 % 8]-}--/** Metres east/north of an origin for a target E7 position (relative-view math). */-fun wearRelativeOffsetMeters(-    originLatE7: Int,-    originLonE7: Int,-    latE7: Int,-    lonE7: Int,-): Pair<Double, Double> {-    val east = (lonE7 - originLonE7) / 1e7 * 111_320.0 * cos(Math.toRadians(originLatE7 / 1e7))-    val north = (latE7 - originLatE7) / 1e7 * 110_540.0-    return east to north-}--/** Region centred on self (else first located person) covering every located person. */-fun wearRegionFor(people: List<WearPerson>): WearRegion {-    val located = people.filter { it.latE7 != null && it.lonE7 != null }-    if (located.isEmpty()) return WearRegion()-    val centre = located.firstOrNull { it.isSelf } ?: located.first()-    val maxDist = located.maxOf {-        wearDistanceMeters(centre.latE7!!, centre.lonE7!!, it.latE7!!, it.lonE7!!)-    }-    return WearRegion(-        centerLatE7 = centre.latE7!!,-        centerLonE7 = centre.lonE7!!,-        radiusM = maxDist.toInt().coerceIn(200, 100_000),-        hasCenter = true,-    )-}--/**- * Builds the all-people snapshot: most-recently-updated first, field caps- * applied, then — only to fit [WearFindFamilyProtocol.MAX_JSON_BYTES] —- * tighter summarising, and only then dropping least-recent people with- * `truncated`/`droppedCount` set. Normal circles lose nobody. Alerts are- * kept only for people present in the snapshot (an alert the watch cannot- * attribute to a named person is dropped, not rendered nameless).- */-fun buildWearSnapshot(-    candidates: List<WearPerson>,-    alerts: List<WearAlert> = emptyList(),-    sharingEnabled: Boolean = true,-    generatedAtMillis: Long,-): WearFindFamilySnapshot {-    val sorted = candidates.sortedWith(-        compareByDescending<WearPerson> { it.updatedAtMillis }.thenBy { it.id },-    ).map {-        it.copy(-            name = it.name.take(WearFindFamilyProtocol.MAX_NAME_CHARS),-            placeLabel = it.placeLabel.take(WearFindFamilyProtocol.MAX_PLACE_CHARS),-        )-    }-    fun snap(people: List<WearPerson>, dropped: Int): WearFindFamilySnapshot {-        val keptIds = people.mapTo(HashSet()) { it.id }-        return WearFindFamilySnapshot(-            generatedAtMillis = generatedAtMillis,-            people = people,-            // An alert is only meaningful beside its person: drop alerts-            // whose person was capped out (or was never a candidate), so-            // the watch never renders an alert it cannot attribute, and-            // shrinking people also shrinks the payload toward the cap.-            alerts = alerts.filter { it.personId in keptIds }.map {-                it.copy(placeLabel = it.placeLabel.take(WearFindFamilyProtocol.MAX_PLACE_CHARS))-            },-            sharingEnabled = sharingEnabled,-            region = wearRegionFor(people),-            truncated = dropped > 0,-            droppedCount = dropped,-            totalPeople = sorted.size,-        )-    }-    var kept = sorted-    var snapshot = snap(kept, 0)-    if (WearFindFamilyProtocol.json.encodeToString(snapshot).encodeToByteArray().size <=-        WearFindFamilyProtocol.MAX_JSON_BYTES-    ) return snapshot-    // Summarise harder before dropping anyone.-    kept = kept.map {-        it.copy(-            name = it.name.take(WearFindFamilyProtocol.SUMMARISED_NAME_CHARS),-            placeLabel = it.placeLabel.take(WearFindFamilyProtocol.SUMMARISED_PLACE_CHARS),-        )-    }-    snapshot = snap(kept, 0)-    while (kept.isNotEmpty() &&-        WearFindFamilyProtocol.json.encodeToString(snapshot).encodeToByteArray().size >-        WearFindFamilyProtocol.MAX_JSON_BYTES-    ) {-        kept = kept.dropLast(1)-        snapshot = snap(kept, sorted.size - kept.size)-    }-    return snapshot-}
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.ktindex 00ee6133ac..99f08950ef 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.kt+++ b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.kt@@ -1,5 +1,10 @@ package com.vayunmathur.findfamily.wear.domain +import com.vayunmathur.library.wearlink.findfamily.WearPerson+import com.vayunmathur.library.wearlink.findfamily.wearBearingDegrees+import com.vayunmathur.library.wearlink.findfamily.wearCompass+import com.vayunmathur.library.wearlink.findfamily.wearDistanceMeters+import com.vayunmathur.library.wearlink.findfamily.wearIsStale import kotlin.math.sqrt  /** Human distance summary: metres under 1 km, one-decimal km beyond. */@@ -32,10 +37,13 @@ fun wearStaleLabel(person: WearPerson, nowMillis: Long): String =  /** Distance + compass summary from self to [person]; "" when either end lacks a fix. */ fun wearDistanceSummary(self: WearPerson?, person: WearPerson): String {-    if (self == null || self.latE7 == null || self.lonE7 == null) return ""-    if (person.latE7 == null || person.lonE7 == null || person.isSelf) return ""-    val dist = wearDistanceMeters(self.latE7, self.lonE7, person.latE7, person.lonE7)-    val bearing = wearBearingDegrees(self.latE7, self.lonE7, person.latE7, person.lonE7)+    val selfLat = self?.latE7 ?: return ""+    val selfLon = self.lonE7 ?: return ""+    val personLat = person.latE7 ?: return ""+    val personLon = person.lonE7 ?: return ""+    if (person.isSelf) return ""+    val dist = wearDistanceMeters(selfLat, selfLon, personLat, personLon)+    val bearing = wearBearingDegrees(selfLat, selfLon, personLat, personLon)     return "${wearFormatDistance(dist)} ${wearCompass(bearing)}" } 
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.ktindex 9f47469f66..c79331ab1f 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.kt+++ b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.kt@@ -2,11 +2,11 @@ package com.vayunmathur.findfamily.wear.sync  import android.content.Context import com.vayunmathur.findfamily.wear.data.WearFindFamilyStore-import com.vayunmathur.findfamily.wear.domain.WearFindFamilyOp-import com.vayunmathur.findfamily.wear.domain.WearFindFamilyProtocol-import com.vayunmathur.findfamily.wear.domain.WearFindFamilySnapshot-import com.vayunmathur.findfamily.wear.domain.WearOpKind-import com.vayunmathur.findfamily.wear.domain.WearWatchState+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyOp+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot+import com.vayunmathur.library.wearlink.findfamily.WearOpKind+import com.vayunmathur.library.wearlink.findfamily.WearWatchState import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkNode
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.ktindex 2bb20c5f28..d682c04a43 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.kt+++ b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.kt@@ -20,8 +20,9 @@ import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.Text import com.vayunmathur.findfamily.wear.R import com.vayunmathur.findfamily.wear.data.WearFindFamilyStore+import com.vayunmathur.library.wearlink.findfamily.wearSnapshotIsStale import com.vayunmathur.findfamily.wear.domain.wearFormatDistance-import com.vayunmathur.findfamily.wear.domain.wearSnapshotIsStale+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot  /**  * All-people relative map: every located person plotted around the@@ -43,7 +44,7 @@ fun WearAllMapScreen( /** Stateless all-map behind [WearAllMapScreen]: snapshot/connection/instant are parameters for previews. */ @Composable internal fun WearAllMapContent(-    snapshot: com.vayunmathur.findfamily.wear.domain.WearFindFamilySnapshot,+    snapshot: WearFindFamilySnapshot,     connected: Boolean,     nowMillis: Long,     onOpenPerson: (Long) -> Unit,
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.ktindex b3d03a3508..a7a25570d5 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.kt+++ b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.kt@@ -23,11 +23,12 @@ import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.Text import com.vayunmathur.findfamily.wear.R import com.vayunmathur.findfamily.wear.data.WearFindFamilyStore-import com.vayunmathur.findfamily.wear.domain.WearAlertKind-import com.vayunmathur.findfamily.wear.domain.WearMotion+import com.vayunmathur.library.wearlink.findfamily.WearAlertKind+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot+import com.vayunmathur.library.wearlink.findfamily.WearMotion+import com.vayunmathur.library.wearlink.findfamily.wearSnapshotIsStale import com.vayunmathur.findfamily.wear.domain.wearAgeLabel import com.vayunmathur.findfamily.wear.domain.wearDistanceSummary-import com.vayunmathur.findfamily.wear.domain.wearSnapshotIsStale import com.vayunmathur.findfamily.wear.domain.wearStaleLabel import com.vayunmathur.findfamily.wear.sync.WearLinkBridge import kotlinx.coroutines.launch@@ -53,7 +54,7 @@ fun WearPeopleScreen( /** Stateless people home behind [WearPeopleScreen]: snapshot/connection/instant are parameters for previews. */ @Composable internal fun WearPeopleContent(-    snapshot: com.vayunmathur.findfamily.wear.domain.WearFindFamilySnapshot,+    snapshot: WearFindFamilySnapshot,     connected: Boolean,     nowMillis: Long,     onOpenPerson: (Long) -> Unit,
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.ktindex fc3e091b26..de9a97c50a 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.kt+++ b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.kt@@ -19,10 +19,11 @@ import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.Text import com.vayunmathur.findfamily.wear.R import com.vayunmathur.findfamily.wear.data.WearFindFamilyStore-import com.vayunmathur.findfamily.wear.domain.WearMotion+import com.vayunmathur.library.wearlink.findfamily.WearMotion+import com.vayunmathur.library.wearlink.findfamily.WearPerson+import com.vayunmathur.library.wearlink.findfamily.wearRegionFor import com.vayunmathur.findfamily.wear.domain.wearAgeLabel import com.vayunmathur.findfamily.wear.domain.wearDistanceSummary-import com.vayunmathur.findfamily.wear.domain.wearRegionFor import com.vayunmathur.findfamily.wear.domain.wearStaleLabel  /**@@ -46,8 +47,8 @@ fun WearPersonScreen( /** Stateless person detail behind [WearPersonScreen]: person/self/instant are parameters for previews. */ @Composable internal fun WearPersonContent(-    person: com.vayunmathur.findfamily.wear.domain.WearPerson?,-    self: com.vayunmathur.findfamily.wear.domain.WearPerson?,+    person: WearPerson?,+    self: WearPerson?,     nowMillis: Long,     onBack: () -> Unit, ) {
findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.kt b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.ktindex 85b8b8baad..60eab9012f 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.kt+++ b/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.kt@@ -6,10 +6,11 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color-import com.vayunmathur.findfamily.wear.domain.WearPerson-import com.vayunmathur.findfamily.wear.domain.WearRegion+import com.vayunmathur.library.wearlink.findfamily.WearPerson+import com.vayunmathur.library.wearlink.findfamily.WearRegion+import com.vayunmathur.library.wearlink.findfamily.wearIsStale+import com.vayunmathur.library.wearlink.findfamily.wearRelativeOffsetMeters import com.vayunmathur.findfamily.wear.domain.WearRelativeProjection-import com.vayunmathur.findfamily.wear.domain.wearRelativeOffsetMeters  private val CentreColor = Color(0xFF4DA3FF) private val PersonColor = Color(0xFF7EE081)@@ -60,7 +61,7 @@ fun WearRelativeCanvas(                 north *= scale             }             val (x, y) = projection.project(east, north)-            val stale = com.vayunmathur.findfamily.wear.domain.wearIsStale(person, nowMillis)+            val stale = wearIsStale(person, nowMillis)             val isCentre = person.isSelf             val highlighted = person.id == highlightId             val radius = when {
findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.kt
diff --git a/findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.kt b/findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.ktindex 89dc78ecab..ce38a19fc7 100644--- a/findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.kt+++ b/findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.kt@@ -10,10 +10,10 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.tooling.preview.Preview import androidx.wear.compose.material.MaterialTheme import com.android.tools.screenshot.PreviewTest-import com.vayunmathur.findfamily.wear.domain.WearFindFamilySnapshot-import com.vayunmathur.findfamily.wear.domain.WearMotion-import com.vayunmathur.findfamily.wear.domain.WearPerson-import com.vayunmathur.findfamily.wear.domain.WearRegion+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot+import com.vayunmathur.library.wearlink.findfamily.WearMotion+import com.vayunmathur.library.wearlink.findfamily.WearPerson+import com.vayunmathur.library.wearlink.findfamily.WearRegion  /** Round watch, 454x454px class (227dp at 320dpi). */ private const val ROUND = "spec:width=227dp,height=227dp,dpi=320"
findfamily-wear/src/test/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocolTest.kt
diff --git a/findfamily-wear/src/test/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocolTest.kt b/findfamily-wear/src/test/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocolTest.ktindex 5679333a6b..a7ed37f63b 100644--- a/findfamily-wear/src/test/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocolTest.kt+++ b/findfamily-wear/src/test/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocolTest.kt@@ -1,5 +1,23 @@ package com.vayunmathur.findfamily.wear.domain +import com.vayunmathur.library.wearlink.findfamily.WearAlert+import com.vayunmathur.library.wearlink.findfamily.WearAlertKind+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyOp+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot+import com.vayunmathur.library.wearlink.findfamily.WearMotion+import com.vayunmathur.library.wearlink.findfamily.WearOpKind+import com.vayunmathur.library.wearlink.findfamily.WearPerson+import com.vayunmathur.library.wearlink.findfamily.WearRegion+import com.vayunmathur.library.wearlink.findfamily.buildWearSnapshot+import com.vayunmathur.library.wearlink.findfamily.wearBearingDegrees+import com.vayunmathur.library.wearlink.findfamily.wearCompass+import com.vayunmathur.library.wearlink.findfamily.wearDistanceMeters+import com.vayunmathur.library.wearlink.findfamily.wearIsStale+import com.vayunmathur.library.wearlink.findfamily.wearMotionFor+import com.vayunmathur.library.wearlink.findfamily.wearRegionFor+import com.vayunmathur.library.wearlink.findfamily.wearRelativeOffsetMeters+import com.vayunmathur.library.wearlink.findfamily.wearSnapshotIsStale import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse@@ -156,7 +174,6 @@ class WearFindFamilyProtocolTest {         assertFalse(wearIsStale(fresh, now))         assertTrue(wearIsStale(fresh, now + 1L))         assertTrue(wearIsStale(person(2L, 0L), now))-        assertEquals("Stale · 31m ago", wearStaleLabel(fresh, now + 60_000L))         assertTrue(wearSnapshotIsStale(WearFindFamilySnapshot(generatedAtMillis = 0L), now))         assertFalse(wearSnapshotIsStale(WearFindFamilySnapshot(generatedAtMillis = now), now))     }@@ -173,12 +190,6 @@ class WearFindFamilyProtocolTest {         assertEquals("NE", wearCompass(45))         val (east, northM) = wearRelativeOffsetMeters(0, 0, 0, 100_000)         assertTrue(east in 1_100.0..1_125.0 && northM == 0.0, "offset $east/$northM")-        val projection = WearRelativeProjection(200f, 200f, 100)-        assertEquals(100f to 100f, projection.project(0.0, 0.0))-        assertEquals(200f to 100f, projection.project(100.0, 0.0))-        assertEquals(100f to 0f, projection.project(0.0, 100.0))-        assertTrue(projection.inside(60.0, 60.0))-        assertFalse(projection.inside(90.0, 90.0))     }      @Test@@ -200,6 +211,23 @@ class WearFindFamilyProtocolTest {         assertEquals(WearRegion(), wearRegionFor(listOf(person(3L, 1L).copy(latE7 = null, lonE7 = null))))     } +    @Test+    fun staleLabelWording() {+        val fresh = person(1L, 1_000_000L)+        val now = 1_000_000L + WearFindFamilyProtocol.STALE_AFTER_MS+        assertEquals("Stale · 31m ago", wearStaleLabel(fresh, now + 60_000L))+    }++    @Test+    fun relativeProjection() {+        val projection = WearRelativeProjection(200f, 200f, 100)+        assertEquals(100f to 100f, projection.project(0.0, 0.0))+        assertEquals(200f to 100f, projection.project(100.0, 0.0))+        assertEquals(100f to 0f, projection.project(0.0, 100.0))+        assertTrue(projection.inside(60.0, 60.0))+        assertFalse(projection.inside(90.0, 90.0))+    }+     @Test     fun distanceSummaryAndAge() {         val self = person(1L, 100L).copy(isSelf = true)
findfamily/AGENTS.md
diff --git a/findfamily/AGENTS.md b/findfamily/AGENTS.mdindex ac75d57c96..8d7f09c365 100644--- a/findfamily/AGENTS.md+++ b/findfamily/AGENTS.md@@ -6,7 +6,7 @@ _Install: ./install findfamily (dev by default)._ - Gradle: :findfamily / dir: findfamily/ - Package roots present: ui, data, domain, platform, intents, service - Entry files: MainActivity.kt (no Route.kt — `Route` + `Navigation` are inline)-- Deps: :library:network, :library:e2ee-p2p, :library:room, :library:work, :library:image, :library:map, :library:aosp-stubs+- Deps: :library:network, :library:e2ee-p2p, :library:room, :library:work, :library:image, :library:map, :library:aosp-stubs, :library:wearlink - Metadata: metadata_data/findfamily.md (present) - Rust: no / screenshotTest: yes @@ -48,6 +48,8 @@ WebSocket relay host: `wss://api.maproj.org/api/ws` (Cloudflare FIRST_PARTY pins - com/vayunmathur/findfamily/domain/NoShowPolicy.kt - com/vayunmathur/findfamily/domain/MovementDetector.kt — sender moving/still state machine (acceleration + fix speed + displacement) - com/vayunmathur/findfamily/domain/ForcedFixPolicy.kt — when a "still" sender forces a one-off fix+### sync/ — wear companion+- com/vayunmathur/findfamily/sync/WearFindFamilySync.kt — phone side of the wear companion; the wire protocol is `com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol` in `:library:wearlink` (shared with `:findfamily-wear`; each side's `WearFindFamilyProtocolTest` pins the same golden JSON) ### intents/ — assistant IPC - com/vayunmathur/findfamily/intents/GetIntent.kt - com/vayunmathur/findfamily/intents/CreateLinkIntent.kt
findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.ktindex 04c43cf573..7633b1d2f7 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt@@ -4,15 +4,15 @@ import android.content.Context import com.vayunmathur.findfamily.data.LocationSource import com.vayunmathur.findfamily.data.FindFamilyRepository import com.vayunmathur.findfamily.data.RequestStatus-import com.vayunmathur.findfamily.domain.WearAlert-import com.vayunmathur.findfamily.domain.WearAlertKind-import com.vayunmathur.findfamily.domain.WearFindFamilyOp-import com.vayunmathur.findfamily.domain.WearFindFamilyProtocol-import com.vayunmathur.findfamily.domain.WearOpKind-import com.vayunmathur.findfamily.domain.WearPerson-import com.vayunmathur.findfamily.domain.WearWatchState-import com.vayunmathur.findfamily.domain.buildWearSnapshot-import com.vayunmathur.findfamily.domain.wearMotionFor+import com.vayunmathur.library.wearlink.findfamily.WearAlert+import com.vayunmathur.library.wearlink.findfamily.WearAlertKind+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyOp+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol+import com.vayunmathur.library.wearlink.findfamily.WearOpKind+import com.vayunmathur.library.wearlink.findfamily.WearPerson+import com.vayunmathur.library.wearlink.findfamily.WearWatchState+import com.vayunmathur.library.wearlink.findfamily.buildWearSnapshot+import com.vayunmathur.library.wearlink.findfamily.wearMotionFor import com.vayunmathur.findfamily.network.Networking import com.vayunmathur.findfamily.platform.LocationServiceController import com.vayunmathur.library.log.Log
findfamily/src/test/java/com/vayunmathur/findfamily/Y3TrackingServiceTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/Y3TrackingServiceTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/Y3TrackingServiceTest.ktindex ac3a166573..48e397cd2a 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/Y3TrackingServiceTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/Y3TrackingServiceTest.kt@@ -19,7 +19,6 @@ import org.junit.runner.RunWith import org.robolectric.Robolectric import org.robolectric.RobolectricTestRunner import org.robolectric.Shadows-import org.robolectric.annotation.Config import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test@@ -28,7 +27,6 @@ import kotlin.test.assertNull  @OptIn(ExperimentalCoroutinesApi::class) @RunWith(RobolectricTestRunner::class)-@Config(sdk = [34]) class Y3TrackingServiceTest {     private val ctx: Context get() = ApplicationProvider.getApplicationContext() 
findfamily/src/test/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocolTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocolTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocolTest.ktindex f8b18fe205..7107c5ab3f 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocolTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocolTest.kt@@ -1,5 +1,23 @@ package com.vayunmathur.findfamily.domain +import com.vayunmathur.library.wearlink.findfamily.WearAlert+import com.vayunmathur.library.wearlink.findfamily.WearAlertKind+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyOp+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol+import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot+import com.vayunmathur.library.wearlink.findfamily.WearMotion+import com.vayunmathur.library.wearlink.findfamily.WearOpKind+import com.vayunmathur.library.wearlink.findfamily.WearPerson+import com.vayunmathur.library.wearlink.findfamily.WearRegion+import com.vayunmathur.library.wearlink.findfamily.buildWearSnapshot+import com.vayunmathur.library.wearlink.findfamily.wearBearingDegrees+import com.vayunmathur.library.wearlink.findfamily.wearCompass+import com.vayunmathur.library.wearlink.findfamily.wearDistanceMeters+import com.vayunmathur.library.wearlink.findfamily.wearIsStale+import com.vayunmathur.library.wearlink.findfamily.wearMotionFor+import com.vayunmathur.library.wearlink.findfamily.wearRegionFor+import com.vayunmathur.library.wearlink.findfamily.wearRelativeOffsetMeters+import com.vayunmathur.library.wearlink.findfamily.wearSnapshotIsStale import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse@@ -41,13 +59,35 @@ class WearFindFamilyProtocolTest {      @Test     fun goldenStopSharingOpJson() {+        val op = WearFindFamilyOp(WearOpKind.STOP_SHARING_NOW, 123L)         assertEquals(             """{"kind":"STOP_SHARING_NOW","requestedAtMillis":123}""",-            WearFindFamilyProtocol.json.encodeToString(WearFindFamilyOp(WearOpKind.STOP_SHARING_NOW, 123L)),+            WearFindFamilyProtocol.json.encodeToString(op),         )+        val refresh = WearFindFamilyOp(WearOpKind.REQUEST_REFRESH, 456L)         assertEquals(             """{"kind":"REQUEST_REFRESH","requestedAtMillis":456}""",-            WearFindFamilyProtocol.json.encodeToString(WearFindFamilyOp(WearOpKind.REQUEST_REFRESH, 456L)),+            WearFindFamilyProtocol.json.encodeToString(refresh),+        )+    }++    @Test+    fun snapshotRoundTrips() {+        val snapshot = WearFindFamilySnapshot(+            generatedAtMillis = 9L,+            people = listOf(person(1L, 10L), person(2L, 20L)),+            alerts = listOf(WearAlert(WearAlertKind.NOSHOW, 2L, "School", 30L, fired = true)),+            sharingEnabled = false,+            region = WearRegion(377_749_000, -1_224_194_000, 500, true),+            truncated = true,+            droppedCount = 3,+            totalPeople = 5,+        )+        assertEquals(+            snapshot,+            WearFindFamilyProtocol.json.decodeFromString<WearFindFamilySnapshot>(+                WearFindFamilyProtocol.json.encodeToString(snapshot),+            ),         )     } @@ -58,7 +98,10 @@ class WearFindFamilyProtocolTest {         assertEquals(200, snapshot.people.size)         assertEquals(200, snapshot.totalPeople)         assertFalse(snapshot.truncated)+        assertEquals(0, snapshot.droppedCount)+        // Most recently updated first.         assertEquals(200L, snapshot.people.first().id)+        assertEquals(1L, snapshot.people.last().id)     }      @Test@@ -69,6 +112,9 @@ class WearFindFamilyProtocolTest {         val snapshot = buildWearSnapshot(candidates, generatedAtMillis = 0L)         assertTrue(snapshot.truncated)         assertTrue(snapshot.droppedCount > 0)+        assertEquals(2_000, snapshot.totalPeople)+        assertEquals(snapshot.totalPeople - snapshot.droppedCount, snapshot.people.size)+        // Most recent survives; oldest are the ones dropped.         assertEquals(2_000L, snapshot.people.first().id)         val bytes = WearFindFamilyProtocol.json.encodeToString(snapshot).encodeToByteArray().size         assertTrue(bytes <= WearFindFamilyProtocol.MAX_JSON_BYTES, "snapshot $bytes over cap")@@ -111,16 +157,58 @@ class WearFindFamilyProtocolTest {     }      @Test-    fun stalenessAndRelativeMath() {+    fun summarisingCapsFieldsBeforeDropping() {+        val snapshot = buildWearSnapshot(+            listOf(person(1L, 1L, name = "N".repeat(100), place = "P".repeat(120))),+            generatedAtMillis = 0L,+        )+        assertEquals(WearFindFamilyProtocol.MAX_NAME_CHARS, snapshot.people.single().name.length)+        assertEquals(WearFindFamilyProtocol.MAX_PLACE_CHARS, snapshot.people.single().placeLabel.length)+        assertFalse(snapshot.truncated)+    }++    @Test+    fun stalenessLabelling() {         val fresh = person(1L, 1_000_000L)         val now = 1_000_000L + WearFindFamilyProtocol.STALE_AFTER_MS         assertFalse(wearIsStale(fresh, now))         assertTrue(wearIsStale(fresh, now + 1L))+        assertTrue(wearIsStale(person(2L, 0L), now))+        assertTrue(wearSnapshotIsStale(WearFindFamilySnapshot(generatedAtMillis = 0L), now))+        assertFalse(wearSnapshotIsStale(WearFindFamilySnapshot(generatedAtMillis = now), now))+    }++    @Test+    fun relativeViewMath() {+        // 0.01 degrees north of equator is about 1.11 km.+        val north = wearDistanceMeters(0, 0, 100_000, 0)+        assertTrue(north in 1_100.0..1_125.0, "north distance $north")         assertEquals(90, wearBearingDegrees(0, 0, 0, 100_000))+        assertEquals(0, wearBearingDegrees(0, 0, 100_000, 0))         assertEquals("E", wearCompass(90))-        val north = wearDistanceMeters(0, 0, 100_000, 0)-        assertTrue(north in 1_100.0..1_125.0, "north $north")+        assertEquals("N", wearCompass(0))+        assertEquals("NE", wearCompass(45))+        val (east, northM) = wearRelativeOffsetMeters(0, 0, 0, 100_000)+        assertTrue(east in 1_100.0..1_125.0 && northM == 0.0, "offset $east/$northM")+    }++    @Test+    fun motionFromSpeed() {         assertEquals(WearMotion.MOVING, wearMotionFor(2.0f, true))+        assertEquals(WearMotion.STATIONARY, wearMotionFor(0.0f, true))+        assertEquals(WearMotion.UNKNOWN, wearMotionFor(null, true))         assertEquals(WearMotion.UNKNOWN, wearMotionFor(5.0f, false))     }++    @Test+    fun regionCentresOnSelfAndCoversEveryone() {+        val self = person(1L, 100L).copy(isSelf = true)+        val far = person(2L, 90L).copy(latE7 = 387_749_000) // ~111 km north+        val region = wearRegionFor(listOf(far, self))+        assertEquals(self.latE7, region.centerLatE7)+        assertTrue(region.hasCenter)+        assertEquals(100_000, region.radiusM)+        assertEquals(WearRegion(), wearRegionFor(listOf(person(3L, 1L).copy(latE7 = null, lonE7 = null))))+    }+ }
findfamily/src/test/java/com/vayunmathur/findfamily/ipc/FamilyLocationServiceRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ipc/FamilyLocationServiceRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ipc/FamilyLocationServiceRealRepoTest.ktindex 31c0d036dc..f3acde4baf 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ipc/FamilyLocationServiceRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ipc/FamilyLocationServiceRealRepoTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ipc +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import android.os.Bundle import android.os.Handler
findfamily/src/test/java/com/vayunmathur/findfamily/platform/FixCeilingAlarmTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/FixCeilingAlarmTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/FixCeilingAlarmTest.ktindex 0ab6513154..18a3b85b0c 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/FixCeilingAlarmTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/FixCeilingAlarmTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.Manifest import android.app.AlarmManager import android.app.Application
findfamily/src/test/java/com/vayunmathur/findfamily/platform/LocationKeepAliveTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/LocationKeepAliveTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/LocationKeepAliveTest.ktindex fd1a3d3ecc..d722345bca 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/LocationKeepAliveTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/LocationKeepAliveTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import android.content.Context import android.location.Location
findfamily/src/test/java/com/vayunmathur/findfamily/platform/NoShowSweepRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/NoShowSweepRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/NoShowSweepRealRepoTest.ktindex c3c23ad676..8fd74a6681 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/NoShowSweepRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/NoShowSweepRealRepoTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.content.Context import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4
findfamily/src/test/java/com/vayunmathur/findfamily/platform/PlatformServicesTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PlatformServicesTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PlatformServicesTest.ktindex 0f5f77ebba..9337085644 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PlatformServicesTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PlatformServicesTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import android.content.Context import android.content.Intent
findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconArmTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconArmTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconArmTest.ktindex 5e73602bb5..3912b4bd52 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconArmTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconArmTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.content.Context import android.content.Intent import android.os.BatteryManager
findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconRealRepoTest.ktindex d5b3797cc2..aadb185b11 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/PoweredOffBeaconRealRepoTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.vayunmathur.findfamily.data.DirectBootStore
findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbHandshakeSdk36Test.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbHandshakeSdk36Test.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbHandshakeSdk36Test.ktindex 984729d63d..3ccd3052e7 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbHandshakeSdk36Test.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbHandshakeSdk36Test.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.ranging.RangingManager import android.ranging.RangingPreference import android.ranging.RangingSession
findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbSessionManagerSdk36Test.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbSessionManagerSdk36Test.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbSessionManagerSdk36Test.ktindex 57af4db976..ba06a4b77f 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbSessionManagerSdk36Test.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/UwbSessionManagerSdk36Test.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.platform +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.test.core.app.ApplicationProvider import com.vayunmathur.findfamily.data.FindFamilyRepository import com.vayunmathur.findfamily.data.RequestStatus
findfamily/src/test/java/com/vayunmathur/findfamily/ui/DialogsWithVmTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/DialogsWithVmTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/DialogsWithVmTest.ktindex 58592460d7..c252ee693a 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/DialogsWithVmTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/DialogsWithVmTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import android.content.Context import androidx.compose.ui.test.assertIsDisplayed
findfamily/src/test/java/com/vayunmathur/findfamily/ui/FirstRunSheetTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/FirstRunSheetTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/FirstRunSheetTest.ktindex e8a4262aaa..4fd0fd11b4 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/FirstRunSheetTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/FirstRunSheetTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule
findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.ktindex 9b71310963..e6948358e4 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import android.content.Context import androidx.compose.ui.test.junit4.createComposeRule
findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.ktindex f9af512259..6b759a5ad7 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import android.content.Intent import androidx.compose.foundation.Canvas
findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.ktindex 096d794b76..4c9cf3650c 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.ui++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.domain.AddInvite  import android.app.Application
findfamily/src/test/java/com/vayunmathur/findfamily/ui/PersonAndFamilySheetsRealTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/PersonAndFamilySheetsRealTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/PersonAndFamilySheetsRealTest.ktindex 6954c629e9..1e6f44998f 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/PersonAndFamilySheetsRealTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/PersonAndFamilySheetsRealTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onAllNodesWithText
findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5FamilyListSheetTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5FamilyListSheetTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5FamilyListSheetTest.ktindex 203f23a338..14222b433e 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5FamilyListSheetTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5FamilyListSheetTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText
findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5MainPageContentTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5MainPageContentTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5MainPageContentTest.ktindex 6eb32006c9..b2407ec597 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5MainPageContentTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5MainPageContentTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText
findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5PersonDetailSheetTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5PersonDetailSheetTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5PersonDetailSheetTest.ktindex 5a3f36c3f9..5f8226858c 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5PersonDetailSheetTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5PersonDetailSheetTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.hasText import androidx.compose.ui.test.junit4.createComposeRule
findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5UserCardTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5UserCardTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5UserCardTest.ktindex 180ae3048a..35ddea55ab 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5UserCardTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/W5UserCardTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText
findfamily/src/test/java/com/vayunmathur/findfamily/ui/dialogs/DialogsRealRepoInteractionsTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/dialogs/DialogsRealRepoInteractionsTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/dialogs/DialogsRealRepoInteractionsTest.ktindex 7deb04a7df..4caf4b11cb 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/dialogs/DialogsRealRepoInteractionsTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/dialogs/DialogsRealRepoInteractionsTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.ui.dialogs +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule
findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingAndControllerTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingAndControllerTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingAndControllerTest.ktindex 51b5761ed4..4ad0e62afd 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingAndControllerTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingAndControllerTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.util +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.Manifest import android.app.Application import android.content.Context
findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingRealRepoTest.ktindex 99ca269920..4422507aa1 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/CrowdFindingRealRepoTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.network.generatePqcIdentityKeyPair import com.vayunmathur.findfamily.network.generatePqcLinkKey import com.vayunmathur.findfamily.network.myInviteFingerprint
findfamily/src/test/java/com/vayunmathur/findfamily/util/DirectBootAndStoresRealTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/DirectBootAndStoresRealTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/DirectBootAndStoresRealTest.ktindex 7db5c6ed6d..98ad880f69 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/DirectBootAndStoresRealTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/DirectBootAndStoresRealTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.platform.LocationTrackingService import com.vayunmathur.findfamily.network.Networking import com.vayunmathur.findfamily.platform.publishDirectBoot
findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.ktindex 5e39fe2672..b3533385c8 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.platform.FindFamilyViewModel  import android.app.Application
findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.ktindex 8e66389d6f..158139d3b9 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.platform.FindFamilyViewModel import com.vayunmathur.findfamily.platform.FindFamilyViewModelFactory 
findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelStatesRealTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelStatesRealTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelStatesRealTest.ktindex 3ebf28616b..77746a4de4 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelStatesRealTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelStatesRealTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.network.generatePqcIdentityKeyPair import com.vayunmathur.findfamily.network.generatePqcLinkKey import com.vayunmathur.findfamily.network.myInviteFingerprint
findfamily/src/test/java/com/vayunmathur/findfamily/util/InboundEnrichRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/InboundEnrichRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/InboundEnrichRealRepoTest.ktindex 262b7fb4b8..29b4d23a85 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/InboundEnrichRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/InboundEnrichRealRepoTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.network.generatePqcIdentityKeyPair import com.vayunmathur.findfamily.network.generatePqcLinkKey import com.vayunmathur.findfamily.network.myInviteFingerprint
findfamily/src/test/java/com/vayunmathur/findfamily/util/LocationTrackingInboundTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/LocationTrackingInboundTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/LocationTrackingInboundTest.ktindex fc7dc5d326..175deb39a4 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/LocationTrackingInboundTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/LocationTrackingInboundTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.network.InboundFix import com.vayunmathur.findfamily.platform.LocationTrackingService import com.vayunmathur.findfamily.notifications.createNotification
findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingDirectBootTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingDirectBootTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingDirectBootTest.ktindex 6d9c79bd8d..1a09473be7 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingDirectBootTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingDirectBootTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.util +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.vayunmathur.findfamily.data.Coord
findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingFramesRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingFramesRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingFramesRealRepoTest.ktindex 17e7a0d4e3..7ca1c6f4e9 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingFramesRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingFramesRealRepoTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.network.generatePqcIdentityKeyPair import com.vayunmathur.findfamily.network.generatePqcLinkKey import com.vayunmathur.findfamily.network.myInviteFingerprint
findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingLiveSessionTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingLiveSessionTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingLiveSessionTest.ktindex ecfd4b336a..bddb8e9dc2 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingLiveSessionTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingLiveSessionTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.network.generatePqcIdentityKeyPair import com.vayunmathur.findfamily.network.generatePqcLinkKey import com.vayunmathur.findfamily.network.myInviteFingerprint
findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingUwbAndBackupTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingUwbAndBackupTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingUwbAndBackupTest.ktindex 6c2471c9da..21f8e28a52 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingUwbAndBackupTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/NetworkingUwbAndBackupTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.network.generatePqcIdentityKeyPair import com.vayunmathur.findfamily.network.generatePqcLinkKey import com.vayunmathur.findfamily.network.myInviteFingerprint
findfamily/src/test/java/com/vayunmathur/findfamily/util/TrackingServiceLifecycleTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/TrackingServiceLifecycleTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/TrackingServiceLifecycleTest.ktindex 736c977bdf..0c65ff39b6 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/TrackingServiceLifecycleTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/TrackingServiceLifecycleTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.util +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.Manifest import android.app.Application import android.content.Context
findfamily/src/test/java/com/vayunmathur/findfamily/util/UserCardsRenderingTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/UserCardsRenderingTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/UserCardsRenderingTest.ktindex 63d2a3f4d3..4bd6e8137e 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/UserCardsRenderingTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/UserCardsRenderingTest.kt@@ -1,5 +1,7 @@ package com.vayunmathur.findfamily.util +// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch.+ import android.app.Application import android.content.Context import androidx.compose.ui.test.junit4.createComposeRule
findfamily/src/test/java/com/vayunmathur/findfamily/util/UwbSessionManagerRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/UwbSessionManagerRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/UwbSessionManagerRealRepoTest.ktindex 65731151fd..7ea58e8b1c 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/UwbSessionManagerRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/UwbSessionManagerRealRepoTest.kt@@ -1,4 +1,6 @@ package com.vayunmathur.findfamily.util++// FIXTURE RELATIVE-TIME EXCEPTION: timestamps are seeded relative to the wall clock the code under test reads internally, so the fresh/expired/relative-time branch under test keeps its meaning; a fixed past instant would silently change that branch. import com.vayunmathur.findfamily.platform.UwbSessionManager  import androidx.test.core.app.ApplicationProvider
library/wearlink/AGENTS.md
diff --git a/library/wearlink/AGENTS.md b/library/wearlink/AGENTS.mdindex 549ddc2c56..61d490de65 100644--- a/library/wearlink/AGENTS.md+++ b/library/wearlink/AGENTS.md@@ -17,7 +17,7 @@ duplicated per app pair: each migrated protocol lives in `com.vayunmathur.library.wearlink.<app>` and is consumed by both the phone and wear app modules (which may not depend on each other). Golden-JSON tests stay in each app module and pin the shared code's wire format.-Migrated: clock, launcher, calendar, weather, music, notes, maps, appstore, contacts. Remaining pairs are listed in+Migrated: clock, launcher, calendar, weather, music, notes, maps, appstore, contacts, findfamily. Remaining pairs are listed in `docs/structure/wear-protocol-pairs.tsv`.  ## Verify
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/findfamily/WearFindFamilyProtocol.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocol.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/findfamily/WearFindFamilyProtocol.ktsimilarity index 96%rename from findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocol.ktrename to library/wearlink/src/main/java/com/vayunmathur/library/wearlink/findfamily/WearFindFamilyProtocol.ktindex 7a185a7d3c..ddb5306386 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocol.kt+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/findfamily/WearFindFamilyProtocol.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.domain+package com.vayunmathur.library.wearlink.findfamily  import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString@@ -11,12 +11,9 @@ import kotlin.math.sqrt /**  * Phone <-> watch protocol for the Wear OS FindFamily companion.  *- * SINGLE SOURCE OF TRUTH, DELIBERATELY DUPLICATED: Gradle cannot let one- * application module depend on another, so the wear module- * (`:findfamily-wear`, applicationId `com.vayunmathur.findfamily`) carries- * a copy of this file under `com.vayunmathur.findfamily.wear.domain`.- * Change both copies together; each side's unit tests pin the same golden- * JSON so a one-sided edit fails loudly.+ * Shared by the phone (`:findfamily`) and the watch (`:findfamily-wear`)+ * through `:library:wearlink`; neither app module depends on the other.+ * Each side's tests pin the same golden JSON against this code.  *  * Transport (WearLink, :library:wearlink — RFCOMM, no Play services):  * - Presence is a completed handshake for [CAPABILITY] (the appId).