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