Salvador Martinez | 4387bd5 | 2019-02-21 16:16:28 -0800 | [diff] [blame] | 1 | package com.android.systemui.power |
| 2 | |
| 3 | import com.android.systemui.power.PowerUI.NO_ESTIMATE_AVAILABLE |
| 4 | |
| 5 | /** |
| 6 | * A simple data class to snapshot battery state when a particular check for the |
| 7 | * low battery warning is running in the background. |
| 8 | */ |
| 9 | data class BatteryStateSnapshot( |
| 10 | val batteryLevel: Int, |
| 11 | val isPowerSaver: Boolean, |
| 12 | val plugged: Boolean, |
| 13 | val bucket: Int, |
| 14 | val batteryStatus: Int, |
| 15 | val severeLevelThreshold: Int, |
| 16 | val lowLevelThreshold: Int, |
| 17 | val timeRemainingMillis: Long, |
| 18 | val severeThresholdMillis: Long, |
| 19 | val lowThresholdMillis: Long, |
| 20 | val isBasedOnUsage: Boolean |
| 21 | ) { |
| 22 | /** |
| 23 | * Returns whether hybrid warning logic/copy should be used for this snapshot |
| 24 | */ |
| 25 | var isHybrid: Boolean = false |
| 26 | private set |
| 27 | |
| 28 | init { |
| 29 | this.isHybrid = true |
| 30 | } |
| 31 | |
| 32 | constructor( |
| 33 | batteryLevel: Int, |
| 34 | isPowerSaver: Boolean, |
| 35 | plugged: Boolean, |
| 36 | bucket: Int, |
| 37 | batteryStatus: Int, |
| 38 | severeLevelThreshold: Int, |
| 39 | lowLevelThreshold: Int |
| 40 | ) : this( |
| 41 | batteryLevel, |
| 42 | isPowerSaver, |
| 43 | plugged, |
| 44 | bucket, |
| 45 | batteryStatus, |
| 46 | severeLevelThreshold, |
| 47 | lowLevelThreshold, |
| 48 | NO_ESTIMATE_AVAILABLE.toLong(), |
| 49 | NO_ESTIMATE_AVAILABLE.toLong(), |
| 50 | NO_ESTIMATE_AVAILABLE.toLong(), |
| 51 | false |
| 52 | ) { |
| 53 | this.isHybrid = false |
| 54 | } |
| 55 | } |