From 9a1cd52e4e0907aacfc66f9babaa77c3e764ad97 Mon Sep 17 00:00:00 2001 From: georgiyrr <114880874+georgiyrr@users.noreply.github.com> Date: Sun, 27 Sep 2026 15:20:12 +0200 Subject: [PATCH] Reconnect cluster map changes over the current link The cluster position choices already reconnect through "Apply and reconnect", so they no longer trigger a second reconnect. The on/off switch now reconnects over the session's own link instead of always forcing wireless, which could move a USB session to Wi-Fi. Co-Authored-By: Claude Opus 5.5 --- .../main/java/com/shilapi/xcertplay/DiPlayActivity.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/shilapi/xcertplay/DiPlayActivity.kt b/common/src/main/java/com/shilapi/xcertplay/DiPlayActivity.kt index 1045bda..ecccf11 100644 --- a/common/src/main/java/com/shilapi/xcertplay/DiPlayActivity.kt +++ b/common/src/main/java/com/shilapi/xcertplay/DiPlayActivity.kt @@ -230,20 +230,18 @@ class DiPlayActivity : ComponentActivity() { "Shows the iPhone's cluster map on the instrument cluster. Choose Small or Full screen navi in the cluster's steering-wheel menu.", AirPlayPersistence.loadClusterMapEnabled(this)) { AirPlayPersistence.saveClusterMapEnabled(this, it) - reconnectForClusterMap(force = true) + reconnectForClusterMap() } val lifts = CarPlayClusterDisplay.liftPresets choice(card, "Car position on cluster map", listOf("Bottom", "Higher · default", "Much higher"), lifts.indexOf(AirPlayPersistence.loadClusterMapLiftPercent(this)).coerceAtLeast(0)) { AirPlayPersistence.saveClusterMapLiftPercent(this, lifts[it]) - reconnectForClusterMap() } val shifts = CarPlayClusterDisplay.shiftPresets choice(card, "Car position across cluster map", listOf("Center", "Left · by 1/12", "Left · by 1/10", "Left · by 1/9 · default", "Left · by 1/8", "Left · by 1/6", "Far left · by 1/3"), shifts.indexOf(AirPlayPersistence.loadClusterMapShiftPercent(this)).coerceAtLeast(0)) { AirPlayPersistence.saveClusterMapShiftPercent(this, shifts[it]) - reconnectForClusterMap() } } } @@ -380,9 +378,10 @@ class DiPlayActivity : ComponentActivity() { } } - // The cluster screen is described at connection time, so a running session reconnects to apply. - private fun reconnectForClusterMap(force: Boolean = false) { - if ((force || AirPlayPersistence.loadClusterMapEnabled(this)) && CarPlayBackgroundSession.hasSession()) connect(true) + // The cluster screen is described at connection time, so a running session reconnects over + // its current link. The position choices need no call: "Apply and reconnect" already does it. + private fun reconnectForClusterMap() { + if (CarPlayBackgroundSession.hasSession()) connect(AirPlayPersistence.loadWirelessEnabled(this)) } private fun applyWirelessLink(mode: WirelessHotspotMode) {