launcher: merge launcher-wear into the single launcher APK
- Commit
5e09a70b008296c8473452fdc28f25410441ddc5- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-04 18:07 UTC (1 day ago)
- Parents
41ab07c
Owner directive: singular apps that detect when they are on a watch and adapt, instead of a separate *-wear APK per companion. This follows the merged clock pilot (adec0c398 + 31a81d3c5) for the launcher pair. The merged :launcher APK keeps applicationId com.vayunmathur.launcher and the convention signing on phone, TV and watch, as the WearLink handshake requires; neither side's identity changed. Runtime detection is PackageManager.FEATURE_WATCH (platform/FormFactor): MainActivity, the sole launcher entry, forwards watches to ui/WearMainActivity and finishes before any phone/TV state (Room, phone conduit sync, widget host) is touched, and phones/TVs keep the existing UiMode-routed UI. There are no broadcast receivers in this module, so no wrong-form-factor receiver gating is needed: the phone sync (sync/WearLauncherSync) starts only from the phone path and the watch bridge (sync/WearLinkBridge) only from WearMainActivity. The favorites sync is unchanged: WearLauncherSync publishes /launcher/favorites from the phone hotseat, WearLinkBridge receives it in the watch experience, appId launcher. Manifest shape, verified against AGP lint: no android.hardware.type.watch uses-feature is declared. required=true would block phone/TV installs and required=false is disallowed for this feature (InvalidWearFeatureAttribute; Google's packaging model does not support a single Wear/non-Wear APK through Play). Distribution here is sideload/F-Droid, not Play's watch channel, so installation on a watch needs no feature declaration; the standalone=false meta-data, WAKE_LOCK, and the watch activity are carried into the phone application element. The wear launcher activity is exported=false with no launcher/HOME filter of its own (stock Wear OS keeps HOME for the system launcher, so the watch experience never claims HOME; phone/TV HOME is unchanged). All launcher-wear sources move into launcher's closed package roots (wear/data -> data, wear/domain -> domain, wear/platform -> platform, wear/sync -> sync, wear/ui -> ui), R references retarget to com.vayunmathur.launcher.R, and wear strings merge as res/values/wear_strings.xml (duplicate app_name dropped). The watch unit tests move with them; the wear WearLauncherProtocolTest copy is dropped because :launcher already pins the same golden JSON. Watch screenshot previews become ui/WearMetadataPreviews with group=wear, so :launcher:metadata keeps rendering them into metadata_data/photos/launcher/wear/ (the old launcher-wear bucket moves there unchanged). The launcher-wear module, its settings include/projectDir, and its AGENTS.md are deleted; root and launcher AGENTS.md describe the merged state. Verified fresh in this worktree on devvm21958: ./gradlew :launcher:lint :launcher:lintVitalRelease :launcher:testDevUnitTest green (419 tests, 0 failures, including the moved WearLauncherModelTest and new FormFactorTest), with lintVitalRelease re-run standalone (executed, not skipped) and :launcher:compileDevScreenshotTestKotlin green. No failures on this branch needed a pre-existing-on-base comparison. Only a real watch can confirm install, FEATURE_WATCH routing, and the Wear OS surface.
Diff
AGENTS.md
diff --git a/AGENTS.md b/AGENTS.mdindex 52076c32e1..3571af4898 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` and `calendar` are single merged APKs for phone and watch (watch experience inside `clock/` / `calendar/`; the remaining `*-wear` modules are separate companion APKs with the phone app's applicationId/signing).+`clock`, `notes`, `calendar` and `launcher` 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`).
launcher-wear/AGENTS.md
diff --git a/launcher-wear/AGENTS.md b/launcher-wear/AGENTS.mddeleted file mode 100644index b76f2141a1..0000000000--- a/launcher-wear/AGENTS.md+++ /dev/null@@ -1,61 +0,0 @@-# AGENTS.md — launcher-wear/ (':launcher:wear')--> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside-> `launcher-wear/` + `launcher/` (the phone side of the same feature).--- Gradle: :launcher:wear (dir launcher-wear/) / convention: `common-conventions-wear`-- Package roots present: ui, data, domain, platform, sync-- Entry file: ui/WearMainActivity.kt--## Why this module exists (read before changing identity)-Wear OS launcher-style companion of the phone Launcher (`:launcher`): a-full-screen app drawer / home-replacement *experience* on the watch. This-module deliberately uses `applicationId = "com.vayunmathur.launcher"` (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.--## What a watch launcher can and cannot be (platform reality)-- **Stock Wear OS: NOT the system HOME.** The watch home (watch face +- system app launcher) is a privileged system component. There is no- public `CATEGORY_HOME` election or `ROLE_HOME` grant for third-party- apps on stock Wear OS builds (unlike phone/TV, where `:launcher`- legitimately declares HOME). This module therefore declares only- MAIN+LAUNCHER and must never claim HOME: users open/pin this app in the- system launcher and get the launcher experience inside it.-- **What this provides:** app drawer for installed watch apps- (icon+label, platform launch intents), favorites/pinned row synced- from the phone hotseat, watch-local recents, quick access to our wear- companions when installed, local search/filter, and settings rows that- open only system intents that resolve on the watch (no fake toggles -- brightness has no public direct intent, so Display opens system- display settings).-- **Tiles/complications: not provided.** No wear module in this repo uses- Tiles and `androidx.wear.tiles` is not in the version catalog; adding- it is a supply-chain/build decision, not a cheap add-on here.-- **MAOS follow-up (OS-side only, not implemented here):** a privileged- MAOS build could grant this package a real HOME/watch-launcher role- (privileged permission / default-home configuration). That belongs in- the OS build, never in this app module.--## Protocol-The wire protocol lives in `:library:wearlink` at-`com.vayunmathur.library.wearlink.launcher.WearLauncherProtocol` (shared by-`:launcher` and `:launcher:wear`; neither app module depends on the other).-Each side's `WearLauncherProtocolTest` pins the same golden JSON against-that shared code.--- Favorites + watch-state sync: WearLink data items- (`/launcher/favorites`, `/launcher/watch-state`)-- Sync request: WearLink message (`/launcher/request-sync`), watch -> phone only-- Only the phone hotseat (pinned row) syncs - not the workspace grid,- folders or widgets. Recents are watch-local and never sync.-- Transport: :library:wearlink (RFCOMM, no Play services); app-lifecycle-bound--## Verify (this module only)-```-./gradlew :launcher:wear:assembleDev-./gradlew :launcher:wear:testDebugUnitTest-./gradlew :launcher:wear:lint-```
launcher-wear/build.gradle.kts
diff --git a/launcher-wear/build.gradle.kts b/launcher-wear/build.gradle.ktsdeleted file mode 100644index a9c0aba011..0000000000--- a/launcher-wear/build.gradle.kts+++ /dev/null@@ -1,35 +0,0 @@-plugins {- id("common-conventions-wear")- id("common-conventions-preview-metadata")-}--launcherIcon {- symbol = "apps"-}--// Version shared with the phone app (root version.txt), as in notes-wear:-// common-conventions-wear inlines 1/"1.0" until a consumer wires the reader.-val wearVersionLines = file("../version.txt").readLines()-val wearVersionCode = wearVersionLines[0].trim().toInt()-val wearVersionName = wearVersionLines[1].trim()--android {- // Same applicationId + signing as :launcher is load-bearing: WearLink's- // handshake token requires the same signing certificate on both sides,- // and the watch app must be installable alongside (not instead of) the- // phone launcher package identity. The namespace only names resources.- namespace = "com.vayunmathur.launcher.wear"- defaultConfig {- applicationId = "com.vayunmathur.launcher"- 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)-}
launcher-wear/src/main/AndroidManifest.xml
diff --git a/launcher-wear/src/main/AndroidManifest.xml b/launcher-wear/src/main/AndroidManifest.xmldeleted file mode 100644index f44707a4d5..0000000000--- a/launcher-wear/src/main/AndroidManifest.xml+++ /dev/null@@ -1,55 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<manifest xmlns:android="http://schemas.android.com/apk/res/android">-- <!-- Watch hardware: this build only installs on Wear OS. -->- <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" />-- <!-- Package visibility for the app drawer (Android 11+). -->- <queries>- <intent>- <action android:name="android.intent.action.MAIN" />- <category android:name="android.intent.category.LAUNCHER" />- </intent>- </queries>-- <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">-- <!-- Paired with the phone launcher, not a standalone watch app. -->- <meta-data- android:name="com.google.android.wearable.standalone"- android:value="false" />-- <!--- Deliberately MAIN + LAUNCHER only, with NO CATEGORY_HOME:- on stock Wear OS the home/watch-face + system-launcher role is- held by the privileged system launcher and there is no public- HOME-intent election or ROLE_HOME grant for third-party apps- (unlike phone/TV). Claiming HOME here would be a false promise.- This activity is the launcher-style app users open (and can pin- in the system launcher); on MAOS a privileged build could grant- a real HOME role as an OS-side follow-up. See AGENTS.md.- -->- <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>
launcher-wear/src/main/res/values/colors.xml
diff --git a/launcher-wear/src/main/res/values/colors.xml b/launcher-wear/src/main/res/values/colors.xmldeleted file mode 100644index f42ada656e..0000000000--- a/launcher-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>
launcher-wear/src/test/java/com/vayunmathur/launcher/wear/domain/WearLauncherProtocolTest.kt
diff --git a/launcher-wear/src/test/java/com/vayunmathur/launcher/wear/domain/WearLauncherProtocolTest.kt b/launcher-wear/src/test/java/com/vayunmathur/launcher/wear/domain/WearLauncherProtocolTest.ktdeleted file mode 100644index 557f205cd5..0000000000--- a/launcher-wear/src/test/java/com/vayunmathur/launcher/wear/domain/WearLauncherProtocolTest.kt+++ /dev/null@@ -1,78 +0,0 @@-package com.vayunmathur.launcher.wear.domain-import com.vayunmathur.library.wearlink.launcher.WearFavorite-import com.vayunmathur.library.wearlink.launcher.WearFavoritesSnapshot-import com.vayunmathur.library.wearlink.launcher.WearLauncherProtocol-import com.vayunmathur.library.wearlink.launcher.buildWearFavorites-import com.vayunmathur.library.wearlink.launcher.wearLauncherCompanionPresent--import kotlin.test.Test-import kotlin.test.assertEquals-import kotlin.test.assertFalse-import kotlin.test.assertTrue-import kotlinx.serialization.encodeToString--class WearLauncherProtocolTest {-- @Test- fun goldenSnapshotJson() {- val snapshot = WearFavoritesSnapshot(- generatedAtMillis = 1_000L,- favorites = listOf(- WearFavorite("com.example.calendar", "com.example.calendar.Main", "Calendar", 0),- ),- truncated = false,- )- assertEquals(- """{"generatedAtMillis":1000,"favorites":[{"packageName":"com.example.calendar",""" +- """"className":"com.example.calendar.Main","label":"Calendar"}]}""",- WearLauncherProtocol.json.encodeToString(snapshot),- )- }-- @Test- fun snapshotRoundTrips() {- val snapshot = WearFavoritesSnapshot(- generatedAtMillis = 9L,- favorites = listOf(WearFavorite("com.example.notes", "", "Notes", 1)),- truncated = true,- )- val decoded = WearLauncherProtocol.json.decodeFromString<WearFavoritesSnapshot>(- WearLauncherProtocol.json.encodeToString(snapshot),- )- assertEquals(snapshot, decoded)- }-- @Test- fun buildSortsByRankDedupesAndReRanks() {- val snapshot = buildWearFavorites(- candidates = listOf(- WearFavorite("com.example.b", "", "B", 2),- WearFavorite("com.example.a", "", "A", 1),- WearFavorite("com.example.a", "", "A duplicate", 0),- WearFavorite("", "", "blank", 0),- ),- generatedAtMillis = 5L,- )- // Duplicate keeps lowest rank (0), then re-ranked in rank order.- assertEquals(listOf("com.example.a", "com.example.b"), snapshot.favorites.map { it.packageName })- assertEquals(listOf(0, 1), snapshot.favorites.map { it.rank })- assertEquals("A duplicate", snapshot.favorites[0].label)- assertFalse(snapshot.truncated)- }-- @Test- fun buildCapsCountAndMarksTruncated() {- val candidates = (0 until WearLauncherProtocol.MAX_FAVORITES + 3).map {- WearFavorite("com.example.$it", "", "App $it", it)- }- val snapshot = buildWearFavorites(candidates, generatedAtMillis = 1L)- assertEquals(WearLauncherProtocol.MAX_FAVORITES, snapshot.favorites.size)- assertTrue(snapshot.truncated)- }-- @Test- fun companionPresenceIsCountBased() {- assertFalse(wearLauncherCompanionPresent(0))- assertTrue(wearLauncherCompanionPresent(1))- }-}
launcher/AGENTS.md
diff --git a/launcher/AGENTS.md b/launcher/AGENTS.mdindex c786f29b73..d9c8b6c892 100644--- a/launcher/AGENTS.md+++ b/launcher/AGENTS.md@@ -4,14 +4,14 @@ _Install: ./install launcher (dev by default). For a TV over Wi-Fi: `sh launcher/install-tv.sh <TV_IP>` builds, installs and offers to set it as the default home; `sh launcher/undo-tv.sh <TV_IP>` restores the stock home._ - Gradle: :launcher / dir: launcher/-- Package roots present: ui, data, domain, platform + tv/{ui,data,domain,platform}-- Entry files: MainActivity.kt (UiMode-routed), Route.kt + Navigation.kt (phone), tv/TvRoute.kt + tv/TvNavigation.kt (TV)-- Deps: :library:room + androidx.tv.material (via common-conventions-tv)+- Package roots present: ui, data, domain, platform, sync + tv/{ui,data,domain,platform}+- Entry files: MainActivity.kt (sole launcher entry; routes watches to WearMainActivity, then UiMode-routed), Route.kt + Navigation.kt (phone), tv/TvRoute.kt + tv/TvNavigation.kt (TV), ui/WearMainActivity.kt (watch)+- Deps: :library:room + :library:wearlink + :library:log + Wear Compose (material + foundation) + androidx.tv.material (via common-conventions-tv) - Metadata: metadata_data/launcher.md (present, mentions TV mode) - Rust: no / screenshotTest: yes ## Overview-**Purpose:** Offline home-screen replacement — paged grid, hotseat, folders, searchable drawer, real widget hosting on phones; calm banner home with HDMI inputs and D-pad reorder on TVs. One APK routes by UI mode. Layout in encrypted Room (phone) / DataStore order (TV); no account, nothing uploaded.+**Purpose:** Offline home-screen replacement — paged grid, hotseat, folders, searchable drawer, real widget hosting on phones; calm banner home with HDMI inputs and D-pad reorder on TVs; launcher-style app drawer on watches. One APK routes by form factor and UI mode. Layout in encrypted Room (phone) / DataStore order (TV) / JSON store (watch); no account, nothing uploaded. **Key features:** - Workspace grid with drag/drop/reorder/folder-merge, drop-bar targets, page-edge dwell, widget resize frames (`ui/components/` drag system + `domain/` placement math) - App drawer with fast scroll + predictions; widget host incl. configurable providers (`platform/LauncherWidgetHost`)@@ -19,6 +19,50 @@ _Install: ./install launcher (dev by default). For a TV over Wi-Fi: `sh launcher - TV mode (`tv/`): 6-per-row 16:9 banner grid, bottom glass row (App Store/HDMI/Settings/Reorder), clock + network header, single-OK pick-up/drop reorder with focus-chase and slot glide, edit/add menus, HOME role — DataStore order, no Room/widget init **Architecture / data-flow:** `ui/` home/drawer/folder/settings → `platform/LauncherViewModel` (+ `LauncherUiContract`) → `data/LauncherRepository` over Room; `domain/` is pure grid math (occupancy, placement, reorder, folders, hotseat, pagination) — the single biggest pure-logic area in any app, testable without Compose. `tv/ui/` → `tv/platform/TvHomeViewModel` (+ `TvUiContract`) → `tv/data/TvPrefs` (DataStore); `tv/domain/TvRowOrder` is pure row math. `MainActivity` routes by `UiModeManager`; neither mode initializes the other's stack. **Entry points + reading order:** `Route` → `MainActivity.kt` (UiMode branch) → phone `Navigation.kt` → `ui/HomeWorkspace.kt` → `platform/LauncherViewModel.kt` → `domain/GridPlacer.kt` + `domain/ReconcileUseCase.kt`; TV `TvRoute` → `tv/TvNavigation.kt` → `tv/ui/TvHomeScreen.kt` → `tv/platform/TvHomeViewModel.kt` → `tv/domain/TvRowOrder.kt`.+## One APK, three form factors (phone + TV + watch)+This module is the single Launcher APK for phones, TVs and watches: same+`applicationId = "com.vayunmathur.launcher"` and signing on all, as the+WearLink handshake requires. The manifest deliberately declares no+`android.hardware.type.watch` feature (required=true would block+phones/TVs; 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, TVs 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/TV state loads; phones/TVs get the UiMode-routed UI. There+are no broadcast receivers in this module; the phone sync+(`sync/WearLauncherSync`) starts only from the phone path and the watch+bridge (`sync/WearLinkBridge`) only from `ui/WearMainActivity`, so+neither runs on the wrong form factor.++## Watch experience (in this module)+- `ui/WearMainActivity` (a `WearShellActivity`, `exported=false`, no+ launcher/HOME filter of its own) routes `ui/WearRoute` over home+ (synced favorites, watch-local recents, companion shortcuts) /+ all-apps drawer with local filter / settings rows that open only+ system intents resolving on the watch.+- On stock Wear OS this is not the system HOME: the watch home is a+ privileged system component with no public `CATEGORY_HOME` election+ or `ROLE_HOME` grant for third-party apps, so the watch experience+ never claims HOME (phone/TV HOME in `MainActivity` is unchanged).+- Watch state persists in `data/WearLauncherStore`+ (`wear-launcher-favorites.json` / `wear-launcher-recents.json`);+ installed apps are enumerated by `platform/InstalledApps`, sections+ are pure in `domain/WearLauncherModel`.+- Watch listing screenshots are the `group = "wear"` previews in+ `src/screenshotTest/.../ui/WearMetadataPreviews.kt`, collected by+ `:launcher:metadata` into `metadata_data/photos/launcher/wear/`;+ phone shots use the `phone` bucket.++## Wear sync (phone <-> watch, one APK)+**Protocol:** shared wire types live in `:library:wearlink` at `com.vayunmathur.library.wearlink.launcher.WearLauncherProtocol`; the golden-JSON tests in this module pin the shared code's wire format.+- Favorites + watch-state sync: WearLink data items (`/launcher/favorites`, `/launcher/watch-state`)+- Sync request: WearLink message (`/launcher/request-sync`), watch -> phone only+- Only the phone hotseat (pinned row) syncs — not the workspace grid, folders or widgets. Recents are watch-local and never sync.+- Transport: :library:wearlink (RFCOMM, no Play services); phone side `sync/WearLauncherSync`, watch side `sync/WearLinkBridge`+ **Gotchas:** - Exempt from the raw-animation rule: built on `animateBounds`/`Animatable` — do NOT "migrate" its motion to library helpers. TV code under `tv/` keeps using `library.ui` helpers anyway — no regression just because the package is exempt. - Reconcile (installed-apps vs stored layout) runs on package changes — launcher bugs after installs live in `ReconcileUseCase` + `LauncherAppsMonitor`@@ -64,6 +108,15 @@ _Install: ./install launcher (dev by default). For a TV over Wi-Fi: `sh launcher - com/vayunmathur/launcher/platform/IconCache.kt - com/vayunmathur/launcher/platform/ActivityBridge.kt - com/vayunmathur/launcher/platform/LauncherPrivilege.kt+- com/vayunmathur/launcher/platform/FormFactor.kt — watch detection (`FEATURE_WATCH`)+- com/vayunmathur/launcher/platform/InstalledApps.kt — watch installed-app enumeration + settings targets+### Watch experience (ui/ + data/ + domain/ + platform/ + sync/)+- com/vayunmathur/launcher/ui/WearMainActivity.kt — watch entry (WearShellActivity, exported=false)+- com/vayunmathur/launcher/ui/WearRoute.kt, WearLauncherScreen.kt, WearAllAppsScreen.kt, WearSettingsScreen.kt+- com/vayunmathur/launcher/data/WearLauncherStore.kt+- com/vayunmathur/launcher/domain/WearLauncherModel.kt+- com/vayunmathur/launcher/sync/WearLinkBridge.kt, WearSyncRequest.kt — watch side; sync/WearLauncherSync.kt is the phone side+ ### tv/ — TV mode (UiMode-routed, DataStore order, no Room/widgets) - com/vayunmathur/launcher/tv/TvRoute.kt - com/vayunmathur/launcher/tv/TvNavigation.kt
launcher/build.gradle.kts
diff --git a/launcher/build.gradle.kts b/launcher/build.gradle.ktsindex 4c137cb75c..a35dc1159e 100644--- a/launcher/build.gradle.kts+++ b/launcher/build.gradle.kts@@ -28,8 +28,16 @@ android { dependencies { implementRoom(libs) implementation(project(":library:room"))- // Phone side of the watch-launcher favorites sync (protocol in :library:wearlink).+ // Both sides of the watch-launcher favorites sync live in this one APK+ // (same applicationId and signing, as the WearLink handshake requires):+ // sync/WearLauncherSync publishes the phone hotseat snapshot,+ // sync/WearLinkBridge receives it on a watch. FormFactor picks the side. implementation(project(":library:wearlink"))+ // Watch experience (ui/Wear*): Wear Compose + the repo log facade the+ // watch platform/sync code writes through.+ implementation(libs.androidx.wear.compose.material)+ implementation(libs.androidx.wear.compose.foundation)+ implementation(project(":library:log")) implementation(libs.androidx.datastore.preferences) // Declared rather than relied on transitively: a launcher is mostly motion, so `Animatable`, // `animateBounds` and the animation specs are load-bearing here rather than incidental.
launcher/src/main/AndroidManifest.xml
diff --git a/launcher/src/main/AndroidManifest.xml b/launcher/src/main/AndroidManifest.xmlindex 94c57fea3f..bf0e5ef8db 100644--- a/launcher/src/main/AndroidManifest.xml+++ b/launcher/src/main/AndroidManifest.xml@@ -58,6 +58,19 @@ <uses-feature android:name="android.hardware.touchscreen" android:required="false" />+ <!-- Single APK for phone, TV and watch. Deliberately NO+ android.hardware.type.watch uses-feature here: required="true"+ would block every phone/TV 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. -->+ <!-- Watch sync / ringing paths wake the watch CPU when they fire. -->+ <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Wi-Fi is only read for the TV network tile; Ethernet-only TVs must still install. --> <uses-feature android:name="android.hardware.wifi"@@ -98,5 +111,21 @@ <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>++ <!-- Watch experience is paired with the phone app, not standalone. -->+ <meta-data+ android:name="com.google.android.wearable.standalone"+ android:value="false" />++ <!-- Watch experience: entered only via MainActivity's watch routing+ (no launcher filter of its own; exported=false). It is inert on+ a phone/TV: MainActivity forwards only on FEATURE_WATCH, and+ the watch sync bridge is started only from this activity. See+ AGENTS.md for why it must never claim CATEGORY_HOME. -->+ <activity+ android:name=".ui.WearMainActivity"+ android:exported="false"+ android:taskAffinity=""+ android:theme="@android:style/Theme.Material.NoActionBar" /> </application> </manifest>
launcher/src/main/java/com/vayunmathur/launcher/MainActivity.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/MainActivity.kt b/launcher/src/main/java/com/vayunmathur/launcher/MainActivity.ktindex dbffa8cfad..df7befa310 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/MainActivity.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/MainActivity.kt@@ -23,6 +23,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import com.vayunmathur.launcher.platform.ActivityBridge+import com.vayunmathur.launcher.platform.FormFactor+import com.vayunmathur.launcher.ui.WearMainActivity import com.vayunmathur.launcher.platform.LauncherPrivilege import com.vayunmathur.launcher.platform.LauncherViewModel import com.vayunmathur.launcher.platform.onStartImpl@@ -38,7 +40,12 @@ import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.library.util.rememberNavBackStack /**- * The home screen activity, and the [ActivityBridge] the Compose tree talks to.+ * Sole launcher entry of the single merged Launcher APK, and the+ * [ActivityBridge] the Compose tree talks to. On a watch (the+ * `android.hardware.type.watch` system feature, see [FormFactor]) it hands+ * off to [WearMainActivity] and finishes before any phone/TV state (Room,+ * phone sync, widget host) is touched; on a phone or TV it routes by UI+ * mode as below. * * `singleTask` plus `stateNotNeeded` in the manifest are what make it behave like a home * app: HOME delivers a new intent to the existing instance rather than stacking another@@ -47,6 +54,18 @@ import com.vayunmathur.library.util.rememberNavBackStack */ class MainActivity : MaActivity(), ActivityBridge { + /** 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 viewModel: LauncherViewModel by viewModels() private val tvViewModel: TvHomeViewModel by viewModels() private var backStack: NavBackStack<Route>? = null@@ -83,6 +102,7 @@ class MainActivity : MaActivity(), ActivityBridge { get() = !tvMode override fun onCreateBeforeContent() {+ if (routedToWear) return tvMode = isTvMode() viewModel.bridge = this // Wear favorites sync (phone hotseat -> watch launcher). No-op state@@ -92,6 +112,9 @@ class MainActivity : MaActivity(), ActivityBridge { @Composable override fun Content() {+ // On a watch this activity is finishing towards WearMainActivity;+ // compose nothing (and touch no phone/TV state) in the meantime.+ if (routedToWear) return if (tvMode) { val stack = rememberNavBackStack<TvRoute>(TvRoute.Home) SideEffect { tvBackStack = stack }@@ -105,6 +128,7 @@ class MainActivity : MaActivity(), ActivityBridge { override fun onStart() { super.onStart()+ if (routedToWear) return if (tvMode) return viewModel.onStartImpl() viewModel.refreshDefaultHomeImpl()@@ -112,6 +136,7 @@ class MainActivity : MaActivity(), ActivityBridge { override fun onResume() { super.onResume()+ if (routedToWear) return val nowTv = isTvMode() if (nowTv != tvMode) { // UI mode flipped underneath us (dock/HDMI-CEC): re-route on next composition.@@ -131,7 +156,7 @@ class MainActivity : MaActivity(), ActivityBridge { } override fun onStop() {- if (!tvMode) viewModel.onStopImpl()+ if (!routedToWear && !tvMode) viewModel.onStopImpl() super.onStop() } @@ -157,7 +182,7 @@ class MainActivity : MaActivity(), ActivityBridge { } override fun onDestroy() {- viewModel.bridge = null+ if (!routedToWear) viewModel.bridge = null super.onDestroy() } @@ -167,6 +192,7 @@ class MainActivity : MaActivity(), ActivityBridge { */ override fun onNewIntent(intent: Intent) { super.onNewIntent(intent)+ if (routedToWear) return setIntent(intent) if (tvMode) tvBackStack?.reset(TvRoute.Home) else backStack?.reset(Route.Home) }
launcher/src/main/java/com/vayunmathur/launcher/data/WearLauncherStore.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/data/WearLauncherStore.kt b/launcher/src/main/java/com/vayunmathur/launcher/data/WearLauncherStore.ktsimilarity index 92%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/data/WearLauncherStore.ktrename to launcher/src/main/java/com/vayunmathur/launcher/data/WearLauncherStore.ktindex a8d96adf76..1acb486189 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/data/WearLauncherStore.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/data/WearLauncherStore.kt@@ -1,12 +1,12 @@-package com.vayunmathur.launcher.wear.data+package com.vayunmathur.launcher.data import android.content.Context-import com.vayunmathur.launcher.wear.domain.RecentLaunch+import com.vayunmathur.launcher.domain.RecentLaunch import com.vayunmathur.library.wearlink.launcher.WearFavoritesSnapshot import com.vayunmathur.library.wearlink.launcher.WearLauncherWatchState import com.vayunmathur.library.wearlink.launcher.WearLauncherProtocol-import com.vayunmathur.launcher.wear.domain.recordRecentLaunch-import com.vayunmathur.launcher.wear.sync.WearLinkBridge+import com.vayunmathur.launcher.domain.recordRecentLaunch+import com.vayunmathur.launcher.sync.WearLinkBridge import com.vayunmathur.library.log.Log import java.io.File import kotlinx.coroutines.flow.MutableStateFlow
launcher/src/main/java/com/vayunmathur/launcher/domain/WearLauncherModel.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/domain/WearLauncherModel.kt b/launcher/src/main/java/com/vayunmathur/launcher/domain/WearLauncherModel.ktsimilarity index 99%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/domain/WearLauncherModel.ktrename to launcher/src/main/java/com/vayunmathur/launcher/domain/WearLauncherModel.ktindex 4ae8c7e045..3474288b34 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/domain/WearLauncherModel.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/domain/WearLauncherModel.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.domain+package com.vayunmathur.launcher.domain import com.vayunmathur.library.wearlink.launcher.WearFavorite import com.vayunmathur.library.wearlink.launcher.WearFavoritesSnapshot
launcher/src/main/java/com/vayunmathur/launcher/platform/FormFactor.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/platform/FormFactor.kt b/launcher/src/main/java/com/vayunmathur/launcher/platform/FormFactor.ktnew file mode 100644index 0000000000..4831ec6ac6--- /dev/null+++ b/launcher/src/main/java/com/vayunmathur/launcher/platform/FormFactor.kt@@ -0,0 +1,25 @@+package com.vayunmathur.launcher.platform++import android.content.Context+import android.content.pm.PackageManager++/**+ * Runtime form-factor detection for the single merged Launcher APK.+ *+ * One APK ships to phones, TVs and watches (same applicationId and signing, as+ * the WearLink handshake requires). [PackageManager.FEATURE_WATCH] is the+ * canonical watch signal: Wear OS devices report the+ * `android.hardware.type.watch` system feature, phones and TVs 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 all; 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+}
launcher/src/main/java/com/vayunmathur/launcher/platform/InstalledApps.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/platform/InstalledApps.kt b/launcher/src/main/java/com/vayunmathur/launcher/platform/InstalledApps.ktsimilarity index 91%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/platform/InstalledApps.ktrename to launcher/src/main/java/com/vayunmathur/launcher/platform/InstalledApps.ktindex 3d93156c56..c9666464ac 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/platform/InstalledApps.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/platform/InstalledApps.kt@@ -1,13 +1,13 @@-package com.vayunmathur.launcher.wear.platform+package com.vayunmathur.launcher.platform import android.content.ComponentName import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.provider.Settings-import com.vayunmathur.launcher.wear.domain.WatchApp-import com.vayunmathur.launcher.wear.domain.WearSettingsTarget-import com.vayunmathur.launcher.wear.domain.availableWearSettingsTargets+import com.vayunmathur.launcher.domain.WatchApp+import com.vayunmathur.launcher.domain.WearSettingsTarget+import com.vayunmathur.launcher.domain.availableWearSettingsTargets /** * Device enumeration for the watch drawer: MAIN+LAUNCHER activities via
launcher/src/main/java/com/vayunmathur/launcher/sync/WearLinkBridge.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/sync/WearLinkBridge.kt b/launcher/src/main/java/com/vayunmathur/launcher/sync/WearLinkBridge.ktsimilarity index 94%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/sync/WearLinkBridge.ktrename to launcher/src/main/java/com/vayunmathur/launcher/sync/WearLinkBridge.ktindex 911b1ae72a..1dd253515f 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/sync/WearLinkBridge.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/sync/WearLinkBridge.kt@@ -1,11 +1,11 @@-package com.vayunmathur.launcher.wear.sync+package com.vayunmathur.launcher.sync import android.content.Context-import com.vayunmathur.launcher.wear.data.WearLauncherStore+import com.vayunmathur.launcher.data.WearLauncherStore import com.vayunmathur.library.wearlink.launcher.WearFavoritesSnapshot import com.vayunmathur.library.wearlink.launcher.WearLauncherProtocol import com.vayunmathur.library.wearlink.launcher.WearLauncherWatchState-import com.vayunmathur.launcher.wear.platform.InstalledApps+import com.vayunmathur.launcher.platform.InstalledApps import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkNode
launcher/src/main/java/com/vayunmathur/launcher/sync/WearSyncRequest.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/sync/WearSyncRequest.kt b/launcher/src/main/java/com/vayunmathur/launcher/sync/WearSyncRequest.ktsimilarity index 82%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/sync/WearSyncRequest.ktrename to launcher/src/main/java/com/vayunmathur/launcher/sync/WearSyncRequest.ktindex a46517e13a..94dec15e05 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/sync/WearSyncRequest.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/sync/WearSyncRequest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.sync+package com.vayunmathur.launcher.sync import android.content.Context
launcher/src/main/java/com/vayunmathur/launcher/ui/WearAllAppsScreen.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearAllAppsScreen.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearAllAppsScreen.ktsimilarity index 92%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearAllAppsScreen.ktrename to launcher/src/main/java/com/vayunmathur/launcher/ui/WearAllAppsScreen.ktindex c91425f0bd..bae7cc0208 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearAllAppsScreen.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearAllAppsScreen.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.ui+package com.vayunmathur.launcher.ui import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding@@ -25,12 +25,12 @@ 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.launcher.wear.R-import com.vayunmathur.launcher.wear.data.WearLauncherStore-import com.vayunmathur.launcher.wear.domain.WatchApp-import com.vayunmathur.launcher.wear.domain.buildWearLauncherSections-import com.vayunmathur.launcher.wear.domain.filterWatchApps-import com.vayunmathur.launcher.wear.platform.InstalledApps+import com.vayunmathur.launcher.R+import com.vayunmathur.launcher.data.WearLauncherStore+import com.vayunmathur.launcher.domain.WatchApp+import com.vayunmathur.launcher.domain.buildWearLauncherSections+import com.vayunmathur.launcher.domain.filterWatchApps+import com.vayunmathur.launcher.platform.InstalledApps import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext
launcher/src/main/java/com/vayunmathur/launcher/ui/WearLauncherScreen.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearLauncherScreen.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearLauncherScreen.ktsimilarity index 95%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearLauncherScreen.ktrename to launcher/src/main/java/com/vayunmathur/launcher/ui/WearLauncherScreen.ktindex 125d66acce..66e739fdfe 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearLauncherScreen.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearLauncherScreen.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.ui+package com.vayunmathur.launcher.ui import android.graphics.drawable.Drawable import androidx.compose.foundation.Image@@ -27,12 +27,12 @@ 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.launcher.wear.R-import com.vayunmathur.launcher.wear.data.WearLauncherStore-import com.vayunmathur.launcher.wear.domain.WatchApp-import com.vayunmathur.launcher.wear.domain.buildWearLauncherSections-import com.vayunmathur.launcher.wear.platform.InstalledApps-import com.vayunmathur.launcher.wear.sync.requestWearSync+import com.vayunmathur.launcher.R+import com.vayunmathur.launcher.data.WearLauncherStore+import com.vayunmathur.launcher.domain.WatchApp+import com.vayunmathur.launcher.domain.buildWearLauncherSections+import com.vayunmathur.launcher.platform.InstalledApps+import com.vayunmathur.launcher.sync.requestWearSync import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext@@ -77,7 +77,7 @@ fun WearLauncherScreen( */ @Composable internal fun WearLauncherContent(- sections: com.vayunmathur.launcher.wear.domain.WearLauncherSections,+ sections: com.vayunmathur.launcher.domain.WearLauncherSections, installedEmpty: Boolean, onLaunch: (WatchApp) -> Unit, onOpenAllApps: () -> Unit,
launcher/src/main/java/com/vayunmathur/launcher/ui/WearMainActivity.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearMainActivity.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearMainActivity.ktsimilarity index 87%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearMainActivity.ktrename to launcher/src/main/java/com/vayunmathur/launcher/ui/WearMainActivity.ktindex 5ace26a862..bda63eb901 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearMainActivity.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearMainActivity.kt@@ -1,7 +1,7 @@-package com.vayunmathur.launcher.wear.ui+package com.vayunmathur.launcher.ui import androidx.compose.runtime.Composable-import com.vayunmathur.launcher.wear.data.WearLauncherStore+import com.vayunmathur.launcher.data.WearLauncherStore import com.vayunmathur.library.wearlink.WearShellActivity /**@@ -12,7 +12,7 @@ import com.vayunmathur.library.wearlink.WearShellActivity class WearMainActivity : WearShellActivity<WearRoute, WearLauncherStore>(WearRoute.Home) { override fun createStore() = WearLauncherStore.get(this).also {- com.vayunmathur.launcher.wear.sync.WearLinkBridge.get(this)+ com.vayunmathur.launcher.sync.WearLinkBridge.get(this) it.publishWatchState() }
launcher/src/main/java/com/vayunmathur/launcher/ui/WearRoute.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearRoute.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearRoute.ktsimilarity index 84%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearRoute.ktrename to launcher/src/main/java/com/vayunmathur/launcher/ui/WearRoute.ktindex f2664581c7..f1bb844aa6 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearRoute.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearRoute.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.ui+package com.vayunmathur.launcher.ui /** Watch launcher destinations; screens are routes, never selection state. */ sealed interface WearRoute {
launcher/src/main/java/com/vayunmathur/launcher/ui/WearSettingsScreen.kt
diff --git a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearSettingsScreen.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearSettingsScreen.ktsimilarity index 91%rename from launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearSettingsScreen.ktrename to launcher/src/main/java/com/vayunmathur/launcher/ui/WearSettingsScreen.ktindex 7280bd5489..e6a9577467 100644--- a/launcher-wear/src/main/java/com/vayunmathur/launcher/wear/ui/WearSettingsScreen.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WearSettingsScreen.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.ui+package com.vayunmathur.launcher.ui import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding@@ -16,8 +16,8 @@ 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.launcher.wear.R-import com.vayunmathur.launcher.wear.platform.InstalledApps+import com.vayunmathur.launcher.R+import com.vayunmathur.launcher.platform.InstalledApps /** * Settings shortcuts: only system intents that resolve on this watch.@@ -41,8 +41,8 @@ fun WearSettingsScreen(onBack: () -> Unit) { */ @Composable internal fun WearSettingsContent(- targets: List<com.vayunmathur.launcher.wear.domain.WearSettingsTarget>,- onOpenTarget: (com.vayunmathur.launcher.wear.domain.WearSettingsTarget) -> Unit,+ targets: List<com.vayunmathur.launcher.domain.WearSettingsTarget>,+ onOpenTarget: (com.vayunmathur.launcher.domain.WearSettingsTarget) -> Unit, onBack: () -> Unit, ) { val listState = rememberScalingLazyListState()
launcher/src/main/res/values/wear_strings.xml
diff --git a/launcher-wear/src/main/res/values/strings.xml b/launcher/src/main/res/values/wear_strings.xmlsimilarity index 96%rename from launcher-wear/src/main/res/values/strings.xmlrename to launcher/src/main/res/values/wear_strings.xmlindex e29e1f4907..41d3ad837f 100644--- a/launcher-wear/src/main/res/values/strings.xml+++ b/launcher/src/main/res/values/wear_strings.xml@@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <resources>- <string name="app_name">Launcher</string> <string name="wear_favorites">Favorites</string> <string name="wear_recent">Recent</string> <string name="wear_our_apps">Our apps</string>
launcher/src/screenshotTest/kotlin/com/vayunmathur/launcher/ui/WearMetadataPreviews.kt
diff --git a/launcher-wear/src/screenshotTest/kotlin/com/vayunmathur/launcher/wear/ui/MetadataPreviews.kt b/launcher/src/screenshotTest/kotlin/com/vayunmathur/launcher/ui/WearMetadataPreviews.ktsimilarity index 83%rename from launcher-wear/src/screenshotTest/kotlin/com/vayunmathur/launcher/wear/ui/MetadataPreviews.ktrename to launcher/src/screenshotTest/kotlin/com/vayunmathur/launcher/ui/WearMetadataPreviews.ktindex 57f273e365..b50c5b76cb 100644--- a/launcher-wear/src/screenshotTest/kotlin/com/vayunmathur/launcher/wear/ui/MetadataPreviews.kt+++ b/launcher/src/screenshotTest/kotlin/com/vayunmathur/launcher/ui/WearMetadataPreviews.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.ui+package com.vayunmathur.launcher.ui import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box@@ -10,9 +10,9 @@ 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.launcher.wear.domain.WatchApp-import com.vayunmathur.launcher.wear.domain.WearLauncherSections-import com.vayunmathur.launcher.wear.domain.WearSettingsTarget+import com.vayunmathur.launcher.domain.WatchApp+import com.vayunmathur.launcher.domain.WearLauncherSections+import com.vayunmathur.launcher.domain.WearSettingsTarget /** Round watch, 454x454px class (227dp at 320dpi). */ private const val ROUND = "spec:width=227dp,height=227dp,dpi=320"@@ -24,10 +24,10 @@ private val fixtureApps = listOf( ) /**- * Store listing images for `:launcher:wear` — every top-level screen/route (home, all-apps, settings).- * `./gradlew :launcher:wear:metadata` copies renders into `metadata_data/photos/launcher-wear/wear/`.+ * Store listing images for the watch experience of `:launcher` — every top-level screen/route (home, all-apps, settings).+ * `./gradlew :launcher:metadata` copies renders into `metadata_data/photos/launcher/wear/`. */-class MetadataPreviews {+class WearMetadataPreviews { @PreviewTest @Preview(name = "1-home-round", device = ROUND, group = "wear")
launcher/src/test/java/com/vayunmathur/launcher/domain/WearLauncherModelTest.kt
diff --git a/launcher-wear/src/test/java/com/vayunmathur/launcher/wear/domain/WearLauncherModelTest.kt b/launcher/src/test/java/com/vayunmathur/launcher/domain/WearLauncherModelTest.ktsimilarity index 99%rename from launcher-wear/src/test/java/com/vayunmathur/launcher/wear/domain/WearLauncherModelTest.ktrename to launcher/src/test/java/com/vayunmathur/launcher/domain/WearLauncherModelTest.ktindex 3d6f0452b8..79771de9a7 100644--- a/launcher-wear/src/test/java/com/vayunmathur/launcher/wear/domain/WearLauncherModelTest.kt+++ b/launcher/src/test/java/com/vayunmathur/launcher/domain/WearLauncherModelTest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.launcher.wear.domain+package com.vayunmathur.launcher.domain import com.vayunmathur.library.wearlink.launcher.WearFavorite import com.vayunmathur.library.wearlink.launcher.WearFavoritesSnapshot
launcher/src/test/java/com/vayunmathur/launcher/platform/FormFactorTest.kt
diff --git a/launcher/src/test/java/com/vayunmathur/launcher/platform/FormFactorTest.kt b/launcher/src/test/java/com/vayunmathur/launcher/platform/FormFactorTest.ktnew file mode 100644index 0000000000..e3bbdb15ff--- /dev/null+++ b/launcher/src/test/java/com/vayunmathur/launcher/platform/FormFactorTest.kt@@ -0,0 +1,19 @@+package com.vayunmathur.launcher.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/launcher/wear/1.png
diff --git a/metadata_data/photos/launcher-wear/wear/1.png b/metadata_data/photos/launcher/wear/1.pngsimilarity index 100%rename from metadata_data/photos/launcher-wear/wear/1.pngrename to metadata_data/photos/launcher/wear/1.png
metadata_data/photos/launcher/wear/2.png
diff --git a/metadata_data/photos/launcher-wear/wear/2.png b/metadata_data/photos/launcher/wear/2.pngsimilarity index 100%rename from metadata_data/photos/launcher-wear/wear/2.pngrename to metadata_data/photos/launcher/wear/2.png
metadata_data/photos/launcher/wear/3.png
diff --git a/metadata_data/photos/launcher-wear/wear/3.png b/metadata_data/photos/launcher/wear/3.pngsimilarity index 100%rename from metadata_data/photos/launcher-wear/wear/3.pngrename to metadata_data/photos/launcher/wear/3.png
settings.gradle.kts
diff --git a/settings.gradle.kts b/settings.gradle.ktsindex d8b9e74488..8538615b09 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -169,8 +169,6 @@ include(":madeveloper") include(":shop") include(":share") include(":launcher")-include(":launcher:wear")-project(":launcher:wear").projectDir = file("launcher-wear") include(":cast") include(":cast:protocol") include(":cast:tv")