Prevent sdk variants from install

Platform variants should be available even when unbundled_build so that
unbundled build of com.android.virt apex can correctly have microdroid
image with system variants.

Bug: 268582372
Test: m (soong test)
Test: banchan com.android.virt aosp_arm64
      UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true m apps_only dist
      (microdroid should have the same contents)
Change-Id: I682e4f1f477f3024f7719dfaa67006ef335e0640
diff --git a/cc/androidmk.go b/cc/androidmk.go
index ce35b5c..980dd07 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -124,14 +124,17 @@
 						}
 					}
 				}
-				if c.Properties.IsSdkVariant && c.Properties.SdkAndPlatformVariantVisibleToMake {
+				if c.Properties.IsSdkVariant {
 					// Make the SDK variant uninstallable so that there are not two rules to install
 					// to the same location.
 					entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
-					// Add the unsuffixed name to SOONG_SDK_VARIANT_MODULES so that Make can rewrite
-					// dependencies to the .sdk suffix when building a module that uses the SDK.
-					entries.SetString("SOONG_SDK_VARIANT_MODULES",
-						"$(SOONG_SDK_VARIANT_MODULES) $(patsubst %.sdk,%,$(LOCAL_MODULE))")
+
+					if c.Properties.SdkAndPlatformVariantVisibleToMake {
+						// Add the unsuffixed name to SOONG_SDK_VARIANT_MODULES so that Make can rewrite
+						// dependencies to the .sdk suffix when building a module that uses the SDK.
+						entries.SetString("SOONG_SDK_VARIANT_MODULES",
+							"$(SOONG_SDK_VARIANT_MODULES) $(patsubst %.sdk,%,$(LOCAL_MODULE))")
+					}
 				}
 			},
 		},