Skip to content

Commit 1152f45

Browse files
committed
remove bleonly mode, use CAPod instead
1 parent 3f582b8 commit 1152f45

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed

android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ import kotlin.io.encoding.ExperimentalEncodingApi
131131
lateinit var serviceConnection: ServiceConnection
132132
lateinit var connectionStatusReceiver: BroadcastReceiver
133133

134-
@ExperimentalHazeMaterialsApi
135134
@ExperimentalMaterial3Api
136135
class MainActivity : ComponentActivity() {
137136
companion object {
@@ -427,7 +426,6 @@ fun Main() {
427426
}
428427
}
429428

430-
@ExperimentalHazeMaterialsApi
431429
@OptIn(ExperimentalPermissionsApi::class, ExperimentalMaterial3Api::class)
432430
@Composable
433431
fun PermissionsScreen(

android/app/src/main/java/me/kavishdevar/librepods/screens/AppSettingsScreen.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,6 @@ fun AppSettingsScreen(navController: NavController) {
173173
mutableStateOf(sharedPreferences.getBoolean("use_alternate_head_tracking_packets", false))
174174
}
175175

176-
val bleOnlyMode = remember {
177-
mutableStateOf(sharedPreferences.getBoolean("ble_only_mode", false))
178-
}
179-
180-
LaunchedEffect(Unit) {
181-
if (!sharedPreferences.contains("ble_only_mode")) {
182-
sharedPreferences.edit { putBoolean("ble_only_mode", false) }
183-
}
184-
}
185-
186176
fun validateHexInput(input: String): Boolean {
187177
val hexPattern = Regex("^[0-9a-fA-F]{32}$")
188178
return hexPattern.matches(input)

android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsService.kt

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
427427

428428
if (!contains("qs_click_behavior")) putString("qs_click_behavior", "cycle")
429429
if (!contains("name")) putString("name", "AirPods")
430-
if (!contains("ble_only_mode")) putBoolean("ble_only_mode", false)
431430

432431
if (!contains("left_single_press_action")) putString(
433432
"left_single_press_action",
@@ -612,7 +611,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
612611
}
613612

614613
Log.d("AirPodsCrossDevice", CrossDevice.isAvailable.toString())
615-
if (!CrossDevice.isAvailable && !config.bleOnlyMode) {
614+
if (!CrossDevice.isAvailable) {
616615
Log.d("AirPodsService", "${config.deviceName} connected")
617616
CoroutineScope(Dispatchers.IO).launch {
618617
connectToSocket(device!!)
@@ -624,12 +623,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
624623
sharedPreferences.edit {
625624
putString("mac_address", macAddress)
626625
}
627-
} else if (config.bleOnlyMode) {
628-
Log.d("AirPodsService", "BLE-only mode: skipping L2CAP connection")
629-
macAddress = device!!.address
630-
sharedPreferences.edit {
631-
putString("mac_address", macAddress)
632-
}
633626
}
634627
} else if (intent?.action == AirPodsNotifications.AIRPODS_DISCONNECTED) {
635628
device = null
@@ -695,7 +688,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
695688
if (profile == BluetoothProfile.A2DP) {
696689
val connectedDevices = proxy.connectedDevices
697690
if (connectedDevices.isNotEmpty()) {
698-
if (!CrossDevice.isAvailable && !config.bleOnlyMode) {
691+
if (!CrossDevice.isAvailable) {
699692
CoroutineScope(Dispatchers.IO).launch {
700693
connectToSocket(device)
701694
}
@@ -704,12 +697,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
704697
sharedPreferences.edit {
705698
putString("mac_address", macAddress)
706699
}
707-
} else if (config.bleOnlyMode) {
708-
Log.d("AirPodsService", "BLE-only mode: skipping L2CAP connection")
709-
macAddress = device.address
710-
sharedPreferences.edit {
711-
putString("mac_address", macAddress)
712-
}
713700
}
714701
this@AirPodsService.sendBroadcast(
715702
Intent(AirPodsNotifications.AIRPODS_CONNECTED)
@@ -1143,7 +1130,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
11431130
conversationalAwarenessVolume = sharedPreferences.getInt("conversational_awareness_volume", 43),
11441131
textColor = sharedPreferences.getLong("textColor", -1L),
11451132
qsClickBehavior = sharedPreferences.getString("qs_click_behavior", "cycle") ?: "cycle",
1146-
bleOnlyMode = sharedPreferences.getBoolean("ble_only_mode", false),
11471133

11481134
// AirPods state-based takeover
11491135
takeoverWhenDisconnected = sharedPreferences.getBoolean("takeover_when_disconnected", true),
@@ -1188,7 +1174,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
11881174
"conversational_awareness_volume" -> config.conversationalAwarenessVolume = preferences.getInt(key, 43)
11891175
"textColor" -> config.textColor = preferences.getLong(key, -1L)
11901176
"qs_click_behavior" -> config.qsClickBehavior = preferences.getString(key, "cycle") ?: "cycle"
1191-
"ble_only_mode" -> config.bleOnlyMode = preferences.getBoolean(key, false)
11921177

11931178
// AirPods state-based takeover
11941179
"takeover_when_disconnected" -> config.takeoverWhenDisconnected = preferences.getBoolean(key, true)
@@ -1686,7 +1671,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
16861671
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
16871672
)
16881673

1689-
if (!::socket.isInitialized && !config.bleOnlyMode) {
1674+
if (!::socket.isInitialized) {
16901675
return
16911676
}
16921677
if (connected && (config.bleOnlyMode || socket.isConnected)) {

0 commit comments

Comments
 (0)