Merge "Move the testing platforms out of soong_injection"
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index f956f2d..ff0d33e 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -182,6 +182,8 @@
 		"external/selinux/libselinux":            Bp2BuildDefaultTrueRecursively,
 		"external/selinux/libsepol":              Bp2BuildDefaultTrueRecursively,
 		"external/speex":                         Bp2BuildDefaultTrueRecursively,
+		"external/tinyalsa":                      Bp2BuildDefaultTrueRecursively,
+		"external/tinyalsa_new":                  Bp2BuildDefaultTrueRecursively,
 		"external/toybox":                        Bp2BuildDefaultTrueRecursively,
 		"external/zlib":                          Bp2BuildDefaultTrueRecursively,
 		"external/zopfli":                        Bp2BuildDefaultTrueRecursively,
@@ -222,6 +224,8 @@
 		"hardware/interfaces":                                     Bp2BuildDefaultTrue,
 		"hardware/interfaces/audio/aidl":                          Bp2BuildDefaultTrue,
 		"hardware/interfaces/audio/aidl/common":                   Bp2BuildDefaultTrue,
+		"hardware/interfaces/audio/aidl/default":                  Bp2BuildDefaultTrue,
+		"hardware/interfaces/audio/aidl/sounddose":                Bp2BuildDefaultTrue,
 		"hardware/interfaces/common/aidl":                         Bp2BuildDefaultTrue,
 		"hardware/interfaces/common/fmq/aidl":                     Bp2BuildDefaultTrue,
 		"hardware/interfaces/common/support":                      Bp2BuildDefaultTrue,
@@ -282,6 +286,7 @@
 		"packages/modules/adb/pairing_connection":            Bp2BuildDefaultTrueRecursively,
 		"packages/modules/adb/proto":                         Bp2BuildDefaultTrueRecursively,
 		"packages/modules/adb/tls":                           Bp2BuildDefaultTrueRecursively,
+		"packages/modules/Gki/libkver":                       Bp2BuildDefaultTrue,
 		"packages/modules/NetworkStack/common/captiveportal": Bp2BuildDefaultTrue,
 		"packages/modules/NeuralNetworks/apex":               Bp2BuildDefaultTrue,
 		"packages/providers/MediaProvider/tools/dialogs":     Bp2BuildDefaultFalse, // TODO(b/242834374)
@@ -346,10 +351,12 @@
 		"system/libhidl/transport/token/1.0/utils":               Bp2BuildDefaultTrue,
 		"system/libhwbinder":                                     Bp2BuildDefaultTrueRecursively,
 		"system/libprocinfo":                                     Bp2BuildDefaultTrue,
+		"system/libvintf":                                        Bp2BuildDefaultTrue,
 		"system/libziparchive":                                   Bp2BuildDefaultTrueRecursively,
 		"system/logging":                                         Bp2BuildDefaultTrueRecursively,
 		"system/media":                                           Bp2BuildDefaultTrue,
 		"system/media/audio":                                     Bp2BuildDefaultTrueRecursively,
+		"system/media/alsa_utils":                                Bp2BuildDefaultTrueRecursively,
 		"system/media/audio_utils":                               Bp2BuildDefaultTrueRecursively,
 		"system/memory/libion":                                   Bp2BuildDefaultTrueRecursively,
 		"system/memory/libmemunreachable":                        Bp2BuildDefaultTrueRecursively,
@@ -358,8 +365,11 @@
 		"system/timezone/apex":                                   Bp2BuildDefaultTrueRecursively,
 		"system/timezone/output_data":                            Bp2BuildDefaultTrueRecursively,
 		"system/tools/aidl/build/tests_bp2build":                 Bp2BuildDefaultTrue,
+		"system/tools/aidl/metadata":                             Bp2BuildDefaultTrue,
+		"system/tools/hidl/metadata":                             Bp2BuildDefaultTrue,
 		"system/tools/mkbootimg":                                 Bp2BuildDefaultTrueRecursively,
 		"system/tools/sysprop":                                   Bp2BuildDefaultTrue,
+		"system/tools/xsdc/utils":                                Bp2BuildDefaultTrueRecursively,
 		"system/unwinding/libunwindstack":                        Bp2BuildDefaultTrueRecursively,
 
 		"tools/apksig":   Bp2BuildDefaultTrue,
@@ -566,8 +576,8 @@
 		"car-ui-androidx-constraintlayout-solver-nodeps",
 
 		//system/libhidl
-		// needed by cc_hidl_library
-		"libhidlbase",
+		"libhidlbase", // needed by cc_hidl_library
+		"libhidl_gtest_helper",
 
 		//frameworks/native
 		"framework_native_aidl_binder",
@@ -859,6 +869,30 @@
 		// depends on android.hardware.health-V2.0-java
 		"android.hardware.health-translate-java",
 
+		//system/libvintf
+		// depends on apex-info-list-tinyxml, unconverted xsd_config Soong module type.
+		"libvintf",
+		"vintf",
+		"libassemblevintf",
+		"assemble_vintf",
+		"libvintffm",
+		"vintffm",
+		"checkvintf",
+
+		// depends on audio_policy_configuration_aidl_default, xsd_config module.
+		"libaudioserviceexampleimpl",
+		"android.hardware.audio.service-aidl.example",
+
+		// depends on //system/tools/aidl/build:aidl_metadata_json, which is an aidl_interfaces_metadata custom Soong type.
+		"aidl_metadata_in_cpp",
+		"libaidlmetadata",
+		"libaidlmetadata_test",
+
+		// depends on //system/tools/hidl/build:hidl_metadata_json, which is an hidl_interfaces_metadata custom Soong type.
+		"hidl_metadata_in_cpp",
+		"libhidlmetadata",
+		"hidl_metadata_test",
+
 		// cc_test related.
 		// b/274164834 "Could not open Configuration file test.cfg"
 		"svcenc", "svcdec",
