Move filesystem into Config

The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies.  In order to support sandboxing the soong_build
process move the filesystem into the Config.  The next change will
make it private.

Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
diff --git a/sdk/testing.go b/sdk/testing.go
index 5082ab4..77ba2e6 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -29,7 +29,36 @@
 )
 
 func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, android.Config) {
-	config := android.TestArchConfig(buildDir, nil)
+	bp = bp + `
+		apex_key {
+			name: "myapex.key",
+			public_key: "myapex.avbpubkey",
+			private_key: "myapex.pem",
+		}
+
+		android_app_certificate {
+			name: "myapex.cert",
+			certificate: "myapex",
+		}
+	` + cc.GatherRequiredDepsForTest(android.Android)
+
+	mockFS := map[string][]byte{
+		"build/make/target/product/security":         nil,
+		"apex_manifest.json":                         nil,
+		"system/sepolicy/apex/myapex-file_contexts":  nil,
+		"system/sepolicy/apex/myapex2-file_contexts": nil,
+		"myapex.avbpubkey":                           nil,
+		"myapex.pem":                                 nil,
+		"myapex.x509.pem":                            nil,
+		"myapex.pk8":                                 nil,
+	}
+
+	for k, v := range fs {
+		mockFS[k] = v
+	}
+
+	config := android.TestArchConfig(buildDir, nil, bp, mockFS)
+
 	ctx := android.NewTestArchContext()
 
 	// from android package
@@ -84,38 +113,7 @@
 	ctx.PreDepsMutators(RegisterPreDepsMutators)
 	ctx.PostDepsMutators(RegisterPostDepsMutators)
 
-	ctx.Register()
-
-	bp = bp + `
-		apex_key {
-			name: "myapex.key",
-			public_key: "myapex.avbpubkey",
-			private_key: "myapex.pem",
-		}
-
-		android_app_certificate {
-			name: "myapex.cert",
-			certificate: "myapex",
-		}
-	` + cc.GatherRequiredDepsForTest(android.Android)
-
-	mockFS := map[string][]byte{
-		"Android.bp":                                 []byte(bp),
-		"build/make/target/product/security":         nil,
-		"apex_manifest.json":                         nil,
-		"system/sepolicy/apex/myapex-file_contexts":  nil,
-		"system/sepolicy/apex/myapex2-file_contexts": nil,
-		"myapex.avbpubkey":                           nil,
-		"myapex.pem":                                 nil,
-		"myapex.x509.pem":                            nil,
-		"myapex.pk8":                                 nil,
-	}
-
-	for k, v := range fs {
-		mockFS[k] = v
-	}
-
-	ctx.MockFileSystem(mockFS)
+	ctx.Register(config)
 
 	return ctx, config
 }