• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 averageTimeToDischargeMillis: Long,
19     val severeThresholdMillis: Long,
20     val lowThresholdMillis: Long,
21     val isBasedOnUsage: Boolean,
22     val isLowWarningEnabled: Boolean
23 ) {
24     /**
25      * Returns whether hybrid warning logic/copy should be used for this snapshot
26      */
27     var isHybrid: Boolean = false
28         private set
29 
30     init {
31         this.isHybrid = true
32     }
33 
34     constructor(
35         batteryLevel: Int,
36         isPowerSaver: Boolean,
37         plugged: Boolean,
38         bucket: Int,
39         batteryStatus: Int,
40         severeLevelThreshold: Int,
41         lowLevelThreshold: Int
42     ) : this(
43             batteryLevel,
44             isPowerSaver,
45             plugged,
46             bucket,
47             batteryStatus,
48             severeLevelThreshold,
49             lowLevelThreshold,
50             NO_ESTIMATE_AVAILABLE.toLong(),
51             NO_ESTIMATE_AVAILABLE.toLong(),
52             NO_ESTIMATE_AVAILABLE.toLong(),
53             NO_ESTIMATE_AVAILABLE.toLong(),
54             false,
55             true
56     ) {
57         this.isHybrid = false
58     }
59 }
60