use of android.app.job.JobScheduler in project muzei by romannurik.
the class ArtworkComplicationJobService method cancelComplicationUpdateJob.
static void cancelComplicationUpdateJob(Context context) {
JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
jobScheduler.cancel(ARTWORK_COMPLICATION_JOB_ID);
if (BuildConfig.DEBUG) {
Log.d(TAG, "Job cancelled");
}
// Disable the BOOT_COMPLETED receiver to reduce memory pressure on boot
ComponentName bootReceivedComponentName = new ComponentName(context, ArtworkComplicationBootReceiver.class);
context.getPackageManager().setComponentEnabledSetting(bootReceivedComponentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
use of android.app.job.JobScheduler in project android_frameworks_base by crdroidandroid.
the class NekoService method registerJobIfNeeded.
public static void registerJobIfNeeded(Context context, long intervalMinutes) {
JobScheduler jss = context.getSystemService(JobScheduler.class);
JobInfo info = jss.getPendingJob(JOB_ID);
if (info == null) {
registerJob(context, intervalMinutes);
}
}
use of android.app.job.JobScheduler in project android_frameworks_base by crdroidandroid.
the class NekoService method cancelJob.
public static void cancelJob(Context context) {
JobScheduler jss = context.getSystemService(JobScheduler.class);
Log.v(TAG, "Canceling job");
jss.cancel(JOB_ID);
}
use of android.app.job.JobScheduler in project android_frameworks_base by crdroidandroid.
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(TimeUnit.DAYS.toMillis(1)).build());
if (DEBUG_DEXOPT) {
Log.i(TAG, "Jobs scheduled");
}
}
use of android.app.job.JobScheduler in project android_frameworks_base by crdroidandroid.
the class TestJobService method scheduleJob.
/** Send job to the JobScheduler. */
public void scheduleJob(JobInfo job) {
Log.d(TAG, "Scheduling job " + job);
JobScheduler tm = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
tm.schedule(job);
}
Aggregations