Loading core/java/com/android/internal/os/BatteryStatsImpl.java +6 −4 Original line number Diff line number Diff line Loading @@ -185,7 +185,7 @@ public class BatteryStatsImpl extends BatteryStats { switch (msg.what) { case MSG_UPDATE_WAKELOCKS: synchronized (BatteryStatsImpl.this) { updateCpuTimeLocked(); updateCpuTimeLocked(false /* updateCpuFreqData */); } if (cb != null) { cb.batteryNeedsCpuUpdate(); Loading Loading @@ -3480,7 +3480,7 @@ public class BatteryStatsImpl extends BatteryStats { Slog.d(TAG, "Updating cpu time because screen is now " + (unpluggedScreenOff ? "off" : "on")); } updateCpuTimeLocked(); updateCpuTimeLocked(true /* updateCpuFreqData */); mOnBatteryScreenOffTimeBase.setRunning(unpluggedScreenOff, uptime, realtime); for (int i = 0; i < mUidStats.size(); i++) { mUidStats.valueAt(i).updateOnBatteryScreenOffBgTimeBase(uptime, realtime); Loading Loading @@ -10002,7 +10002,7 @@ public class BatteryStatsImpl extends BatteryStats { * and we are on battery with screen off, we give more of the cpu time to those apps holding * wakelocks. If the screen is on, we just assign the actual cpu time an app used. */ public void updateCpuTimeLocked() { public void updateCpuTimeLocked(boolean updateCpuFreqData) { if (mPowerProfile == null) { return; } Loading Loading @@ -10117,7 +10117,9 @@ public class BatteryStatsImpl extends BatteryStats { } }); if (updateCpuFreqData) { readKernelUidCpuFreqTimesLocked(); } final long elapse = (mClocks.elapsedRealtime() - startTimeMs); if (DEBUG_ENERGY_CPU || (elapse >= 100)) { Loading services/core/java/com/android/server/am/BatteryStatsService.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.am; import static com.android.internal.os.BatteryStatsImpl.ExternalStatsSync.UPDATE_CPU; import android.annotation.Nullable; import android.bluetooth.BluetoothActivityEnergyInfo; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -1549,7 +1551,9 @@ public final class BatteryStatsService extends IBatteryStats.Stub BatteryStats.HistoryItem.EVENT_COLLECT_EXTERNAL_STATS, reason, 0); mStats.updateCpuTimeLocked(); if ((updateFlags & UPDATE_CPU) != 0) { mStats.updateCpuTimeLocked(true /* updateCpuFreqData */); } mStats.updateKernelWakelocksLocked(); mStats.updateKernelMemoryBandwidthLocked(); Loading Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +6 −4 Original line number Diff line number Diff line Loading @@ -185,7 +185,7 @@ public class BatteryStatsImpl extends BatteryStats { switch (msg.what) { case MSG_UPDATE_WAKELOCKS: synchronized (BatteryStatsImpl.this) { updateCpuTimeLocked(); updateCpuTimeLocked(false /* updateCpuFreqData */); } if (cb != null) { cb.batteryNeedsCpuUpdate(); Loading Loading @@ -3480,7 +3480,7 @@ public class BatteryStatsImpl extends BatteryStats { Slog.d(TAG, "Updating cpu time because screen is now " + (unpluggedScreenOff ? "off" : "on")); } updateCpuTimeLocked(); updateCpuTimeLocked(true /* updateCpuFreqData */); mOnBatteryScreenOffTimeBase.setRunning(unpluggedScreenOff, uptime, realtime); for (int i = 0; i < mUidStats.size(); i++) { mUidStats.valueAt(i).updateOnBatteryScreenOffBgTimeBase(uptime, realtime); Loading Loading @@ -10002,7 +10002,7 @@ public class BatteryStatsImpl extends BatteryStats { * and we are on battery with screen off, we give more of the cpu time to those apps holding * wakelocks. If the screen is on, we just assign the actual cpu time an app used. */ public void updateCpuTimeLocked() { public void updateCpuTimeLocked(boolean updateCpuFreqData) { if (mPowerProfile == null) { return; } Loading Loading @@ -10117,7 +10117,9 @@ public class BatteryStatsImpl extends BatteryStats { } }); if (updateCpuFreqData) { readKernelUidCpuFreqTimesLocked(); } final long elapse = (mClocks.elapsedRealtime() - startTimeMs); if (DEBUG_ENERGY_CPU || (elapse >= 100)) { Loading
services/core/java/com/android/server/am/BatteryStatsService.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.am; import static com.android.internal.os.BatteryStatsImpl.ExternalStatsSync.UPDATE_CPU; import android.annotation.Nullable; import android.bluetooth.BluetoothActivityEnergyInfo; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -1549,7 +1551,9 @@ public final class BatteryStatsService extends IBatteryStats.Stub BatteryStats.HistoryItem.EVENT_COLLECT_EXTERNAL_STATS, reason, 0); mStats.updateCpuTimeLocked(); if ((updateFlags & UPDATE_CPU) != 0) { mStats.updateCpuTimeLocked(true /* updateCpuFreqData */); } mStats.updateKernelWakelocksLocked(); mStats.updateKernelMemoryBandwidthLocked(); Loading