@@ -1475,26 +1509,263 @@
 	// The list of modules which are expected to spend lots of build time.
 	// With `--ninja_weight_source=soong`, ninja builds these modules and deps first.
 	HugeModulesMap = map[string]int{
-		"libbt_packets":                           DEFAULT_NINJA_WEIGHT,
-		"libbt_packets_nonapex":                   DEFAULT_NINJA_WEIGHT,
-		"crosvm":                                  DEFAULT_NINJA_WEIGHT,
-		"system-api-stubs-docs-non-updatable":     DEFAULT_NINJA_WEIGHT,
-		"test-api-stubs-docs-non-updatable":       DEFAULT_NINJA_WEIGHT,
-		"module-lib-api-stubs-docs-non-updatable": DEFAULT_NINJA_WEIGHT,
-		"libdevices":                              DEFAULT_NINJA_WEIGHT,
-		"libaom":                                  DEFAULT_NINJA_WEIGHT,
-		"libart-disassembler":                     DEFAULT_NINJA_WEIGHT,
-		"libart":                                  DEFAULT_NINJA_WEIGHT,
-		"libprotobuf":                             DEFAULT_NINJA_WEIGHT,
-		"libsyn":                                  DEFAULT_NINJA_WEIGHT,
-		"api-stubs-docs-non-updatable":            DEFAULT_NINJA_WEIGHT,
-		"framework-res":                           DEFAULT_NINJA_WEIGHT,
-		"SystemUI-core":                           DEFAULT_NINJA_WEIGHT,
-		"services-non-updatable-stubs":            DEFAULT_NINJA_WEIGHT,
-		"art.module.public.api.stubs.source":      DEFAULT_NINJA_WEIGHT,
-		"art.module.intra.core.api.stubs.source":  DEFAULT_NINJA_WEIGHT,
-		"virtmgr":                                 DEFAULT_NINJA_WEIGHT,
-		"metalava":                                DEFAULT_NINJA_WEIGHT,
-		"libkeystore2":                            DEFAULT_NINJA_WEIGHT,
+		"AccountManagementApp":                          DEFAULT_NINJA_WEIGHT,
+		"ActivityManagerPerfTestsStubApp1":              DEFAULT_NINJA_WEIGHT,
+		"ActivityManagerPerfTestsStubApp2":              DEFAULT_NINJA_WEIGHT,
+		"ActivityManagerPerfTestsStubApp3":              DEFAULT_NINJA_WEIGHT,
+		"api-stubs-docs-non-updatable":                  DEFAULT_NINJA_WEIGHT,
+		"AppCompatibilityTest":                          DEFAULT_NINJA_WEIGHT,
+		"AppTransitionTests":                            DEFAULT_NINJA_WEIGHT,
+		"art_compiler_tests":                            DEFAULT_NINJA_WEIGHT,
+		"art.module.intra.core.api.stubs.source":        DEFAULT_NINJA_WEIGHT,
+		"art.module.public.api.stubs.source":            DEFAULT_NINJA_WEIGHT,
+		"AttestationVerificationTest":                   DEFAULT_NINJA_WEIGHT,
+		"BatteryUsageStatsProtoTests":                   DEFAULT_NINJA_WEIGHT,
+		"bluetooth_test_gd_unit":                        DEFAULT_NINJA_WEIGHT,
+		"Bluetooth":                                     DEFAULT_NINJA_WEIGHT,
+		"BluetoothInstrumentationTests":                 DEFAULT_NINJA_WEIGHT,
+		"Calendar":                                      DEFAULT_NINJA_WEIGHT,
+		"CalendarProvider":                              DEFAULT_NINJA_WEIGHT,
+		"Camera2":                                       DEFAULT_NINJA_WEIGHT,
+		"CarRotaryControllerUnitTests":                  DEFAULT_NINJA_WEIGHT,
+		"CarSettingsForUnitTesting":                     DEFAULT_NINJA_WEIGHT,
+		"CarSettingsUnitTests":                          DEFAULT_NINJA_WEIGHT,
+		"CarSystemUI-tests":                             DEFAULT_NINJA_WEIGHT,
+		"CellBroadcastApp":                              DEFAULT_NINJA_WEIGHT,
+		"CellBroadcastLegacyApp":                        DEFAULT_NINJA_WEIGHT,
+		"CellBroadcastReceiverOemUnitTests":             DEFAULT_NINJA_WEIGHT,
+		"CellBroadcastServiceModule":                    DEFAULT_NINJA_WEIGHT,
+		"CompanionDeviceManager":                        DEFAULT_NINJA_WEIGHT,
+		"ConnectivityChecker":                           DEFAULT_NINJA_WEIGHT,
+		"Contacts":                                      DEFAULT_NINJA_WEIGHT,
+		"ContactsProvider":                              DEFAULT_NINJA_WEIGHT,
+		"ContentCapturePerfTests":                       DEFAULT_NINJA_WEIGHT,
+		"CorePerfTests":                                 DEFAULT_NINJA_WEIGHT,
+		"crosvm":                                        DEFAULT_NINJA_WEIGHT,
+		"CtsDomainVerificationDeviceMultiUserTestCases": DEFAULT_NINJA_WEIGHT,
+		"CtsLogdTestCases":                              DEFAULT_NINJA_WEIGHT,
+		"CtsMediaProviderTranscodeTests":                DEFAULT_NINJA_WEIGHT,
+		"CtsRollbackManagerHostTestHelperApp":           DEFAULT_NINJA_WEIGHT,
+		"CtsRollbackManagerHostTestHelperApp2":          DEFAULT_NINJA_WEIGHT,
+		"CtsRootPackageInstallerTestCases":              DEFAULT_NINJA_WEIGHT,
+		"CtsRootRollbackManagerHostTestHelperApp":       DEFAULT_NINJA_WEIGHT,
+		"CtsTranscodeTestAppSupportsHevc":               DEFAULT_NINJA_WEIGHT,
+		"CtsTranscodeTestAppSupportsSlowMotion":         DEFAULT_NINJA_WEIGHT,
+		"CuttlefishDisplayHotplugHelperApp":             DEFAULT_NINJA_WEIGHT,
+		"cvd-host_package":                              DEFAULT_NINJA_WEIGHT,
+		"DelegateTestApp":                               DEFAULT_NINJA_WEIGHT,
+		"DeskClock":                                     DEFAULT_NINJA_WEIGHT,
+		"Development":                                   DEFAULT_NINJA_WEIGHT,
+		"DeviceAdminTestApp":                            DEFAULT_NINJA_WEIGHT,
+		"DevicePolicyManagementRoleHolderTestApp":       DEFAULT_NINJA_WEIGHT,
+		"dex2oatd":                                      DEFAULT_NINJA_WEIGHT,
+		"DocumentsUI":                                   DEFAULT_NINJA_WEIGHT,
+		"EasterEgg":                                     DEFAULT_NINJA_WEIGHT,
+		"EffectProxyTest":                               DEFAULT_NINJA_WEIGHT,
+		"EmergencyInfo":                                 DEFAULT_NINJA_WEIGHT,
+		"EmptyTestApp":                                  DEFAULT_NINJA_WEIGHT,
+		"ExtServices":                                   DEFAULT_NINJA_WEIGHT,
+		"FacebookAppsScenarioTests":                     DEFAULT_NINJA_WEIGHT,
+		"flickerlib-core":                               DEFAULT_NINJA_WEIGHT,
+		"flickerlib":                                    DEFAULT_NINJA_WEIGHT,
+		"FlickerLibTest":                                DEFAULT_NINJA_WEIGHT,
+		"FlickerTests":                                  DEFAULT_NINJA_WEIGHT,
+		"framework-minus-apex":                          DEFAULT_NINJA_WEIGHT,
+		"framework-res":                                 DEFAULT_NINJA_WEIGHT,
+		"FrameworksCoreTests":                           DEFAULT_NINJA_WEIGHT,
+		"FrameworksMockingCoreTests":                    DEFAULT_NINJA_WEIGHT,
+		"FrameworksMockingServicesTests":                DEFAULT_NINJA_WEIGHT,
+		"FrameworksNetSmokeTests":                       DEFAULT_NINJA_WEIGHT,
+		"FrameworksNetTests":                            DEFAULT_NINJA_WEIGHT,
+		"FrameworksServicesTests":                       DEFAULT_NINJA_WEIGHT,
+		"FrameworksTelephonyTests":                      DEFAULT_NINJA_WEIGHT,
+		"FrameworksUiServicesTests":                     DEFAULT_NINJA_WEIGHT,
+		"FrameworksVcnTests":                            DEFAULT_NINJA_WEIGHT,
+		"Gallery2":                                      DEFAULT_NINJA_WEIGHT,
+		"GameCoreDevice":                                DEFAULT_NINJA_WEIGHT,
+		"GoogleBluetoothInstrumentationTests":           DEFAULT_NINJA_WEIGHT,
+		"guice_munged_srcs":                             DEFAULT_NINJA_WEIGHT,
+		"HalfSheetUX":                                   DEFAULT_NINJA_WEIGHT,
+		"ImePerfTests":                                  DEFAULT_NINJA_WEIGHT,
+		"imgdiag":                                       DEFAULT_NINJA_WEIGHT,
+		"ImsServiceEntitlement":                         DEFAULT_NINJA_WEIGHT,
+		"ImsServiceEntitlementUnitTests":                DEFAULT_NINJA_WEIGHT,
+		"InputTests":                                    DEFAULT_NINJA_WEIGHT,
+		"InstallTest":                                   DEFAULT_NINJA_WEIGHT,
+		"IntentResolver":                                DEFAULT_NINJA_WEIGHT,
+		"JankBench":                                     DEFAULT_NINJA_WEIGHT,
+		"jsilver":                                       DEFAULT_NINJA_WEIGHT,
+		"KeyChain":                                      DEFAULT_NINJA_WEIGHT,
+		"KeyChainTests":                                 DEFAULT_NINJA_WEIGHT,
+		"keystore2":                                     DEFAULT_NINJA_WEIGHT,
+		"LargeResourcesCompressed":                      DEFAULT_NINJA_WEIGHT,
+		"LatinIME":                                      DEFAULT_NINJA_WEIGHT,
+		"Launcher3QuickStepLib":                         DEFAULT_NINJA_WEIGHT,
+		"libaom":                                        DEFAULT_NINJA_WEIGHT,
+		"libart-broken":                                 DEFAULT_NINJA_WEIGHT,
+		"libart-compiler":                               DEFAULT_NINJA_WEIGHT,
+		"libart-disassembler":                           DEFAULT_NINJA_WEIGHT,
+		"libart":                                        DEFAULT_NINJA_WEIGHT,
+		"libartd":                                       DEFAULT_NINJA_WEIGHT,
+		"libaudiohal@7.1":                               DEFAULT_NINJA_WEIGHT,
+		"libbluetooth_core_rs":                          DEFAULT_NINJA_WEIGHT,
+		"libbluetooth_gd_unit_tests":                    DEFAULT_NINJA_WEIGHT,
+		"libbluetooth_gd":                               DEFAULT_NINJA_WEIGHT,
+		"libbluetooth_rs":                               DEFAULT_NINJA_WEIGHT,
+		"libbluetooth-for-tests":                        DEFAULT_NINJA_WEIGHT,
+		"libbt_common":                                  DEFAULT_NINJA_WEIGHT,
+		"libbt_packets_nonapex":                         DEFAULT_NINJA_WEIGHT,
+		"libbt_packets":                                 DEFAULT_NINJA_WEIGHT,
+		"libbt_shim_ffi":                                DEFAULT_NINJA_WEIGHT,
+		"libbt_shim":                                    DEFAULT_NINJA_WEIGHT,
+		"libbt-audio-hal-interface":                     DEFAULT_NINJA_WEIGHT,
+		"libbt-bta-core":                                DEFAULT_NINJA_WEIGHT,
+		"libbt-bta":                                     DEFAULT_NINJA_WEIGHT,
+		"libbt-common":                                  DEFAULT_NINJA_WEIGHT,
+		"libbt-hci":                                     DEFAULT_NINJA_WEIGHT,
+		"libbt-platform-protos-lite":                    DEFAULT_NINJA_WEIGHT,
+		"libbt-protos-lite":                             DEFAULT_NINJA_WEIGHT,
+		"libbt-sbc-decoder":                             DEFAULT_NINJA_WEIGHT,
+		"libc":                                          DEFAULT_NINJA_WEIGHT,
+		"libclap":                                       DEFAULT_NINJA_WEIGHT,
+		"libcodec2_soft_av1dec_gav1":                    DEFAULT_NINJA_WEIGHT,
+		"libcompositionengine_test":                     DEFAULT_NINJA_WEIGHT,
+		"libdevices":                                    DEFAULT_NINJA_WEIGHT,
+		"libfrontend_proto":                             DEFAULT_NINJA_WEIGHT,
+		"libhwtrust":                                    DEFAULT_NINJA_WEIGHT,
+		"libjni":                                        DEFAULT_NINJA_WEIGHT,
+		"libkeystore2":                                  DEFAULT_NINJA_WEIGHT,
+		"libkmr_ta":                                     DEFAULT_NINJA_WEIGHT,
+		"liblmp":                                        DEFAULT_NINJA_WEIGHT,
+		"libopenjdkjvmtid":                              DEFAULT_NINJA_WEIGHT,
+		"libprotobuf_deprecated":                        DEFAULT_NINJA_WEIGHT,
+		"libprotobuf":                                   DEFAULT_NINJA_WEIGHT,
+		"libregex":                                      DEFAULT_NINJA_WEIGHT,
+		"LibStatsPullTests":                             DEFAULT_NINJA_WEIGHT,
+		"libstd":                                        DEFAULT_NINJA_WEIGHT,
+		"libsurfaceflinger_unittest":                    DEFAULT_NINJA_WEIGHT,
+		"libsyn":                                        DEFAULT_NINJA_WEIGHT,
+		"libtokio":                                      DEFAULT_NINJA_WEIGHT,
+		"libuwb_core":                                   DEFAULT_NINJA_WEIGHT,
+		"libuwb_uci_jni_rust":                           DEFAULT_NINJA_WEIGHT,
+		"libuwb_uci_packets":                            DEFAULT_NINJA_WEIGHT,
+		"libvpx":                                        DEFAULT_NINJA_WEIGHT,
+		"libvulkan_enc":                                 DEFAULT_NINJA_WEIGHT,
+		"libwebrtc":                                     DEFAULT_NINJA_WEIGHT,
+		"LiveWallpapersPicker":                          DEFAULT_NINJA_WEIGHT,
+		"LockTaskApp":                                   DEFAULT_NINJA_WEIGHT,
+		"LongevityPlatformLibTests":                     DEFAULT_NINJA_WEIGHT,
+		"ManagedProvisioning":                           DEFAULT_NINJA_WEIGHT,
+		"ManagedProvisioningTests":                      DEFAULT_NINJA_WEIGHT,
+		"MediaProvider":                                 DEFAULT_NINJA_WEIGHT,
+		"MediaProviderClientTests":                      DEFAULT_NINJA_WEIGHT,
+		"MediaProviderLegacy":                           DEFAULT_NINJA_WEIGHT,
+		"messaging":                                     DEFAULT_NINJA_WEIGHT,
+		"metalava":                                      DEFAULT_NINJA_WEIGHT,
+		"MicrobenchmarkRunnerTests":                     DEFAULT_NINJA_WEIGHT,
+		"microdroid_manager":                            DEFAULT_NINJA_WEIGHT,
+		"minikin_tests":                                 DEFAULT_NINJA_WEIGHT,
+		"MLCTestApp":                                    DEFAULT_NINJA_WEIGHT,
+		"MmsService":                                    DEFAULT_NINJA_WEIGHT,
+		"MmsServiceTests":                               DEFAULT_NINJA_WEIGHT,
+		"module-lib-api-stubs-docs-non-updatable":       DEFAULT_NINJA_WEIGHT,
+		"motion_tool_lib_tests":                         DEFAULT_NINJA_WEIGHT,
+		"MtpService":                                    DEFAULT_NINJA_WEIGHT,
+		"MultiUserTests":                                DEFAULT_NINJA_WEIGHT,
+		"NearbyIntegrationUiTests":                      DEFAULT_NINJA_WEIGHT,
+		"net_test_bluetooth":                            DEFAULT_NINJA_WEIGHT,
+		"net_test_btif":                                 DEFAULT_NINJA_WEIGHT,
+		"net_test_main_shim":                            DEFAULT_NINJA_WEIGHT,
+		"net_test_stack":                                DEFAULT_NINJA_WEIGHT,
+		"net-tests-utils":                               DEFAULT_NINJA_WEIGHT,
+		"NetworkStackCoverageTests":                     DEFAULT_NINJA_WEIGHT,
+		"NetworkStackIntegrationTests":                  DEFAULT_NINJA_WEIGHT,
+		"NetworkStackNext":                              DEFAULT_NINJA_WEIGHT,
+		"NfcNci":                                        DEFAULT_NINJA_WEIGHT,
+		"NfcNciUnitTests":                               DEFAULT_NINJA_WEIGHT,
+		"NotEmptyTestApp":                               DEFAULT_NINJA_WEIGHT,
+		"NotificationFunctionalTests":                   DEFAULT_NINJA_WEIGHT,
+		"oatdumpd":                                      DEFAULT_NINJA_WEIGHT,
+		"OsuLogin":                                      DEFAULT_NINJA_WEIGHT,
+		"PackageInstaller":                              DEFAULT_NINJA_WEIGHT,
+		"PackageManagerComponentOverrideTests":          DEFAULT_NINJA_WEIGHT,
+		"PackageManagerPerfTests":                       DEFAULT_NINJA_WEIGHT,
+		"PackageManagerServiceServerTests":              DEFAULT_NINJA_WEIGHT,
+		"PackageManagerServiceUnitTests":                DEFAULT_NINJA_WEIGHT,
+		"PackageWatchdogTest":                           DEFAULT_NINJA_WEIGHT,
+		"PandoraServerLib":                              DEFAULT_NINJA_WEIGHT,
+		"pdl":                                           DEFAULT_NINJA_WEIGHT,
+		"perfetto_trace_java_protos":                    DEFAULT_NINJA_WEIGHT,
+		"perfetto_trace-full":                           DEFAULT_NINJA_WEIGHT,
+		"PermissionController":                          DEFAULT_NINJA_WEIGHT,
+		"PermissionControllerMockingTests":              DEFAULT_NINJA_WEIGHT,
+		"PixelAppCompTests":                             DEFAULT_NINJA_WEIGHT,
+		"platform-bootclasspath":                        DEFAULT_NINJA_WEIGHT,
+		"PlatformCommonScenarioTests":                   DEFAULT_NINJA_WEIGHT,
+		"PlatformComposeCoreTests":                      DEFAULT_NINJA_WEIGHT,
+		"platformprotoslite":                            DEFAULT_NINJA_WEIGHT,
+		"PlatformRuleTests":                             DEFAULT_NINJA_WEIGHT,
+		"precompiled_sepolicy-without_apex":             DEFAULT_NINJA_WEIGHT,
+		"PresencePolling":                               DEFAULT_NINJA_WEIGHT,
+		"PrintSpooler":                                  DEFAULT_NINJA_WEIGHT,
+		"QuickSearchBox":                                DEFAULT_NINJA_WEIGHT,
+		"RemoteDPCTestApp":                              DEFAULT_NINJA_WEIGHT,
+		"RemoteProvisioningServiceTests":                DEFAULT_NINJA_WEIGHT,
+		"RkpdAppUnitTests":                              DEFAULT_NINJA_WEIGHT,
+		"Robolectric_shadows_framework":                 DEFAULT_NINJA_WEIGHT,
+		"RoleHolderApp":                                 DEFAULT_NINJA_WEIGHT,
+		"SdkSandbox":                                    DEFAULT_NINJA_WEIGHT,
+		"service-appsearch":                             DEFAULT_NINJA_WEIGHT,
+		"service-connectivity":                          DEFAULT_NINJA_WEIGHT,
+		"service-uwb":                                   DEFAULT_NINJA_WEIGHT,
+		"service-wifi":                                  DEFAULT_NINJA_WEIGHT,
+		"services-non-updatable-stubs":                  DEFAULT_NINJA_WEIGHT,
+		"services":                                      DEFAULT_NINJA_WEIGHT,
+		"Settings-core":                                 DEFAULT_NINJA_WEIGHT,
+		"Settings":                                      DEFAULT_NINJA_WEIGHT,
+		"SettingsIntelligence":                          DEFAULT_NINJA_WEIGHT,
+		"SettingsLibTests":                              DEFAULT_NINJA_WEIGHT,
+		"SettingsProvider":                              DEFAULT_NINJA_WEIGHT,
+		"Shell":                                         DEFAULT_NINJA_WEIGHT,
+		"SimAppDialog":                                  DEFAULT_NINJA_WEIGHT,
+		"sl4a":                                          DEFAULT_NINJA_WEIGHT,
+		"SmsApp":                                        DEFAULT_NINJA_WEIGHT,
+		"SoundPicker":                                   DEFAULT_NINJA_WEIGHT,
+		"StagedInstallTest":                             DEFAULT_NINJA_WEIGHT,
+		"StatementService":                              DEFAULT_NINJA_WEIGHT,
+		"StatsdFrameworkTestApp":                        DEFAULT_NINJA_WEIGHT,
+		"StatsdFrameworkTestAppNoPermission":            DEFAULT_NINJA_WEIGHT,
+		"statsdprotolite":                               DEFAULT_NINJA_WEIGHT,
+		"Stk":                                           DEFAULT_NINJA_WEIGHT,
+		"StorageManager":                                DEFAULT_NINJA_WEIGHT,
+		"system-api-stubs-docs-non-updatable":           DEFAULT_NINJA_WEIGHT,
+		"SystemUI-core":                                 DEFAULT_NINJA_WEIGHT,
+		"SystemUI-tests-base":                           DEFAULT_NINJA_WEIGHT,
+		"SystemUI-tests":                                DEFAULT_NINJA_WEIGHT,
+		"SystemUI":                                      DEFAULT_NINJA_WEIGHT,
+		"SystemUIComposeFeatures":                       DEFAULT_NINJA_WEIGHT,
+		"SystemUIComposeFeaturesTests":                  DEFAULT_NINJA_WEIGHT,
+		"SystemUITests":                                 DEFAULT_NINJA_WEIGHT,
+		"Tag":                                           DEFAULT_NINJA_WEIGHT,
+		"Telecom":                                       DEFAULT_NINJA_WEIGHT,
+		"TelecomUnitTests":                              DEFAULT_NINJA_WEIGHT,
+		"telephony-common":                              DEFAULT_NINJA_WEIGHT,
+		"TelephonyProvider":                             DEFAULT_NINJA_WEIGHT,
+		"TeleService":                                   DEFAULT_NINJA_WEIGHT,
+		"test-api-stubs-docs-non-updatable":             DEFAULT_NINJA_WEIGHT,
+		"TetheringIntegrationTests":                     DEFAULT_NINJA_WEIGHT,
+		"TetheringNext":                                 DEFAULT_NINJA_WEIGHT,
+		"ThemePickerTests":                              DEFAULT_NINJA_WEIGHT,
+		"Traceur":                                       DEFAULT_NINJA_WEIGHT,
+		"UsbManagerTests":                               DEFAULT_NINJA_WEIGHT,
+		"UsbTests":                                      DEFAULT_NINJA_WEIGHT,
+		"virtmgr":                                       DEFAULT_NINJA_WEIGHT,
+		"WallpaperPicker2TestLib":                       DEFAULT_NINJA_WEIGHT,
+		"WallpaperPicker2Tests":                         DEFAULT_NINJA_WEIGHT,
+		"WifiDialog":                                    DEFAULT_NINJA_WEIGHT,
+		"wm-proto-parsers":                              DEFAULT_NINJA_WEIGHT,
+		"WMShellFlickerTests":                           DEFAULT_NINJA_WEIGHT,
+		"WmTests":                                       DEFAULT_NINJA_WEIGHT,
+		"wpa_supplicant":                                DEFAULT_NINJA_WEIGHT,
 	}
 )
