Create apkcerts.txt using Soong

This CL creates an apkcerts.txt of the apps installed on the device, and
any apk-in-apex of installed apexes. Note that this behavior is unlike
make. There is some ongoing discussion on whether the make behavior can
be updated to only list the installed apps as well.

To implement this, androidDevice will consult the following providers
from the list of installed modules
- AppInfoProvider (android_app, android_app_import, ...)
- AppInfosProvider (for apk-in-apex)
- RuntimeResourceOverlayInfoProvider (for checked-in and autogen rros)

Test: With https://r.android.com/3529333, apkcerts.txt is identical for
aosp_cf_x86_64_phone between make and soong

Bug: 399788149
Change-Id: I10009ea8761a197dd2301acf9615079bd28af3f5
diff --git a/apex/apex.go b/apex/apex.go
index 196f389..38ab012 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -550,6 +550,9 @@
 
 	// Required modules, filled out during GenerateAndroidBuildActions and used in AndroidMk
 	required []string
+
+	// appinfo of the apk-in-apex of this module
+	appInfos java.AppInfos
 }
 
 // apexFileClass represents a type of file that can be included in APEX.
@@ -1931,6 +1934,7 @@
 			}
 		case androidAppTag:
 			if appInfo, ok := android.OtherModuleProvider(ctx, child, java.AppInfoProvider); ok {
+				a.appInfos = append(a.appInfos, *appInfo)
 				if appInfo.AppSet {
 					appDir := "app"
 					if appInfo.Privileged {
@@ -2267,6 +2271,8 @@
 	})
 
 	android.SetProvider(ctx, filesystem.ApexKeyPathInfoProvider, filesystem.ApexKeyPathInfo{a.apexKeysPath})
+
+	android.SetProvider(ctx, java.AppInfosProvider, a.appInfos)
 }
 
 // Set prebuiltInfoProvider. This will be used by `apex_prebuiltinfo_singleton` to print out a metadata file