library: music and notes wear protocols move into wearlink
- Commit
6c66f46ff88a1f09abc98372dec74478a29f882d- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 17:07 UTC (4 days ago)
- Parents
8a3089f
LOC Phase 2, pairs 5-6. Both verified byte-identical
modulo package (notes' truncated-delete guard already
mirrored on both sides), moved to
com.vayunmathur.library.wearlink.{music,notes} under the
same symbol names, both app copies deleted, consumers
rewired — import-only changes in co-resident dirty modules
were staged selectively so other agents' content stays
uncommitted. Golden tests were already at parity on both
sides and now pin the shared code. Net: music -177,
notes -182. structure_check wear: 7 pairs remain, OK.
Verified in one Gradle invocation: wearlink tests, both
protocol classes, both wear full suites, WearAlbumOrder,
both compiles + assembles; lints green except music's
pre-existing detector errors in untouched files.Diff
docs/structure/wear-protocol-pairs.tsv
diff --git a/docs/structure/wear-protocol-pairs.tsv b/docs/structure/wear-protocol-pairs.tsvindex 8157fe8ef2..645692709e 100644--- a/docs/structure/wear-protocol-pairs.tsv+++ b/docs/structure/wear-protocol-pairs.tsv@@ -9,13 +9,13 @@ # listed): clock (com.vayunmathur.library.wearlink.clock), launcher # (com.vayunmathur.library.wearlink.launcher), calendar # (com.vayunmathur.library.wearlink.calendar), weather-# (com.vayunmathur.library.wearlink.weather).+# (com.vayunmathur.library.wearlink.weather), music+# (com.vayunmathur.library.wearlink.music), notes+# (com.vayunmathur.library.wearlink.notes). appstore appstore/src/main/java/com/vayunmathur/appstore/domain/WearSyncProtocol.kt appstore/wear/src/main/java/com/vayunmathur/appstore/wear/domain/WearSyncProtocol.kt 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 contacts contacts/src/main/java/com/vayunmathur/contacts/domain/WearContactsProtocol.kt contacts-wear/src/main/java/com/vayunmathur/contacts/wear/domain/WearContactsProtocol.kt findfamily findfamily/src/main/java/com/vayunmathur/findfamily/domain/WearFindFamilyProtocol.kt findfamily-wear/src/main/java/com/vayunmathur/findfamily/wear/domain/WearFindFamilyProtocol.kt maps maps/src/main/java/com/vayunmathur/maps/domain/WearMapsProtocol.kt maps-wear/src/main/java/com/vayunmathur/maps/wear/domain/WearMapsProtocol.kt-music music/src/main/java/com/vayunmathur/music/domain/WearMusicProtocol.kt music-wear/src/main/java/com/vayunmathur/music/wear/domain/WearMusicProtocol.kt-notes notes/src/main/java/com/vayunmathur/notes/domain/WearNotesProtocol.kt notes-wear/src/main/java/com/vayunmathur/notes/wear/domain/WearNotesProtocol.kt todo todo/src/main/java/com/vayunmathur/todo/domain/WearTodoProtocol.kt todo-wear/src/main/java/com/vayunmathur/todo/wear/domain/WearTodoProtocol.kt
library/wearlink/AGENTS.md
diff --git a/library/wearlink/AGENTS.md b/library/wearlink/AGENTS.mdindex f580fd3287..86bcde4ef1 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. Remaining pairs are listed in+Migrated: clock, launcher, calendar, weather, music, notes. Remaining pairs are listed in `docs/structure/wear-protocol-pairs.tsv`. ## Verify
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/music/WearMusicProtocol.kt
diff --git a/music/src/main/java/com/vayunmathur/music/domain/WearMusicProtocol.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/music/WearMusicProtocol.ktsimilarity index 94%rename from music/src/main/java/com/vayunmathur/music/domain/WearMusicProtocol.ktrename to library/wearlink/src/main/java/com/vayunmathur/library/wearlink/music/WearMusicProtocol.ktindex 2ff3b515f2..55bbc8951b 100644--- a/music/src/main/java/com/vayunmathur/music/domain/WearMusicProtocol.kt+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/music/WearMusicProtocol.kt@@ -1,4 +1,4 @@-package com.vayunmathur.music.domain+package com.vayunmathur.library.wearlink.music import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json@@ -6,11 +6,10 @@ import kotlinx.serialization.json.Json /** * Phone <-> watch protocol for the Wear OS Music companion. *- * SINGLE SOURCE OF TRUTH, DELIBERATELY DUPLICATED: Gradle cannot let one- * application module depend on another, so the wear module (`:music:wear`,- * applicationId `com.vayunmathur.music`) carries a copy under- * `com.vayunmathur.music.wear.domain`. Change both copies together; each- * side's `WearMusicProtocolTest` pins the same golden JSON.+ * Shared by the phone (`:music`) and the watch (`:music:wear`)+ * through `:library:wearlink`; neither app module depends on the other.+ * Each side's `WearMusicProtocolTest` pins the same golden JSON against+ * this code. * * Design (owner direction): the phone owns the catalog and ALL audio * playback. The watch never stores music files and never warehouses the
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/notes/WearNotesProtocol.kt
diff --git a/notes/src/main/java/com/vayunmathur/notes/domain/WearNotesProtocol.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/notes/WearNotesProtocol.ktsimilarity index 95%rename from notes/src/main/java/com/vayunmathur/notes/domain/WearNotesProtocol.ktrename to library/wearlink/src/main/java/com/vayunmathur/library/wearlink/notes/WearNotesProtocol.ktindex ce979d8927..d8c58df783 100644--- a/notes/src/main/java/com/vayunmathur/notes/domain/WearNotesProtocol.kt+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/notes/WearNotesProtocol.kt@@ -1,4 +1,4 @@-package com.vayunmathur.notes.domain+package com.vayunmathur.library.wearlink.notes import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString@@ -7,11 +7,10 @@ import kotlinx.serialization.json.Json /** * Phone <-> watch sync protocol for the Wear OS Notes companion. *- * SINGLE SOURCE OF TRUTH, DELIBERATELY DUPLICATED: Gradle cannot let one- * application module depend on another, so the wear module (`:notes-wear`,- * applicationId `com.vayunmathur.notes`) carries a copy of this file under- * `com.vayunmathur.notes.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 (`:notes`) and the watch (`:notes-wear`)+ * through `:library:wearlink`; neither app module depends on the other.+ * Each side's unit tests pin the same golden JSON against this code so a+ * one-sided edit fails loudly. * * Transport (WearLink, :library:wearlink — RFCOMM, no Play services): * - Presence is a completed handshake for [CAPABILITY] (the appId).
music-wear/AGENTS.md
diff --git a/music-wear/AGENTS.md b/music-wear/AGENTS.mdindex 3df5b2a4b7..1f6f436bbc 100644--- a/music-wear/AGENTS.md+++ b/music-wear/AGENTS.md@@ -16,9 +16,11 @@ changing either breaks phone<->watch sync. Bootstrap is a one-time ADB sideload of this APK onto the watch. ## Protocol-`domain/WearMusicProtocol.kt` is a copy of the phone's file (Gradle cannot-depend on another app module). Change both copies together; each side's-`WearMusicProtocolTest` pins the same golden JSON.+The wire protocol lives in `:library:wearlink` at+`com.vayunmathur.library.wearlink.music.WearMusicProtocol` (shared by+`:music` and `:music:wear`; neither app module depends on the other).+Each side's `WearMusicProtocolTest` pins the same golden JSON against+that shared code. - Page snapshots: WearLink data item (`/music/page`, phone -> watch), requested by message (`/music/page-request`, watch -> phone)
music-wear/src/main/java/com/vayunmathur/music/wear/data/WearMusicStore.kt
diff --git a/music-wear/src/main/java/com/vayunmathur/music/wear/data/WearMusicStore.kt b/music-wear/src/main/java/com/vayunmathur/music/wear/data/WearMusicStore.ktindex 4bfc1ec582..27e9f5d956 100644--- a/music-wear/src/main/java/com/vayunmathur/music/wear/data/WearMusicStore.kt+++ b/music-wear/src/main/java/com/vayunmathur/music/wear/data/WearMusicStore.kt@@ -2,14 +2,14 @@ package com.vayunmathur.music.wear.data import android.content.Context import com.vayunmathur.library.log.Log-import com.vayunmathur.music.wear.domain.WearMusicOp-import com.vayunmathur.music.wear.domain.WearMusicProtocol-import com.vayunmathur.music.wear.domain.WearOpKind-import com.vayunmathur.music.wear.domain.WearPageId-import com.vayunmathur.music.wear.domain.WearPageKey-import com.vayunmathur.music.wear.domain.WearPageSnapshot-import com.vayunmathur.music.wear.domain.WearPlaybackState-import com.vayunmathur.music.wear.domain.WearWatchState+import com.vayunmathur.library.wearlink.music.WearMusicOp+import com.vayunmathur.library.wearlink.music.WearMusicProtocol+import com.vayunmathur.library.wearlink.music.WearOpKind+import com.vayunmathur.library.wearlink.music.WearPageId+import com.vayunmathur.library.wearlink.music.WearPageKey+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaybackState+import com.vayunmathur.library.wearlink.music.WearWatchState import com.vayunmathur.music.wear.sync.WearLinkBridge import java.io.File import kotlinx.coroutines.flow.MutableStateFlow
music-wear/src/main/java/com/vayunmathur/music/wear/domain/WearMusicProtocol.kt
diff --git a/music-wear/src/main/java/com/vayunmathur/music/wear/domain/WearMusicProtocol.kt b/music-wear/src/main/java/com/vayunmathur/music/wear/domain/WearMusicProtocol.ktdeleted file mode 100644index ea786237fa..0000000000--- a/music-wear/src/main/java/com/vayunmathur/music/wear/domain/WearMusicProtocol.kt+++ /dev/null@@ -1,198 +0,0 @@-package com.vayunmathur.music.wear.domain--import kotlinx.serialization.Serializable-import kotlinx.serialization.json.Json--/**- * Phone <-> watch protocol for the Wear OS Music companion.- *- * SINGLE SOURCE OF TRUTH, DELIBERATELY DUPLICATED: Gradle cannot let one- * application module depend on another, so the wear module (`:music:wear`,- * applicationId `com.vayunmathur.music`) carries a copy under- * `com.vayunmathur.music.wear.domain`. Change both copies together; each- * side's `WearMusicProtocolTest` pins the same golden JSON.- *- * Design (owner direction): the phone owns the catalog and ALL audio- * playback. The watch never stores music files and never warehouses the- * whole catalog. Instead the phone serves bounded page snapshots keyed by- * [WearPageKey] with cursor pagination; the watch caches visited pages for- * offline browsing. Now-playing is a small [WearPlaybackState] streamed as- * a data item. Every playback action is a [WearMusicOp] sent to the phone,- * which executes it in its playback service; the watch UI only reflects the- * resulting [WearPlaybackState]. No audio plays on the watch itself.- */-object WearMusicProtocol {- /** WearLink appId the phone requires in the peer handshake. */- const val CAPABILITY = "music_wear_companion"-- /** Data-item path (phone -> watch): one [WearPageSnapshot] JSON. */- const val PAGE_PATH = "/music/page"-- /** Data-item path (phone -> watch): the [WearPlaybackState] JSON. */- const val PLAYBACK_PATH = "/music/playback"-- /** Data-item path (watch -> phone): the [WearWatchState] JSON. */- const val WATCH_STATE_PATH = "/music/watch-state"-- /** Message path (watch -> phone): one [WearPageRequest] JSON. */- const val PAGE_REQUEST_PATH = "/music/page-request"-- /** Message path (watch -> phone): one [WearMusicOp] JSON. */- const val OP_PATH = "/music/op"-- /** Message path (watch -> phone): one [WearSearchRequest] JSON. */- const val SEARCH_REQUEST_PATH = "/music/search-request"-- /** Tracks/artists/albums per page; keeps one frame small on the watch. */- const val PAGE_SIZE = 30-- /** Largest page/playback JSON in UTF-8 bytes. */- const val MAX_JSON_BYTES = 45_000-- /** Largest playback queue page carried in state (full queue stays on phone). */- const val MAX_QUEUE_ITEMS = 50-- /** Field caps. */- const val MAX_TITLE_CHARS = 120- const val MAX_NAME_CHARS = 120-- /** Wire JSON: unknown keys ignored so a newer side never breaks an older one. */- val json: Json = Json { ignoreUnknownKeys = true }-}--/** Every phone page/route, mirrored 1:1 as a watch page key. */-@Serializable-enum class WearPageKey {- HOME, ALBUMS, ARTISTS, PLAYLISTS, TRACKS,- ALBUM_DETAIL, ARTIST_DETAIL, PLAYLIST_DETAIL,- SEARCH, QUEUE, NOW_PLAYING, SETTINGS,-}--/** Identifies one bounded page: route + entity id + search query. */-@Serializable-data class WearPageId(- val key: WearPageKey,- val entityId: Long = 0L,- val query: String = "",-)--/** Id-carrying page request (watch -> phone). [cursor] is the opaque next-page cursor, "" = first page. */-@Serializable-data class WearPageRequest(val page: WearPageId, val cursor: String = "")--/** Search request (watch -> phone): dictation/typed text lives in [WearPageRequest.page.query]. */-@Serializable-data class WearSearchRequest(val query: String, val cursor: String = "")--/** One track row, trimmed to watch size. IDs are phone library IDs. */-@Serializable-data class WearTrack(- val id: Long,- val title: String,- val artist: String = "",- val album: String = "",- val durationMs: Long = 0L,- val isPlaying: Boolean = false,-)--/** One album row. */-@Serializable-data class WearAlbum(val id: Long, val name: String, val artistName: String = "", val trackCount: Int = 0)--/** One artist row. */-@Serializable-data class WearArtist(val id: Long, val name: String, val albumCount: Int = 0)--/** One playlist row. */-@Serializable-data class WearPlaylist(val id: Long, val name: String, val trackCount: Int = 0)--/** One bounded page snapshot (phone -> watch). [nextCursor] empty = last page. */-@Serializable-data class WearPageSnapshot(- val page: WearPageId,- val generation: Long = 0L,- val tracks: List<WearTrack> = emptyList(),- val albums: List<WearAlbum> = emptyList(),- val artists: List<WearArtist> = emptyList(),- val playlists: List<WearPlaylist> = emptyList(),- val nextCursor: String = "",- val totalCount: Int = 0,- val truncated: Boolean = false,-)--/** Now-playing state streamed phone -> watch; the phone service is the only player. */-@Serializable-data class WearPlaybackState(- val trackId: Long? = null,- val title: String = "",- val artist: String = "",- val album: String = "",- val isPlaying: Boolean = false,- val positionMs: Long = 0L,- val durationMs: Long = 0L,- val shuffle: Boolean = false,- /** Mirrors media3 Player repeat constants: 0=off, 1=one, 2=all. */- val repeatMode: Int = 0,- val queue: List<WearTrack> = emptyList(),- val queueIndex: Int = -1,- val sourceName: String = "",- val lyricsSnippet: String = "",-)--/** What the watch last applied, published at [WearMusicProtocol.WATCH_STATE_PATH]. */-@Serializable-data class WearWatchState(- val appliedGeneration: Long = 0L,- val cachedPages: Int = 0,- val pendingOps: Int = 0,-)--/** Kinds of watch-originated ops; all execute on the phone only. */-@Serializable-enum class WearOpKind {- PLAY_TRACKS, PLAY_SHUFFLED, TOGGLE_PLAY_PAUSE, SEEK, SKIP_NEXT, SKIP_PREVIOUS,- TOGGLE_SHUFFLE, CYCLE_REPEAT, PLAY_ALBUM, PLAY_ARTIST, PLAY_PLAYLIST,- ADD_TO_QUEUE, ADD_TO_PLAYLIST, CREATE_PLAYLIST,-}--/**- * One watch-originated op ([WearMusicProtocol.OP_PATH]). The phone executes- * it against its playback service / library; the watch never claims success- * until the next [WearPlaybackState]/page reflects it.- */-@Serializable-data class WearMusicOp(- val kind: WearOpKind,- val trackIds: List<Long> = emptyList(),- val startIndex: Int = 0,- val entityId: Long = 0L,- val positionMs: Long = 0L,- val text: String = "",- val sourceName: String = "",-)--/** Pure playback state machine: applies an op's *result* (as reported by the phone) to prior state. */-fun reducePlayback(state: WearPlaybackState, op: WearMusicOp, reported: WearPlaybackState): WearPlaybackState = reported--/** Next repeat mode in the phone's cycle: off -> all -> one -> off. */-fun nextWearRepeatMode(mode: Int): Int = when (mode) { 0 -> 2; 2 -> 1; else -> 0 }--/**- * Builds one bounded page from a full ordered list using an offset cursor.- * Cursor is the decimal offset of the next item; malformed/overflow cursors- * restart at the first page rather than crashing the watch.- */-fun <T> paginateWearPage(items: List<T>, cursor: String, pageSize: Int = WearMusicProtocol.PAGE_SIZE): Pair<List<T>, String> {- val offset = cursor.toIntOrNull()?.coerceIn(0, items.size) ?: 0- val slice = items.drop(offset).take(pageSize)- val next = if (offset + slice.size < items.size) (offset + slice.size).toString() else ""- return slice to next-}--/** Caps one track's fields to watch size. */-fun capWearTrack(track: WearTrack): WearTrack = track.copy(- title = track.title.take(WearMusicProtocol.MAX_TITLE_CHARS),- artist = track.artist.take(WearMusicProtocol.MAX_NAME_CHARS),- album = track.album.take(WearMusicProtocol.MAX_NAME_CHARS),-)
music-wear/src/main/java/com/vayunmathur/music/wear/sync/WearLinkBridge.kt
diff --git a/music-wear/src/main/java/com/vayunmathur/music/wear/sync/WearLinkBridge.kt b/music-wear/src/main/java/com/vayunmathur/music/wear/sync/WearLinkBridge.ktindex 0b95ace036..8261a5a05c 100644--- a/music-wear/src/main/java/com/vayunmathur/music/wear/sync/WearLinkBridge.kt+++ b/music-wear/src/main/java/com/vayunmathur/music/wear/sync/WearLinkBridge.kt@@ -6,13 +6,13 @@ import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkNode import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.music.wear.data.WearMusicStore-import com.vayunmathur.music.wear.domain.WearMusicOp-import com.vayunmathur.music.wear.domain.WearMusicProtocol-import com.vayunmathur.music.wear.domain.WearPageRequest-import com.vayunmathur.music.wear.domain.WearPageSnapshot-import com.vayunmathur.music.wear.domain.WearPlaybackState-import com.vayunmathur.music.wear.domain.WearSearchRequest-import com.vayunmathur.music.wear.domain.WearWatchState+import com.vayunmathur.library.wearlink.music.WearMusicOp+import com.vayunmathur.library.wearlink.music.WearMusicProtocol+import com.vayunmathur.library.wearlink.music.WearPageRequest+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaybackState+import com.vayunmathur.library.wearlink.music.WearSearchRequest+import com.vayunmathur.library.wearlink.music.WearWatchState import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob
music-wear/src/main/java/com/vayunmathur/music/wear/ui/WearMusicRoot.kt
diff --git a/music-wear/src/main/java/com/vayunmathur/music/wear/ui/WearMusicRoot.kt b/music-wear/src/main/java/com/vayunmathur/music/wear/ui/WearMusicRoot.ktindex eef8e378b8..43b07aacfe 100644--- a/music-wear/src/main/java/com/vayunmathur/music/wear/ui/WearMusicRoot.kt+++ b/music-wear/src/main/java/com/vayunmathur/music/wear/ui/WearMusicRoot.kt@@ -21,13 +21,13 @@ import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.Text import com.vayunmathur.music.wear.R import com.vayunmathur.music.wear.data.WearMusicStore-import com.vayunmathur.music.wear.domain.WearMusicOp-import com.vayunmathur.music.wear.domain.WearOpKind-import com.vayunmathur.music.wear.domain.WearPageId-import com.vayunmathur.music.wear.domain.WearPageKey-import com.vayunmathur.music.wear.domain.WearPageRequest-import com.vayunmathur.music.wear.domain.WearPageSnapshot-import com.vayunmathur.music.wear.domain.WearPlaybackState+import com.vayunmathur.library.wearlink.music.WearMusicOp+import com.vayunmathur.library.wearlink.music.WearOpKind+import com.vayunmathur.library.wearlink.music.WearPageId+import com.vayunmathur.library.wearlink.music.WearPageKey+import com.vayunmathur.library.wearlink.music.WearPageRequest+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaybackState import com.vayunmathur.music.wear.sync.WearLinkBridge /** Root switch over [WearRoute]: every phone page has exactly one watch screen here. */
music-wear/src/screenshotTest/kotlin/com/vayunmathur/music/wear/ui/MetadataPreviews.kt
diff --git a/music-wear/src/screenshotTest/kotlin/com/vayunmathur/music/wear/ui/MetadataPreviews.kt b/music-wear/src/screenshotTest/kotlin/com/vayunmathur/music/wear/ui/MetadataPreviews.ktindex b7b906ccd9..a66b8de556 100644--- a/music-wear/src/screenshotTest/kotlin/com/vayunmathur/music/wear/ui/MetadataPreviews.kt+++ b/music-wear/src/screenshotTest/kotlin/com/vayunmathur/music/wear/ui/MetadataPreviews.kt@@ -10,14 +10,14 @@ 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.music.wear.domain.WearPageId-import com.vayunmathur.music.wear.domain.WearPageKey-import com.vayunmathur.music.wear.domain.WearPageSnapshot-import com.vayunmathur.music.wear.domain.WearPlaybackState-import com.vayunmathur.music.wear.domain.WearTrack-import com.vayunmathur.music.wear.domain.WearAlbum-import com.vayunmathur.music.wear.domain.WearArtist-import com.vayunmathur.music.wear.domain.WearPlaylist+import com.vayunmathur.library.wearlink.music.WearPageId+import com.vayunmathur.library.wearlink.music.WearPageKey+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaybackState+import com.vayunmathur.library.wearlink.music.WearTrack+import com.vayunmathur.library.wearlink.music.WearAlbum+import com.vayunmathur.library.wearlink.music.WearArtist+import com.vayunmathur.library.wearlink.music.WearPlaylist /** Round watch, 454x454px class (227dp at 320dpi) — Pixel Watch / Galaxy Watch size. */ private const val ROUND = "spec:width=227dp,height=227dp,dpi=320"
music-wear/src/test/java/com/vayunmathur/music/wear/data/WearPendingOpsTest.kt
diff --git a/music-wear/src/test/java/com/vayunmathur/music/wear/data/WearPendingOpsTest.kt b/music-wear/src/test/java/com/vayunmathur/music/wear/data/WearPendingOpsTest.ktindex e53d226dbd..3a49622de4 100644--- a/music-wear/src/test/java/com/vayunmathur/music/wear/data/WearPendingOpsTest.kt+++ b/music-wear/src/test/java/com/vayunmathur/music/wear/data/WearPendingOpsTest.kt@@ -1,12 +1,12 @@ package com.vayunmathur.music.wear.data -import com.vayunmathur.music.wear.domain.WearMusicOp-import com.vayunmathur.music.wear.domain.WearOpKind-import com.vayunmathur.music.wear.domain.WearPageId-import com.vayunmathur.music.wear.domain.WearPageKey-import com.vayunmathur.music.wear.domain.WearPageSnapshot-import com.vayunmathur.music.wear.domain.WearPlaylist-import com.vayunmathur.music.wear.domain.WearTrack+import com.vayunmathur.library.wearlink.music.WearMusicOp+import com.vayunmathur.library.wearlink.music.WearOpKind+import com.vayunmathur.library.wearlink.music.WearPageId+import com.vayunmathur.library.wearlink.music.WearPageKey+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaylist+import com.vayunmathur.library.wearlink.music.WearTrack import kotlin.test.Test import kotlin.test.assertEquals
music-wear/src/test/java/com/vayunmathur/music/wear/domain/WearMusicProtocolTest.kt
diff --git a/music-wear/src/test/java/com/vayunmathur/music/wear/domain/WearMusicProtocolTest.kt b/music-wear/src/test/java/com/vayunmathur/music/wear/domain/WearMusicProtocolTest.ktindex c3e48e58b5..d4a015e6c9 100644--- a/music-wear/src/test/java/com/vayunmathur/music/wear/domain/WearMusicProtocolTest.kt+++ b/music-wear/src/test/java/com/vayunmathur/music/wear/domain/WearMusicProtocolTest.kt@@ -1,4 +1,15 @@ package com.vayunmathur.music.wear.domain+import com.vayunmathur.library.wearlink.music.WearMusicOp+import com.vayunmathur.library.wearlink.music.WearMusicProtocol+import com.vayunmathur.library.wearlink.music.WearOpKind+import com.vayunmathur.library.wearlink.music.WearPageId+import com.vayunmathur.library.wearlink.music.WearPageKey+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaybackState+import com.vayunmathur.library.wearlink.music.WearTrack+import com.vayunmathur.library.wearlink.music.nextWearRepeatMode+import com.vayunmathur.library.wearlink.music.paginateWearPage+import com.vayunmathur.library.wearlink.music.reducePlayback import kotlin.test.Test import kotlin.test.assertEquals
music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt
diff --git a/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt b/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.ktindex 0cf63cf471..8de7f98156 100644--- a/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt+++ b/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt@@ -4,21 +4,21 @@ import android.content.Context import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkNode import com.vayunmathur.music.data.MusicRepository-import com.vayunmathur.music.domain.WearAlbum-import com.vayunmathur.music.domain.WearArtist-import com.vayunmathur.music.domain.WearMusicOp-import com.vayunmathur.music.domain.WearMusicProtocol-import com.vayunmathur.music.domain.WearOpKind-import com.vayunmathur.music.domain.WearPageId-import com.vayunmathur.music.domain.WearPageKey-import com.vayunmathur.music.domain.WearPageRequest-import com.vayunmathur.music.domain.WearPageSnapshot-import com.vayunmathur.music.domain.WearPlaylist-import com.vayunmathur.music.domain.WearPlaybackState-import com.vayunmathur.music.domain.WearSearchRequest-import com.vayunmathur.music.domain.WearTrack-import com.vayunmathur.music.domain.capWearTrack-import com.vayunmathur.music.domain.paginateWearPage+import com.vayunmathur.library.wearlink.music.WearAlbum+import com.vayunmathur.library.wearlink.music.WearArtist+import com.vayunmathur.library.wearlink.music.WearMusicOp+import com.vayunmathur.library.wearlink.music.WearMusicProtocol+import com.vayunmathur.library.wearlink.music.WearOpKind+import com.vayunmathur.library.wearlink.music.WearPageId+import com.vayunmathur.library.wearlink.music.WearPageKey+import com.vayunmathur.library.wearlink.music.WearPageRequest+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaylist+import com.vayunmathur.library.wearlink.music.WearPlaybackState+import com.vayunmathur.library.wearlink.music.WearSearchRequest+import com.vayunmathur.library.wearlink.music.WearTrack+import com.vayunmathur.library.wearlink.music.capWearTrack+import com.vayunmathur.library.wearlink.music.paginateWearPage import com.vayunmathur.music.platform.PlaybackManager import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers
music/src/test/java/com/vayunmathur/music/domain/WearMusicProtocolTest.kt
diff --git a/music/src/test/java/com/vayunmathur/music/domain/WearMusicProtocolTest.kt b/music/src/test/java/com/vayunmathur/music/domain/WearMusicProtocolTest.ktindex a593e62d17..5663d74ec0 100644--- a/music/src/test/java/com/vayunmathur/music/domain/WearMusicProtocolTest.kt+++ b/music/src/test/java/com/vayunmathur/music/domain/WearMusicProtocolTest.kt@@ -1,4 +1,15 @@ package com.vayunmathur.music.domain+import com.vayunmathur.library.wearlink.music.WearMusicOp+import com.vayunmathur.library.wearlink.music.WearMusicProtocol+import com.vayunmathur.library.wearlink.music.WearOpKind+import com.vayunmathur.library.wearlink.music.WearPageId+import com.vayunmathur.library.wearlink.music.WearPageKey+import com.vayunmathur.library.wearlink.music.WearPageSnapshot+import com.vayunmathur.library.wearlink.music.WearPlaybackState+import com.vayunmathur.library.wearlink.music.WearTrack+import com.vayunmathur.library.wearlink.music.nextWearRepeatMode+import com.vayunmathur.library.wearlink.music.paginateWearPage+import com.vayunmathur.library.wearlink.music.reducePlayback import kotlin.test.Test import kotlin.test.assertEquals
notes-wear/AGENTS.md
diff --git a/notes-wear/AGENTS.md b/notes-wear/AGENTS.mdindex 9a44c4e289..2ab901097a 100644--- a/notes-wear/AGENTS.md+++ b/notes-wear/AGENTS.md@@ -16,9 +16,11 @@ changing either breaks phone<->watch sync. Bootstrap is a one-time ADB sideload of this APK onto the watch. ## Protocol-`domain/WearNotesProtocol.kt` is a copy of the phone's file (Gradle cannot-depend on another app module). Change both copies together; each side's-`WearNotesProtocolTest` pins the same golden JSON.+The wire protocol lives in `:library:wearlink` at+`com.vayunmathur.library.wearlink.notes.WearNotesProtocol` (shared by+`:notes` and `:notes-wear`; neither app module depends on the other).+Each side's `WearNotesProtocolTest` pins the same golden JSON against+that shared code. - Snapshot + watch-state sync: WearLink data items (`/notes/snapshot`, `/notes/watch-state`) - Watch-originated ops: WearLink message (`/notes/op`, create/edit/delete)
notes-wear/build.gradle.kts
diff --git a/notes-wear/build.gradle.kts b/notes-wear/build.gradle.ktsindex 76a033feca..0ed68a0325 100644--- a/notes-wear/build.gradle.kts+++ b/notes-wear/build.gradle.kts@@ -31,8 +31,7 @@ android { } dependencies {- // Watch side of the Wear OS sync (see domain/WearNotesProtocol.kt, the- // copy of the phone protocol it must stay in step with).+ // Watch side of the Wear OS sync (protocol in :library:wearlink). implementation(libs.kotlinx.coroutines.android) implementation(project(":library:wearlink")) testImplementation(libs.kotlin.test)
notes-wear/src/main/java/com/vayunmathur/notes/wear/data/WearNotesStore.kt
diff --git a/notes-wear/src/main/java/com/vayunmathur/notes/wear/data/WearNotesStore.kt b/notes-wear/src/main/java/com/vayunmathur/notes/wear/data/WearNotesStore.ktindex 691706bbc9..9774392aa8 100644--- a/notes-wear/src/main/java/com/vayunmathur/notes/wear/data/WearNotesStore.kt+++ b/notes-wear/src/main/java/com/vayunmathur/notes/wear/data/WearNotesStore.kt@@ -2,13 +2,13 @@ package com.vayunmathur.notes.wear.data import android.content.Context import com.vayunmathur.library.log.Log-import com.vayunmathur.notes.wear.domain.WearNote-import com.vayunmathur.notes.wear.domain.WearNoteOp-import com.vayunmathur.notes.wear.domain.WearNotesProtocol-import com.vayunmathur.notes.wear.domain.WearNotesSnapshot-import com.vayunmathur.notes.wear.domain.WearOpKind-import com.vayunmathur.notes.wear.domain.mergeWearSnapshot-import com.vayunmathur.notes.wear.domain.reflectedOps+import com.vayunmathur.library.wearlink.notes.WearNote+import com.vayunmathur.library.wearlink.notes.WearNoteOp+import com.vayunmathur.library.wearlink.notes.WearNotesProtocol+import com.vayunmathur.library.wearlink.notes.WearNotesSnapshot+import com.vayunmathur.library.wearlink.notes.WearOpKind+import com.vayunmathur.library.wearlink.notes.mergeWearSnapshot+import com.vayunmathur.library.wearlink.notes.reflectedOps import java.io.File import java.util.UUID import kotlinx.coroutines.flow.MutableStateFlow
notes-wear/src/main/java/com/vayunmathur/notes/wear/domain/WearNotesProtocol.kt
diff --git a/notes-wear/src/main/java/com/vayunmathur/notes/wear/domain/WearNotesProtocol.kt b/notes-wear/src/main/java/com/vayunmathur/notes/wear/domain/WearNotesProtocol.ktdeleted file mode 100644index dc888e2257..0000000000--- a/notes-wear/src/main/java/com/vayunmathur/notes/wear/domain/WearNotesProtocol.kt+++ /dev/null@@ -1,199 +0,0 @@-package com.vayunmathur.notes.wear.domain--import kotlinx.serialization.Serializable-import kotlinx.serialization.encodeToString-import kotlinx.serialization.json.Json--/**- * Phone <-> watch sync protocol for the Wear OS Notes companion.- *- * SINGLE SOURCE OF TRUTH, DELIBERATELY DUPLICATED: Gradle cannot let one- * application module depend on another, so the wear module (`:notes-wear`,- * applicationId `com.vayunmathur.notes`) carries a copy of this file under- * `com.vayunmathur.notes.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 (bounded recent notes) and- * [WATCH_STATE_PATH] watch -> phone (what the watch applied + pending ops).- * - Messages: [OP_PATH] watch -> phone (one create/edit/delete) and- * [REQUEST_SYNC_PATH] watch -> phone (ask for a fresh snapshot).- * Delivery needs a live session; nothing wakes a dead phone process.- *- * Conflict policy — last-writer-wins per note, stated plainly: for one- * `syncId`, the version with the larger `updatedAt` wins on both sides.- * Ties break deterministically: a tombstone beats a live note, then the- * lexicographically larger (title, body) wins. Watch edits stamp- * `max(now, editedVersion.updatedAt + 1)` so an edit always beats the- * version it was made from, even with a skewed watch clock; an edit made- * from a stale copy can still lose to a newer phone edit — that is LWW,- * not merging, and no text merge is attempted or claimed.- *- * Honest write scope: the watch body is plain text (`Note.content`). A- * note whose phone body contains image/ink blocks is flagged- * `textOnly = false`: the watch renders its text but offers no edit (a- * text-only replacement would destroy the blocks). Delete is offered for- * every note — a tombstone destroys nothing the phone cannot still show- * as deleted — and create/edit only ever produce a single text block on- * the phone. No watch action claims a write until the phone applies it- * and the next snapshot reflects it; unreflected ops stay pending.- */-object WearNotesProtocol {- /** WearLink appId the phone requires in the peer handshake. */- const val CAPABILITY = "notes_wear_companion"-- /** Data-item path (phone -> watch): the [WearNotesSnapshot] JSON. */- const val SNAPSHOT_PATH = "/notes/snapshot"-- /** Data-item path (watch -> phone): the [WearWatchState] JSON. */- const val WATCH_STATE_PATH = "/notes/watch-state"-- /** Message path (watch -> phone): one [WearNoteOp] JSON. */- const val OP_PATH = "/notes/op"-- /** Message path (watch -> phone): ask the phone to publish a fresh snapshot. */- const val REQUEST_SYNC_PATH = "/notes/request-sync"-- /** Most-recent notes in one snapshot; a watch renders a short list. */- const val MAX_NOTES = 50-- /** Largest snapshot JSON in UTF-8 bytes (near the old 100 KB DataItem ceiling). */- const val MAX_JSON_BYTES = 90_000-- /** Field caps applied when a snapshot is built. */- const val MAX_TITLE_CHARS = 120- const val MAX_BODY_CHARS = 4_000-- /** Wire JSON: unknown keys ignored so a newer side never breaks an older one. */- val json: Json = Json { ignoreUnknownKeys = true }-}--/** One note trimmed to watch size. [syncId] is the phone note's stable sync identity. */-@Serializable-data class WearNote(- val syncId: String,- val title: String,- /** Plain-text body, capped at [WearNotesProtocol.MAX_BODY_CHARS]. */- val body: String = "",- /** Last-writer-wins stamp (epoch millis / hybrid stamp on the phone). */- val updatedAt: Long = 0L,- val deleted: Boolean = false,- /** False when the phone body has image/ink blocks: watch is read-only for it. */- val textOnly: Boolean = true,- /** True when [body] was cut at the cap; the full text stays on the phone. */- val bodyTruncated: Boolean = false,-)--/** The phone's bounded recent-notes snapshot for the watch ([WearNotesProtocol.SNAPSHOT_PATH]). */-@Serializable-data class WearNotesSnapshot(- val generatedAtMillis: Long = 0L,- /** Live notes only, most recently updated first. */- val notes: List<WearNote> = emptyList(),- /** True when the count/byte caps dropped notes. */- val truncated: Boolean = false,-)--/** What the watch last applied, published at [WearNotesProtocol.WATCH_STATE_PATH]. */-@Serializable-data class WearWatchState(- val appliedGeneratedAtMillis: Long = 0L,- val noteCount: Int = 0,- /** Watch-originated ops not yet reflected in a phone snapshot. */- val pendingOps: Int = 0,-)--/** Kind of a watch-originated change. */-@Serializable-enum class WearOpKind { UPSERT, DELETE }--/** One watch-originated create/edit (UPSERT) or delete (DELETE), as [WearNotesProtocol.OP_PATH]. */-@Serializable-data class WearNoteOp(- val kind: WearOpKind,- val note: WearNote,-)--/**- * True when [candidate] wins over [incumbent] under the stated LWW policy- * (see [WearNotesProtocol]): larger `updatedAt`, then tombstone, then the- * lexicographically larger (title, body). Identical versions never win.- */-fun wearNoteWins(candidate: WearNote, incumbent: WearNote): Boolean {- if (candidate.updatedAt != incumbent.updatedAt) return candidate.updatedAt > incumbent.updatedAt- if (candidate.deleted != incumbent.deleted) return candidate.deleted- if (candidate.title != incumbent.title) return candidate.title > incumbent.title- return candidate.body > incumbent.body-}--/**- * Builds a bounded snapshot: most-recently-updated live notes first, field- * caps applied, then [WearNotesProtocol.MAX_NOTES] and- * [WearNotesProtocol.MAX_JSON_BYTES] enforced by dropping the oldest kept- * notes (recent notes — the watch's main screen — survive longest).- */-fun buildWearSnapshot(candidates: List<WearNote>, generatedAtMillis: Long): WearNotesSnapshot {- val sorted = candidates- .filter { !it.deleted }- .sortedWith(compareByDescending<WearNote> { it.updatedAt }.thenBy { it.syncId })- .map { note ->- note.copy(- title = note.title.take(WearNotesProtocol.MAX_TITLE_CHARS),- body = note.body.take(WearNotesProtocol.MAX_BODY_CHARS),- bodyTruncated = note.bodyTruncated || note.body.length > WearNotesProtocol.MAX_BODY_CHARS,- )- }- var kept = sorted.take(WearNotesProtocol.MAX_NOTES)- var truncated = kept.size < sorted.size- var snapshot = WearNotesSnapshot(generatedAtMillis, kept, truncated)- while (kept.isNotEmpty() &&- WearNotesProtocol.json.encodeToString(snapshot).encodeToByteArray().size >- WearNotesProtocol.MAX_JSON_BYTES- ) {- kept = kept.dropLast(1)- truncated = true- snapshot = snapshot.copy(notes = kept, truncated = true)- }- return snapshot-}--/**- * Merges a phone [snapshot] into the watch's local view: a pending- * watch-originated op wins over the snapshot copy of the same note when- * [wearNoteWins] says so (the phone has not applied/reflected it yet);- * otherwise the snapshot is truth. Pending deletes hide their note.- * Result is most-recent first and contains no tombstones.- */-fun mergeWearSnapshot(- snapshot: WearNotesSnapshot,- pendingOps: List<WearNoteOp>,-): List<WearNote> {- val byId = snapshot.notes.associateBy { it.syncId }.toMutableMap()- for (op in pendingOps) {- val local = op.note- val remote = byId[local.syncId]- if (remote == null || wearNoteWins(local, remote)) {- if (local.deleted) byId.remove(local.syncId) else byId[local.syncId] = local- }- }- return byId.values- .filter { !it.deleted }- .sortedWith(compareByDescending<WearNote> { it.updatedAt }.thenBy { it.syncId })-}--/** Ops already reflected by [snapshot] (snapshot version is at least as new) and safe to drop. */-fun reflectedOps(snapshot: WearNotesSnapshot, pendingOps: List<WearNoteOp>): List<WearNoteOp> =- pendingOps.filter { op ->- val remote = snapshot.notes.firstOrNull { it.syncId == op.note.syncId }- when {- // A delete is reflected when the note is gone from a complete live- // snapshot. Absence from a truncated snapshot proves nothing: the- // count/byte caps may have dropped the still-live note, so the- // delete stays pending (and is resent) until a complete snapshot- // confirms the phone no longer holds it.- op.kind == WearOpKind.DELETE -> remote == null && !snapshot.truncated- remote == null -> false- else -> !wearNoteWins(op.note, remote)- }- }
notes-wear/src/main/java/com/vayunmathur/notes/wear/sync/WearLinkBridge.kt
diff --git a/notes-wear/src/main/java/com/vayunmathur/notes/wear/sync/WearLinkBridge.kt b/notes-wear/src/main/java/com/vayunmathur/notes/wear/sync/WearLinkBridge.ktindex e3f7452001..7ac2843c2b 100644--- a/notes-wear/src/main/java/com/vayunmathur/notes/wear/sync/WearLinkBridge.kt+++ b/notes-wear/src/main/java/com/vayunmathur/notes/wear/sync/WearLinkBridge.kt@@ -6,10 +6,10 @@ import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkNode import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.notes.wear.data.WearNotesStore-import com.vayunmathur.notes.wear.domain.WearNoteOp-import com.vayunmathur.notes.wear.domain.WearNotesProtocol-import com.vayunmathur.notes.wear.domain.WearNotesSnapshot-import com.vayunmathur.notes.wear.domain.WearWatchState+import com.vayunmathur.library.wearlink.notes.WearNoteOp+import com.vayunmathur.library.wearlink.notes.WearNotesProtocol+import com.vayunmathur.library.wearlink.notes.WearNotesSnapshot+import com.vayunmathur.library.wearlink.notes.WearWatchState import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob
notes-wear/src/screenshotTest/kotlin/com/vayunmathur/notes/wear/ui/MetadataPreviews.kt
diff --git a/notes-wear/src/screenshotTest/kotlin/com/vayunmathur/notes/wear/ui/MetadataPreviews.kt b/notes-wear/src/screenshotTest/kotlin/com/vayunmathur/notes/wear/ui/MetadataPreviews.ktindex f95374d40a..be67d652ef 100644--- a/notes-wear/src/screenshotTest/kotlin/com/vayunmathur/notes/wear/ui/MetadataPreviews.kt+++ b/notes-wear/src/screenshotTest/kotlin/com/vayunmathur/notes/wear/ui/MetadataPreviews.kt@@ -10,7 +10,7 @@ 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.notes.wear.domain.WearNote+import com.vayunmathur.library.wearlink.notes.WearNote /** Round watch, 454x454px class (227dp at 320dpi). */ private const val ROUND = "spec:width=227dp,height=227dp,dpi=320"
notes-wear/src/test/java/com/vayunmathur/notes/wear/domain/WearNotesProtocolTest.kt
diff --git a/notes-wear/src/test/java/com/vayunmathur/notes/wear/domain/WearNotesProtocolTest.kt b/notes-wear/src/test/java/com/vayunmathur/notes/wear/domain/WearNotesProtocolTest.ktindex 31d83cd81f..90d8448bcb 100644--- a/notes-wear/src/test/java/com/vayunmathur/notes/wear/domain/WearNotesProtocolTest.kt+++ b/notes-wear/src/test/java/com/vayunmathur/notes/wear/domain/WearNotesProtocolTest.kt@@ -1,4 +1,13 @@ package com.vayunmathur.notes.wear.domain+import com.vayunmathur.library.wearlink.notes.WearNote+import com.vayunmathur.library.wearlink.notes.WearNoteOp+import com.vayunmathur.library.wearlink.notes.WearNotesProtocol+import com.vayunmathur.library.wearlink.notes.WearNotesSnapshot+import com.vayunmathur.library.wearlink.notes.WearOpKind+import com.vayunmathur.library.wearlink.notes.buildWearSnapshot+import com.vayunmathur.library.wearlink.notes.mergeWearSnapshot+import com.vayunmathur.library.wearlink.notes.reflectedOps+import com.vayunmathur.library.wearlink.notes.wearNoteWins import kotlin.test.Test import kotlin.test.assertEquals
notes/src/test/java/com/vayunmathur/notes/sync/WearNotesApplyTest.kt
diff --git a/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesApplyTest.kt b/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesApplyTest.ktindex 73611d435d..098c639fb6 100644--- a/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesApplyTest.kt+++ b/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesApplyTest.kt@@ -7,10 +7,10 @@ import com.vayunmathur.notes.data.NoteBlock import com.vayunmathur.notes.data.NoteBody import com.vayunmathur.notes.data.NotesRepository import com.vayunmathur.notes.data.withBody-import com.vayunmathur.notes.domain.WearNote-import com.vayunmathur.notes.domain.WearNoteOp-import com.vayunmathur.notes.domain.WearNotesProtocol-import com.vayunmathur.notes.domain.WearOpKind+import com.vayunmathur.library.wearlink.notes.WearNote+import com.vayunmathur.library.wearlink.notes.WearNoteOp+import com.vayunmathur.library.wearlink.notes.WearNotesProtocol+import com.vayunmathur.library.wearlink.notes.WearOpKind import com.vayunmathur.notes.seedNotesDb import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith
notes/src/test/java/com/vayunmathur/notes/sync/WearNotesProtocolTest.kt
diff --git a/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesProtocolTest.kt b/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesProtocolTest.ktindex 9078917c9e..18f4bd7608 100644--- a/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesProtocolTest.kt+++ b/notes/src/test/java/com/vayunmathur/notes/sync/WearNotesProtocolTest.kt@@ -1,4 +1,13 @@ package com.vayunmathur.notes.domain+import com.vayunmathur.library.wearlink.notes.WearNote+import com.vayunmathur.library.wearlink.notes.WearNoteOp+import com.vayunmathur.library.wearlink.notes.WearNotesProtocol+import com.vayunmathur.library.wearlink.notes.WearNotesSnapshot+import com.vayunmathur.library.wearlink.notes.WearOpKind+import com.vayunmathur.library.wearlink.notes.buildWearSnapshot+import com.vayunmathur.library.wearlink.notes.mergeWearSnapshot+import com.vayunmathur.library.wearlink.notes.reflectedOps+import com.vayunmathur.library.wearlink.notes.wearNoteWins import kotlin.test.Test import kotlin.test.assertEquals