Refresh Android.bp, cargo2android.json, TEST_MAPPING.

Test: None
Change-Id: I9f66880ecc0c608a5d609677874f5e5d9c46df16
diff --git a/Android.bp b/Android.bp
index 2fc52d4..8825101 100644
--- a/Android.bp
+++ b/Android.bp
@@ -38,6 +38,8 @@
     name: "libring",
     host_supported: true,
     crate_name: "ring",
+    cargo_env_compat: true,
+    cargo_pkg_version: "0.16.20",
     srcs: ["src/lib.rs"],
     edition: "2018",
     features: [
@@ -66,12 +68,18 @@
     min_sdk_version: "29",
 }
 
-rust_defaults {
-    name: "ring_defaults",
+rust_test {
+    name: "ring_test_src_lib",
+    host_supported: true,
     crate_name: "ring",
+    cargo_env_compat: true,
+    cargo_pkg_version: "0.16.20",
     srcs: ["src/lib.rs"],
     test_suites: ["general-tests"],
     auto_gen_config: true,
+    test_options: {
+        unit_test: true,
+    },
     edition: "2018",
     features: [
         "alloc",
@@ -92,22 +100,11 @@
     ],
 }
 
-rust_test_host {
-    name: "ring_host_test_src_lib",
-    defaults: ["ring_defaults"],
-    test_options: {
-        unit_test: true,
-    },
-}
-
-rust_test {
-    name: "ring_device_test_src_lib",
-    defaults: ["ring_defaults"],
-}
-
 rust_defaults {
-    name: "ring_defaults_ring",
+    name: "ring_test_defaults",
     crate_name: "ring",
+    cargo_env_compat: true,
+    cargo_pkg_version: "0.16.20",
     test_suites: ["general-tests"],
     auto_gen_config: true,
     edition: "2018",
@@ -127,9 +124,10 @@
     ],
 }
 
