fix: pause Steam Controller BLE reconnects while the session is suspended (#1312)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-22 12:05:17 +00:00
1 parent aaa2e40def
commit d012a1f5b6
1 file changed
+5
@@ -13,6 +13,7 @@ import android.content.Context
import android.os.Handler
import android.os.HandlerThread
import android.util.Log
import com.droiddeck.launcher.session.SessionState
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.util.ArrayDeque
@@ -51,6 +52,10 @@ class SteamControllerBle(private val context: Context) {
private fun connect() {
if (!running || gatt != null) return
if (SessionState.suspended) {
handler.postDelayed(::connect, RETRY_MS)
return
}
val adapter = (context.getSystemService(Context.BLUETOOTH_SERVICE) as? BluetoothManager)?.adapter
val bonded = runCatching { adapter?.takeIf(BluetoothAdapter::isEnabled)?.bondedDevices }
.onFailure { Log.w(TAG, "paired devices unreadable", it) }