Do not check for BT perm in NSC mode
This commit is contained in:
parent
fd814baa60
commit
b2bd7a7d21
3 changed files with 6 additions and 4 deletions
|
@ -179,7 +179,7 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
@Synchronized fun notifyAboutNewCommand() {
|
@Synchronized fun notifyAboutNewCommand() {
|
||||||
waitForFinishedThread()
|
waitForFinishedThread()
|
||||||
if (thread == null || thread!!.state == Thread.State.TERMINATED) {
|
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()
|
thread!!.start()
|
||||||
aapsLogger.debug(LTag.PUMPQUEUE, "Starting new thread")
|
aapsLogger.debug(LTag.PUMPQUEUE, "Starting new thread")
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
|
||||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||||
|
@ -28,7 +29,8 @@ class QueueThread internal constructor(
|
||||||
private val activePlugin: ActivePlugin,
|
private val activePlugin: ActivePlugin,
|
||||||
private val rh: ResourceHelper,
|
private val rh: ResourceHelper,
|
||||||
private val sp: SP,
|
private val sp: SP,
|
||||||
private val androidPermission: AndroidPermission
|
private val androidPermission: AndroidPermission,
|
||||||
|
private val config: Config
|
||||||
) : Thread() {
|
) : Thread() {
|
||||||
|
|
||||||
private var connectLogged = false
|
private var connectLogged = false
|
||||||
|
@ -50,7 +52,7 @@ class QueueThread internal constructor(
|
||||||
val secondsElapsed = (System.currentTimeMillis() - connectionStartTime) / 1000
|
val secondsElapsed = (System.currentTimeMillis() - connectionStartTime) / 1000
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
// Manifest.permission.BLUETOOTH_CONNECT
|
// 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")) {
|
if (androidPermission.permissionNotGranted(context, "android.permission.BLUETOOTH_CONNECT")) {
|
||||||
aapsLogger.debug(LTag.PUMPQUEUE, "no permission")
|
aapsLogger.debug(LTag.PUMPQUEUE, "no permission")
|
||||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING))
|
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING))
|
||||||
|
|
|
@ -81,7 +81,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
.thenReturn(percentageConstraint)
|
.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")
|
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
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue