Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
986faae
Declare Android TV / Google TV eligibility in the manifest
claude Jul 23, 2026
3a3961f
Lock landscape orientation on Android TV instead of the phone portrai…
claude Jul 23, 2026
4b8f966
Hide the QR remote-pairing scan button when no camera is available
claude Jul 23, 2026
ddebf9f
Fix D-pad focus in the player switcher dialog
claude Jul 23, 2026
363186a
Add Android TV support notes for local verification
claude Jul 23, 2026
451a8e1
Flag ANDROID-TV.md as excluded from upstream PRs
claude Jul 23, 2026
4acf03f
Fix manifest merger silently re-requiring the camera feature
dmfrey Jul 23, 2026
2547bf9
Fix QrScanAvailabilityTest assertions
dmfrey Jul 23, 2026
95f6296
Update Android TV support notes with local verification results
dmfrey Jul 23, 2026
89dd54a
Remove local-only Android TV working notes before upstream PR
dmfrey Jul 23, 2026
4099ef8
Document testing conventions and upstream repo relationship
claude Jul 25, 2026
e16c4d9
Fold in real Android TV verification findings
claude Jul 25, 2026
7635472
Document that session-added .claude/*.md content stays out of PRs
claude Jul 25, 2026
aed1ecb
Strip session-added .claude/*.md content before it hits the PR
dmfrey Jul 25, 2026
30b346a
Fix D-pad focus on the connected Android TV settings screen
dmfrey Aug 6, 2026
875ed88
Make Android TV player and settings fully D-pad navigable, and add a …
dmfrey Aug 7, 2026
ff12772
Fix Android TV login keyboard trap, error visibility, and player swit…
dmfrey Aug 7, 2026
6b14f8c
Fix Android TV initial focus landing when returning from Settings
dmfrey Aug 7, 2026
ea94859
Enlarge focused player slider thumbs and land focus on detail play bu…
dmfrey Aug 8, 2026
f784406
Anchor TV settings editor above the on-screen keyboard
dmfrey Aug 8, 2026
782185d
Show friendly connect-failure messages on Android TV settings
dmfrey Aug 10, 2026
3836785
Show placeholder hints instead of hardcoded defaults in server host a…
dmfrey Aug 10, 2026
7c1d4f8
Merge upstream main into Android TV branch
dmfrey Aug 10, 2026
0de753f
Fix detekt findings on the Android TV branch
dmfrey Aug 10, 2026
b164773
Fix Android TV changes breaking phone unit tests
dmfrey Aug 10, 2026
faf0566
Gate MainNavRoot's TV-only focus effects behind isTelevisionDevice()
dmfrey Aug 12, 2026
9a10b4d
Gate SelectPlayerDialog's D-pad interception behind isTelevisionDevice()
dmfrey Aug 12, 2026
bdda84a
Extract SettingsScreen's TV focus-link builders into SettingsTvFocusL…
dmfrey Aug 12, 2026
e2e2ef3
Move SettingsScreen's TV-only composables into SettingsScreenTv.kt
dmfrey Aug 12, 2026
93ccae4
Wire the persistent mini-player into the TV D-pad focus graph
dmfrey Aug 14, 2026
a11b1fe
Add visible D-pad focus indication to Home cards, nav rail, and top-b…
dmfrey Aug 14, 2026
e56f21d
Add explicit D-pad up/down links between nav rail items
dmfrey Aug 15, 2026
33b9be7
Merge upstream main into Android TV branch
dmfrey Aug 16, 2026
124c277
Fix D-pad unable to reach search results on Android TV
dmfrey Aug 26, 2026
c458a34
Merge upstream main into Android TV branch
dmfrey Aug 26, 2026
da281c7
Add require-encryption toggle to TV Sendspin settings, fix TV orienta…
dmfrey Aug 26, 2026
7967295
Merge branch 'main' into claude/music-assistant-android-tv-95iu6l
dmfrey Sep 14, 2026
a8979fe
Remove dead icon/state imports left over from the upstream merge
dmfrey Sep 14, 2026
fbe4f5f
Fix unresolved ServerIdMismatchException reference from the merge
dmfrey Sep 14, 2026
c687592
Merge branch 'main' into claude/music-assistant-android-tv-95iu6l
dmfrey Sep 20, 2026
1195e58
Merge remote-tracking branch 'upstream/main' into claude/music-assist…
dmfrey Sep 29, 2026
16576a5
Fix androidTest dependency resolution conflict on the TV branch
dmfrey Sep 29, 2026
e916071
Merge remote-tracking branch 'upstream/main' into claude/music-assist…
dmfrey Oct 19, 2026
43fbea4
Add Android TV Watch Next / Continue Listening row
dmfrey Oct 19, 2026
04e988e
Merge remote-tracking branch 'upstream/main' into claude/music-assist…
dmfrey Oct 26, 2026
28f44cc
Rework TV local-player settings for the upstream Sendspin redesign
dmfrey Oct 26, 2026
e1dd1c6
Merge remote-tracking branch 'upstream/main' into claude/music-assist…
dmfrey Oct 26, 2026
47fd220
Fix compile errors left by the upstream merge
dmfrey Oct 26, 2026
9be7ccd
Merge remote-tracking branch 'upstream/main' into claude/music-assist…
dmfrey Nov 17, 2026
7d4975d
Fix TV D-pad focus landing invisibly/disconnected in the player bar
dmfrey Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ android {
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 19
versionName = "0.18.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
packaging {
resources {
Expand Down Expand Up @@ -113,11 +114,25 @@ dependencies {
implementation(libs.koin.androidx.compose)
implementation(libs.androidx.media)
implementation(libs.androidx.car.app)
// Android TV Watch Next / continue-row integration (WatchNextManager).
implementation(libs.androidx.tvprovider)
implementation(libs.coil)
implementation(libs.kermit)
debugImplementation(libs.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.test.manifest)

// androidx.car.app (via guava) and androidx.camera pull older transitive versions of
// these three than espresso/androidx.test.ext:junit below require. AGP's consistent
// resolution then locks the androidTest classpath to whatever version the app itself
// resolves, so without this the two disagree and dependency resolution fails outright.
// Constraining the app's own resolution to the newer, compatible versions keeps both
// classpaths consistent instead of pinning the androidTest side down.
constraints {
implementation(libs.androidx.concurrent.futures)
implementation(libs.androidx.concurrent.futures.ktx)
implementation(libs.errorprone.annotations)
}

testImplementation(project(":nav"))
testImplementation(project(":ui-utils"))
testImplementation(project(":sendspin-kmp"))
Expand All @@ -131,6 +146,17 @@ dependencies {
testImplementation(libs.koin.test)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.compose.components.resources)

// Instrumented tests: real device/emulator only, for the class of Window/focus behavior
// Robolectric doesn't simulate (see SelectPlayerDialogDpadLeakTest in androidTest).
androidTestImplementation(libs.junit)
androidTestImplementation(libs.kotlin.test)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.androidx.test.uiautomator)
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
androidTestImplementation(libs.compose.components.resources)
androidTestImplementation(libs.material)
}

@CacheableTask
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
package io.music_assistant.client.ui.compose.common

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.assertIsFocused
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.junit4.v2.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.unit.dp
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import kotlinx.coroutines.delay
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

/**
* Real-hardware coverage for the TV settings row/editor pattern ([TvPreferenceRow],
* [TvTextEditorDialog]): rows are D-pad traversable via explicit `TvFocusFlow` links, selecting a
* row opens the full-window editor dialog, Done commits the typed value back to the row while
* Cancel discards it, and focus returns to the row that opened the editor.
*
* Mounts the real production composables and drives real DPAD key events via `UiDevice`, the same
* mechanism as the config-screen tests and as `adb shell input keyevent`.
*/
@RunWith(AndroidJUnit4::class)
class TvPreferenceRowDialogTest {
@get:Rule
val composeTestRule = createComposeRule()

@Test
fun rowsNavigateAndEditorCommitReturnsFocus() {
val valueA = mutableStateOf("original")
val editingA = mutableStateOf(false)
val flowHolder = arrayOfNulls<TvFocusFlow>(1)

composeTestRule.setContent {
MaterialTheme {
val flow = rememberTvFocusFlow()
flowHolder[0] = flow
Column(modifier = Modifier.fillMaxSize().padding(16.dp)) {
TvPreferenceRow(
label = "Label A",
value = valueA.value,
onClick = { editingA.value = true },
focusModifier = flow.modifierFor("rowA", rowLinks.getValue("rowA"))
.testTag("RowA"),
)
TvPreferenceRow(
label = "Label B",
value = null,
onClick = {},
focusModifier = flow.modifierFor("rowB", rowLinks.getValue("rowB"))
.testTag("RowB"),
)
}
if (editingA.value) {
TvTextEditorDialog(
title = "Edit A",
initialValue = valueA.value,
onConfirm = {
valueA.value = it
editingA.value = false
},
onDismiss = { editingA.value = false },
)
}
LaunchedEffect(editingA.value) {
if (!editingA.value) {
delay(300)
flow.requestFocus("rowA")
}
}
}
}

composeTestRule.runOnUiThread { flowHolder[0]!!.requestFocus("rowA") }
composeTestRule.waitForFocus("RowA")

val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())

// D-pad traverses the rows through the explicit links.
device.pressDPadDown()
composeTestRule.waitForFocus("RowB")
device.pressDPadUp()
composeTestRule.waitForFocus("RowA")

// Selecting the row opens the editor; the dialog field gets focus (typing proves it).
device.pressDPadCenter()
composeTestRule.waitForIdle()
Thread.sleep(800)
typeInto(device, android.view.KeyEvent.KEYCODE_X)
check(editingA.value) { "CENTER on the row did not open the editor" }

// A focused TextField on this hardware captures D-pad in the system IME layer (the Leanback
// keyboard reopens and consumes the key), so the real TV flow is to press the keyboard's
// Done key. KEYCODE_ENTER triggers the field's ImeAction.Done -> commit.
device.pressKeyCode(android.view.KeyEvent.KEYCODE_ENTER)
composeTestRule.waitForIdle()
Thread.sleep(500)
check(!editingA.value) { "IME Done did not commit" }
check(valueA.value.contains("x")) {
"Done committed a value without the typed char (value='${valueA.value}')"
}

// The settings screen re-lands focus on the row that opened the editor.
composeTestRule.waitForFocus("RowA")
}

