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

Commit 6c0d3e10 authored by Kweku Adams's avatar Kweku Adams Committed by Simon MacMullen
Browse files

Trace job execution.

Also include the job ID in the battery name so that we can distinguish
between jobs using the same JobService.

Bug: 230864839
Test: N/A
Change-Id: Ia183329ef398b8a8fe9ef246a0f0592cd274a88f
(cherry pick of ag/18972117 and ag/19969125)
parent 56cf35b2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
import android.util.EventLog;
import android.util.IndentingPrintWriter;
@@ -361,6 +362,9 @@ public final class JobServiceContext implements ServiceConnection {
                    job.getJob().getPriority(),
                    job.getEffectivePriority(),
                    job.getNumFailures());
            // Use the context's ID to distinguish traces since there'll only be one job running
            // per context.
            Trace.asyncTraceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, job.getTag(), getId());
            try {
                mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid());
            } catch (RemoteException e) {
@@ -1024,6 +1028,7 @@ public final class JobServiceContext implements ServiceConnection {
                completedJob.getJob().getPriority(),
                completedJob.getEffectivePriority(),
                completedJob.getNumFailures());
        Trace.asyncTraceEnd(Trace.TRACE_TAG_SYSTEM_SERVER, completedJob.getTag(), getId());
        try {
            mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(), mRunningJob.getSourceUid(),
                    internalStopReason);
+1 −1
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ public final class JobStatus {
        this.batteryName = this.sourceTag != null
                ? this.sourceTag + ":" + job.getService().getPackageName()
                : job.getService().flattenToShortString();
        this.tag = "*job*/" + this.batteryName;
        this.tag = "*job*/" + this.batteryName + "#" + job.getId();

        this.earliestRunTimeElapsedMillis = earliestRunTimeElapsedMillis;
        this.latestRunTimeElapsedMillis = latestRunTimeElapsedMillis;