diff --git a/CHANGELOG.md b/CHANGELOG.md
index f2e4c8bfa..4d9422ea0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -44,6 +44,7 @@ audio focus was lost
#### Dev/Meta
- Completed migration to reactive playback system
- Refactor music backends into a unified chain of extractors
+- Add bluetooth connection reciever (No functionality in app yet)
## 2.6.3
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 32a1a60ac..7cd215cc8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,10 +8,10 @@
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
= Build.VERSION_CODES.S) {
- val settings = Settings(this)
- if (settings.bluetoothAutoplay) {
- ActivityCompat.requestPermissions(
- this,
- arrayOf(android.Manifest.permission.BLUETOOTH_CONNECT),
- BLUETOOTH_PERMISSION_REQUEST_ID
- )
- }
- }
}
override fun onNewIntent(intent: Intent?) {
@@ -145,6 +133,5 @@ class MainActivity : AppCompatActivity() {
companion object {
private const val KEY_INTENT_USED = BuildConfig.APPLICATION_ID + ".key.FILE_INTENT_USED"
- private const val BLUETOOTH_PERMISSION_REQUEST_ID = 1337 * 42;
}
}
diff --git a/app/src/main/java/org/oxycblt/auxio/playback/system/BluetoothConnectReceiver.kt b/app/src/main/java/org/oxycblt/auxio/playback/system/BluetoothConnectReceiver.kt
deleted file mode 100644
index 0e33563cb..000000000
--- a/app/src/main/java/org/oxycblt/auxio/playback/system/BluetoothConnectReceiver.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.oxycblt.auxio.playback.system
-
-import android.bluetooth.BluetoothProfile
-import android.content.BroadcastReceiver
-import android.content.Context
-import android.content.Intent
-import android.os.Build
-import org.oxycblt.auxio.playback.state.InternalPlayer
-import org.oxycblt.auxio.playback.state.PlaybackStateManager
-import org.oxycblt.auxio.settings.Settings
-
-class BluetoothConnectReceiver : BroadcastReceiver() {
- override fun onReceive(context: Context, intent: Intent) {
- if (intent.action == android.bluetooth.BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED) {
- val newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_DISCONNECTED)
- if (newState == BluetoothProfile.STATE_CONNECTED) {
- val settings = Settings(context)
- if (settings.bluetoothAutoplay) {
- // make sure required services are up and running
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- context.startForegroundService(Intent(context, PlaybackService::class.java))
- } else {
- context.startService(Intent(context, PlaybackService::class.java))
- }
- // start playback
- val playbackManager = PlaybackStateManager.getInstance()
- playbackManager.startAction(InternalPlayer.Action.RestoreState)
- playbackManager.changePlaying(true)
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/oxycblt/auxio/playback/system/BluetoothHeadsetReceiver.kt b/app/src/main/java/org/oxycblt/auxio/playback/system/BluetoothHeadsetReceiver.kt
new file mode 100644
index 000000000..62f877f62
--- /dev/null
+++ b/app/src/main/java/org/oxycblt/auxio/playback/system/BluetoothHeadsetReceiver.kt
@@ -0,0 +1,23 @@
+package org.oxycblt.auxio.playback.system
+
+import android.bluetooth.BluetoothProfile
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+
+/**
+ * A [BroadcastReceiver] that handles connections from bluetooth headsets, starting playback if
+ * they occur.
+ * @author seijikun, OxygenCobalt
+ */
+class BluetoothHeadsetReceiver : BroadcastReceiver() {
+ override fun onReceive(context: Context, intent: Intent) {
+ if (intent.action == android.bluetooth.BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED) {
+ val newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_DISCONNECTED)
+ if (newState == BluetoothProfile.STATE_CONNECTED) {
+ // TODO: Initialize the service (Permission workflow must be figured out)
+ // Perhaps move this to the internal receivers?
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt b/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt
index 234ac159f..d9e9072b2 100644
--- a/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt
+++ b/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt
@@ -230,10 +230,6 @@ class Settings(private val context: Context, private val callback: Callback? = n
val headsetAutoplay: Boolean
get() = inner.getBoolean(context.getString(R.string.set_key_headset_autoplay), false)
- /** Whether a connected bluetooth device should cause Auxio to spawn and start playback */
- val bluetoothAutoplay: Boolean
- get() = inner.getBoolean(context.getString(R.string.set_key_bluetooth_autoplay), false)
-
/** The current ReplayGain configuration */
val replayGainMode: ReplayGainMode
get() =
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index f0a83afbf..67b2ae991 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -49,8 +49,6 @@
Audio
Kopfhörer: automatische Wiedergabe
Beginne die Wiedergabe immer, wenn Kopfhörer verbunden sind (funktioniert nicht auf allen Geräten)
- Bluetooth: automatische Wiedergabe
- Auxio starten und Wiedergabe fortführen, sobald ein Bluetooth Audio fähiges Gerät verbunden wurde
ReplayGain-Strategie
ReplayGain-Prälautverstärkung
Während der Musikwiedergabe, trifft die Prälautverstärkung dem aktuellem Abgleich zu
diff --git a/app/src/main/res/values/settings.xml b/app/src/main/res/values/settings.xml
index dbb927cf6..ddf4e68da 100644
--- a/app/src/main/res/values/settings.xml
+++ b/app/src/main/res/values/settings.xml
@@ -14,7 +14,6 @@
auxio_separators
auxio_headset_autoplay
- auxio_bluetooth_autoplay
auxio_replay_gain
auxio_pre_amp
auxio_pre_amp_with
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0c21f5004..6c31654e1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -186,8 +186,6 @@
Audio
Headset autoplay
Always start playing when a headset is connected (may not work on all devices)
- Bluetooth autoplay
- A connected bluetooth audio device causes Auxio to spawn and start playback
ReplayGain strategy
Prefer track
Prefer album