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

Commit 734cab3e authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Make JS constraints easier to interpret in the logs." into main

parents 9a72bca4 dd1e6e96
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.provider.MediaStore;
import android.text.format.DateFormat;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.DebugUtils;
import android.util.IndentingPrintWriter;
import android.util.Pair;
import android.util.Patterns;
@@ -121,10 +122,10 @@ public final class JobStatus {
    public static final int CONSTRAINT_DEADLINE = 1 << 30;
    public static final int CONSTRAINT_CONNECTIVITY = 1 << 28;
    public static final int CONSTRAINT_CONTENT_TRIGGER = 1 << 26;
    static final int CONSTRAINT_DEVICE_NOT_DOZING = 1 << 25; // Implicit constraint
    static final int CONSTRAINT_WITHIN_QUOTA = 1 << 24;      // Implicit constraint
    static final int CONSTRAINT_PREFETCH = 1 << 23;
    static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1 << 22; // Implicit constraint
    public static final int CONSTRAINT_DEVICE_NOT_DOZING = 1 << 25; // Implicit constraint
    public static final int CONSTRAINT_WITHIN_QUOTA = 1 << 24;      // Implicit constraint
    public static final int CONSTRAINT_PREFETCH = 1 << 23;
    public static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1 << 22; // Implicit constraint
    public static final int CONSTRAINT_FLEXIBLE = 1 << 21; // Implicit constraint

    private static final int IMPLICIT_CONSTRAINTS = 0
@@ -2004,8 +2005,8 @@ public final class JobStatus {
        }
        if (DEBUG) {
            Slog.v(TAG,
                    "Constraint " + constraint + " is " + (!state ? "NOT " : "") + "satisfied for "
                            + toShortString());
                    "Constraint " + constraintsToString(constraint) + " is "
                            + (!state ? "NOT " : "") + "satisfied for " + toShortString());
        }
        final boolean wasReady = !state && isReady();
        satisfiedConstraints = (satisfiedConstraints&~constraint) | (state ? constraint : 0);
@@ -2845,6 +2846,10 @@ public final class JobStatus {
        }
    }

    static String constraintsToString(int constraints) {
        return DebugUtils.flagsToString(JobStatus.class, "CONSTRAINT_", constraints);
    }

    // Dumpsys infrastructure
    @NeverCompile // Avoid size overhead of debugging code.
    public void dump(IndentingPrintWriter pw,  boolean full, long nowElapsed) {
+1 −1
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ public abstract class StateController {
        final boolean jobWouldBeReady = jobStatus.wouldBeReadyWithConstraint(constraint);
        if (DEBUG) {
            Slog.v(TAG, "wouldBeReadyWithConstraintLocked: " + jobStatus.toShortString()
                    + " constraint=" + constraint
                    + " constraint=" + JobStatus.constraintsToString(constraint)
                    + " readyWithConstraint=" + jobWouldBeReady);
        }
        if (!jobWouldBeReady) {