diff --git a/android/api_levels.go b/android/api_levels.go
index 0c0b2b4..ea2afdf 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -466,7 +466,7 @@
 	// https://cs.android.com/android/platform/superproject/+/master:build/bazel/rules/common/api.bzl;l=23;drc=231c7e8c8038fd478a79eb68aa5b9f5c64e0e061
 	return config.Once(apiLevelsMapKey, func() interface{} {
 		apiLevelsMap := getApiLevelsMapReleasedVersions()
-		for i, codename := range config.PlatformVersionActiveCodenames() {
+		for i, codename := range config.PlatformVersionAllPreviewCodenames() {
 			apiLevelsMap[codename] = previewAPILevelBase + i
 		}
 
diff --git a/android/config.go b/android/config.go
index e0b661b..33deba5 100644
--- a/android/config.go
+++ b/android/config.go
@@ -100,6 +100,8 @@
 	BazelForceEnabledModules string
 
 	UseBazelProxy bool
+
+	BuildFromTextStub bool
 }
 
 // Build modes that soong_build can run as.
@@ -272,6 +274,10 @@
 	// If true, for any requests to Bazel, communicate with a Bazel proxy using
 	// unix sockets, instead of spawning Bazel as a subprocess.
 	UseBazelProxy bool
+
+	// If buildFromTextStub is true then the Java API stubs are
+	// built from the signature text files, not the source Java files.
+	buildFromTextStub bool
 }
 
 type deviceConfig struct {
@@ -466,6 +472,8 @@
 
 		MultitreeBuild: cmdArgs.MultitreeBuild,
 		UseBazelProxy:  cmdArgs.UseBazelProxy,
+
+		buildFromTextStub: cmdArgs.BuildFromTextStub,
 	}
 
 	config.deviceConfig = &deviceConfig{
@@ -923,6 +931,11 @@
 	return c.productVariables.Platform_version_active_codenames
 }
 
+// All unreleased codenames.
+func (c *config) PlatformVersionAllPreviewCodenames() []string {
+	return c.productVariables.Platform_version_all_preview_codenames
+}
+
 func (c *config) ProductAAPTConfig() []string {
 	return c.productVariables.AAPTConfig
 }
@@ -1179,6 +1192,10 @@
 	return append([]string(nil), c.productVariables.NamespacesToExport...)
 }
 
