Merge changes I8bc68d10,Ie6182fa4 am: 8fa5ddae14 am: b3f8ed74cb

Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2046463

Change-Id: I8aa82d1940f989c98a4e8b2d59d6a393dc87a5a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.bp b/Android.bp
index a237d7d..2cdee68 100644
--- a/Android.bp
+++ b/Android.bp
@@ -62,6 +62,16 @@
 }
 
 soong_config_module_type {
+    name: "module_prebuilt_systemserverclasspath_fragment",
+    module_type: "prebuilt_systemserverclasspath_fragment",
+    config_namespace: "ANDROID",
+    bool_variables: ["module_build_from_source"],
+    properties: [
+        "prefer",
+    ],
+}
+
+soong_config_module_type {
     name: "module_java_import",
     module_type: "java_import",
     config_namespace: "ANDROID",
diff --git a/build/allowed_deps.txt b/build/allowed_deps.txt
index 570ff4b..53c0366 100644
--- a/build/allowed_deps.txt
+++ b/build/allowed_deps.txt
@@ -13,11 +13,21 @@
 # See go/apex-allowed-deps-error for more details.
 # TODO(b/157465465): introduce automated quality signals and remove this list.
 
+android.hardware.audio.common-V1-ndk(minSdkVersion:31)
+android.hardware.audio.common@5.0(minSdkVersion:30)
+android.hardware.bluetooth.a2dp@1.0(minSdkVersion:30)
+android.hardware.bluetooth.audio-V1-ndk(minSdkVersion:31)
+android.hardware.bluetooth.audio@2.0(minSdkVersion:30)
+android.hardware.bluetooth.audio@2.1(minSdkVersion:30)
+android.hardware.bluetooth@1.0(minSdkVersion:30)
+android.hardware.bluetooth@1.1(minSdkVersion:30)
 android.hardware.cas.native@1.0(minSdkVersion:29)
 android.hardware.cas@1.0(minSdkVersion:29)
 android.hardware.common-ndk_platform(minSdkVersion:29)
 android.hardware.common-V2-ndk(minSdkVersion:29)
 android.hardware.common-V2-ndk_platform(minSdkVersion:29)
+android.hardware.common.fmq-V1-ndk(minSdkVersion:29)
+android.hardware.graphics.allocator-V1-ndk(minSdkVersion:29)
 android.hardware.graphics.allocator@2.0(minSdkVersion:29)
 android.hardware.graphics.allocator@3.0(minSdkVersion:29)
 android.hardware.graphics.allocator@4.0(minSdkVersion:29)
@@ -26,6 +36,7 @@
 android.hardware.graphics.common-ndk_platform(minSdkVersion:29)
 android.hardware.graphics.common-V2-ndk(minSdkVersion:29)
 android.hardware.graphics.common-V2-ndk_platform(minSdkVersion:29)
+android.hardware.graphics.common-V3-ndk(minSdkVersion:29)
 android.hardware.graphics.common@1.0(minSdkVersion:29)
 android.hardware.graphics.common@1.1(minSdkVersion:29)
 android.hardware.graphics.common@1.2(minSdkVersion:29)
@@ -48,9 +59,12 @@
 android.hardware.neuralnetworks@1.1(minSdkVersion:30)
 android.hardware.neuralnetworks@1.2(minSdkVersion:30)
 android.hardware.neuralnetworks@1.3(minSdkVersion:30)
+android.hardware.radio-V1.0-java(minSdkVersion:current)
 android.hardware.tetheroffload.config-V1.0-java(minSdkVersion:current)
 android.hardware.tetheroffload.control-V1.0-java(minSdkVersion:current)
 android.hardware.tetheroffload.control-V1.1-java(minSdkVersion:current)
+android.hardware.uwb-V1-ndk(minSdkVersion:Tiramisu)
+android.hardware.uwb-V1-rust(minSdkVersion:Tiramisu)
 android.hardware.wifi-V1.0-java(minSdkVersion:30)
 android.hardware.wifi-V1.0-java-constants(minSdkVersion:30)
 android.hardware.wifi-V1.1-java(minSdkVersion:30)
@@ -81,7 +95,11 @@
 android.hidl.token@1.0(minSdkVersion:29)
 android.hidl.token@1.0-utils(minSdkVersion:29)
 android.media.audio.common.types-V1-cpp(minSdkVersion:29)
+android.media.audio.common.types-V1-ndk(minSdkVersion:29)
 android.net.ipsec.ike.xml(minSdkVersion:(no version))
+android.system.suspend-V1-ndk(minSdkVersion:30)
+android.system.suspend-V1-ndk(minSdkVersion:Tiramisu)
+android.system.suspend.control-V1-ndk(minSdkVersion:30)
 android_downloader_lib(minSdkVersion:30)
 androidx-constraintlayout_constraintlayout(minSdkVersion:14)
 androidx-constraintlayout_constraintlayout-solver(minSdkVersion:24)
@@ -176,6 +194,7 @@
 auto_value_annotations(minSdkVersion:19)
 av-headers(minSdkVersion:29)
 av-types-aidl-cpp(minSdkVersion:29)
+avrcp_headers(minSdkVersion:30)
 bcm_object(minSdkVersion:29)
 bionic_libc_platform_headers(minSdkVersion:29)
 boringssl_self_test(minSdkVersion:29)
@@ -190,8 +209,10 @@
 car-rotary-lib-resources(minSdkVersion:28)
 car-ui-lib(minSdkVersion:28)
 car-ui-lib-resources(minSdkVersion:28)
+census(minSdkVersion:30)
 clatd(minSdkVersion:30)
 codecs_g711dec(minSdkVersion:29)
+com.android.vcard(minSdkVersion:9)
 com.google.android.material_material(minSdkVersion:14)
 conscrypt(minSdkVersion:29)
 core-libart(minSdkVersion:31)
@@ -229,27 +250,29 @@
 fmtlib_headers(minSdkVersion:29)
 fmtlib_ndk(minSdkVersion:29)
 fp16_headers(minSdkVersion:30)
+framework-bluetooth(minSdkVersion:current)
 framework-mediaprovider(minSdkVersion:30)
 framework-permission(minSdkVersion:30)
 framework-permission(minSdkVersion:current)
 framework-statsd(minSdkVersion:30)
 framework-statsd(minSdkVersion:current)
 framework-tethering(minSdkVersion:30)
-framework-uwb(minSdkVersion:current)
+framework-uwb(minSdkVersion:Tiramisu)
 framework-wifi(minSdkVersion:30)
 framework-wifi-util-lib(minSdkVersion:30)
 gemmlowp_headers(minSdkVersion:(no version))
 GoogleCellBroadcastApp(minSdkVersion:29)
 GoogleCellBroadcastServiceModule(minSdkVersion:29)
 GoogleExtServices(minSdkVersion:30)
-GoogleExtServices(minSdkVersion:current)
 GooglePermissionController(minSdkVersion:28)
 GooglePermissionController(minSdkVersion:30)
+gpr_base(minSdkVersion:30)
 guava(minSdkVersion:current)
 gwp_asan_headers(minSdkVersion:S)
 icing-java-proto-lite(minSdkVersion:current)
 iconloader(minSdkVersion:21)
 iconloader(minSdkVersion:26)
+internal_include_headers(minSdkVersion:30)
 ipmemorystore-aidl-interfaces-java(minSdkVersion:29)
 ipmemorystore-aidl-interfaces-V10-java(minSdkVersion:29)
 jacocoagent(minSdkVersion:9)
@@ -270,8 +293,11 @@
 libadbd_core(minSdkVersion:30)
 libadbd_services(minSdkVersion:(no version))
 libadbd_services(minSdkVersion:30)
+libaddress_sorting(minSdkVersion:30)
 libaidlcommonsupport(minSdkVersion:29)
 liballoc.rust_sysroot(minSdkVersion:29)
+libalts_frame_protector(minSdkVersion:30)
+libalts_util(minSdkVersion:30)
 libamrextractor(minSdkVersion:29)
 libandroid_log_sys(minSdkVersion:29)
 libandroid_logger(minSdkVersion:29)
@@ -283,6 +309,7 @@
 libasyncio(minSdkVersion:(no version))
 libasyncio(minSdkVersion:apex_inherit)
 libatomic(minSdkVersion:(no version))
+libaudio-a2dp-hw-utils(minSdkVersion:29)
 libaudio_system_headers(minSdkVersion:29)
 libaudioclient_aidl_conversion_util(minSdkVersion:29)
 libaudioclient_headers(minSdkVersion:29)
@@ -307,8 +334,13 @@
 libbinder_rs(minSdkVersion:Tiramisu)
 libbinder_tokio_rs(minSdkVersion:Tiramisu)
 libbinderthreadstateutils(minSdkVersion:29)
+libbitflags(minSdkVersion:29)
+libbluetooth-types(minSdkVersion:29)
 libbluetooth-types-header(minSdkVersion:29)
+libbluetooth_headers(minSdkVersion:30)
 libbrotli(minSdkVersion:(no version))
+libbt-platform-protos-lite(minSdkVersion:30)
+libbtcore_headers(minSdkVersion:30)
 libbuildversion(minSdkVersion:(no version))
 libbuildversion(minSdkVersion:26)
 libbytes(minSdkVersion:29)
@@ -322,8 +354,10 @@
 libc_llndk_headers(minSdkVersion:apex_inherit)
 libc_scudo(minSdkVersion:apex_inherit)
 libcap(minSdkVersion:29)
+libcesu8(minSdkVersion:29)
 libcfg_if(minSdkVersion:29)
 libcfg_if.rust_sysroot(minSdkVersion:29)
+libchrome(minSdkVersion:30)
 libcodec2(minSdkVersion:29)
 libcodec2_headers(minSdkVersion:29)
 libcodec2_hidl@1.0(minSdkVersion:29)
@@ -363,6 +397,7 @@
 libcodec2_soft_vp9enc(minSdkVersion:29)
 libcodec2_vndk(minSdkVersion:29)
 libcom_android_networkstack_tethering_util_jni(minSdkVersion:30)
+libcombine(minSdkVersion:29)
 libcompiler_builtins.rust_sysroot(minSdkVersion:29)
 libcore.rust_sysroot(minSdkVersion:29)
 libcrypto(minSdkVersion:29)
@@ -370,8 +405,11 @@
 libcrypto_utils(minSdkVersion:(no version))
 libcrypto_utils(minSdkVersion:apex_inherit)
 libcutils(minSdkVersion:29)
+libcutils_bindgen(minSdkVersion:29)
 libcutils_headers(minSdkVersion:29)
 libcutils_sockets(minSdkVersion:29)
+libcxx(minSdkVersion:29)
+libcxxbridge05(minSdkVersion:29)
 libdexfile_external_headers(minSdkVersion:31)
 libdexfile_support(minSdkVersion:31)
 libdiagnose_usb(minSdkVersion:(no version))
@@ -379,9 +417,13 @@
 libdmabufheap(minSdkVersion:29)
 libdmabufinfo(minSdkVersion:S)
 libdoh_ffi(minSdkVersion:29)
+libdowncast_rs(minSdkVersion:29)
 libeigen(minSdkVersion:(no version))
 libenv_logger(minSdkVersion:29)
+liberror_headers(minSdkVersion:29)
+libevent(minSdkVersion:30)
 libexpat(minSdkVersion:apex_inherit)
+libexpectedutils_headers(minSdkVersion:29)
 libextservices(minSdkVersion:30)
 libextservices_jni(minSdkVersion:30)
 libfft2d(minSdkVersion:30)
@@ -390,6 +432,7 @@
 libFLAC-config(minSdkVersion:29)
 libFLAC-headers(minSdkVersion:29)
 libflacextractor(minSdkVersion:29)
+libflatbuffers-cpp(minSdkVersion:30)
 libfmq(minSdkVersion:29)
 libfmq-base(minSdkVersion:29)
 libform_urlencoded(minSdkVersion:29)
@@ -409,6 +452,41 @@
 libgetopts(minSdkVersion:29)
 libgralloctypes(minSdkVersion:29)
 libgrallocusage(minSdkVersion:29)
+libgrpc(minSdkVersion:30)
+libgrpc++(minSdkVersion:30)
+libgrpc++_base(minSdkVersion:30)
+libgrpc++_codegen_base_src(minSdkVersion:30)
+libgrpc_base(minSdkVersion:30)
+libgrpc_base_c(minSdkVersion:30)
+libgrpc_bindgen(minSdkVersion:29)
+libgrpc_client_authority_filter(minSdkVersion:30)
+libgrpc_client_channel(minSdkVersion:30)
+libgrpc_deadline_filter(minSdkVersion:30)
+libgrpc_http_filters(minSdkVersion:30)
+libgrpc_lb_policy_grpclb_secure(minSdkVersion:30)
+libgrpc_lb_policy_pick_first(minSdkVersion:30)
+libgrpc_lb_policy_round_robin(minSdkVersion:30)
+libgrpc_max_age_filter(minSdkVersion:30)
+libgrpc_message_size_filter(minSdkVersion:30)
+libgrpc_resolver_dns_ares(minSdkVersion:30)
+libgrpc_resolver_dns_native(minSdkVersion:30)
+libgrpc_resolver_fake(minSdkVersion:30)
+libgrpc_resolver_sockaddr(minSdkVersion:30)
+libgrpc_secure(minSdkVersion:30)
+libgrpc_server_backward_compatibility(minSdkVersion:30)
+libgrpc_trace(minSdkVersion:30)
+libgrpc_transport_chttp2(minSdkVersion:30)
+libgrpc_transport_chttp2_alpn(minSdkVersion:30)
+libgrpc_transport_chttp2_client_connector(minSdkVersion:30)
+libgrpc_transport_chttp2_client_insecure(minSdkVersion:30)
+libgrpc_transport_chttp2_client_secure(minSdkVersion:30)
+libgrpc_transport_chttp2_server_insecure(minSdkVersion:30)
+libgrpc_transport_chttp2_server_secure(minSdkVersion:30)
+libgrpc_transport_inproc(minSdkVersion:30)
+libgrpc_workaround_cronet_compression_filter(minSdkVersion:30)
+libgrpc_wrap(minSdkVersion:29)
+libgrpcio(minSdkVersion:29)
+libgrpcio_sys(minSdkVersion:29)
 libgsm(minSdkVersion:apex_inherit)
 libgtest_prod(minSdkVersion:apex_inherit)
 libgtest_prod_headers(minSdkVersion:apex_inherit)
@@ -426,6 +504,8 @@
 libidna(minSdkVersion:29)
 libion(minSdkVersion:29)
 libip_checksum(minSdkVersion:30)
+libjni(minSdkVersion:29)
+libjni_sys(minSdkVersion:29)
 libjsoncpp(minSdkVersion:29)
 libkll(minSdkVersion:30)
 libkll-encoder(minSdkVersion:30)
@@ -435,8 +515,11 @@
 liblibc.rust_sysroot(minSdkVersion:29)
 libLibGuiProperties(minSdkVersion:29)
 liblibm(minSdkVersion:29)
+liblibz_sys(minSdkVersion:29)
+liblock_api(minSdkVersion:29)
 liblog_headers(minSdkVersion:29)
 liblog_rust(minSdkVersion:29)
+liblogger(minSdkVersion:29)
 liblua(minSdkVersion:(no version))
 liblua(minSdkVersion:30)
 liblz4(minSdkVersion:(no version))
@@ -454,6 +537,7 @@
 libmediaformatshaper(minSdkVersion:29)
 libmemchr(minSdkVersion:29)
 libmeminfo(minSdkVersion:S)
+libmemoffset(minSdkVersion:29)
 libminijail(minSdkVersion:29)
 libminijail_gen_constants(minSdkVersion:(no version))
 libminijail_gen_constants_obj(minSdkVersion:29)
@@ -462,6 +546,7 @@
 libminijail_generated(minSdkVersion:29)
 libmio(minSdkVersion:29)
 libmkvextractor(minSdkVersion:29)
+libmodpb64(minSdkVersion:30)
 libmp3extractor(minSdkVersion:29)
 libmp4extractor(minSdkVersion:29)
 libmpeg2dec(minSdkVersion:29)
@@ -481,17 +566,22 @@
 libneuralnetworks_common(minSdkVersion:(no version))
 libneuralnetworks_headers(minSdkVersion:(no version))
 libneuralnetworks_shim_static(minSdkVersion:30)
+libnix(minSdkVersion:29)
 libnum_cpus(minSdkVersion:29)
+libnum_traits(minSdkVersion:29)
 liboggextractor(minSdkVersion:29)
 libonce_cell(minSdkVersion:29)
 libopenjdkjvmti_headers(minSdkVersion:31)
 libopus(minSdkVersion:29)
 libpanic_abort.rust_sysroot(minSdkVersion:29)
+libparking_lot(minSdkVersion:29)
+libparking_lot_core(minSdkVersion:29)
 libpercent_encoding(minSdkVersion:29)
 libperfetto_client_experimental(minSdkVersion:S)
 libpin_project_lite(minSdkVersion:29)
 libpin_utils(minSdkVersion:29)
 libPlatformProperties(minSdkVersion:S)
+libpower(minSdkVersion:Tiramisu)
 libproc_macro_nested(minSdkVersion:29)
 libprocessgroup(minSdkVersion:29)
 libprocessgroup_headers(minSdkVersion:29)
@@ -503,8 +593,12 @@
 libprofile-extras(minSdkVersion:(no version))
 libprofile-extras_ndk(minSdkVersion:(no version))
 libprofiler_builtins.rust_sysroot(minSdkVersion:29)
+libprotobuf(minSdkVersion:29)
+libprotobuf-c-nano(minSdkVersion:30)
+libprotobuf-cpp-full(minSdkVersion:29)
 libprotobuf-cpp-lite(minSdkVersion:29)
 libprotobuf-java-lite(minSdkVersion:current)
+libprotobuf-java-micro(minSdkVersion:8)
 libprotobuf-java-nano(minSdkVersion:9)
 libprotoutil(minSdkVersion:(no version))
 libqemu_pipe(minSdkVersion:(no version))
@@ -515,9 +609,12 @@
 librustc_demangle(minSdkVersion:(no version))
 librustc_demangle.rust_sysroot(minSdkVersion:29)
 librustc_demangle_static(minSdkVersion:(no version))
+librustutils(minSdkVersion:29)
 libruy_static(minSdkVersion:30)
+libscopeguard(minSdkVersion:29)
 libsfplugin_ccodec_utils(minSdkVersion:29)
 libslab(minSdkVersion:29)
+libsmallvec(minSdkVersion:29)
 libsonivoxwithoutjet(minSdkVersion:29)
 libspeexresampler(minSdkVersion:29)
 libspin(minSdkVersion:29)
@@ -551,6 +648,7 @@
 libstd_detect.rust_sysroot(minSdkVersion:29)
 libsync(minSdkVersion:(no version))
 libsystem_headers(minSdkVersion:apex_inherit)
+libsystem_properties_bindgen(minSdkVersion:29)
 libsysutils(minSdkVersion:apex_inherit)
 libtcutils(minSdkVersion:30)
 libterm(minSdkVersion:29)
@@ -571,6 +669,9 @@
 libtinyvec_macros(minSdkVersion:29)
 libtinyxml2(minSdkVersion:S)
 libtokio(minSdkVersion:29)
+libtokio_stream(minSdkVersion:29)
+libtsi(minSdkVersion:30)
+libtsi_interface(minSdkVersion:30)
 libui(minSdkVersion:29)
 libui-types(minSdkVersion:apex_inherit)
 libui_headers(minSdkVersion:29)
@@ -608,12 +709,14 @@
 modules-utils-backgroundthread(minSdkVersion:29)
 modules-utils-build(minSdkVersion:29)
 modules-utils-build_system(minSdkVersion:29)
+modules-utils-bytesmatcher(minSdkVersion:29)
 modules-utils-handlerexecutor(minSdkVersion:29)
 modules-utils-list-slice(minSdkVersion:30)
 modules-utils-os(minSdkVersion:30)
 modules-utils-preconditions(minSdkVersion:29)
 modules-utils-shell-command-handler(minSdkVersion:29)
 modules-utils-statemachine(minSdkVersion:29)
+modules-utils-synchronous-result-receiver(minSdkVersion:29)
 ndk_crtbegin_so.21(minSdkVersion:(no version))
 ndk_crtbegin_so.27(minSdkVersion:(no version))
 ndk_crtend_so.21(minSdkVersion:(no version))
@@ -845,6 +948,7 @@
 prebuilt_asm-tree-7.0(minSdkVersion:current)
 prebuilt_asm-tree-9.2(minSdkVersion:current)
 prebuilt_bionic_libc_platform_headers(minSdkVersion:(no version))
+prebuilt_car-ui-lib-nodeps(minSdkVersion:28)
 prebuilt_com.google.android.material_material-nodeps(minSdkVersion:(no version))
 prebuilt_com.google.android.material_material-nodeps(minSdkVersion:14)
 prebuilt_crtbegin_dynamic(minSdkVersion:(no version))
@@ -882,6 +986,7 @@
 prebuilt_test_framework-sdkextensions(minSdkVersion:(no version))
 resourceobserver_aidl_interface-V1-ndk(minSdkVersion:29)
 resourceobserver_aidl_interface-V1-ndk_platform(minSdkVersion:29)
+sap-api-java-static(minSdkVersion:30)
 server_configurable_flags(minSdkVersion:29)
 ServiceWifiResourcesGoogle(minSdkVersion:30)
 SettingsLibActionBarShadow(minSdkVersion:21)
@@ -897,6 +1002,7 @@
 SettingsLibRadioButtonPreference(minSdkVersion:21)
 SettingsLibRestrictedLockUtils(minSdkVersion:21)
 SettingsLibSearchWidget(minSdkVersion:21)
+SettingsLibSelectorWithWidgetPreference(minSdkVersion:21)
 SettingsLibSettingsTheme(minSdkVersion:21)
 SettingsLibSettingsTransition(minSdkVersion:29)
 SettingsLibTopIntroPreference(minSdkVersion:21)
diff --git a/build/build_unbundled_mainline_module.sh b/build/build_unbundled_mainline_module.sh
index 7c2478f..d85d74a 100755
--- a/build/build_unbundled_mainline_module.sh
+++ b/build/build_unbundled_mainline_module.sh
@@ -70,6 +70,7 @@
   ExtServices
   NetworkPermissionConfig
   NetworkStack
+  NetworkStackNext
   PermissionController
 )
 
