Convert getFdoProfilePathFromDep and addStubDependencyProviders to use
ModuleProxy.

Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: If06de5f852e6e4574ce0e383ba0bc4fc3508b4b4
diff --git a/cc/library.go b/cc/library.go
index be27b01..c9114fd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1216,7 +1216,7 @@
 // Visits the stub variants of the library and returns a struct containing the stub .so paths
 func addStubDependencyProviders(ctx ModuleContext) []SharedStubLibrary {
 	stubsInfo := []SharedStubLibrary{}
-	stubs := ctx.GetDirectDepsWithTag(stubImplDepTag)
+	stubs := ctx.GetDirectDepsProxyWithTag(stubImplDepTag)
 	if len(stubs) > 0 {
 		for _, stub := range stubs {
 			stubInfo, ok := android.OtherModuleProvider(ctx, stub, SharedLibraryInfoProvider)
@@ -1225,8 +1225,12 @@
 				continue
 			}
 			flagInfo, _ := android.OtherModuleProvider(ctx, stub, FlagExporterInfoProvider)
+			ccInfo, ok := android.OtherModuleProvider(ctx, stub, CcInfoProvider)
+			if !ok || ccInfo.LibraryInfo == nil {
+				panic(fmt.Errorf("couldn't find library info for %s", stub))
+			}
 			stubsInfo = append(stubsInfo, SharedStubLibrary{
-				Version:           moduleLibraryInterface(stub).stubsVersion(),
+				Version:           ccInfo.LibraryInfo.StubsVersion,
 				SharedLibraryInfo: stubInfo,
 				FlagExporterInfo:  flagInfo,
 			})