Change depVisitor to use providers instead of type-asserting to
interfaces directly, the next step is to change it to use ModuleProxy
once IsDepInSameApex is ready.

Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: I13a4e256a26dbf7f9b3b746d628ac8f68b4e598e
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index bf54c09..a440c91 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -32,6 +32,7 @@
 	"path/filepath"
 	"strings"
 
+	"github.com/google/blueprint"
 	"github.com/google/blueprint/proptools"
 
 	"android/soong/android"
@@ -90,6 +91,15 @@
 
 }
 
+type PrebuiltEtcInfo struct {
+	// Returns the base install directory, such as "etc", "usr/share".
+	BaseDir string
+	// Returns the sub install directory relative to BaseDir().
+	SubDir string
+}
+
+var PrebuiltEtcInfoProvider = blueprint.NewProvider[PrebuiltEtcInfo]()
+
 var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents)
 
 type PrebuiltEtcProperties struct {
@@ -502,6 +512,15 @@
 	p.updateModuleInfoJSON(ctx)
 
 	ctx.SetOutputFiles(p.outputFilePaths.Paths(), "")
+
+	SetCommonPrebuiltEtcInfo(ctx, p)
+}
+
+func SetCommonPrebuiltEtcInfo(ctx android.ModuleContext, p PrebuiltEtcModule) {
+	android.SetProvider(ctx, PrebuiltEtcInfoProvider, PrebuiltEtcInfo{
+		BaseDir: p.BaseDir(),
+		SubDir:  p.SubDir(),
+	})
 }
 
 func (p *PrebuiltEtc) updateModuleInfoJSON(ctx android.ModuleContext) {