Add checks for double_loadable dependencies

Vendor-available libs can be double-loaded if LLNDK libs depend
on them. Currently soong checks only 'direct' dependency bewteen
LLNDK and VNDK lib. With this change, soong checks if every dependencies
from LLNDK is also LLNDK or VNDK-SP or marked as 'double_loadable:true'.
This change causes many libs to be marked as 'double_loadable'.

Bug: 121280180
Test: m -j
Change-Id: Ibc1879b6fd465a3141520abe0150018c3051c0a7
diff --git a/android/mutator.go b/android/mutator.go
index e5f742f..509b67f 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -132,11 +132,15 @@
 	VisitDepsDepthFirst(visit func(Module))
 	VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
 	WalkDeps(visit func(Module, Module) bool)
+	// GetWalkPath is supposed to be called in visit function passed in WalkDeps()
+	// and returns a top-down dependency path from a start module to current child module.
+	GetWalkPath() []Module
 }
 
 type androidTopDownMutatorContext struct {
 	blueprint.TopDownMutatorContext
 	androidBaseContextImpl
+	walkPath []Module
 }
 
 type AndroidBottomUpMutator func(BottomUpMutatorContext)
@@ -287,10 +291,16 @@
 }
 
 func (a *androidTopDownMutatorContext) WalkDeps(visit func(Module, Module) bool) {
+	a.walkPath = []Module{a.Module()}
 	a.TopDownMutatorContext.WalkDeps(func(child, parent blueprint.Module) bool {
 		childAndroidModule, _ := child.(Module)
 		parentAndroidModule, _ := parent.(Module)
 		if childAndroidModule != nil && parentAndroidModule != nil {
+			// record walkPath before visit
+			for a.walkPath[len(a.walkPath)-1] != parentAndroidModule {
+				a.walkPath = a.walkPath[0 : len(a.walkPath)-1]
+			}
+			a.walkPath = append(a.walkPath, childAndroidModule)
 			return visit(childAndroidModule, parentAndroidModule)
 		} else {
 			return false
@@ -298,6 +308,10 @@
 	})
 }
 
+func (a *androidTopDownMutatorContext) GetWalkPath() []Module {
+	return a.walkPath
+}
+
 func (a *androidTopDownMutatorContext) AppendProperties(props ...interface{}) {
 	for _, p := range props {
 		err := proptools.AppendMatchingProperties(a.Module().base().customizableProperties,