+func (c *config) SourceRootDirs() []string {
+	return c.productVariables.SourceRootDirs
+}
+
 func (c *config) IncludeTags() []string {
 	return c.productVariables.IncludeTags
 }
@@ -1873,3 +1890,7 @@
 		s.String(),
 		version)
 }
+
+func (c *config) BuildFromTextStub() bool {
+	return c.buildFromTextStub
+}
diff --git a/android/namespace.go b/android/namespace.go
index b43ffdf..f357ca7 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -225,6 +225,10 @@
 	return ns, nil
 }
 
+func (r *NameResolver) NewSkippedModule(ctx blueprint.NamespaceContext, name string, skipInfo blueprint.SkippedModuleInfo) {
+	r.rootNamespace.moduleContainer.NewSkippedModule(ctx, name, skipInfo)
+}
+
 func (r *NameResolver) AllModules() []blueprint.ModuleGroup {
 	childLists := [][]blueprint.ModuleGroup{}
 	totalCount := 0
@@ -300,7 +304,7 @@
 	for _, name := range namespace.importedNamespaceNames {
 		imp, ok := r.namespaceAt(name)
 		if !ok {
-			return fmt.Errorf("namespace %v does not exist", name)
+			return fmt.Errorf("namespace %v does not exist; Some necessary modules may have been skipped by Soong. Check if PRODUCT_SOURCE_ROOT_DIRS is pruning necessary Android.bp files.", name)
 		}
 		namespace.visibleNamespaces = append(namespace.visibleNamespaces, imp)
 	}
diff --git a/android/register.go b/android/register.go
index 9a3d3aa..1a3db9d 100644
--- a/android/register.go
+++ b/android/register.go
@@ -162,6 +162,7 @@
 	ctx := &Context{blueprint.NewContext(), config}
 	ctx.SetSrcDir(absSrcDir)
 	ctx.AddIncludeTags(config.IncludeTags()...)
+	ctx.AddSourceRootDirs(config.SourceRootDirs()...)
 	return ctx
 }
 
diff --git a/android/sdk_version.go b/android/sdk_version.go
index 1192f7d..5bb1e5a 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -94,8 +94,9 @@
 // not check if either module exists.
 // TODO: Return .txt (single-tree or multi-tree equivalents) based on config
 func JavaLibraryNameFromText(c Config, name string) string {
-	// This returns the default for now.
-	// TODO: Implement this
+	if c.BuildFromTextStub() {
+		return name + ".from-text"
+	}
 	return name
 }
 
diff --git a/android/variable.go b/android/variable.go
index 8c5c0bc..1da5974 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -199,6 +199,7 @@
 	Platform_sdk_extension_version            *int     `json:",omitempty"`
 	Platform_base_sdk_extension_version       *int     `json:",omitempty"`
 	Platform_version_active_codenames         []string `json:",omitempty"`
+	Platform_version_all_preview_codenames    []string `json:",omitempty"`
 	Platform_vndk_version                     *string  `json:",omitempty"`
 	Platform_systemsdk_versions               []string `json:",omitempty"`
 	Platform_security_patch                   *string  `json:",omitempty"`
@@ -461,7 +462,8 @@
 
 	IgnorePrefer32OnDevice bool `json:",omitempty"`
 
-	IncludeTags []string `json:",omitempty"`
+	IncludeTags    []string `json:",omitempty"`
+	SourceRootDirs []string `json:",omitempty"`
 }
 
 func boolPtr(v bool) *bool {
@@ -480,13 +482,14 @@
 	*v = productVariables{
 		BuildNumberFile: stringPtr("build_number.txt"),
 
-		Platform_version_name:               stringPtr("S"),
-		Platform_base_sdk_extension_version: intPtr(30),
-		Platform_sdk_version:                intPtr(30),
-		Platform_sdk_codename:               stringPtr("S"),
-		Platform_sdk_final:                  boolPtr(false),
-		Platform_version_active_codenames:   []string{"S"},
-		Platform_vndk_version:               stringPtr("S"),
+		Platform_version_name:                  stringPtr("S"),
+		Platform_base_sdk_extension_version:    intPtr(30),
+		Platform_sdk_version:                   intPtr(30),
+		Platform_sdk_codename:                  stringPtr("S"),
+		Platform_sdk_final:                     boolPtr(false),
+		Platform_version_active_codenames:      []string{"S"},
+		Platform_version_all_preview_codenames: []string{"S"},
+		Platform_vndk_version:                  stringPtr("S"),
 
 		HostArch:                   stringPtr("x86_64"),
 		HostSecondaryArch:          stringPtr("x86"),
diff --git a/apex/apex.go b/apex/apex.go
index 5c19dc8..3678636 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -103,12 +103,13 @@
 	// to avoid mistakes. When set as true, no force-labelling.
 	Use_file_contexts_as_is *bool
 
-	// Path to the canned fs config file for customizing file's uid/gid/mod/capabilities. The
-	// format is /<path_or_glob> <uid> <gid> <mode> [capabilities=0x<cap>], where path_or_glob is a
-	// path or glob pattern for a file or set of files, uid/gid are numerial values of user ID
-	// and group ID, mode is octal value for the file mode, and cap is hexadecimal value for the
-	// capability. If this property is not set, or a file is missing in the file, default config
-	// is used.
+	// Path to the canned fs config file for customizing file's
+	// uid/gid/mod/capabilities. The content of this file is appended to the
+	// default config, so that the custom entries are preferred. The format is
+	// /<path_or_glob> <uid> <gid> <mode> [capabilities=0x<cap>], where
+	// path_or_glob is a path or glob pattern for a file or set of files,
+	// uid/gid are numerial values of user ID and group ID, mode is octal value
+	// for the file mode, and cap is hexadecimal value for the capability.
 	Canned_fs_config *string `android:"path"`
 
 	ApexNativeDependencies
@@ -3518,6 +3519,7 @@
 	Manifest              bazel.LabelAttribute
 	Android_manifest      bazel.LabelAttribute
 	File_contexts         bazel.LabelAttribute
+	Canned_fs_config      bazel.LabelAttribute
 	Key                   bazel.LabelAttribute
 	Certificate           bazel.LabelAttribute  // used when the certificate prop is a module
 	Certificate_name      bazel.StringAttribute // used when the certificate prop is a string
@@ -3577,6 +3579,11 @@
 		fileContextsLabelAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, *a.properties.File_contexts))
 	}
 
+	var cannedFsConfigAttribute bazel.LabelAttribute
+	if a.properties.Canned_fs_config != nil {
+		cannedFsConfigAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, *a.properties.Canned_fs_config))
+	}
+
 	productVariableProps := android.ProductVariableProperties(ctx, a)
 	// TODO(b/219503907) this would need to be set to a.MinSdkVersionValue(ctx) but
 	// given it's coming via config, we probably don't want to put it in here.
@@ -3663,6 +3670,7 @@
 		Manifest:              manifestLabelAttribute,
 		Android_manifest:      androidManifestLabelAttribute,
 		File_contexts:         fileContextsLabelAttribute,
+		Canned_fs_config:      cannedFsConfigAttribute,
 		Min_sdk_version:       minSdkVersion,
 		Key:                   keyLabelAttribute,
 		Certificate:           certificate,
diff --git a/apex/apex_test.go b/apex/apex_test.go
index c9665a4..05c888a 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -10105,3 +10105,45 @@
 	android.AssertStringDoesContain(t, "missing lib to trim", libs_to_trim, "libbar")
 	android.AssertStringDoesNotContain(t, "unexpected libs in the libs to trim", libs_to_trim, "libbaz")
 }