@Test
fun cancelDiscardsAndReturnsToRow() {
val valueA = mutableStateOf("original")
val editingA = mutableStateOf(false)
val flowHolder = arrayOfNulls<TvFocusFlow>(1)

composeTestRule.setContent {
MaterialTheme {
val flow = rememberTvFocusFlow()
flowHolder[0] = flow
Column(modifier = Modifier.fillMaxSize().padding(16.dp)) {
TvPreferenceRow(
label = "Label A",
value = valueA.value,
onClick = { editingA.value = true },
focusModifier = flow.modifierFor("rowA", rowLinks.getValue("rowA"))
.testTag("RowA"),
)
TvPreferenceRow(
label = "Label B",
value = null,
onClick = {},
focusModifier = flow.modifierFor("rowB", rowLinks.getValue("rowB"))
.testTag("RowB"),
)
}
if (editingA.value) {
TvTextEditorDialog(
title = "Edit A",
initialValue = valueA.value,
onConfirm = {
valueA.value = it
editingA.value = false
},
onDismiss = { editingA.value = false },
)
}
LaunchedEffect(editingA.value) {
if (!editingA.value) {
delay(300)
flow.requestFocus("rowA")
}
}
}
}

composeTestRule.runOnUiThread { flowHolder[0]!!.requestFocus("rowA") }
composeTestRule.waitForFocus("RowA")

val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())

