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

Commit 11007fa3 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Work towards issue #26390161: Throttle syncs/jobs when system is low on RAM" into nyc-dev

parents ae262a89 1085ff6e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,9 +46,9 @@ public class JobSchedulerImpl extends JobScheduler {
    }

    @Override
    public int scheduleAsPackage(JobInfo job, String packageName, int userId) {
    public int scheduleAsPackage(JobInfo job, String packageName, int userId, String tag) {
        try {
            return mBinder.scheduleAsPackage(job, packageName, userId);
            return mBinder.scheduleAsPackage(job, packageName, userId, tag);
        } catch (RemoteException e) {
            return JobScheduler.RESULT_FAILURE;
        }
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import android.app.job.JobInfo;
  */
interface IJobScheduler {
    int schedule(in JobInfo job);
    int scheduleAsPackage(in JobInfo job, String packageName, int userId);
    int scheduleAsPackage(in JobInfo job, String packageName, int userId, String tag);
    void cancel(int jobId);
    void cancelAll();
    List<JobInfo> getAllPendingJobs();
+26 −1
Original line number Diff line number Diff line
@@ -83,6 +83,31 @@ public class JobInfo implements Parcelable {
     */
    public static final int DEFAULT_BACKOFF_POLICY = BACKOFF_POLICY_EXPONENTIAL;

    /**
     * Default of {@link #getPriority}.
     * @hide
     */
    public static final int PRIORITY_DEFAULT = 0;

    /**
     * Value of {@link #getPriority} for expedited syncs.
     * @hide
     */
    public static final int PRIORITY_SYNC_EXPEDITED = 10;

    /**
     * Value of {@link #getPriority} for first time initialization syncs.
     * @hide
     */
    public static final int PRIORITY_SYNC_INITIALIZATION = 20;

    /**
     * Value of {@link #getPriority} for the current foreground app (overrides the supplied
     * JobInfo priority if it is smaller).
     * @hide
     */
    public static final int PRIORITY_FOREGROUND_APP = 30;

    private final int jobId;
    private final PersistableBundle extras;
    private final ComponentName service;
@@ -406,7 +431,7 @@ public class JobInfo implements Parcelable {
        private int mJobId;
        private PersistableBundle mExtras = PersistableBundle.EMPTY;
        private ComponentName mJobService;
        private int mPriority;
        private int mPriority = PRIORITY_DEFAULT;
        // Requirements.
        private boolean mRequiresCharging;
        private boolean mRequiresDeviceIdle;
+2 −1
Original line number Diff line number Diff line
@@ -68,10 +68,11 @@ public abstract class JobScheduler {
     * @param packageName The package on behalf of which the job is to be scheduled. This will be
     *                    used to track battery usage and appIdleState.
     * @param userId    User on behalf of whom this job is to be scheduled.
     * @param tag Debugging tag for dumps associated with this job (instead of the service class)
     * @return {@link #RESULT_SUCCESS} or {@link #RESULT_FAILURE}
     * @hide
     */
    public abstract int scheduleAsPackage(JobInfo job, String packageName, int userId);
    public abstract int scheduleAsPackage(JobInfo job, String packageName, int userId, String tag);

    /**
     * Cancel a job that is pending in the JobScheduler.
+1 −1
Original line number Diff line number Diff line
@@ -1319,7 +1319,7 @@ public class SyncManager {
        }

        getJobScheduler().scheduleAsPackage(b.build(), syncOperation.owningPackage,
                syncOperation.target.userId);
                syncOperation.target.userId, "sync");
    }

    /**
Loading