Fix race condition when running tests

Tests running in parallel can trigger the race detector on
addLsdumpPath vs. reading the global paths in cc/makevars.go.
Move the lsdumpPaths variable into the Context instead of a
global variable.

Test: go test -race ./apex
Flag: EXEMPT bugfix
Change-Id: I0247358a5b3955d8e0e7d2ef54ce3942d973e948
diff --git a/cc/sabi.go b/cc/sabi.go
index 2caf0d4..bc61b6c 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -22,10 +22,16 @@
 )
 
 var (
-	lsdumpPaths     []string
 	lsdumpPathsLock sync.Mutex
+	lsdumpKey       = android.NewOnceKey("lsdump")
 )
 
+func lsdumpPaths(config android.Config) *[]string {
+	return config.Once(lsdumpKey, func() any {
+		return &[]string{}
+	}).(*[]string)
+}
+
 type lsdumpTag string
 
 const (
@@ -291,8 +297,9 @@
 
 // Add an entry to the global list of lsdump. The list is exported to a Make variable by
 // `cc.makeVarsProvider`.
-func addLsdumpPath(lsdumpPath string) {
+func addLsdumpPath(config android.Config, lsdumpPath string) {
+	lsdumpPaths := lsdumpPaths(config)
 	lsdumpPathsLock.Lock()
 	defer lsdumpPathsLock.Unlock()
-	lsdumpPaths = append(lsdumpPaths, lsdumpPath)
+	*lsdumpPaths = append(*lsdumpPaths, lsdumpPath)
 }