device.pressDPadCenter()
composeTestRule.waitForIdle()
Thread.sleep(800)
typeInto(device, android.view.KeyEvent.KEYCODE_Y)
check(editingA.value) { "CENTER on the row did not open the editor" }

// Real TV cancel flow: the system BACK key closes the open keyboard first, then a second
// BACK dismisses the dialog without committing.
device.pressBack()
composeTestRule.waitForIdle()
Thread.sleep(500)
device.pressBack()
composeTestRule.waitForIdle()
Thread.sleep(500)
check(!editingA.value) { "BACK did not dismiss the editor" }
check(valueA.value == "original") {
"BACK must discard the edit (value='${valueA.value}')"
}

composeTestRule.waitForFocus("RowA")
}

private fun ComposeTestRule.waitForFocus(tag: String, timeoutMillis: Long = 3000) {
waitUntil(timeoutMillis) {
runCatching { onNodeWithTag(tag).assertIsFocused() }.isSuccess
}
}

private fun typeInto(device: UiDevice, keyCode: Int) {
device.pressKeyCode(keyCode)
composeTestRule.waitForIdle()
Thread.sleep(300)
}

companion object {
private val rowLinks = mapOf(
"rowA" to TvFocusFlow.Links(down = "rowB"),
"rowB" to TvFocusFlow.Links(up = "rowA"),
)
}
}
Loading
Loading