Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b2ce4de authored by Varun Shah's avatar Varun Shah Committed by Android (Google) Code Review
Browse files

Merge "Rename RUN_LONG_JOBS to RUN_USER_INITIATED_JOBS."

parents a5ac1c17 dcf49e50
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -169,18 +169,18 @@ public class JobSchedulerImpl extends JobScheduler {
    }

    @Override
    public boolean canRunLongJobs() {
    public boolean canRunUserInitiatedJobs() {
        try {
            return mBinder.canRunLongJobs(mContext.getOpPackageName());
            return mBinder.canRunUserInitiatedJobs(mContext.getOpPackageName());
        } catch (RemoteException e) {
            return false;
        }
    }

    @Override
    public boolean hasRunLongJobsPermission(String packageName, int userId) {
    public boolean hasRunUserInitiatedJobsPermission(String packageName, int userId) {
        try {
            return mBinder.hasRunLongJobsPermission(packageName, userId);
            return mBinder.hasRunUserInitiatedJobsPermission(packageName, userId);
        } catch (RemoteException e) {
            return false;
        }
+2 −2
Original line number Diff line number Diff line
@@ -39,8 +39,8 @@ interface IJobScheduler {
    ParceledListSlice<JobInfo> getAllPendingJobsInNamespace(String namespace);
    JobInfo getPendingJob(String namespace, int jobId);
    int getPendingJobReason(String namespace, int jobId);
    boolean canRunLongJobs(String packageName);
    boolean hasRunLongJobsPermission(String packageName, int userId);
    boolean canRunUserInitiatedJobs(String packageName);
    boolean hasRunUserInitiatedJobsPermission(String packageName, int userId);
    List<JobInfo> getStartedJobs();
    ParceledListSlice getAllJobSnapshots();
    @EnforcePermission(allOf={"MANAGE_ACTIVITY_TASKS", "INTERACT_ACROSS_USERS_FULL"})
+3 −3
Original line number Diff line number Diff line
@@ -1904,8 +1904,8 @@ public class JobInfo implements Parcelable {
         * and allow for rescheduling.
         *
         * <p>
         * If the app doesn't hold the {@link android.Manifest.permission#RUN_LONG_JOBS} permission
         * when scheduling a user-initiated job, JobScheduler will throw a
         * If the app doesn't hold the {@link android.Manifest.permission#RUN_USER_INITIATED_JOBS}
         * permission when scheduling a user-initiated job, JobScheduler will throw a
         * {@link SecurityException}.
         *
         * <p>
@@ -1914,7 +1914,7 @@ public class JobInfo implements Parcelable {
         *
         * @see JobInfo#isUserInitiated()
         */
        @RequiresPermission(android.Manifest.permission.RUN_LONG_JOBS)
        @RequiresPermission(android.Manifest.permission.RUN_USER_INITIATED_JOBS)
        @NonNull
        public Builder setUserInitiated(boolean userInitiated) {
            if (userInitiated) {
+1 −1
Original line number Diff line number Diff line
@@ -424,7 +424,7 @@ public class JobParameters implements Parcelable {
     * {@code true}. This will return {@code false} if the job wasn't requested to run as a
     * user-initiated job, or if it was requested to run as a user-initiated job but the app didn't
     * meet any of the requirements at the time of execution, such as having the
     * {@link android.Manifest.permission#RUN_LONG_JOBS} permission.
     * {@link android.Manifest.permission#RUN_USER_INITIATED_JOBS} permission.
     *
     * @see JobInfo.Builder#setUserInitiated(boolean)
     */
+7 −4
Original line number Diff line number Diff line
@@ -454,20 +454,23 @@ public abstract class JobScheduler {

    /**
     * Returns {@code true} if the calling app currently holds the
     * {@link android.Manifest.permission#RUN_LONG_JOBS} permission, allowing it to run long jobs.
     * {@link android.Manifest.permission#RUN_USER_INITIATED_JOBS} permission, allowing it to run
     * user-initiated jobs.
     */
    public boolean canRunLongJobs() {
    public boolean canRunUserInitiatedJobs() {
        return false;
    }

    /**
     * Returns {@code true} if the app currently holds the
     * {@link android.Manifest.permission#RUN_LONG_JOBS} permission, allowing it to run long jobs.
     * {@link android.Manifest.permission#RUN_USER_INITIATED_JOBS} permission, allowing it to run
     * user-initiated jobs.
     * @hide
     * TODO(255371817): consider exposing this to apps who could call
     * {@link #scheduleAsPackage(JobInfo, String, int, String)}
     */
    public boolean hasRunLongJobsPermission(@NonNull String packageName, @UserIdInt int userId) {
    public boolean hasRunUserInitiatedJobsPermission(@NonNull String packageName,
            @UserIdInt int userId) {
        return false;
    }

Loading