launcher: merge tvlauncher as UiMode-routed TV mode
- Commit
f9235128e0e3952552e1c1eb807aa6982e3a6b2f- Author
- vayun-mathur <[email protected]>
- When
- 2026-10-20 06:09 UTC (1 month ago)
- Parents
276450e
Diff
launcher/AGENTS.md
diff --git a/launcher/AGENTS.md b/launcher/AGENTS.mdindex 787478daf2..a17c0d05c9 100644--- a/launcher/AGENTS.md+++ b/launcher/AGENTS.md@@ -2,27 +2,30 @@ > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `launcher/` + allowed shared modules. Do not root-scan. -_Install: ./install launcher (dev by default)._-<!-- last-reviewed: 2026-10-16 -->+_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._+<!-- last-reviewed: 2026-10-20 --> - Gradle: :launcher / dir: launcher/-- Package roots present: ui, data, domain, platform-- Entry files: MainActivity.kt, Route.kt, Navigation.kt-- Deps: :library:room-- Metadata: metadata_data/launcher.md (present)+- 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)+- 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. Layout in encrypted Room; 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. One APK routes by UI mode. Layout in encrypted Room (phone) / DataStore order (TV); 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`) - Icon cache, app-change monitor, privilege-gated surfaces; settings pages-**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.-**Entry points + reading order:** `Route` → `MainActivity.kt` → `Navigation.kt` → `ui/HomeWorkspace.kt` → `platform/LauncherViewModel.kt` → `domain/GridPlacer.kt` + `domain/ReconcileUseCase.kt`.+- 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`. **Gotchas:**-- Exempt from the raw-animation rule: built on `animateBounds`/`Animatable` — do NOT "migrate" its motion to library helpers+- 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` - Drag input math is in `domain/`, gesture plumbing in `ui/components/` — keep them separated+- TV Back order: edit menu → cancel hold (quiet restore) → disarm reorder → no-op. TV hint slot is always composed (`TvReorderHint`) — never conditionally compose hints in the `SpaceBetween` column or the grid jumps.+- One HOME filter carries MAIN+LAUNCHER+LEANBACK_LAUNCHER+HOME+DEFAULT together — split filters on one activity confuse resolver elections. ## Key files ### Root — entry + navigation@@ -62,6 +65,25 @@ _Install: ./install launcher (dev by default)._ - com/vayunmathur/launcher/platform/IconCache.kt - com/vayunmathur/launcher/platform/ActivityBridge.kt - com/vayunmathur/launcher/platform/LauncherPrivilege.kt+### tv/ — TV mode (UiMode-routed, DataStore order, no Room/widgets)+- com/vayunmathur/launcher/tv/TvRoute.kt+- com/vayunmathur/launcher/tv/TvNavigation.kt+- com/vayunmathur/launcher/tv/data/TvPrefs.kt+- com/vayunmathur/launcher/tv/domain/TvRowOrder.kt+- com/vayunmathur/launcher/tv/platform/TvHomeViewModel.kt+- com/vayunmathur/launcher/tv/platform/TvUiContract.kt+- com/vayunmathur/launcher/tv/platform/TvApps.kt+- com/vayunmathur/launcher/tv/platform/TvInputs.kt+- com/vayunmathur/launcher/tv/platform/TvHomeRole.kt+- com/vayunmathur/launcher/tv/platform/TvArtCache.kt+- com/vayunmathur/launcher/tv/ui/TvHomeScreen.kt+- com/vayunmathur/launcher/tv/ui/TvHomePage.kt+- com/vayunmathur/launcher/tv/ui/TvClockHeader.kt+- com/vayunmathur/launcher/tv/ui/TvAppGrid.kt+- com/vayunmathur/launcher/tv/ui/TvBottomRow.kt+- com/vayunmathur/launcher/tv/ui/TvEditMenu.kt+- com/vayunmathur/launcher/tv/ui/components/TvBannerTile.kt+- com/vayunmathur/launcher/tv/ui/components/TvReorderHint.kt ### ui/ + ui/components/ — workspace, drawer, drag system - com/vayunmathur/launcher/ui/HomeWorkspace.kt - com/vayunmathur/launcher/ui/HomePage.kt
launcher/build.gradle.kts
diff --git a/launcher/build.gradle.kts b/launcher/build.gradle.ktsindex 5232068ade..082078e29a 100644--- a/launcher/build.gradle.kts+++ b/launcher/build.gradle.kts@@ -1,5 +1,9 @@ plugins { id("common-conventions-app")+ // androidx.tv, so the in-app TV mode is built on a design system that knows what a+ // D-pad is. Named alongside (the cast:tv precedent): the launcherIcon/nativeAbis+ // accessors are generated from directly-applied plugins.+ id("common-conventions-tv") // Listing screenshots come from Compose previews (src/screenshotTest), not from an // instrumented test on a device. Same `:launcher:metadata` task name either way. id("common-conventions-preview-metadata")@@ -10,6 +14,11 @@ launcherIcon { symbol = "apps" } +// Google TV hardware runs a 32-bit userspace: an arm64-only APK is rejected at install.+nativeAbis {+ armv7 = true+}+ android { defaultConfig { applicationId = "com.vayunmathur.launcher"
launcher/install-tv.sh
diff --git a/tvlauncher/install-tv.sh b/launcher/install-tv.shsimilarity index 91%rename from tvlauncher/install-tv.shrename to launcher/install-tv.shindex cbce1873bc..d5d13e49dd 100644--- a/tvlauncher/install-tv.sh+++ b/launcher/install-tv.sh@@ -13,7 +13,7 @@ set -e cd "$(dirname "$0")/.." TARGET="$1"-[ -n "$TARGET" ] || { echo "Usage: sh tvlauncher/install-tv.sh <TV_IP>" >&2; exit 1; }+[ -n "$TARGET" ] || { echo "Usage: sh launcher/install-tv.sh <TV_IP>" >&2; exit 1; } command -v adb >/dev/null 2>&1 || { echo "adb is missing. Install it first:" >&2 echo " Mac: brew install android-platform-tools" >&2@@ -34,16 +34,16 @@ case "$state" in *) echo "Can't reach $TV. Check the TV is on, on the same network, and has USB/network debugging turned on." >&2; exit 1 ;; esac -ME=com.vayunmathur.tvlauncher/.MainActivity+ME=com.vayunmathur.launcher/.MainActivity if [ -n "$APK" ]; then [ -f "$APK" ] || { echo "No such APK: $APK" >&2; exit 1; } else echo "Building…"- ./gradlew :tvlauncher:assembleDev --console=plain -q- APK_DIR=tvlauncher/build/outputs/apk/dev+ ./gradlew :launcher:assembleDev --console=plain -q+ APK_DIR=launcher/build/outputs/apk/dev META=$APK_DIR/output-metadata.json- APK_NAME=tvlauncher-dev.apk+ APK_NAME=launcher-dev.apk if [ -f "$META" ]; then FOUND=$(grep -oE '"outputFile"[[:space:]]*:[[:space:]]*"[^"]+"' "$META" | head -1 | sed -E 's/.*"([^"]+)"$/\1/') [ -n "$FOUND" ] && APK_NAME=$FOUND@@ -61,7 +61,7 @@ current_home() { sh_tv cmd package resolve-activity --brief -a android.intent.ac # Make it the default home: the role (Android 10+) and the classic way. if [ "$(sh_tv getprop ro.build.version.sdk)" -ge 29 ]; then- sh_tv cmd role add-role-holder --user 0 android.app.role.HOME com.vayunmathur.tvlauncher >/dev/null 2>&1 || true+ sh_tv cmd role add-role-holder --user 0 android.app.role.HOME com.vayunmathur.launcher >/dev/null 2>&1 || true fi sh_tv cmd package set-home-activity "$ME" >/dev/null 2>&1 || true @@ -73,7 +73,7 @@ LAUNCHERS="com.google.android.tvlauncher com.google.android.apps.tv.launcherx co # the TV needs them to start, so they, unknown apps and anything always running stay on. is_launcher() { case "$1" in- com.vayunmathur.tvlauncher|com.android.settings|com.android.tv.settings|com.android.systemui|com.android.provision) return 1 ;;+ com.vayunmathur.launcher|com.android.settings|com.android.tv.settings|com.android.systemui|com.android.provision) return 1 ;; *setup*|*wraith*|*provision*|*systemui*|*tvcenter*|*.tv.framework*|*.tvinput*) return 1 ;; esac case " $(echo $LAUNCHERS) " in *" $1 "*) ;; *) return 1 ;; esac@@ -90,7 +90,7 @@ is_off() { sh_tv pm list packages -d "$1" | grep -Fqx "package:$1"; } # always turn it back on. If it can't be saved, it's left on. turn_off() { for p in "$@"; do- if ! sh_tv "echo $p >> /data/local/tmp/tvlauncher-disabled.txt"; then+ if ! sh_tv "echo $p >> /data/local/tmp/launcher-tv-disabled.txt"; then echo "Leaving $p on: couldn't save it for undo-tv.sh." >&2; continue fi sh_tv pm disable-user --user 0 "$p" >/dev/null 2>&1 || true@@ -112,7 +112,7 @@ if [ "$(current_home)" != "$ME" ]; then others="" for p in $(home_apps); do if is_launcher "$p"; then others="$others $p"; continue; fi- case "$p" in com.vayunmathur.tvlauncher|com.android.settings|com.android.tv.settings|$WRAITH) ;; *) echo "Leaving $p on: it may be needed for your TV to start." ;; esac+ case "$p" in com.vayunmathur.launcher|com.android.settings|com.android.tv.settings|$WRAITH) ;; *) echo "Leaving $p on: it may be needed for your TV to start." ;; esac done others=$(echo $others | tr ' ' '\n') if [ -n "$others" ]; then
launcher/src/main/AndroidManifest.xml
diff --git a/launcher/src/main/AndroidManifest.xml b/launcher/src/main/AndroidManifest.xmlindex 6226b254b8..f3a9dc020a 100644--- a/launcher/src/main/AndroidManifest.xml+++ b/launcher/src/main/AndroidManifest.xml@@ -11,6 +11,11 @@ <uses-permission android:name="android.permission.MODIFY_QUIET_MODE" tools:ignore="ProtectedPermissions" /> <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />+ <!-- Only for the TV network tile: Wi-Fi, Ethernet or offline, and the Wi-Fi signal. -->+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />+ <!-- Lets "Uninstall" in the TV edit menu open Android's uninstall prompt. -->+ <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" /> <queries> <intent>@@ -20,10 +25,37 @@ <intent> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent>+ <!-- Android 11+ only shows a home screen the TV apps it asks to see. -->+ <intent>+ <action android:name="android.intent.action.MAIN" />+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />+ </intent>+ <!-- Settings screens the TV network tile opens. -->+ <intent>+ <action android:name="android.settings.WIFI_SETTINGS" />+ </intent>+ <intent>+ <action android:name="android.settings.WIRELESS_SETTINGS" />+ </intent>+ <intent>+ <action android:name="android.settings.SETTINGS" />+ </intent>+ <!-- Google TV's HDMI input player, so TV HDMI tiles open the right surface. -->+ <package android:name="com.google.android.tv.inputplayer" /> </queries> + <!-- Leanback rows list the app on TV; touch stays available so phones keep it.+ required=true on leanback would be wrong here — this APK also serves phones. -->+ <uses-feature+ android:name="android.software.leanback"+ android:required="false" />+ <uses-feature+ android:name="android.hardware.touchscreen"+ android:required="false" />+ <application android:allowBackup="true"+ android:banner="@drawable/tv_banner" android:dataExtractionRules="@xml/data_extraction_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"@@ -38,9 +70,16 @@ android:resizeableActivity="true" android:stateNotNeeded="true" android:theme="@style/Theme.Launcher">+ <!--+ One filter carrying every category: separate filters on one activity build+ separate resolve entries that confuse launcher resolution (learned merging+ tvlauncher in). LEANBACK_LAUNCHER puts the app in TV rows; HOME + DEFAULT+ keep it offerable as the default home on both form factors.+ --> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
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 1582127ffd..e98ab19e8e 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/MainActivity.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/MainActivity.kt@@ -3,10 +3,13 @@ package com.vayunmathur.launcher import android.app.Activity import android.app.ActivityOptions import android.app.PendingIntent+import android.app.UiModeManager import android.app.role.RoleManager import android.appwidget.AppWidgetManager import android.content.ComponentName+import android.content.Context import android.content.Intent+import android.content.res.Configuration import android.net.Uri import android.content.pm.PackageManager import android.os.Bundle@@ -16,6 +19,9 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect+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.LauncherPrivilege import com.vayunmathur.launcher.platform.LauncherViewModel@@ -23,6 +29,9 @@ import com.vayunmathur.launcher.platform.onStartImpl import com.vayunmathur.launcher.platform.reconcileNowImpl import com.vayunmathur.launcher.platform.onStopImpl import com.vayunmathur.launcher.platform.refreshDefaultHomeImpl+import com.vayunmathur.launcher.tv.platform.TvHomeViewModel+import com.vayunmathur.launcher.tv.TvNavigation+import com.vayunmathur.launcher.tv.TvRoute import com.vayunmathur.library.ui.MaActivity import com.vayunmathur.library.util.AppMessages import com.vayunmathur.library.util.NavBackStack@@ -39,7 +48,16 @@ import com.vayunmathur.library.util.rememberNavBackStack class MainActivity : MaActivity(), ActivityBridge { private val viewModel: LauncherViewModel by viewModels()+ private val tvViewModel: TvHomeViewModel by viewModels() private var backStack: NavBackStack<Route>? = null+ private var tvBackStack: NavBackStack<TvRoute>? = null++ /**+ * Phone or TV content, decided once per resume from the current UI mode. A `var` rather+ * than a `val`: HDMI-CEC/dock changes can flip `uiMode` at runtime, and the next resume+ * re-routes (the merged-tvlauncher contract).+ */+ private var tvMode: Boolean = false /** Asked before anything a stock device cannot do is offered. See [LauncherPrivilege]. */ private val privilege get() = viewModel.privilege@@ -61,35 +79,77 @@ class MainActivity : MaActivity(), ActivityBridge { callback?.invoke(result.resultCode == Activity.RESULT_OK) } + override val edgeToEdge: Boolean+ get() = !tvMode+ override fun onCreateBeforeContent() {+ tvMode = isTvMode() viewModel.bridge = this } @Composable override fun Content() {- val stack = rememberNavBackStack<Route>(Route.Home)- SideEffect { backStack = stack }- Navigation(viewModel, this, stack)+ if (tvMode) {+ val stack = rememberNavBackStack<TvRoute>(TvRoute.Home)+ SideEffect { tvBackStack = stack }+ TvNavigation(tvViewModel, stack)+ } else {+ val stack = rememberNavBackStack<Route>(Route.Home)+ SideEffect { backStack = stack }+ Navigation(viewModel, this, stack)+ } } override fun onStart() { super.onStart()+ if (tvMode) return viewModel.onStartImpl() viewModel.refreshDefaultHomeImpl() } override fun onResume() { super.onResume()+ val nowTv = isTvMode()+ if (nowTv != tvMode) {+ // UI mode flipped underneath us (dock/HDMI-CEC): re-route on next composition.+ tvMode = nowTv+ }+ if (tvMode) {+ tvViewModel.refreshApps()+ tvViewModel.refreshDefaultHome(this)+ return+ } // Cheap enough to redo every time we come back: an app may have been installed or // uninstalled while we were away without us being alive to hear the callback. viewModel.reconcileNowImpl() } override fun onStop() {- viewModel.onStopImpl()+ if (!tvMode) viewModel.onStopImpl() super.onStop() } + override fun onConfigurationChanged(newConfig: Configuration) {+ super.onConfigurationChanged(newConfig)+ if (isTvMode() != tvMode) {+ // Recreate to re-run onCreateBeforeContent + Content with the right mode rather+ // than trying to swap nav graphs mid-composition.+ recreate()+ }+ }++ /**+ * True when this device is a television. Single fact, mirrored from the appstore+ * DeviceAttributesProvider notion of TV — leanback present, no touchscreen.+ */+ private fun isTvMode(): Boolean {+ val uiMode = getSystemService(UiModeManager::class.java)+ ?.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION+ if (uiMode) return true+ return packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK) &&+ !packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)+ }+ override fun onDestroy() { viewModel.bridge = null super.onDestroy()@@ -102,7 +162,7 @@ class MainActivity : MaActivity(), ActivityBridge { override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) setIntent(intent)- backStack?.reset(Route.Home)+ if (tvMode) tvBackStack?.reset(TvRoute.Home) else backStack?.reset(Route.Home) } // ------------------------------------------------------------------
launcher/src/main/java/com/vayunmathur/launcher/tv/TvNavigation.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/tv/TvNavigation.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/TvNavigation.ktnew file mode 100644index 0000000000..08d667b925--- /dev/null+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/TvNavigation.kt@@ -0,0 +1,22 @@+package com.vayunmathur.launcher.tv++import androidx.compose.runtime.Composable+import com.vayunmathur.launcher.tv.platform.TvHomeViewModel+import com.vayunmathur.launcher.tv.ui.TvHomePage+import com.vayunmathur.library.util.MainNavigation+import com.vayunmathur.library.util.NavBackStack++/**+ * TV navigation: a single Home destination. Phone `Navigation` is untouched — the two+ * graphs share only the activity, never a back stack.+ */+@Composable+fun TvNavigation(+ viewModel: TvHomeViewModel,+ backStack: NavBackStack<TvRoute>,+) {+ // Opaque: a TV home screen paints its own warm gradient, never the wallpaper behind it.+ MainNavigation(backStack) {+ entry<TvRoute.Home> { TvHomePage(viewModel) }+ }+}
launcher/src/main/java/com/vayunmathur/launcher/tv/TvRoute.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/tv/TvRoute.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/TvRoute.ktnew file mode 100644index 0000000000..943a3c4cb3--- /dev/null+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/TvRoute.kt@@ -0,0 +1,21 @@+package com.vayunmathur.launcher.tv++import com.vayunmathur.library.util.NavKey+import kotlinx.serialization.Serializable++/**+ * The TV nav graph is a single destination.+ *+ * Named TvRoute (not Route): the phone graph's `Route` lives in this same module, and two+ * same-named sealed interfaces would collide. Same reason for [TvNavigation].+ *+ * The edit menu (move/replace/remove) and the add-app picker are **not** routes: they are+ * overlays inside the home screen, because D-pad focus must stay inside one focus tree+ * while editing.+ */+@Serializable+sealed interface TvRoute : NavKey {+ /** The banner grid with the clock header and bottom row. */+ @Serializable+ data object Home : TvRoute+}
launcher/src/main/java/com/vayunmathur/launcher/tv/data/TvPrefs.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/data/TvPrefs.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/data/TvPrefs.ktsimilarity index 97%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/data/TvPrefs.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/data/TvPrefs.ktindex 2d05d3e1b9..8c3fde521b 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/data/TvPrefs.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/data/TvPrefs.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.data+package com.vayunmathur.launcher.tv.data import android.content.Context import androidx.datastore.preferences.core.edit@@ -47,3 +47,4 @@ class TvPrefs(private val context: Context) { private val KEY_QUICK = stringPreferencesKey("quick") } }+
launcher/src/main/java/com/vayunmathur/launcher/tv/domain/TvRowOrder.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/domain/TvRowOrder.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/domain/TvRowOrder.ktsimilarity index 98%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/domain/TvRowOrder.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/domain/TvRowOrder.ktindex 7027e3b8a6..c2297fc76c 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/domain/TvRowOrder.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/domain/TvRowOrder.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.domain+package com.vayunmathur.launcher.tv.domain /** * Pure row-order math for the TV home screen: no Android, no Compose.@@ -92,3 +92,4 @@ object TvRowOrder { fun maxHdmiSlots(hasStore: Boolean): Int = (PER_ROW - 2 - if (hasStore) 1 else 0) .coerceIn(0, MAX_INPUTS) }+
launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvApps.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvApps.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvApps.ktsimilarity index 93%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvApps.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvApps.ktindex f0b93c71bb..0ff7e12f57 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvApps.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvApps.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.platform+package com.vayunmathur.launcher.tv.platform import android.content.Context import android.content.Intent@@ -33,8 +33,8 @@ object TvApps { if (pkg == selfPackage || pkg in seen) continue seen.add(pkg) val isLeanback = pkg in leanbackPkgs- if (pkg in com.vayunmathur.tvlauncher.domain.TvRowOrder.NEVER_TILES &&- pkg != com.vayunmathur.tvlauncher.domain.TvRowOrder.PLAY_STORE+ if (pkg in com.vayunmathur.launcher.tv.domain.TvRowOrder.NEVER_TILES &&+ pkg != com.vayunmathur.launcher.tv.domain.TvRowOrder.PLAY_STORE ) { continue }@@ -82,3 +82,4 @@ data class TvLaunchTarget( val addApp: Boolean = false, val hdmiInputId: String? = null, )+
launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvArtCache.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvArtCache.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvArtCache.ktsimilarity index 96%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvArtCache.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvArtCache.ktindex e33c98c2bf..99e25a0292 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvArtCache.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvArtCache.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.platform+package com.vayunmathur.launcher.tv.platform import android.app.Application import android.graphics.drawable.Drawable@@ -39,3 +39,4 @@ class TvArtCache(private val app: Application) { synchronized(icons) { icons.remove(pkg) } } }+
launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeRole.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvHomeRole.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeRole.ktsimilarity index 96%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvHomeRole.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeRole.ktindex 130b88dfe4..0755f1fe58 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvHomeRole.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeRole.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.platform+package com.vayunmathur.launcher.tv.platform import android.app.Activity import android.app.role.RoleManager@@ -33,3 +33,4 @@ object TvHomeRole { }.getOrDefault(false) } }+
launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeViewModel.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvHomeViewModel.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeViewModel.ktsimilarity index 98%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvHomeViewModel.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeViewModel.ktindex e74ef4bbb4..bf74d353da 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvHomeViewModel.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvHomeViewModel.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.platform+package com.vayunmathur.launcher.tv.platform import android.app.Application import android.content.BroadcastReceiver@@ -10,8 +10,8 @@ import android.provider.Settings import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope import com.vayunmathur.library.util.AppMessages-import com.vayunmathur.tvlauncher.data.TvPrefs-import com.vayunmathur.tvlauncher.domain.TvRowOrder+import com.vayunmathur.launcher.tv.data.TvPrefs+import com.vayunmathur.launcher.tv.domain.TvRowOrder import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow@@ -340,3 +340,4 @@ class TvHomeViewModel(app: Application) : AndroidViewModel(app) { return order.mapNotNull { byPkg[it] } + tiles.filter { it.packageName !in order } } }+
launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvInputs.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvInputs.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvInputs.ktsimilarity index 98%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvInputs.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvInputs.ktindex 8568d6de97..47ceca280b 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvInputs.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvInputs.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.platform+package com.vayunmathur.launcher.tv.platform import android.content.Context import android.content.Intent@@ -67,3 +67,4 @@ object TvInputs { "com.droidlogic.android.tv" to "com.android.tv.TvActivity", ) }+
launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvUiContract.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvUiContract.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvUiContract.ktsimilarity index 96%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvUiContract.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvUiContract.ktindex 79f98abac8..2a286f67ac 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/platform/TvUiContract.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/platform/TvUiContract.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.platform+package com.vayunmathur.launcher.tv.platform import android.graphics.drawable.Drawable @@ -35,3 +35,4 @@ data class TvHomeState( val isDefaultHome: Boolean = false, val loading: Boolean = true, )+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvAppGrid.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvAppGrid.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvAppGrid.ktsimilarity index 96%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvAppGrid.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvAppGrid.ktindex ce5a361bb1..c0890f9490 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvAppGrid.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvAppGrid.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.ui+package com.vayunmathur.launcher.tv.ui import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box@@ -16,9 +16,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.animatedDp-import com.vayunmathur.tvlauncher.domain.TvRowOrder-import com.vayunmathur.tvlauncher.platform.TvHomeState-import com.vayunmathur.tvlauncher.ui.components.TvBannerTile+import com.vayunmathur.launcher.tv.domain.TvRowOrder+import com.vayunmathur.launcher.tv.platform.TvHomeState+import com.vayunmathur.launcher.tv.ui.components.TvBannerTile /** * The app banner grid: six 16:9 tiles per row like the tv-detox reference.@@ -132,3 +132,4 @@ fun TvAppGrid( } private const val MAX_ROWS = 2+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvBottomRow.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvBottomRow.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvBottomRow.ktsimilarity index 96%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvBottomRow.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvBottomRow.ktindex 060aa5c82b..8c04a2d191 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvBottomRow.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvBottomRow.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.ui+package com.vayunmathur.launcher.tv.ui import androidx.compose.foundation.background import androidx.compose.foundation.border@@ -34,9 +34,9 @@ import com.vayunmathur.library.ui.IconSettings import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.animatedFloat-import com.vayunmathur.tvlauncher.domain.TvRowOrder-import com.vayunmathur.tvlauncher.platform.TvHdmiInput-import com.vayunmathur.tvlauncher.platform.TvHomeState+import com.vayunmathur.launcher.tv.domain.TvRowOrder+import com.vayunmathur.launcher.tv.platform.TvHdmiInput+import com.vayunmathur.launcher.tv.platform.TvHomeState /** * The bottom glass row: App Store, HDMI inputs, Settings, Reorder (the tv-detox bottom row@@ -175,3 +175,4 @@ private fun TvGlassTile( ) } }+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvClockHeader.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvClockHeader.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvClockHeader.ktsimilarity index 99%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvClockHeader.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvClockHeader.ktindex cbc0dd3e23..766b95f158 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvClockHeader.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvClockHeader.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.ui+package com.vayunmathur.launcher.tv.ui import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement@@ -118,3 +118,4 @@ private fun TvNetworkTile( } } }+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvEditMenu.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvEditMenu.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvEditMenu.ktsimilarity index 98%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvEditMenu.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvEditMenu.ktindex 2671b0780c..7050b74aac 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvEditMenu.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvEditMenu.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.ui+package com.vayunmathur.launcher.tv.ui import androidx.compose.foundation.clickable import androidx.compose.foundation.focusable@@ -19,7 +19,7 @@ import com.vayunmathur.library.ui.AlertDialog import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton-import com.vayunmathur.tvlauncher.platform.TvHomeState+import com.vayunmathur.launcher.tv.platform.TvHomeState /** * Edit overlays: the per-tile menu (Move/Replace/Remove/Uninstall-or-App-info) and the@@ -124,3 +124,4 @@ private fun TvMenuRow( .padding(vertical = 16.dp, horizontal = 8.dp), ) }+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomePage.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvHomePage.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomePage.ktsimilarity index 94%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvHomePage.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomePage.ktindex b48883bafb..249ec4e0d8 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvHomePage.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomePage.kt@@ -1,11 +1,11 @@-package com.vayunmathur.tvlauncher.ui+package com.vayunmathur.launcher.tv.ui import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext-import com.vayunmathur.tvlauncher.platform.TvHomeViewModel+import com.vayunmathur.launcher.tv.platform.TvHomeViewModel /** * The stateful half of the TV home screen.@@ -45,3 +45,4 @@ fun TvHomePage(viewModel: TvHomeViewModel) { }, ) }+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomeScreen.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvHomeScreen.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomeScreen.ktsimilarity index 96%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvHomeScreen.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomeScreen.ktindex a77b5a3e4b..5478989126 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/TvHomeScreen.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/TvHomeScreen.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.ui+package com.vayunmathur.launcher.tv.ui import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement@@ -16,7 +16,7 @@ import androidx.activity.compose.BackHandler import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton-import com.vayunmathur.tvlauncher.ui.components.TvReorderHint+import com.vayunmathur.launcher.tv.ui.components.TvReorderHint // RAW SCAFFOLD EXCEPTION: TV launcher fullscreen grid, no app bar. @@ -32,7 +32,7 @@ import com.vayunmathur.tvlauncher.ui.components.TvReorderHint */ @Composable fun TvHomeScreen(- state: com.vayunmathur.tvlauncher.platform.TvHomeState,+ state: com.vayunmathur.launcher.tv.platform.TvHomeState, onPressTile: (String) -> Unit, onOpenAppStore: () -> Unit, onOpenInput: (String) -> Unit,@@ -131,3 +131,4 @@ private val TvHomeBackground = Brush.verticalGradient( Color(0xFF050405), ), )+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvBannerTile.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/components/TvBannerTile.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvBannerTile.ktsimilarity index 98%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/components/TvBannerTile.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvBannerTile.ktindex d744cb5e22..5c3ad55d0f 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/components/TvBannerTile.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvBannerTile.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.ui.components+package com.vayunmathur.launcher.tv.ui.components import android.graphics.drawable.Drawable import androidx.compose.foundation.Image@@ -45,8 +45,8 @@ import com.vayunmathur.library.ui.IconApps import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.animatedFloat-import com.vayunmathur.tvlauncher.domain.TvRowOrder-import com.vayunmathur.tvlauncher.platform.TvTile+import com.vayunmathur.launcher.tv.domain.TvRowOrder+import com.vayunmathur.launcher.tv.platform.TvTile import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -287,3 +287,4 @@ private fun TvGlassIcon(tile: TvTile) { ) } }+
launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvReorderHint.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/components/TvReorderHint.kt b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvReorderHint.ktsimilarity index 96%rename from tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/components/TvReorderHint.ktrename to launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvReorderHint.ktindex f956ccc78a..01e7395058 100644--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/ui/components/TvReorderHint.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/tv/ui/components/TvReorderHint.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.ui.components+package com.vayunmathur.launcher.tv.ui.components import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth@@ -46,3 +46,4 @@ fun TvReorderHint( ) } }+
launcher/src/main/res/drawable/tv_banner.xml
diff --git a/tvlauncher/src/main/res/drawable/banner.xml b/launcher/src/main/res/drawable/tv_banner.xmlsimilarity index 70%rename from tvlauncher/src/main/res/drawable/banner.xmlrename to launcher/src/main/res/drawable/tv_banner.xmlindex d7623aced0..ea902f9fc5 100644--- a/tvlauncher/src/main/res/drawable/banner.xml+++ b/launcher/src/main/res/drawable/tv_banner.xml@@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?>-<!-- Leanback-row banner (160x90), following the cast:tv banner pattern. The home grid itself- draws banner art per app at runtime; this is the static icon other launchers show for us. -->+<!-- Leanback-row banner (160x90): the static icon TV rows show for this app. The home grid+ itself draws banner art per app at runtime. Moved verbatim from the merged tvlauncher. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="160dp" android:height="90dp"
launcher/src/test/java/com/vayunmathur/launcher/tv/domain/TvRowOrderTest.kt
diff --git a/tvlauncher/src/test/java/com/vayunmathur/tvlauncher/domain/TvRowOrderTest.kt b/launcher/src/test/java/com/vayunmathur/launcher/tv/domain/TvRowOrderTest.ktsimilarity index 98%rename from tvlauncher/src/test/java/com/vayunmathur/tvlauncher/domain/TvRowOrderTest.ktrename to launcher/src/test/java/com/vayunmathur/launcher/tv/domain/TvRowOrderTest.ktindex 16e3f1da05..b57ad8fb70 100644--- a/tvlauncher/src/test/java/com/vayunmathur/tvlauncher/domain/TvRowOrderTest.kt+++ b/launcher/src/test/java/com/vayunmathur/launcher/tv/domain/TvRowOrderTest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.tvlauncher.domain+package com.vayunmathur.launcher.tv.domain import kotlin.test.Test import kotlin.test.assertEquals@@ -107,3 +107,4 @@ class TvRowOrderTest { assertEquals(4, TvRowOrder.maxHdmiSlots(hasStore = false)) } }+
launcher/undo-tv.sh
diff --git a/tvlauncher/undo-tv.sh b/launcher/undo-tv.shsimilarity index 95%rename from tvlauncher/undo-tv.shrename to launcher/undo-tv.shindex d54b9c456a..1d0a9abdc4 100644--- a/tvlauncher/undo-tv.sh+++ b/launcher/undo-tv.sh@@ -34,7 +34,7 @@ turn_on() { # Turn back on whatever install-tv.sh turned off, before removing TV Launcher. # END marks a full read; no list at all is fine.-LIST=/data/local/tmp/tvlauncher-disabled.txt+LIST=/data/local/tmp/launcher-tv-disabled.txt list=$(adb -s "$TV" shell "if [ -e $LIST ]; then cat $LIST && echo END; else echo END; fi" 2>/dev/null) || list= list=$(printf '%s\n' "$list" | tr -d '\r') case "$list" in@@ -58,6 +58,6 @@ if [ -n "$failed" ]; then exit 1 fi adb -s "$TV" shell rm -f "$LIST"-adb -s "$TV" uninstall com.vayunmathur.tvlauncher >/dev/null 2>&1 || true+adb -s "$TV" uninstall com.vayunmathur.launcher >/dev/null 2>&1 || true adb -s "$TV" shell input keyevent KEYCODE_HOME echo "Removed. Your TV is back to its own home screen."
metadata_data/launcher.md
diff --git a/metadata_data/launcher.md b/metadata_data/launcher.mdindex 68bb443d58..09e3b23ab7 100644--- a/metadata_data/launcher.md+++ b/metadata_data/launcher.md@@ -1,10 +1,11 @@-A home screen replacement with real widget support+A home screen replacement with real widget support, plus a TV mode Features: - Paged icon grid, a hotseat, folders, and a searchable app drawer - Widgets hosted directly, including providers that need configuring first - Cell grid whose size you choose - Layout kept in an encrypted database on your device+- On Android TV and Google TV it becomes a calm banner home: 16:9 app tiles, HDMI inputs, clock header, D-pad reorder - No account, nothing collected, nothing uploaded 100% offline
metadata_data/tvlauncher.md
diff --git a/metadata_data/tvlauncher.md b/metadata_data/tvlauncher.mddeleted file mode 100644index 4eedc71c68..0000000000--- a/metadata_data/tvlauncher.md+++ /dev/null@@ -1,10 +0,0 @@-A calm, fast home screen for Android TV and Google TV--Features:-- Your apps as large 16:9 banners, six per row, with nothing else competing-- HDMI inputs, Play Store and Settings one D-pad press away on the bottom row-- Giant clock and date header with a live network status icon-- Reorder, replace or remove tiles with the remote; order survives restarts-- Can be set as the default home screen via the system Home role--100% offline
settings.gradle.kts
diff --git a/settings.gradle.kts b/settings.gradle.ktsindex 88b4eba042..df0c5c053c 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -110,7 +110,6 @@ include(":euicc") include(":backup") include(":share") include(":launcher")-include(":tvlauncher") include(":cast") include(":cast:protocol") include(":cast:tv")
tvlauncher/AGENTS.md
diff --git a/tvlauncher/AGENTS.md b/tvlauncher/AGENTS.mddeleted file mode 100644index 0e92409122..0000000000--- a/tvlauncher/AGENTS.md+++ /dev/null@@ -1,56 +0,0 @@-# AGENTS.md — tvlauncher/ (':tvlauncher')--> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `tvlauncher/` + allowed shared modules. Do not root-scan.--_Install: ./install tvlauncher (dev by default) for a USB-connected device. For a TV over-Wi-Fi: `sh tvlauncher/install-tv.sh <TV_IP>` builds, installs and offers to set it as the-default home; `sh tvlauncher/undo-tv.sh <TV_IP>` restores the stock home and uninstalls._-<!-- last-reviewed: 2026-10-19 -->-- Gradle: :tvlauncher / dir: tvlauncher/-- Package roots present: ui, data, domain, platform-- Entry files: MainActivity.kt, Route.kt, Navigation.kt-- Deps: androidx.tv.material (via common-conventions-tv), datastore.preferences-- Metadata: metadata_data/tvlauncher.md (present)-- Rust: no / screenshotTest: no (TV fullscreen grid, Layoutlib cannot render it — cast:tv precedent)--## Overview-**Purpose:** Calm TV home-screen replacement in the tv-detox shape — app banner grid, HDMI inputs, clock header — rebuilt in Compose/Kotlin. No account, nothing uploaded; row order in DataStore.-**Key features:**-- 6-per-row 16:9 banner grid topped up from installed leanback apps, persisted order-- Bottom glass row: Play Store, HDMI inputs, Settings, Add-- D-pad focus scale + caption, long-OK edit menu (move/replace/remove/uninstall)-- Clock header with live network tile; HOME role so it can be the default launcher-**Architecture / data-flow:** `ui/` home/grid/bottom-row/edit-menu → `platform/TvHomeViewModel` (+ `TvUiContract`) → `data/TvPrefs` (DataStore); `domain/` is pure row-order math (move/replace/remove, 6-per-row) with no Android imports; `platform/TvInputs` owns HDMI via TvInputManager.-**Entry points + reading order:** `Route` → `MainActivity.kt` → `Navigation.kt` → `ui/TvHomeScreen.kt` → `platform/TvHomeViewModel.kt` → `domain/TvRowOrder.kt`.-**Gotchas:**-- New package, so the `:launcher` raw-animation exemption does NOT apply — focus motion goes through `library.ui` motion helpers-- TV banner art comes from `PackageManager.getActivityBanner()`, which has no repo precedent; loading is bounded-parallel with a non-reflowing placeholder-- Back on home is a no-op; HOME intent resets to the grid (no folder/page state to reset in v1)--## Key files-### Root — entry + navigation-- com/vayunmathur/tvlauncher/MainActivity.kt-- com/vayunmathur/tvlauncher/Navigation.kt-- com/vayunmathur/tvlauncher/Route.kt-### data/ — DataStore row order-- com/vayunmathur/tvlauncher/data/TvPrefs.kt-### domain/ — pure row math (no Android/Compose)-- com/vayunmathur/tvlauncher/domain/TvRowOrder.kt-### platform/ — ViewModel, apps, inputs, home role-- com/vayunmathur/tvlauncher/platform/TvHomeViewModel.kt-- com/vayunmathur/tvlauncher/platform/TvUiContract.kt-- com/vayunmathur/tvlauncher/platform/TvApps.kt-- com/vayunmathur/tvlauncher/platform/TvInputs.kt-### ui/ — clock header, grid, bottom row, edit menu-- com/vayunmathur/tvlauncher/ui/TvHomeScreen.kt-- com/vayunmathur/tvlauncher/ui/TvClockHeader.kt-- com/vayunmathur/tvlauncher/ui/TvAppGrid.kt-- com/vayunmathur/tvlauncher/ui/TvBottomRow.kt-- com/vayunmathur/tvlauncher/ui/TvEditMenu.kt--## Verify (this module only)-```-./gradlew :tvlauncher:compileDevKotlin-./gradlew :tvlauncher:lint-./gradlew :tvlauncher:checkMetadata-```
tvlauncher/build.gradle.kts
diff --git a/tvlauncher/build.gradle.kts b/tvlauncher/build.gradle.ktsdeleted file mode 100644index a28ff63e16..0000000000--- a/tvlauncher/build.gradle.kts+++ /dev/null@@ -1,33 +0,0 @@-plugins {- id("common-conventions-app")- // androidx.tv, so the home screen is built on a design system that knows what a D-pad is.- // Named here *alongside* the app convention rather than instead of it, even though it applies- // that itself: the type-safe `launcherIcon` and `nativeAbis` accessors below are generated- // from the plugins this file applies directly (the cast:tv precedent).- id("common-conventions-tv")- // No preview-metadata convention. The home screen is a TV-shaped fullscreen grid and- // Layoutlib cannot render it into a *phone* listing image (the cast:tv precedent).- // metadata_data/tvlauncher.md still exists, which is what generates a listing at all.-}--launcherIcon {- symbol = "tv"-}--// Google TV hardware (the onn 4K Streaming Box and friends) runs a 32-bit userspace and-// reports only `armeabi-v7a,armeabi`, so an arm64-only APK is rejected at install time.-nativeAbis {- armv7 = true-}--android {- defaultConfig {- applicationId = "com.vayunmathur.tvlauncher"- }-}--dependencies {- // Pinned-row order + quick settings (the BackupConfig preferencesDataStore pattern, not- // Room: a launcher row order is a flat list, not relational data).- implementation(libs.androidx.datastore.preferences)-}
tvlauncher/src/main/AndroidManifest.xml
diff --git a/tvlauncher/src/main/AndroidManifest.xml b/tvlauncher/src/main/AndroidManifest.xmldeleted file mode 100644index 3d84cd4927..0000000000--- a/tvlauncher/src/main/AndroidManifest.xml+++ /dev/null@@ -1,79 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<manifest xmlns:android="http://schemas.android.com/apk/res/android">-- <!-- Only for the network tile: Wi-Fi, Ethernet or offline, and the Wi-Fi signal. -->- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />- <!-- Lets "Uninstall" in the edit menu open Android's uninstall prompt. -->- <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />-- <!-- Android 11+ only shows apps a home screen asks to see: TV apps and normal apps. -->- <queries>- <intent>- <action android:name="android.intent.action.MAIN" />- <category android:name="android.intent.category.LEANBACK_LAUNCHER" />- </intent>- <intent>- <action android:name="android.intent.action.MAIN" />- <category android:name="android.intent.category.LAUNCHER" />- </intent>- <!-- Settings screens the network tile opens. -->- <intent>- <action android:name="android.settings.WIFI_SETTINGS" />- </intent>- <intent>- <action android:name="android.settings.WIRELESS_SETTINGS" />- </intent>- <intent>- <action android:name="android.settings.SETTINGS" />- </intent>- <!-- Google TV's HDMI input player, so HDMI tiles open the right surface. -->- <package android:name="com.google.android.tv.inputplayer" />- </queries>-- <!-- Leanback is the point; touch is incidental (some TVs report a touchscreen). -->- <uses-feature- android:name="android.software.leanback"- android:required="true" />- <uses-feature- android:name="android.hardware.touchscreen"- android:required="false" />-- <application- android:allowBackup="true"- android:banner="@drawable/banner"- android:dataExtractionRules="@xml/data_extraction_rules"- android:icon="@mipmap/ic_launcher"- android:label="@string/app_name"- android:roundIcon="@mipmap/ic_launcher"- android:supportsRtl="true"- android:theme="@style/Theme.General">- <!--- singleTask + stateNotNeeded are what make this behave like a home app: HOME delivers- a new intent to the existing instance rather than stacking another copy, and the system- may kill it without saving state because the row order lives in DataStore, not in a- Bundle.- One filter carrying every category (the :launcher precedent): separate filters build- separate resolve entries for the same activity, and Google TV's HOME election then- never prefers the HOME one — query-activities lists us while resolve-activity keeps- the stock launcher. LEANBACK_LAUNCHER keeps the app visible in other launchers' TV- rows; HOME + DEFAULT is what lets the system offer it as the default home screen.- -->- <activity- android:name=".MainActivity"- android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"- android:excludeFromRecents="true"- android:exported="true"- android:launchMode="singleTask"- android:screenOrientation="landscape"- android:stateNotNeeded="true"- android:theme="@style/Theme.General">- <intent-filter>- <action android:name="android.intent.action.MAIN" />- <category android:name="android.intent.category.LEANBACK_LAUNCHER" />- <category android:name="android.intent.category.HOME" />- <category android:name="android.intent.category.DEFAULT" />- </intent-filter>- </activity>- </application>-</manifest>
tvlauncher/src/main/java/com/vayunmathur/tvlauncher/MainActivity.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/MainActivity.kt b/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/MainActivity.ktdeleted file mode 100644index ce2117ddfa..0000000000--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/MainActivity.kt+++ /dev/null@@ -1,53 +0,0 @@-package com.vayunmathur.tvlauncher--import android.content.Intent-import androidx.activity.viewModels-import androidx.compose.runtime.Composable-import androidx.compose.runtime.SideEffect-import com.vayunmathur.library.ui.MaActivity-import com.vayunmathur.library.util.NavBackStack-import com.vayunmathur.library.util.rememberNavBackStack-import com.vayunmathur.tvlauncher.platform.TvHomeViewModel--/**- * The TV home screen activity.- *- * `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- * copy, and the system may kill it without saving state because the row order is in- * DataStore, not in a `Bundle`. `edgeToEdge` is false: a TV has no phone chrome to draw- * behind (the cast:tv precedent).- */-class MainActivity : MaActivity() {- override val edgeToEdge: Boolean = false-- private val viewModel: TvHomeViewModel by viewModels()- private var backStack: NavBackStack<Route>? = null-- @Composable- override fun Content() {- val stack = rememberNavBackStack<Route>(Route.Home)- SideEffect { backStack = stack }- Navigation(viewModel, stack)- }-- override fun onResume() {- super.onResume()- // Cheap enough to redo every time we come back: an app may have been installed or- // uninstalled while we were away without us being alive to hear the callback. The- // default-home check rides along so the set-default button clears itself the moment- // the system grants the role (e.g. returning from the role prompt).- viewModel.refreshApps()- viewModel.refreshDefaultHome(this)- }-- /**- * Pressing HOME from inside another app comes back here. Resetting to the grid is what- * makes HOME feel like HOME rather than a no-op (the :launcher MainActivity precedent).- */- override fun onNewIntent(intent: Intent) {- super.onNewIntent(intent)- setIntent(intent)- backStack?.reset(Route.Home)- }-}
tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Navigation.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Navigation.kt b/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Navigation.ktdeleted file mode 100644index 5b9d32215d..0000000000--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Navigation.kt+++ /dev/null@@ -1,18 +0,0 @@-package com.vayunmathur.tvlauncher--import androidx.compose.runtime.Composable-import com.vayunmathur.library.util.MainNavigation-import com.vayunmathur.library.util.NavBackStack-import com.vayunmathur.tvlauncher.platform.TvHomeViewModel-import com.vayunmathur.tvlauncher.ui.TvHomePage--@Composable-fun Navigation(- viewModel: TvHomeViewModel,- backStack: NavBackStack<Route>,-) {- // Opaque: a TV home screen paints its own warm gradient, never the wallpaper behind it.- MainNavigation(backStack) {- entry<Route.Home> { TvHomePage(viewModel) }- }-}
tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Route.kt
diff --git a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Route.kt b/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Route.ktdeleted file mode 100644index ade3b40121..0000000000--- a/tvlauncher/src/main/java/com/vayunmathur/tvlauncher/Route.kt+++ /dev/null@@ -1,18 +0,0 @@-package com.vayunmathur.tvlauncher--import com.vayunmathur.library.util.NavKey-import kotlinx.serialization.Serializable--/**- * The nav graph is a single destination in v1.- *- * The edit menu (move/replace/remove) and the add-app picker are **not** routes: they are- * overlays inside the home screen, because D-pad focus must stay inside one focus tree while- * editing (the :launcher drawer-as-overlay precedent, minus the drag system).- */-@Serializable-sealed interface Route : NavKey {- /** The banner grid with the clock header and bottom row. */- @Serializable- data object Home : Route-}
tvlauncher/src/main/res/values/strings.xml
diff --git a/tvlauncher/src/main/res/values/strings.xml b/tvlauncher/src/main/res/values/strings.xmldeleted file mode 100644index a25c4ef615..0000000000--- a/tvlauncher/src/main/res/values/strings.xml+++ /dev/null@@ -1,4 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<resources>- <string name="app_name">TV Launcher</string>-</resources>
tvlauncher/src/main/res/xml/data_extraction_rules.xml
diff --git a/tvlauncher/src/main/res/xml/data_extraction_rules.xml b/tvlauncher/src/main/res/xml/data_extraction_rules.xmldeleted file mode 100644index 81a97e0f26..0000000000--- a/tvlauncher/src/main/res/xml/data_extraction_rules.xml+++ /dev/null@@ -1,17 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<data-extraction-rules>- <cloud-backup>- <include domain="root" path="." />- <include domain="file" path="." />- <include domain="database" path="." />- <include domain="sharedpref" path="." />- <include domain="external" path="." />- </cloud-backup>- <device-transfer>- <include domain="root" path="." />- <include domain="file" path="." />- <include domain="database" path="." />- <include domain="sharedpref" path="." />- <include domain="external" path="." />- </device-transfer>-</data-extraction-rules>