Conditionally include VCN in Tethering module

When the build system flag RELEASE_MOVE_VCN_TO_MAINLINE is true,
VCN framework lib will be included in the tethering boot classpath
fragment and the VCN service lib will be included in the
service-connectivity.jar

Bug: 375213246
Test: flag enabled: VCN libs are in the tethering module
      flag disabled: VCN libs are in the platform
Flag: RELEASE_MOVE_VCN_TO_MAINLINE
Change-Id: If0239eb1684b861b63794762915dab0d62379885
This commit is contained in:
Yan Yan 2024-11-02 01:37:17 +00:00
commit b4ccc6aff7
6 changed files with 56 additions and 2 deletions

View file

@ -155,7 +155,10 @@ bootclasspath_fragment {
"framework-connectivity",
"framework-connectivity-t",
"framework-tethering",
],
] + select(release_flag("RELEASE_MOVE_VCN_TO_MAINLINE"), {
true: ["framework-connectivity-b"],
default: [],
}),
apex_available: ["com.android.tethering"],
// The bootclasspath_fragments that provide APIs on which this depends.
@ -195,6 +198,7 @@ bootclasspath_fragment {
"android.net.http",
"android.net.netstats",
"android.net.util",
"android.net.vcn",
],
// The following packages and all their subpackages currently only

View file

@ -102,6 +102,7 @@ filegroup {
java_library {
name: "framework-connectivity-t-pre-jarjar",
defaults: ["framework-connectivity-t-defaults"],
installable: false,
libs: [
"framework-bluetooth.stubs.module_lib",
"framework-wifi.stubs.module_lib",

View file

@ -143,6 +143,7 @@ java_library {
java_library {
name: "framework-connectivity-pre-jarjar",
defaults: ["framework-module-defaults"],
installable: false,
min_sdk_version: "30",
static_libs: [
"framework-connectivity-pre-jarjar-without-cronet",

40
service-b/Android.bp Normal file
View file

@ -0,0 +1,40 @@
//
// Copyright (C) 2024 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_team: "trendy_team_enigma",
default_applicable_licenses: ["Android-Apache-2.0"],
}
// TODO: b/380331248 This lib is a non-jarjared version of "service-connectivity-b-platform"
// It will only be included in the Tethering module when the build system flag
// RELEASE_MOVE_VCN_TO_MAINLINE is enabled. Including "service-connectivity-b-platform"
// in Tethering will break art branch check because that lib lives in framework/base.
// Once VCN is moved to Connectivity/, "service-connectivity-b-platform" can be cleaned up.
java_library {
name: "service-connectivity-b-pre-jarjar",
defaults: ["service-connectivity-b-pre-jarjar-defaults"],
libs: ["service-connectivity-pre-jarjar"],
sdk_version: "system_server_current",
// TODO(b/210962470): Bump this to B
min_sdk_version: "30",
apex_available: [
"com.android.tethering",
],
}

View file

@ -207,6 +207,7 @@ java_library {
},
visibility: [
"//packages/modules/Connectivity/service-t",
"//packages/modules/Connectivity/service-b",
"//packages/modules/Connectivity/networksecurity:__subpackages__",
"//packages/modules/Connectivity/tests:__subpackages__",
"//packages/modules/Connectivity/thread/service:__subpackages__",
@ -252,7 +253,11 @@ java_defaults {
"service-networksecurity-pre-jarjar",
service_remoteauth_pre_jarjar_lib,
"service-thread-pre-jarjar",
],
] + select(release_flag("RELEASE_MOVE_VCN_TO_MAINLINE"), {
true: ["service-connectivity-b-pre-jarjar"],
default: [],
}),
// The below libraries are not actually needed to build since no source is compiled
// (only combining prebuilt static_libs), but they are necessary so that R8 has the right
// references to optimize the code. Without these, there will be missing class warnings and
@ -338,6 +343,7 @@ java_genrule {
name: "service-connectivity-jarjar-gen",
tool_files: [
":service-connectivity-pre-jarjar{.jar}",
":service-connectivity-b-pre-jarjar{.jar}",
":service-connectivity-tiramisu-pre-jarjar{.jar}",
"jarjar-excludes.txt",
],
@ -347,6 +353,7 @@ java_genrule {
out: ["service_connectivity_jarjar_rules.txt"],
cmd: "$(location jarjar-rules-generator) " +
"$(location :service-connectivity-pre-jarjar{.jar}) " +
"$(location :service-connectivity-b-pre-jarjar{.jar}) " +
"$(location :service-connectivity-tiramisu-pre-jarjar{.jar}) " +
"--prefix android.net.connectivity " +
"--excludes $(location jarjar-excludes.txt) " +

View file

@ -1,3 +1,4 @@
# Classes loaded by SystemServer via their hardcoded name, so they can't be jarjared
com\.android\.server\.ConnectivityServiceInitializer(\$.+)?
com\.android\.server\.ConnectivityServiceInitializerB(\$.+)?
com\.android\.server\.NetworkStatsServiceInitializer(\$.+)?