limit logging
This commit is contained in:
parent
175926527c
commit
51c6237d02
|
@ -28,7 +28,8 @@ class StorageConstraintPlugin @Inject constructor(
|
||||||
aapsLogger: AAPSLogger,
|
aapsLogger: AAPSLogger,
|
||||||
rh: ResourceHelper,
|
rh: ResourceHelper,
|
||||||
private val rxBus: RxBus
|
private val rxBus: RxBus
|
||||||
) : PluginBase(PluginDescription()
|
) : PluginBase(
|
||||||
|
PluginDescription()
|
||||||
.mainType(PluginType.CONSTRAINTS)
|
.mainType(PluginType.CONSTRAINTS)
|
||||||
.neverVisible(true)
|
.neverVisible(true)
|
||||||
.alwaysEnabled(true)
|
.alwaysEnabled(true)
|
||||||
|
@ -37,11 +38,12 @@ class StorageConstraintPlugin @Inject constructor(
|
||||||
aapsLogger, rh, injector
|
aapsLogger, rh, injector
|
||||||
), Constraints {
|
), Constraints {
|
||||||
|
|
||||||
|
@Suppress("ReplaceGetOrSet")
|
||||||
override fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
override fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||||
val diskFree = availableInternalMemorySize()
|
val diskFree = availableInternalMemorySize()
|
||||||
aapsLogger.debug(LTag.CONSTRAINTS, "Internal storage free (Mb):$diskFree")
|
|
||||||
if (diskFree < Constants.MINIMUM_FREE_SPACE) {
|
if (diskFree < Constants.MINIMUM_FREE_SPACE) {
|
||||||
value[aapsLogger, false, rh.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE)] = this
|
aapsLogger.debug(LTag.CONSTRAINTS, "Internal storage free (Mb):$diskFree")
|
||||||
|
value.set(aapsLogger, false, rh.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), this)
|
||||||
val notification = Notification(Notification.DISK_FULL, rh.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), Notification.NORMAL)
|
val notification = Notification(Notification.DISK_FULL, rh.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), Notification.NORMAL)
|
||||||
rxBus.send(EventNewNotification(notification))
|
rxBus.send(EventNewNotification(notification))
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue