Add Cronet .so and .jar to tethering apex

Also remove cronet apex related modules and files

Bug: 251054736
Test: atest CronetApiTest
Change-Id: Idd41785fd2f74a153c5bb03f4c00c7cccdb50e7a
diff --git a/Cronet/Android.bp b/Cronet/Android.bp
index ec7158c..bd278db 100644
--- a/Cronet/Android.bp
+++ b/Cronet/Android.bp
@@ -20,26 +20,28 @@
     name: "cronet_impl_native_java",
     jars: ["prebuilt/cronet_impl_native_java.jar"],
     visibility: ["//visibility:private"],
-    apex_available: ["com.android.cronet"],
+    apex_available: ["com.android.tethering"],
+    min_sdk_version: "29",
 }
 
 java_import {
     name: "cronet_impl_common_java",
     jars: ["prebuilt/cronet_impl_common_java.jar"],
     visibility: ["//visibility:private"],
-    apex_available: ["com.android.cronet"],
+    apex_available: ["com.android.tethering"],
+    min_sdk_version: "29",
 }
 
 java_import {
     name: "cronet_impl_platform_java",
     jars: ["prebuilt/cronet_impl_platform_java.jar"],
     visibility: ["//visibility:private"],
-    apex_available: ["com.android.cronet"],
+    apex_available: ["com.android.tethering"],
+    min_sdk_version: "29",
 }
 
 cc_prebuilt_library_shared {
     name: "libcronet.80.0.3986.0",
-    // STOPSHIP: Confirm if it is safe
     shared_libs: [
         "libandroid",
         "libc",
@@ -66,7 +68,8 @@
     strip: {
         none: true,
     },
-    apex_available: ["com.android.cronet"],
+    apex_available: ["com.android.tethering"],
+    min_sdk_version: "29",
 }
 
 genrule {
@@ -80,14 +83,10 @@
 
 java_sdk_library {
     name: "org.chromium.net.cronet",
+    defaults: ["framework-module-defaults"],
     srcs: [
         ":cronet_api-src",
     ],
-    // Only public non-hide methods for now.
-    // TODO: Confirm target APIs with Cronet team.
-    api_packages: [
-        "org.chromium.net",
-    ],
     libs: [
         "androidx.annotation_annotation",
     ],
@@ -96,18 +95,9 @@
         "cronet_impl_native_java",
         "cronet_impl_platform_java",
     ],
-    // Add dependencies on files used by droiddoc_options.
-    droiddoc_option_files: [":cronet-api-current.txt"],
-    apex_available: ["com.android.cronet"],
+    apex_available: ["com.android.tethering"],
     unsafe_ignore_missing_latest_api: true,
     dist_group: "android",
-}
-
-// Make the current.txt available for use by the cts/tests/signature tests.
-// ========================================================================
-filegroup {
-    name: "cronet-api-current.txt",
-    srcs: [
-        "api/current.txt",
-    ],
+    // cronet is used as a shared library.
+    shared_library: true,
 }
diff --git a/Cronet/apex/Android.bp b/Cronet/apex/Android.bp
index 2c5b481..4fadfd3 100644
--- a/Cronet/apex/Android.bp
+++ b/Cronet/apex/Android.bp
@@ -38,30 +38,11 @@
     name: "CronetApexDefaultsDisabled",
 }
 
-apex_defaults {
-    name: "com.android.cronet-defaults",
-    compile_multilib: "both",
-    jni_libs: ["libcronet.80.0.3986.0"],
-    java_libs: ["org.chromium.net.cronet"],
-    key: "com.android.cronet.key",
-    certificate: ":com.android.cronet.certificate",
-    updatable: false,
-    generate_hashtree: false,
-
-    // Use a custom AndroidManifest.xml used for API targeting.
-    androidManifest: ":cronet-manifest.xml",
-}
-
-filegroup {
-    name: "cronet-manifest.xml",
-    srcs: [
-        "AndroidManifest.xml",
-    ],
-}
-
+// TODO: Remove cronet apex after com.android.cronet is removed from PRODUCT_PACKAGES
 apex {
     name: "com.android.cronet",
-    defaults: ["com.android.cronet-defaults"],
+    key: "com.android.cronet.key",
+    updatable: false,
     manifest: "manifest.json",
 }
 
@@ -70,8 +51,3 @@
     public_key: "com.android.cronet.avbpubkey",
     private_key: "com.android.cronet.pem",
 }
-
-android_app_certificate {
-     name: "com.android.cronet.certificate",
-     certificate: "com.android.cronet",
-}
diff --git a/Cronet/apex/testing/Android.bp b/Cronet/apex/testing/Android.bp
deleted file mode 100644
index a6859ff..0000000
--- a/Cronet/apex/testing/Android.bp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-apex_test {
-    name: "test_com.android.cronet",
-    visibility: [
-        "//system/apex/tests",
-    ],
-    defaults: ["com.android.cronet-defaults"],
-    manifest: "test_apex_manifest.json",
-    file_contexts: ":com.android.cronet-file_contexts",
-    // Test APEX, should never be installed
-    installable: false,
-}
diff --git a/Cronet/apex/testing/test_apex_manifest.json b/Cronet/apex/testing/test_apex_manifest.json
deleted file mode 100644
index 15aaead..0000000
--- a/Cronet/apex/testing/test_apex_manifest.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-    "name": "com.android.cronet",
-    "version": 300000000
-}
\ No newline at end of file
diff --git a/Cronet/api/module-lib-current.txt b/Cronet/api/module-lib-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/Cronet/api/module-lib-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/Cronet/api/module-lib-removed.txt b/Cronet/api/module-lib-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/Cronet/api/module-lib-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0