Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf1b0b04 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Bugfix: wakeup alarms logging"

parents 3c827555 6f724c4b
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -4028,18 +4028,17 @@ public class BatteryStatsImpl extends BatteryStats {
    public void noteWakupAlarmLocked(String packageName, int uid, WorkSource workSource,
            String tag) {
        if (!isOnBattery()) {
            return;
        }
        if (workSource != null) {
            for (int i = 0; i < workSource.size(); ++i) {
                uid = workSource.get(i);
                final String workSourceName = workSource.getName(i);
                if (isOnBattery()) {
                    BatteryStatsImpl.Uid.Pkg pkg = getPackageStatsLocked(uid,
                            workSourceName != null ? workSourceName : packageName);
                    pkg.noteWakeupAlarmLocked(tag);
                }
                StatsLog.write(StatsLog.WAKEUP_ALARM_OCCURRED, uid, tag);
            }
@@ -4050,16 +4049,20 @@ public class BatteryStatsImpl extends BatteryStats {
                    final WorkChain wc = workChains.get(i);
                    uid = wc.getAttributionUid();
                    if (isOnBattery()) {
                        BatteryStatsImpl.Uid.Pkg pkg = getPackageStatsLocked(uid, packageName);
                        pkg.noteWakeupAlarmLocked(tag);
                    }
                    // TODO(statsd): Log the full attribution chain here once it's available
                    StatsLog.write(StatsLog.WAKEUP_ALARM_OCCURRED, uid, tag);
                }
            }
        } else {
            if (isOnBattery()) {
                BatteryStatsImpl.Uid.Pkg pkg = getPackageStatsLocked(uid, packageName);
                pkg.noteWakeupAlarmLocked(tag);
            }
            StatsLog.write(StatsLog.WAKEUP_ALARM_OCCURRED, uid, tag);
        }
    }