Log plug state chage & other events at boot

Logs plugged state changed, charging state changed, and battery level to
statsd at boot. These events used to be logged at boot, but the logic
was changed in ag/19715391. This is a partial revert of ag/19715391 to
restore the logic to the old behavior.

Bug: 289301086
Test: manually verified the atoms were logged at boot
Change-Id: Ia5136531ec4fa1014b44bcf2701af543b66bfe45
Merged-In: Ia5136531ec4fa1014b44bcf2701af543b66bfe45
This commit is contained in:
Tej Singh
2023-06-28 23:57:49 -07:00
parent b96e63953f
commit 79f08fb251

View File

@@ -14613,17 +14613,13 @@ public class BatteryStatsImpl extends BatteryStats {
// Inform StatsLog of setBatteryState changes.
private void reportChangesToStatsLog(final int status, final int plugType, final int level) {
if (!mHaveBatteryLevel) {
return;
}
if (mBatteryStatus != status) {
if (!mHaveBatteryLevel || mBatteryStatus != status) {
FrameworkStatsLog.write(FrameworkStatsLog.CHARGING_STATE_CHANGED, status);
}
if (mBatteryPlugType != plugType) {
if (!mHaveBatteryLevel || mBatteryPlugType != plugType) {
FrameworkStatsLog.write(FrameworkStatsLog.PLUGGED_STATE_CHANGED, plugType);
}
if (mBatteryLevel != level) {
if (!mHaveBatteryLevel || mBatteryLevel != level) {
FrameworkStatsLog.write(FrameworkStatsLog.BATTERY_LEVEL_CHANGED, level);
}
}