+
+func TestCannedFsConfig(t *testing.T) {
+	ctx := testApex(t, `
+		apex {
+			name: "myapex",
+			key: "myapex.key",
+			updatable: false,
+		}
+
+		apex_key {
+			name: "myapex.key",
+			public_key: "testkey.avbpubkey",
+			private_key: "testkey.pem",
+		}`)
+	mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
+	generateFsRule := mod.Rule("generateFsConfig")
+	cmd := generateFsRule.RuleParams.Command
+
+	ensureContains(t, cmd, `( echo '/ 1000 1000 0755'; echo '/apex_manifest.json 1000 1000 0644'; echo '/apex_manifest.pb 1000 1000 0644'; ) >`)
+}
+
+func TestCannedFsConfig_HasCustomConfig(t *testing.T) {
+	ctx := testApex(t, `
+		apex {
+			name: "myapex",
+			key: "myapex.key",
+			canned_fs_config: "my_config",
+			updatable: false,
+		}
+
+		apex_key {
+			name: "myapex.key",
+			public_key: "testkey.avbpubkey",
+			private_key: "testkey.pem",
+		}`)
+	mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
+	generateFsRule := mod.Rule("generateFsConfig")
+	cmd := generateFsRule.RuleParams.Command
+
+	// Ensure that canned_fs_config has "cat my_config" at the end
+	ensureContains(t, cmd, `( echo '/ 1000 1000 0755'; echo '/apex_manifest.json 1000 1000 0644'; echo '/apex_manifest.pb 1000 1000 0644'; cat my_config ) >`)
+}
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go
index 250db7f..1cc3f22 100644
--- a/bp2build/apex_conversion_test.go
+++ b/bp2build/apex_conversion_test.go
@@ -1566,3 +1566,25 @@
 			}),
 		}})
 }
+
+func TestApexBundleSimple_customCannedFsConfig(t *testing.T) {
+	runApexTestCase(t, Bp2buildTestCase{
+		Description:                "apex - custom canned_fs_config",
+		ModuleTypeUnderTest:        "apex",
+		ModuleTypeUnderTestFactory: apex.BundleFactory,
+		Filesystem:                 map[string]string{},
+		Blueprint: `
+apex {
+	name: "com.android.apogee",
+	canned_fs_config: "custom.canned_fs_config",
+	file_contexts: "file_contexts_file",
+}
+`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("apex", "com.android.apogee", AttrNameToString{
+				"canned_fs_config": `"custom.canned_fs_config"`,
+				"file_contexts":    `"file_contexts_file"`,
+				"manifest":         `"apex_manifest.json"`,
+			}),
+		}})
+}
diff --git a/cc/config/global.go b/cc/config/global.go
index 3eb4577..5b2191a 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -239,7 +239,6 @@
 		"-Wno-error=deprecated",          // in external/googletest/googletest
 		// New warnings to be fixed after clang-r475365
 		"-Wno-error=single-bit-bitfield-constant-conversion", // http://b/243965903
-		"-Wno-error=incompatible-function-pointer-types",     // http://b/257101299
 		"-Wno-error=enum-constexpr-conversion",               // http://b/243964282
 	}
 
@@ -249,6 +248,7 @@
 		// http://b/191699019
 		"-Wno-format-insufficient-args",
 		"-Wno-sizeof-array-div",
+		"-Wno-incompatible-function-pointer-types",
 		"-Wno-unused-but-set-variable",
 		"-Wno-unused-but-set-parameter",
 		"-Wno-unqualified-std-cast-call",
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index 70e9fe4..35c57f9 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -28,7 +28,6 @@
 		"-fno-emulated-tls",
 		// For -fsanitize=shadow-call-stack.
 		"-ffixed-x18",
-		"-march=rv64gc_zbb",
 	}
 
 	riscv64ArchVariantCflags = map[string][]string{}
@@ -37,7 +36,6 @@
 		"-Wl,--hash-style=gnu",
 		// For -fsanitize=shadow-call-stack.
 		"-ffixed-x18",
-		"-march=rv64gc_zbb",
 	}
 
 	riscv64Lldflags = append(riscv64Ldflags,
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 052832d..6a10e14 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -212,6 +212,14 @@
 	return LibclangRuntimeLibrary(t, "asan")
 }
 
+func AddressSanitizerStaticRuntimeLibrary(t Toolchain) string {
+	return LibclangRuntimeLibrary(t, "asan.static")
+}
+
+func AddressSanitizerCXXStaticRuntimeLibrary(t Toolchain) string {
+	return LibclangRuntimeLibrary(t, "asan_cxx.static")
+}
+
 func HWAddressSanitizerRuntimeLibrary(t Toolchain) string {
 	return LibclangRuntimeLibrary(t, "hwasan")
 }
diff --git a/cc/ndk_prebuilt.go b/cc/ndk_prebuilt.go
index 51ec6b8..1d15cf8 100644
--- a/cc/ndk_prebuilt.go
+++ b/cc/ndk_prebuilt.go
@@ -15,15 +15,12 @@
 package cc
 
 import (
-	"fmt"
 	"strings"
 
 	"android/soong/android"
-	"android/soong/cc/config"
 )
 
 func init() {
-	android.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory)
 	android.RegisterModuleType("ndk_prebuilt_static_stl", NdkPrebuiltStaticStlFactory)
 	android.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory)
 }
@@ -34,68 +31,6 @@
 // either (with the exception of the shared STLs, which are installed to the app's directory rather
 // than to the system image).
 
-func getNdkLibDir(ctx android.ModuleContext, toolchain config.Toolchain, version string) android.SourcePath {
-	suffix := ""
-	// Most 64-bit NDK prebuilts store libraries in "lib64", except for arm64 which is not a
-	// multilib toolchain and stores the libraries in "lib".
-	if toolchain.Is64Bit() && ctx.Arch().ArchType != android.Arm64 {
-		suffix = "64"
-	}
-	return android.PathForSource(ctx, fmt.Sprintf("prebuilts/ndk/current/platforms/android-%s/arch-%s/usr/lib%s",
-		version, toolchain.Name(), suffix))
-}
-
-func ndkPrebuiltModuleToPath(ctx android.ModuleContext, toolchain config.Toolchain,
-	ext string, version string) android.Path {
-
-	// NDK prebuilts are named like: ndk_NAME.EXT.SDK_VERSION.
-	// We want to translate to just NAME.EXT
-	name := strings.Split(strings.TrimPrefix(ctx.ModuleName(), "ndk_"), ".")[0]
-	dir := getNdkLibDir(ctx, toolchain, version)
-	return dir.Join(ctx, name+ext)
-}
-
-type ndkPrebuiltObjectLinker struct {
-	objectLinker
-}
-
-func (*ndkPrebuiltObjectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
-	// NDK objects can't have any dependencies
-	return deps
-}
-
-// ndk_prebuilt_object exports a precompiled ndk object file for linking
-// operations. Soong's module name format is ndk_<NAME>.o.<sdk_version> where
-// the object is located under
-// ./prebuilts/ndk/current/platforms/android-<sdk_version>/arch-$(HOST_ARCH)/usr/lib/<NAME>.o.
-func NdkPrebuiltObjectFactory() android.Module {
-	module := newBaseModule(android.DeviceSupported, android.MultilibBoth)
-	module.linker = &ndkPrebuiltObjectLinker{
-		objectLinker: objectLinker{
-			baseLinker: NewBaseLinker(nil),
-		},
-	}
-	module.Properties.AlwaysSdk = true
-	module.Properties.Sdk_version = StringPtr("current")
-	module.Properties.HideFromMake = true
-	return module.Init()
-}
-
-func (c *ndkPrebuiltObjectLinker) link(ctx ModuleContext, flags Flags,
-	deps PathDeps, objs Objects) android.Path {
-	// A null build step, but it sets up the output path.
-	if !strings.HasPrefix(ctx.ModuleName(), "ndk_crt") {
-		ctx.ModuleErrorf("NDK prebuilt objects must have an ndk_crt prefixed name")
-	}
-
-	return ndkPrebuiltModuleToPath(ctx, flags.Toolchain, objectExtension, ctx.sdkVersion())
-}
-
-func (*ndkPrebuiltObjectLinker) availableFor(what string) bool {
-	// ndk prebuilt objects are available to everywhere
-	return true
-}
-
 type ndkPrebuiltStlLinker struct {
 	*libraryDecorator
 }
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index 5b7ba43..4470f54 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -16,7 +16,6 @@
 
 import (
 	"path/filepath"
-	"strings"
 
 	"android/soong/android"
 	"android/soong/bazel"
@@ -208,12 +207,13 @@
 			})
 
 			// TODO(b/220898484): Mainline module sdk prebuilts of stub libraries use a stub
-			// library as their source and must not be installed, but libclang_rt.* libraries
-			// have stubs because they are LLNDK libraries, but use an implementation library
-			// as their source and need to be installed.  This discrepancy should be resolved
-			// without the prefix hack below.
-			if p.hasStubsVariants() && !p.buildStubs() && !ctx.Host() &&
-				!strings.HasPrefix(ctx.baseModuleName(), "libclang_rt.") {
+			// library as their source and must not be installed, but other prebuilts like
+			// libclang_rt.* libraries set `stubs` property because they are LLNDK libraries,
+			// but use an implementation library as their source and need to be installed.
+			// This discrepancy should be resolved without the prefix hack below.
+			isModuleSdkPrebuilts := android.HasAnyPrefix(ctx.ModuleDir(), []string{
+				"prebuilts/runtime/mainline/", "prebuilts/module_sdk/"})
+			if p.hasStubsVariants() && !p.buildStubs() && !ctx.Host() && isModuleSdkPrebuilts {
 				ctx.Module().MakeUninstallable()
 			}
 
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index e3ec9d5..0c79e55 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -670,11 +670,15 @@
 }
 
 func TestPrebuiltStubNoinstall(t *testing.T) {
-	testFunc := func(t *testing.T, bp string) {
+	testFunc := func(t *testing.T, expectLibfooOnSystemLib bool, fs android.MockFS) {
 		result := android.GroupFixturePreparers(
 			prepareForPrebuiltTest,
 			android.PrepareForTestWithMakevars,
-		).RunTestWithBp(t, bp)
+			android.FixtureMergeMockFs(fs),
+		).RunTest(t)
+
+		ldRule := result.ModuleForTests("installedlib", "android_arm64_armv8-a_shared").Rule("ld")
+		android.AssertStringDoesContain(t, "", ldRule.Args["libFlags"], "android_arm64_armv8-a_shared/libfoo.so")
 
 		installRules := result.InstallMakeRulesForTesting(t)
 		var installedlibRule *android.InstallMakeRule
@@ -691,50 +695,83 @@
 			return
 		}
 
-		android.AssertStringListDoesNotContain(t,
-			"installedlib has install dependency on stub",
-			installedlibRule.Deps,
-			"out/target/product/test_device/system/lib/stublib.so")
-		android.AssertStringListDoesNotContain(t,
-			"installedlib has order-only install dependency on stub",
-			installedlibRule.OrderOnlyDeps,
-			"out/target/product/test_device/system/lib/stublib.so")
+		if expectLibfooOnSystemLib {
+			android.AssertStringListContains(t,
+				"installedlib doesn't have install dependency on libfoo impl",
+				installedlibRule.OrderOnlyDeps,
+				"out/target/product/test_device/system/lib/libfoo.so")
+		} else {
+			android.AssertStringListDoesNotContain(t,
+				"installedlib has install dependency on libfoo stub",
+				installedlibRule.Deps,
+				"out/target/product/test_device/system/lib/libfoo.so")
+			android.AssertStringListDoesNotContain(t,
+				"installedlib has order-only install dependency on libfoo stub",
+				installedlibRule.OrderOnlyDeps,
+				"out/target/product/test_device/system/lib/libfoo.so")
+		}
 	}
 
