Loading services/core/java/com/android/server/power/stats/BatteryExternalStatsWorker.java +8 −7 Original line number Original line Diff line number Diff line Loading @@ -120,7 +120,7 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat private int mScreenState; private int mScreenState; @GuardedBy("this") @GuardedBy("this") private int[] mPerDisplayScreenStates = null; private int[] mPerDisplayScreenStates; @GuardedBy("this") @GuardedBy("this") private boolean mUseLatestStates = true; private boolean mUseLatestStates = true; Loading Loading @@ -243,6 +243,7 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat } } synchronized (mStats) { synchronized (mStats) { mStats.initEnergyConsumerStatsLocked(supportedStdBuckets, customBucketNames); mStats.initEnergyConsumerStatsLocked(supportedStdBuckets, customBucketNames); mPerDisplayScreenStates = new int[mStats.getDisplayCount()]; } } } } } } Loading Loading @@ -490,6 +491,12 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat onBatteryScreenOff, screenState, displayScreenStates, onBatteryScreenOff, screenState, displayScreenStates, useLatestStates); useLatestStates); } finally { } finally { if ((updateFlags & UPDATE_ALL) == UPDATE_ALL) { synchronized (mStats) { // This helps mStats deal with ignoring data from prior to resets. mStats.informThatAllExternalStatsAreFlushed(); } } if (DEBUG) { if (DEBUG) { Slog.d(TAG, "end updateExternalStatsSync"); Slog.d(TAG, "end updateExternalStatsSync"); } } Loading Loading @@ -767,7 +774,6 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat // WiFi and Modem state are updated without the mStats lock held, because they // WiFi and Modem state are updated without the mStats lock held, because they // do some network stats retrieval before internally grabbing the mStats lock. // do some network stats retrieval before internally grabbing the mStats lock. if (wifiInfo != null) { if (wifiInfo != null) { if (wifiInfo.isValid()) { if (wifiInfo.isValid()) { final long wifiChargeUC = final long wifiChargeUC = Loading @@ -790,11 +796,6 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat mStats.noteModemControllerActivity(modemInfo, mobileRadioChargeUC, elapsedRealtime, mStats.noteModemControllerActivity(modemInfo, mobileRadioChargeUC, elapsedRealtime, uptime, networkStatsManager); uptime, networkStatsManager); } } if ((updateFlags & UPDATE_ALL) == UPDATE_ALL) { // This helps mStats deal with ignoring data from prior to resets. mStats.informThatAllExternalStatsAreFlushed(); } } } /** /** Loading Loading
services/core/java/com/android/server/power/stats/BatteryExternalStatsWorker.java +8 −7 Original line number Original line Diff line number Diff line Loading @@ -120,7 +120,7 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat private int mScreenState; private int mScreenState; @GuardedBy("this") @GuardedBy("this") private int[] mPerDisplayScreenStates = null; private int[] mPerDisplayScreenStates; @GuardedBy("this") @GuardedBy("this") private boolean mUseLatestStates = true; private boolean mUseLatestStates = true; Loading Loading @@ -243,6 +243,7 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat } } synchronized (mStats) { synchronized (mStats) { mStats.initEnergyConsumerStatsLocked(supportedStdBuckets, customBucketNames); mStats.initEnergyConsumerStatsLocked(supportedStdBuckets, customBucketNames); mPerDisplayScreenStates = new int[mStats.getDisplayCount()]; } } } } } } Loading Loading @@ -490,6 +491,12 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat onBatteryScreenOff, screenState, displayScreenStates, onBatteryScreenOff, screenState, displayScreenStates, useLatestStates); useLatestStates); } finally { } finally { if ((updateFlags & UPDATE_ALL) == UPDATE_ALL) { synchronized (mStats) { // This helps mStats deal with ignoring data from prior to resets. mStats.informThatAllExternalStatsAreFlushed(); } } if (DEBUG) { if (DEBUG) { Slog.d(TAG, "end updateExternalStatsSync"); Slog.d(TAG, "end updateExternalStatsSync"); } } Loading Loading @@ -767,7 +774,6 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat // WiFi and Modem state are updated without the mStats lock held, because they // WiFi and Modem state are updated without the mStats lock held, because they // do some network stats retrieval before internally grabbing the mStats lock. // do some network stats retrieval before internally grabbing the mStats lock. if (wifiInfo != null) { if (wifiInfo != null) { if (wifiInfo.isValid()) { if (wifiInfo.isValid()) { final long wifiChargeUC = final long wifiChargeUC = Loading @@ -790,11 +796,6 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat mStats.noteModemControllerActivity(modemInfo, mobileRadioChargeUC, elapsedRealtime, mStats.noteModemControllerActivity(modemInfo, mobileRadioChargeUC, elapsedRealtime, uptime, networkStatsManager); uptime, networkStatsManager); } } if ((updateFlags & UPDATE_ALL) == UPDATE_ALL) { // This helps mStats deal with ignoring data from prior to resets. mStats.informThatAllExternalStatsAreFlushed(); } } } /** /** Loading