Convert checkStaticLinkingToStubLibraries to use module proxy.

Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: Id776727a431f2ce8fd4c7b352dc0bd282ac57f90
diff --git a/android/module.go b/android/module.go
index d703c19..a9f6b94 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1870,6 +1870,7 @@
 	CompileTarget           Target
 	SkipAndroidMkProcessing bool
 	BaseModuleName          string
+	CanHaveApexVariants     bool
 }
 
 var CommonModuleInfoKey = blueprint.NewProvider[CommonModuleInfo]()
@@ -2145,6 +2146,8 @@
 	} else {
 		commonData.Enabled = m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled)
 	}
+	am, ok := m.module.(ApexModule)
+	commonData.CanHaveApexVariants = ok && am.CanHaveApexVariants()
 	SetProvider(ctx, CommonModuleInfoKey, commonData)
 	if p, ok := m.module.(PrebuiltInterface); ok && p.Prebuilt() != nil {
 		SetProvider(ctx, PrebuiltModuleProviderKey, PrebuiltModuleProviderData{})