fix: Address Codex review on auto-monitor-mode

- Seed connectedDevices flow with onStart so ALWAYS autolaunch fires before HEADSET profile binds

- Gate UnavailableMissingPermission classification on Android 12+ (BLUETOOTH_CONNECT only exists from API 31)

- Treat blank/empty profile.address as unpaired (matches AutoConnect)

- Subscribe DeviceSettingsViewModel to nudgeCapabilityStore.availability so UI updates immediately on verdict change

- Seed availability StateFlow with the persisted value via valueBlocking to close the cold-start race
This commit is contained in:
Matthias Urhahn
2026-05-07 14:10:16 +02:00
committed by Matthias Urhahn
parent 1eeeb63a76
commit 0e6848d886
6 changed files with 47 additions and 8 deletions
@@ -85,6 +85,20 @@ class MonitorModeResolverTest : BaseTest() {
resolver.effectiveMode.first() shouldBe MonitorMode.MANUAL
}
@Test
fun `case 4 variant - profile with blank address is treated as unpaired`() = runTest {
profilesFlow.value = listOf(profile(address = "", autoConnect = true))
resolver.effectiveMode.first() shouldBe MonitorMode.MANUAL
}
@Test
fun `case 4 variant - profile with whitespace address is treated as unpaired`() = runTest {
profilesFlow.value = listOf(profile(address = " ", autoConnect = true))
resolver.effectiveMode.first() shouldBe MonitorMode.MANUAL
}
@Test
fun `multi-profile primary-only - primary case 2 + secondary case 3 - AUTOMATIC`() = runTest {
profilesFlow.value = listOf(