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

Commit 4f3efa97 authored by Kweku Adams's avatar Kweku Adams Committed by Android (Google) Code Review
Browse files

Merge "Log job cancellations to statsd."

parents 3772ca49 1177c712
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -1404,8 +1404,31 @@ public class JobSchedulerService extends com.android.server.SystemService
        }
        mChangedJobList.remove(cancelled);
        // Cancel if running.
        mConcurrencyManager.stopJobOnServiceContextLocked(
        final boolean wasRunning = mConcurrencyManager.stopJobOnServiceContextLocked(
                cancelled, reason, internalReasonCode, debugReason);
        // If the job was running, the JobServiceContext should log with state FINISHED.
        if (!wasRunning) {
            FrameworkStatsLog.write_non_chained(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
                    cancelled.getSourceUid(), null, cancelled.getBatteryName(),
                    FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__CANCELLED,
                    internalReasonCode, cancelled.getStandbyBucket(),
                    cancelled.getJobId(),
                    cancelled.hasChargingConstraint(),
                    cancelled.hasBatteryNotLowConstraint(),
                    cancelled.hasStorageNotLowConstraint(),
                    cancelled.hasTimingDelayConstraint(),
                    cancelled.hasDeadlineConstraint(),
                    cancelled.hasIdleConstraint(),
                    cancelled.hasConnectivityConstraint(),
                    cancelled.hasContentTriggerConstraint(),
                    cancelled.isRequestedExpeditedJob(),
                    /* isRunningAsExpeditedJob */ false,
                    reason,
                    cancelled.getJob().isPrefetch(),
                    cancelled.getJob().getPriority(),
                    cancelled.getEffectivePriority(),
                    cancelled.getNumFailures());
        }
        // If this is a replacement, bring in the new version of the job
        if (incomingJob != null) {
            if (DEBUG) Slog.i(TAG, "Tracking replacement job " + incomingJob.toShortString());