findfamily: merge findfamily-wear into the single findfamily APK
- Commit
fa42db12ad168e87c67354c55b177c9655c3b61d- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-04 18:18 UTC (1 day ago)
- Parents
f29e066
Owner rule: singular apps detect a watch via FEATURE_WATCH instead of shipping a separate *-wear APK. findfamily follows the merged clock pilot (adec0c398 + 31a81d3c5): one APK, same applicationId com.vayunmathur.findfamily and convention signing on both form factors, as the WearLink handshake requires. Runtime routing: platform/FormFactor reads PackageManager.FEATURE_WATCH. MainActivity, the sole launcher entry, forwards watches to ui/WearMainActivity (exported=false, no launcher filter) and finishes before any phone state (Room, phone WearFindFamilySync, NetworkClient, permission gate) is touched; phones keep the existing map UI untouched. Phone-only receivers BootReceiver and FixCeilingReceiver return early on a watch, so phone location sharing never starts there. Manifest: no android.hardware.type.watch uses-feature (required would block phones; optional is disallowed for this feature), touchscreen not-required, standalone=false; distribution is sideload/F-Droid, not Play's watch channel. All findfamily-wear sources move into findfamily's closed roots (wear/data -> data, wear/domain -> domain, wear/sync -> sync, wear/ui -> ui), R references retarget to com.vayunmathur.findfamily.R, wear strings merge as res/values/wear_strings.xml (duplicate app_name dropped), and the watch screenshots move to ui/WearMetadataPreviews with group=wear rendering into metadata_data/photos/findfamily/wear/. Moved file bodies are unchanged apart from package/import retargeting: location-sharing and E2EE code paths keep their exact behaviour; only the wear UI slice moved. The wear-only tests for WearRelative helpers (staleLabel, relativeProjection, distanceSummaryAndAge) merge into the existing WearFindFamilyProtocolTest beside the golden-JSON tests, and a new FormFactorTest pins the routing signal. The findfamily-wear module, its settings include, and its AGENTS.md are deleted. Root and findfamily AGENTS.md describe the merged state. Verified fresh on devvm21958 (./gradlew :findfamily:lint :findfamily:lintVitalRelease :findfamily:testDevUnitTest --rerun-tasks): BUILD SUCCESSFUL, 601 unit tests, 0 failures, including the moved wear tests and FormFactorTest; lint reports warnings only. The same three tasks are green on the unmodified base (de47de281), so no failure here is pre-existing breakage. Only a real watch can confirm install, FEATURE_WATCH routing, and the Wear OS launcher surface.
Diff
AGENTS.md
diff --git a/AGENTS.md b/AGENTS.mdindex 3c8b9c51ce..97dc773dbe 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -49,7 +49,7 @@ Monorepo: ~100 Gradle modules + Rust workspace. Do scoped work only. ### Apps (Gradle key → dir) Reference: `backup/` satisfies every rule; `notes/` second + `intents/` demo. `camera` + `games/voxels` hand-commit screenshots. Full canonical index (Gradle key → dir + group + notes): `.llms/repo-map.md`.-`clock`, `notes`, `calendar`, `launcher`, `todo`, `maps` and `camera` are single merged APKs for phone and watch (watch experience inside the phone app's module; the remaining `*-wear` modules are separate companion APKs with the phone app's applicationId/signing).+`clock`, `notes`, `calendar`, `launcher`, `todo`, `maps`, `camera` and `findfamily` are single merged APKs for phone and watch (watch experience inside the phone app's module; the remaining `*-wear` modules are separate companion APKs with the phone app's applicationId/signing). `appstore→appstore/` `astronomy→astronomy/` `auto→auto/,auto/protocol/` `backup→backup/` `calculator→calculator/` `calendar→calendar/` `camera→camera/` `cast→cast/,cast/protocol/,cast/tv/` `clock→clock/` `code→code/` `communicate→communicate/` `contacts→contacts/` `education→education/` `email→email/` `emergency→emergency/` `euicc→euicc/` `everysync→everysync/` `files→files/` `findfamily→findfamily/` `findfamily-ios→apple/FindFamily/` (SwiftPM/xtool, not Gradle) `flashcards→flashcards/` `fooddelivery→fooddelivery/` `health→health/` `keyboard→keyboard/` `launcher→launcher/` `logviewer→logviewer/` `maps→maps/` `measure→measure/` `music→music/` `networklocation→networklocation/` `news→news/` `notes→notes/` `office→office/` `openassistant→openassistant/` `passwords→passwords/` `pdf→pdf/` `photos→photos/` `parentalcontrols→parentalcontrols/` `screentime→screentime/` `setupwizard→setupwizard/` `share→share/` `speech→speech/` `taxi→taxi/` `things→things/` `todo→todo/` `translate→translate/` `travel→travel/` `tuner→tuner/` `updater→updater/` `vpn→vpn/` `weather→weather/` `watch→watch/,watch-wear/` `web→web/` `youpipe→youpipe/,youpipe/extractor/` `games-hub→games/hub/` `games-arrows→games/arrows/` `games-chess→games/chess/` `games-logicgate→games/logicgate/` `games-minesweeper→games/minesweeper/` `games-nonogram→games/nonogram/` `games-pipes→games/pipes/` `games-solitaire→games/solitaire/` `games-sudoku→games/sudoku/` `games-unblockjam→games/unblockjam/` `games-voxels→games/voxels/` `games-wordmaker→games/wordmaker/` Slash == colon for Gradle (`games/voxels` == `games:voxels`).
findfamily-wear/AGENTS.md
diff --git a/findfamily-wear/AGENTS.md b/findfamily-wear/AGENTS.mddeleted file mode 100644index 6547912aa6..0000000000--- a/findfamily-wear/AGENTS.md+++ /dev/null@@ -1,47 +0,0 @@-# AGENTS.md — findfamily-wear/ (':findfamily-wear')--> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside-> `findfamily-wear/` + `findfamily/` (the phone side of the same feature).--- Gradle: :findfamily-wear / dir: findfamily-wear/ (convention: `common-conventions-wear`)-- Package roots present: ui, data, domain, sync-- Entry file: ui/WearMainActivity.kt--## Why this module exists (read before changing identity)-Wear OS companion of the phone FindFamily (`:findfamily`). This module-deliberately uses `applicationId = "com.vayunmathur.findfamily"` (the-phone app's) with the shared dev/release signing from the convention-plugins: WearLink's handshake token requires the same signing-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-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,- fix/report times, accuracy, battery, motion), no history/track.-- Watch state: WearLink data item (`/findfamily/watch-state`)-- Ops: WearLink message (`/findfamily/op`: STOP_SHARING_NOW,- REQUEST_REFRESH); request-sync message (`/findfamily/request-sync`)-- Transport: :library:wearlink (RFCOMM, no Play services); app-lifecycle-bound--## What the watch shows-People home (every person, most-recent first), per-person detail via a-Route carrying the person id (precise fix age/accuracy/place + relative-view), and an all-people relative map centred on the phone-supplied-region (self when located). There is no vector basemap: the phone-FindFamily app owns no planet archive, so markers are plotted relative-to the centre — never fake precision, stale fixes are labelled by age.-The last snapshot persists on-watch for offline reading.--## Verify (this module only)-```-./gradlew :findfamily-wear:assembleDev-./gradlew :findfamily-wear:testDebugUnitTest-```
findfamily-wear/build.gradle.kts
diff --git a/findfamily-wear/build.gradle.kts b/findfamily-wear/build.gradle.ktsdeleted file mode 100644index b0ca2c75b4..0000000000--- a/findfamily-wear/build.gradle.kts+++ /dev/null@@ -1,31 +0,0 @@-plugins {- id("common-conventions-wear")- id("common-conventions-preview-metadata")-}--launcherIcon {- symbol = "moved_location"-}--// Version shared with the phone app (root version.txt).-val wearVersionLines = file("../version.txt").readLines()-val wearVersionCode = wearVersionLines[0].trim().toInt()-val wearVersionName = wearVersionLines[1].trim()--android {- // WearLink handshake requires same package + signing as the phone app.- namespace = "com.vayunmathur.findfamily.wear"- defaultConfig {- applicationId = "com.vayunmathur.findfamily"- minSdk = 31- versionCode = wearVersionCode- versionName = wearVersionName- }-}--dependencies {- implementation(libs.kotlinx.coroutines.android)- implementation(project(":library:wearlink"))- testImplementation(libs.kotlin.test)- testImplementation(libs.kotlin.test.junit)-}
findfamily-wear/src/main/AndroidManifest.xml
diff --git a/findfamily-wear/src/main/AndroidManifest.xml b/findfamily-wear/src/main/AndroidManifest.xmldeleted file mode 100644index f9d172cc32..0000000000--- a/findfamily-wear/src/main/AndroidManifest.xml+++ /dev/null@@ -1,35 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<manifest xmlns:android="http://schemas.android.com/apk/res/android">-- <uses-feature- android:name="android.hardware.type.watch"- android:required="true" />- <uses-feature- android:name="android.hardware.touchscreen"- android:required="false" />-- <uses-permission android:name="android.permission.WAKE_LOCK" />-- <application- android:allowBackup="false"- android:icon="@mipmap/ic_launcher"- android:label="@string/app_name"- android:roundIcon="@mipmap/ic_launcher"- android:supportsRtl="true"- android:theme="@android:style/Theme.Material.NoActionBar">-- <meta-data- android:name="com.google.android.wearable.standalone"- android:value="false" />-- <activity- android:name=".ui.WearMainActivity"- android:exported="true"- android:taskAffinity="">- <intent-filter>- <action android:name="android.intent.action.MAIN" />- <category android:name="android.intent.category.LAUNCHER" />- </intent-filter>- </activity>- </application>-</manifest>
findfamily-wear/src/main/res/values/colors.xml
diff --git a/findfamily-wear/src/main/res/values/colors.xml b/findfamily-wear/src/main/res/values/colors.xmldeleted file mode 100644index f42ada656e..0000000000--- a/findfamily-wear/src/main/res/values/colors.xml+++ /dev/null@@ -1,4 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<resources>- <color name="ic_launcher_background">#FFFFFF</color>-</resources>
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.ktdeleted file mode 100644index a7ed37f63b..0000000000--- a/findfamily-wear/src/test/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocolTest.kt+++ /dev/null@@ -1,243 +0,0 @@-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-import kotlin.test.assertTrue-import kotlinx.serialization.encodeToString--class WearFindFamilyProtocolTest {-- private fun person(- id: Long,- updatedAt: Long,- name: String = "Person $id",- place: String = "Home",- ) = WearPerson(- id = id,- name = name,- placeLabel = place,- latE7 = 377_749_000,- lonE7 = -1_224_194_000,- updatedAtMillis = updatedAt,- )-- @Test- fun goldenSnapshotJson() {- val snapshot = WearFindFamilySnapshot(- generatedAtMillis = 1_000L,- people = listOf(person(7L, 900L, name = "Ada")),- region = WearRegion(377_749_000, -1_224_194_000, 200, true),- totalPeople = 1,- )- assertEquals(- """{"generatedAtMillis":1000,"people":[{"id":7,"name":"Ada","placeLabel":"Home",""" +- """"latE7":377749000,"lonE7":-1224194000,"updatedAtMillis":900}],""" +- """"region":{"centerLatE7":377749000,"centerLonE7":-1224194000,""" +- """"hasCenter":true},"totalPeople":1}""",- WearFindFamilyProtocol.json.encodeToString(snapshot),- )- }-- @Test- fun goldenStopSharingOpJson() {- val op = WearFindFamilyOp(WearOpKind.STOP_SHARING_NOW, 123L)- assertEquals(- """{"kind":"STOP_SHARING_NOW","requestedAtMillis":123}""",- WearFindFamilyProtocol.json.encodeToString(op),- )- val refresh = WearFindFamilyOp(WearOpKind.REQUEST_REFRESH, 456L)- assertEquals(- """{"kind":"REQUEST_REFRESH","requestedAtMillis":456}""",- 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),- ),- )- }-- @Test- fun allPeopleCompletenessNoSilentDrop() {- val candidates = (1L..200L).map { person(it, it * 1_000L) }- val snapshot = buildWearSnapshot(candidates, generatedAtMillis = 999_000L)- 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- fun hardCapDropsOldestAndSaysSo() {- val candidates = (1L..2_000L).map {- person(it, it, name = "N".repeat(100), place = "P".repeat(120))- }- 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")- }-- @Test- fun hardCapDropsAlertsForDroppedPeople() {- val candidates = (1L..2_000L).map {- person(it, it, name = "N".repeat(100), place = "P".repeat(120))- }- // The phone attaches one AT_PLACE alert per located person; the- // oldest person also has a fired no-show. The byte cap drops the- // oldest people, so their alerts must go with them: the watch- // must never render an alert it cannot attribute to a person.- val alerts = candidates.map {- WearAlert(WearAlertKind.AT_PLACE, it.id, it.placeLabel, it.placeSinceMillis)- } + WearAlert(WearAlertKind.NOSHOW, 1L, "School", 42L, fired = true)- val snapshot = buildWearSnapshot(candidates, alerts = alerts, generatedAtMillis = 0L)- assertTrue(snapshot.truncated)- val keptIds = snapshot.people.map { it.id }.toSet()- assertTrue(snapshot.alerts.isNotEmpty())- assertTrue(snapshot.alerts.all { it.personId in keptIds })- assertTrue(snapshot.alerts.none { it.kind == WearAlertKind.NOSHOW })- val bytes = WearFindFamilyProtocol.json.encodeToString(snapshot).encodeToByteArray().size- assertTrue(bytes <= WearFindFamilyProtocol.MAX_JSON_BYTES, "snapshot $bytes over cap")- }-- @Test- fun alertsForUnknownPeopleAreDropped() {- val snapshot = buildWearSnapshot(- listOf(person(1L, 10L), person(2L, 20L)),- alerts = listOf(- WearAlert(WearAlertKind.AT_PLACE, 1L, "Home", 5L),- WearAlert(WearAlertKind.NOSHOW, 999L, "School", 6L, fired = true),- ),- generatedAtMillis = 0L,- )- assertFalse(snapshot.truncated)- assertEquals(listOf(1L), snapshot.alerts.map { it.personId })- }-- @Test- 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))- 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))))- }-- @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)- val other = person(2L, 100L).copy(latE7 = 378_749_000) // ~11 km north- assertTrue(wearDistanceSummary(self, other).endsWith(" N"))- assertEquals("", wearDistanceSummary(null, other))- assertEquals("just now", wearAgeLabel(1_000L, 30_000L))- assertEquals("5m ago", wearAgeLabel(0L + 1_000L, 1_000L + 5 * 60_000L))- assertEquals("2h ago", wearAgeLabel(1_000L, 1_000L + 2 * 3_600_000L))- assertEquals("500 m", wearFormatDistance(500.0))- assertEquals("1.5 km", wearFormatDistance(1_500.0))- }-}
findfamily/AGENTS.md
diff --git a/findfamily/AGENTS.md b/findfamily/AGENTS.mdindex 894fa0ec08..18cc6e93bc 100644--- a/findfamily/AGENTS.md+++ b/findfamily/AGENTS.md@@ -4,9 +4,9 @@ _Install: ./install findfamily (dev by default)._ - Gradle: :findfamily / dir: findfamily/-- Package roots present: ui, data, domain, platform, intents, service-- Entry files: MainActivity.kt + Route.kt + Navigation.kt-- Deps: :library:network, :library:e2ee-p2p, :library:room, :library:work, :library:image, :library:map, :library:aosp-stubs, :library:wearlink+- Package roots present: ui, data, domain, platform, intents, service, sync+- Entry files: MainActivity.kt (sole launcher; routes watches to WearMainActivity) + Route.kt + Navigation.kt + ui/WearMainActivity.kt+- Deps: :library:network, :library:e2ee-p2p, :library:room, :library:work, :library:image, :library:map, :library:aosp-stubs, :library:wearlink, Wear Compose (material + foundation) - Metadata: metadata_data/findfamily.md (present) - Rust: no / screenshotTest: yes @@ -29,6 +29,40 @@ WebSocket relay host: `wss://api.maproj.org/api/ws` (Cloudflare FIRST_PARTY pins - Extra non-conforming dirs (`ipc/`, `tracker/`, `uwb/`, `util/`) hold real code — like camera's `util/`, a closed-roots migration is pending - Upgrades from app versions before v2.6.0 start fresh: the `FFDatabase` floor is DB v5, pre-floor DB v1–v4 opens destructively (no data carried over), and DB v5 onward migrates normally +## One APK, two form factors (phone + watch)+This module is the single FindFamily APK for phones and watches: same+`applicationId = "com.vayunmathur.findfamily"` and signing on both, as+the WearLink handshake requires. The manifest deliberately declares no+`android.hardware.type.watch` feature (required=true would block+phones; required=false is disallowed for this feature), plus+touchscreen not-required and+`com.google.android.wearable.standalone=false`; distribution is+sideload/F-Droid, not Play's watch channel, so the APK installs on+phones and watches alike. `platform/FormFactor.kt` reads+`PackageManager.FEATURE_WATCH` at runtime: `MainActivity` (the sole+launcher entry) forwards watches to `ui/WearMainActivity` before any+phone state loads; phones get the map UI. Phone-only receivers gate+on the same signal — `platform/BootReceiver` and+`platform/FixCeilingReceiver` return early on a watch, so phone+location sharing never starts there.++## Watch experience (in this module)+- `ui/WearMainActivity` (a `WearShellActivity`, `exported=false`, no+ launcher filter) routes `ui/WearRoute` over people home (every+ person, most-recent first) / per-person detail (precise fix+ age/accuracy/place + relative view) / the all-people relative map+ centred on the phone-supplied region. There is no vector basemap:+ markers plot relative to the centre, stale fixes are labelled by+ age, and precision is never faked.+- Watch state persists in `data/WearFindFamilyStore`+ (`wear-findfamily-snapshot.json`); presentation helpers live in+ `domain/WearRelative.kt`; the watch sync side is+ `sync/WearLinkBridge.kt`.+- Watch listing screenshots are the `group = "wear"` previews in+ `src/screenshotTest/.../ui/WearMetadataPreviews.kt`, collected by+ `:findfamily:metadata` into `metadata_data/photos/findfamily/wear/`;+ phone shots use the `phone` bucket.+ ## Key files ### Root — entry + navigation - com/vayunmathur/findfamily/MainActivity.kt — deep-link parsing, permission spec, permission-upgrade trigger@@ -50,8 +84,14 @@ 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)+### sync/ — wear companion (both sides in this APK)+- 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` (the golden-JSON tests in this module pin the shared code's wire format)+- com/vayunmathur/findfamily/sync/WearLinkBridge.kt — watch side of the wear companion; snapshot receive into `data/WearFindFamilyStore`, watch-state publish, stop-sharing/refresh/request-sync messages to the phone+### Watch experience (ui/ + data/ + domain/)+- com/vayunmathur/findfamily/ui/WearMainActivity.kt — watch entry (WearShellActivity, exported=false)+- com/vayunmathur/findfamily/ui/WearRoute.kt, WearPeopleScreen.kt, WearPersonScreen.kt, WearAllMapScreen.kt, WearRelativeCanvas.kt+- com/vayunmathur/findfamily/data/WearFindFamilyStore.kt+- com/vayunmathur/findfamily/domain/WearRelative.kt ### intents/ — assistant IPC - com/vayunmathur/findfamily/intents/GetIntent.kt - com/vayunmathur/findfamily/intents/CreateLinkIntent.kt@@ -59,6 +99,7 @@ WebSocket relay host: `wss://api.maproj.org/api/ws` (Cloudflare FIRST_PARTY pins - com/vayunmathur/findfamily/ipc/FamilyLocationProtocol.kt - com/vayunmathur/findfamily/ipc/FamilyLocationService.kt ### platform/ — reporters + schedulers+- com/vayunmathur/findfamily/platform/FormFactor.kt — watch detection (`FEATURE_WATCH`) for the single merged APK - com/vayunmathur/findfamily/platform/FinalLocationReporter.kt - com/vayunmathur/findfamily/platform/NoShowCheckScheduler.kt - com/vayunmathur/findfamily/platform/PoweredOffBeacon.kt
findfamily/build.gradle.kts
diff --git a/findfamily/build.gradle.kts b/findfamily/build.gradle.ktsindex 430f8b9b79..718f02b480 100644--- a/findfamily/build.gradle.kts+++ b/findfamily/build.gradle.kts@@ -125,7 +125,15 @@ dependencies { implementation(project(":library:image")) implementation(project(":library:map"))+ // Both sides of the Wear OS sync live in this one APK (same+ // applicationId and signing, as the WearLink handshake requires):+ // sync/WearFindFamilySync publishes the phone snapshot, sync/+ // WearLinkBridge receives it on a watch. FormFactor picks the side+ // at runtime. implementation(project(":library:wearlink"))+ // Watch experience (ui/Wear*): Wear Compose for the watch screens.+ implementation(libs.androidx.wear.compose.material)+ implementation(libs.androidx.wear.compose.foundation) // @SystemApi android.nearby.NearbyManager, for powered-off finding. Present at runtime, // absent from the public SDK, and must NOT be packaged. See :library:aosp-stubs. compileOnly(project(":library:aosp-stubs"))
findfamily/src/main/AndroidManifest.xml
diff --git a/findfamily/src/main/AndroidManifest.xml b/findfamily/src/main/AndroidManifest.xmlindex fa644a4266..396066a1da 100644--- a/findfamily/src/main/AndroidManifest.xml+++ b/findfamily/src/main/AndroidManifest.xml@@ -42,6 +42,21 @@ <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-feature android:name="android.hardware.bluetooth_le" android:required="false" /> + <!-- Single APK for phone and watch. Deliberately NO+ android.hardware.type.watch uses-feature here: required="true"+ would block every phone install, and required="false" is+ disallowed for this feature (lint InvalidWearFeatureAttribute;+ Google's packaging model does not support one APK for Wear and+ non-Wear via Play). This app does not distribute through Play's+ watch channel — it is sideloaded / F-Droid-installed, where no+ feature declaration is needed to install on a watch — so the+ APK carries no watch feature filter at all and+ FormFactor.isWatch (PackageManager.FEATURE_WATCH, still+ reported by watch hardware at runtime) routes the experience. -->+ <uses-feature+ android:name="android.hardware.touchscreen"+ android:required="false" />+ <uses-permission android:name="android.permission.RANGING" /> <!-- Powered-off finding (NearbyManager#setPoweredOffFindingEphemeralIds). signature|privileged, so this is only actually granted when findfamily is installed as a MAOS priv-app with a@@ -64,6 +79,11 @@ android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="true" android:theme="@style/Theme.General">++ <!-- Watch experience is paired with the phone app, not standalone. -->+ <meta-data+ android:name="com.google.android.wearable.standalone"+ android:value="false" /> <activity android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:name=".MainActivity"@@ -152,6 +172,15 @@ </intent-filter> </receiver> + <!-- Watch experience: entered only via MainActivity's watch routing+ (no launcher filter of its own). It renders only the locally+ stored phone snapshot, so it stays inert on a phone. -->+ <activity+ android:name=".ui.WearMainActivity"+ android:exported="false"+ android:taskAffinity=""+ android:theme="@android:style/Theme.Material.NoActionBar" />+ <activity android:name=".intents.GetIntent" android:exported="true"
findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.ktindex 86ffb64631..2c8f1f1fe9 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt@@ -1,6 +1,7 @@ package com.vayunmathur.findfamily import android.content.Intent+import android.os.Bundle import androidx.activity.viewModels import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState@@ -14,7 +15,9 @@ import com.vayunmathur.findfamily.notifications.EXTRA_NOSHOW_USER_ID import com.vayunmathur.findfamily.notifications.EXTRA_NOSHOW_WAYPOINT_ID import com.vayunmathur.findfamily.platform.FindFamilyViewModel import com.vayunmathur.findfamily.platform.FindFamilyViewModelFactory+import com.vayunmathur.findfamily.platform.FormFactor import com.vayunmathur.findfamily.platform.Platform+import com.vayunmathur.findfamily.ui.WearMainActivity import com.vayunmathur.findfamily.ui.dialogs.decodeBase26 import com.vayunmathur.findfamily.ui.findFamilyPermissionsSpec import com.vayunmathur.library.network.NetworkClient@@ -24,8 +27,13 @@ import com.vayunmathur.library.ui.MaActivity import com.vayunmathur.library.util.OfflineAware /**- * FindFamily entry activity: initialises the first-party network client, parses invite- * and no-show intents, and hosts the permission-gated navigation graph.+ * Sole launcher entry of the single merged FindFamily APK. On a watch (the+ * `android.hardware.type.watch` system feature, see [FormFactor]) it hands+ * off to [WearMainActivity] and finishes before any phone state (Room,+ * phone wear sync, first-party network client, permission gate) is+ * touched; on a phone it initialises the first-party network client,+ * parses invite and no-show intents, and hosts the permission-gated+ * navigation graph. */ class MainActivity : MaActivity() { /** Intent-extra keys for launching [MainActivity]. */@@ -34,6 +42,18 @@ class MainActivity : MaActivity() { const val EXTRA_UWB_PEER_ID = "com.vayunmathur.findfamily.EXTRA_UWB_PEER_ID" } + /** True on a watch, where this activity only forwards to [WearMainActivity]. */+ private var routedToWear = false++ override fun onCreate(savedInstanceState: Bundle?) {+ routedToWear = FormFactor.isWatch(this)+ super.onCreate(savedInstanceState)+ if (routedToWear) {+ startActivity(Intent(this, WearMainActivity::class.java))+ finish()+ }+ }+ private val ffViewModel: FindFamilyViewModel by viewModels { FindFamilyViewModelFactory(application, FindFamilyRepository.get(application)) }@@ -50,6 +70,7 @@ class MainActivity : MaActivity() { private val noShowTarget = mutableStateOf<Pair<Long, Long?>?>(null) override fun onCreateBeforeContent() {+ if (routedToWear) return com.vayunmathur.library.wearlink.WearLinkPermissions.requestIfNeeded(this) // Wear companion sync lives and dies with this process (WearLink has // no system wakeup); it republishes on reconnect and on data changes.@@ -62,6 +83,9 @@ class MainActivity : MaActivity() { @Composable override fun Content() {+ // On a watch this activity is finishing towards WearMainActivity;+ // compose nothing (and touch no phone state) in the meantime.+ if (routedToWear) return val platform = Platform(this) val hasForeground by ffViewModel.hasForeground.collectAsState() val hasCoarse by ffViewModel.hasCoarse.collectAsState()@@ -118,6 +142,7 @@ class MainActivity : MaActivity() { override fun onNewIntent(intent: Intent) { super.onNewIntent(intent)+ if (routedToWear) return // singleTop: warm-start links arrive here. Keep getIntent() in sync and // surface the invite so Compose routes to the prefilled dialog. setIntent(intent)
findfamily/src/main/java/com/vayunmathur/findfamily/data/WearFindFamilyStore.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/data/WearFindFamilyStore.ktsimilarity index 94%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/data/WearFindFamilyStore.ktindex 20cb3a3091..9dc637e951 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/data/WearFindFamilyStore.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/data/WearFindFamilyStore.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.data+package com.vayunmathur.findfamily.data import android.content.Context import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol@@ -47,7 +47,7 @@ class WearFindFamilyStore private constructor(private val context: Context) { _snapshot.value = snapshot runCatching { snapshotFile.writeText(WearFindFamilyProtocol.json.encodeToString(snapshot)) } .onFailure { Log.status(TAG, "persist snapshot failed: ${it.message}") }- com.vayunmathur.findfamily.wear.sync.WearLinkBridge.publishWatchState(context)+ com.vayunmathur.findfamily.sync.WearLinkBridge.publishWatchState(context) } private fun loadSnapshot(): WearFindFamilySnapshot = runCatching {
findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearRelative.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearRelative.ktsimilarity index 98%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearRelative.ktindex 99f08950ef..6db86eb118 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearRelative.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearRelative.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.domain+package com.vayunmathur.findfamily.domain import com.vayunmathur.library.wearlink.findfamily.WearPerson import com.vayunmathur.library.wearlink.findfamily.wearBearingDegrees
findfamily/src/main/java/com/vayunmathur/findfamily/platform/BootReceiver.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/BootReceiver.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/BootReceiver.ktindex d10be10bd7..66c870cc48 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/BootReceiver.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/BootReceiver.kt@@ -10,6 +10,9 @@ import kotlinx.coroutines.launch /** Restarts location sharing and no-show checks after boot or app replacement. */ class BootReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) {+ // Phone experience only: on a watch the merged APK shows the wear+ // snapshot UI and never starts phone location sharing.+ if (FormFactor.isWatch(context)) return // LOCKED_BOOT_COMPLETED is the only one of these delivered before the user unlocks, // and it is the whole reason this receiver is directBootAware. BOOT_COMPLETED does not // arrive until after the passcode, so registering for it alone meant nothing ran at all
findfamily/src/main/java/com/vayunmathur/findfamily/platform/FixCeilingAlarm.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FixCeilingAlarm.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FixCeilingAlarm.ktindex 2b1fdd6b16..923441430c 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FixCeilingAlarm.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FixCeilingAlarm.kt@@ -141,6 +141,9 @@ internal object FixCeilingAlarm { */ class FixCeilingReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) {+ // Phone experience only: the ceiling alarm serves phone location+ // sharing, which the watch experience never runs.+ if (FormFactor.isWatch(context)) return if (intent.action != FixCeilingAlarm.ACTION_ALARM) return FixCeilingAlarm.acquireWakeLock(context) val command = Intent(context, LocationTrackingService::class.java).setAction(FixCeilingAlarm.ACTION_CHECK)
findfamily/src/main/java/com/vayunmathur/findfamily/platform/FormFactor.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FormFactor.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FormFactor.ktnew file mode 100644index 0000000000..2ca7281bc1--- /dev/null+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FormFactor.kt@@ -0,0 +1,25 @@+package com.vayunmathur.findfamily.platform++import android.content.Context+import android.content.pm.PackageManager++/**+ * Runtime form-factor detection for the single merged FindFamily APK.+ *+ * One APK ships to phones and watches (same applicationId and signing, as+ * the WearLink handshake requires). [PackageManager.FEATURE_WATCH] is the+ * canonical signal: Wear OS devices report the `android.hardware.type.watch`+ * system feature, phones and tablets do not. The manifest deliberately+ * declares no such uses-feature (required=true would block phones,+ * required=false is disallowed for this feature), so the same APK+ * installs on both; this runtime check is what routes the experience.+ */+object FormFactor {++ /** True when this device reports the watch system feature. */+ fun isWatch(context: Context): Boolean =+ isWatch(context.packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH))++ /** Pure core of [isWatch], split out so unit tests need no Android runtime. */+ fun isWatch(hasWatchSystemFeature: Boolean): Boolean = hasWatchSystemFeature+}
findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearLinkBridge.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearLinkBridge.ktsimilarity index 97%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearLinkBridge.ktindex c79331ab1f..12c17a1142 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/sync/WearLinkBridge.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearLinkBridge.kt@@ -1,7 +1,7 @@-package com.vayunmathur.findfamily.wear.sync+package com.vayunmathur.findfamily.sync import android.content.Context-import com.vayunmathur.findfamily.wear.data.WearFindFamilyStore+import com.vayunmathur.findfamily.data.WearFindFamilyStore import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyOp import com.vayunmathur.library.wearlink.findfamily.WearFindFamilyProtocol import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot
findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearAllMapScreen.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearAllMapScreen.ktsimilarity index 95%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearAllMapScreen.ktindex d682c04a43..988f3ea2d5 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearAllMapScreen.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearAllMapScreen.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.ui+package com.vayunmathur.findfamily.ui import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth@@ -18,10 +18,10 @@ import androidx.wear.compose.material.Chip import androidx.wear.compose.material.ChipDefaults 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.R+import com.vayunmathur.findfamily.data.WearFindFamilyStore import com.vayunmathur.library.wearlink.findfamily.wearSnapshotIsStale-import com.vayunmathur.findfamily.wear.domain.wearFormatDistance+import com.vayunmathur.findfamily.domain.wearFormatDistance import com.vayunmathur.library.wearlink.findfamily.WearFindFamilySnapshot /**
findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearMainActivity.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearMainActivity.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearMainActivity.ktsimilarity index 89%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearMainActivity.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearMainActivity.ktindex 43bbdfa228..e60a8f5947 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearMainActivity.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearMainActivity.kt@@ -1,8 +1,8 @@-package com.vayunmathur.findfamily.wear.ui+package com.vayunmathur.findfamily.ui import androidx.compose.runtime.Composable-import com.vayunmathur.findfamily.wear.data.WearFindFamilyStore-import com.vayunmathur.findfamily.wear.sync.WearLinkBridge+import com.vayunmathur.findfamily.data.WearFindFamilyStore+import com.vayunmathur.findfamily.sync.WearLinkBridge import com.vayunmathur.library.wearlink.WearShellActivity /**
findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPeopleScreen.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPeopleScreen.ktsimilarity index 96%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPeopleScreen.ktindex a7a25570d5..979f2ea7b8 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPeopleScreen.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPeopleScreen.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.ui+package com.vayunmathur.findfamily.ui import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding@@ -21,16 +21,16 @@ import androidx.wear.compose.material.Chip import androidx.wear.compose.material.ChipDefaults 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.R+import com.vayunmathur.findfamily.data.WearFindFamilyStore 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.wearStaleLabel-import com.vayunmathur.findfamily.wear.sync.WearLinkBridge+import com.vayunmathur.findfamily.domain.wearAgeLabel+import com.vayunmathur.findfamily.domain.wearDistanceSummary+import com.vayunmathur.findfamily.domain.wearStaleLabel+import com.vayunmathur.findfamily.sync.WearLinkBridge import kotlinx.coroutines.launch /**
findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPersonScreen.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPersonScreen.ktsimilarity index 94%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPersonScreen.ktindex de9a97c50a..cdf00d1036 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearPersonScreen.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearPersonScreen.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.ui+package com.vayunmathur.findfamily.ui import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth@@ -17,14 +17,14 @@ import androidx.wear.compose.material.Chip import androidx.wear.compose.material.ChipDefaults 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.R+import com.vayunmathur.findfamily.data.WearFindFamilyStore 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.wearStaleLabel+import com.vayunmathur.findfamily.domain.wearAgeLabel+import com.vayunmathur.findfamily.domain.wearDistanceSummary+import com.vayunmathur.findfamily.domain.wearStaleLabel /** * Per-person detail (Route carries [personId]): precise fix age,
findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRelativeCanvas.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRelativeCanvas.ktsimilarity index 97%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRelativeCanvas.ktindex 60eab9012f..d00affc977 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRelativeCanvas.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRelativeCanvas.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.ui+package com.vayunmathur.findfamily.ui import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.fillMaxSize@@ -10,7 +10,7 @@ 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.domain.WearRelativeProjection private val CentreColor = Color(0xFF4DA3FF) private val PersonColor = Color(0xFF7EE081)
findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRoute.kt
diff --git a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRoute.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRoute.ktsimilarity index 90%rename from findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRoute.ktrename to findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRoute.ktindex 700ce651f7..600cf73ddd 100644--- a/findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/ui/WearRoute.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/WearRoute.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.ui+package com.vayunmathur.findfamily.ui /** Watch navigation: detail routes carry the person id, never selection state. */ sealed interface WearRoute {
findfamily/src/main/res/values/wear_strings.xml
diff --git a/findfamily-wear/src/main/res/values/strings.xml b/findfamily/src/main/res/values/wear_strings.xmlsimilarity index 95%rename from findfamily-wear/src/main/res/values/strings.xmlrename to findfamily/src/main/res/values/wear_strings.xmlindex 569748ef81..5c60321823 100644--- a/findfamily-wear/src/main/res/values/strings.xml+++ b/findfamily/src/main/res/values/wear_strings.xml@@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <resources>- <string name="app_name">FindFamily</string> <string name="wear_empty">No people synced yet. Open FindFamily on your phone to sync this watch.</string> <string name="wear_people">People</string> <string name="wear_map">Map</string>
findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/WearMetadataPreviews.kt
diff --git a/findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.kt b/findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/WearMetadataPreviews.ktsimilarity index 92%rename from findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.ktrename to findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/WearMetadataPreviews.ktindex ce38a19fc7..a2f7774555 100644--- a/findfamily-wear/src/screenshotTest/kotlin/com/vayunmathur/findfamily/wear/ui/MetadataPreviews.kt+++ b/findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/WearMetadataPreviews.kt@@ -1,4 +1,4 @@-package com.vayunmathur.findfamily.wear.ui+package com.vayunmathur.findfamily.ui import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box@@ -36,12 +36,12 @@ private val fixtureSnapshot = WearFindFamilySnapshot( ) /**- * Store listing images for `:findfamily-wear` — every top-level screen/route+ * Store listing images for the watch experience of `:findfamily` — every top-level screen/route * (people home, person detail, all-people relative map). No basemap is drawn: * the relative canvas is the app's real renderer over a literal snapshot.- * `./gradlew :findfamily-wear:metadata` copies renders into `metadata_data/photos/findfamily-wear/wear/`.+ * `./gradlew :findfamily:metadata` copies renders into `metadata_data/photos/findfamily/wear/`. */-class MetadataPreviews {+class WearMetadataPreviews { @PreviewTest @Preview(name = "1-people-round", device = ROUND, group = "wear")
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 7107c5ab3f..1c2486a22a 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocolTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocolTest.kt@@ -211,4 +211,34 @@ 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)+ val other = person(2L, 100L).copy(latE7 = 378_749_000) // ~11 km north+ assertTrue(wearDistanceSummary(self, other).endsWith(" N"))+ assertEquals("", wearDistanceSummary(null, other))+ assertEquals("just now", wearAgeLabel(1_000L, 30_000L))+ assertEquals("5m ago", wearAgeLabel(0L + 1_000L, 1_000L + 5 * 60_000L))+ assertEquals("2h ago", wearAgeLabel(1_000L, 1_000L + 2 * 3_600_000L))+ assertEquals("500 m", wearFormatDistance(500.0))+ assertEquals("1.5 km", wearFormatDistance(1_500.0))+ }+ }
findfamily/src/test/java/com/vayunmathur/findfamily/platform/FormFactorTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/platform/FormFactorTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/FormFactorTest.ktnew file mode 100644index 0000000000..a9f0d85588--- /dev/null+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/platform/FormFactorTest.kt@@ -0,0 +1,19 @@+package com.vayunmathur.findfamily.platform++import kotlin.test.Test+import kotlin.test.assertFalse+import kotlin.test.assertTrue++/** The watch system feature is the single-APK routing signal. */+class FormFactorTest {++ @Test+ fun watchFeatureMeansWatch() {+ assertTrue(FormFactor.isWatch(hasWatchSystemFeature = true))+ }++ @Test+ fun noWatchFeatureMeansPhone() {+ assertFalse(FormFactor.isWatch(hasWatchSystemFeature = false))+ }+}
metadata_data/photos/findfamily/wear/1.png
diff --git a/metadata_data/photos/findfamily-wear/wear/1.png b/metadata_data/photos/findfamily/wear/1.pngsimilarity index 100%rename from metadata_data/photos/findfamily-wear/wear/1.pngrename to metadata_data/photos/findfamily/wear/1.png
metadata_data/photos/findfamily/wear/2.png
diff --git a/metadata_data/photos/findfamily-wear/wear/2.png b/metadata_data/photos/findfamily/wear/2.pngsimilarity index 100%rename from metadata_data/photos/findfamily-wear/wear/2.pngrename to metadata_data/photos/findfamily/wear/2.png
metadata_data/photos/findfamily/wear/3.png
diff --git a/metadata_data/photos/findfamily-wear/wear/3.png b/metadata_data/photos/findfamily/wear/3.pngsimilarity index 100%rename from metadata_data/photos/findfamily-wear/wear/3.pngrename to metadata_data/photos/findfamily/wear/3.png
settings.gradle.kts
diff --git a/settings.gradle.kts b/settings.gradle.ktsindex fc9c459bc9..ee7ebb53ae 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -104,7 +104,6 @@ include(":youpipe") include(":youpipe:extractor") include(":uniflix") include(":findfamily")-include(":findfamily-wear") include(":maps") include(":games:chess") include(":games:unblockjam")