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

Commit ce0c10c4 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8625096 from cf0f928a to tm-qpr1-release

Change-Id: Iba168e2b243c9ae94e27b171d596d02bcbf4088d
parents 7edfbe2d cf0f928a
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1777,10 +1777,7 @@ public class JobInfo implements Parcelable {
         * {@link Build.VERSION_CODES#S}, but starting from Android version
         * {@link Build.VERSION_CODES#TIRAMISU}, expedited jobs for the foreground app are
         * guaranteed to be started before {@link JobScheduler#schedule(JobInfo)} returns (assuming
         * all requested constraints are satisfied), similar to foreground services. However, this
         * start guarantee means there is a higher chance of overlapping executions, as noted in
         * {@link JobService}, so be sure to handle that properly if you intend to reschedule the
         * job while it's actively running.
         * all requested constraints are satisfied), similar to foreground services.
         *
         * @see JobInfo#isExpedited()
         */
+1 −3
Original line number Diff line number Diff line
@@ -107,9 +107,7 @@ public abstract class JobScheduler {
    /**
     * Schedule a job to be executed.  Will replace any currently scheduled job with the same
     * ID with the new information in the {@link JobInfo}.  If a job with the given ID is currently
     * running, it will be stopped. Note that in some cases, the newly scheduled job may be started
     * before the previously running job has been fully stopped. See {@link JobService} for
     * additional details.
     * running, it will be stopped.
     *
     * <p class="caution"><strong>Note:</strong> Scheduling a job can have a high cost, even if it's
     * rescheduling the same job and the job didn't execute, especially on platform versions before
+2 −7
Original line number Diff line number Diff line
@@ -32,16 +32,11 @@ import android.os.IBinder;
 * {@link #onStopJob(android.app.job.JobParameters)}, which is meant to inform you that the
 * scheduling requirements are no longer being met.</p>
 *
 * As a subclass of {@link Service}, there will only be one active instance of any JobService
 * <p>As a subclass of {@link Service}, there will only be one active instance of any JobService
 * subclasses, regardless of job ID. This means that if you schedule multiple jobs with different
 * job IDs but using the same JobService class, that JobService may receive multiple calls to
 * {@link #onStartJob(JobParameters)} and {@link #onStopJob(JobParameters)}, with each call being
 * for the separate jobs.
 *
 * <p class="note">Note that if you cancel and reschedule an already executing job,
 * there may be a small period of time where {@link #onStartJob(JobParameters)} has been called for
 * the newly scheduled job instance before {@link #onStopJob(JobParameters)} has been called or
 * fully processed for the old job.</p>
 * for the separate jobs.</p>
 */
public abstract class JobService extends Service {
    private static final String TAG = "JobService";
+2 −1
Original line number Diff line number Diff line
@@ -693,6 +693,7 @@ public class DeviceIdleController extends SystemService
        synchronized (DeviceIdleController.this) {
            if (mStationaryListeners.size() > 0) {
                startMonitoringMotionLocked();
                scheduleMotionTimeoutAlarmLocked();
            }
        }
    };
@@ -3859,7 +3860,7 @@ public class DeviceIdleController extends SystemService
    void handleMotionDetectedLocked(long timeout, String type) {
        if (mStationaryListeners.size() > 0) {
            postStationaryStatusUpdated();
            scheduleMotionTimeoutAlarmLocked();
            cancelMotionTimeoutAlarmLocked();
            // We need to re-register the motion listener, but we don't want the sensors to be
            // constantly active or to churn the CPU by registering too early, register after some
            // delay.
+7 −25
Original line number Diff line number Diff line
@@ -717,17 +717,9 @@ class JobConcurrencyManager {

            final boolean isTopEj = nextPending.shouldTreatAsExpeditedJob()
                    && nextPending.lastEvaluatedBias == JobInfo.BIAS_TOP_APP;
            // Avoid overlapping job execution as much as possible.
            if (!isTopEj && isSimilarJobRunningLocked(nextPending)) {
                if (DEBUG) {
                    Slog.w(TAG, "Delaying execution of job because of similarly running one: "
                            + nextPending);
                }
                // It would be nice to let the JobService running the other similar job know about
                // this new job so that it doesn't unbind from the JobService and we can call
                // onStartJob as soon as the older job finishes.
                // TODO: optimize the job reschedule flow to reduce service binding churn
                continue;
            if (DEBUG && isSimilarJobRunningLocked(nextPending)) {
                Slog.w(TAG, "Already running similar " + (isTopEj ? "TOP-EJ" : "job")
                        + " to: " + nextPending);
            }

            // Find an available slot for nextPending. The context should be one of the following:
@@ -1206,13 +1198,8 @@ class JobConcurrencyManager {
                    continue;
                }

                // Avoid overlapping job execution as much as possible.
                if (isSimilarJobRunningLocked(nextPending)) {
                    if (DEBUG) {
                        Slog.w(TAG, "Avoiding execution of job because of similarly running one: "
                                + nextPending);
                    }
                    continue;
                if (DEBUG && isSimilarJobRunningLocked(nextPending)) {
                    Slog.w(TAG, "Already running similar job to: " + nextPending);
                }

                if (worker.getPreferredUid() != nextPending.getUid()) {
@@ -1298,13 +1285,8 @@ class JobConcurrencyManager {
                    continue;
                }

                // Avoid overlapping job execution as much as possible.
                if (isSimilarJobRunningLocked(nextPending)) {
                    if (DEBUG) {
                        Slog.w(TAG, "Avoiding execution of job because of similarly running one: "
                                + nextPending);
                    }
                    continue;
                if (DEBUG && isSimilarJobRunningLocked(nextPending)) {
                    Slog.w(TAG, "Already running similar job to: " + nextPending);
                }

                if (isPkgConcurrencyLimitedLocked(nextPending)) {
Loading