Methods Summary |
---|
public void | dumpControllerState(java.io.PrintWriter pw)
pw.println("Batt.");
pw.println("Stable power: " + mChargeTracker.isOnStablePower());
synchronized (mTrackedTasks) {
Iterator<JobStatus> it = mTrackedTasks.iterator();
if (it.hasNext()) {
pw.print(String.valueOf(it.next().hashCode()));
}
while (it.hasNext()) {
pw.print("," + String.valueOf(it.next().hashCode()));
}
pw.println();
}
|
public static com.android.server.job.controllers.BatteryController | get(com.android.server.job.JobSchedulerService taskManagerService)
synchronized (sCreationLock) {
if (sController == null) {
sController = new BatteryController(taskManagerService,
taskManagerService.getContext());
}
}
return sController;
|
public static com.android.server.job.controllers.BatteryController | getForTesting(com.android.server.job.StateChangedListener stateChangedListener, android.content.Context context)
return new BatteryController(stateChangedListener, context);
|
public com.android.server.job.controllers.BatteryController$ChargingTracker | getTracker()
return mChargeTracker;
|
private void | maybeReportNewChargingState()
final boolean stablePower = mChargeTracker.isOnStablePower();
if (DEBUG) {
Slog.d(TAG, "maybeReportNewChargingState: " + stablePower);
}
boolean reportChange = false;
synchronized (mTrackedTasks) {
for (JobStatus ts : mTrackedTasks) {
boolean previous = ts.chargingConstraintSatisfied.getAndSet(stablePower);
if (previous != stablePower) {
reportChange = true;
}
}
}
// Let the scheduler know that state has changed. This may or may not result in an
// execution.
if (reportChange) {
mStateChangedListener.onControllerStateChanged();
}
// Also tell the scheduler that any ready jobs should be flushed.
if (stablePower) {
mStateChangedListener.onRunJobNow(null);
}
|
public void | maybeStartTrackingJob(JobStatus taskStatus)
final boolean isOnStablePower = mChargeTracker.isOnStablePower();
if (taskStatus.hasChargingConstraint()) {
synchronized (mTrackedTasks) {
mTrackedTasks.add(taskStatus);
taskStatus.chargingConstraintSatisfied.set(isOnStablePower);
}
}
if (isOnStablePower) {
mChargeTracker.setStableChargingAlarm();
}
|
public void | maybeStopTrackingJob(JobStatus taskStatus)
if (taskStatus.hasChargingConstraint()) {
synchronized (mTrackedTasks) {
mTrackedTasks.remove(taskStatus);
}
}
|