Fix: stubs lib is installed in APEX

This CL fixes the problem that when a lib is defined with stubs, the
stubs variantof the lib is installed to the APEX. This was happening
because the non-stubs variant is the last variant of the 'version'
variants and addFarVariationDependencies selects the first variant when
the 'version' variant isn't specified.

Fixing the problem by making the non-stubs variant (whose name is "")
the first variant.

Test: m (apex_test)

Change-Id: I1505fd2f29a0d70c916bad51000aa06f2b80b137
diff --git a/apex/apex_test.go b/apex/apex_test.go
index dd5bf70..63d2aab 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -664,5 +664,5 @@
 	ldFlags := ctx.ModuleForTests("not_in_apex", "android_arm64_armv8-a_core").Rule("ld").Args["libFlags"]
 
 	// Ensure that not_in_apex is linking with the static variant of mylib
-	ensureContains(t, ldFlags, "mylib/android_arm64_armv8-a_core_static/mylib.a")
+	ensureContains(t, ldFlags, "mylib/android_arm64_armv8-a_core_static_platform/mylib.a")
 }
diff --git a/cc/library.go b/cc/library.go
index 40c1b4f..da223dc 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1059,7 +1059,7 @@
 			stubsVersionsFor(mctx.Config())[mctx.ModuleName()] = copiedVersions
 
 			// "" is for the non-stubs variant
-			versions = append(versions, "")
+			versions = append([]string{""}, versions...)
 
 			modules := mctx.CreateVariations(versions...)
 			for i, m := range modules {