-	const prebuiltStublibBp = `
+	prebuiltLibfooBp := []byte(`
 		cc_prebuilt_library {
-			name: "stublib",
+			name: "libfoo",
 			prefer: true,
-			srcs: ["foo.so"],
+			srcs: ["libfoo.so"],
 			stubs: {
 				versions: ["1"],
 			},
 		}
-	`
+	`)
 
-	const installedlibBp = `
+	installedlibBp := []byte(`
 		cc_library {
 			name: "installedlib",
-			shared_libs: ["stublib"],
+			shared_libs: ["libfoo"],
 		}
-	`
+	`)
 
-	t.Run("prebuilt without source", func(t *testing.T) {
-		testFunc(t, prebuiltStublibBp+installedlibBp)
+	t.Run("prebuilt stub (without source): no install", func(t *testing.T) {
+		testFunc(
+			t,
+			/*expectLibfooOnSystemLib=*/ false,
+			android.MockFS{
+				"prebuilts/module_sdk/art/current/Android.bp": prebuiltLibfooBp,
+				"Android.bp": installedlibBp,
+			},
+		)
 	})
 
-	const disabledSourceStublibBp = `
+	disabledSourceLibfooBp := []byte(`
 		cc_library {
-			name: "stublib",
+			name: "libfoo",
 			enabled: false,
 			stubs: {
 				versions: ["1"],
 			},
 		}
-	`
+	`)
 
-	t.Run("prebuilt with disabled source", func(t *testing.T) {
-		testFunc(t, disabledSourceStublibBp+prebuiltStublibBp+installedlibBp)
+	t.Run("prebuilt stub (with disabled source): no install", func(t *testing.T) {
+		testFunc(
+			t,
+			/*expectLibfooOnSystemLib=*/ false,
+			android.MockFS{
+				"prebuilts/module_sdk/art/current/Android.bp": prebuiltLibfooBp,
+				"impl/Android.bp": disabledSourceLibfooBp,
+				"Android.bp":      installedlibBp,
+			},
+		)
+	})
+
+	t.Run("prebuilt impl (with `stubs` property set): install", func(t *testing.T) {
+		testFunc(
+			t,
+			/*expectLibfooOnSystemLib=*/ true,
+			android.MockFS{
+				"impl/Android.bp": prebuiltLibfooBp,
+				"Android.bp":      installedlibBp,
+			},
+		)
 	})
 }
 
diff --git a/cc/sanitize.go b/cc/sanitize.go
index cc81d0e..f19659c 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1530,56 +1530,15 @@
 			diagSanitizers = sanitizers
 		}
 
-		// Determine the runtime library required
-		runtimeLibrary := ""
-		alwaysStaticRuntime := false
-		var extraStaticDeps []string
-		toolchain := c.toolchain(mctx)
-		if Bool(sanProps.Address) {
-			runtimeLibrary = config.AddressSanitizerRuntimeLibrary(toolchain)
-		} else if Bool(sanProps.Hwaddress) {
-			if c.staticBinary() {
-				runtimeLibrary = config.HWAddressSanitizerStaticLibrary(toolchain)
-				extraStaticDeps = []string{"libdl"}
-			} else {
-				runtimeLibrary = config.HWAddressSanitizerRuntimeLibrary(toolchain)
-			}
-		} else if Bool(sanProps.Thread) {
-			runtimeLibrary = config.ThreadSanitizerRuntimeLibrary(toolchain)
-		} else if Bool(sanProps.Scudo) {
-			if len(diagSanitizers) == 0 && !c.sanitize.Properties.UbsanRuntimeDep {
-				runtimeLibrary = config.ScudoMinimalRuntimeLibrary(toolchain)
-			} else {
-				runtimeLibrary = config.ScudoRuntimeLibrary(toolchain)
-			}
-		} else if len(diagSanitizers) > 0 || c.sanitize.Properties.UbsanRuntimeDep ||
-			Bool(sanProps.Fuzzer) ||
-			Bool(sanProps.Undefined) ||
-			Bool(sanProps.All_undefined) {
-			runtimeLibrary = config.UndefinedBehaviorSanitizerRuntimeLibrary(toolchain)
-			if c.staticBinary() || toolchain.Musl() {
-				// Use a static runtime for static binaries.
-				// Also use a static runtime for musl to match
-				// what clang does for glibc.  Otherwise dlopening
-				// libraries that depend on libclang_rt.ubsan_standalone.so
-				// fails with:
-				// Error relocating ...: initial-exec TLS resolves to dynamic definition
-				runtimeLibrary += ".static"
-				alwaysStaticRuntime = true
-			}
-		}
-
-		addStaticDeps := func(deps ...string) {
+		addStaticDeps := func(dep string, hideSymbols bool) {
 			// If we're using snapshots, redirect to snapshot whenever possible
 			snapshot := mctx.Provider(SnapshotInfoProvider).(SnapshotInfo)
-			for idx, dep := range deps {
-				if lib, ok := snapshot.StaticLibs[dep]; ok {
-					deps[idx] = lib
-				}
+			if lib, ok := snapshot.StaticLibs[dep]; ok {
+				dep = lib
 			}
 
 			// static executable gets static runtime libs
-			depTag := libraryDependencyTag{Kind: staticLibraryDependency, unexportedSymbols: true}
+			depTag := libraryDependencyTag{Kind: staticLibraryDependency, unexportedSymbols: hideSymbols}
 			variations := append(mctx.Target().Variations(),
 				blueprint.Variation{Mutator: "link", Variation: "static"})
 			if c.Device() {
@@ -1589,17 +1548,60 @@
 				variations = append(variations,
 					blueprint.Variation{Mutator: "sdk", Variation: "sdk"})
 			}
-			mctx.AddFarVariationDependencies(variations, depTag, deps...)
-
+			mctx.AddFarVariationDependencies(variations, depTag, dep)
 		}
+
+		// Determine the runtime library required
+		runtimeSharedLibrary := ""
+		toolchain := c.toolchain(mctx)
+		if Bool(sanProps.Address) {
+			if toolchain.Musl() || (c.staticBinary() && toolchain.Bionic()) {
+				// Use a static runtime for musl to match what clang does for glibc.
+				addStaticDeps(config.AddressSanitizerStaticRuntimeLibrary(toolchain), false)
+				addStaticDeps(config.AddressSanitizerCXXStaticRuntimeLibrary(toolchain), false)
+			} else {
+				runtimeSharedLibrary = config.AddressSanitizerRuntimeLibrary(toolchain)
+			}
+		} else if Bool(sanProps.Hwaddress) {
+			if c.staticBinary() {
+				addStaticDeps(config.HWAddressSanitizerStaticLibrary(toolchain), true)
+				addStaticDeps("libdl", false)
+			} else {
+				runtimeSharedLibrary = config.HWAddressSanitizerRuntimeLibrary(toolchain)
+			}
+		} else if Bool(sanProps.Thread) {
+			runtimeSharedLibrary = config.ThreadSanitizerRuntimeLibrary(toolchain)
+		} else if Bool(sanProps.Scudo) {
+			if len(diagSanitizers) == 0 && !c.sanitize.Properties.UbsanRuntimeDep {
+				runtimeSharedLibrary = config.ScudoMinimalRuntimeLibrary(toolchain)
+			} else {
+				runtimeSharedLibrary = config.ScudoRuntimeLibrary(toolchain)
+			}
+		} else if len(diagSanitizers) > 0 || c.sanitize.Properties.UbsanRuntimeDep ||
+			Bool(sanProps.Fuzzer) ||
+			Bool(sanProps.Undefined) ||
+			Bool(sanProps.All_undefined) {
+			if toolchain.Musl() || (c.staticBinary() && toolchain.Bionic()) {
+				// Use a static runtime for static binaries.
+				// Also use a static runtime for musl to match
+				// what clang does for glibc.  Otherwise dlopening
+				// libraries that depend on libclang_rt.ubsan_standalone.so
+				// fails with:
+				// Error relocating ...: initial-exec TLS resolves to dynamic definition
+				addStaticDeps(config.UndefinedBehaviorSanitizerRuntimeLibrary(toolchain)+".static", true)
+			} else {
+				runtimeSharedLibrary = config.UndefinedBehaviorSanitizerRuntimeLibrary(toolchain)
+			}
+		}
+
 		if enableMinimalRuntime(c.sanitize) || c.sanitize.Properties.MinimalRuntimeDep {
-			addStaticDeps(config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(toolchain))
+			addStaticDeps(config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(toolchain), true)
 		}
 		if c.sanitize.Properties.BuiltinsDep {
-			addStaticDeps(config.BuiltinsRuntimeLibrary(toolchain))
+			addStaticDeps(config.BuiltinsRuntimeLibrary(toolchain), true)
 		}
 
-		if runtimeLibrary != "" && (toolchain.Bionic() || toolchain.Musl() || c.sanitize.Properties.UbsanRuntimeDep) {
+		if runtimeSharedLibrary != "" && (toolchain.Bionic() || toolchain.Musl() || c.sanitize.Properties.UbsanRuntimeDep) {
 			// UBSan is supported on non-bionic linux host builds as well
 
 			// Adding dependency to the runtime library. We are using *FarVariation*
@@ -1609,14 +1611,17 @@
 			//
 			// Note that by adding dependency with {static|shared}DepTag, the lib is
 			// added to libFlags and LOCAL_SHARED_LIBRARIES by cc.Module
-			if c.staticBinary() || alwaysStaticRuntime {
-				addStaticDeps(runtimeLibrary)
-				addStaticDeps(extraStaticDeps...)
+			if c.staticBinary() {
+				// Most sanitizers are either disabled for static binaries or have already
+				// handled the static binary case above through a direct call to addStaticDeps.
+				// If not, treat the runtime shared library as a static library and hope for
+				// the best.
+				addStaticDeps(runtimeSharedLibrary, true)
 			} else if !c.static() && !c.Header() {
 				// If we're using snapshots, redirect to snapshot whenever possible
 				snapshot := mctx.Provider(SnapshotInfoProvider).(SnapshotInfo)
-				if lib, ok := snapshot.SharedLibs[runtimeLibrary]; ok {
-					runtimeLibrary = lib
+				if lib, ok := snapshot.SharedLibs[runtimeSharedLibrary]; ok {
+					runtimeSharedLibrary = lib
 				}
 
 				// Skip apex dependency check for sharedLibraryDependency
@@ -1640,7 +1645,7 @@
 					variations = append(variations,
 						blueprint.Variation{Mutator: "sdk", Variation: "sdk"})
 				}
-				AddSharedLibDependenciesWithVersions(mctx, c, variations, depTag, runtimeLibrary, "", true)
+				AddSharedLibDependenciesWithVersions(mctx, c, variations, depTag, runtimeSharedLibrary, "", true)
 			}
 			// static lib does not have dependency to the runtime library. The
 			// dependency will be added to the executables or shared libs using
diff --git a/cc/sanitize_test.go b/cc/sanitize_test.go
index 71c5a22..718186d 100644
--- a/cc/sanitize_test.go
+++ b/cc/sanitize_test.go
@@ -127,6 +127,7 @@
 const (
 	RUNTIME_LINKAGE_NONE   = expectedRuntimeLinkage(0)
 	RUNTIME_LINKAGE_SHARED = iota
+	RUNTIME_LINKAGE_STATIC
 )
 
 func TestAsan(t *testing.T) {
@@ -245,6 +246,8 @@
 		libStaticAsanNoAsanVariant := result.ModuleForTests("libstatic_asan", staticVariant)
 
 		libAsanSharedRuntime := result.ModuleForTests("libclang_rt.asan", sharedVariant)
+		libAsanStaticRuntime := result.ModuleForTests("libclang_rt.asan.static", staticVariant)
+		libAsanStaticCxxRuntime := result.ModuleForTests("libclang_rt.asan_cxx.static", staticVariant)
 
 		expectSharedLinkDep(t, ctx, binWithAsan, libShared)
 		expectSharedLinkDep(t, ctx, binWithAsan, libAsan)
@@ -289,12 +292,38 @@
 			expectNoSharedLinkDep(t, ctx, libShared, libAsanSharedRuntime)
 			expectNoSharedLinkDep(t, ctx, libTransitive, libAsanSharedRuntime)
 		}
+
+		if runtimeLinkage == RUNTIME_LINKAGE_STATIC {
+			expectStaticLinkDep(t, ctx, binWithAsan, libAsanStaticRuntime)
+			expectNoStaticLinkDep(t, ctx, binNoAsan, libAsanStaticRuntime)
+			expectStaticLinkDep(t, ctx, libAsan, libAsanStaticRuntime)
+			expectNoStaticLinkDep(t, ctx, libShared, libAsanStaticRuntime)
+			expectNoStaticLinkDep(t, ctx, libTransitive, libAsanStaticRuntime)
+
+			expectStaticLinkDep(t, ctx, binWithAsan, libAsanStaticCxxRuntime)
+			expectNoStaticLinkDep(t, ctx, binNoAsan, libAsanStaticCxxRuntime)
+			expectStaticLinkDep(t, ctx, libAsan, libAsanStaticCxxRuntime)
+			expectNoStaticLinkDep(t, ctx, libShared, libAsanStaticCxxRuntime)
+			expectNoStaticLinkDep(t, ctx, libTransitive, libAsanStaticCxxRuntime)
+		} else {
+			expectNoStaticLinkDep(t, ctx, binWithAsan, libAsanStaticRuntime)
+			expectNoStaticLinkDep(t, ctx, binNoAsan, libAsanStaticRuntime)
+			expectNoStaticLinkDep(t, ctx, libAsan, libAsanStaticRuntime)
+			expectNoStaticLinkDep(t, ctx, libShared, libAsanStaticRuntime)
+			expectNoStaticLinkDep(t, ctx, libTransitive, libAsanStaticRuntime)
+
+			expectNoStaticLinkDep(t, ctx, binWithAsan, libAsanStaticCxxRuntime)
+			expectNoStaticLinkDep(t, ctx, binNoAsan, libAsanStaticCxxRuntime)
+			expectNoStaticLinkDep(t, ctx, libAsan, libAsanStaticCxxRuntime)
+			expectNoStaticLinkDep(t, ctx, libShared, libAsanStaticCxxRuntime)
+			expectNoStaticLinkDep(t, ctx, libTransitive, libAsanStaticCxxRuntime)
+		}
 	}
 
 	t.Run("host", func(t *testing.T) { check(t, buildOS, RUNTIME_LINKAGE_NONE, preparer) })
 	t.Run("device", func(t *testing.T) { check(t, "android_arm64_armv8-a", RUNTIME_LINKAGE_SHARED, preparer) })
 	t.Run("host musl", func(t *testing.T) {
-		check(t, "linux_musl_x86_64", RUNTIME_LINKAGE_SHARED,
+		check(t, "linux_musl_x86_64", RUNTIME_LINKAGE_STATIC,
 			android.GroupFixturePreparers(preparer, PrepareForTestWithHostMusl))
 	})
 }
diff --git a/cc/testing.go b/cc/testing.go
index d38a57c..f78ea0f 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -40,7 +40,6 @@
 	ctx.RegisterModuleType("cc_genrule", GenRuleFactory)
 	ctx.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory)
 	ctx.RegisterModuleType("ndk_prebuilt_static_stl", NdkPrebuiltStaticStlFactory)
-	ctx.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory)
 	ctx.RegisterModuleType("ndk_library", NdkLibraryFactory)
 	ctx.RegisterModuleType("ndk_headers", ndkHeadersFactory)
 }
diff --git a/cmd/sbox/sbox.go b/cmd/sbox/sbox.go
index 91e3540..fc56dd5 100644
--- a/cmd/sbox/sbox.go
+++ b/cmd/sbox/sbox.go
@@ -390,7 +390,7 @@
 		}
 	}
 
