Merge "Add min_sdk_version prop to snapshots"
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 14c713f..e3e4dba 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -201,6 +201,7 @@
 		"frameworks/base/libs/androidfw":                     Bp2BuildDefaultTrue,
 		"frameworks/base/media/tests/MediaDump":              Bp2BuildDefaultTrue,
 		"frameworks/base/services/tests/servicestests/aidl":  Bp2BuildDefaultTrue,
+		"frameworks/base/proto":                              Bp2BuildDefaultTrue,
 		"frameworks/base/startop/apps/test":                  Bp2BuildDefaultTrue,
 		"frameworks/base/tests/appwidgets/AppWidgetHostTest": Bp2BuildDefaultTrueRecursively,
 		"frameworks/base/tools/aapt2":                        Bp2BuildDefaultTrue,
@@ -296,14 +297,17 @@
 
 		"platform_testing/tests/example": Bp2BuildDefaultTrueRecursively,
 
-		"prebuilts/clang/host/linux-x86":           Bp2BuildDefaultTrueRecursively,
-		"prebuilts/gradle-plugin":                  Bp2BuildDefaultTrueRecursively,
-		"prebuilts/runtime/mainline/platform/sdk":  Bp2BuildDefaultTrueRecursively,
-		"prebuilts/sdk/current/androidx":           Bp2BuildDefaultTrue,
-		"prebuilts/sdk/current/extras/app-toolkit": Bp2BuildDefaultTrue,
-		"prebuilts/sdk/current/support":            Bp2BuildDefaultTrue,
-		"prebuilts/tools":                          Bp2BuildDefaultTrue,
-		"prebuilts/tools/common/m2":                Bp2BuildDefaultTrue,
+		"prebuilts/clang/host/linux-x86":                   Bp2BuildDefaultTrueRecursively,
+		"prebuilts/gradle-plugin":                          Bp2BuildDefaultTrueRecursively,
+		"prebuilts/runtime/mainline/platform/sdk":          Bp2BuildDefaultTrueRecursively,
+		"prebuilts/sdk/current/androidx":                   Bp2BuildDefaultTrue,
+		"prebuilts/sdk/current/androidx-legacy":            Bp2BuildDefaultTrue,
+		"prebuilts/sdk/current/extras/constraint-layout-x": Bp2BuildDefaultTrue,
+		"prebuilts/sdk/current/extras/material-design-x":   Bp2BuildDefaultTrue,
+		"prebuilts/sdk/current/extras/app-toolkit":         Bp2BuildDefaultTrue,
+		"prebuilts/sdk/current/support":                    Bp2BuildDefaultTrue,
+		"prebuilts/tools":                                  Bp2BuildDefaultTrue,
+		"prebuilts/tools/common/m2":                        Bp2BuildDefaultTrue,
 
 		"sdk/dumpeventlog":  Bp2BuildDefaultTrue,
 		"sdk/eventanalyzer": Bp2BuildDefaultTrue,
@@ -375,6 +379,7 @@
 		"system/tools/xsdc/utils":                                Bp2BuildDefaultTrueRecursively,
 		"system/unwinding/libunwindstack":                        Bp2BuildDefaultTrueRecursively,
 
+		"tools/apifinder":                            Bp2BuildDefaultTrue,
 		"tools/apksig":                               Bp2BuildDefaultTrue,
 		"tools/external_updater":                     Bp2BuildDefaultTrueRecursively,
 		"tools/metalava":                             Bp2BuildDefaultTrue,
@@ -454,7 +459,6 @@
 		"framework-connectivity-protos",
 		"gemmlowp_headers",
 		"gl_headers",
-		"ipconnectivity-proto-src",
 		"libandroid_runtime_lazy",
 		"libandroid_runtime_vm_headers",
 		"libaudioclient_aidl_conversion_util",
@@ -726,6 +730,9 @@
 
 		// min_sdk_version in android_app
 		"CtsShimUpgrade",
+
+		// Mainline Module Apps
+		"CaptivePortalLogin",
 	}
 
 	Bp2buildModuleTypeAlwaysConvertList = []string{
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index ade2c49..9c273d9 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -63,6 +63,8 @@
 		"LLVM_NEXT",
 		"ALLOW_UNKNOWN_WARNING_OPTION",
 
+		"UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT",
+
 		// Overrides the version in the apex_manifest.json. The version is unique for
 		// each branch (internal, aosp, mainline releases, dessert releases).  This
 		// enables modules built on an older branch to be installed against a newer
diff --git a/android/filegroup.go b/android/filegroup.go
index c259f21..0ca5dc5 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -81,6 +81,7 @@
 type bazelAidlLibraryAttributes struct {
 	Srcs                bazel.LabelListAttribute
 	Strip_import_prefix *string
+	Deps                bazel.LabelListAttribute
 }
 
 // api srcs can be contained in filegroups.
@@ -119,9 +120,12 @@
 	// and then convert
 	if fg.ShouldConvertToAidlLibrary(ctx) {
 		tags := []string{"apex_available=//apex_available:anyapex"}
+		deps := bazel.MakeLabelListAttribute(BazelLabelForModuleDeps(ctx, fg.properties.Aidl.Deps))
+
 		attrs := &bazelAidlLibraryAttributes{
 			Srcs:                srcs,
 			Strip_import_prefix: fg.properties.Path,
+			Deps:                deps,
 		}
 
 		props := bazel.BazelTargetModuleProperties{
@@ -187,6 +191,14 @@
 	// Create a make variable with the specified name that contains the list of files in the
 	// filegroup, relative to the root of the source tree.
 	Export_to_make_var *string
+
+	// aidl is explicitly provided for implicit aidl dependencies
+	// TODO(b/278298615): aidl prop is a no-op in Soong and is an escape hatch
+	// to include implicit aidl dependencies for bazel migration compatibility
+	Aidl struct {
+		// List of aidl files or filegroup depended on by srcs
+		Deps []string `android:"path"`
+	}
 }
 
 type fileGroup struct {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 557265c..924f923 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -5646,6 +5646,58 @@
 	})
 }
 
