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

Commit d30c9c99 authored by Kweku Adams's avatar Kweku Adams Committed by Android (Google) Code Review
Browse files

Merge "Split allowed time by standby bucket."

parents 30498450 86f4c940
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -357,6 +357,9 @@ public class JobSchedulerService extends com.android.server.SystemService
    // Putting RESTRICTED_INDEX after NEVER_INDEX to make it easier for proto dumping
    // (ScheduledJobStateChanged and JobStatusDumpProto).
    public static final int RESTRICTED_INDEX = 5;
    // Putting EXEMPTED_INDEX after RESTRICTED_INDEX to make it easier for proto dumping
    // (ScheduledJobStateChanged and JobStatusDumpProto).
    public static final int EXEMPTED_INDEX = 6;

    private class ConstantsObserver implements DeviceConfig.OnPropertiesChangedListener,
            EconomyManagerInternal.TareStateChangeListener {
@@ -2492,6 +2495,7 @@ public class JobSchedulerService extends com.android.server.SystemService
                    shouldForceBatchJob =
                            mConstants.MIN_READY_NON_ACTIVE_JOBS_COUNT > 1
                                    && job.getEffectiveStandbyBucket() != ACTIVE_INDEX
                                    && job.getEffectiveStandbyBucket() != EXEMPTED_INDEX
                                    && !batchDelayExpired;
                }

@@ -3086,8 +3090,10 @@ public class JobSchedulerService extends com.android.server.SystemService
            return FREQUENT_INDEX;
        } else if (bucket > UsageStatsManager.STANDBY_BUCKET_ACTIVE) {
            return WORKING_INDEX;
        } else {
        } else if (bucket > UsageStatsManager.STANDBY_BUCKET_EXEMPTED) {
            return ACTIVE_INDEX;
        } else {
            return EXEMPTED_INDEX;
        }
    }

+5 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.job.controllers;

import static com.android.server.job.JobSchedulerService.ACTIVE_INDEX;
import static com.android.server.job.JobSchedulerService.EXEMPTED_INDEX;
import static com.android.server.job.JobSchedulerService.NEVER_INDEX;
import static com.android.server.job.JobSchedulerService.RESTRICTED_INDEX;
import static com.android.server.job.JobSchedulerService.WORKING_INDEX;
@@ -844,12 +845,15 @@ public final class JobStatus {
     * exemptions.
     */
    public int getEffectiveStandbyBucket() {
        final int actualBucket = getStandbyBucket();
        if (actualBucket == EXEMPTED_INDEX) {
            return actualBucket;
        }
        if (uidActive || getJob().isExemptedFromAppStandby()) {
            // Treat these cases as if they're in the ACTIVE bucket so that they get throttled
            // like other ACTIVE apps.
            return ACTIVE_INDEX;
        }
        final int actualBucket = getStandbyBucket();
        if (actualBucket != RESTRICTED_INDEX && actualBucket != NEVER_INDEX
                && mHasMediaBackupExemption) {
            // Cap it at WORKING_INDEX as media back up jobs are important to the user, and the
+312 −68

File changed.

Preview size limit exceeded, changes collapsed.

+117 −16

File changed.

Preview size limit exceeded, changes collapsed.