Extract duplicate code to common helper functions.

Also, fall back to using a default name for the dexpreopt directory if
we are not building for Android.

Bug: 290583827
Test: m nothing
Change-Id: I3fc6ff9142a2dcdf995796f75891b242fe2848d0
diff --git a/android/configured_jars.go b/android/configured_jars.go
index 53fef05..1281bae 100644
--- a/android/configured_jars.go
+++ b/android/configured_jars.go
@@ -311,4 +311,9 @@
 	return ConfiguredJarList{}
 }
 
+// IsConfiguredJarForPlatform returns true if the given apex name is a special name for the platform.
+func IsConfiguredJarForPlatform(apex string) bool {
+	return apex == "platform" || apex == "system_ext"
+}
+
 var earlyBootJarsKey = NewOnceKey("earlyBootJars")