diff options
| author | Bookatz <bookatz@google.com> | 2017-11-28 16:48:14 -0800 |
|---|---|---|
| committer | Adam Bookatz <bookatz@google.com> | 2017-11-30 19:08:26 +0000 |
| commit | ddccf0a94e5ad3673517246997da996e7a54768d (patch) | |
| tree | 077299fd3364c4c0ccde86e43226613697423192 /core/java | |
| parent | ada2f4dcf8b481e9302d2fb597af9cde5f100d26 (diff) | |
Add/fix a few statsd atoms
Adding atoms:
MobileRadioPowerStateChanged
WifiRadioPowerStateChanged
DeviceIdlingModeStateChanged
Made the following other atom changes:
Added tag to WakeupAlarmOccurred
Changed some ints to enums
Removed the obsolete UidWakelockStateChanged
Test: none
Fixes: 69479171
Fixes: 69479176
Fixes: 69479177
Fixes: 69479169
Change-Id: I815c0f896ef050a4bc1fca482fb02ccb8e78f009
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/os/BatteryStatsImpl.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 56d0bb229b80..3d49072ea8e8 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -4389,6 +4389,7 @@ public class BatteryStatsImpl extends BatteryStats { + Integer.toHexString(mHistoryCur.states)); addHistoryRecordLocked(elapsedRealtime, uptime); mMobileRadioPowerState = powerState; + StatsLog.write(StatsLog.MOBILE_RADIO_POWER_STATE_CHANGED, uid, powerState); if (active) { mMobileRadioActiveTimer.startRunningLocked(elapsedRealtime); mMobileRadioActivePerAppTimer.startRunningLocked(elapsedRealtime); @@ -4426,7 +4427,7 @@ public class BatteryStatsImpl extends BatteryStats { } } - public void noteDeviceIdleModeLocked(int mode, String activeReason, int activeUid) { + public void noteDeviceIdleModeLocked(final int mode, String activeReason, int activeUid) { final long elapsedRealtime = mClocks.elapsedRealtime(); final long uptime = mClocks.uptimeMillis(); boolean nowIdling = mode == DEVICE_IDLE_MODE_DEEP; @@ -4445,6 +4446,13 @@ public class BatteryStatsImpl extends BatteryStats { addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_ACTIVE, activeReason, activeUid); } + if (mDeviceIdling != nowIdling || mDeviceLightIdling != nowLightIdling) { + int statsmode; + if (nowIdling) statsmode = DEVICE_IDLE_MODE_DEEP; + else if (nowLightIdling) statsmode = DEVICE_IDLE_MODE_LIGHT; + else statsmode = DEVICE_IDLE_MODE_OFF; + StatsLog.write(StatsLog.DEVICE_IDLING_MODE_STATE_CHANGED, statsmode); + } if (mDeviceIdling != nowIdling) { mDeviceIdling = nowIdling; int stepState = nowIdling ? STEP_LEVEL_MODE_DEVICE_IDLE : 0; @@ -4489,6 +4497,7 @@ public class BatteryStatsImpl extends BatteryStats { mDeviceIdleModeFullTimer.startRunningLocked(elapsedRealtime); } mDeviceIdleMode = mode; + StatsLog.write(StatsLog.DEVICE_IDLE_MODE_STATE_CHANGED, mode); } } @@ -5085,6 +5094,7 @@ public class BatteryStatsImpl extends BatteryStats { + Integer.toHexString(mHistoryCur.states)); addHistoryRecordLocked(elapsedRealtime, uptime); mWifiRadioPowerState = powerState; + StatsLog.write(StatsLog.WIFI_RADIO_POWER_STATE_CHANGED, uid, powerState); } } @@ -8928,8 +8938,6 @@ public class BatteryStatsImpl extends BatteryStats { } if (type == WAKE_TYPE_PARTIAL) { createAggregatedPartialWakelockTimerLocked().startRunningLocked(elapsedRealtimeMs); - // TODO(statsd): Possibly use a worksource instead of a uid. - StatsLog.write(StatsLog.UID_WAKELOCK_STATE_CHANGED, getUid(), type, 1); if (pid >= 0) { Pid p = getPidStatsLocked(pid); if (p.mWakeNesting++ == 0) { @@ -8952,11 +8960,6 @@ public class BatteryStatsImpl extends BatteryStats { if (type == WAKE_TYPE_PARTIAL) { if (mAggregatedPartialWakelockTimer != null) { mAggregatedPartialWakelockTimer.stopRunningLocked(elapsedRealtimeMs); - if (!mAggregatedPartialWakelockTimer.isRunningLocked()) { - // TODO(statsd): Possibly use a worksource instead of a uid. - StatsLog.write(StatsLog.UID_WAKELOCK_STATE_CHANGED, getUid(), type, - 0); - } } if (pid >= 0) { Pid p = mPids.get(pid); |
