diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt index fd19aa3e38..5315d15713 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt @@ -179,7 +179,7 @@ class CommandQueueImplementation @Inject constructor( @Synchronized fun notifyAboutNewCommand() { waitForFinishedThread() if (thread == null || thread!!.state == Thread.State.TERMINATED) { - thread = QueueThread(this, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission) + thread = QueueThread(this, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission, config) thread!!.start() aapsLogger.debug(LTag.PUMPQUEUE, "Starting new thread") } else { diff --git a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt index 22f507f1af..5f99519df1 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt @@ -10,6 +10,7 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue +import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning import info.nightscout.androidaps.queue.events.EventQueueChanged @@ -28,7 +29,8 @@ class QueueThread internal constructor( private val activePlugin: ActivePlugin, private val rh: ResourceHelper, private val sp: SP, - private val androidPermission: AndroidPermission + private val androidPermission: AndroidPermission, + private val config: Config ) : Thread() { private var connectLogged = false @@ -50,7 +52,7 @@ class QueueThread internal constructor( val secondsElapsed = (System.currentTimeMillis() - connectionStartTime) / 1000 val pump = activePlugin.activePump // Manifest.permission.BLUETOOTH_CONNECT - if (Build.VERSION.SDK_INT >= /*Build.VERSION_CODES.S*/31) + if (config.PUMPDRIVERS && Build.VERSION.SDK_INT >= /*Build.VERSION_CODES.S*/31) if (androidPermission.permissionNotGranted(context, "android.permission.BLUETOOTH_CONNECT")) { aapsLogger.debug(LTag.PUMPQUEUE, "no permission") rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING)) diff --git a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt index c3a5de70a5..2f41e05e2f 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt @@ -81,7 +81,7 @@ class QueueThreadTest : TestBaseWithProfile() { .thenReturn(percentageConstraint) Mockito.`when`(rh.gs(ArgumentMatchers.eq(R.string.temp_basal_absolute), anyObject(), anyObject())).thenReturn("TEMP BASAL %1\$.2f U/h %2\$d min") - sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission) + sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission, config) } @Test