Merge "AdbDebuggingManager: simplify JNI, add missing error checks." into main
diff --git a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
index e649485..e82df12 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
@@ -41,10 +41,10 @@
             ]
         },
         {
-            "name": "CtsHostsideNetworkTests",
+            "name": "CtsHostsideNetworkPolicyTests",
             "options": [
-                {"include-filter": "com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testMeteredNetworkAccess_expeditedJob"},
-                {"include-filter": "com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testNonMeteredNetworkAccess_expeditedJob"}
+                {"include-filter": "com.android.cts.netpolicy.HostsideRestrictBackgroundNetworkTests#testMeteredNetworkAccess_expeditedJob"},
+                {"include-filter": "com.android.cts.netpolicy.HostsideRestrictBackgroundNetworkTests#testNonMeteredNetworkAccess_expeditedJob"}
             ]
         },
         {
diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java
index b9de93c..7653bdb 100644
--- a/core/java/android/text/format/Formatter.java
+++ b/core/java/android/text/format/Formatter.java
@@ -56,11 +56,18 @@
     public static class BytesResult {
         public final String value;
         public final String units;
+        /**
+         * Content description of the {@link #units}.
+         * See {@link View#setContentDescription(CharSequence)}
+         */
+        public final String unitsContentDescription;
         public final long roundedBytes;
 
-        public BytesResult(String value, String units, long roundedBytes) {
+        public BytesResult(String value, String units, String unitsContentDescription,
+                long roundedBytes) {
             this.value = value;
             this.units = units;
+            this.unitsContentDescription = unitsContentDescription;
             this.roundedBytes = roundedBytes;
         }
     }
@@ -271,20 +278,20 @@
         final Locale locale = res.getConfiguration().getLocales().get(0);
         final NumberFormat numberFormatter = getNumberFormatter(locale, rounded.fractionDigits);
         final String formattedNumber = numberFormatter.format(rounded.value);
-        final String units;
+        // Since ICU does not give us access to the pattern, we need to extract the unit string
+        // from ICU, which we do by taking out the formatted number out of the formatted string
+        // and trimming the result of spaces and controls.
+        final String formattedMeasure = formatMeasureShort(
+                locale, numberFormatter, rounded.value, rounded.units);
+        final String numberRemoved = deleteFirstFromString(formattedMeasure, formattedNumber);
+        String units = SPACES_AND_CONTROLS.trim(numberRemoved).toString();
+        String unitsContentDescription = units;
         if (rounded.units == MeasureUnit.BYTE) {
             // ICU spells out "byte" instead of "B".
             units = getByteSuffixOverride(res);
-        } else {
-            // Since ICU does not give us access to the pattern, we need to extract the unit string
-            // from ICU, which we do by taking out the formatted number out of the formatted string
-            // and trimming the result of spaces and controls.
-            final String formattedMeasure = formatMeasureShort(
-                    locale, numberFormatter, rounded.value, rounded.units);
-            final String numberRemoved = deleteFirstFromString(formattedMeasure, formattedNumber);
-            units = SPACES_AND_CONTROLS.trim(numberRemoved).toString();
         }
-        return new BytesResult(formattedNumber, units, rounded.roundedBytes);
+        return new BytesResult(formattedNumber, units, unitsContentDescription,
+                rounded.roundedBytes);
     }
 
     /**
diff --git a/services/core/java/com/android/server/net/TEST_MAPPING b/services/core/java/com/android/server/net/TEST_MAPPING
index 4fc1a17..ad6b0ca 100644
--- a/services/core/java/com/android/server/net/TEST_MAPPING
+++ b/services/core/java/com/android/server/net/TEST_MAPPING
@@ -1,7 +1,7 @@
 {
   "presubmit-large": [
     {
-      "name": "CtsHostsideNetworkTests",
+      "name": "CtsHostsideNetworkPolicyTests",
       "options": [
         {
           "exclude-annotation": "androidx.test.filters.FlakyTest"
diff --git a/services/core/jni/OWNERS b/services/core/jni/OWNERS
index 586f35b..8de43c4 100644
--- a/services/core/jni/OWNERS
+++ b/services/core/jni/OWNERS
@@ -15,6 +15,7 @@
 per-file com_android_server_SystemClock* = file:/services/core/java/com/android/server/timedetector/OWNERS
 per-file com_android_server_Usb* = file:/services/usb/OWNERS
 per-file com_android_server_Vibrator* = file:/services/core/java/com/android/server/vibrator/OWNERS
+per-file com_android_server_adb_* = file:/services/core/java/com/android/server/adb/OWNERS
 per-file com_android_server_hdmi_* = file:/core/java/android/hardware/hdmi/OWNERS
 per-file com_android_server_lights_* = file:/services/core/java/com/android/server/lights/OWNERS
 per-file com_android_server_location_* = file:/location/java/android/location/OWNERS
diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp
index c333eb7..c6317e4 100644
--- a/services/tests/servicestests/Android.bp
+++ b/services/tests/servicestests/Android.bp
@@ -264,7 +264,7 @@
 test_module_config {
     name: "FrameworksServicesTests_contentprotection",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_filters: ["com.android.server.contentprotection"],
     exclude_annotations: FLAKY_AND_IGNORED,
 }
@@ -272,7 +272,7 @@
 test_module_config {
     name: "FrameworksServicesTests_om",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_filters: ["com.android.server.om."],
     exclude_annotations: FLAKY_AND_IGNORED,
 }
@@ -281,7 +281,7 @@
 test_module_config {
     name: "FrameworksServicesTests_contexthub_presubmit",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_filters: ["com.android.server.location.contexthub."],
     // TODO(ron): are these right, does it run anything?
     include_annotations: ["android.platform.test.annotations.Presubmit"],
@@ -291,7 +291,7 @@
 test_module_config {
     name: "FrameworksServicesTests_contexthub_postsubmit",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_filters: ["com.android.server.location.contexthub."],
     // TODO(ron): are these right, does it run anything?
     include_annotations: ["android.platform.test.annotations.Postsubmit"],
@@ -302,7 +302,7 @@
 test_module_config {
     name: "FrameworksServicesTests_contentcapture",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_filters: ["com.android.server.contentcapture"],
     exclude_annotations: FLAKY_AND_IGNORED,
 }
@@ -310,7 +310,7 @@
 test_module_config {
     name: "FrameworksServicesTests_recoverysystem",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_filters: ["com.android.server.recoverysystem."],
     exclude_annotations: ["androidx.test.filters.FlakyTest"],
 }
@@ -319,7 +319,7 @@
 test_module_config {
     name: "FrameworksServicesTests_pm_presubmit",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_annotations: ["android.platform.test.annotations.Presubmit"],
     include_filters: ["com.android.server.pm."],
     exclude_annotations: FLAKY_AND_IGNORED,
@@ -328,7 +328,7 @@
 test_module_config {
     name: "FrameworksServicesTests_pm_postsubmit",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_annotations: ["android.platform.test.annotations.Postsubmit"],
     include_filters: ["com.android.server.pm."],
     exclude_annotations: FLAKY_AND_IGNORED,
@@ -338,6 +338,6 @@
 test_module_config {
     name: "FrameworksServicesTests_os",
     base: "FrameworksServicesTests",
-    test_suites: ["general-tests"],
+    test_suites: ["device-tests"],
     include_filters: ["com.android.server.os."],
 }