Java Code Examples for android.app.job.JobInfo#getService()
The following examples show how to use
android.app.job.JobInfo#getService() .
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 |
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: VJobSchedulerService.java From container with GNU General Public License v3.0 | 6 votes |
@Override public int schedule(JobInfo job) throws RemoteException { int vuid = VBinder.getCallingUid(); int id = job.getId(); ComponentName service = job.getService(); JobId jobId = new JobId(vuid, service.getPackageName(), id); JobConfig config = mJobStore.get(jobId); if (config == null) { config = new JobConfig(mGlobalJobId++, service.getClassName(), job.getExtras()); mJobStore.put(jobId, config); } else { config.serviceName = service.getClassName(); config.extras = job.getExtras(); } saveJobs(); mirror.android.app.job.JobInfo.jobId.set(job, config.virtualJobId); mirror.android.app.job.JobInfo.service.set(job, mJobProxyComponent); return mScheduler.schedule(job); }