Merge "Add shell command to get aconfig flag values." into main
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
index f97100b..7e142a5 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -5365,6 +5365,14 @@
             }
             pw.println();
 
+            pw.println("Aconfig flags:");
+            pw.increaseIndent();
+            pw.print(Flags.FLAG_THROW_ON_UNSUPPORTED_BIAS_USAGE,
+                    Flags.throwOnUnsupportedBiasUsage());
+            pw.println();
+            pw.decreaseIndent();
+            pw.println();
+
             for (int i = mJobRestrictions.size() - 1; i >= 0; i--) {
                 mJobRestrictions.get(i).dumpConstants(pw);
             }
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java
index 293088d..c14efae 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java
@@ -58,6 +58,8 @@
                     return cancelJob(pw);
                 case "monitor-battery":
                     return monitorBattery(pw);
+                case "get-aconfig-flag-state":
+                    return getAconfigFlagState(pw);
                 case "get-battery-seq":
                     return getBatterySeq(pw);
                 case "get-battery-charging":
@@ -336,6 +338,28 @@
         return 0;
     }
 
+    private int getAconfigFlagState(PrintWriter pw) throws Exception {
+        checkPermission("get aconfig flag state");
+
+        final String flagName = getNextArgRequired();
+
+        switch (flagName) {
+            case android.app.job.Flags.FLAG_JOB_DEBUG_INFO_APIS:
+                pw.println(android.app.job.Flags.jobDebugInfoApis());
+                break;
+            case android.app.job.Flags.FLAG_ENFORCE_MINIMUM_TIME_WINDOWS:
+                pw.println(android.app.job.Flags.enforceMinimumTimeWindows());
+                break;
+            case com.android.server.job.Flags.FLAG_THROW_ON_UNSUPPORTED_BIAS_USAGE:
+                pw.println(com.android.server.job.Flags.throwOnUnsupportedBiasUsage());
+                break;
+            default:
+                pw.println("Unknown flag: " + flagName);
+                break;
+        }
+        return 0;
+    }
+
     private int getBatterySeq(PrintWriter pw) {
         int seq = mInternal.getBatterySeq();
         pw.println(seq);
@@ -693,6 +717,9 @@
         pw.println("  monitor-battery [on|off]");
         pw.println("    Control monitoring of all battery changes.  Off by default.  Turning");
         pw.println("    on makes get-battery-seq useful.");
+        pw.println("  get-aconfig-flag-state FULL_FLAG_NAME");
+        pw.println("    Return the state of the specified aconfig flag, if known. The flag name");
+        pw.println("         must be fully qualified.");
         pw.println("  get-battery-seq");
         pw.println("    Return the last battery update sequence number that was received.");
         pw.println("  get-battery-charging");