mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix: pause Steam Controller BLE reconnects while the session is suspended (#1312)
This commit is contained in:
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) }
|
||||
|
||||
Reference in new issue
Block a user