-	const maxErrors = 10
+	const maxErrors = 25
 
 	if len(incorrectOutputDirectoryErrors) > 0 {
 		errorMessage := ""
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 2ace746..79a5ce4 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -84,6 +84,7 @@
 	flag.BoolVar(&cmdlineArgs.BazelModeStaging, "bazel-mode-staging", false, "use bazel for analysis of certain near-ready modules")
 	flag.BoolVar(&cmdlineArgs.BazelModeDev, "bazel-mode-dev", false, "use bazel for analysis of a large number of modules (less stable)")
 	flag.BoolVar(&cmdlineArgs.UseBazelProxy, "use-bazel-proxy", false, "communicate with bazel using unix socket proxy instead of spawning subprocesses")
+	flag.BoolVar(&cmdlineArgs.BuildFromTextStub, "build-from-text-stub", false, "build Java stubs from API text files instead of source files")
 
 	// Flags that probably shouldn't be flags of soong_build, but we haven't found
 	// the time to remove them yet
@@ -105,6 +106,7 @@
 	ctx.SetNameInterface(newNameResolver(configuration))
 	ctx.SetAllowMissingDependencies(configuration.AllowMissingDependencies())
 	ctx.AddIncludeTags(configuration.IncludeTags()...)
+	ctx.AddSourceRootDirs(configuration.SourceRootDirs()...)
 	return ctx
 }
 
diff --git a/java/androidmk.go b/java/androidmk.go
index a4dac80..148d7c2 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -733,3 +733,22 @@
 		},
 	}
 }
+
+func (al *ApiLibrary) AndroidMkEntries() []android.AndroidMkEntries {
+	var entriesList []android.AndroidMkEntries
+
+	entriesList = append(entriesList, android.AndroidMkEntries{
+		Class:      "JAVA_LIBRARIES",
+		OutputFile: android.OptionalPathForPath(al.stubsJar),
+		Include:    "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
+		ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+			func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
+				entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
+				entries.SetPath("LOCAL_SOONG_CLASSES_JAR", al.stubsJar)
+				entries.SetPath("LOCAL_SOONG_HEADER_JAR", al.stubsJar)
+			},
+		},
+	})
+
+	return entriesList
+}
diff --git a/java/java.go b/java/java.go
index ebd9f5e..499a6b6 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1697,6 +1697,12 @@
 		Flag("--color").
 		Flag("--quiet").
 		Flag("--format=v2").
+		Flag("--include-annotations").
+		// The flag makes nullability issues as warnings rather than errors by replacing
+		// @Nullable/@NonNull in the listed packages APIs with @RecentlyNullable/@RecentlyNonNull,
+		// and these packages are meant to have everything annotated
+		// @RecentlyNullable/@RecentlyNonNull.
+		FlagWithArg("--force-convert-to-warning-nullability-annotations ", "+*:-android.*:+android.icu.*:-dalvik.*").
 		FlagWithArg("--repeat-errors-max ", "10").
 		FlagWithArg("--hide ", "UnresolvedImport").
 		FlagWithArg("--hide ", "InvalidNullabilityOverride").
@@ -1705,6 +1711,14 @@
 	return cmd
 }
 
