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

Commit 8ce00d59 authored by Ben Murdoch's avatar Ben Murdoch Committed by android-build-merger
Browse files

Merge "Add worksource AAB bucket to WakeupAlarmOccurred WW atom." into qt-dev

am: a2fcdafa

Change-Id: I6394f1d200429cf551d7ab32394b7654bcd2688a
parents 4060eeac a2fcdafa
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -994,6 +994,19 @@ message WakeupAlarmOccurred {

    // Name of source package (for historical reasons, since BatteryStats tracked it).
    optional string package_name = 3;

    // These enum values match the STANDBY_BUCKET_XXX constants defined in UsageStatsManager.java.
    enum Bucket {
        UNKNOWN = 0;
        EXEMPTED = 5;
        ACTIVE = 10;
        WORKING_SET = 20;
        FREQUENT = 30;
        RARE = 40;
        NEVER = 50;
    }
    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
    optional Bucket app_standby_bucket = 4;
}

/**
+31 −6
Original line number Diff line number Diff line
@@ -8457,18 +8457,43 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
        }
        if (DEBUG_POWER) {
            Slog.w(TAG, "noteWakupAlarm[ sourcePkg=" + sourcePkg + ", sourceUid=" + sourceUid
                    + ", workSource=" + workSource + ", tag=" + tag + "]");
        }
        int standbyBucket = 0;
        mBatteryStatsService.noteWakupAlarm(sourcePkg, sourceUid, workSource, tag);
        if (workSource != null) {
            StatsLog.write(StatsLog.WAKEUP_ALARM_OCCURRED, workSource, tag, sourcePkg);
            String workSourcePackage = workSource.getName(0);
            int workSourceUid = workSource.getAttributionUid();
            if (workSourcePackage == null) {
                workSourcePackage = sourcePkg;
                workSourceUid = sourceUid;
            }
            if (mUsageStatsService != null) {
                standbyBucket = mUsageStatsService.getAppStandbyBucket(workSourcePackage,
                        UserHandle.getUserId(workSourceUid), SystemClock.elapsedRealtime());
            }
            StatsLog.write(StatsLog.WAKEUP_ALARM_OCCURRED, workSource, tag, sourcePkg,
                    standbyBucket);
            if (DEBUG_POWER) {
                Slog.w(TAG, "noteWakeupAlarm[ sourcePkg=" + sourcePkg + ", sourceUid=" + sourceUid
                        + ", workSource=" + workSource + ", tag=" + tag + ", standbyBucket="
                        + standbyBucket + " wsName=" + workSourcePackage + ")]");
            }
        } else {
            if (mUsageStatsService != null) {
                standbyBucket = mUsageStatsService.getAppStandbyBucket(sourcePkg,
                        UserHandle.getUserId(sourceUid), SystemClock.elapsedRealtime());
            }
            StatsLog.write_non_chained(StatsLog.WAKEUP_ALARM_OCCURRED, sourceUid, null, tag,
                    sourcePkg);
                    sourcePkg, standbyBucket);
            if (DEBUG_POWER) {
                Slog.w(TAG, "noteWakeupAlarm[ sourcePkg=" + sourcePkg + ", sourceUid=" + sourceUid
                        + ", workSource=" + workSource + ", tag=" + tag + ", standbyBucket="
                        + standbyBucket + "]");
            }
        }
    }
    @Override