Use soong built autogenerated RROs

At ToT, soong emits metadata to make (LOCAL_SOONG_PRODUCT_RRO_DIRS and
LOCAL_SOONG_DEVICE_RRO_DIRS), and make uses this metadata to build and
install apks that are intalled in /vendor or /product. This CL ports
this logic to soong.

This CL autogenerates these modules in a load hook for android_app and
override_android_app, and adds them to the `LOCAL_REQUIRED_MODULES` of
the base app. The autogenerated modules will inherit the enabled
property of the apps. This required me to add `Target.Android.Enabled`
to commonProperties in ModuleBase.

Since autogeneration happens in soong now,
`LOCAL_SOONG_(DEVICE|PRODUCT)_RRO_DIRS` no longer needs to be exported.

Followup work
- Installing the overlay variants for soong built filesystems.

Test: lunch aosp_cf_x86_64_phone-trunk_staging-userdebug
Test: no diff in system, vendor, product file_list.txt
Test: m out/target/product/vsoc_x86_64/vendor/overlay/SystemUI__aosp_cf_x86_64_phone__auto_generated_rro_vendor.apk

the apk is not bit-identical, but this is likely due to different
aapt link flags between make and soong (e.g. `--enable-compact-entries`
is added as default in soong but not in make
Test: aapt2 diff
SystemUI__aosp_cf_x86_64_phone__auto_generated_rro_vendor.apk.before
SystemUI__aosp_cf_x86_64_phone__auto_generated_rro_vendor.apk.after
reports no diffs

Change-Id: I9b212a4ed443250a63dbe27cb955c6f133cff9af
diff --git a/java/androidmk.go b/java/androidmk.go
index 2ad30b1..35024c1 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -307,15 +307,11 @@
 			Disabled: true,
 		}}
 	}
-	var required []string
-	if proptools.Bool(app.appProperties.Generate_product_characteristics_rro) {
-		required = []string{app.productCharacteristicsRROPackageName()}
-	}
 	return []android.AndroidMkEntries{android.AndroidMkEntries{
 		Class:      "APPS",
 		OutputFile: android.OptionalPathForPath(app.outputFile),
 		Include:    "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
-		Required:   required,
+		Required:   app.requiredModuleNames,
 		ExtraEntries: []android.AndroidMkExtraEntriesFunc{
 			func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
 				// App module names can be overridden.
@@ -350,31 +346,6 @@
 					entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true)
 				}
 
-				filterRRO := func(filter overlayType) android.Paths {
-					var paths android.Paths
-					seen := make(map[android.Path]bool)
-					for _, d := range app.rroDirsDepSet.ToList() {
-						if d.overlayType == filter {
-							if seen[d.path] {
-								continue
-							}
-							seen[d.path] = true
-							paths = append(paths, d.path)
-						}
-					}
-					// Reverse the order, Soong stores rroDirs in aapt2 order (low to high priority), but Make
-					// expects it in LOCAL_RESOURCE_DIRS order (high to low priority).
-					return android.ReversePaths(paths)
-				}
-				deviceRRODirs := filterRRO(device)
-				if len(deviceRRODirs) > 0 {
-					entries.AddStrings("LOCAL_SOONG_DEVICE_RRO_DIRS", deviceRRODirs.Strings()...)
-				}
-				productRRODirs := filterRRO(product)
-				if len(productRRODirs) > 0 {
-					entries.AddStrings("LOCAL_SOONG_PRODUCT_RRO_DIRS", productRRODirs.Strings()...)
-				}
-
 				entries.SetBoolIfTrue("LOCAL_EXPORT_PACKAGE_RESOURCES", Bool(app.appProperties.Export_package_resources))
 
 				entries.SetPath("LOCAL_FULL_MANIFEST_FILE", app.manifestPath)