Merge "Add API constraints to ScheduledJobStateChanged atom" into rvc-dev am: 13ecf63ba4
Change-Id: I79662e2c07a3de06abc3b70ee4d5d800fe688fe4
This commit is contained in:
@@ -1074,7 +1074,15 @@ public class JobSchedulerService extends com.android.server.SystemService
|
|||||||
uId, null, jobStatus.getBatteryName(),
|
uId, null, jobStatus.getBatteryName(),
|
||||||
FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__SCHEDULED,
|
FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED__STATE__SCHEDULED,
|
||||||
JobProtoEnums.STOP_REASON_CANCELLED, jobStatus.getStandbyBucket(),
|
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
|
// 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
|
// 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.IJobService;
|
||||||
import android.app.job.JobInfo;
|
import android.app.job.JobInfo;
|
||||||
import android.app.job.JobParameters;
|
import android.app.job.JobParameters;
|
||||||
|
import android.app.job.JobProtoEnums;
|
||||||
import android.app.job.JobWorkItem;
|
import android.app.job.JobWorkItem;
|
||||||
import android.app.usage.UsageStatsManagerInternal;
|
import android.app.usage.UsageStatsManagerInternal;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@@ -45,6 +46,7 @@ import android.util.TimeUtils;
|
|||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.app.IBatteryStats;
|
import com.android.internal.app.IBatteryStats;
|
||||||
|
import com.android.internal.util.FrameworkStatsLog;
|
||||||
import com.android.server.EventLogTags;
|
import com.android.server.EventLogTags;
|
||||||
import com.android.server.LocalServices;
|
import com.android.server.LocalServices;
|
||||||
import com.android.server.job.controllers.JobStatus;
|
import com.android.server.job.controllers.JobStatus;
|
||||||
@@ -273,9 +275,20 @@ public final class JobServiceContext implements ServiceConnection {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mJobPackageTracker.noteActive(job);
|
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 {
|
try {
|
||||||
mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid(),
|
mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid());
|
||||||
job.getStandbyBucket(), job.getJobId());
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// Whatever.
|
// Whatever.
|
||||||
}
|
}
|
||||||
@@ -779,10 +792,21 @@ public final class JobServiceContext implements ServiceConnection {
|
|||||||
applyStoppedReasonLocked(reason);
|
applyStoppedReasonLocked(reason);
|
||||||
completedJob = mRunningJob;
|
completedJob = mRunningJob;
|
||||||
mJobPackageTracker.noteInactive(completedJob, mParams.getStopReason(), reason);
|
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 {
|
try {
|
||||||
mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(),
|
mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(), mRunningJob.getSourceUid(),
|
||||||
mRunningJob.getSourceUid(), mParams.getStopReason(),
|
mParams.getStopReason());
|
||||||
mRunningJob.getStandbyBucket(), mRunningJob.getJobId());
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// Whatever.
|
// Whatever.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -980,6 +980,17 @@ message ScheduledJobStateChanged {
|
|||||||
|
|
||||||
// The job id (as assigned by the app).
|
// The job id (as assigned by the app).
|
||||||
optional int32 job_id = 6;
|
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 noteSyncStart(String name, int uid);
|
||||||
void noteSyncFinish(String name, int uid);
|
void noteSyncFinish(String name, int uid);
|
||||||
void noteJobStart(String name, int uid, int standbyBucket, int jobid);
|
void noteJobStart(String name, int uid);
|
||||||
void noteJobFinish(String name, int uid, int stopReason, int standbyBucket, int jobid);
|
void noteJobFinish(String name, int uid, int stopReason);
|
||||||
|
|
||||||
void noteStartWakelock(int uid, int pid, String name, String historyName,
|
void noteStartWakelock(int uid, int pid, String name, String historyName,
|
||||||
int type, boolean unimportantForLogging);
|
int type, boolean unimportantForLogging);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.android.server.am;
|
package com.android.server.am;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.job.JobProtoEnums;
|
|
||||||
import android.bluetooth.BluetoothActivityEnergyInfo;
|
import android.bluetooth.BluetoothActivityEnergyInfo;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -468,26 +467,18 @@ public final class BatteryStatsService extends IBatteryStats.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A scheduled job was started. */
|
/** A scheduled job was started. */
|
||||||
public void noteJobStart(String name, int uid, int standbyBucket, int jobid) {
|
public void noteJobStart(String name, int uid) {
|
||||||
enforceCallingPermission();
|
enforceCallingPermission();
|
||||||
synchronized (mStats) {
|
synchronized (mStats) {
|
||||||
mStats.noteJobStartLocked(name, uid);
|
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. */
|
/** 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();
|
enforceCallingPermission();
|
||||||
synchronized (mStats) {
|
synchronized (mStats) {
|
||||||
mStats.noteJobFinishLocked(name, uid, stopReason);
|
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