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