hidl_package_root: use ExistentPathForSource

There has previously been an incremental build problem when new
current.txt files are added. This is now fixed.

Bug: 119117395
Test: manual
Change-Id: Iffd962f590cffe810fc9cdb48d5073d123ab608c
diff --git a/build/hidl_interface.go b/build/hidl_interface.go
index bd99cfa..2d31857 100644
--- a/build/hidl_interface.go
+++ b/build/hidl_interface.go
@@ -80,27 +80,32 @@
 	}
 
 	var fullRootOptions []string
-	var currentPaths android.Paths
+	var currentPath android.OptionalPath
 	ctx.VisitDirectDeps(func(dep android.Module) {
 		switch t := dep.(type) {
 		case *hidlInterface:
 			fullRootOptions = append(fullRootOptions, t.properties.Full_root_option)
 		case *hidlPackageRoot:
-			currentPaths = append(currentPaths, t.getCurrentPaths()...)
+			if currentPath.Valid() {
+				panic(fmt.Sprintf("Expecting only one path, but found %v %v", currentPath, t.getCurrentPath()))
+			}
+
+			currentPath = t.getCurrentPath()
 		default:
 			panic(fmt.Sprintf("Unrecognized hidlGenProperties dependency: %T", t))
 		}
 	})
 
-	if len(currentPaths) > 1 {
-		panic(fmt.Sprintf("Expecting one or zero current paths, but found: %v", currentPaths))
-	}
-
 	fullRootOptions = android.FirstUniqueStrings(fullRootOptions)
 
+	inputs := g.genInputs
+	if (currentPath.Valid()) {
+		inputs = append(inputs, currentPath.Path())
+	}
+
 	ctx.ModuleBuild(pctx, android.ModuleBuildParams{
 		Rule:            hidlRule,
-		Inputs:          append(g.genInputs, currentPaths...),
+		Inputs:          inputs,
 		Output:          g.genOutputs[0],
 		ImplicitOutputs: g.genOutputs[1:],
 		Args: map[string]string{