Merge changes Iba57c949,Ief43ff51,Ib1809a4d,I2ab64f36 am: b08a091502 am: 3f57de54b2 am: a088bff723 am: 6c4cdb0bb2

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480605

Change-Id: Ie0876cdaf142dbd75c094f9e680849efb4105b28
diff --git a/apex/allowed_deps.txt b/apex/allowed_deps.txt
index a88b6b5..5cecfaf 100644
--- a/apex/allowed_deps.txt
+++ b/apex/allowed_deps.txt
@@ -57,17 +57,15 @@
 androidx.activity_activity(minSdkVersion:14)
 androidx.activity_activity-ktx(minSdkVersion:14)
 androidx.annotation_annotation(minSdkVersion:24)
-androidx.annotation_annotation(minSdkVersion:current)
+androidx.annotation_annotation-experimental(minSdkVersion:14)
 androidx.appcompat_appcompat(minSdkVersion:14)
 androidx.appcompat_appcompat-resources(minSdkVersion:14)
 androidx.arch.core_core-common(minSdkVersion:24)
-androidx.arch.core_core-common(minSdkVersion:current)
 androidx.arch.core_core-runtime(minSdkVersion:14)
 androidx.asynclayoutinflater_asynclayoutinflater(minSdkVersion:14)
 androidx.autofill_autofill(minSdkVersion:14)
 androidx.cardview_cardview(minSdkVersion:14)
 androidx.collection_collection(minSdkVersion:24)
-androidx.collection_collection(minSdkVersion:current)
 androidx.collection_collection-ktx(minSdkVersion:24)
 androidx.coordinatorlayout_coordinatorlayout(minSdkVersion:14)
 androidx.core_core(minSdkVersion:14)
@@ -87,7 +85,6 @@
 androidx.legacy_legacy-support-v13(minSdkVersion:14)
 androidx.legacy_legacy-support-v4(minSdkVersion:14)
 androidx.lifecycle_lifecycle-common(minSdkVersion:24)
-androidx.lifecycle_lifecycle-common(minSdkVersion:current)
 androidx.lifecycle_lifecycle-common-java8(minSdkVersion:24)
 androidx.lifecycle_lifecycle-extensions(minSdkVersion:14)
 androidx.lifecycle_lifecycle-livedata(minSdkVersion:14)
@@ -116,15 +113,19 @@
 androidx.recyclerview_recyclerview(minSdkVersion:14)
 androidx.recyclerview_recyclerview-selection(minSdkVersion:14)
 androidx.savedstate_savedstate(minSdkVersion:14)
+androidx.savedstate_savedstate-ktx(minSdkVersion:14)
 androidx.slidingpanelayout_slidingpanelayout(minSdkVersion:14)
 androidx.swiperefreshlayout_swiperefreshlayout(minSdkVersion:14)
 androidx.transition_transition(minSdkVersion:14)
 androidx.vectordrawable_vectordrawable(minSdkVersion:14)
 androidx.vectordrawable_vectordrawable-animated(minSdkVersion:14)
 androidx.versionedparcelable_versionedparcelable(minSdkVersion:14)
+androidx.viewpager2_viewpager2(minSdkVersion:14)
 androidx.viewpager_viewpager(minSdkVersion:14)
 apache-commons-compress(minSdkVersion:current)
 art.module.public.api.stubs(minSdkVersion:(no version))
+audioflinger-aidl-unstable-cpp(minSdkVersion:29)
+av-types-aidl-unstable-cpp(minSdkVersion:29)
 bcm_object(minSdkVersion:29)
 bionic_libc_platform_headers(minSdkVersion:29)
 boringssl_self_test(minSdkVersion:29)
@@ -165,7 +166,9 @@
 DocumentsUI-res-lib(minSdkVersion:29)
 exoplayer2-extractor(minSdkVersion:16)
 exoplayer2-extractor-annotation-stubs(minSdkVersion:16)
+ExtServices(minSdkVersion:30)
 ExtServices(minSdkVersion:current)
+ExtServices-core(minSdkVersion:30)
 ExtServices-core(minSdkVersion:current)
 flatbuffer_headers(minSdkVersion:(no version))
 fmtlib(minSdkVersion:29)
