Disallow adding nested conditional class loader context.

Nested conditional context doesn't make sense because conditional
context is only needed for compatibility libraries, and those are only
used by apps, and apps are always at the root of class loader context
tree. Therefore, trying to add conditional nested context can only mean
an error somewhere on the way.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iadeaaf89fdb11cb23b107c6fb074b1bc765256be
diff --git a/dexpreopt/class_loader_context.go b/dexpreopt/class_loader_context.go
index 8d61901..2b6ec79 100644
--- a/dexpreopt/class_loader_context.go
+++ b/dexpreopt/class_loader_context.go
@@ -110,6 +110,13 @@
 		devicePath = android.InstallPathToOnDevicePath(ctx, installPath.(android.InstallPath))
 	}
 
+	// Nested class loader context shouldn't have conditional part (it is allowed only at the top level).
+	for ver, _ := range nestedClcMap {
+		if ver != AnySdkVersion {
+			clcStr, _ := ComputeClassLoaderContext(nestedClcMap)
+			return fmt.Errorf("nested class loader context shouldn't have conditional part: %s", clcStr)
+		}
+	}
 	subcontexts := nestedClcMap[AnySdkVersion]
 
 	// If the library with this name is already present as one of the unconditional top-level