android.app.job.JobService Java Examples

The following examples show how to use android.app.job.JobService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JobSchedulerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void enforceValidJobRequest(int uid, JobInfo job) {
    final IPackageManager pm = AppGlobals.getPackageManager();
    final ComponentName service = job.getService();
    try {
        ServiceInfo si = pm.getServiceInfo(service,
                PackageManager.MATCH_DIRECT_BOOT_AWARE
                        | PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
                UserHandle.getUserId(uid));
        if (si == null) {
            throw new IllegalArgumentException("No such service " + service);
        }
        if (si.applicationInfo.uid != uid) {
            throw new IllegalArgumentException("uid " + uid +
                    " cannot schedule job in " + service.getPackageName());
        }
        if (!JobService.PERMISSION_BIND.equals(si.permission)) {
            throw new IllegalArgumentException("Scheduled service " + service
                    + " does not require android.permission.BIND_JOB_SERVICE permission");
        }
    } catch (RemoteException e) {
        // Can't happen; the Package Manager is in this same process
    }
}
 
Example #2
Source File: DiskStatsLoggingService.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public void setJobService(JobService jobService, JobParameters params) {
    mJobService = jobService;
    mParams = params;
}
 
Example #3
Source File: DownloaderJobService.java    From android-migrate-to-jobs with Apache License 2.0 4 votes vote down vote up
public EventListener(JobService service, JobParameters jobParameters, EventBus bus) {
    this.service = service;
    this.jobParameters = jobParameters;
    this.bus = bus;
}
 
Example #4
Source File: BackgroundDownloadService.java    From shortyz with GNU General Public License v3.0 4 votes vote down vote up
public DownloadTask(JobService jobService) {
    this.jobService = jobService;
}