@@ -178,6 +181,7 @@
 gemmlowp_headers(minSdkVersion:(no version))
 GoogleCellBroadcastApp(minSdkVersion:29)
 GoogleCellBroadcastServiceModule(minSdkVersion:29)
+GoogleExtServices(minSdkVersion:30)
 GoogleExtServices(minSdkVersion:current)
 GooglePermissionController(minSdkVersion:28)
 guava(minSdkVersion:current)
@@ -225,6 +229,7 @@
 libbacktrace_headers(minSdkVersion:apex_inherit)
 libbase(minSdkVersion:29)
 libbase_headers(minSdkVersion:29)
+libbinder(minSdkVersion:29)
 libbinder_headers(minSdkVersion:29)
 libbinderthreadstateutils(minSdkVersion:29)
 libbluetooth-types-header(minSdkVersion:29)
@@ -317,6 +322,7 @@
 liblog(minSdkVersion:(no version))
 liblog_headers(minSdkVersion:29)
 liblua(minSdkVersion:(no version))
+liblua(minSdkVersion:30)
 liblz4(minSdkVersion:(no version))
 libm(minSdkVersion:(no version))
 libmath(minSdkVersion:29)
@@ -355,6 +361,10 @@
 libprocessgroup(minSdkVersion:29)
 libprocessgroup_headers(minSdkVersion:29)
 libprocpartition(minSdkVersion:(no version))
+libprofile-clang-extras(minSdkVersion:(no version))
+libprofile-clang-extras_ndk(minSdkVersion:(no version))
+libprofile-extras(minSdkVersion:(no version))
+libprofile-extras_ndk(minSdkVersion:(no version))
 libprotobuf-cpp-lite(minSdkVersion:29)
 libprotobuf-java-lite(minSdkVersion:current)
 libprotobuf-java-nano(minSdkVersion:9)
@@ -371,6 +381,7 @@
 libstagefright_amrwbenc(minSdkVersion:29)
 libstagefright_bufferpool@2.0.1(minSdkVersion:29)
 libstagefright_bufferqueue_helper(minSdkVersion:29)
+libstagefright_bufferqueue_helper_novndk(minSdkVersion:(no version))
 libstagefright_enc_common(minSdkVersion:29)
 libstagefright_esds(minSdkVersion:29)
 libstagefright_flacdec(minSdkVersion:29)
@@ -397,12 +408,18 @@
 libtetherutilsjni(minSdkVersion:30)
 libtetherutilsjni(minSdkVersion:current)
 libtextclassifier(minSdkVersion:(no version))
-libtextclassifier-java(minSdkVersion:current)
+libtextclassifier(minSdkVersion:30)
+libtextclassifier-java(minSdkVersion:28)
+libtextclassifier_abseil(minSdkVersion:30)
+libtextclassifier_flatbuffer_headers(minSdkVersion:(no version))
+libtextclassifier_flatbuffer_headers(minSdkVersion:30)
 libtextclassifier_hash_headers(minSdkVersion:(no version))
 libtextclassifier_hash_static(minSdkVersion:(no version))
 libtflite_kernel_utils(minSdkVersion:(no version))
 libtflite_static(minSdkVersion:(no version))
+libtflite_static(minSdkVersion:30)
 libui(minSdkVersion:29)
+libui-types(minSdkVersion:apex_inherit)
 libui_headers(minSdkVersion:29)
 libunwind_llvm(minSdkVersion:apex_inherit)
 libutf(minSdkVersion:(no version))
@@ -416,6 +433,8 @@
 libyuv(minSdkVersion:29)
 libyuv_static(minSdkVersion:29)
 libzstd(minSdkVersion:(no version))
+marisa-trie(minSdkVersion:(no version))
+marisa-trie(minSdkVersion:30)
 media_ndk_headers(minSdkVersion:29)
 media_plugin_headers(minSdkVersion:29)
 mediaswcodec(minSdkVersion:29)
@@ -426,6 +445,7 @@
 ndk_crtend_so.19(minSdkVersion:(no version))
 ndk_crtend_so.21(minSdkVersion:(no version))
 ndk_crtend_so.27(minSdkVersion:(no version))