-rust_test_host {
-    name: "ring_host_test_tests_aead_tests",
-    defaults: ["ring_defaults_ring"],
+rust_test {
+    name: "ring_test_tests_aead_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/aead_tests.rs"],
     test_options: {
         unit_test: true,
@@ -137,14 +135,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_aead_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/aead_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_agreement_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_agreement_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/agreement_tests.rs"],
     test_options: {
         unit_test: true,
@@ -152,14 +145,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_agreement_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/agreement_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_constant_time_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_constant_time_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/constant_time_tests.rs"],
     test_options: {
         unit_test: true,
@@ -167,14 +155,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_constant_time_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/constant_time_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_digest_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_digest_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/digest_tests.rs"],
     test_options: {
         unit_test: true,
@@ -182,14 +165,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_digest_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/digest_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_ecdsa_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_ecdsa_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/ecdsa_tests.rs"],
     test_options: {
         unit_test: true,
@@ -197,14 +175,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_ecdsa_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/ecdsa_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_ed25519_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_ed25519_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/ed25519_tests.rs"],
     test_options: {
         unit_test: true,
@@ -212,14 +185,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_ed25519_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/ed25519_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_hkdf_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_hkdf_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/hkdf_tests.rs"],
     test_options: {
         unit_test: true,
@@ -227,14 +195,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_hkdf_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/hkdf_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_hmac_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_hmac_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/hmac_tests.rs"],
     test_options: {
         unit_test: true,
@@ -242,14 +205,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_hmac_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/hmac_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_pbkdf2_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_pbkdf2_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/pbkdf2_tests.rs"],
     test_options: {
         unit_test: true,
@@ -257,14 +215,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_pbkdf2_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/pbkdf2_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_quic_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_quic_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/quic_tests.rs"],
     test_options: {
         unit_test: true,
@@ -272,14 +225,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_quic_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/quic_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_rand_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_rand_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/rand_tests.rs"],
     test_options: {
         unit_test: true,
@@ -287,14 +235,9 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_rand_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/rand_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_rsa_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_rsa_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/rsa_tests.rs"],
     test_options: {
         unit_test: true,
@@ -302,26 +245,15 @@
 }
 
 rust_test {
-    name: "ring_device_test_tests_rsa_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/rsa_tests.rs"],
-}
-
-rust_test_host {
-    name: "ring_host_test_tests_signature_tests",
-    defaults: ["ring_defaults_ring"],
+    name: "ring_test_tests_signature_tests",
+    defaults: ["ring_test_defaults"],
+    host_supported: true,
     srcs: ["tests/signature_tests.rs"],
     test_options: {
         unit_test: true,
     },
 }
 
-rust_test {
-    name: "ring_device_test_tests_signature_tests",
-    defaults: ["ring_defaults_ring"],
-    srcs: ["tests/signature_tests.rs"],
-}
-
 cc_library_static {
     name: "libring-core",
     host_supported: true,
@@ -437,10 +369,3 @@
     ],
     min_sdk_version: "29",
 }
-
-// dependent_library ["feature_list"]
-//   cc-1.0.69
-//   libc-0.2.98
-//   once_cell-1.8.0 "alloc,race,std"
-//   spin-0.5.2
-//   untrusted-0.7.1
diff --git a/TEST_MAPPING b/TEST_MAPPING
index c08567b..bcbd101 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,5 +1,13 @@
 // Generated by update_crate_tests.py for tests that depend on this crate.
 {
+  "imports": [
+    {
+      "path": "external/rust/crates/quiche"
+    },
+    {
+      "path": "external/rust/crates/webpki"
+    }
+  ],
   "presubmit": [
     {
       "name": "apkdmverity.test"
@@ -20,10 +28,7 @@
       "name": "microdroid_manager_test"
     },
     {
-      "name": "quiche_device_test_src_lib"
-    },
-    {
-      "name": "ring_device_test_src_lib",
+      "name": "ring_test_src_lib",
       "options": [
         {
           "test-timeout": "100000"
@@ -31,16 +36,16 @@
       ]
     },
     {
-      "name": "ring_device_test_tests_aead_tests"
+      "name": "ring_test_tests_aead_tests"
     },
     {
-      "name": "ring_device_test_tests_agreement_tests"
+      "name": "ring_test_tests_agreement_tests"
     },
     {
-      "name": "ring_device_test_tests_constant_time_tests"
+      "name": "ring_test_tests_constant_time_tests"
     },
     {
-      "name": "ring_device_test_tests_digest_tests",
+      "name": "ring_test_tests_digest_tests",
       "options": [
         {
           "test-timeout": "600000"
@@ -48,43 +53,109 @@
       ]
     },
     {
-      "name": "ring_device_test_tests_ecdsa_tests"
+      "name": "ring_test_tests_ecdsa_tests"
     },
     {
-      "name": "ring_device_test_tests_ed25519_tests"
+      "name": "ring_test_tests_ed25519_tests"
     },
     {
-      "name": "ring_device_test_tests_hkdf_tests"
+      "name": "ring_test_tests_hkdf_tests"
     },
     {
-      "name": "ring_device_test_tests_hmac_tests"
+      "name": "ring_test_tests_hmac_tests"
     },
     {
-      "name": "ring_device_test_tests_pbkdf2_tests"
+      "name": "ring_test_tests_pbkdf2_tests"
     },
     {
-      "name": "ring_device_test_tests_quic_tests"
+      "name": "ring_test_tests_quic_tests"
     },
     {
-      "name": "ring_device_test_tests_rand_tests"
+      "name": "ring_test_tests_rand_tests"
     },
     {
-      "name": "ring_device_test_tests_rsa_tests"
+      "name": "ring_test_tests_rsa_tests"
     },
     {
-      "name": "ring_device_test_tests_signature_tests"
+      "name": "ring_test_tests_signature_tests"
     },
     {
       "name": "virtualizationservice_device_test"
+    }
+  ],
+  "presubmit-rust": [
+    {
+      "name": "apkdmverity.test"
     },
     {
-      "name": "webpki_device_test_src_lib"
+      "name": "doh_unit_test"
     },
     {
-      "name": "webpki_device_test_tests_dns_name_tests"
+      "name": "libapkverify.integration_test"
     },
     {
-      "name": "webpki_device_test_tests_integration"
+      "name": "libapkverify.test"
+    },
+    {
+      "name": "libidsig.test"
+    },
+    {
+      "name": "microdroid_manager_test"
+    },
+    {
+      "name": "ring_test_src_lib",
+      "options": [
+        {
+          "test-timeout": "100000"
+        }
+      ]
+    },
+    {
+      "name": "ring_test_tests_aead_tests"
+    },
+    {
+      "name": "ring_test_tests_agreement_tests"
+    },
+    {
+      "name": "ring_test_tests_constant_time_tests"
+    },
+    {
+      "name": "ring_test_tests_digest_tests",
+      "options": [
+        {
+          "test-timeout": "600000"
+        }
+      ]
+    },
+    {
+      "name": "ring_test_tests_ecdsa_tests"
+    },
+    {
+      "name": "ring_test_tests_ed25519_tests"
+    },
+    {
+      "name": "ring_test_tests_hkdf_tests"
+    },
+    {
+      "name": "ring_test_tests_hmac_tests"
+    },
+    {
+      "name": "ring_test_tests_pbkdf2_tests"
+    },
+    {
+      "name": "ring_test_tests_quic_tests"
+    },
+    {
+      "name": "ring_test_tests_rand_tests"
+    },
+    {
+      "name": "ring_test_tests_rsa_tests"
+    },
+    {
+      "name": "ring_test_tests_signature_tests"
+    },
+    {
+      "name": "virtualizationservice_device_test"
     }
   ]
 }
diff --git a/cargo2android.json b/cargo2android.json
index d0fc23b..2809212 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -16,4 +16,4 @@
     "ring-core",
     "ring-test"
   ]
-}
+}
\ No newline at end of file