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

Commit ba659b93 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Add Standby Bucket and job duration to ScheduledJobStateChanged...

Merge "Merge "Add Standby Bucket and job duration to ScheduledJobStateChanged atom." into qt-dev am: ffc81628 am: d40df6b8" into qt-r1-dev-plus-aosp
parents a6185a06 004fb7ca
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -750,6 +750,22 @@ message ScheduledJobStateChanged {
    // This is only applicable when the state is FINISHED.
    // The default value is STOP_REASON_UNKNOWN.
    optional android.app.job.StopReasonEnum stop_reason = 4;

    // The standby bucket of the app that scheduled the job. These match the framework constants
    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
    // already assigned 0.
    enum Bucket {
        UNKNOWN = -1;
        ACTIVE = 0;
        WORKING_SET = 1;
        FREQUENT = 2;
        RARE = 3;
        NEVER = 4;
    }
    optional Bucket standby_bucket = 5 [default = UNKNOWN];

    // The job id (as assigned by the app).
    optional int32 job_id = 6;
}

/**
+2 −2
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ interface IBatteryStats {

    void noteSyncStart(String name, int uid);
    void noteSyncFinish(String name, int uid);
    void noteJobStart(String name, int uid);
    void noteJobFinish(String name, int uid, int stopReason);
    void noteJobStart(String name, int uid, int standbyBucket, int jobid);
    void noteJobFinish(String name, int uid, int stopReason, int standbyBucket, int jobid);

    void noteStartWakelock(int uid, int pid, String name, String historyName,
            int type, boolean unimportantForLogging);
+6 −4
Original line number Diff line number Diff line
@@ -467,23 +467,25 @@ public final class BatteryStatsService extends IBatteryStats.Stub
        }
    }

    public void noteJobStart(String name, int uid) {
    /** A scheduled job was started. */
    public void noteJobStart(String name, int uid, int standbyBucket, int jobid) {
        enforceCallingPermission();
        synchronized (mStats) {
            mStats.noteJobStartLocked(name, uid);
            StatsLog.write_non_chained(StatsLog.SCHEDULED_JOB_STATE_CHANGED, uid, null,
                    name, StatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__STARTED,
                    JobProtoEnums.STOP_REASON_UNKNOWN);
                    JobProtoEnums.STOP_REASON_UNKNOWN, standbyBucket, jobid);
        }
    }

    public void noteJobFinish(String name, int uid, int stopReason) {
    /** A scheduled job was finished. */
    public void noteJobFinish(String name, int uid, int stopReason, int standbyBucket, int jobid) {
        enforceCallingPermission();
        synchronized (mStats) {
            mStats.noteJobFinishLocked(name, uid, stopReason);
            StatsLog.write_non_chained(StatsLog.SCHEDULED_JOB_STATE_CHANGED, uid, null,
                    name, StatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__FINISHED,
                    stopReason);
                    stopReason, standbyBucket, jobid);
        }
    }

+2 −1
Original line number Diff line number Diff line
@@ -1057,7 +1057,8 @@ public class JobSchedulerService extends com.android.server.SystemService
            StatsLog.write_non_chained(StatsLog.SCHEDULED_JOB_STATE_CHANGED,
                    uId, null, jobStatus.getBatteryName(),
                    StatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__SCHEDULED,
                    JobProtoEnums.STOP_REASON_CANCELLED);
                    JobProtoEnums.STOP_REASON_CANCELLED, jobStatus.getStandbyBucket(),
                    jobStatus.getJobId());

            // If the job is immediately ready to run, then we can just immediately
            // put it in the pending list and try to schedule it.  This is especially
+4 −2
Original line number Diff line number Diff line
@@ -265,7 +265,8 @@ public final class JobServiceContext implements ServiceConnection {
            }
            mJobPackageTracker.noteActive(job);
            try {
                mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid());
                mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid(),
                        job.getStandbyBucket(), job.getJobId());
            } catch (RemoteException e) {
                // Whatever.
            }
@@ -774,7 +775,8 @@ public final class JobServiceContext implements ServiceConnection {
        mJobPackageTracker.noteInactive(completedJob, mParams.getStopReason(), reason);
        try {
            mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(),
                    mRunningJob.getSourceUid(), mParams.getStopReason());
                    mRunningJob.getSourceUid(), mParams.getStopReason(),
                    mRunningJob.getStandbyBucket(), mRunningJob.getJobId());
        } catch (RemoteException e) {
            // Whatever.
        }