+ndk_libandroid_support(minSdkVersion:(no version))
 ndk_libc++_static(minSdkVersion:(no version))
 ndk_libc++_static(minSdkVersion:16)
 ndk_libc++abi(minSdkVersion:(no version))
@@ -433,10 +453,12 @@
 ndk_libunwind(minSdkVersion:16)
 net-utils-device-common(minSdkVersion:29)
 net-utils-framework-common(minSdkVersion:current)
+netd_aidl_interface-java(minSdkVersion:29)
 netd_aidl_interface-unstable-java(minSdkVersion:29)
 netd_event_listener_interface-ndk_platform(minSdkVersion:29)
 netd_event_listener_interface-unstable-ndk_platform(minSdkVersion:29)
 netlink-client(minSdkVersion:29)
+networkstack-aidl-interfaces-java(minSdkVersion:29)
 networkstack-aidl-interfaces-unstable-java(minSdkVersion:29)
 networkstack-client(minSdkVersion:29)
 NetworkStackApiStableDependencies(minSdkVersion:29)
@@ -456,6 +478,7 @@
 prebuilt_androidx-constraintlayout_constraintlayout-solver-nodeps(minSdkVersion:current)
 prebuilt_androidx.activity_activity-ktx-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.activity_activity-nodeps(minSdkVersion:(no version))
+prebuilt_androidx.annotation_annotation-experimental-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.annotation_annotation-nodeps(minSdkVersion:current)
 prebuilt_androidx.appcompat_appcompat-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.appcompat_appcompat-resources-nodeps(minSdkVersion:(no version))
@@ -509,6 +532,7 @@
 prebuilt_androidx.print_print-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.recyclerview_recyclerview-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.recyclerview_recyclerview-selection-nodeps(minSdkVersion:(no version))
+prebuilt_androidx.savedstate_savedstate-ktx-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.savedstate_savedstate-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.slidingpanelayout_slidingpanelayout-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.swiperefreshlayout_swiperefreshlayout-nodeps(minSdkVersion:(no version))
@@ -516,6 +540,7 @@
 prebuilt_androidx.vectordrawable_vectordrawable-animated-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.vectordrawable_vectordrawable-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.versionedparcelable_versionedparcelable-nodeps(minSdkVersion:(no version))
+prebuilt_androidx.viewpager2_viewpager2-nodeps(minSdkVersion:(no version))
 prebuilt_androidx.viewpager_viewpager-nodeps(minSdkVersion:(no version))
 prebuilt_com.google.android.material_material-nodeps(minSdkVersion:(no version))
 prebuilt_error_prone_annotations(minSdkVersion:(no version))
@@ -551,8 +576,10 @@
 TetheringApiCurrentLib(minSdkVersion:current)
 TetheringGoogle(minSdkVersion:30)
 TetheringGoogle(minSdkVersion:current)
+textclassifier-statsd(minSdkVersion:30)
 textclassifier-statsd(minSdkVersion:current)
 TextClassifierNotificationLibNoManifest(minSdkVersion:29)
 TextClassifierServiceLibNoManifest(minSdkVersion:28)
+TextClassifierServiceLibNoManifest(minSdkVersion:30)
 updatable-media(minSdkVersion:29)
 xz-java(minSdkVersion:current)
diff --git a/apex/apex.go b/apex/apex.go
index 91770f4..c1f74e8 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -193,7 +193,6 @@
 		"ExtServices-core",
 		"ExtServices",
 		"libtextclassifier-java",
