/frameworks/base/core/tests/coretests/src/com/android/internal/os/ |
D | BatteryStatsCounterTest.java | 18 import android.os.BatteryStats; 44 assertEquals(0, counter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCounter() 45 assertEquals(0, counter.getCountLocked(BatteryStats.STATS_CURRENT)); in testCounter() 46 assertEquals(0, counter.getCountLocked(BatteryStats.STATS_SINCE_UNPLUGGED)); in testCounter() 54 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCounter() 55 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_CURRENT)); in testCounter() 56 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_SINCE_UNPLUGGED)); in testCounter() 63 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCounter() 64 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_CURRENT)); in testCounter() 65 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_SINCE_UNPLUGGED)); in testCounter() [all …]
|
D | BatteryStatsSamplingTimerTest.java | 18 import android.os.BatteryStats; 41 assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData() 42 assertEquals(10, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData() 46 assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData() 47 assertEquals(10, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData() 51 assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData() 52 assertEquals(10, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData() 67 assertEquals(0, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testEndSampleAndContinueWhenTimeOrCountDecreases() 68 assertEquals(0, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testEndSampleAndContinueWhenTimeOrCountDecreases() 74 assertEquals(0, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testEndSampleAndContinueWhenTimeOrCountDecreases() [all …]
|
D | BatteryStatsStopwatchTimerTest.java | 18 import android.os.BatteryStats; 36 null, BatteryStats.SENSOR, null, timeBase); in testCount() 45 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() 47 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() 49 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() 51 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() 56 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() 64 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() 67 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() 73 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount() [all …]
|
D | BatteryStatsSensorTest.java | 19 import android.os.BatteryStats; 55 BatteryStats.Timer sensorTimer = bi.getUidStats().get(UID).getSensorStats() in testSensorStartStop() 57 BatteryStats.Timer sensorBgTimer = bi.getUidStats().get(UID).getSensorStats() in testSensorStartStop() 60 assertEquals(2, sensorTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop() 62 clocks.realtime * 1000, BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop() 64 assertEquals(1, sensorBgTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop() 66 clocks.realtime * 1000, BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop() 86 BatteryStats.Timer sensorTimer = bi.getUidStats().get(UID).getSensorStats() in testCountingWhileOffBattery() 89 sensorTimer.getTotalTimeLocked(curr, BatteryStats.STATS_SINCE_CHARGED)); in testCountingWhileOffBattery() 90 assertEquals(0, sensorTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCountingWhileOffBattery() [all …]
|
D | BatteryStatsNoteTest.java | 18 import static android.os.BatteryStats.STATS_SINCE_CHARGED; 19 import static android.os.BatteryStats.WAKE_TYPE_PARTIAL; 22 import android.os.BatteryStats; 49 BatteryStats.Counter bgCntr = bi.getUidStats().get(UID).getBluetoothScanResultBgCounter(); in testNoteBluetoothScanResultLocked() 83 … BatteryStats.Timer aggregTimer = bi.getUidStats().get(UID).getAggregatedPartialWakelockTimer(); in testNoteStartWakeLocked()
|
D | BatteryStatsBackgroundStatsTest.java | 18 import static android.os.BatteryStats.STATS_SINCE_CHARGED; 21 import android.os.BatteryStats; 242 BatteryStats.Timer timer = bi.getUidStats().get(UID).getBluetoothScanTimer(); in testAppBluetoothScan() 243 BatteryStats.Timer bgTimer = bi.getUidStats().get(UID).getBluetoothScanBackgroundTimer(); in testAppBluetoothScan() 244 BatteryStats.Timer badTimer = bi.getUidStats().get(UID).getBluetoothUnoptimizedScanTimer(); in testAppBluetoothScan() 245 BatteryStats.Timer badBgTimer = bi.getUidStats().get(UID) in testAppBluetoothScan() 303 final ArrayMap<String, ? extends BatteryStats.Timer> jobs = in testJob() 306 BatteryStats.Timer timer = jobs.valueAt(0); in testJob() 307 BatteryStats.Timer bgTimer = timer.getSubTimer(); in testJob() 364 final ArrayMap<String, ? extends BatteryStats.Timer> syncs = in testSyncs() [all …]
|
D | BatteryStatsDurationTimerTest.java | 18 import android.os.BatteryStats; 40 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testStartStop() 113 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testParceling() 134 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testParceling() 151 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase, fullParcel); in testParceling()
|
D | BatteryStatsTimeBaseTest.java | 22 import android.os.BatteryStats; 283 tb.computeUptime(666, BatteryStats.STATS_SINCE_CHARGED)); in testComputeUptime() 285 tb.computeUptime(666, BatteryStats.STATS_CURRENT)); in testComputeUptime() 287 tb.computeUptime(666, BatteryStats.STATS_SINCE_UNPLUGGED)); in testComputeUptime() 302 tb.computeRealtime(6666, BatteryStats.STATS_SINCE_CHARGED)); in testComputeRealtime() 304 tb.computeRealtime(6666, BatteryStats.STATS_CURRENT)); in testComputeRealtime() 306 tb.computeRealtime(6666, BatteryStats.STATS_SINCE_UNPLUGGED)); in testComputeRealtime()
|
D | BatteryStatsServTest.java | 19 import android.os.BatteryStats; 601 Assert.assertEquals(8085, serv.getLaunches(BatteryStats.STATS_SINCE_CHARGED)); in testGetLaunches() 602 Assert.assertEquals(8085-11118, serv.getLaunches(BatteryStats.STATS_CURRENT)); in testGetLaunches() 603 Assert.assertEquals(8085-17714, serv.getLaunches(BatteryStats.STATS_SINCE_UNPLUGGED)); in testGetLaunches() 638 serv.getStartTime(20000, BatteryStats.STATS_SINCE_CHARGED)); in testGetStartTimeRunning() 640 serv.getStartTime(20000, BatteryStats.STATS_CURRENT)); in testGetStartTimeRunning() 642 serv.getStartTime(20000, BatteryStats.STATS_SINCE_UNPLUGGED)); in testGetStartTimeRunning() 677 serv.getStartTime(20000, BatteryStats.STATS_SINCE_CHARGED)); in testGetStartTimeNotRunning() 679 serv.getStartTime(20000, BatteryStats.STATS_CURRENT)); in testGetStartTimeNotRunning() 681 serv.getStartTime(20000, BatteryStats.STATS_SINCE_UNPLUGGED)); in testGetStartTimeNotRunning() [all …]
|
/frameworks/base/services/core/java/com/android/server/am/ |
D | HealthStatsBatteryStatsWriter.java | 19 import android.os.BatteryStats; 20 import static android.os.BatteryStats.STATS_SINCE_UNPLUGGED; 50 public void writeUid(HealthStatsWriter uidWriter, BatteryStats bs, BatteryStats.Uid uid) { in writeUid() 52 BatteryStats.Timer timer; in writeUid() 53 SparseArray<? extends BatteryStats.Uid.Sensor> sensors; in writeUid() 54 SparseArray<? extends BatteryStats.Uid.Pid> pids; in writeUid() 55 BatteryStats.ControllerActivityCounter controller; in writeUid() 85 for (final Map.Entry<String,? extends BatteryStats.Uid.Wakelock> entry: in writeUid() 88 final BatteryStats.Uid.Wakelock wakelock = entry.getValue(); in writeUid() 91 timer = wakelock.getWakeTime(BatteryStats.WAKE_TYPE_FULL); in writeUid() [all …]
|
/frameworks/base/core/java/com/android/internal/os/ |
D | MobileRadioPowerCalculator.java | 18 import android.os.BatteryStats; 28 private BatteryStats mStats; 38 final long mobileRx = mStats.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_RX_DATA, in getMobilePowerPerPacket() 40 final long mobileTx = mStats.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_TX_DATA, in getMobilePowerPerPacket() 52 public MobileRadioPowerCalculator(PowerProfile profile, BatteryStats stats) { in MobileRadioPowerCalculator() 62 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 65 app.mobileRxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_RX_DATA, in calculateApp() 67 app.mobileTxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_TX_DATA, in calculateApp() 71 app.mobileRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_MOBILE_RX_DATA, in calculateApp() 73 app.mobileTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_MOBILE_TX_DATA, in calculateApp() [all …]
|
D | WifiPowerCalculator.java | 18 import android.os.BatteryStats; 41 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 43 final BatteryStats.ControllerActivityCounter counter = u.getWifiControllerActivity(); in calculateApp() 59 app.wifiRxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp() 61 app.wifiTxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp() 63 app.wifiRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp() 65 app.wifiTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp() 75 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining() 77 final BatteryStats.ControllerActivityCounter counter = stats.getWifiControllerActivity(); in calculateRemaining()
|
D | WakelockPowerCalculator.java | 18 import android.os.BatteryStats; 33 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 36 final ArrayMap<String, ? extends BatteryStats.Uid.Wakelock> wakelockStats = in calculateApp() 40 final BatteryStats.Uid.Wakelock wakelock = wakelockStats.valueAt(i); in calculateApp() 44 BatteryStats.Timer timer = wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL); in calculateApp() 61 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
|
D | WifiPowerEstimator.java | 18 import android.os.BatteryStats; 51 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 53 app.wifiRxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp() 55 app.wifiTxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp() 57 app.wifiRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp() 59 app.wifiTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp() 73 for (int bin = 0; bin < BatteryStats.Uid.NUM_WIFI_BATCHED_SCAN_BINS; bin++) { in calculateApp() 88 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
|
D | SensorPowerCalculator.java | 20 import android.os.BatteryStats; 35 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 38 final SparseArray<? extends BatteryStats.Uid.Sensor> sensorStats = u.getSensorStats(); in calculateApp() 41 final BatteryStats.Uid.Sensor sensor = sensorStats.valueAt(ise); in calculateApp() 43 final BatteryStats.Timer timer = sensor.getSensorTime(); in calculateApp() 46 case BatteryStats.Uid.Sensor.GPS: in calculateApp()
|
D | BluetoothPowerCalculator.java | 18 import android.os.BatteryStats; 37 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 40 final BatteryStats.ControllerActivityCounter counter = u.getBluetoothControllerActivity(); in calculateApp() 59 app.btRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_BT_RX_DATA, statsType); in calculateApp() 60 app.btTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_BT_TX_DATA, statsType); in calculateApp() 67 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining() 69 final BatteryStats.ControllerActivityCounter counter = in calculateRemaining()
|
D | PowerCalculator.java | 18 import android.os.BatteryStats; 34 public abstract void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 47 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
|
D | CameraPowerCalculator.java | 18 import android.os.BatteryStats; 33 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 38 final BatteryStats.Timer timer = u.getCameraTurnedOnTimer(); in calculateApp()
|
D | FlashlightPowerCalculator.java | 18 import android.os.BatteryStats; 31 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 36 final BatteryStats.Timer timer = u.getFlashlightTurnedOnTimer(); in calculateApp()
|
D | MemoryPowerCalculator.java | 3 import android.os.BatteryStats; 25 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 29 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining() 33 LongSparseArray<? extends BatteryStats.Timer> timers = stats.getKernelMemoryStats(); in calculateRemaining()
|
D | BatteryStatsHelper.java | 26 import android.os.BatteryStats; 27 import android.os.BatteryStats.Uid; 69 private static BatteryStats sStatsXfer; 71 private static ArrayMap<File, BatteryStats> sFileXfer = new ArrayMap<>(); 78 private BatteryStats mStats; 105 private int mStatsType = BatteryStats.STATS_SINCE_CHARGED; 149 public static boolean checkHasWifiPowerReporting(BatteryStats stats, PowerProfile profile) { in checkHasWifiPowerReporting() 156 public static boolean checkHasBluetoothPowerReporting(BatteryStats stats, in checkHasBluetoothPowerReporting() 209 public static BatteryStats statsFromFile(Context context, String fname) { in statsFromFile() 212 BatteryStats stats = sFileXfer.get(path); in statsFromFile() [all …]
|
D | CpuPowerCalculator.java | 18 import android.os.BatteryStats; 32 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp() 75 final ArrayMap<String, ? extends BatteryStats.Uid.Proc> processStats = u.getProcessStats(); in calculateApp() 78 final BatteryStats.Uid.Proc ps = processStats.valueAt(i); in calculateApp()
|
/frameworks/opt/net/wifi/service/java/com/android/server/wifi/ |
D | WifiStateTracker.java | 19 import android.os.BatteryStats; 58 int reportState = BatteryStats.WIFI_STATE_OFF; in updateState() 62 reportState = BatteryStats.WIFI_STATE_OFF_SCANNING; in updateState() 65 reportState = BatteryStats.WIFI_STATE_ON_DISCONNECTED; in updateState() 68 reportState = BatteryStats.WIFI_STATE_ON_CONNECTED_STA; in updateState() 71 reportState = BatteryStats.WIFI_STATE_SOFT_AP; in updateState()
|
D | SupplicantStateTracker.java | 24 import android.os.BatteryStats; 189 case DISCONNECTED: supplState = BatteryStats.WIFI_SUPPL_STATE_DISCONNECTED; break; in sendSupplicantStateChangedBroadcast() 191 supplState = BatteryStats.WIFI_SUPPL_STATE_INTERFACE_DISABLED; break; in sendSupplicantStateChangedBroadcast() 192 case INACTIVE: supplState = BatteryStats.WIFI_SUPPL_STATE_INACTIVE; break; in sendSupplicantStateChangedBroadcast() 193 case SCANNING: supplState = BatteryStats.WIFI_SUPPL_STATE_SCANNING; break; in sendSupplicantStateChangedBroadcast() 194 case AUTHENTICATING: supplState = BatteryStats.WIFI_SUPPL_STATE_AUTHENTICATING; break; in sendSupplicantStateChangedBroadcast() 195 case ASSOCIATING: supplState = BatteryStats.WIFI_SUPPL_STATE_ASSOCIATING; break; in sendSupplicantStateChangedBroadcast() 196 case ASSOCIATED: supplState = BatteryStats.WIFI_SUPPL_STATE_ASSOCIATED; break; in sendSupplicantStateChangedBroadcast() 198 supplState = BatteryStats.WIFI_SUPPL_STATE_FOUR_WAY_HANDSHAKE; break; in sendSupplicantStateChangedBroadcast() 199 case GROUP_HANDSHAKE: supplState = BatteryStats.WIFI_SUPPL_STATE_GROUP_HANDSHAKE; break; in sendSupplicantStateChangedBroadcast() [all …]
|
/frameworks/base/packages/SettingsLib/src/com/android/settingslib/ |
D | BatteryInfo.java | 23 import android.os.BatteryStats; 24 import android.os.BatteryStats.HistoryItem; 42 private BatteryStats mStats; 104 new AsyncTask<Void, Void, BatteryStats>() { in getBatteryInfo() 106 protected BatteryStats doInBackground(Void... params) { in getBatteryInfo() 113 protected void onPostExecute(BatteryStats batteryStats) { in getBatteryInfo() 125 BatteryStats stats, long elapsedRealtimeUs) { in getBatteryInfo() 131 BatteryStats stats, long elapsedRealtimeUs, boolean shortString) { in getBatteryInfo() 194 private static void parse(BatteryStats stats, long remainingTimeUs, in parse()
|