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

Commit fc15fd31 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure networked UI jobs run during BS & Doze."

parents 0a8a91f7 fe385d6d
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -361,7 +361,14 @@ public final class JobServiceContext implements ServiceConnection {
            boolean binding = false;
            try {
                final int bindFlags;
                if (job.shouldTreatAsExpeditedJob()) {
                if (job.shouldTreatAsUserInitiatedJob()) {
                    // TODO (191785864, 261999509): add an appropriate flag so user-initiated jobs
                    //    can bypass data saver
                    bindFlags = Context.BIND_AUTO_CREATE
                            | Context.BIND_ALMOST_PERCEPTIBLE
                            | Context.BIND_BYPASS_POWER_NETWORK_RESTRICTIONS
                            | Context.BIND_NOT_APP_COMPONENT_USAGE;
                } else if (job.shouldTreatAsExpeditedJob()) {
                    bindFlags = Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
                            | Context.BIND_ALMOST_PERCEPTIBLE
                            | Context.BIND_BYPASS_POWER_NETWORK_RESTRICTIONS
+12 −0
Original line number Diff line number Diff line
@@ -98,6 +98,13 @@ public final class ConnectivityController extends RestrictingController implemen
            ~(ConnectivityManager.BLOCKED_REASON_APP_STANDBY
                    | ConnectivityManager.BLOCKED_REASON_BATTERY_SAVER
                    | ConnectivityManager.BLOCKED_REASON_DOZE);
    // TODO(261999509): allow bypassing data saver & user-restricted. However, when we allow a UI
    //     job to run while data saver restricts the app, we must ensure that we don't run regular
    //     jobs when we put a hole in the data saver wall for the UI job
    private static final int UNBYPASSABLE_UI_BLOCKED_REASONS =
            ~(ConnectivityManager.BLOCKED_REASON_APP_STANDBY
                    | ConnectivityManager.BLOCKED_REASON_BATTERY_SAVER
                    | ConnectivityManager.BLOCKED_REASON_DOZE);
    private static final int UNBYPASSABLE_FOREGROUND_BLOCKED_REASONS =
            ~(ConnectivityManager.BLOCKED_REASON_APP_STANDBY
                    | ConnectivityManager.BLOCKED_REASON_BATTERY_SAVER
@@ -1080,6 +1087,11 @@ public final class ConnectivityController extends RestrictingController implemen
                Slog.d(TAG, "Using FG bypass for " + jobStatus.getSourceUid());
            }
            unbypassableBlockedReasons = UNBYPASSABLE_FOREGROUND_BLOCKED_REASONS;
        } else if (jobStatus.shouldTreatAsUserInitiatedJob()) {
            if (DEBUG) {
                Slog.d(TAG, "Using UI bypass for " + jobStatus.getSourceUid());
            }
            unbypassableBlockedReasons = UNBYPASSABLE_UI_BLOCKED_REASONS;
        } else if (jobStatus.shouldTreatAsExpeditedJob() || jobStatus.startedAsExpeditedJob) {
            if (DEBUG) {
                Slog.d(TAG, "Using EJ bypass for " + jobStatus.getSourceUid());