diff options
author | Jeff Sharkey <jsharkey@android.com> | 2016-07-14 20:22:54 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-07-14 20:22:54 +0000 |
commit | 96347802ce6cc38cf357ee63d61ece5a5a40955e (patch) | |
tree | c25007251262cb2517fce226c934215232cbd00a | |
parent | e76abe851c838988ef0b0d6a873ee6af3c65c891 (diff) | |
parent | aa8ae41aa55407659c6494a77076d7ed2317bffe (diff) |
Merge \\"Require permission for FLAG_WILL_BE_FOREGROUND.\\" into nyc-mr1-dev am: 97639a1310
am: aa8ae41aa5
Change-Id: Icfe17015febaa13823bf9c6d35c33a09d39e7462
-rw-r--r-- | core/java/android/app/job/JobInfo.java | 3 | ||||
-rw-r--r-- | services/core/java/com/android/server/job/JobSchedulerService.java | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/app/job/JobInfo.java b/core/java/android/app/job/JobInfo.java index 49f32ab3aa75..2d6b45d9c33d 100644 --- a/core/java/android/app/job/JobInfo.java +++ b/core/java/android/app/job/JobInfo.java @@ -166,6 +166,9 @@ public class JobInfo implements Parcelable { * network restrictions for the requesting app. Note that this flag alone * doesn't actually place your {@link JobService} in the foreground; you * still need to post the notification yourself. + * <p> + * To use this flag, the caller must hold the + * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL} permission. * * @hide */ diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java index 8589de1a1884..8f212db7d90a 100644 --- a/services/core/java/com/android/server/job/JobSchedulerService.java +++ b/services/core/java/com/android/server/job/JobSchedulerService.java @@ -1556,6 +1556,11 @@ public final class JobSchedulerService extends com.android.server.SystemService } } + if ((job.getFlags() & JobInfo.FLAG_WILL_BE_FOREGROUND) != 0) { + getContext().enforceCallingOrSelfPermission( + android.Manifest.permission.CONNECTIVITY_INTERNAL, TAG); + } + long ident = Binder.clearCallingIdentity(); try { return JobSchedulerService.this.schedule(job, uid); |