+func (al *ApiLibrary) HeaderJars() android.Paths {
+	return android.Paths{al.stubsJar}
+}
+
+func (al *ApiLibrary) OutputDirAndDeps() (android.Path, android.Paths) {
+	return nil, nil
+}
+
 func (al *ApiLibrary) stubsFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, stubsDir android.OptionalPath) {
 	if stubsDir.Valid() {
 		cmd.FlagWithArg("--stubs ", stubsDir.String())
@@ -1816,7 +1830,10 @@
 	ctx.Phony(ctx.ModuleName(), al.stubsJar)
 
 	ctx.SetProvider(JavaInfoProvider, JavaInfo{
-		HeaderJars: android.PathsIfNonNil(al.stubsJar),
+		HeaderJars:                     android.PathsIfNonNil(al.stubsJar),
+		ImplementationAndResourcesJars: android.PathsIfNonNil(al.stubsJar),
+		ImplementationJars:             android.PathsIfNonNil(al.stubsJar),
+		AidlIncludeDirs:                android.Paths{},
 	})
 }
 
diff --git a/rust/builder.go b/rust/builder.go
index 4b20e2b..b89e7ad 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -218,6 +218,7 @@
 
 	var inputs android.Paths
 	var implicits android.Paths
+	var orderOnly android.Paths
 	var output buildOutput
 	var rustcFlags, linkFlags []string
 	var implicitOutputs android.WritablePaths
@@ -255,7 +256,7 @@
 	// Disallow experimental features
 	modulePath := android.PathForModuleSrc(ctx).String()
 	if !(android.IsThirdPartyPath(modulePath) || strings.HasPrefix(modulePath, "prebuilts")) {
-		rustcFlags = append(rustcFlags, "-Zallow-features=\"default_alloc_error_handler,custom_inner_attributes,mixed_integer_ops\"")
+		rustcFlags = append(rustcFlags, "-Zallow-features=\"custom_inner_attributes,mixed_integer_ops\"")
 	}
 
 	// Collect linker flags
@@ -285,6 +286,8 @@
 	implicits = append(implicits, deps.CrtBegin...)
 	implicits = append(implicits, deps.CrtEnd...)
 
+	orderOnly = append(orderOnly, deps.SharedLibs...)
+
 	if len(deps.SrcDeps) > 0 {
 		moduleGenDir := ctx.RustModule().compiler.CargoOutDir()
 		var outputs android.WritablePaths
@@ -331,6 +334,7 @@
 			ImplicitOutputs: nil,
 			Inputs:          inputs,
 			Implicits:       implicits,
+			OrderOnly:       orderOnly,
 			Args: map[string]string{
 				"rustcFlags":  strings.Join(rustcFlags, " "),
 				"libFlags":    strings.Join(libFlags, " "),
@@ -349,6 +353,7 @@
 		ImplicitOutputs: implicitOutputs,
 		Inputs:          inputs,
 		Implicits:       implicits,
+		OrderOnly:       orderOnly,
 		Args: map[string]string{
 			"rustcFlags": strings.Join(rustcFlags, " "),
 			"linkFlags":  strings.Join(linkFlags, " "),
@@ -367,6 +372,7 @@
 			Output:      kytheFile,
 			Inputs:      inputs,
 			Implicits:   implicits,
+			OrderOnly:   orderOnly,
 			Args: map[string]string{
 				"rustcFlags": strings.Join(rustcFlags, " "),
 				"linkFlags":  strings.Join(linkFlags, " "),
diff --git a/rust/rust.go b/rust/rust.go
index 018cdab..f85babc 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1413,7 +1413,7 @@
 
 	depPaths.RLibs = append(depPaths.RLibs, rlibDepFiles...)
 	depPaths.DyLibs = append(depPaths.DyLibs, dylibDepFiles...)
-	depPaths.SharedLibs = append(depPaths.SharedLibs, sharedLibDepFiles...)
+	depPaths.SharedLibs = append(depPaths.SharedLibs, sharedLibFiles...)
 	depPaths.SharedLibDeps = append(depPaths.SharedLibDeps, sharedLibDepFiles...)
 	depPaths.StaticLibs = append(depPaths.StaticLibs, staticLibDepFiles...)
 	depPaths.ProcMacros = append(depPaths.ProcMacros, procMacroDepFiles...)
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 3bcd58c..e8e5800 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -209,6 +209,10 @@
 // Test to make sure dependencies are being picked up correctly.
 func TestDepsTracking(t *testing.T) {
 	ctx := testRust(t, `
+		cc_library {
+			host_supported: true,
+			name: "cc_stubs_dep",
+		}
 		rust_ffi_host_static {
 			name: "libstatic",
 			srcs: ["foo.rs"],
@@ -235,6 +239,7 @@
 			crate_name: "rlib",
 			static_libs: ["libstatic"],
 			whole_static_libs: ["libwholestatic"],
+			shared_libs: ["cc_stubs_dep"],
 		}
 		rust_proc_macro {
 			name: "libpm",
@@ -279,6 +284,17 @@
 		t.Errorf("-lstatic flag not being passed to rustc for static library %#v", rustc.Args["rustcFlags"])
 	}
 
+	if !strings.Contains(rustc.Args["linkFlags"], "cc_stubs_dep.so") {
+		t.Errorf("shared cc_library not being passed to rustc linkFlags %#v", rustc.Args["linkFlags"])
+	}
+
+	if !android.SuffixInList(rustc.OrderOnly.Strings(), "cc_stubs_dep.so") {
+		t.Errorf("shared cc dep not being passed as order-only to rustc %#v", rustc.OrderOnly.Strings())
+	}
+
+	if !android.SuffixInList(rustc.Implicits.Strings(), "cc_stubs_dep.so.toc") {
+		t.Errorf("shared cc dep TOC not being passed as implicit to rustc %#v", rustc.Implicits.Strings())
+	}
 }
 
 func TestSourceProviderDeps(t *testing.T) {
@@ -331,7 +347,7 @@
 			source_stem: "bindings",
 			host_supported: true,
 			wrapper_src: "src/any.h",
-        }
+		}
 	`)
 
 	libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_dylib-std").Rule("rustc")
@@ -371,7 +387,6 @@
 	if !android.InList("libbindings.rlib-std", libprocmacroMod.Properties.AndroidMkRlibs) {
 		t.Errorf("bindgen dependency not detected as a rlib dependency (dependency missing from AndroidMkRlibs)")
 	}
-
 }
 
 func TestSourceProviderTargetMismatch(t *testing.T) {
diff --git a/ui/build/config.go b/ui/build/config.go
index 9664548..a755d14 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -88,6 +88,7 @@
 	searchApiDir      bool // Scan the Android.bp files generated in out/api_surfaces
 	skipMetricsUpload bool
 	buildStartedTime  int64 // For metrics-upload-only - manually specify a build-started time
+	buildFromTextStub bool
 
 	// From the product config
 	katiArgs        []string
@@ -117,7 +118,8 @@
 
 	bazelForceEnabledModules string
 
-	includeTags []string
+	includeTags    []string
+	sourceRootDirs []string
 
 	// Data source to write ninja weight list
 	ninjaWeightListSource NinjaWeightListSource
@@ -517,6 +519,11 @@
 		}
 	}
 
+	if ret.BuildFromTextStub() {
+		// TODO(b/271443071): support hidden api check for from-text stub build
+		ret.environ.Set("UNSAFE_DISABLE_HIDDENAPI_FLAGS", "true")
+	}
+
 	bpd := ret.BazelMetricsDir()
 	if err := os.RemoveAll(bpd); err != nil {
 		ctx.Fatalf("Unable to remove bazel profile directory %q: %v", bpd, err)
@@ -858,6 +865,8 @@
 			} else {
 				ctx.Fatalf("unknown option for ninja_weight_source: %s", source)
 			}
+		} else if arg == "--build-from-text-stub" {
+			c.buildFromTextStub = true
 		} else if strings.HasPrefix(arg, "--build-command=") {
 			buildCmd := strings.TrimPrefix(arg, "--build-command=")
 			// remove quotations
@@ -1199,6 +1208,10 @@
 	return c.skipConfig
 }
 
+func (c *configImpl) BuildFromTextStub() bool {
+	return c.buildFromTextStub
+}
+
 func (c *configImpl) TargetProduct() string {
 	if v, ok := c.environ.Get("TARGET_PRODUCT"); ok {
 		return v
@@ -1229,6 +1242,14 @@
 	return c.parallel
 }
 
+func (c *configImpl) GetSourceRootDirs() []string {
+	return c.sourceRootDirs
+}
+
+func (c *configImpl) SetSourceRootDirs(i []string) {
+	c.sourceRootDirs = i
+}
+
 func (c *configImpl) GetIncludeTags() []string {
 	return c.includeTags
 }
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index a9c298f..efe7478 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -148,6 +148,7 @@
 	"PLATFORM_VERSION_CODENAME",
 	"PLATFORM_VERSION",
 	"PRODUCT_INCLUDE_TAGS",
+	"PRODUCT_SOURCE_ROOT_DIRS",
 	"TARGET_PRODUCT",
 	"TARGET_BUILD_VARIANT",
 	"TARGET_BUILD_APPS",
@@ -299,4 +300,5 @@
 	config.SetBuildBrokenUsesNetwork(makeVars["BUILD_BROKEN_USES_NETWORK"] == "true")
 	config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(makeVars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
 	config.SetIncludeTags(strings.Fields(makeVars["PRODUCT_INCLUDE_TAGS"]))
+	config.SetSourceRootDirs(strings.Fields(makeVars["PRODUCT_SOURCE_ROOT_DIRS"]))
 }
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 871e637..9287731 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -171,6 +171,9 @@
 	if pb.config.multitreeBuild {
 		commonArgs = append(commonArgs, "--multitree-build")
 	}
+	if pb.config.buildFromTextStub {
+		commonArgs = append(commonArgs, "--build-from-text-stub")
+	}
 
 	commonArgs = append(commonArgs, "-l", filepath.Join(pb.config.FileListDir(), "Android.bp.list"))
 	invocationEnv := make(map[string]string)
@@ -282,6 +285,9 @@
 	if config.MultitreeBuild() {
 		mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--multitree-build")
 	}
+	if config.buildFromTextStub {
+		mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--build-from-text-stub")
+	}
 
 	queryviewDir := filepath.Join(config.SoongOutDir(), "queryview")
 	// The BUILD files will be generated in out/soong/.api_bp2build (no symlinks to src files)
@@ -410,6 +416,7 @@
 
 	blueprintCtx := blueprint.NewContext()
 	blueprintCtx.AddIncludeTags(config.GetIncludeTags()...)
+	blueprintCtx.AddSourceRootDirs(config.GetSourceRootDirs()...)
 	blueprintCtx.SetIgnoreUnknownModuleTypes(true)
 	blueprintConfig := BlueprintConfig{
 		soongOutDir: config.SoongOutDir(),