-		"libz_current",
 		"textclassifier-statsd",
 		"TextClassifierNotificationLibNoManifest",
 		"TextClassifierServiceLibNoManifest",
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go
index ee9fc81..c1aca95 100644
--- a/apex/apex_singleton.go
+++ b/apex/apex_singleton.go
@@ -17,9 +17,9 @@
 package apex
 
 import (
-	"android/soong/android"
-
 	"github.com/google/blueprint"
+
+	"android/soong/android"
 )
 
 func init() {
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index ce16d73..f7a5561 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -21,7 +21,6 @@
 
 	"android/soong/android"
 	"android/soong/java"
-
 	"github.com/google/blueprint"
 
 	"github.com/google/blueprint/proptools"
@@ -266,9 +265,6 @@
 	// list of commands to create symlinks for backward compatibility.
 	// these commands will be attached as LOCAL_POST_INSTALL_CMD
 	compatSymlinks []string
-
-	hostRequired        []string
-	postInstallCommands []string
 }
 
 type ApexSetProperties struct {
@@ -407,43 +403,21 @@
 	for _, overridden := range a.properties.Overrides {
 		a.compatSymlinks = append(a.compatSymlinks, makeCompatSymlinks(overridden, ctx)...)
 	}
-
-	if ctx.Config().InstallExtraFlattenedApexes() {
-		// flattened apex should be in /system_ext/apex
-		flattenedApexDir := android.PathForModuleInstall(&systemExtContext{ctx}, "apex", a.BaseModuleName())
-		a.postInstallCommands = append(a.postInstallCommands,
-			fmt.Sprintf("$(HOST_OUT_EXECUTABLES)/deapexer --debugfs_path $(HOST_OUT_EXECUTABLES)/debugfs extract %s %s",
-				a.outputApex.String(),
-				flattenedApexDir.ToMakePath().String(),
-			))
-		a.hostRequired = []string{"deapexer", "debugfs"}
-	}
-}
-
-type systemExtContext struct {
-	android.ModuleContext
-}
-
-func (*systemExtContext) SystemExtSpecific() bool {
-	return true
 }
 
 func (a *ApexSet) AndroidMkEntries() []android.AndroidMkEntries {
 	return []android.AndroidMkEntries{android.AndroidMkEntries{
-		Class:         "ETC",
-		OutputFile:    android.OptionalPathForPath(a.outputApex),
-		Include:       "$(BUILD_PREBUILT)",
-		Host_required: a.hostRequired,
+		Class:      "ETC",
+		OutputFile: android.OptionalPathForPath(a.outputApex),
+		Include:    "$(BUILD_PREBUILT)",
 		ExtraEntries: []android.AndroidMkExtraEntriesFunc{
 			func(entries *android.AndroidMkEntries) {
 				entries.SetString("LOCAL_MODULE_PATH", a.installDir.ToMakePath().String())
 				entries.SetString("LOCAL_MODULE_STEM", a.installFilename)
 				entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !a.installable())
 				entries.AddStrings("LOCAL_OVERRIDES_MODULES", a.properties.Overrides...)
-				postInstallCommands := append([]string{}, a.postInstallCommands...)
-				postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
-				if len(postInstallCommands) > 0 {
-					entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(postInstallCommands, " && "))
+				if len(a.compatSymlinks) > 0 {
+					entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(a.compatSymlinks, " && "))
 				}
 			},
 		},
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
index eb3d16f..74c3965 100644
--- a/cc/config/vndk.go
+++ b/cc/config/vndk.go
@@ -19,11 +19,14 @@
 // has VndkUseCoreVariant set.
 var VndkMustUseVendorVariantList = []string{
 	"android.hardware.automotive.occupant_awareness-ndk_platform",
+	"android.hardware.gnss-unstable-ndk_platform",
 	"android.hardware.light-ndk_platform",
 	"android.hardware.identity-ndk_platform",
 	"android.hardware.keymint-ndk_platform",
 	"android.hardware.nfc@1.2",
 	"android.hardware.power-ndk_platform",
+	"android.hardware.power.stats-ndk_platform",
+	"android.hardware.power.stats-unstable-ndk_platform",
 	"android.hardware.rebootescrow-ndk_platform",
 	"android.hardware.vibrator-ndk_platform",
 	"android.system.keystore2-unstable-ndk_platform",
diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go
index 021920a..6571950 100644
--- a/java/legacy_core_platform_api_usage.go
+++ b/java/legacy_core_platform_api_usage.go
@@ -19,11 +19,9 @@
 	"android/soong/java/config"
 )
 
-// This variable is effectively unused in pre-master branches, and is
-// included (with the same value as it has in AOSP) only to ease
-// merges between branches (see the comment in the
-// useLegacyCorePlatformApi() function):
 var legacyCorePlatformApiModules = []string{
+	"AAECarSystemUI",
+	"AAECarSystemUI-tests",
 	"ahat-test-dump",
 	"android.car",
 	"android.test.mock",
@@ -33,16 +31,34 @@
 	"api-stubs-docs",
 	"art_cts_jvmti_test_library",
 	"art-gtest-jars-MyClassNatives",
+	"atfwd",
+	"BackupEncryption",
 	"BackupFrameworksServicesRoboTests",
+	"backuplib",
 	"BandwidthEnforcementTest",
 	"BlockedNumberProvider",
 	"BluetoothInstrumentationTests",
+	"BluetoothMidiLib",
 	"BluetoothMidiService",
-	"car-apps-common",
+	"BTTestApp",
+	"CallEnhancement",
+	"CapCtrlInterface",
+	"CarService",
+	"car-service-test-lib",
+	"car-service-test-static-lib",
 	"CertInstaller",
+	"com.qti.location.sdk",
+	"com.qti.media.secureprocessor",
+	"com.qti.snapdragon.sdk.display",
+	"ConfURIDialer",
 	"ConnectivityManagerTest",
 	"ContactsProvider",
+	"CorePerfTests",
 	"core-tests-support",
+	"cronet_impl_common_java",
+	"cronet_impl_native_java",
+	"cronet_impl_platform_java",
+	"CtsAppExitTestCases",
 	"CtsContentTestCases",
 	"CtsIkeTestCases",
 	"CtsLibcoreWycheproofBCTestCases",
@@ -50,10 +66,17 @@
 	"CtsNetTestCases",
 	"CtsNetTestCasesLatestSdk",
 	"CtsSecurityTestCases",
+	"CtsSuspendAppsTestCases",
 	"CtsUsageStatsTestCases",
+	"datastatusnotification",
+	"DeadpoolService",
+	"DeadpoolServiceBtServices",
+	"DeviceInfo",
 	"DisplayCutoutEmulationEmu01Overlay",
+	"DocumentsUIGoogleTests",
 	"DocumentsUIPerfTests",
 	"DocumentsUITests",
+	"DocumentsUIUnitTests",
 	"DownloadProvider",
 	"DownloadProviderTests",
 	"DownloadProviderUi",
@@ -62,10 +85,13 @@
 	"ethernet-service",
 	"EthernetServiceTests",
 	"ExternalStorageProvider",
-	"ExtServices",
-	"ExtServices-core",
+	"face-V1-0-javalib",
+	"FloralClocks",
 	"framework-all",
+	"framework-jobscheduler",
 	"framework-minus-apex",
+	"framework-minus-apex-intdefs",
+	"FrameworkOverlayG6QU3",
 	"FrameworksCoreTests",
 	"FrameworksIkeTests",
 	"FrameworksNetCommonTests",
@@ -73,28 +99,66 @@
 	"FrameworksServicesRoboTests",
 	"FrameworksServicesTests",
 	"FrameworksUtilTests",
+	"FrameworksWifiTests",
+	"GtsIncrementalInstallTestCases",
+	"GtsIncrementalInstallTriggerApp",
+	"GtsInstallerV2TestCases",
+	"HelloOslo",
 	"hid",
 	"hidl_test_java_java",
 	"hwbinder",
 	"ims",
+	"ims-ext-common",
+	"imssettings",
+	"izat.lib.glue",
 	"KeyChain",
-	"ksoap2",
+	"LocalSettingsLib",
 	"LocalTransport",
 	"lockagent",
 	"mediaframeworktest",
-	"MediaProvider",
+	"mediatek-ims-base",
 	"MmsService",
-	"MtpDocumentsProvider",
+	"ModemTestMode",
+	"MtkCapCtrl",
+	"MtpService",
 	"MultiDisplayProvider",
+	"my.tests.snapdragonsdktest",
+	"NetworkSetting",
 	"NetworkStackIntegrationTestsLib",
 	"NetworkStackNextIntegrationTests",
 	"NetworkStackNextTests",
 	"NetworkStackTests",
 	"NetworkStackTestsLib",
 	"NfcNci",
+	"online-gcm-ref-docs",
+	"online-gts-docs",
+	"PerformanceMode",
+	"pixel-power-ext-java",
+	"pixel-power-ext-unstable-java",
+	"pixel-power-ext-V1-java",
 	"platform_library-docs",
+	"PowerStatsService",
 	"PrintSpooler",
+	"pxp-monitor",
+	"QColor",
+	"qcom.fmradio",
+	"qcrilhook",
+	"qcrilhook-static",
+	"qcrilmsgtunnel",
+	"QDCMMobileApp",
+	"Qmmi",
+	"QPerformance",
+	"QtiTelephonyService",
+	"QtiTelephonyServicelibrary",
+	"remoteSimLockAuthentication",
+	"remotesimlockmanagerlibrary",
 	"RollbackTest",
+	"sam",
+	"saminterfacelibrary",
+	"sammanagerlibrary",
+	"service-blobstore",
+	"service-connectivity",
+	"service-jobscheduler",
 	"services",
 	"services.accessibility",
 	"services.backup",
@@ -104,21 +168,55 @@
 	"services.usage",
 	"services.usb",
 	"Settings-core",
+	"SettingsGoogleOverlayCoral",
+	"SettingsGoogleOverlayFlame",
 	"SettingsLib",
+	"SettingsOverlayG013A",
+	"SettingsOverlayG013B",
+	"SettingsOverlayG013C",
+	"SettingsOverlayG013D",
+	"SettingsOverlayG020A",
+	"SettingsOverlayG020B",
+	"SettingsOverlayG020C",
+	"SettingsOverlayG020D",
+	"SettingsOverlayG020E",
+	"SettingsOverlayG020E_VN",
+	"SettingsOverlayG020F",
+	"SettingsOverlayG020F_VN",
+	"SettingsOverlayG020G",
+	"SettingsOverlayG020G_VN",
+	"SettingsOverlayG020H",
+	"SettingsOverlayG020H_VN",
+	"SettingsOverlayG020I",
+	"SettingsOverlayG020I_VN",
+	"SettingsOverlayG020J",
+	"SettingsOverlayG020M",
+	"SettingsOverlayG020N",
+	"SettingsOverlayG020P",
+	"SettingsOverlayG020Q",
+	"SettingsOverlayG025H",
+	"SettingsOverlayG025J",
+	"SettingsOverlayG025M",
+	"SettingsOverlayG025N",
+	"SettingsOverlayG5NZ6",
 	"SettingsProvider",
 	"SettingsProviderTest",
 	"SettingsRoboTests",
 	"Shell",
 	"ShellTests",
+	"SimContact",
+	"SimContacts",
+	"SimSettings",
 	"sl4a.Common",
 	"StatementService",
 	"SystemUI-core",
 	"SystemUISharedLib",
 	"SystemUI-tests",
+	"tcmiface",
 	"Telecom",
 	"TelecomUnitTests",
 	"telephony-common",
-	"TelephonyProvider",
+	"telephony-ext",
 	"TelephonyProviderTests",
 	"TeleService",
 	"testables",
@@ -128,18 +226,19 @@
 	"time_zone_distro_installer-tests",
 	"time_zone_distro-tests",
 	"time_zone_updater",
+	"TMobilePlanProvider",
 	"TvProvider",
 	"uiautomator-stubs-docs",
+	"uimgbamanagerlibrary",
 	"UsbHostExternalManagementTestApp",
 	"UserDictionaryProvider",
+	"UxPerformance",
 	"WallpaperBackup",
-	"wifi-service",
+	"WallpaperBackupAgentTests",
+	"WfdCommon",
+	"xdivert",
 }
 
-// This variable is effectively unused in pre-master branches, and is
-// included (with the same value as it has in AOSP) only to ease
-// merges between branches (see the comment in the
-// useLegacyCorePlatformApi() function):
 var legacyCorePlatformApiLookup = make(map[string]struct{})
 
 func init() {
@@ -149,12 +248,8 @@
 }
 
 func useLegacyCorePlatformApi(ctx android.EarlyModuleContext) bool {
-	// In pre-master branches, we don't attempt to force usage of the stable
-	// version of the core/platform API. Instead, we always use the legacy
-	// version --- except in tests, where we always use stable, so that we
-	// can make the test assertions the same as other branches.
-	// This should be false in tests and true otherwise:
-	return ctx.Config().TestProductVariables == nil
+	_, found := legacyCorePlatformApiLookup[ctx.ModuleName()]
+	return found
 }
 
 func corePlatformSystemModules(ctx android.EarlyModuleContext) string {