use of android.app.job.JobScheduler in project muzei by romannurik.
the class DirectBootCacheJobService method scheduleDirectBootCacheJob.
static void scheduleDirectBootCacheJob(Context context) {
JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
ComponentName componentName = new ComponentName(context, DirectBootCacheJobService.class);
jobScheduler.schedule(new JobInfo.Builder(DIRECT_BOOT_CACHE_JOB_ID, componentName).addTriggerContentUri(new JobInfo.TriggerContentUri(MuzeiContract.Artwork.CONTENT_URI, JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS)).setTriggerContentUpdateDelay(DIRECT_BOOT_CACHE_DELAY_MILLIS).build());
}
use of android.app.job.JobScheduler in project platform_frameworks_base by android.
the class FullBackupJob method schedule.
public static void schedule(Context ctx, long minDelay) {
JobScheduler js = (JobScheduler) ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE);
JobInfo.Builder builder = new JobInfo.Builder(JOB_ID, sIdleService).setRequiresDeviceIdle(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED).setRequiresCharging(true);
if (minDelay > 0) {
builder.setMinimumLatency(minDelay);
}
js.schedule(builder.build());
}
use of android.app.job.JobScheduler in project platform_frameworks_base by android.
the class KeyValueBackupJob method schedule.
public static void schedule(Context ctx, long delay) {
synchronized (KeyValueBackupJob.class) {
if (!sScheduled) {
if (delay <= 0) {
delay = BATCH_INTERVAL + new Random().nextInt(FUZZ_MILLIS);
}
if (BackupManagerService.DEBUG_SCHEDULING) {
Slog.v(TAG, "Scheduling k/v pass in " + (delay / 1000 / 60) + " minutes");
}
JobScheduler js = (JobScheduler) ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE);
JobInfo.Builder builder = new JobInfo.Builder(JOB_ID, sKeyValueJobService).setMinimumLatency(delay).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY).setRequiresCharging(true).setOverrideDeadline(MAX_DEFERRAL);
js.schedule(builder.build());
sNextScheduled = System.currentTimeMillis() + delay;
sScheduled = true;
}
}
}
use of android.app.job.JobScheduler in project platform_frameworks_base by android.
the class MountServiceIdler method scheduleIdlePass.
/**
* Schedule the idle job that will ping the mount service
*/
public static void scheduleIdlePass(Context context) {
JobScheduler tm = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
Calendar calendar = tomorrowMidnight();
final long timeToMidnight = calendar.getTimeInMillis() - System.currentTimeMillis();
JobInfo.Builder builder = new JobInfo.Builder(MOUNT_JOB_ID, sIdleService);
builder.setRequiresDeviceIdle(true);
builder.setRequiresCharging(true);
builder.setMinimumLatency(timeToMidnight);
tm.schedule(builder.build());
}
use of android.app.job.JobScheduler in project platform_frameworks_base by android.
the class BackgroundDexOptService method schedule.
public static void schedule(Context context) {
JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
// Schedule a one-off job which scans installed packages and updates
// out-of-date oat files.
js.schedule(new JobInfo.Builder(JOB_POST_BOOT_UPDATE, sDexoptServiceName).setMinimumLatency(TimeUnit.MINUTES.toMillis(1)).setOverrideDeadline(TimeUnit.MINUTES.toMillis(1)).build());
// Schedule a daily job which scans installed packages and compiles
// those with fresh profiling data.
js.schedule(new JobInfo.Builder(JOB_IDLE_OPTIMIZE, sDexoptServiceName).setRequiresDeviceIdle(true).setRequiresCharging(true).setPeriodic(IDLE_OPTIMIZATION_PERIOD).build());
if (DEBUG_DEXOPT) {
Log.i(TAG, "Jobs scheduled");
}
}
Aggregations