Merge "Add API constraints to ScheduledJobStateChanged atom" into rvc-dev am: 13ecf63ba4
Change-Id: Ie13dc4c1ec8b281328ba45df668349a8ae930c94
This commit is contained in:
@@ -1074,7 +1074,15 @@ public class JobSchedulerService extends com.android.server.SystemService
|
||||
uId, null, jobStatus.getBatteryName(),
|
||||
FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__SCHEDULED,
|
||||
JobProtoEnums.STOP_REASON_CANCELLED, jobStatus.getStandbyBucket(),
|
||||
jobStatus.getJobId());
|
||||
jobStatus.getJobId(),
|
||||
jobStatus.hasChargingConstraint(),
|
||||
jobStatus.hasBatteryNotLowConstraint(),
|
||||
jobStatus.hasStorageNotLowConstraint(),
|
||||
jobStatus.hasTimingDelayConstraint(),
|
||||
jobStatus.hasDeadlineConstraint(),
|
||||
jobStatus.hasIdleConstraint(),
|
||||
jobStatus.hasConnectivityConstraint(),
|
||||
jobStatus.hasContentTriggerConstraint());
|
||||
|
||||
// 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
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.app.job.IJobCallback;
|
||||
import android.app.job.IJobService;
|
||||
import android.app.job.JobInfo;
|
||||
import android.app.job.JobParameters;
|
||||
import android.app.job.JobProtoEnums;
|
||||
import android.app.job.JobWorkItem;
|
||||
import android.app.usage.UsageStatsManagerInternal;
|
||||
import android.content.ComponentName;
|
||||
@@ -45,6 +46,7 @@ import android.util.TimeUtils;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.app.IBatteryStats;
|
||||
import com.android.internal.util.FrameworkStatsLog;
|
||||
import com.android.server.EventLogTags;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.job.controllers.JobStatus;
|
||||
@@ -273,9 +275,20 @@ public final class JobServiceContext implements ServiceConnection {
|
||||
return false;
|
||||
}
|
||||
mJobPackageTracker.noteActive(job);
|
||||
FrameworkStatsLog.write_non_chained(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
|
||||
job.getSourceUid(), null, job.getBatteryName(),
|
||||
FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__STARTED,
|
||||
JobProtoEnums.STOP_REASON_UNKNOWN, job.getStandbyBucket(), job.getJobId(),
|
||||
job.hasChargingConstraint(),
|
||||
job.hasBatteryNotLowConstraint(),
|
||||
job.hasStorageNotLowConstraint(),
|
||||
job.hasTimingDelayConstraint(),
|
||||
job.hasDeadlineConstraint(),
|
||||
job.hasIdleConstraint(),
|
||||
job.hasConnectivityConstraint(),
|
||||
job.hasContentTriggerConstraint());
|
||||
try {
|
||||
mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid(),
|
||||
job.getStandbyBucket(), job.getJobId());
|
||||
mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid());
|
||||
} catch (RemoteException e) {
|
||||
// Whatever.
|
||||
}
|
||||
@@ -779,10 +792,21 @@ public final class JobServiceContext implements ServiceConnection {
|
||||
applyStoppedReasonLocked(reason);
|
||||
completedJob = mRunningJob;
|
||||
mJobPackageTracker.noteInactive(completedJob, mParams.getStopReason(), reason);
|
||||
FrameworkStatsLog.write_non_chained(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
|
||||
completedJob.getSourceUid(), null, completedJob.getBatteryName(),
|
||||
FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__FINISHED,
|
||||
mParams.getStopReason(), completedJob.getStandbyBucket(), completedJob.getJobId(),
|
||||
completedJob.hasChargingConstraint(),
|
||||
completedJob.hasBatteryNotLowConstraint(),
|
||||
completedJob.hasStorageNotLowConstraint(),
|
||||
completedJob.hasTimingDelayConstraint(),
|
||||
completedJob.hasDeadlineConstraint(),
|
||||
completedJob.hasIdleConstraint(),
|
||||
completedJob.hasConnectivityConstraint(),
|
||||
completedJob.hasContentTriggerConstraint());
|
||||
try {
|
||||
mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(),
|
||||
mRunningJob.getSourceUid(), mParams.getStopReason(),
|
||||
mRunningJob.getStandbyBucket(), mRunningJob.getJobId());
|
||||
mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(), mRunningJob.getSourceUid(),
|
||||
mParams.getStopReason());
|
||||
} catch (RemoteException e) {
|
||||
// Whatever.
|
||||
}
|
||||
|
||||
@@ -980,6 +980,17 @@ message ScheduledJobStateChanged {
|
||||
|
||||
// The job id (as assigned by the app).
|
||||
optional int32 job_id = 6;
|
||||
|
||||
// One flag for each of the API constraints defined by Jobscheduler. Does not include implcit
|
||||
// constraints as they are always assumed to be set.
|
||||
optional bool has_charging_constraint = 7;
|
||||
optional bool has_battery_not_low_constraint = 8;
|
||||
optional bool has_storage_not_low_constraint = 9;
|
||||
optional bool has_timing_delay_constraint = 10;
|
||||
optional bool has_deadline_constraint = 11;
|
||||
optional bool has_idle_constraint = 12;
|
||||
optional bool has_connectivity_constraint = 13;
|
||||
optional bool has_content_trigger_constraint = 14;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -71,8 +71,8 @@ interface IBatteryStats {
|
||||
|
||||
void noteSyncStart(String name, int uid);
|
||||
void noteSyncFinish(String name, int uid);
|
||||
void noteJobStart(String name, int uid, int standbyBucket, int jobid);
|
||||
void noteJobFinish(String name, int uid, int stopReason, int standbyBucket, int jobid);
|
||||
void noteJobStart(String name, int uid);
|
||||
void noteJobFinish(String name, int uid, int stopReason);
|
||||
|
||||
void noteStartWakelock(int uid, int pid, String name, String historyName,
|
||||
int type, boolean unimportantForLogging);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.server.am;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.job.JobProtoEnums;
|
||||
import android.bluetooth.BluetoothActivityEnergyInfo;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@@ -468,26 +467,18 @@ public final class BatteryStatsService extends IBatteryStats.Stub
|
||||
}
|
||||
|
||||
/** A scheduled job was started. */
|
||||
public void noteJobStart(String name, int uid, int standbyBucket, int jobid) {
|
||||
public void noteJobStart(String name, int uid) {
|
||||
enforceCallingPermission();
|
||||
synchronized (mStats) {
|
||||
mStats.noteJobStartLocked(name, uid);
|
||||
FrameworkStatsLog.write_non_chained(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
|
||||
uid, null, name,
|
||||
FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__STARTED,
|
||||
JobProtoEnums.STOP_REASON_UNKNOWN, standbyBucket, jobid);
|
||||
}
|
||||
}
|
||||
|
||||
/** A scheduled job was finished. */
|
||||
public void noteJobFinish(String name, int uid, int stopReason, int standbyBucket, int jobid) {
|
||||
public void noteJobFinish(String name, int uid, int stopReason) {
|
||||
enforceCallingPermission();
|
||||
synchronized (mStats) {
|
||||
mStats.noteJobFinishLocked(name, uid, stopReason);
|
||||
FrameworkStatsLog.write_non_chained(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
|
||||
uid, null, name,
|
||||
FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__FINISHED, stopReason,
|
||||
standbyBucket, jobid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user