diff --git a/build/mainline_modules_sdks.py b/build/mainline_modules_sdks.py
index 119c16c..dc04877 100755
--- a/build/mainline_modules_sdks.py
+++ b/build/mainline_modules_sdks.py
@@ -660,6 +660,11 @@
 # List of mainline modules.
 MAINLINE_MODULES = [
     MainlineModule(
+        apex="com.android.adservices",
+        sdks=["adservices-module-sdk"],
+        first_release=Tiramisu,
+    ),
+    MainlineModule(
         apex="com.android.art",
         sdks=[
             "art-module-sdk",
@@ -716,6 +721,11 @@
         ]),
     ),
     MainlineModule(
+        apex="com.android.ondevicepersonalization",
+        sdks=["ondevicepersonalization-module-sdk"],
+        first_release=Tiramisu,
+    ),
+    MainlineModule(
         apex="com.android.permission",
         sdks=["permission-module-sdk"],
         first_release=R,
@@ -755,6 +765,10 @@
         ]),
     ),
     MainlineModule(
+        apex="com.android.uwb",
+        sdks=["uwb-module-sdk"],
+    ),
+    MainlineModule(
         apex="com.android.wifi",
         sdks=["wifi-module-sdk"],
         first_release=R,
diff --git a/javatests/com/android/modules/updatablesharedlibs/Android.bp b/javatests/com/android/modules/updatablesharedlibs/Android.bp
new file mode 100644
index 0000000..1c2f7e7
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/Android.bp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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"],
+}
+
+java_test_host {
+    name: "UpdatableSharedLibsTest",
+    srcs: [
+        "UpdatableSharedLibsTest.java"
+    ],
+    libs: ["tradefed"],
+    java_resources: [
+        ":test_com.android.modules.updatablesharedlibs",
+    ],
+    data: [
+        ":com.android.modules.updatablesharedlibs.apps.targetS",
+        ":com.android.modules.updatablesharedlibs.apps.targetT",
+        ":com.android.modules.updatablesharedlibs.apps.targetTWithLib",
+    ],
+    static_libs: [
+        "compatibility-host-util",
+        "cts-install-lib-host",
+        "frameworks-base-hostutils",
+        "truth-prebuilt"
+    ],
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/OWNERS b/javatests/com/android/modules/updatablesharedlibs/OWNERS
new file mode 100644
index 0000000..55f5b97
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/OWNERS
@@ -0,0 +1,5 @@
+# Mainline modularization team
+
+andreionea@google.com
+pedroql@google.com
+satayev@google.com
diff --git a/javatests/com/android/modules/updatablesharedlibs/UpdatableSharedLibsTest.java b/javatests/com/android/modules/updatablesharedlibs/UpdatableSharedLibsTest.java
new file mode 100644
index 0000000..a0fefe4
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/UpdatableSharedLibsTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2021 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 com.android.modules.updatablesharedlibs;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeTrue;
+import static org.junit.Assert.assertThrows;
+
+import com.android.tradefed.targetprep.TargetSetupError;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.testtype.junit4.DeviceTestRunOptions;
+import com.android.internal.util.test.SystemPreparer;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+
+import android.cts.install.lib.host.InstallUtilsHost;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class UpdatableSharedLibsTest extends BaseHostJUnit4Test {
+
+    private final InstallUtilsHost mHostUtils = new InstallUtilsHost(this);
+    private final TemporaryFolder mTemporaryFolder = new TemporaryFolder();
+    private final SystemPreparer mPreparer = new SystemPreparer(mTemporaryFolder, this::getDevice);
+
+    @Rule
+    public final RuleChain ruleChain = RuleChain.outerRule(mTemporaryFolder).around(mPreparer);
+
+    @Test
+    public void callOnDeviceApiFromHost() throws Exception {
+        if (!getDevice().isAdbRoot()) {
+            getDevice().enableAdbRoot();
+        }
+        assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
+        assumeTrue("Device requires root", getDevice().isAdbRoot());
+
+        // install app requiring lib before the lib is installed
+        assertInstalationFails();
+
+        String apex = "test_com.android.modules.updatablesharedlibs.apex";
+        mPreparer.pushResourceFile(apex, "/system/apex/" + apex);
+        mPreparer.reboot();
+        getDevice().disableAdbRoot();
+
+        installPackage("com.android.modules.updatablesharedlibs.apps.targetS.apk");
+        installPackage("com.android.modules.updatablesharedlibs.apps.targetT.apk");
+        installPackage("com.android.modules.updatablesharedlibs.apps.targetTWithLib.apk");
+
+        runDeviceTests("com.android.modules.updatablesharedlibs.apps.targetS", null);
+        runDeviceTests("com.android.modules.updatablesharedlibs.apps.targetT", null);
+        runDeviceTests("com.android.modules.updatablesharedlibs.apps.targetTWithLib", null);
+    }
+
+    private void assertInstalationFails() throws Exception {
+        String packageName = "com.android.modules.updatablesharedlibs.apps.targetTWithLib";
+        Exception e = assertThrows(
+            TargetSetupError.class,
+            () -> installPackage(packageName + ".apk"));
+        assertThat(e).hasMessageThat().contains(
+            "Package " + packageName + " requires "
+                + "unavailable shared library "
+                + "com.android.modules.updatablesharedlibs.libs.since.t");
+    }
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apex/Android.bp b/javatests/com/android/modules/updatablesharedlibs/apex/Android.bp
new file mode 100644
index 0000000..db56f35
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apex/Android.bp
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 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_key {
+    name: "com.android.modules.updatablesharedlibs.key",
+    public_key: "com.android.modules.updatablesharedlibs.avbpubkey",
+    private_key: "com.android.modules.updatablesharedlibs.pem",
+}
+
+android_app_certificate {
+    name: "com.android.modules.updatablesharedlibs.certificate",
+    certificate: "com.android.modules.updatablesharedlibs",
+}
+
+apex_test {
+    name: "test_com.android.modules.updatablesharedlibs",
+    manifest: "manifest.json",
+    file_contexts: ":apex.test-file_contexts",
+    key: "com.android.modules.updatablesharedlibs.key",
+    java_libs: [
+        "com.android.modules.updatablesharedlibs.libs.before.t",
+        "com.android.modules.updatablesharedlibs.libs.since.t",
+    ],
+    updatable: false,
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.avbpubkey b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.avbpubkey
new file mode 100644
index 0000000..e95ecbe
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.avbpubkey
Binary files differ
diff --git a/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.pem b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.pem
new file mode 100644
index 0000000..ef30766
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.pem
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+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
+-----END RSA PRIVATE KEY-----
diff --git a/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.pk8 b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.pk8
new file mode 100644
index 0000000..db1a90f
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.pk8
Binary files differ
diff --git a/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.x509.pem b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.x509.pem
new file mode 100644
index 0000000..6d9143f
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apex/com.android.modules.updatablesharedlibs.x509.pem
@@ -0,0 +1,34 @@
+-----BEGIN CERTIFICATE-----
+MIIF8zCCA9sCFF/jvwHjBgaxHaamJyRxH88j4704MA0GCSqGSIb3DQEBCwUAMIG0
+MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91
+bnRhaW4gVmlldzEQMA4GA1UECgwHQW5kcm9pZDEQMA4GA1UECwwHQW5kcm9pZDEi
+MCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTEwMC4GA1UEAwwnY29t
+LmFuZHJvaWQubW9kdWxlcy51cGRhdGFibGVzaGFyZWRsaWJzMCAXDTIxMTAyNzEy
+NTU0OFoYDzQ3NTkwOTIzMTI1NTQ4WjCBtDELMAkGA1UEBhMCVVMxEzARBgNVBAgM
+CkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEDAOBgNVBAoMB0Fu
+ZHJvaWQxEDAOBgNVBAsMB0FuZHJvaWQxIjAgBgkqhkiG9w0BCQEWE2FuZHJvaWRA
+YW5kcm9pZC5jb20xMDAuBgNVBAMMJ2NvbS5hbmRyb2lkLm1vZHVsZXMudXBkYXRh
+Ymxlc2hhcmVkbGliczCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK1C
+8OSduZta1sNA/3eKcj/IU5dtOUWFSB21dKIlzOqEBOO9meCBiU5IYKGIjEpktsEH
+CaIn3PZ8iqUNU30myjgugqQbdoo7GyYHj9px23s5L+DRoOyDlk6WEfLpNei74POz
+wisii5MJMN3SEPVbMFhwYJnfPOOxLl1hLpkKD0I/bDKrjKnVCqpDB3YfOZrwk32h
+Og1fI7G7/kCBD2KZPyjXghJMVs0ohRrl7KLFSYCGIvrUH8WUQ3iQGGmTYTJmwUMu
+BshlY/xt2EIqjzU2s3R9uzPibzDfaWgzmHVEV1fmXwUEryiKSza8lPnUhaH2fNsi
+SPUHYPG19qEoQueHchBNpxFFJPipTGH00XLKAQATqmCL2Dwxu02HY4mxdUKFc5TS
+AKre9e7GjUv+P6RNuqMXOUmdTcN8xXy2wfIFeVa1JA9IAdRz9OlkXiB/l7GLjb0x
+WEAIG0cmikrPsgKe9GT+OjKKKwhKrE/oCp+qc4Y9BnPoo1Q538BbEp0jYyYpKOVQ
+7nGUbPI6Km6f+RzyzqEKB10EmUREApinEl0j05CVbf/WNl5ubRgo70MlyXdaQS2L
+U6XF+HgwIOySLHL0opQgbgapZIGaOQv3/baa4R7DaJ8oVNQwSCpieLW+MzsTk3hJ
+MyJAJf7iRlNcRx7NoJy5JWL9kmXiWAffYo+Dr8ldAgMBAAEwDQYJKoZIhvcNAQEL
+BQADggIBAGQ5m+rrDvOQUfeOfRdfuU+XyhJ1zaOmyi1Br8ARuUrG5m3H6o8D1DyW
+zmv09YgkcXt4iTSFG5WcxXtu6mA57f9KuiXaRtA4wzmcnSgUpZrhRamltv1xfo8P
+h5vW9EKU67+437CuFBKlyjRLC+MD1GyMgNJwbHBqkIDUIfio+soIBVKgdANshSq7
+Cgc1dLAg7DvJkRg+WyjhBRmmregopXmfJfs73zxt2Jif5QQEZfLG27JkE7Ae06+9
+1FKvotlabdT3LMXjlX6miaJhPV8WPCmGyF2sZ8rOvI8OIKjWfWdf2S5269OnOrpg
+IMRJTnXzsIDNk/nVdbvI50V0/STIKyCj+HYMjlGjyFqs9XOSoWtv7Y41bYDp+eoF
+tfau5WOmVALWQ/M3sSIeBGkpzoq33wkyoqYNrlLRnA8FSNCOahKZpgAZyd7Cs9Fu
+EzK1+35F+5HdxgJaK29cmiaBsx3acTUr4UZrPewsmnYTU+xUtnbOKaLniUxkf/WT
+8qPhdg8n/1Hks5iWRzvKSHmFYMzx/efbz7PcB4UEyzKyaYW5mpX9xPLZ0Du6Je3X
+JIk2t6WEGnMDHWS2fa1KpUfhsiRKkxNP7tMMuAwZ/2OnCiFmZ2/Tzy6bp4EFPsa6
+zXcvJSf7eAe5jJkKrWkoMoKp+SBGoCKXzoMRCAbLSEdnSpr5EZXF
+-----END CERTIFICATE-----
diff --git a/javatests/com/android/modules/updatablesharedlibs/apex/manifest.json b/javatests/com/android/modules/updatablesharedlibs/apex/manifest.json
new file mode 100644
index 0000000..ffe9a73
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apex/manifest.json
@@ -0,0 +1,4 @@
+{
+  "name": "test_com.android.modules.updatablesharedlibs",
+  "version": 1
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetS/Android.bp b/javatests/com/android/modules/updatablesharedlibs/apps/targetS/Android.bp
new file mode 100644
index 0000000..24c495b
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetS/Android.bp
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 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"],
+}
+
+android_test_helper_app {
+    name: "com.android.modules.updatablesharedlibs.apps.targetS",
+    srcs: ["UpdatableSharedLibraryTargetSTest.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "androidx.test.core",
+        "truth-prebuilt",
+    ],
+    sdk_version: "current",
+    target_sdk_version: "31",
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetS/AndroidManifest.xml b/javatests/com/android/modules/updatablesharedlibs/apps/targetS/AndroidManifest.xml
new file mode 100644
index 0000000..e0c0ec9
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetS/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.modules.updatablesharedlibs.apps.targetS">
+  <application>
+  </application>
+
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+    android:targetPackage="com.android.modules.updatablesharedlibs.apps.targetS"
+   ></instrumentation>
+</manifest>
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetS/UpdatableSharedLibraryTargetSTest.java b/javatests/com/android/modules/updatablesharedlibs/apps/targetS/UpdatableSharedLibraryTargetSTest.java
new file mode 100644
index 0000000..d881ce8
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetS/UpdatableSharedLibraryTargetSTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2021 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 com.android.modules.updatablesharedlibs.apps.targetS;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import junit.framework.Assert;
+
+import com.google.common.truth.Correspondence;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+/**
+ * Tests an app targeting S.
+ *
+ * <p>One of the shared libraries included in this test claims to be in the
+ * BOOTCLASSPATH before T so it should be added transparently to this app.
+ */
+@RunWith(AndroidJUnit4.class)
+public class UpdatableSharedLibraryTargetSTest {
+    private static String SHARED_LIB_PATH = "/apex/test_com.android.modules.updatablesharedlibs"
+            + "/javalib/com.android.modules.updatablesharedlibs.libs.before.t.jar";
+
+    private static final Context sContext = InstrumentationRegistry.getInstrumentation()
+            .getContext();
+
+    @Test
+    public void checkSharedLibrary() throws Exception {
+        String packageName = sContext.getPackageName();
+        ApplicationInfo appInfo = sContext.getPackageManager().getApplicationInfo(packageName,
+                PackageManager.GET_SHARED_LIBRARY_FILES);
+
+        assertThat(appInfo.sharedLibraryFiles)
+                .asList()
+                .contains(SHARED_LIB_PATH);
+    }
+
+    @Test
+    public void callApi() throws Exception {
+        Object api = Class.forName("com.android.modules.updatablesharedlibs.libs.before.t.Api")
+                .getDeclaredConstructor()
+                .newInstance();
+
+        String actual = (String) api.getClass().getDeclaredMethod("methodBeforeT").invoke(api);
+        assertThat(actual).isEqualTo("Success");
+    }
+
+    @Test
+    public void testGetSystemSharedLibraryNames() {
+        String[] libraries = sContext.getPackageManager().getSystemSharedLibraryNames();
+        assertThat(libraries)
+                .asList()
+                .containsAtLeast(
+                    "com.android.modules.updatablesharedlibs.libs.before.t",
+                    "com.android.modules.updatablesharedlibs.libs.since.t");
+    }
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetT/Android.bp b/javatests/com/android/modules/updatablesharedlibs/apps/targetT/Android.bp
new file mode 100644
index 0000000..70a549e
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetT/Android.bp
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 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"],
+}
+
+android_test_helper_app {
+    name: "com.android.modules.updatablesharedlibs.apps.targetT",
+    srcs: ["UpdatableSharedLibraryTargetTTest.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "androidx.test.core",
+        "truth-prebuilt",
+    ],
+    sdk_version: "current",
+    target_sdk_version: "Tiramisu",
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetT/AndroidManifest.xml b/javatests/com/android/modules/updatablesharedlibs/apps/targetT/AndroidManifest.xml
new file mode 100644
index 0000000..17f52e7
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetT/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.modules.updatablesharedlibs.apps.targetT">
+  <application>
+  </application>
+
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+    android:targetPackage="com.android.modules.updatablesharedlibs.apps.targetT"
+   ></instrumentation>
+</manifest>
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetT/UpdatableSharedLibraryTargetTTest.java b/javatests/com/android/modules/updatablesharedlibs/apps/targetT/UpdatableSharedLibraryTargetTTest.java
new file mode 100644
index 0000000..20078a5
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetT/UpdatableSharedLibraryTargetTTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2021 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 com.android.modules.updatablesharedlibs.apps.targetT;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertThrows;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import junit.framework.Assert;
+
+import com.google.common.truth.Correspondence;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+/**
+ * Tests an app targeting T.
+ *
+ * <p>With the shared libraries included in this test, none of the shared libraries present in this
+ * test should be included for this app.
+ */
+@RunWith(AndroidJUnit4.class)
+public class UpdatableSharedLibraryTargetTTest {
+    private static final Correspondence<String, String> CONTAINS_SUBSTRING =
+            Correspondence.from(String::contains, "contains");
+    private static final Context sContext = InstrumentationRegistry.getInstrumentation()
+            .getContext();
+
+    @Test
+    public void checkHasNoSharedLibrary() throws Exception {
+        String packageName = sContext.getPackageName();
+        ApplicationInfo appInfo = sContext.getPackageManager().getApplicationInfo(packageName,
+                PackageManager.GET_SHARED_LIBRARY_FILES);
+
+        assertThat(appInfo.sharedLibraryFiles)
+            .asList()
+            .comparingElementsUsing(CONTAINS_SUBSTRING)
+            .doesNotContain("com.android.modules.updatablesharedlibs");
+    }
+
+    @Test
+    public void checkHasNoApiAccess() throws Exception {
+        assertThrows(
+            ClassNotFoundException.class,
+            () -> Class.forName("com.android.modules.updatablesharedlibs.libs.before.t.Api")
+        );
+    }
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/Android.bp b/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/Android.bp
new file mode 100644
index 0000000..890af11
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/Android.bp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 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"],
+}
+
+android_test_helper_app {
+    name: "com.android.modules.updatablesharedlibs.apps.targetTWithLib",
+    srcs: ["UpdatableSharedLibraryTargetTWithLibraryTest.java"],
+    libs: [
+        "com.android.modules.updatablesharedlibs.libs.since.t",
+    ],
+    static_libs: [
+        "androidx.test.rules",
+        "androidx.test.core",
+    ],
+    sdk_version: "current",
+    target_sdk_version: "Tiramisu",
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/AndroidManifest.xml b/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/AndroidManifest.xml
new file mode 100644
index 0000000..f510ca6
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.modules.updatablesharedlibs.apps.targetTWithLib">
+  <application>
+  </application>
+
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+    android:targetPackage="com.android.modules.updatablesharedlibs.apps.targetTWithLib"
+   ></instrumentation>
+</manifest>
diff --git a/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/UpdatableSharedLibraryTargetTWithLibraryTest.java b/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/UpdatableSharedLibraryTargetTWithLibraryTest.java
new file mode 100644
index 0000000..425ed99
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/apps/targetTWithLib/UpdatableSharedLibraryTargetTWithLibraryTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 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 com.android.modules.updatablesharedlibs.apps.targetTWithLib;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+/**
+ * Tests an app targeting T which also includes a shared library that is part of the BOOTCLASSPATH
+ * from T.
+ *
+ * <p>This means the shared library should not be explicitly in the shared libraries in order
+ * to avoid duplication of the BCP.
+ */
+@RunWith(AndroidJUnit4.class)
+public class UpdatableSharedLibraryTargetTWithLibraryTest {
+    // private static final Context sContext = InstrumentationRegistry.getInstrumentation()
+    //          .getContext();
+
+    @Test
+    public void checkHasNoSharedLibrary() throws Exception {
+        // TODO(b/205261027): not possible to test yet
+
+        // This is the code we'd like to run. But because before API finalisation PM
+        // will see the shared library as
+        // having "on-bcp-since 9001" this means that it never considers that shared
+        // library to be in the BCP.
+
+        // String packageName = getContext().getPackageName();
+        // ApplicationInfo appInfo = getPackageManager().getApplicationInfo(packageName,
+        //      PackageManager.GET_SHARED_LIBRARY_FILES);
+        // Log.d(TAG, "checkHasNoSharedLibrary in " + appInfo.sharedLibraryFiles.length
+        //      + " libraries");
+        // for (String path : appInfo.sharedLibraryFiles) {
+        //      if (path.contains("com.android.modules.updatablesharedlibs")) {
+        //          Assert.fail("Unexpectedly found a shared library: " + path);
+        //      }
+        // }
+    }
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/Android.bp b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/Android.bp
new file mode 100644
index 0000000..8f0565e
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/Android.bp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2021 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"],
+}
+
+java_sdk_library {
+    name: "com.android.modules.updatablesharedlibs.libs.before.t",
+    srcs: [
+        "Api.java"
+    ],
+    permitted_packages: [ "com.android.modules.updatablesharedlibs.libs"],
+    apex_available: [ "test_com.android.modules.updatablesharedlibs" ],
+    min_sdk_version: "Tiramisu",
+    sdk_version: "current",
+    on_bootclasspath_before: "Tiramisu",
+
+    // Output the api files to a special directory that won't trigger an API
+    // review as it is a test only API.
+    api_dir: "api_dir",
+    // Testing only.
+    no_dist: true,
+    unsafe_ignore_missing_latest_api: true,
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/Api.java b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/Api.java
new file mode 100644
index 0000000..a01d0f0
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/Api.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 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 com.android.modules.updatablesharedlibs.libs.before.t;
+
+/**
+ * Basic class to pretend we have one API.
+ */
+public class Api {
+
+    public String methodBeforeT() {
+        return "Success";
+    }
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/current.txt
new file mode 100644
index 0000000..2b3339c
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/current.txt
@@ -0,0 +1,10 @@
+// Signature format: 2.0
+package com.android.modules.updatablesharedlibs.libs.before.t {
+
+  public class Api {
+    ctor public Api();
+    method public String methodBeforeT();
+  }
+
+}
+
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/module-lib-current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/module-lib-current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/module-lib-current.txt
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/module-lib-removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/module-lib-removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/module-lib-removed.txt
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/system-current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/system-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/system-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/system-removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/system-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/system-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/test-current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/test-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/test-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/test-removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/test-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/before/t/api_dir/test-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/Android.bp b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/Android.bp
new file mode 100644
index 0000000..553dca6
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/Android.bp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2021 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"],
+}
+
+java_sdk_library {
+    name: "com.android.modules.updatablesharedlibs.libs.since.t",
+    srcs: [
+        "Api.java"
+    ],
+    permitted_packages: [ "com.android.modules.updatablesharedlibs.libs.since"],
+    apex_available: [ "test_com.android.modules.updatablesharedlibs" ],
+    min_sdk_version: "Tiramisu",
+    sdk_version: "current",
+    on_bootclasspath_since: "Tiramisu",
+
+    // Output the api files to a special directory that won't trigger an API
+    // review as it is a test only API.
+    api_dir: "api_dir",
+    // Testing only.
+    no_dist: true,
+    unsafe_ignore_missing_latest_api: true,
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/Api.java b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/Api.java
new file mode 100644
index 0000000..53dde68
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/Api.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 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 com.android.modules.updatablesharedlibs.libs.since.t;
+
+/**
+ * Basic class to pretend we have one API.
+ */
+public class Api {
+
+    public String methodSinceT() {
+        return "Success";
+    }
+}
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/current.txt
new file mode 100644
index 0000000..c459c1a
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/current.txt
@@ -0,0 +1,10 @@
+// Signature format: 2.0
+package com.android.modules.updatablesharedlibs.libs.since.t {
+
+  public class Api {
+    ctor public Api();
+    method public String methodSinceT();
+  }
+
+}
+
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/module-lib-current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/module-lib-current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/module-lib-current.txt
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/module-lib-removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/module-lib-removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/module-lib-removed.txt
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/system-current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/system-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/system-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/system-removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/system-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/system-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/test-current.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/test-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/test-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/test-removed.txt b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/test-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/javatests/com/android/modules/updatablesharedlibs/libs/since/t/api_dir/test-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/sdk/ModuleDefaults.bp b/sdk/ModuleDefaults.bp
index d4d8a18..cf1b417 100644
--- a/sdk/ModuleDefaults.bp
+++ b/sdk/ModuleDefaults.bp
@@ -102,7 +102,6 @@
     // Hide impl library and stub sources
     impl_library_visibility: [
         ":__pkg__",
-        "//frameworks/base", // For framework-all
         "//frameworks/base/api", // For framework-all
     ],
     stubs_source_visibility: ["//visibility:private"],