+func TestPrebuiltSkipsSymbols(t *testing.T) {
+	testCases := []struct {
+		name               string
+		usePrebuilt        bool
+		installSymbolFiles bool
+	}{
+		{
+			name:               "Source module build rule doesn't install symbol files",
+			usePrebuilt:        true,
+			installSymbolFiles: false,
+		},
+		{
+			name:               "Source module is installed with symbols",
+			usePrebuilt:        false,
+			installSymbolFiles: true,
+		},
+	}
+	for _, tc := range testCases {
+		t.Run(tc.name, func(t *testing.T) {
+			preferProperty := "prefer: false"
+			if tc.usePrebuilt {
+				preferProperty = "prefer: true"
+			}
+			ctx := testApex(t, `
+				// Source module
+				apex {
+					name: "myapex",
+					key: "myapex.key",
+					updatable: false,
+				}
+
+				apex_key {
+					name: "myapex.key",
+					public_key: "testkey.avbpubkey",
+					private_key: "testkey.pem",
+				}
+
+				apex_set {
+					name: "myapex",
+					set: "myapex.apks",
+					`+preferProperty+`
+				}
+			`)
+			// Symbol files are installed by installing entries under ${OUT}/apex/{apex name}
+			android.AssertStringListContainsEquals(t, "Implicits",
+				ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule").Implicits.Strings(),
+				"out/soong/target/product/test_device/apex/myapex/apex_manifest.pb",
+				tc.installSymbolFiles)
+		})
+	}
+}
+
 func TestApexWithTests(t *testing.T) {
 	ctx := testApex(t, `
 		apex_test {
diff --git a/apex/builder.go b/apex/builder.go
index 94aef49..2f8a4ec 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -468,6 +468,10 @@
 	imageDir := android.PathForModuleOut(ctx, "image"+suffix)
 
 	installSymbolFiles := (!ctx.Config().KatiEnabled() || a.ExportedToMake()) && a.installable()
+	// We can't install symbol files when prebuilt is used.
+	if a.IsReplacedByPrebuilt() {
+		installSymbolFiles = false
+	}
 
 	// set of dependency module:location mappings
 	installMapSet := make(map[string]bool)
diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go
index 6a3b3c8..bf3a6b5 100644
--- a/bazel/cquery/request_type.go
+++ b/bazel/cquery/request_type.go
@@ -149,7 +149,6 @@
 rootSharedLibraries = []
 
 shared_info_tag = "//build/bazel/rules/cc:cc_library_shared.bzl%CcSharedLibraryOutputInfo"
-stubs_tag = "//build/bazel/rules/cc:cc_stub_library.bzl%CcStubInfo"
 unstripped_tag = "//build/bazel/rules/cc:stripped_cc_common.bzl%CcUnstrippedInfo"
 unstripped = ""
 
@@ -161,8 +160,6 @@
   unstripped = path
   if unstripped_tag in p:
     unstripped = p[unstripped_tag].unstripped.path
-elif stubs_tag in p:
-  rootSharedLibraries.extend([f.path for f in target.files.to_list()])
 else:
   for linker_input in linker_inputs:
     for library in linker_input.libraries:
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index d78c4a4..cbea943 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -36,6 +36,7 @@
 
 func runCcLibrarySharedTestCase(t *testing.T, tc Bp2buildTestCase) {
 	t.Helper()
+	t.Parallel()
 	(&tc).ModuleTypeUnderTest = "cc_library_shared"
 	(&tc).ModuleTypeUnderTestFactory = cc.LibrarySharedFactory
 	RunBp2BuildTestCase(t, registerCcLibrarySharedModuleTypes, tc)
@@ -1249,40 +1250,3 @@
 		},
 	})
 }
-
-func TestCcLibrarySharedStubsDessertVersionConversion(t *testing.T) {
-	runCcLibrarySharedTestCase(t, Bp2buildTestCase{
-		Description: "cc_library_shared converts dessert codename versions to numerical versions",
-		Blueprint: `
-cc_library_shared {
-	name: "a",
-	include_build_directory: false,
-	stubs: {
-		symbol_file: "a.map.txt",
-		versions: [
-			"Q",
-			"R",
-			"31",
-			"current",
-		],
-	},
-}
-`,
-		ExpectedBazelTargets: []string{
-			makeCcStubSuiteTargets("a", AttrNameToString{
-				"soname":               `"a.so"`,
-				"source_library_label": `"//:a"`,
-				"stubs_symbol_file":    `"a.map.txt"`,
-				"stubs_versions": `[
-        "29",
-        "30",
-        "31",
-        "current",
-    ]`,
-			}),
-			MakeBazelTarget("cc_library_shared", "a", AttrNameToString{
-				"stubs_symbol_file": `"a.map.txt"`,
-			}),
-		},
-	})
-}
diff --git a/bp2build/cc_prebuilt_library_conversion_test.go b/bp2build/cc_prebuilt_library_conversion_test.go
index c5a6dfd..b88960e 100644
--- a/bp2build/cc_prebuilt_library_conversion_test.go
+++ b/bp2build/cc_prebuilt_library_conversion_test.go
@@ -20,12 +20,17 @@
 	"android/soong/cc"
 )
 
+func runCcPrebuiltLibraryTestCase(t *testing.T, tc Bp2buildTestCase) {
+	t.Helper()
+	(&tc).ModuleTypeUnderTest = "cc_prebuilt_library"
+	(&tc).ModuleTypeUnderTestFactory = cc.PrebuiltLibraryFactory
+	RunBp2BuildTestCaseSimple(t, tc)
+}
+
 func TestPrebuiltLibraryStaticAndSharedSimple(t *testing.T) {
-	RunBp2BuildTestCaseSimple(t,
+	runCcPrebuiltLibraryTestCase(t,
 		Bp2buildTestCase{
-			Description:                "prebuilt library static and shared simple",
-			ModuleTypeUnderTest:        "cc_prebuilt_library",
-			ModuleTypeUnderTestFactory: cc.PrebuiltLibraryFactory,
+			Description: "prebuilt library static and shared simple",
 			Filesystem: map[string]string{
 				"libf.so": "",
 			},
@@ -51,11 +56,9 @@
 }
 
 func TestPrebuiltLibraryWithArchVariance(t *testing.T) {
-	RunBp2BuildTestCaseSimple(t,
+	runCcPrebuiltLibraryTestCase(t,
 		Bp2buildTestCase{
-			Description:                "prebuilt library with arch variance",
-			ModuleTypeUnderTest:        "cc_prebuilt_library",
-			ModuleTypeUnderTestFactory: cc.PrebuiltLibraryFactory,
+			Description: "prebuilt library with arch variance",
 			Filesystem: map[string]string{
 				"libf.so": "",
 				"libg.so": "",
@@ -95,11 +98,9 @@
 }
 
 func TestPrebuiltLibraryAdditionalAttrs(t *testing.T) {
-	RunBp2BuildTestCaseSimple(t,
+	runCcPrebuiltLibraryTestCase(t,
 		Bp2buildTestCase{
-			Description:                "prebuilt library additional attributes",
-			ModuleTypeUnderTest:        "cc_prebuilt_library",
-			ModuleTypeUnderTestFactory: cc.PrebuiltLibraryFactory,
+			Description: "prebuilt library additional attributes",
 			Filesystem: map[string]string{
 				"libf.so":             "",
 				"testdir/1/include.h": "",
@@ -125,20 +126,19 @@
 					"export_system_includes": `["testdir/2/"]`,
 					"alwayslink":             "True",
 				}),
-				// TODO(b/229374533): When fixed, update this test
 				MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
-					"shared_library": `"libf.so"`,
+					"shared_library":         `"libf.so"`,
+					"export_includes":        `["testdir/1/"]`,
+					"export_system_includes": `["testdir/2/"]`,
 				}),
 			},
 		})
 }
 
 func TestPrebuiltLibrarySharedStanzaFails(t *testing.T) {
-	RunBp2BuildTestCaseSimple(t,
+	runCcPrebuiltLibraryTestCase(t,
 		Bp2buildTestCase{
-			Description:                "prebuilt library with shared stanza fails because multiple sources",
-			ModuleTypeUnderTest:        "cc_prebuilt_library",
-			ModuleTypeUnderTestFactory: cc.PrebuiltLibraryFactory,
+			Description: "prebuilt library with shared stanza fails because multiple sources",
 			Filesystem: map[string]string{
 				"libf.so": "",
 				"libg.so": "",
@@ -180,11 +180,9 @@
 }
 
 func TestPrebuiltLibrarySharedAndStaticStanzas(t *testing.T) {
-	RunBp2BuildTestCaseSimple(t,
+	runCcPrebuiltLibraryTestCase(t,
 		Bp2buildTestCase{
-			Description:                "prebuilt library with both shared and static stanzas",
-			ModuleTypeUnderTest:        "cc_prebuilt_library",
-			ModuleTypeUnderTestFactory: cc.PrebuiltLibraryFactory,
+			Description: "prebuilt library with both shared and static stanzas",
 			Filesystem: map[string]string{
 				"libf.so": "",
 				"libg.so": "",
@@ -217,11 +215,9 @@
 
 // TODO(b/228623543): When this bug is fixed, enable this test
 //func TestPrebuiltLibraryOnlyShared(t *testing.T) {
-//	RunBp2BuildTestCaseSimple(t,
+//	runCcPrebuiltLibraryTestCase(t,
 //		bp2buildTestCase{
 //			description:                "prebuilt library shared only",
-//			moduleTypeUnderTest:        "cc_prebuilt_library",
-//			moduleTypeUnderTestFactory: cc.PrebuiltLibraryFactory,
 //			filesystem: map[string]string{
 //				"libf.so": "",
 //			},
@@ -244,11 +240,9 @@
 
 // TODO(b/228623543): When this bug is fixed, enable this test
 //func TestPrebuiltLibraryOnlyStatic(t *testing.T) {
-//	RunBp2BuildTestCaseSimple(t,
+//	runCcPrebuiltLibraryTestCase(t,
 //		bp2buildTestCase{
 //			description:                "prebuilt library static only",
-//			moduleTypeUnderTest:        "cc_prebuilt_library",
-//			moduleTypeUnderTestFactory: cc.PrebuiltLibraryFactory,
 //			filesystem: map[string]string{
 //				"libf.so": "",
 //			},
@@ -272,3 +266,97 @@
 //			},
 //		})
 //}
+
+func TestPrebuiltLibraryWithExportIncludesArchVariant(t *testing.T) {
+	runCcPrebuiltLibraryTestCase(t, Bp2buildTestCase{
+		Description: "cc_prebuilt_library correctly translates export_includes with arch variance",
+		Filesystem: map[string]string{
+			"libf.so": "",
+			"libg.so": "",
+		},
+		Blueprint: `
+cc_prebuilt_library {
+	name: "libtest",
+	srcs: ["libf.so"],
+	arch: {
+		arm: { export_include_dirs: ["testdir/1/"], },
+		arm64: { export_include_dirs: ["testdir/2/"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
+				"shared_library": `"libf.so"`,
+				"export_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest_bp2build_cc_library_static", AttrNameToString{
+				"static_library": `"libf.so"`,
+				"export_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest_bp2build_cc_library_static_alwayslink", AttrNameToString{
+				"alwayslink":     "True",
+				"static_library": `"libf.so"`,
+				"export_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+		},
+	})
+}
+
+func TestPrebuiltLibraryWithExportSystemIncludesArchVariant(t *testing.T) {
+	runCcPrebuiltLibraryTestCase(t, Bp2buildTestCase{
+		Description: "cc_prebuilt_ibrary correctly translates export_system_includes with arch variance",
+		Filesystem: map[string]string{
+			"libf.so": "",
+			"libg.so": "",
+		},
+		Blueprint: `
+cc_prebuilt_library {
+	name: "libtest",
+	srcs: ["libf.so"],
+	arch: {
+		arm: { export_system_include_dirs: ["testdir/1/"], },
+		arm64: { export_system_include_dirs: ["testdir/2/"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
+				"shared_library": `"libf.so"`,
+				"export_system_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest_bp2build_cc_library_static", AttrNameToString{
+				"static_library": `"libf.so"`,
+				"export_system_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest_bp2build_cc_library_static_alwayslink", AttrNameToString{
+				"alwayslink":     "True",
+				"static_library": `"libf.so"`,
+				"export_system_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+		},
+	})
+}
diff --git a/bp2build/cc_prebuilt_library_shared_conversion_test.go b/bp2build/cc_prebuilt_library_shared_conversion_test.go
new file mode 100644
index 0000000..9e975ae
--- /dev/null
+++ b/bp2build/cc_prebuilt_library_shared_conversion_test.go
@@ -0,0 +1,165 @@
+// Copyright 2022 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package bp2build
+
+import (
+	"testing"
+
+	"android/soong/cc"
+)
+
+func runCcPrebuiltLibrarySharedTestCase(t *testing.T, tc Bp2buildTestCase) {
+	t.Parallel()
+	t.Helper()
+	(&tc).ModuleTypeUnderTest = "cc_prebuilt_library_shared"
+	(&tc).ModuleTypeUnderTestFactory = cc.PrebuiltSharedLibraryFactory
+	RunBp2BuildTestCaseSimple(t, tc)
+}
+
+func TestPrebuiltLibrarySharedSimple(t *testing.T) {
+	runCcPrebuiltLibrarySharedTestCase(t,
+		Bp2buildTestCase{
+			Description: "prebuilt library shared simple",
+			Filesystem: map[string]string{
+				"libf.so": "",
+			},
+			Blueprint: `
+cc_prebuilt_library_shared {
+	name: "libtest",
+	srcs: ["libf.so"],
+	bazel_module: { bp2build_available: true },
+}`,
+			ExpectedBazelTargets: []string{
+				MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
+					"shared_library": `"libf.so"`,
+				}),
+			},
+		})
+}
+
+func TestPrebuiltLibrarySharedWithArchVariance(t *testing.T) {
+	runCcPrebuiltLibrarySharedTestCase(t,
+		Bp2buildTestCase{
+			Description: "prebuilt library shared with arch variance",
+			Filesystem: map[string]string{
+				"libf.so": "",
+				"libg.so": "",
+			},
+			Blueprint: `
+cc_prebuilt_library_shared {
+	name: "libtest",
+	arch: {
+		arm64: { srcs: ["libf.so"], },
+		arm: { srcs: ["libg.so"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+			ExpectedBazelTargets: []string{
+				MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
+					"shared_library": `select({
+        "//build/bazel/platforms/arch:arm": "libg.so",
+        "//build/bazel/platforms/arch:arm64": "libf.so",
+        "//conditions:default": None,
+    })`,
+				}),
+			},
+		})
+}
+
+func TestPrebuiltLibrarySharedAdditionalAttrs(t *testing.T) {
+	runCcPrebuiltLibrarySharedTestCase(t,
+		Bp2buildTestCase{
+			Description: "prebuilt library shared additional attributes",
+			Filesystem: map[string]string{
+				"libf.so":             "",
+				"testdir/1/include.h": "",
+				"testdir/2/other.h":   "",
+			},
+			Blueprint: `
+cc_prebuilt_library_shared {
+	name: "libtest",
+	srcs: ["libf.so"],
+	export_include_dirs: ["testdir/1/"],
+	export_system_include_dirs: ["testdir/2/"],
+	bazel_module: { bp2build_available: true },
+}`,
+			ExpectedBazelTargets: []string{
+				MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
+					"shared_library":         `"libf.so"`,
+					"export_includes":        `["testdir/1/"]`,
+					"export_system_includes": `["testdir/2/"]`,
+				}),
+			},
+		})
+}
+
+func TestPrebuiltLibrarySharedWithExportIncludesArchVariant(t *testing.T) {
+	runCcPrebuiltLibrarySharedTestCase(t, Bp2buildTestCase{
+		Description: "cc_prebuilt_library_shared correctly translates export_includes with arch variance",
+		Filesystem: map[string]string{
+			"libf.so": "",
+			"libg.so": "",
+		},
+		Blueprint: `
+cc_prebuilt_library_shared {
+	name: "libtest",
+	srcs: ["libf.so"],
+	arch: {
+		arm: { export_include_dirs: ["testdir/1/"], },
+		arm64: { export_include_dirs: ["testdir/2/"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
+				"shared_library": `"libf.so"`,
+				"export_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+		},
+	})
+}
+
+func TestPrebuiltLibrarySharedWithExportSystemIncludesArchVariant(t *testing.T) {
+	runCcPrebuiltLibrarySharedTestCase(t, Bp2buildTestCase{
+		Description: "cc_prebuilt_library_shared correctly translates export_system_includes with arch variance",
+		Filesystem: map[string]string{
+			"libf.so": "",
+			"libg.so": "",
+		},
+		Blueprint: `
+cc_prebuilt_library_shared {
+	name: "libtest",
+	srcs: ["libf.so"],
+	arch: {
+		arm: { export_system_include_dirs: ["testdir/1/"], },
+		arm64: { export_system_include_dirs: ["testdir/2/"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("cc_prebuilt_library_shared", "libtest", AttrNameToString{
+				"shared_library": `"libf.so"`,
+				"export_system_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+		},
+	})
+}
diff --git a/bp2build/cc_prebuilt_library_static_conversion_test.go b/bp2build/cc_prebuilt_library_static_conversion_test.go
new file mode 100644
index 0000000..77562e7
--- /dev/null
+++ b/bp2build/cc_prebuilt_library_static_conversion_test.go
@@ -0,0 +1,199 @@
+// Copyright 2022 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package bp2build
+
+import (
+	"testing"
+
+	"android/soong/cc"
+)
+
+func runCcPrebuiltLibraryStaticTestCase(t *testing.T, tc Bp2buildTestCase) {
+	t.Parallel()
+	t.Helper()
+	(&tc).ModuleTypeUnderTest = "cc_prebuilt_library_static"
+	(&tc).ModuleTypeUnderTestFactory = cc.PrebuiltStaticLibraryFactory
+	RunBp2BuildTestCaseSimple(t, tc)
+}
+
+func TestPrebuiltLibraryStaticSimple(t *testing.T) {
+	runCcPrebuiltLibraryStaticTestCase(t,
+		Bp2buildTestCase{
+			Description: "prebuilt library static simple",
+			Filesystem: map[string]string{
+				"libf.so": "",
+			},
+			Blueprint: `
+cc_prebuilt_library_static {
+	name: "libtest",
+	srcs: ["libf.so"],
+	bazel_module: { bp2build_available: true },
+}`,
+			ExpectedBazelTargets: []string{
+				MakeBazelTarget("cc_prebuilt_library_static", "libtest", AttrNameToString{
+					"static_library": `"libf.so"`,
+				}),
+				MakeBazelTarget("cc_prebuilt_library_static", "libtest_alwayslink", AttrNameToString{
+					"static_library": `"libf.so"`,
+					"alwayslink":     "True",
+				}),
+			},
+		})
+}
+
+func TestPrebuiltLibraryStaticWithArchVariance(t *testing.T) {
+	runCcPrebuiltLibraryStaticTestCase(t,
+		Bp2buildTestCase{
+			Description: "prebuilt library with arch variance",
+			Filesystem: map[string]string{
+				"libf.so": "",
+				"libg.so": "",
+			},
+			Blueprint: `
+cc_prebuilt_library_static {
+	name: "libtest",
+	arch: {
+		arm64: { srcs: ["libf.so"], },
+		arm: { srcs: ["libg.so"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+			ExpectedBazelTargets: []string{
+				MakeBazelTarget("cc_prebuilt_library_static", "libtest", AttrNameToString{
+					"static_library": `select({
+        "//build/bazel/platforms/arch:arm": "libg.so",
+        "//build/bazel/platforms/arch:arm64": "libf.so",
+        "//conditions:default": None,
+    })`}),
+				MakeBazelTarget("cc_prebuilt_library_static", "libtest_alwayslink", AttrNameToString{
+					"alwayslink": "True",
+					"static_library": `select({
+        "//build/bazel/platforms/arch:arm": "libg.so",
+        "//build/bazel/platforms/arch:arm64": "libf.so",
+        "//conditions:default": None,
+    })`}),
+			},
+		})
+}
+
+func TestPrebuiltLibraryStaticAdditionalAttrs(t *testing.T) {
+	runCcPrebuiltLibraryStaticTestCase(t,
+		Bp2buildTestCase{
+			Description: "prebuilt library additional attributes",
+			Filesystem: map[string]string{
+				"libf.so":             "",
+				"testdir/1/include.h": "",
+				"testdir/2/other.h":   "",
+			},
+			Blueprint: `
+cc_prebuilt_library_static {
+	name: "libtest",
+	srcs: ["libf.so"],
+	export_include_dirs: ["testdir/1/"],
+	export_system_include_dirs: ["testdir/2/"],
+	bazel_module: { bp2build_available: true },
+}`,
+			ExpectedBazelTargets: []string{
+				MakeBazelTarget("cc_prebuilt_library_static", "libtest", AttrNameToString{
+					"static_library":         `"libf.so"`,
+					"export_includes":        `["testdir/1/"]`,
+					"export_system_includes": `["testdir/2/"]`,
+				}),
+				MakeBazelTarget("cc_prebuilt_library_static", "libtest_alwayslink", AttrNameToString{
+					"static_library":         `"libf.so"`,
+					"export_includes":        `["testdir/1/"]`,
+					"export_system_includes": `["testdir/2/"]`,
+					"alwayslink":             "True",
+				}),
+			},
+		})
+}
+
+func TestPrebuiltLibraryStaticWithExportIncludesArchVariant(t *testing.T) {
+	runCcPrebuiltLibraryStaticTestCase(t, Bp2buildTestCase{
+		Description: "cc_prebuilt_library_static correctly translates export_includes with arch variance",
+		Filesystem: map[string]string{
+			"libf.so": "",
+			"libg.so": "",
+		},
+		Blueprint: `
+cc_prebuilt_library_static {
+	name: "libtest",
+	srcs: ["libf.so"],
+	arch: {
+		arm: { export_include_dirs: ["testdir/1/"], },
+		arm64: { export_include_dirs: ["testdir/2/"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest", AttrNameToString{
+				"static_library": `"libf.so"`,
+				"export_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest_alwayslink", AttrNameToString{
+				"alwayslink":     "True",
+				"static_library": `"libf.so"`,
+				"export_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+		},
+	})
+}
+
+func TestPrebuiltLibraryStaticWithExportSystemIncludesArchVariant(t *testing.T) {
+	runCcPrebuiltLibraryStaticTestCase(t, Bp2buildTestCase{
+		Description: "cc_prebuilt_library_static correctly translates export_system_includes with arch variance",
+		Filesystem: map[string]string{
+			"libf.so": "",
+			"libg.so": "",
+		},
+		Blueprint: `
+cc_prebuilt_library_static {
+	name: "libtest",
+	srcs: ["libf.so"],
+	arch: {
+		arm: { export_system_include_dirs: ["testdir/1/"], },
+		arm64: { export_system_include_dirs: ["testdir/2/"], },
+	},
+	bazel_module: { bp2build_available: true },
+}`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest", AttrNameToString{
+				"static_library": `"libf.so"`,
+				"export_system_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+			MakeBazelTarget("cc_prebuilt_library_static", "libtest_alwayslink", AttrNameToString{
+				"alwayslink":     "True",
+				"static_library": `"libf.so"`,
+				"export_system_includes": `select({
+        "//build/bazel/platforms/arch:arm": ["testdir/1/"],
+        "//build/bazel/platforms/arch:arm64": ["testdir/2/"],
+        "//conditions:default": [],
+    })`,
+			}),
+		},
+	})
+}
diff --git a/bp2build/filegroup_conversion_test.go b/bp2build/filegroup_conversion_test.go
index 7ce559d..273d556 100644
--- a/bp2build/filegroup_conversion_test.go
+++ b/bp2build/filegroup_conversion_test.go
@@ -105,6 +105,42 @@
 	}
 }
 
+func TestFilegroupWithAidlDeps(t *testing.T) {
+	bp := `
+	filegroup {
+		name: "bar",
+		srcs: ["bar.aidl"],
+	}
+	filegroup {
+		name: "foo",
+		srcs: ["aidl/foo.aidl"],
+		path: "aidl",
+		aidl: {
+			deps: [":bar"],
+		}
+	}`
+
+	t.Run("filegroup with aidl deps", func(t *testing.T) {
+		expectedBazelTargets := []string{
+			MakeBazelTargetNoRestrictions("aidl_library", "bar", AttrNameToString{
+				"srcs": `["bar.aidl"]`,
+				"tags": `["apex_available=//apex_available:anyapex"]`,
+			}),
+			MakeBazelTargetNoRestrictions("aidl_library", "foo", AttrNameToString{
+				"srcs":                `["aidl/foo.aidl"]`,
+				"strip_import_prefix": `"aidl"`,
+				"deps":                `[":bar"]`,
+				"tags":                `["apex_available=//apex_available:anyapex"]`,
+			}),
+		}
+		runFilegroupTestCase(t, Bp2buildTestCase{
+			Description:          "filegroup with aidl deps",
+			Blueprint:            bp,
+			ExpectedBazelTargets: expectedBazelTargets,
+		})
+	})
+}
+
 func TestFilegroupWithAidlAndNonAidlSrcs(t *testing.T) {
 	runFilegroupTestCase(t, Bp2buildTestCase{
 		Description: "filegroup with aidl and non-aidl srcs",
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 4ac1c20..c8f516c 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -762,10 +762,8 @@
 
 			if libraryProps, ok := archVariantLibraryProperties[axis][cfg].(*LibraryProperties); ok {
 				if axis == bazel.NoConfigAxis {
-					versions := android.CopyOf(libraryProps.Stubs.Versions)
-					normalizeVersions(ctx, versions)
 					compilerAttrs.stubsSymbolFile = libraryProps.Stubs.Symbol_file
-					compilerAttrs.stubsVersions.SetSelectValue(axis, cfg, versions)
+					compilerAttrs.stubsVersions.SetSelectValue(axis, cfg, libraryProps.Stubs.Versions)
 				}
 				if suffix := libraryProps.Suffix; suffix != nil {
 					compilerAttrs.suffix.SetSelectValue(axis, cfg, suffix)
diff --git a/cc/cc.go b/cc/cc.go
index 0addb60..1997e94 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1964,17 +1964,6 @@
 	c.maybeInstall(mctx, apexInfo)
 }
 
-func moduleContextFromAndroidModuleContext(actx android.ModuleContext, c *Module) ModuleContext {
-	ctx := &moduleContext{
-		ModuleContext: actx,
-		moduleContextImpl: moduleContextImpl{
-			mod: c,
-		},
-	}
-	ctx.ctx = ctx
-	return ctx
-}
-
 func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
 	// Handle the case of a test module split by `test_per_src` mutator.
 	//
@@ -1994,7 +1983,13 @@
 
 	c.makeLinkType = GetMakeLinkType(actx, c)
 
-	ctx := moduleContextFromAndroidModuleContext(actx, c)
+	ctx := &moduleContext{
+		ModuleContext: actx,
+		moduleContextImpl: moduleContextImpl{
+			mod: c,
+		},
+	}
+	ctx.ctx = ctx
 
 	deps := c.depsToPaths(ctx)
 	if ctx.Failed() {
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 3ae4b15..b986511 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -3680,133 +3680,6 @@
 	}
 }
 
-func TestMixedBuildUsesStubs(t *testing.T) {
-	// TODO(b/275313114): Test exposes non-determinism which should be corrected and the test
-	// reenabled.
-	t.Skip()
-	t.Parallel()
-	bp := `
-		cc_library_shared {
-			name: "libFoo",
-			bazel_module: { label: "//:libFoo" },
-			srcs: ["foo.c"],
-			stubs: {
-				symbol_file: "foo.map.txt",
-				versions: ["current"],
-			},
-			apex_available: ["bar", "a1"],
-		}
-
-		cc_library_shared {
-			name: "libBar",
-			srcs: ["bar.c"],
-			shared_libs: ["libFoo"],
-			apex_available: ["a1"],
-		}
-
-		cc_library_shared {
-			name: "libA1",
-			srcs: ["a1.c"],
-			shared_libs: ["libFoo"],
-			apex_available: ["a1"],
-		}
-
-		cc_library_shared {
-			name: "libBarA1",
-			srcs: ["bara1.c"],
-			shared_libs: ["libFoo"],
-			apex_available: ["bar", "a1"],
-		}
-
-		cc_library_shared {
-			name: "libAnyApex",
-			srcs: ["anyApex.c"],
-			shared_libs: ["libFoo"],
-			apex_available: ["//apex_available:anyapex"],
-		}
-
-		cc_library_shared {
-			name: "libBaz",
-			srcs: ["baz.c"],
-			shared_libs: ["libFoo"],
-			apex_available: ["baz"],
-		}
-
-		cc_library_shared {
-			name: "libQux",
-			srcs: ["qux.c"],
-			shared_libs: ["libFoo"],
-			apex_available: ["qux", "bar"],
-		}`
-
-	result := android.GroupFixturePreparers(
-		prepareForCcTest,
-		android.FixtureModifyConfig(func(config android.Config) {
-			config.BazelContext = android.MockBazelContext{
-				OutputBaseDir: "out/bazel",
-				LabelToCcInfo: map[string]cquery.CcInfo{
-					"//:libFoo": {
-						RootDynamicLibraries: []string{"libFoo.so"},
-					},
-					"//:libFoo_stub_libs-current": {
-						RootDynamicLibraries: []string{"libFoo_stub_libs-current.so"},
-					},
-				},
-			}
-		}),
-	).RunTestWithBp(t, bp)
-	ctx := result.TestContext
-
-	variants := ctx.ModuleVariantsForTests("libFoo")
-	expectedVariants := []string{
-		"android_arm64_armv8-a_shared",
-		"android_arm64_armv8-a_shared_current",
-		"android_arm_armv7-a-neon_shared",
-		"android_arm_armv7-a-neon_shared_current",
-	}
-	variantsMismatch := false
-	if len(variants) != len(expectedVariants) {
-		variantsMismatch = true
-	} else {
-		for _, v := range expectedVariants {
-			if !inList(v, variants) {
-				variantsMismatch = false
-			}
-		}
-	}
-	if variantsMismatch {
-		t.Errorf("variants of libFoo expected:\n")
-		for _, v := range expectedVariants {
-			t.Errorf("%q\n", v)
-		}
-		t.Errorf(", but got:\n")
-		for _, v := range variants {
-			t.Errorf("%q\n", v)
-		}
-	}
-
-	linkAgainstFoo := []string{"libBarA1"}
-	linkAgainstFooStubs := []string{"libBar", "libA1", "libBaz", "libQux", "libAnyApex"}
-
-	libFooPath := "out/bazel/execroot/__main__/libFoo.so"
-	for _, lib := range linkAgainstFoo {
-		libLinkRule := ctx.ModuleForTests(lib, "android_arm64_armv8-a_shared").Rule("ld")
-		libFlags := libLinkRule.Args["libFlags"]
-		if !strings.Contains(libFlags, libFooPath) {
-			t.Errorf("%q: %q is not found in %q", lib, libFooPath, libFlags)
-		}
-	}
-
-	libFooStubPath := "out/bazel/execroot/__main__/libFoo_stub_libs-current.so"
-	for _, lib := range linkAgainstFooStubs {
-		libLinkRule := ctx.ModuleForTests(lib, "android_arm64_armv8-a_shared").Rule("ld")
-		libFlags := libLinkRule.Args["libFlags"]
-		if !strings.Contains(libFlags, libFooStubPath) {
-			t.Errorf("%q: %q is not found in %q", lib, libFooStubPath, libFlags)
-		}
-	}
-}
-
 func TestVersioningMacro(t *testing.T) {
 	t.Parallel()
 	for _, tc := range []struct{ moduleName, expected string }{
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index 76c8e5d..a63d5c2 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -26,8 +26,6 @@
 		// Help catch common 32/64-bit errors.
 		"-Werror=implicit-function-declaration",
 		"-fno-emulated-tls",
-		// For -fsanitize=shadow-call-stack.
-		"-ffixed-x18",
 		// A temporary fix for SExtWRemoval miscompilation bug.
 		"-mllvm",
 		"-riscv-disable-sextw-removal=true",
@@ -37,8 +35,6 @@
 
 	riscv64Ldflags = []string{
 		"-Wl,--hash-style=gnu",
-		// For -fsanitize=shadow-call-stack.
-		"-ffixed-x18",
 	}
 
 	riscv64Lldflags = append(riscv64Ldflags,
diff --git a/cc/library.go b/cc/library.go
index 80797a3..172ca64 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -931,17 +931,9 @@
 func (handler *ccLibraryBazelHandler) QueueBazelCall(ctx android.BaseModuleContext, label string) {
 	bazelCtx := ctx.Config().BazelContext
 	bazelCtx.QueueBazelRequest(label, cquery.GetCcInfo, android.GetConfigKeyApexVariant(ctx, GetApexConfigKey(ctx)))
-	if v := handler.module.library.stubsVersion(); v != "" {
-		stubsLabel := label + "_stub_libs-" + v
-		bazelCtx.QueueBazelRequest(stubsLabel, cquery.GetCcInfo, android.GetConfigKeyApexVariant(ctx, GetApexConfigKey(ctx)))
-	}
 }
 
 func (handler *ccLibraryBazelHandler) ProcessBazelQueryResponse(ctx android.ModuleContext, label string) {
-	if v := handler.module.library.stubsVersion(); v != "" {
-		// if we are a stubs variant, just use the Bazel stubs target
-		label = label + "_stub_libs-" + v
-	}
 	bazelCtx := ctx.Config().BazelContext
 	ccInfo, err := bazelCtx.GetCcInfo(label, android.GetConfigKeyApexVariant(ctx, GetApexConfigKey(ctx)))
 	if err != nil {
@@ -970,9 +962,6 @@
 	}
 
 	handler.module.setAndroidMkVariablesFromCquery(ccInfo.CcAndroidMkInfo)
-
-	cctx := moduleContextFromAndroidModuleContext(ctx, handler.module)
-	addStubDependencyProviders(cctx)
 }
 
 func (library *libraryDecorator) setFlagExporterInfoFromCcInfo(ctx android.ModuleContext, ccInfo cquery.CcInfo) {
@@ -1798,12 +1787,6 @@
 		Target:                               ctx.Target(),
 	})
 
-	addStubDependencyProviders(ctx)
-
-	return unstrippedOutputFile
-}
-
-func addStubDependencyProviders(ctx ModuleContext) {
 	stubs := ctx.GetDirectDepsWithTag(stubImplDepTag)
 	if len(stubs) > 0 {
 		var stubsInfo []SharedStubLibrary
@@ -1818,9 +1801,12 @@
 		}
 		ctx.SetProvider(SharedLibraryStubsProvider, SharedLibraryStubsInfo{
 			SharedStubLibraries: stubsInfo,
-			IsLLNDK:             ctx.IsLlndk(),
+
+			IsLLNDK: ctx.IsLlndk(),
 		})
 	}
+
+	return unstrippedOutputFile
 }
 
 func (library *libraryDecorator) unstrippedOutputFilePath() android.Path {
@@ -2671,7 +2657,7 @@
 // normalizeVersions modifies `versions` in place, so that each raw version
 // string becomes its normalized canonical form.
 // Validates that the versions in `versions` are specified in least to greatest order.
-func normalizeVersions(ctx android.BazelConversionPathContext, versions []string) {
+func normalizeVersions(ctx android.BaseModuleContext, versions []string) {
 	var previous android.ApiLevel
 	for i, v := range versions {
 		ver, err := android.ApiLevelFromUser(ctx, v)
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index 4470f54..0b5841e 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -376,6 +376,7 @@
 		Static_library:         prebuiltAttrs.Src,
 		Export_includes:        exportedIncludes.Includes,
 		Export_system_includes: exportedIncludes.SystemIncludes,
+		// TODO: ¿Alwayslink?
 	}
 
 	props := bazel.BazelTargetModuleProperties{
@@ -398,14 +399,19 @@
 }
 
 type bazelPrebuiltLibrarySharedAttributes struct {
-	Shared_library bazel.LabelAttribute
+	Shared_library         bazel.LabelAttribute
+	Export_includes        bazel.StringListAttribute
+	Export_system_includes bazel.StringListAttribute
 }
 
 func prebuiltLibrarySharedBp2Build(ctx android.TopDownMutatorContext, module *Module) {
 	prebuiltAttrs := Bp2BuildParsePrebuiltLibraryProps(ctx, module, false)
+	exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, nil)
 
 	attrs := &bazelPrebuiltLibrarySharedAttributes{
-		Shared_library: prebuiltAttrs.Src,
+		Shared_library:         prebuiltAttrs.Src,
+		Export_includes:        exportedIncludes.Includes,
+		Export_system_includes: exportedIncludes.SystemIncludes,
 	}
 
 	props := bazel.BazelTargetModuleProperties{
diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go
index 8175a37..79d2412 100644
--- a/fuzz/fuzz_common.go
+++ b/fuzz/fuzz_common.go
@@ -338,6 +338,8 @@
 	IsJni *bool `json:"is_jni,omitempty"`
 	// List of modules for monitoring coverage drops in directories (e.g. "libicu")
 	Target_modules []string `json:"target_modules,omitempty"`
+	// Specifies a bug assignee to replace default ISE assignment
+	Assignee string `json:"assignee,omitempty"`
 }
 
 type FuzzFrameworks struct {
diff --git a/java/testing.go b/java/testing.go
index 0764d26..f68e12f 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -389,15 +389,16 @@
 	}
 
 	extraApiLibraryModules := map[string]string{
-		"android_stubs_current.from-text":               "api/current.txt",
-		"android_system_stubs_current.from-text":        "api/system-current.txt",
-		"android_test_stubs_current.from-text":          "api/test-current.txt",
-		"android_module_lib_stubs_current.from-text":    "api/module-lib-current.txt",
-		"android_system_server_stubs_current.from-text": "api/system-server-current.txt",
-		"core.current.stubs.from-text":                  "api/current.txt",
-		"legacy.core.platform.api.stubs.from-text":      "api/current.txt",
-		"stable.core.platform.api.stubs.from-text":      "api/current.txt",
-		"core-lambda-stubs.from-text":                   "api/current.txt",
+		"android_stubs_current.from-text":                 "api/current.txt",
+		"android_system_stubs_current.from-text":          "api/system-current.txt",
+		"android_test_stubs_current.from-text":            "api/test-current.txt",
+		"android_module_lib_stubs_current.from-text":      "api/module-lib-current.txt",
+		"android_module_lib_stubs_current_full.from-text": "api/module-lib-current.txt",
+		"android_system_server_stubs_current.from-text":   "api/system-server-current.txt",
+		"core.current.stubs.from-text":                    "api/current.txt",
+		"legacy.core.platform.api.stubs.from-text":        "api/current.txt",
+		"stable.core.platform.api.stubs.from-text":        "api/current.txt",
+		"core-lambda-stubs.from-text":                     "api/current.txt",
 	}
 
 	for libName, apiFile := range extraApiLibraryModules {
diff --git a/rust/config/global.go b/rust/config/global.go
index 8894938..2d1f0c1 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -104,7 +104,7 @@
 
 	pctx.ImportAs("cc_config", "android/soong/cc/config")
 	pctx.StaticVariable("RustLinker", "${cc_config.ClangBin}/clang++")
-	pctx.StaticVariable("RustLinkerArgs", "")
+	pctx.StaticVariable("RustLinkerArgs", "-Wl,--as-needed")
 
 	pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))
 
diff --git a/ui/build/build.go b/ui/build/build.go
index edc595d..6874ef7 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -259,10 +259,16 @@
 		startGoma(ctx, config)
 	}
 
+	rbeCh := make(chan bool)
 	if config.StartRBE() {
 		cleanupRBELogsDir(ctx, config)
-		startRBE(ctx, config)
+		go func() {
+			startRBE(ctx, config)
+			close(rbeCh)
+		}()
 		defer DumpRBEMetrics(ctx, config, filepath.Join(config.LogsDir(), "rbe_metrics.pb"))
+	} else {
+		close(rbeCh)
 	}
 
 	if what&RunProductConfig != 0 {
@@ -315,11 +321,11 @@
 		testForDanglingRules(ctx, config)
 	}
 
+	<-rbeCh
 	if what&RunNinja != 0 {
 		if what&RunKati != 0 {
 			installCleanIfNecessary(ctx, config)
 		}
-
 		runNinjaForBuild(ctx, config)
 	}
 
diff --git a/ui/build/config.go b/ui/build/config.go
index a755d14..bf4aec9 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -1374,6 +1374,15 @@
 	return filepath.Join(buildTmpDir, "rbe")
 }
 
+func (c *configImpl) rbeCacheDir() string {
+	for _, f := range []string{"RBE_cache_dir", "FLAG_cache_dir"} {
+		if v, ok := c.environ.Get(f); ok {
+			return v
+		}
+	}
+	return shared.JoinPath(c.SoongOutDir(), "rbe")
+}
+
 func (c *configImpl) shouldCleanupRBELogsDir() bool {
 	// Perform a log directory cleanup only when the log directory
 	// is auto created by the build rather than user-specified.
diff --git a/ui/build/rbe.go b/ui/build/rbe.go
index 1d17216..6479925 100644
--- a/ui/build/rbe.go
+++ b/ui/build/rbe.go
@@ -60,6 +60,7 @@
 		"RBE_exec_root":     config.rbeExecRoot(),
 		"RBE_output_dir":    config.rbeProxyLogsDir(),
 		"RBE_proxy_log_dir": config.rbeProxyLogsDir(),
+		"RBE_cache_dir":     config.rbeCacheDir(),
 		"RBE_platform":      "container-image=" + remoteexec.DefaultImage,
 	}
 	if config.StartRBE() {