Move configuration checks from getBootImageJar

The getBootImageJar function will be removed once the boot image
creation has been moved to the platform_bootclasspath and
bootclasspath_fragment module types. However, the consistency checks
that it performs are still useful so this change moves them out
first.

The ART boot image related checks are now performed in the
bootclasspath_fragment module type. A previous change accidentally
disabled the checks when the contents property was not empty which has
been fixed. Also, the error messages have been tweaked to make it clear
that the art-bootclasspath-fragment is now the source of truth as to
its contents not the configuration.

The framework boot image related checks are now performed in the
platform_bootclasspath module type.

Initially, this change included an extra check to make sure that
UpdatableBootJars comes from updatable APEXes but that broke because
framework-wifi and framework-tethering are not currently marked as
updatable in AOSP.

Bug: 177892522
Test: m nothing
Change-Id: I80fb600fa2c7cec4566b3461c6a33c4c6f0743f4
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 956b8d9..08d82e9 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -6519,6 +6519,15 @@
 			min_sdk_version: "current",
 		}
 
+		bootclasspath_fragment {
+			name: "art-bootclasspath-fragment",
+			image_name: "art",
+			contents: ["some-art-lib"],
+			apex_available: [
+				"com.android.art.debug",
+			],
+		}
+
 		apex_key {
 			name: "com.android.art.debug.key",
 		}
@@ -6651,14 +6660,14 @@
 	})
 
 	t.Run("updatable jar from some other apex in the ART boot image => error", func(t *testing.T) {
-		err := `module "some-updatable-apex-lib" from updatable apexes \["some-updatable-apex"\] is not allowed in the ART boot image`
+		err := `ArtApexJars expects this to be in apex "some-updatable-apex" but this is only in apexes.*"com.android.art.debug"`
 		// Update the dexpreopt ArtApexJars directly.
 		preparer := prepareSetArtJars("some-updatable-apex:some-updatable-apex-lib")
 		testNoUpdatableJarsInBootImage(t, err, preparer)
 	})
 
 	t.Run("non-updatable jar from some other apex in the ART boot image => error", func(t *testing.T) {
-		err := `module "some-non-updatable-apex-lib" is not allowed in the ART boot image`
+		err := `ArtApexJars expects this to be in apex "some-non-updatable-apex" but this is only in apexes.*"com.android.art.debug"`
 		// Update the dexpreopt ArtApexJars directly.
 		preparer := prepareSetArtJars("some-non-updatable-apex:some-non-updatable-apex-lib")
 		testNoUpdatableJarsInBootImage(t, err, preparer)
@@ -6688,7 +6697,7 @@
 	})
 
 	t.Run("platform jar in the ART boot image => error", func(t *testing.T) {
-		err := `module "some-platform-lib" is not allowed in the ART boot image`
+		err := `ArtApexJars is invalid as it requests a platform variant of "some-platform-lib"`
 		// Update the dexpreopt ArtApexJars directly.
 		preparer := prepareSetArtJars("platform:some-platform-lib")
 		testNoUpdatableJarsInBootImage(t, err, preparer)
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index 3d39d34..e2b320c 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -94,6 +94,8 @@
 		bootclasspath_fragment {
 			name: "art-bootclasspath-fragment",
 			image_name: "art",
+			// Must match the "com.android.art:" entries passed to FixtureConfigureBootJars above.
+			contents: ["baz", "quuz"],
 			apex_available: [
 				"com.android.art",
 			],
@@ -405,6 +407,8 @@
 		prebuilt_bootclasspath_fragment {
 			name: "mybootclasspathfragment",
 			image_name: "art",
+			// Must match the "com.android.art:" entries passed to FixtureConfigureBootJars above.
+			contents: ["foo", "bar"],
 			apex_available: [
 				"com.android.art",
 			],