Merge "Use system modules for prebuilt SDKs >=30"
diff --git a/android/apex.go b/android/apex.go
index 9056c3d..75be150 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -421,21 +421,15 @@
 type DepNameToDepInfoMap map[string]ApexModuleDepInfo
 
 type ApexBundleDepsInfo struct {
-	minSdkVersion string
-	flatListPath  OutputPath
-	fullListPath  OutputPath
+	flatListPath OutputPath
+	fullListPath OutputPath
 }
 
 type ApexDepsInfoIntf interface {
-	MinSdkVersion() string
 	FlatListPath() Path
 	FullListPath() Path
 }
 
-func (d *ApexBundleDepsInfo) MinSdkVersion() string {
-	return d.minSdkVersion
-}
-
 func (d *ApexBundleDepsInfo) FlatListPath() Path {
 	return d.flatListPath
 }
@@ -450,8 +444,6 @@
 // 1. FullList with transitive deps and their parents in the dep graph
 // 2. FlatList with a flat list of transitive deps
 func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, minSdkVersion string, depInfos DepNameToDepInfoMap) {
-	d.minSdkVersion = minSdkVersion
-
 	var fullContent strings.Builder
 	var flatContent strings.Builder
 
diff --git a/android/module.go b/android/module.go
index e2b7dd3..7e64f0a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -898,6 +898,13 @@
 	return Bool(m.commonProperties.System_ext_specific)
 }
 
+// RequiresStableAPIs returns true if the module will be installed to a partition that may
+// be updated separately from the system image.
+func (m *ModuleBase) RequiresStableAPIs(ctx BaseModuleContext) bool {
+	return m.SocSpecific() || m.DeviceSpecific() ||
+		(m.ProductSpecific() && ctx.Config().EnforceProductPartitionInterface())
+}
+
 func (m *ModuleBase) PartitionTag(config DeviceConfig) string {
 	partition := "system"
 	if m.SocSpecific() {
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 82745a4..ee4a13a 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -69,6 +69,10 @@
 	p.properties.Prefer = proptools.BoolPtr(true)
 }
 
+func (p *Prebuilt) Prefer() bool {
+	return proptools.Bool(p.properties.Prefer)
+}
+
 // The below source-related functions and the srcs, src fields are based on an assumption that
 // prebuilt modules have a static source property at the moment. Currently there is only one
 // exception, android_app_import, which chooses a source file depending on the product's DPI
diff --git a/android/visibility.go b/android/visibility.go
index 2cb0023..68da1c4 100644
--- a/android/visibility.go
+++ b/android/visibility.go
@@ -140,7 +140,7 @@
 }
 
 func (r packageRule) String() string {
-	return fmt.Sprintf("//%s:__pkg__", r.pkg)
+	return fmt.Sprintf("//%s", r.pkg) // :__pkg__ is the default, so skip it.
 }
 
 // A subpackagesRule is a visibility rule that matches modules in a specific package (i.e.
@@ -496,6 +496,24 @@
 
 	rule := effectiveVisibilityRules(ctx.Config(), qualified)
 
+	// Modules are implicitly visible to other modules in the same package,
+	// without checking the visibility rules. Here we need to add that visibility
+	// explicitly.
+	if rule != nil && !rule.matches(qualified) {
+		if len(rule) == 1 {
+			if _, ok := rule[0].(privateRule); ok {
+				// If the rule is //visibility:private we can't append another
+				// visibility to it. Semantically we need to convert it to a package
+				// visibility rule for the location where the result is used, but since
+				// modules are implicitly visible within the package we get the same
+				// result without any rule at all, so just make it an empty list to be
+				// appended below.
+				rule = compositeRule{}
+			}
+		}
+		rule = append(rule, packageRule{dir})
+	}
+
 	return rule.Strings()
 }
 
diff --git a/apex/androidmk.go b/apex/androidmk.go
index 2c5407c..09d3607 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -120,6 +120,9 @@
 			if len(fi.symlinks) > 0 {
 				fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS :=", strings.Join(fi.symlinks, " "))
 			}
+			if len(fi.dataPaths) > 0 {
+				fmt.Println(w, "LOCAL_TEST_DATA :=", strings.Join(cc.AndroidMkDataPaths(fi.dataPaths), " "))
+			}
 
 			if fi.module != nil && len(fi.module.NoticeFiles()) > 0 {
 				fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", strings.Join(fi.module.NoticeFiles().Strings(), " "))
@@ -166,7 +169,7 @@
 			fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String())
 		}
 		if fi.class == javaSharedLib {
-			javaModule := fi.module.(javaLibrary)
+			javaModule := fi.module.(java.Dependency)
 			// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar  Therefore
 			// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
 			// we will have foo.jar.jar
diff --git a/apex/apex.go b/apex/apex.go
index fa71ffa..4b59c6d 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -244,19 +244,6 @@
 	//
 	// Module separator
 	//
-	m["com.android.extservices"] = []string{
-		"flatbuffer_headers",
-		"liblua",
-		"libtextclassifier",
-		"libtextclassifier_hash_static",
-		"libtflite_static",
-		"libutf",
-		"libz_current",
-		"tensorflow_headers",
-	}
-	//
-	// Module separator
-	//
 	m["com.android.neuralnetworks"] = []string{
 		"android.hardware.neuralnetworks@1.0",
 		"android.hardware.neuralnetworks@1.1",
@@ -723,6 +710,7 @@
 	android.RegisterModuleType("apex_defaults", defaultsFactory)
 	android.RegisterModuleType("prebuilt_apex", PrebuiltFactory)
 	android.RegisterModuleType("override_apex", overrideApexFactory)
+	android.RegisterModuleType("apex_set", apexSetFactory)
 
 	android.PreDepsMutators(RegisterPreDepsMutators)
 	android.PostDepsMutators(RegisterPostDepsMutators)
@@ -1214,6 +1202,7 @@
 	module     android.Module
 	// list of symlinks that will be created in installDir that point to this apexFile
 	symlinks      []string
+	dataPaths     android.Paths
 	transitiveDep bool
 	moduleDir     string
 
@@ -1249,16 +1238,20 @@
 	return af.builtFile != nil && af.builtFile.String() != ""
 }
 
+func (af *apexFile) apexRelativePath(path string) string {
+	return filepath.Join(af.installDir, path)
+}
+
 // Path() returns path of this apex file relative to the APEX root
 func (af *apexFile) Path() string {
-	return filepath.Join(af.installDir, af.builtFile.Base())
+	return af.apexRelativePath(af.builtFile.Base())
 }
 
 // SymlinkPaths() returns paths of the symlinks (if any) relative to the APEX root
 func (af *apexFile) SymlinkPaths() []string {
 	var ret []string
 	for _, symlink := range af.symlinks {
-		ret = append(ret, filepath.Join(af.installDir, symlink))
+		ret = append(ret, af.apexRelativePath(symlink))
 	}
 	return ret
 }
@@ -1664,6 +1657,7 @@
 	fileToCopy := cc.OutputFile().Path()
 	af := newApexFile(ctx, fileToCopy, cc.Name(), dirInApex, nativeExecutable, cc)
 	af.symlinks = cc.Symlinks()
+	af.dataPaths = cc.DataPaths()
 	return af
 }
 
@@ -1694,16 +1688,10 @@
 	return af
 }
 
-// TODO(b/146586360): replace javaLibrary(in apex/apex.go) with java.Dependency
-type javaLibrary interface {
-	android.Module
-	java.Dependency
-}
-
-func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile {
+func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib java.Dependency, module android.Module) apexFile {
 	dirInApex := "javalib"
 	fileToCopy := lib.DexJar()
-	af := newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib)
+	af := newApexFile(ctx, fileToCopy, module.Name(), dirInApex, javaSharedLib, module)
 	af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
 	return af
 }
@@ -1971,7 +1959,7 @@
 				}
 			case javaLibTag:
 				if javaLib, ok := child.(*java.Library); ok {
-					af := apexFileForJavaLibrary(ctx, javaLib)
+					af := apexFileForJavaLibrary(ctx, javaLib, javaLib)
 					if !af.Ok() {
 						ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
 					} else {
@@ -1979,7 +1967,7 @@
 						return true // track transitive dependencies
 					}
 				} else if sdkLib, ok := child.(*java.SdkLibrary); ok {
-					af := apexFileForJavaLibrary(ctx, sdkLib)
+					af := apexFileForJavaLibrary(ctx, sdkLib, sdkLib)
 					if !af.Ok() {
 						ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
 						return false
diff --git a/apex/apex_test.go b/apex/apex_test.go
index dc69862..5461deb 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -175,11 +175,14 @@
 		"testkey2.pem":                               nil,
 		"myapex-arm64.apex":                          nil,
 		"myapex-arm.apex":                            nil,
+		"myapex.apks":                                nil,
 		"frameworks/base/api/current.txt":            nil,
 		"framework/aidl/a.aidl":                      nil,
 		"build/make/core/proguard.flags":             nil,
 		"build/make/core/proguard_basic_keeps.flags": nil,
 		"dummy.txt":                                  nil,
+		"baz":                                        nil,
+		"bar/baz":                                    nil,
 	}
 
 	cc.GatherRequiredFilesForTest(fs)
@@ -216,6 +219,7 @@
 	ctx.RegisterModuleType("apex_defaults", defaultsFactory)
 	ctx.RegisterModuleType("prebuilt_apex", PrebuiltFactory)
 	ctx.RegisterModuleType("override_apex", overrideApexFactory)
+	ctx.RegisterModuleType("apex_set", apexSetFactory)
 
 	ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
 	ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
@@ -3267,6 +3271,14 @@
 			private_key: "testkey.pem",
 		}
 
+		filegroup {
+			name: "fg",
+			srcs: [
+				"baz",
+				"bar/baz"
+			],
+		}
+
 		cc_test {
 			name: "mytest",
 			gtest: false,
@@ -3276,6 +3288,7 @@
 			system_shared_libs: [],
 			static_executable: true,
 			stl: "none",
+			data: [":fg"],
 		}
 
 		cc_library {
@@ -3308,6 +3321,10 @@
 	ensureContains(t, copyCmds, "image.apex/bin/test/mytest")
 	ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
 
+	//Ensure that test data are copied into apex.
+	ensureContains(t, copyCmds, "image.apex/bin/test/baz")
+	ensureContains(t, copyCmds, "image.apex/bin/test/bar/baz")
+
 	// Ensure that test deps built with `test_per_src` are copied into apex.
 	ensureContains(t, copyCmds, "image.apex/bin/test/mytest1")
 	ensureContains(t, copyCmds, "image.apex/bin/test/mytest2")
@@ -4774,6 +4791,48 @@
 	ensureNotContains(t, ldFlags, "mylib/android_arm64_armv8-a_shared_1/mylib.so")
 }
 
+// TODO(jungjw): Move this to proptools
+func intPtr(i int) *int {
+	return &i
+}
+
+func TestApexSet(t *testing.T) {
+	ctx, config := testApex(t, `
+		apex_set {
+			name: "myapex",
+			set: "myapex.apks",
+			filename: "foo_v2.apex",
+			overrides: ["foo"],
+		}
+	`, func(fs map[string][]byte, config android.Config) {
+		config.TestProductVariables.Platform_sdk_version = intPtr(30)
+		config.TestProductVariables.DeviceArch = proptools.StringPtr("arm")
+		config.TestProductVariables.DeviceSecondaryArch = proptools.StringPtr("arm64")
+	})
+
+	m := ctx.ModuleForTests("myapex", "android_common")
+
+	// Check extract_apks tool parameters.
+	extractedApex := m.Output(buildDir + "/.intermediates/myapex/android_common/foo_v2.apex")
+	actual := extractedApex.Args["abis"]
+	expected := "ARMEABI_V7A,ARM64_V8A"
+	if actual != expected {
+		t.Errorf("Unexpected abis parameter - expected %q vs actual %q", expected, actual)
+	}
+	actual = extractedApex.Args["sdk-version"]
+	expected = "30"
+	if actual != expected {
+		t.Errorf("Unexpected abis parameter - expected %q vs actual %q", expected, actual)
+	}
+
+	a := m.Module().(*ApexSet)
+	expectedOverrides := []string{"foo"}
+	actualOverrides := android.AndroidMkEntriesForTest(t, config, "", a)[0].EntryMap["LOCAL_OVERRIDES_MODULES"]
+	if !reflect.DeepEqual(actualOverrides, expectedOverrides) {
+		t.Errorf("Incorrect LOCAL_OVERRIDES_MODULES - expected %q vs actual %q", expectedOverrides, actualOverrides)
+	}
+}
+
 func TestMain(m *testing.M) {
 	run := func() int {
 		setUp()
diff --git a/apex/builder.go b/apex/builder.go
index ca24f2c..3d0e9b2 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -61,6 +61,7 @@
 	pctx.HostBinToolVariable("zipalign", "zipalign")
 	pctx.HostBinToolVariable("jsonmodify", "jsonmodify")
 	pctx.HostBinToolVariable("conv_apex_manifest", "conv_apex_manifest")
+	pctx.HostBinToolVariable("extract_apks", "extract_apks")
 }
 
 var (
@@ -350,6 +351,19 @@
 			symlinkDest := android.PathForModuleOut(ctx, "image"+suffix, symlinkPath).String()
 			copyCommands = append(copyCommands, "ln -sfn "+filepath.Base(destPath)+" "+symlinkDest)
 		}
+		for _, d := range fi.dataPaths {
+			// TODO(eakammer): This is now the third repetition of ~this logic for test paths, refactoring should be possible
+			relPath := d.Rel()
+			dataPath := d.String()
+			if !strings.HasSuffix(dataPath, relPath) {
+				panic(fmt.Errorf("path %q does not end with %q", dataPath, relPath))
+			}
+
+			dataDest := android.PathForModuleOut(ctx, "image"+suffix, fi.apexRelativePath(relPath)).String()
+
+			copyCommands = append(copyCommands, "cp -f "+d.String()+" "+dataDest)
+			implicitInputs = append(implicitInputs, d)
+		}
 	}
 
 	// TODO(jiyong): use RuleBuilder
@@ -406,6 +420,9 @@
 			pathInApex := filepath.Join(f.installDir, f.builtFile.Base())
 			if f.installDir == "bin" || strings.HasPrefix(f.installDir, "bin/") {
 				executablePaths = append(executablePaths, pathInApex)
+				for _, d := range f.dataPaths {
+					readOnlyPaths = append(readOnlyPaths, filepath.Join(f.installDir, d.Rel()))
+				}
 				for _, s := range f.symlinks {
 					executablePaths = append(executablePaths, filepath.Join(f.installDir, s))
 				}
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index d089c28..03266c5 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -16,13 +16,29 @@
 
 import (
 	"fmt"
+	"strconv"
 	"strings"
 
 	"android/soong/android"
+	"android/soong/java"
+	"github.com/google/blueprint"
 
 	"github.com/google/blueprint/proptools"
 )
 
+var (
+	extractMatchingApex = pctx.StaticRule(
+		"extractMatchingApex",
+		blueprint.RuleParams{
+			Command: `rm -rf "$out" && ` +
+				`${extract_apks} -o "${out}" -allow-prereleased=${allow-prereleased} ` +
+				`-sdk-version=${sdk-version} -abis=${abis} -screen-densities=all -extract-single ` +
+				`${in}`,
+			CommandDeps: []string{"${extract_apks}"},
+		},
+		"abis", "allow-prereleased", "sdk-version")
+)
+
 type Prebuilt struct {
 	android.ModuleBase
 	prebuilt android.Prebuilt
@@ -208,3 +224,117 @@
 		},
 	}}
 }
+
+type ApexSet struct {
+	android.ModuleBase
+	prebuilt android.Prebuilt
+
+	properties ApexSetProperties
+
+	installDir      android.InstallPath
+	installFilename string
+	outputApex      android.WritablePath
+
+	// list of commands to create symlinks for backward compatibility.
+	// these commands will be attached as LOCAL_POST_INSTALL_CMD
+	compatSymlinks []string
+}
+
+type ApexSetProperties struct {
+	// the .apks file path that contains prebuilt apex files to be extracted.
+	Set *string
+
+	// whether the extracted apex file installable.
+	Installable *bool
+
+	// optional name for the installed apex. If unspecified, name of the
+	// module is used as the file name
+	Filename *string
+
+	// names of modules to be overridden. Listed modules can only be other binaries
+	// (in Make or Soong).
+	// This does not completely prevent installation of the overridden binaries, but if both
+	// binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
+	// from PRODUCT_PACKAGES.
+	Overrides []string
+
+	// apexes in this set use prerelease SDK version
+	Prerelease *bool
+}
+
+func (a *ApexSet) installable() bool {
+	return a.properties.Installable == nil || proptools.Bool(a.properties.Installable)
+}
+
+func (a *ApexSet) InstallFilename() string {
+	return proptools.StringDefault(a.properties.Filename, a.BaseModuleName()+imageApexSuffix)
+}
+
+func (a *ApexSet) Prebuilt() *android.Prebuilt {
+	return &a.prebuilt
+}
+
+func (a *ApexSet) Name() string {
+	return a.prebuilt.Name(a.ModuleBase.Name())
+}
+
+// prebuilt_apex imports an `.apex` file into the build graph as if it was built with apex.
+func apexSetFactory() android.Module {
+	module := &ApexSet{}
+	module.AddProperties(&module.properties)
+	android.InitSingleSourcePrebuiltModule(module, &module.properties, "Set")
+	android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
+	return module
+}
+
+func (a *ApexSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+	a.installFilename = a.InstallFilename()
+	if !strings.HasSuffix(a.installFilename, imageApexSuffix) {
+		ctx.ModuleErrorf("filename should end in %s for apex_set", imageApexSuffix)
+	}
+
+	apexSet := a.prebuilt.SingleSourcePath(ctx)
+	a.outputApex = android.PathForModuleOut(ctx, a.installFilename)
+	ctx.Build(pctx,
+		android.BuildParams{
+			Rule:        extractMatchingApex,
+			Description: "Extract an apex from an apex set",
+			Inputs:      android.Paths{apexSet},
+			Output:      a.outputApex,
+			Args: map[string]string{
+				"abis":              strings.Join(java.SupportedAbis(ctx), ","),
+				"allow-prereleased": strconv.FormatBool(proptools.Bool(a.properties.Prerelease)),
+				"sdk-version":       ctx.Config().PlatformSdkVersion(),
+			},
+		})
+	a.installDir = android.PathForModuleInstall(ctx, "apex")
+	if a.installable() {
+		ctx.InstallFile(a.installDir, a.installFilename, a.outputApex)
+	}
+
+	// in case that apex_set replaces source apex (using prefer: prop)
+	a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx)
+	// or that apex_set overrides other apexes (using overrides: prop)
+	for _, overridden := range a.properties.Overrides {
+		a.compatSymlinks = append(a.compatSymlinks, makeCompatSymlinks(overridden, ctx)...)
+	}
+}
+
+func (a *ApexSet) AndroidMkEntries() []android.AndroidMkEntries {
+	return []android.AndroidMkEntries{android.AndroidMkEntries{
+		Class:      "ETC",
+		OutputFile: android.OptionalPathForPath(a.outputApex),
+		Include:    "$(BUILD_PREBUILT)",
+		ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+			func(entries *android.AndroidMkEntries) {
+				entries.SetString("LOCAL_MODULE_PATH", a.installDir.ToMakePath().String())
+				entries.SetString("LOCAL_MODULE_STEM", a.installFilename)
+				entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !a.installable())
+				entries.AddStrings("LOCAL_OVERRIDES_MODULES", a.properties.Overrides...)
+				if len(a.compatSymlinks) > 0 {
+					entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(a.compatSymlinks, " && "))
+				}
+			},
+		},
+	}}
+}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 671adb5..3ce1a89 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -149,7 +149,7 @@
 	return []android.AndroidMkEntries{entries}
 }
 
-func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, entries *android.AndroidMkEntries) {
+func AndroidMkDataPaths(data android.Paths) []string {
 	var testFiles []string
 	for _, d := range data {
 		rel := d.Rel()
@@ -160,6 +160,11 @@
 		path = strings.TrimSuffix(path, rel)
 		testFiles = append(testFiles, path+":"+rel)
 	}
+	return testFiles
+}
+
+func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, entries *android.AndroidMkEntries) {
+	testFiles := AndroidMkDataPaths(data)
 	if len(testFiles) > 0 {
 		entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
 			entries.AddStrings("LOCAL_TEST_DATA", testFiles...)
diff --git a/cc/builder.go b/cc/builder.go
index 41cc0c7..e571e5a 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -99,6 +99,15 @@
 		},
 		"arCmd", "arFlags")
 
+	arWithLibs = pctx.AndroidStaticRule("arWithLibs",
+		blueprint.RuleParams{
+			Command:        "rm -f ${out} && $arCmd $arObjFlags $out @${out}.rsp && $arCmd $arLibFlags $out $arLibs",
+			CommandDeps:    []string{"$arCmd"},
+			Rspfile:        "${out}.rsp",
+			RspfileContent: "${arObjs}",
+		},
+		"arCmd", "arObjFlags", "arObjs", "arLibFlags", "arLibs")
+
 	darwinStrip = pctx.AndroidStaticRule("darwinStrip",
 		blueprint.RuleParams{
 			Command:     "${config.MacStripPath} -u -r -o $out $in",
@@ -609,26 +618,45 @@
 }
 
 // Generate a rule for compiling multiple .o files to a static library (.a)
-func TransformObjToStaticLib(ctx android.ModuleContext, objFiles android.Paths,
+func TransformObjToStaticLib(ctx android.ModuleContext,
+	objFiles android.Paths, wholeStaticLibs android.Paths,
 	flags builderFlags, outputFile android.ModuleOutPath, deps android.Paths) {
 
 	arCmd := "${config.ClangBin}/llvm-ar"
-	arFlags := "crsPD"
+	arFlags := ""
 	if !ctx.Darwin() {
 		arFlags += " -format=gnu"
 	}
 
-	ctx.Build(pctx, android.BuildParams{
-		Rule:        ar,
-		Description: "static link " + outputFile.Base(),
-		Output:      outputFile,
-		Inputs:      objFiles,
-		Implicits:   deps,
-		Args: map[string]string{
-			"arFlags": arFlags,
-			"arCmd":   arCmd,
-		},
-	})
+	if len(wholeStaticLibs) == 0 {
+		ctx.Build(pctx, android.BuildParams{
+			Rule:        ar,
+			Description: "static link " + outputFile.Base(),
+			Output:      outputFile,
+			Inputs:      objFiles,
+			Implicits:   deps,
+			Args: map[string]string{
+				"arFlags": "crsPD" + arFlags,
+				"arCmd":   arCmd,
+			},
+		})
+
+	} else {
+		ctx.Build(pctx, android.BuildParams{
+			Rule:        arWithLibs,
+			Description: "static link " + outputFile.Base(),
+			Output:      outputFile,
+			Inputs:      append(objFiles, wholeStaticLibs...),
+			Implicits:   deps,
+			Args: map[string]string{
+				"arCmd":      arCmd,
+				"arObjFlags": "crsPD" + arFlags,
+				"arObjs":     strings.Join(objFiles.Strings(), " "),
+				"arLibFlags": "cqsL" + arFlags,
+				"arLibs":     strings.Join(wholeStaticLibs.Strings(), " "),
+			},
+		})
+	}
 }
 
 // Generate a rule for compiling multiple .o files, plus static libraries, whole static libraries,
diff --git a/cc/cc.go b/cc/cc.go
index 02c4879..6bf022d 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -124,10 +124,16 @@
 	StaticLibs, LateStaticLibs, WholeStaticLibs android.Paths
 
 	// Paths to .o files
-	Objs               Objects
+	Objs Objects
+	// Paths to .o files in dependencies that provide them. Note that these lists
+	// aren't complete since prebuilt modules don't provide the .o files.
 	StaticLibObjs      Objects
 	WholeStaticLibObjs Objects
 
+	// Paths to .a files in prebuilts. Complements WholeStaticLibObjs to contain
+	// the libs from all whole_static_lib dependencies.
+	WholeStaticLibsFromPrebuilts android.Paths
+
 	// Paths to generated source files
 	GeneratedSources android.Paths
 	GeneratedHeaders android.Paths
@@ -1395,6 +1401,15 @@
 	return ok && test.isAllTestsVariation()
 }
 
+func (c *Module) DataPaths() android.Paths {
+	if p, ok := c.installer.(interface {
+		dataPaths() android.Paths
+	}); ok {
+		return p.dataPaths()
+	}
+	return nil
+}
+
 func (c *Module) getNameSuffixWithVndkVersion(ctx android.ModuleContext) string {
 	// Returns the name suffix for product and vendor variants. If the VNDK version is not
 	// "current", it will append the VNDK version to the name suffix.
@@ -2473,7 +2488,11 @@
 					}
 					ctx.AddMissingDependencies(missingDeps)
 				}
-				depPaths.WholeStaticLibObjs = depPaths.WholeStaticLibObjs.Append(staticLib.objs())
+				if _, ok := ccWholeStaticLib.linker.(prebuiltLinkerInterface); ok {
+					depPaths.WholeStaticLibsFromPrebuilts = append(depPaths.WholeStaticLibsFromPrebuilts, linkFile.Path())
+				} else {
+					depPaths.WholeStaticLibObjs = depPaths.WholeStaticLibObjs.Append(staticLib.objs())
+				}
 			} else {
 				ctx.ModuleErrorf(
 					"non-cc.Modules cannot be included as whole static libraries.", depName)
diff --git a/cc/coverage.go b/cc/coverage.go
index cc9a1ad..f885fcb 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -92,7 +92,7 @@
 			// flags that the module may use.
 			flags.Local.CFlags = append(flags.Local.CFlags, "-Wno-frame-larger-than=", "-O0")
 		} else if clangCoverage {
-			flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-fprofile-instr-generate", "-fcoverage-mapping")
+			flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-fprofile-instr-generate", "-fcoverage-mapping", "-Wno-pass-failed")
 		}
 	}
 
diff --git a/cc/library.go b/cc/library.go
index ecea2ea..47485ce 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -874,7 +874,7 @@
 		}
 	}
 
-	TransformObjToStaticLib(ctx, library.objects.objFiles, builderFlags, outputFile, objs.tidyFiles)
+	TransformObjToStaticLib(ctx, library.objects.objFiles, deps.WholeStaticLibsFromPrebuilts, builderFlags, outputFile, objs.tidyFiles)
 
 	library.coverageOutputFile = TransformCoverageFilesToZip(ctx, library.objects, ctx.ModuleName())
 
diff --git a/cc/test.go b/cc/test.go
index 95abfbf..2439c94 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -160,6 +160,10 @@
 	return test.baseCompiler.Properties.Srcs
 }
 
+func (test *testBinary) dataPaths() android.Paths {
+	return test.data
+}
+
 func (test *testBinary) isAllTestsVariation() bool {
 	stem := test.binaryDecorator.Properties.Stem
 	return stem != nil && *stem == ""
diff --git a/cmd/extract_apks/Android.bp b/cmd/extract_apks/Android.bp
new file mode 100644
index 0000000..90548cd
--- /dev/null
+++ b/cmd/extract_apks/Android.bp
@@ -0,0 +1,21 @@
+blueprint_go_binary {
+    name: "extract_apks",
+    srcs: ["main.go"],
+    deps: [
+        "android-archive-zip",
+        "golang-protobuf-proto",
+        "soong-cmd-extract_apks-proto",
+    ],
+    testSrcs: ["main_test.go"]
+}
+
+bootstrap_go_package {
+    name: "soong-cmd-extract_apks-proto",
+    pkgPath: "android/soong/cmd/extract_apks/bundle_proto",
+    deps: ["golang-protobuf-proto"],
+    srcs: [
+        "bundle_proto/commands.pb.go",
+        "bundle_proto/config.pb.go",
+        "bundle_proto/targeting.pb.go",
+    ],
+}
diff --git a/cmd/extract_apks/bundle_proto/commands.pb.go b/cmd/extract_apks/bundle_proto/commands.pb.go
new file mode 100644
index 0000000..bbf3314
--- /dev/null
+++ b/cmd/extract_apks/bundle_proto/commands.pb.go
@@ -0,0 +1,1033 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: commands.proto
+
+package android_bundle_proto
+
+import (
+	fmt "fmt"
+	proto "github.com/golang/protobuf/proto"
+	math "math"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+type DeliveryType int32
+
+const (
+	DeliveryType_UNKNOWN_DELIVERY_TYPE DeliveryType = 0
+	DeliveryType_INSTALL_TIME          DeliveryType = 1
+	DeliveryType_ON_DEMAND             DeliveryType = 2
+	DeliveryType_FAST_FOLLOW           DeliveryType = 3
+)
+
+var DeliveryType_name = map[int32]string{
+	0: "UNKNOWN_DELIVERY_TYPE",
+	1: "INSTALL_TIME",
+	2: "ON_DEMAND",
+	3: "FAST_FOLLOW",
+}
+
+var DeliveryType_value = map[string]int32{
+	"UNKNOWN_DELIVERY_TYPE": 0,
+	"INSTALL_TIME":          1,
+	"ON_DEMAND":             2,
+	"FAST_FOLLOW":           3,
+}
+
+func (x DeliveryType) String() string {
+	return proto.EnumName(DeliveryType_name, int32(x))
+}
+
+func (DeliveryType) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{0}
+}
+
+type SystemApkMetadata_SystemApkType int32
+
+const (
+	SystemApkMetadata_UNSPECIFIED_VALUE SystemApkMetadata_SystemApkType = 0
+	// Uncompressed APK for system image.
+	SystemApkMetadata_SYSTEM SystemApkMetadata_SystemApkType = 1
+	// Stub APK for compressed APK in the system image
+	// (contains only android manifest).
+	SystemApkMetadata_SYSTEM_STUB SystemApkMetadata_SystemApkType = 2
+	// Compressed APK for system image.
+	SystemApkMetadata_SYSTEM_COMPRESSED SystemApkMetadata_SystemApkType = 3
+)
+
+var SystemApkMetadata_SystemApkType_name = map[int32]string{
+	0: "UNSPECIFIED_VALUE",
+	1: "SYSTEM",
+	2: "SYSTEM_STUB",
+	3: "SYSTEM_COMPRESSED",
+}
+
+var SystemApkMetadata_SystemApkType_value = map[string]int32{
+	"UNSPECIFIED_VALUE": 0,
+	"SYSTEM":            1,
+	"SYSTEM_STUB":       2,
+	"SYSTEM_COMPRESSED": 3,
+}
+
+func (x SystemApkMetadata_SystemApkType) String() string {
+	return proto.EnumName(SystemApkMetadata_SystemApkType_name, int32(x))
+}
+
+func (SystemApkMetadata_SystemApkType) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{10, 0}
+}
+
+// Describes the output of the "build-apks" command.
+type BuildApksResult struct {
+	// The package name of this app.
+	PackageName string `protobuf:"bytes,4,opt,name=package_name,json=packageName,proto3" json:"package_name,omitempty"`
+	// List of the created variants.
+	Variant []*Variant `protobuf:"bytes,1,rep,name=variant,proto3" json:"variant,omitempty"`
+	// Metadata about BundleTool used to build the APKs.
+	Bundletool *Bundletool `protobuf:"bytes,2,opt,name=bundletool,proto3" json:"bundletool,omitempty"`
+	// List of the created asset slices.
+	AssetSliceSet []*AssetSliceSet `protobuf:"bytes,3,rep,name=asset_slice_set,json=assetSliceSet,proto3" json:"asset_slice_set,omitempty"`
+	// Information about local testing mode.
+	LocalTestingInfo     *LocalTestingInfo `protobuf:"bytes,5,opt,name=local_testing_info,json=localTestingInfo,proto3" json:"local_testing_info,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
+	XXX_unrecognized     []byte            `json:"-"`
+	XXX_sizecache        int32             `json:"-"`
+}
+
+func (m *BuildApksResult) Reset()         { *m = BuildApksResult{} }
+func (m *BuildApksResult) String() string { return proto.CompactTextString(m) }
+func (*BuildApksResult) ProtoMessage()    {}
+func (*BuildApksResult) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{0}
+}
+
+func (m *BuildApksResult) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_BuildApksResult.Unmarshal(m, b)
+}
+func (m *BuildApksResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_BuildApksResult.Marshal(b, m, deterministic)
+}
+func (m *BuildApksResult) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_BuildApksResult.Merge(m, src)
+}
+func (m *BuildApksResult) XXX_Size() int {
+	return xxx_messageInfo_BuildApksResult.Size(m)
+}
+func (m *BuildApksResult) XXX_DiscardUnknown() {
+	xxx_messageInfo_BuildApksResult.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_BuildApksResult proto.InternalMessageInfo
+
+func (m *BuildApksResult) GetPackageName() string {
+	if m != nil {
+		return m.PackageName
+	}
+	return ""
+}
+
+func (m *BuildApksResult) GetVariant() []*Variant {
+	if m != nil {
+		return m.Variant
+	}
+	return nil
+}
+
+func (m *BuildApksResult) GetBundletool() *Bundletool {
+	if m != nil {
+		return m.Bundletool
+	}
+	return nil
+}
+
+func (m *BuildApksResult) GetAssetSliceSet() []*AssetSliceSet {
+	if m != nil {
+		return m.AssetSliceSet
+	}
+	return nil
+}
+
+func (m *BuildApksResult) GetLocalTestingInfo() *LocalTestingInfo {
+	if m != nil {
+		return m.LocalTestingInfo
+	}
+	return nil
+}
+
+// Variant is a group of APKs that covers a part of the device configuration
+// space. APKs from multiple variants are never combined on one device.
+type Variant struct {
+	// Variant-level targeting.
+	// This targeting is fairly high-level and each APK has its own targeting as
+	// well.
+	Targeting *VariantTargeting `protobuf:"bytes,1,opt,name=targeting,proto3" json:"targeting,omitempty"`
+	// Set of APKs, one set per module.
+	ApkSet []*ApkSet `protobuf:"bytes,2,rep,name=apk_set,json=apkSet,proto3" json:"apk_set,omitempty"`
+	// Number of the variant, starting at 0 (unless overridden).
+	// A device will receive APKs from the first variant that matches the device
+	// configuration, with higher variant numbers having priority over lower
+	// variant numbers.
+	VariantNumber        uint32   `protobuf:"varint,3,opt,name=variant_number,json=variantNumber,proto3" json:"variant_number,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *Variant) Reset()         { *m = Variant{} }
+func (m *Variant) String() string { return proto.CompactTextString(m) }
+func (*Variant) ProtoMessage()    {}
+func (*Variant) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{1}
+}
+
+func (m *Variant) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Variant.Unmarshal(m, b)
+}
+func (m *Variant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Variant.Marshal(b, m, deterministic)
+}
+func (m *Variant) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Variant.Merge(m, src)
+}
+func (m *Variant) XXX_Size() int {
+	return xxx_messageInfo_Variant.Size(m)
+}
+func (m *Variant) XXX_DiscardUnknown() {
+	xxx_messageInfo_Variant.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Variant proto.InternalMessageInfo
+
+func (m *Variant) GetTargeting() *VariantTargeting {
+	if m != nil {
+		return m.Targeting
+	}
+	return nil
+}
+
+func (m *Variant) GetApkSet() []*ApkSet {
+	if m != nil {
+		return m.ApkSet
+	}
+	return nil
+}
+
+func (m *Variant) GetVariantNumber() uint32 {
+	if m != nil {
+		return m.VariantNumber
+	}
+	return 0
+}
+
+// Represents a module.
+// For pre-L devices multiple modules (possibly all) may be merged into one.
+type ApkSet struct {
+	ModuleMetadata *ModuleMetadata `protobuf:"bytes,1,opt,name=module_metadata,json=moduleMetadata,proto3" json:"module_metadata,omitempty"`
+	// APKs.
+	ApkDescription       []*ApkDescription `protobuf:"bytes,2,rep,name=apk_description,json=apkDescription,proto3" json:"apk_description,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
+	XXX_unrecognized     []byte            `json:"-"`
+	XXX_sizecache        int32             `json:"-"`
+}
+
+func (m *ApkSet) Reset()         { *m = ApkSet{} }
+func (m *ApkSet) String() string { return proto.CompactTextString(m) }
+func (*ApkSet) ProtoMessage()    {}
+func (*ApkSet) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{2}
+}
+
+func (m *ApkSet) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ApkSet.Unmarshal(m, b)
+}
+func (m *ApkSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ApkSet.Marshal(b, m, deterministic)
+}
+func (m *ApkSet) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ApkSet.Merge(m, src)
+}
+func (m *ApkSet) XXX_Size() int {
+	return xxx_messageInfo_ApkSet.Size(m)
+}
+func (m *ApkSet) XXX_DiscardUnknown() {
+	xxx_messageInfo_ApkSet.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApkSet proto.InternalMessageInfo
+
+func (m *ApkSet) GetModuleMetadata() *ModuleMetadata {
+	if m != nil {
+		return m.ModuleMetadata
+	}
+	return nil
+}
+
+func (m *ApkSet) GetApkDescription() []*ApkDescription {
+	if m != nil {
+		return m.ApkDescription
+	}
+	return nil
+}
+
+type ModuleMetadata struct {
+	// Module name.
+	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+	// Indicates the delivery type (e.g. on-demand) of the module.
+	DeliveryType DeliveryType `protobuf:"varint,6,opt,name=delivery_type,json=deliveryType,proto3,enum=android.bundle.DeliveryType" json:"delivery_type,omitempty"`
+	// Indicates whether this module is marked "instant".
+	IsInstant bool `protobuf:"varint,3,opt,name=is_instant,json=isInstant,proto3" json:"is_instant,omitempty"`
+	// Names of the modules that this module directly depends on.
+	// Each module implicitly depends on the base module.
+	Dependencies []string `protobuf:"bytes,4,rep,name=dependencies,proto3" json:"dependencies,omitempty"`
+	// The targeting that makes a conditional module installed.
+	// Relevant only for Split APKs.
+	Targeting *ModuleTargeting `protobuf:"bytes,5,opt,name=targeting,proto3" json:"targeting,omitempty"`
+	// Deprecated. Please use delivery_type.
+	OnDemandDeprecated   bool     `protobuf:"varint,2,opt,name=on_demand_deprecated,json=onDemandDeprecated,proto3" json:"on_demand_deprecated,omitempty"` // Deprecated: Do not use.
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *ModuleMetadata) Reset()         { *m = ModuleMetadata{} }
+func (m *ModuleMetadata) String() string { return proto.CompactTextString(m) }
+func (*ModuleMetadata) ProtoMessage()    {}
+func (*ModuleMetadata) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{3}
+}
+
+func (m *ModuleMetadata) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ModuleMetadata.Unmarshal(m, b)
+}
+func (m *ModuleMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ModuleMetadata.Marshal(b, m, deterministic)
+}
+func (m *ModuleMetadata) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ModuleMetadata.Merge(m, src)
+}
+func (m *ModuleMetadata) XXX_Size() int {
+	return xxx_messageInfo_ModuleMetadata.Size(m)
+}
+func (m *ModuleMetadata) XXX_DiscardUnknown() {
+	xxx_messageInfo_ModuleMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ModuleMetadata proto.InternalMessageInfo
+
+func (m *ModuleMetadata) GetName() string {
+	if m != nil {
+		return m.Name
+	}
+	return ""
+}
+
+func (m *ModuleMetadata) GetDeliveryType() DeliveryType {
+	if m != nil {
+		return m.DeliveryType
+	}
+	return DeliveryType_UNKNOWN_DELIVERY_TYPE
+}
+
+func (m *ModuleMetadata) GetIsInstant() bool {
+	if m != nil {
+		return m.IsInstant
+	}
+	return false
+}
+
+func (m *ModuleMetadata) GetDependencies() []string {
+	if m != nil {
+		return m.Dependencies
+	}
+	return nil
+}
+
+func (m *ModuleMetadata) GetTargeting() *ModuleTargeting {
+	if m != nil {
+		return m.Targeting
+	}
+	return nil
+}
+
+// Deprecated: Do not use.
+func (m *ModuleMetadata) GetOnDemandDeprecated() bool {
+	if m != nil {
+		return m.OnDemandDeprecated
+	}
+	return false
+}
+
+// Set of asset slices belonging to a single asset module.
+type AssetSliceSet struct {
+	// Module level metadata.
+	AssetModuleMetadata *AssetModuleMetadata `protobuf:"bytes,1,opt,name=asset_module_metadata,json=assetModuleMetadata,proto3" json:"asset_module_metadata,omitempty"`
+	// Asset slices.
+	ApkDescription       []*ApkDescription `protobuf:"bytes,2,rep,name=apk_description,json=apkDescription,proto3" json:"apk_description,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
+	XXX_unrecognized     []byte            `json:"-"`
+	XXX_sizecache        int32             `json:"-"`
+}
+
+func (m *AssetSliceSet) Reset()         { *m = AssetSliceSet{} }
+func (m *AssetSliceSet) String() string { return proto.CompactTextString(m) }
+func (*AssetSliceSet) ProtoMessage()    {}
+func (*AssetSliceSet) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{4}
+}
+
+func (m *AssetSliceSet) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_AssetSliceSet.Unmarshal(m, b)
+}
+func (m *AssetSliceSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_AssetSliceSet.Marshal(b, m, deterministic)
+}
+func (m *AssetSliceSet) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_AssetSliceSet.Merge(m, src)
+}
+func (m *AssetSliceSet) XXX_Size() int {
+	return xxx_messageInfo_AssetSliceSet.Size(m)
+}
+func (m *AssetSliceSet) XXX_DiscardUnknown() {
+	xxx_messageInfo_AssetSliceSet.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AssetSliceSet proto.InternalMessageInfo
+
+func (m *AssetSliceSet) GetAssetModuleMetadata() *AssetModuleMetadata {
+	if m != nil {
+		return m.AssetModuleMetadata
+	}
+	return nil
+}
+
+func (m *AssetSliceSet) GetApkDescription() []*ApkDescription {
+	if m != nil {
+		return m.ApkDescription
+	}
+	return nil
+}
+
+type AssetModuleMetadata struct {
+	// Module name.
+	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+	// Indicates the delivery type for persistent install.
+	DeliveryType DeliveryType `protobuf:"varint,4,opt,name=delivery_type,json=deliveryType,proto3,enum=android.bundle.DeliveryType" json:"delivery_type,omitempty"`
+	// Metadata for instant installs.
+	InstantMetadata *InstantMetadata `protobuf:"bytes,3,opt,name=instant_metadata,json=instantMetadata,proto3" json:"instant_metadata,omitempty"`
+	// Deprecated. Use delivery_type.
+	OnDemandDeprecated   bool     `protobuf:"varint,2,opt,name=on_demand_deprecated,json=onDemandDeprecated,proto3" json:"on_demand_deprecated,omitempty"` // Deprecated: Do not use.
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *AssetModuleMetadata) Reset()         { *m = AssetModuleMetadata{} }
+func (m *AssetModuleMetadata) String() string { return proto.CompactTextString(m) }
+func (*AssetModuleMetadata) ProtoMessage()    {}
+func (*AssetModuleMetadata) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{5}
+}
+
+func (m *AssetModuleMetadata) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_AssetModuleMetadata.Unmarshal(m, b)
+}
+func (m *AssetModuleMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_AssetModuleMetadata.Marshal(b, m, deterministic)
+}
+func (m *AssetModuleMetadata) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_AssetModuleMetadata.Merge(m, src)
+}
+func (m *AssetModuleMetadata) XXX_Size() int {
+	return xxx_messageInfo_AssetModuleMetadata.Size(m)
+}
+func (m *AssetModuleMetadata) XXX_DiscardUnknown() {
+	xxx_messageInfo_AssetModuleMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AssetModuleMetadata proto.InternalMessageInfo
+
+func (m *AssetModuleMetadata) GetName() string {
+	if m != nil {
+		return m.Name
+	}
+	return ""
+}
+
+func (m *AssetModuleMetadata) GetDeliveryType() DeliveryType {
+	if m != nil {
+		return m.DeliveryType
+	}
+	return DeliveryType_UNKNOWN_DELIVERY_TYPE
+}
+
+func (m *AssetModuleMetadata) GetInstantMetadata() *InstantMetadata {
+	if m != nil {
+		return m.InstantMetadata
+	}
+	return nil
+}
+
+// Deprecated: Do not use.
+func (m *AssetModuleMetadata) GetOnDemandDeprecated() bool {
+	if m != nil {
+		return m.OnDemandDeprecated
+	}
+	return false
+}
+
+type InstantMetadata struct {
+	// Indicates whether this module is marked "instant".
+	IsInstant bool `protobuf:"varint,1,opt,name=is_instant,json=isInstant,proto3" json:"is_instant,omitempty"`
+	// Indicates the delivery type for instant install.
+	DeliveryType DeliveryType `protobuf:"varint,3,opt,name=delivery_type,json=deliveryType,proto3,enum=android.bundle.DeliveryType" json:"delivery_type,omitempty"`
+	// Deprecated. Use delivery_type.
+	OnDemandDeprecated   bool     `protobuf:"varint,2,opt,name=on_demand_deprecated,json=onDemandDeprecated,proto3" json:"on_demand_deprecated,omitempty"` // Deprecated: Do not use.
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *InstantMetadata) Reset()         { *m = InstantMetadata{} }
+func (m *InstantMetadata) String() string { return proto.CompactTextString(m) }
+func (*InstantMetadata) ProtoMessage()    {}
+func (*InstantMetadata) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{6}
+}
+
+func (m *InstantMetadata) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_InstantMetadata.Unmarshal(m, b)
+}
+func (m *InstantMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_InstantMetadata.Marshal(b, m, deterministic)
+}
+func (m *InstantMetadata) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_InstantMetadata.Merge(m, src)
+}
+func (m *InstantMetadata) XXX_Size() int {
+	return xxx_messageInfo_InstantMetadata.Size(m)
+}
+func (m *InstantMetadata) XXX_DiscardUnknown() {
+	xxx_messageInfo_InstantMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_InstantMetadata proto.InternalMessageInfo
+
+func (m *InstantMetadata) GetIsInstant() bool {
+	if m != nil {
+		return m.IsInstant
+	}
+	return false
+}
+
+func (m *InstantMetadata) GetDeliveryType() DeliveryType {
+	if m != nil {
+		return m.DeliveryType
+	}
+	return DeliveryType_UNKNOWN_DELIVERY_TYPE
+}
+
+// Deprecated: Do not use.
+func (m *InstantMetadata) GetOnDemandDeprecated() bool {
+	if m != nil {
+		return m.OnDemandDeprecated
+	}
+	return false
+}
+
+type ApkDescription struct {
+	Targeting *ApkTargeting `protobuf:"bytes,1,opt,name=targeting,proto3" json:"targeting,omitempty"`
+	// Path to the APK file.
+	// BEGIN-INTERNAL
+	// The path may be a blobkey if the proto is not constructed by bundletool.
+	// END-INTERNAL
+	Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
+	// Types that are valid to be assigned to ApkMetadataOneofValue:
+	//	*ApkDescription_SplitApkMetadata
+	//	*ApkDescription_StandaloneApkMetadata
+	//	*ApkDescription_InstantApkMetadata
+	//	*ApkDescription_SystemApkMetadata
+	//	*ApkDescription_AssetSliceMetadata
+	//	*ApkDescription_ApexApkMetadata
+	ApkMetadataOneofValue isApkDescription_ApkMetadataOneofValue `protobuf_oneof:"apk_metadata_oneof_value"`
+	XXX_NoUnkeyedLiteral  struct{}                               `json:"-"`
+	XXX_unrecognized      []byte                                 `json:"-"`
+	XXX_sizecache         int32                                  `json:"-"`
+}
+
+func (m *ApkDescription) Reset()         { *m = ApkDescription{} }
+func (m *ApkDescription) String() string { return proto.CompactTextString(m) }
+func (*ApkDescription) ProtoMessage()    {}
+func (*ApkDescription) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{7}
+}
+
+func (m *ApkDescription) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ApkDescription.Unmarshal(m, b)
+}
+func (m *ApkDescription) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ApkDescription.Marshal(b, m, deterministic)
+}
+func (m *ApkDescription) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ApkDescription.Merge(m, src)
+}
+func (m *ApkDescription) XXX_Size() int {
+	return xxx_messageInfo_ApkDescription.Size(m)
+}
+func (m *ApkDescription) XXX_DiscardUnknown() {
+	xxx_messageInfo_ApkDescription.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApkDescription proto.InternalMessageInfo
+
+func (m *ApkDescription) GetTargeting() *ApkTargeting {
+	if m != nil {
+		return m.Targeting
+	}
+	return nil
+}
+
+func (m *ApkDescription) GetPath() string {
+	if m != nil {
+		return m.Path
+	}
+	return ""
+}
+
+type isApkDescription_ApkMetadataOneofValue interface {
+	isApkDescription_ApkMetadataOneofValue()
+}
+
+type ApkDescription_SplitApkMetadata struct {
+	SplitApkMetadata *SplitApkMetadata `protobuf:"bytes,3,opt,name=split_apk_metadata,json=splitApkMetadata,proto3,oneof"`
+}
+
+type ApkDescription_StandaloneApkMetadata struct {
+	StandaloneApkMetadata *StandaloneApkMetadata `protobuf:"bytes,4,opt,name=standalone_apk_metadata,json=standaloneApkMetadata,proto3,oneof"`
+}
+
+type ApkDescription_InstantApkMetadata struct {
+	InstantApkMetadata *SplitApkMetadata `protobuf:"bytes,5,opt,name=instant_apk_metadata,json=instantApkMetadata,proto3,oneof"`
+}
+
+type ApkDescription_SystemApkMetadata struct {
+	SystemApkMetadata *SystemApkMetadata `protobuf:"bytes,6,opt,name=system_apk_metadata,json=systemApkMetadata,proto3,oneof"`
+}
+
+type ApkDescription_AssetSliceMetadata struct {
+	AssetSliceMetadata *SplitApkMetadata `protobuf:"bytes,7,opt,name=asset_slice_metadata,json=assetSliceMetadata,proto3,oneof"`
+}
+
+type ApkDescription_ApexApkMetadata struct {
+	ApexApkMetadata *ApexApkMetadata `protobuf:"bytes,8,opt,name=apex_apk_metadata,json=apexApkMetadata,proto3,oneof"`
+}
+
+func (*ApkDescription_SplitApkMetadata) isApkDescription_ApkMetadataOneofValue() {}
+
+func (*ApkDescription_StandaloneApkMetadata) isApkDescription_ApkMetadataOneofValue() {}
+
+func (*ApkDescription_InstantApkMetadata) isApkDescription_ApkMetadataOneofValue() {}
+
+func (*ApkDescription_SystemApkMetadata) isApkDescription_ApkMetadataOneofValue() {}
+
+func (*ApkDescription_AssetSliceMetadata) isApkDescription_ApkMetadataOneofValue() {}
+
+func (*ApkDescription_ApexApkMetadata) isApkDescription_ApkMetadataOneofValue() {}
+
+func (m *ApkDescription) GetApkMetadataOneofValue() isApkDescription_ApkMetadataOneofValue {
+	if m != nil {
+		return m.ApkMetadataOneofValue
+	}
+	return nil
+}
+
+func (m *ApkDescription) GetSplitApkMetadata() *SplitApkMetadata {
+	if x, ok := m.GetApkMetadataOneofValue().(*ApkDescription_SplitApkMetadata); ok {
+		return x.SplitApkMetadata
+	}
+	return nil
+}
+
+func (m *ApkDescription) GetStandaloneApkMetadata() *StandaloneApkMetadata {
+	if x, ok := m.GetApkMetadataOneofValue().(*ApkDescription_StandaloneApkMetadata); ok {
+		return x.StandaloneApkMetadata
+	}
+	return nil
+}
+
+func (m *ApkDescription) GetInstantApkMetadata() *SplitApkMetadata {
+	if x, ok := m.GetApkMetadataOneofValue().(*ApkDescription_InstantApkMetadata); ok {
+		return x.InstantApkMetadata
+	}
+	return nil
+}
+
+func (m *ApkDescription) GetSystemApkMetadata() *SystemApkMetadata {
+	if x, ok := m.GetApkMetadataOneofValue().(*ApkDescription_SystemApkMetadata); ok {
+		return x.SystemApkMetadata
+	}
+	return nil
+}
+
+func (m *ApkDescription) GetAssetSliceMetadata() *SplitApkMetadata {
+	if x, ok := m.GetApkMetadataOneofValue().(*ApkDescription_AssetSliceMetadata); ok {
+		return x.AssetSliceMetadata
+	}
+	return nil
+}
+
+func (m *ApkDescription) GetApexApkMetadata() *ApexApkMetadata {
+	if x, ok := m.GetApkMetadataOneofValue().(*ApkDescription_ApexApkMetadata); ok {
+		return x.ApexApkMetadata
+	}
+	return nil
+}
+
+// XXX_OneofWrappers is for the internal use of the proto package.
+func (*ApkDescription) XXX_OneofWrappers() []interface{} {
+	return []interface{}{
+		(*ApkDescription_SplitApkMetadata)(nil),
+		(*ApkDescription_StandaloneApkMetadata)(nil),
+		(*ApkDescription_InstantApkMetadata)(nil),
+		(*ApkDescription_SystemApkMetadata)(nil),
+		(*ApkDescription_AssetSliceMetadata)(nil),
+		(*ApkDescription_ApexApkMetadata)(nil),
+	}
+}
+
+// Holds data specific to Split APKs.
+type SplitApkMetadata struct {
+	SplitId string `protobuf:"bytes,1,opt,name=split_id,json=splitId,proto3" json:"split_id,omitempty"`
+	// Indicates whether this APK is the master split of the module.
+	IsMasterSplit        bool     `protobuf:"varint,2,opt,name=is_master_split,json=isMasterSplit,proto3" json:"is_master_split,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *SplitApkMetadata) Reset()         { *m = SplitApkMetadata{} }
+func (m *SplitApkMetadata) String() string { return proto.CompactTextString(m) }
+func (*SplitApkMetadata) ProtoMessage()    {}
+func (*SplitApkMetadata) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{8}
+}
+
+func (m *SplitApkMetadata) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SplitApkMetadata.Unmarshal(m, b)
+}
+func (m *SplitApkMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SplitApkMetadata.Marshal(b, m, deterministic)
+}
+func (m *SplitApkMetadata) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SplitApkMetadata.Merge(m, src)
+}
+func (m *SplitApkMetadata) XXX_Size() int {
+	return xxx_messageInfo_SplitApkMetadata.Size(m)
+}
+func (m *SplitApkMetadata) XXX_DiscardUnknown() {
+	xxx_messageInfo_SplitApkMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SplitApkMetadata proto.InternalMessageInfo
+
+func (m *SplitApkMetadata) GetSplitId() string {
+	if m != nil {
+		return m.SplitId
+	}
+	return ""
+}
+
+func (m *SplitApkMetadata) GetIsMasterSplit() bool {
+	if m != nil {
+		return m.IsMasterSplit
+	}
+	return false
+}
+
+// Holds data specific to Standalone APKs.
+type StandaloneApkMetadata struct {
+	// Names of the modules fused in this standalone APK.
+	FusedModuleName      []string `protobuf:"bytes,1,rep,name=fused_module_name,json=fusedModuleName,proto3" json:"fused_module_name,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *StandaloneApkMetadata) Reset()         { *m = StandaloneApkMetadata{} }
+func (m *StandaloneApkMetadata) String() string { return proto.CompactTextString(m) }
+func (*StandaloneApkMetadata) ProtoMessage()    {}
+func (*StandaloneApkMetadata) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{9}
+}
+
+func (m *StandaloneApkMetadata) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_StandaloneApkMetadata.Unmarshal(m, b)
+}
+func (m *StandaloneApkMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_StandaloneApkMetadata.Marshal(b, m, deterministic)
+}
+func (m *StandaloneApkMetadata) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_StandaloneApkMetadata.Merge(m, src)
+}
+func (m *StandaloneApkMetadata) XXX_Size() int {
+	return xxx_messageInfo_StandaloneApkMetadata.Size(m)
+}
+func (m *StandaloneApkMetadata) XXX_DiscardUnknown() {
+	xxx_messageInfo_StandaloneApkMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_StandaloneApkMetadata proto.InternalMessageInfo
+
+func (m *StandaloneApkMetadata) GetFusedModuleName() []string {
+	if m != nil {
+		return m.FusedModuleName
+	}
+	return nil
+}
+
+// Holds data specific to system APKs.
+type SystemApkMetadata struct {
+	// Names of the modules fused in this system APK.
+	FusedModuleName []string `protobuf:"bytes,1,rep,name=fused_module_name,json=fusedModuleName,proto3" json:"fused_module_name,omitempty"`
+	// Indicates whether the APK is uncompressed system APK, stub APK or
+	// compressed system APK.
+	SystemApkType        SystemApkMetadata_SystemApkType `protobuf:"varint,2,opt,name=system_apk_type,json=systemApkType,proto3,enum=android.bundle.SystemApkMetadata_SystemApkType" json:"system_apk_type,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}                        `json:"-"`
+	XXX_unrecognized     []byte                          `json:"-"`
+	XXX_sizecache        int32                           `json:"-"`
+}
+
+func (m *SystemApkMetadata) Reset()         { *m = SystemApkMetadata{} }
+func (m *SystemApkMetadata) String() string { return proto.CompactTextString(m) }
+func (*SystemApkMetadata) ProtoMessage()    {}
+func (*SystemApkMetadata) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{10}
+}
+
+func (m *SystemApkMetadata) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SystemApkMetadata.Unmarshal(m, b)
+}
+func (m *SystemApkMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SystemApkMetadata.Marshal(b, m, deterministic)
+}
+func (m *SystemApkMetadata) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SystemApkMetadata.Merge(m, src)
+}
+func (m *SystemApkMetadata) XXX_Size() int {
+	return xxx_messageInfo_SystemApkMetadata.Size(m)
+}
+func (m *SystemApkMetadata) XXX_DiscardUnknown() {
+	xxx_messageInfo_SystemApkMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SystemApkMetadata proto.InternalMessageInfo
+
+func (m *SystemApkMetadata) GetFusedModuleName() []string {
+	if m != nil {
+		return m.FusedModuleName
+	}
+	return nil
+}
+
+func (m *SystemApkMetadata) GetSystemApkType() SystemApkMetadata_SystemApkType {
+	if m != nil {
+		return m.SystemApkType
+	}
+	return SystemApkMetadata_UNSPECIFIED_VALUE
+}
+
+// Holds data specific to APEX APKs.
+type ApexApkMetadata struct {
+	// Configuration for processing of APKs embedded in an APEX image.
+	ApexEmbeddedApkConfig []*ApexEmbeddedApkConfig `protobuf:"bytes,1,rep,name=apex_embedded_apk_config,json=apexEmbeddedApkConfig,proto3" json:"apex_embedded_apk_config,omitempty"`
+	XXX_NoUnkeyedLiteral  struct{}                 `json:"-"`
+	XXX_unrecognized      []byte                   `json:"-"`
+	XXX_sizecache         int32                    `json:"-"`
+}
+
+func (m *ApexApkMetadata) Reset()         { *m = ApexApkMetadata{} }
+func (m *ApexApkMetadata) String() string { return proto.CompactTextString(m) }
+func (*ApexApkMetadata) ProtoMessage()    {}
+func (*ApexApkMetadata) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{11}
+}
+
+func (m *ApexApkMetadata) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ApexApkMetadata.Unmarshal(m, b)
+}
+func (m *ApexApkMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ApexApkMetadata.Marshal(b, m, deterministic)
+}
+func (m *ApexApkMetadata) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ApexApkMetadata.Merge(m, src)
+}
+func (m *ApexApkMetadata) XXX_Size() int {
+	return xxx_messageInfo_ApexApkMetadata.Size(m)
+}
+func (m *ApexApkMetadata) XXX_DiscardUnknown() {
+	xxx_messageInfo_ApexApkMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApexApkMetadata proto.InternalMessageInfo
+
+func (m *ApexApkMetadata) GetApexEmbeddedApkConfig() []*ApexEmbeddedApkConfig {
+	if m != nil {
+		return m.ApexEmbeddedApkConfig
+	}
+	return nil
+}
+
+type LocalTestingInfo struct {
+	// Indicates if the bundle is built in local testing mode.
+	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
+	// The local testing path, as specified in the base manifest.
+	// This refers to the relative path on the external directory of the app where
+	// APKs will be pushed for local testing.
+	// Set only if local testing is enabled.
+	LocalTestingPath     string   `protobuf:"bytes,2,opt,name=local_testing_path,json=localTestingPath,proto3" json:"local_testing_path,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *LocalTestingInfo) Reset()         { *m = LocalTestingInfo{} }
+func (m *LocalTestingInfo) String() string { return proto.CompactTextString(m) }
+func (*LocalTestingInfo) ProtoMessage()    {}
+func (*LocalTestingInfo) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0dff099eb2e3dfdb, []int{12}
+}
+
+func (m *LocalTestingInfo) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_LocalTestingInfo.Unmarshal(m, b)
+}
+func (m *LocalTestingInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_LocalTestingInfo.Marshal(b, m, deterministic)
+}
+func (m *LocalTestingInfo) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_LocalTestingInfo.Merge(m, src)
+}
+func (m *LocalTestingInfo) XXX_Size() int {
+	return xxx_messageInfo_LocalTestingInfo.Size(m)
+}
+func (m *LocalTestingInfo) XXX_DiscardUnknown() {
+	xxx_messageInfo_LocalTestingInfo.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_LocalTestingInfo proto.InternalMessageInfo
+
+func (m *LocalTestingInfo) GetEnabled() bool {
+	if m != nil {
+		return m.Enabled
+	}
+	return false
+}
+
+func (m *LocalTestingInfo) GetLocalTestingPath() string {
+	if m != nil {
+		return m.LocalTestingPath
+	}
+	return ""
+}
+
+func init() {
+	proto.RegisterEnum("android.bundle.DeliveryType", DeliveryType_name, DeliveryType_value)
+	proto.RegisterEnum("android.bundle.SystemApkMetadata_SystemApkType", SystemApkMetadata_SystemApkType_name, SystemApkMetadata_SystemApkType_value)
+	proto.RegisterType((*BuildApksResult)(nil), "android.bundle.BuildApksResult")
+	proto.RegisterType((*Variant)(nil), "android.bundle.Variant")
+	proto.RegisterType((*ApkSet)(nil), "android.bundle.ApkSet")
+	proto.RegisterType((*ModuleMetadata)(nil), "android.bundle.ModuleMetadata")
+	proto.RegisterType((*AssetSliceSet)(nil), "android.bundle.AssetSliceSet")
+	proto.RegisterType((*AssetModuleMetadata)(nil), "android.bundle.AssetModuleMetadata")
+	proto.RegisterType((*InstantMetadata)(nil), "android.bundle.InstantMetadata")
+	proto.RegisterType((*ApkDescription)(nil), "android.bundle.ApkDescription")
+	proto.RegisterType((*SplitApkMetadata)(nil), "android.bundle.SplitApkMetadata")
+	proto.RegisterType((*StandaloneApkMetadata)(nil), "android.bundle.StandaloneApkMetadata")
+	proto.RegisterType((*SystemApkMetadata)(nil), "android.bundle.SystemApkMetadata")
+	proto.RegisterType((*ApexApkMetadata)(nil), "android.bundle.ApexApkMetadata")
+	proto.RegisterType((*LocalTestingInfo)(nil), "android.bundle.LocalTestingInfo")
+}
+
+func init() {
+	proto.RegisterFile("commands.proto", fileDescriptor_0dff099eb2e3dfdb)
+}
+
+var fileDescriptor_0dff099eb2e3dfdb = []byte{
+	// 1104 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0xe2, 0x46,
+	0x14, 0x5e, 0x03, 0x0b, 0xe1, 0x05, 0xb0, 0x33, 0x1b, 0xba, 0xde, 0x68, 0x77, 0xcb, 0xba, 0x4a,
+	0x85, 0xa2, 0x2a, 0xab, 0xa6, 0x3d, 0xad, 0xd4, 0x4a, 0x10, 0x9c, 0x96, 0x2d, 0x90, 0xc8, 0x26,
+	0x89, 0x92, 0x4a, 0x1d, 0x4d, 0x98, 0x49, 0xd6, 0xc2, 0xbf, 0xca, 0x98, 0x28, 0xf9, 0x57, 0x7a,
+	0xa9, 0x7a, 0xec, 0xb1, 0xd7, 0xfe, 0x51, 0x3d, 0xf5, 0xde, 0xca, 0x63, 0x03, 0xb6, 0xb1, 0xd4,
+	0x64, 0xd5, 0x13, 0x7e, 0x6f, 0xbe, 0xf9, 0xe6, 0xbd, 0xf7, 0xbd, 0x79, 0x0c, 0x34, 0x26, 0x9e,
+	0xe3, 0x10, 0x97, 0xf2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x1f, 0xf6, 0x7e, 0x84, 0x5a, 0x72, 0x7a,
+	0xa2, 0x17, 0xd0, 0x3c, 0x1d, 0xfd, 0x30, 0x3a, 0x3e, 0x1f, 0xe1, 0x9e, 0x3e, 0xe8, 0x9f, 0xe9,
+	0xc6, 0x05, 0x1e, 0x5f, 0x9c, 0x84, 0xd5, 0x52, 0xa0, 0xd6, 0x1f, 0x99, 0xe3, 0xce, 0x60, 0x80,
+	0xc7, 0xfd, 0xa1, 0xae, 0x48, 0xa8, 0x0e, 0xd5, 0xe3, 0x10, 0x37, 0xec, 0x8c, 0x7a, 0x4a, 0x21,
+	0x2c, 0xe1, 0x51, 0xc7, 0x1c, 0xe3, 0xa3, 0xe3, 0xc1, 0xe0, 0xf8, 0x5c, 0x29, 0x76, 0xf7, 0x00,
+	0x4d, 0x3c, 0x27, 0x93, 0xfb, 0xe5, 0x76, 0x6c, 0xe3, 0xc8, 0xc6, 0xe2, 0x8d, 0x7d, 0x55, 0x16,
+	0x3f, 0x5f, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xe5, 0xcb, 0x87, 0xab, 0x0b, 0x00, 0x00,
+}
diff --git a/cmd/extract_apks/bundle_proto/commands.proto b/cmd/extract_apks/bundle_proto/commands.proto
new file mode 100644
index 0000000..b36340b
--- /dev/null
+++ b/cmd/extract_apks/bundle_proto/commands.proto
@@ -0,0 +1,197 @@
+// Messages describing APK Set's table of contents (toc.pb entry).
+// Please be advised that the ultimate source is at
+// https://github.com/google/bundletool/tree/master/src/main/proto
+// so you have been warned.
+syntax = "proto3";
+
+package android.bundle;
+
+import "config.proto";
+import "targeting.proto";
+
+option go_package = "android_bundle_proto";
+option java_package = "com.android.bundle";
+
+// Describes the output of the "build-apks" command.
+message BuildApksResult {
+  // The package name of this app.
+  string package_name = 4;
+
+  // List of the created variants.
+  repeated Variant variant = 1;
+
+  // Metadata about BundleTool used to build the APKs.
+  Bundletool bundletool = 2;
+
+  // List of the created asset slices.
+  repeated AssetSliceSet asset_slice_set = 3;
+
+  // Information about local testing mode.
+  LocalTestingInfo local_testing_info = 5;
+}
+
+// Variant is a group of APKs that covers a part of the device configuration
+// space. APKs from multiple variants are never combined on one device.
+message Variant {
+  // Variant-level targeting.
+  // This targeting is fairly high-level and each APK has its own targeting as
+  // well.
+  VariantTargeting targeting = 1;
+
+  // Set of APKs, one set per module.
+  repeated ApkSet apk_set = 2;
+
+  // Number of the variant, starting at 0 (unless overridden).
+  // A device will receive APKs from the first variant that matches the device
+  // configuration, with higher variant numbers having priority over lower
+  // variant numbers.
+  uint32 variant_number = 3;
+}
+
+// Represents a module.
+// For pre-L devices multiple modules (possibly all) may be merged into one.
+message ApkSet {
+  ModuleMetadata module_metadata = 1;
+
+  // APKs.
+  repeated ApkDescription apk_description = 2;
+}
+
+message ModuleMetadata {
+  // Module name.
+  string name = 1;
+
+  // Indicates the delivery type (e.g. on-demand) of the module.
+  DeliveryType delivery_type = 6;
+
+  // Indicates whether this module is marked "instant".
+  bool is_instant = 3;
+
+  // Names of the modules that this module directly depends on.
+  // Each module implicitly depends on the base module.
+  repeated string dependencies = 4;
+
+  // The targeting that makes a conditional module installed.
+  // Relevant only for Split APKs.
+  ModuleTargeting targeting = 5;
+
+  // Deprecated. Please use delivery_type.
+  bool on_demand_deprecated = 2 [deprecated = true];
+}
+
+// Set of asset slices belonging to a single asset module.
+message AssetSliceSet {
+  // Module level metadata.
+  AssetModuleMetadata asset_module_metadata = 1;
+
+  // Asset slices.
+  repeated ApkDescription apk_description = 2;
+}
+
+message AssetModuleMetadata {
+  // Module name.
+  string name = 1;
+
+  // Indicates the delivery type for persistent install.
+  DeliveryType delivery_type = 4;
+
+  // Metadata for instant installs.
+  InstantMetadata instant_metadata = 3;
+
+  // Deprecated. Use delivery_type.
+  bool on_demand_deprecated = 2 [deprecated = true];
+}
+
+message InstantMetadata {
+  // Indicates whether this module is marked "instant".
+  bool is_instant = 1;
+
+  // Indicates the delivery type for instant install.
+  DeliveryType delivery_type = 3;
+
+  // Deprecated. Use delivery_type.
+  bool on_demand_deprecated = 2 [deprecated = true];
+}
+
+enum DeliveryType {
+  UNKNOWN_DELIVERY_TYPE = 0;
+  INSTALL_TIME = 1;
+  ON_DEMAND = 2;
+  FAST_FOLLOW = 3;
+}
+
+message ApkDescription {
+  ApkTargeting targeting = 1;
+
+  // Path to the APK file.
+  // BEGIN-INTERNAL
+  // The path may be a blobkey if the proto is not constructed by bundletool.
+  // END-INTERNAL
+  string path = 2;
+
+  oneof apk_metadata_oneof_value {
+    // Set only for Split APKs.
+    SplitApkMetadata split_apk_metadata = 3;
+    // Set only for standalone APKs.
+    StandaloneApkMetadata standalone_apk_metadata = 4;
+    // Set only for Instant split APKs.
+    SplitApkMetadata instant_apk_metadata = 5;
+    // Set only for system APKs.
+    SystemApkMetadata system_apk_metadata = 6;
+    // Set only for asset slices.
+    SplitApkMetadata asset_slice_metadata = 7;
+    // Set only for APEX APKs.
+    ApexApkMetadata apex_apk_metadata = 8;
+  }
+}
+
+// Holds data specific to Split APKs.
+message SplitApkMetadata {
+  string split_id = 1;
+
+  // Indicates whether this APK is the master split of the module.
+  bool is_master_split = 2;
+}
+
+// Holds data specific to Standalone APKs.
+message StandaloneApkMetadata {
+  // Names of the modules fused in this standalone APK.
+  repeated string fused_module_name = 1;
+
+  reserved 2;
+}
+
+// Holds data specific to system APKs.
+message SystemApkMetadata {
+  // Names of the modules fused in this system APK.
+  repeated string fused_module_name = 1;
+  enum SystemApkType {
+    UNSPECIFIED_VALUE = 0;
+    // Uncompressed APK for system image.
+    SYSTEM = 1;
+    // Stub APK for compressed APK in the system image
+    // (contains only android manifest).
+    SYSTEM_STUB = 2;
+    // Compressed APK for system image.
+    SYSTEM_COMPRESSED = 3;
+  }
+  // Indicates whether the APK is uncompressed system APK, stub APK or
+  // compressed system APK.
+  SystemApkType system_apk_type = 2;
+}
+
+// Holds data specific to APEX APKs.
+message ApexApkMetadata {
+  // Configuration for processing of APKs embedded in an APEX image.
+  repeated ApexEmbeddedApkConfig apex_embedded_apk_config = 1;
+}
+
+message LocalTestingInfo {
+  // Indicates if the bundle is built in local testing mode.
+  bool enabled = 1;
+  // The local testing path, as specified in the base manifest.
+  // This refers to the relative path on the external directory of the app where
+  // APKs will be pushed for local testing.
+  // Set only if local testing is enabled.
+  string local_testing_path = 2;
+}
diff --git a/cmd/extract_apks/bundle_proto/config.pb.go b/cmd/extract_apks/bundle_proto/config.pb.go
new file mode 100644
index 0000000..a28147a
--- /dev/null
+++ b/cmd/extract_apks/bundle_proto/config.pb.go
@@ -0,0 +1,952 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: config.proto
+
+package android_bundle_proto
+
+import (
+	fmt "fmt"
+	proto "github.com/golang/protobuf/proto"
+	math "math"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+type BundleConfig_BundleType int32
+
+const (
+	BundleConfig_REGULAR    BundleConfig_BundleType = 0
+	BundleConfig_APEX       BundleConfig_BundleType = 1
+	BundleConfig_ASSET_ONLY BundleConfig_BundleType = 2
+)
+
+var BundleConfig_BundleType_name = map[int32]string{
+	0: "REGULAR",
+	1: "APEX",
+	2: "ASSET_ONLY",
+}
+
+var BundleConfig_BundleType_value = map[string]int32{
+	"REGULAR":    0,
+	"APEX":       1,
+	"ASSET_ONLY": 2,
+}
+
+func (x BundleConfig_BundleType) String() string {
+	return proto.EnumName(BundleConfig_BundleType_name, int32(x))
+}
+
+func (BundleConfig_BundleType) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{0, 0}
+}
+
+type SplitDimension_Value int32
+
+const (
+	SplitDimension_UNSPECIFIED_VALUE          SplitDimension_Value = 0
+	SplitDimension_ABI                        SplitDimension_Value = 1
+	SplitDimension_SCREEN_DENSITY             SplitDimension_Value = 2
+	SplitDimension_LANGUAGE                   SplitDimension_Value = 3
+	SplitDimension_TEXTURE_COMPRESSION_FORMAT SplitDimension_Value = 4
+	// BEGIN-INTERNAL
+	SplitDimension_GRAPHICS_API SplitDimension_Value = 5
+)
+
+var SplitDimension_Value_name = map[int32]string{
+	0: "UNSPECIFIED_VALUE",
+	1: "ABI",
+	2: "SCREEN_DENSITY",
+	3: "LANGUAGE",
+	4: "TEXTURE_COMPRESSION_FORMAT",
+	5: "GRAPHICS_API",
+}
+
+var SplitDimension_Value_value = map[string]int32{
+	"UNSPECIFIED_VALUE":          0,
+	"ABI":                        1,
+	"SCREEN_DENSITY":             2,
+	"LANGUAGE":                   3,
+	"TEXTURE_COMPRESSION_FORMAT": 4,
+	"GRAPHICS_API":               5,
+}
+
+func (x SplitDimension_Value) String() string {
+	return proto.EnumName(SplitDimension_Value_name, int32(x))
+}
+
+func (SplitDimension_Value) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{9, 0}
+}
+
+type BundleConfig struct {
+	Bundletool    *Bundletool    `protobuf:"bytes,1,opt,name=bundletool,proto3" json:"bundletool,omitempty"`
+	Optimizations *Optimizations `protobuf:"bytes,2,opt,name=optimizations,proto3" json:"optimizations,omitempty"`
+	Compression   *Compression   `protobuf:"bytes,3,opt,name=compression,proto3" json:"compression,omitempty"`
+	// Resources to be always kept in the master split.
+	MasterResources *MasterResources `protobuf:"bytes,4,opt,name=master_resources,json=masterResources,proto3" json:"master_resources,omitempty"`
+	ApexConfig      *ApexConfig      `protobuf:"bytes,5,opt,name=apex_config,json=apexConfig,proto3" json:"apex_config,omitempty"`
+	// APKs to be signed with the same key as generated APKs.
+	UnsignedEmbeddedApkConfig []*UnsignedEmbeddedApkConfig `protobuf:"bytes,6,rep,name=unsigned_embedded_apk_config,json=unsignedEmbeddedApkConfig,proto3" json:"unsigned_embedded_apk_config,omitempty"`
+	AssetModulesConfig        *AssetModulesConfig          `protobuf:"bytes,7,opt,name=asset_modules_config,json=assetModulesConfig,proto3" json:"asset_modules_config,omitempty"`
+	Type                      BundleConfig_BundleType      `protobuf:"varint,8,opt,name=type,proto3,enum=android.bundle.BundleConfig_BundleType" json:"type,omitempty"`
+	XXX_NoUnkeyedLiteral      struct{}                     `json:"-"`
+	XXX_unrecognized          []byte                       `json:"-"`
+	XXX_sizecache             int32                        `json:"-"`
+}
+
+func (m *BundleConfig) Reset()         { *m = BundleConfig{} }
+func (m *BundleConfig) String() string { return proto.CompactTextString(m) }
+func (*BundleConfig) ProtoMessage()    {}
+func (*BundleConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{0}
+}
+
+func (m *BundleConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_BundleConfig.Unmarshal(m, b)
+}
+func (m *BundleConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_BundleConfig.Marshal(b, m, deterministic)
+}
+func (m *BundleConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_BundleConfig.Merge(m, src)
+}
+func (m *BundleConfig) XXX_Size() int {
+	return xxx_messageInfo_BundleConfig.Size(m)
+}
+func (m *BundleConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_BundleConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_BundleConfig proto.InternalMessageInfo
+
+func (m *BundleConfig) GetBundletool() *Bundletool {
+	if m != nil {
+		return m.Bundletool
+	}
+	return nil
+}
+
+func (m *BundleConfig) GetOptimizations() *Optimizations {
+	if m != nil {
+		return m.Optimizations
+	}
+	return nil
+}
+
+func (m *BundleConfig) GetCompression() *Compression {
+	if m != nil {
+		return m.Compression
+	}
+	return nil
+}
+
+func (m *BundleConfig) GetMasterResources() *MasterResources {
+	if m != nil {
+		return m.MasterResources
+	}
+	return nil
+}
+
+func (m *BundleConfig) GetApexConfig() *ApexConfig {
+	if m != nil {
+		return m.ApexConfig
+	}
+	return nil
+}
+
+func (m *BundleConfig) GetUnsignedEmbeddedApkConfig() []*UnsignedEmbeddedApkConfig {
+	if m != nil {
+		return m.UnsignedEmbeddedApkConfig
+	}
+	return nil
+}
+
+func (m *BundleConfig) GetAssetModulesConfig() *AssetModulesConfig {
+	if m != nil {
+		return m.AssetModulesConfig
+	}
+	return nil
+}
+
+func (m *BundleConfig) GetType() BundleConfig_BundleType {
+	if m != nil {
+		return m.Type
+	}
+	return BundleConfig_REGULAR
+}
+
+type Bundletool struct {
+	// Version of BundleTool used to build the Bundle.
+	Version              string   `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *Bundletool) Reset()         { *m = Bundletool{} }
+func (m *Bundletool) String() string { return proto.CompactTextString(m) }
+func (*Bundletool) ProtoMessage()    {}
+func (*Bundletool) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{1}
+}
+
+func (m *Bundletool) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Bundletool.Unmarshal(m, b)
+}
+func (m *Bundletool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Bundletool.Marshal(b, m, deterministic)
+}
+func (m *Bundletool) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Bundletool.Merge(m, src)
+}
+func (m *Bundletool) XXX_Size() int {
+	return xxx_messageInfo_Bundletool.Size(m)
+}
+func (m *Bundletool) XXX_DiscardUnknown() {
+	xxx_messageInfo_Bundletool.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Bundletool proto.InternalMessageInfo
+
+func (m *Bundletool) GetVersion() string {
+	if m != nil {
+		return m.Version
+	}
+	return ""
+}
+
+type Compression struct {
+	// Glob matching the list of files to leave uncompressed in the APKs.
+	// The matching is done against the path of files in the APK, thus excluding
+	// the name of the modules, and using forward slash ("/") as a name separator.
+	// Examples: "res/raw/**", "assets/**/*.uncompressed", etc.
+	UncompressedGlob     []string `protobuf:"bytes,1,rep,name=uncompressed_glob,json=uncompressedGlob,proto3" json:"uncompressed_glob,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *Compression) Reset()         { *m = Compression{} }
+func (m *Compression) String() string { return proto.CompactTextString(m) }
+func (*Compression) ProtoMessage()    {}
+func (*Compression) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{2}
+}
+
+func (m *Compression) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Compression.Unmarshal(m, b)
+}
+func (m *Compression) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Compression.Marshal(b, m, deterministic)
+}
+func (m *Compression) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Compression.Merge(m, src)
+}
+func (m *Compression) XXX_Size() int {
+	return xxx_messageInfo_Compression.Size(m)
+}
+func (m *Compression) XXX_DiscardUnknown() {
+	xxx_messageInfo_Compression.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Compression proto.InternalMessageInfo
+
+func (m *Compression) GetUncompressedGlob() []string {
+	if m != nil {
+		return m.UncompressedGlob
+	}
+	return nil
+}
+
+// Resources to keep in the master split.
+type MasterResources struct {
+	// Resource IDs to be kept in master split.
+	ResourceIds []int32 `protobuf:"varint,1,rep,packed,name=resource_ids,json=resourceIds,proto3" json:"resource_ids,omitempty"`
+	// Resource names to be kept in master split.
+	ResourceNames        []string `protobuf:"bytes,2,rep,name=resource_names,json=resourceNames,proto3" json:"resource_names,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *MasterResources) Reset()         { *m = MasterResources{} }
+func (m *MasterResources) String() string { return proto.CompactTextString(m) }
+func (*MasterResources) ProtoMessage()    {}
+func (*MasterResources) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{3}
+}
+
+func (m *MasterResources) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_MasterResources.Unmarshal(m, b)
+}
+func (m *MasterResources) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_MasterResources.Marshal(b, m, deterministic)
+}
+func (m *MasterResources) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_MasterResources.Merge(m, src)
+}
+func (m *MasterResources) XXX_Size() int {
+	return xxx_messageInfo_MasterResources.Size(m)
+}
+func (m *MasterResources) XXX_DiscardUnknown() {
+	xxx_messageInfo_MasterResources.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MasterResources proto.InternalMessageInfo
+
+func (m *MasterResources) GetResourceIds() []int32 {
+	if m != nil {
+		return m.ResourceIds
+	}
+	return nil
+}
+
+func (m *MasterResources) GetResourceNames() []string {
+	if m != nil {
+		return m.ResourceNames
+	}
+	return nil
+}
+
+type Optimizations struct {
+	SplitsConfig *SplitsConfig `protobuf:"bytes,1,opt,name=splits_config,json=splitsConfig,proto3" json:"splits_config,omitempty"`
+	// This is for uncompressing native libraries on M+ devices (L+ devices on
+	// instant apps).
+	UncompressNativeLibraries *UncompressNativeLibraries `protobuf:"bytes,2,opt,name=uncompress_native_libraries,json=uncompressNativeLibraries,proto3" json:"uncompress_native_libraries,omitempty"`
+	// This is for uncompressing dex files on P+ devices.
+	UncompressDexFiles *UncompressDexFiles `protobuf:"bytes,3,opt,name=uncompress_dex_files,json=uncompressDexFiles,proto3" json:"uncompress_dex_files,omitempty"`
+	// Configuration for the generation of standalone APKs.
+	// If no StandaloneConfig is set, the configuration is inherited from
+	// splits_config.
+	StandaloneConfig     *StandaloneConfig `protobuf:"bytes,4,opt,name=standalone_config,json=standaloneConfig,proto3" json:"standalone_config,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
+	XXX_unrecognized     []byte            `json:"-"`
+	XXX_sizecache        int32             `json:"-"`
+}
+
+func (m *Optimizations) Reset()         { *m = Optimizations{} }
+func (m *Optimizations) String() string { return proto.CompactTextString(m) }
+func (*Optimizations) ProtoMessage()    {}
+func (*Optimizations) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{4}
+}
+
+func (m *Optimizations) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Optimizations.Unmarshal(m, b)
+}
+func (m *Optimizations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Optimizations.Marshal(b, m, deterministic)
+}
+func (m *Optimizations) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Optimizations.Merge(m, src)
+}
+func (m *Optimizations) XXX_Size() int {
+	return xxx_messageInfo_Optimizations.Size(m)
+}
+func (m *Optimizations) XXX_DiscardUnknown() {
+	xxx_messageInfo_Optimizations.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Optimizations proto.InternalMessageInfo
+
+func (m *Optimizations) GetSplitsConfig() *SplitsConfig {
+	if m != nil {
+		return m.SplitsConfig
+	}
+	return nil
+}
+
+func (m *Optimizations) GetUncompressNativeLibraries() *UncompressNativeLibraries {
+	if m != nil {
+		return m.UncompressNativeLibraries
+	}
+	return nil
+}
+
+func (m *Optimizations) GetUncompressDexFiles() *UncompressDexFiles {
+	if m != nil {
+		return m.UncompressDexFiles
+	}
+	return nil
+}
+
+func (m *Optimizations) GetStandaloneConfig() *StandaloneConfig {
+	if m != nil {
+		return m.StandaloneConfig
+	}
+	return nil
+}
+
+type UncompressNativeLibraries struct {
+	Enabled              bool     `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *UncompressNativeLibraries) Reset()         { *m = UncompressNativeLibraries{} }
+func (m *UncompressNativeLibraries) String() string { return proto.CompactTextString(m) }
+func (*UncompressNativeLibraries) ProtoMessage()    {}
+func (*UncompressNativeLibraries) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{5}
+}
+
+func (m *UncompressNativeLibraries) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_UncompressNativeLibraries.Unmarshal(m, b)
+}
+func (m *UncompressNativeLibraries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_UncompressNativeLibraries.Marshal(b, m, deterministic)
+}
+func (m *UncompressNativeLibraries) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_UncompressNativeLibraries.Merge(m, src)
+}
+func (m *UncompressNativeLibraries) XXX_Size() int {
+	return xxx_messageInfo_UncompressNativeLibraries.Size(m)
+}
+func (m *UncompressNativeLibraries) XXX_DiscardUnknown() {
+	xxx_messageInfo_UncompressNativeLibraries.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_UncompressNativeLibraries proto.InternalMessageInfo
+
+func (m *UncompressNativeLibraries) GetEnabled() bool {
+	if m != nil {
+		return m.Enabled
+	}
+	return false
+}
+
+type UncompressDexFiles struct {
+	Enabled              bool     `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *UncompressDexFiles) Reset()         { *m = UncompressDexFiles{} }
+func (m *UncompressDexFiles) String() string { return proto.CompactTextString(m) }
+func (*UncompressDexFiles) ProtoMessage()    {}
+func (*UncompressDexFiles) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{6}
+}
+
+func (m *UncompressDexFiles) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_UncompressDexFiles.Unmarshal(m, b)
+}
+func (m *UncompressDexFiles) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_UncompressDexFiles.Marshal(b, m, deterministic)
+}
+func (m *UncompressDexFiles) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_UncompressDexFiles.Merge(m, src)
+}
+func (m *UncompressDexFiles) XXX_Size() int {
+	return xxx_messageInfo_UncompressDexFiles.Size(m)
+}
+func (m *UncompressDexFiles) XXX_DiscardUnknown() {
+	xxx_messageInfo_UncompressDexFiles.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_UncompressDexFiles proto.InternalMessageInfo
+
+func (m *UncompressDexFiles) GetEnabled() bool {
+	if m != nil {
+		return m.Enabled
+	}
+	return false
+}
+
+// Optimization configuration used to generate Split APKs.
+type SplitsConfig struct {
+	SplitDimension       []*SplitDimension `protobuf:"bytes,1,rep,name=split_dimension,json=splitDimension,proto3" json:"split_dimension,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
+	XXX_unrecognized     []byte            `json:"-"`
+	XXX_sizecache        int32             `json:"-"`
+}
+
+func (m *SplitsConfig) Reset()         { *m = SplitsConfig{} }
+func (m *SplitsConfig) String() string { return proto.CompactTextString(m) }
+func (*SplitsConfig) ProtoMessage()    {}
+func (*SplitsConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{7}
+}
+
+func (m *SplitsConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SplitsConfig.Unmarshal(m, b)
+}
+func (m *SplitsConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SplitsConfig.Marshal(b, m, deterministic)
+}
+func (m *SplitsConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SplitsConfig.Merge(m, src)
+}
+func (m *SplitsConfig) XXX_Size() int {
+	return xxx_messageInfo_SplitsConfig.Size(m)
+}
+func (m *SplitsConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_SplitsConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SplitsConfig proto.InternalMessageInfo
+
+func (m *SplitsConfig) GetSplitDimension() []*SplitDimension {
+	if m != nil {
+		return m.SplitDimension
+	}
+	return nil
+}
+
+// Optimization configuration used to generate Standalone APKs.
+type StandaloneConfig struct {
+	// Device targeting dimensions to shard.
+	SplitDimension []*SplitDimension `protobuf:"bytes,1,rep,name=split_dimension,json=splitDimension,proto3" json:"split_dimension,omitempty"`
+	// Whether 64 bit libraries should be stripped from Standalone APKs.
+	Strip_64BitLibraries bool     `protobuf:"varint,2,opt,name=strip_64_bit_libraries,json=strip64BitLibraries,proto3" json:"strip_64_bit_libraries,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *StandaloneConfig) Reset()         { *m = StandaloneConfig{} }
+func (m *StandaloneConfig) String() string { return proto.CompactTextString(m) }
+func (*StandaloneConfig) ProtoMessage()    {}
+func (*StandaloneConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{8}
+}
+
+func (m *StandaloneConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_StandaloneConfig.Unmarshal(m, b)
+}
+func (m *StandaloneConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_StandaloneConfig.Marshal(b, m, deterministic)
+}
+func (m *StandaloneConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_StandaloneConfig.Merge(m, src)
+}
+func (m *StandaloneConfig) XXX_Size() int {
+	return xxx_messageInfo_StandaloneConfig.Size(m)
+}
+func (m *StandaloneConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_StandaloneConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_StandaloneConfig proto.InternalMessageInfo
+
+func (m *StandaloneConfig) GetSplitDimension() []*SplitDimension {
+	if m != nil {
+		return m.SplitDimension
+	}
+	return nil
+}
+
+func (m *StandaloneConfig) GetStrip_64BitLibraries() bool {
+	if m != nil {
+		return m.Strip_64BitLibraries
+	}
+	return false
+}
+
+type SplitDimension struct {
+	Value SplitDimension_Value `protobuf:"varint,1,opt,name=value,proto3,enum=android.bundle.SplitDimension_Value" json:"value,omitempty"`
+	// If set to 'true', indicates that APKs should *not* be split by this
+	// dimension.
+	Negate bool `protobuf:"varint,2,opt,name=negate,proto3" json:"negate,omitempty"`
+	// Optional transformation to be applied to asset directories where
+	// the targeting is encoded in the directory name (e.g: assets/foo#tcf_etc1)
+	SuffixStripping      *SuffixStripping `protobuf:"bytes,3,opt,name=suffix_stripping,json=suffixStripping,proto3" json:"suffix_stripping,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
+	XXX_unrecognized     []byte           `json:"-"`
+	XXX_sizecache        int32            `json:"-"`
+}
+
+func (m *SplitDimension) Reset()         { *m = SplitDimension{} }
+func (m *SplitDimension) String() string { return proto.CompactTextString(m) }
+func (*SplitDimension) ProtoMessage()    {}
+func (*SplitDimension) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{9}
+}
+
+func (m *SplitDimension) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SplitDimension.Unmarshal(m, b)
+}
+func (m *SplitDimension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SplitDimension.Marshal(b, m, deterministic)
+}
+func (m *SplitDimension) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SplitDimension.Merge(m, src)
+}
+func (m *SplitDimension) XXX_Size() int {
+	return xxx_messageInfo_SplitDimension.Size(m)
+}
+func (m *SplitDimension) XXX_DiscardUnknown() {
+	xxx_messageInfo_SplitDimension.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SplitDimension proto.InternalMessageInfo
+
+func (m *SplitDimension) GetValue() SplitDimension_Value {
+	if m != nil {
+		return m.Value
+	}
+	return SplitDimension_UNSPECIFIED_VALUE
+}
+
+func (m *SplitDimension) GetNegate() bool {
+	if m != nil {
+		return m.Negate
+	}
+	return false
+}
+
+func (m *SplitDimension) GetSuffixStripping() *SuffixStripping {
+	if m != nil {
+		return m.SuffixStripping
+	}
+	return nil
+}
+
+type SuffixStripping struct {
+	// If set to 'true', indicates that the targeting suffix should be removed
+	// from assets paths for this dimension when splits (or asset slices) are
+	// generated.
+	// This only applies to assets.
+	// For example a folder with path "assets/level1_textures#tcf_etc1"
+	// would be outputted to "assets/level1_textures". File contents are
+	// unchanged.
+	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
+	// The default suffix to be used for the cases where separate slices can't
+	// be generated for this dimension. In the case of standalone/universal APKs
+	// generation, stripping the suffix can lead to file name collisions. This
+	// default suffix defines the directories to retain. The others are
+	// discarded: standalone/universal APKs will contain only directories
+	// targeted at this value for the dimension.
+	//
+	// If not set or empty, the fallback directory in each directory group will be
+	// used (for example, if both "assets/level1_textures#tcf_etc1" and
+	// "assets/level1_textures" are present and the default suffix is empty,
+	// then only "assets/level1_textures" will be used).
+	DefaultSuffix        string   `protobuf:"bytes,2,opt,name=default_suffix,json=defaultSuffix,proto3" json:"default_suffix,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *SuffixStripping) Reset()         { *m = SuffixStripping{} }
+func (m *SuffixStripping) String() string { return proto.CompactTextString(m) }
+func (*SuffixStripping) ProtoMessage()    {}
+func (*SuffixStripping) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{10}
+}
+
+func (m *SuffixStripping) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SuffixStripping.Unmarshal(m, b)
+}
+func (m *SuffixStripping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SuffixStripping.Marshal(b, m, deterministic)
+}
+func (m *SuffixStripping) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SuffixStripping.Merge(m, src)
+}
+func (m *SuffixStripping) XXX_Size() int {
+	return xxx_messageInfo_SuffixStripping.Size(m)
+}
+func (m *SuffixStripping) XXX_DiscardUnknown() {
+	xxx_messageInfo_SuffixStripping.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SuffixStripping proto.InternalMessageInfo
+
+func (m *SuffixStripping) GetEnabled() bool {
+	if m != nil {
+		return m.Enabled
+	}
+	return false
+}
+
+func (m *SuffixStripping) GetDefaultSuffix() string {
+	if m != nil {
+		return m.DefaultSuffix
+	}
+	return ""
+}
+
+// Configuration for processing APEX bundles.
+// https://source.android.com/devices/tech/ota/apex
+type ApexConfig struct {
+	// Configuration for processing of APKs embedded in an APEX image.
+	ApexEmbeddedApkConfig []*ApexEmbeddedApkConfig `protobuf:"bytes,1,rep,name=apex_embedded_apk_config,json=apexEmbeddedApkConfig,proto3" json:"apex_embedded_apk_config,omitempty"`
+	XXX_NoUnkeyedLiteral  struct{}                 `json:"-"`
+	XXX_unrecognized      []byte                   `json:"-"`
+	XXX_sizecache         int32                    `json:"-"`
+}
+
+func (m *ApexConfig) Reset()         { *m = ApexConfig{} }
+func (m *ApexConfig) String() string { return proto.CompactTextString(m) }
+func (*ApexConfig) ProtoMessage()    {}
+func (*ApexConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{11}
+}
+
+func (m *ApexConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ApexConfig.Unmarshal(m, b)
+}
+func (m *ApexConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ApexConfig.Marshal(b, m, deterministic)
+}
+func (m *ApexConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ApexConfig.Merge(m, src)
+}
+func (m *ApexConfig) XXX_Size() int {
+	return xxx_messageInfo_ApexConfig.Size(m)
+}
+func (m *ApexConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_ApexConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApexConfig proto.InternalMessageInfo
+
+func (m *ApexConfig) GetApexEmbeddedApkConfig() []*ApexEmbeddedApkConfig {
+	if m != nil {
+		return m.ApexEmbeddedApkConfig
+	}
+	return nil
+}
+
+type ApexEmbeddedApkConfig struct {
+	// Android package name of the APK.
+	PackageName string `protobuf:"bytes,1,opt,name=package_name,json=packageName,proto3" json:"package_name,omitempty"`
+	// Path to the APK within the APEX system image.
+	Path                 string   `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *ApexEmbeddedApkConfig) Reset()         { *m = ApexEmbeddedApkConfig{} }
+func (m *ApexEmbeddedApkConfig) String() string { return proto.CompactTextString(m) }
+func (*ApexEmbeddedApkConfig) ProtoMessage()    {}
+func (*ApexEmbeddedApkConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{12}
+}
+
+func (m *ApexEmbeddedApkConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ApexEmbeddedApkConfig.Unmarshal(m, b)
+}
+func (m *ApexEmbeddedApkConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ApexEmbeddedApkConfig.Marshal(b, m, deterministic)
+}
+func (m *ApexEmbeddedApkConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ApexEmbeddedApkConfig.Merge(m, src)
+}
+func (m *ApexEmbeddedApkConfig) XXX_Size() int {
+	return xxx_messageInfo_ApexEmbeddedApkConfig.Size(m)
+}
+func (m *ApexEmbeddedApkConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_ApexEmbeddedApkConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApexEmbeddedApkConfig proto.InternalMessageInfo
+
+func (m *ApexEmbeddedApkConfig) GetPackageName() string {
+	if m != nil {
+		return m.PackageName
+	}
+	return ""
+}
+
+func (m *ApexEmbeddedApkConfig) GetPath() string {
+	if m != nil {
+		return m.Path
+	}
+	return ""
+}
+
+type UnsignedEmbeddedApkConfig struct {
+	// Path to the APK inside the module (e.g. if the path inside the bundle
+	// is split/assets/example.apk, this will be assets/example.apk).
+	Path                 string   `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *UnsignedEmbeddedApkConfig) Reset()         { *m = UnsignedEmbeddedApkConfig{} }
+func (m *UnsignedEmbeddedApkConfig) String() string { return proto.CompactTextString(m) }
+func (*UnsignedEmbeddedApkConfig) ProtoMessage()    {}
+func (*UnsignedEmbeddedApkConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{13}
+}
+
+func (m *UnsignedEmbeddedApkConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_UnsignedEmbeddedApkConfig.Unmarshal(m, b)
+}
+func (m *UnsignedEmbeddedApkConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_UnsignedEmbeddedApkConfig.Marshal(b, m, deterministic)
+}
+func (m *UnsignedEmbeddedApkConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_UnsignedEmbeddedApkConfig.Merge(m, src)
+}
+func (m *UnsignedEmbeddedApkConfig) XXX_Size() int {
+	return xxx_messageInfo_UnsignedEmbeddedApkConfig.Size(m)
+}
+func (m *UnsignedEmbeddedApkConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_UnsignedEmbeddedApkConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_UnsignedEmbeddedApkConfig proto.InternalMessageInfo
+
+func (m *UnsignedEmbeddedApkConfig) GetPath() string {
+	if m != nil {
+		return m.Path
+	}
+	return ""
+}
+
+type AssetModulesConfig struct {
+	// App versionCodes that will be updated with these asset modules.
+	// Only relevant for asset-only bundles.
+	AppVersion []int64 `protobuf:"varint,1,rep,packed,name=app_version,json=appVersion,proto3" json:"app_version,omitempty"`
+	// Version tag for the asset upload.
+	// Only relevant for asset-only bundles.
+	AssetVersionTag      string   `protobuf:"bytes,2,opt,name=asset_version_tag,json=assetVersionTag,proto3" json:"asset_version_tag,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *AssetModulesConfig) Reset()         { *m = AssetModulesConfig{} }
+func (m *AssetModulesConfig) String() string { return proto.CompactTextString(m) }
+func (*AssetModulesConfig) ProtoMessage()    {}
+func (*AssetModulesConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_3eaf2c85e69e9ea4, []int{14}
+}
+
+func (m *AssetModulesConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_AssetModulesConfig.Unmarshal(m, b)
+}
+func (m *AssetModulesConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_AssetModulesConfig.Marshal(b, m, deterministic)
+}
+func (m *AssetModulesConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_AssetModulesConfig.Merge(m, src)
+}
+func (m *AssetModulesConfig) XXX_Size() int {
+	return xxx_messageInfo_AssetModulesConfig.Size(m)
+}
+func (m *AssetModulesConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_AssetModulesConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AssetModulesConfig proto.InternalMessageInfo
+
+func (m *AssetModulesConfig) GetAppVersion() []int64 {
+	if m != nil {
+		return m.AppVersion
+	}
+	return nil
+}
+
+func (m *AssetModulesConfig) GetAssetVersionTag() string {
+	if m != nil {
+		return m.AssetVersionTag
+	}
+	return ""
+}
+
+func init() {
+	proto.RegisterEnum("android.bundle.BundleConfig_BundleType", BundleConfig_BundleType_name, BundleConfig_BundleType_value)
+	proto.RegisterEnum("android.bundle.SplitDimension_Value", SplitDimension_Value_name, SplitDimension_Value_value)
+	proto.RegisterType((*BundleConfig)(nil), "android.bundle.BundleConfig")
+	proto.RegisterType((*Bundletool)(nil), "android.bundle.Bundletool")
+	proto.RegisterType((*Compression)(nil), "android.bundle.Compression")
+	proto.RegisterType((*MasterResources)(nil), "android.bundle.MasterResources")
+	proto.RegisterType((*Optimizations)(nil), "android.bundle.Optimizations")
+	proto.RegisterType((*UncompressNativeLibraries)(nil), "android.bundle.UncompressNativeLibraries")
+	proto.RegisterType((*UncompressDexFiles)(nil), "android.bundle.UncompressDexFiles")
+	proto.RegisterType((*SplitsConfig)(nil), "android.bundle.SplitsConfig")
+	proto.RegisterType((*StandaloneConfig)(nil), "android.bundle.StandaloneConfig")
+	proto.RegisterType((*SplitDimension)(nil), "android.bundle.SplitDimension")
+	proto.RegisterType((*SuffixStripping)(nil), "android.bundle.SuffixStripping")
+	proto.RegisterType((*ApexConfig)(nil), "android.bundle.ApexConfig")
+	proto.RegisterType((*ApexEmbeddedApkConfig)(nil), "android.bundle.ApexEmbeddedApkConfig")
+	proto.RegisterType((*UnsignedEmbeddedApkConfig)(nil), "android.bundle.UnsignedEmbeddedApkConfig")
+	proto.RegisterType((*AssetModulesConfig)(nil), "android.bundle.AssetModulesConfig")
+}
+
+func init() {
+	proto.RegisterFile("config.proto", fileDescriptor_3eaf2c85e69e9ea4)
+}
+
+var fileDescriptor_3eaf2c85e69e9ea4 = []byte{
+	// 1001 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdb, 0x6e, 0xdb, 0x46,
+	0x10, 0x0d, 0x75, 0xb1, 0xe5, 0x91, 0x2c, 0xd1, 0xdb, 0x38, 0x50, 0x2e, 0x4d, 0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0xb4,
+	0x39, 0x8d, 0xd0, 0x8b, 0x68, 0xf0, 0x7a, 0x24, 0xed, 0xfe, 0x51, 0xa6, 0xf9, 0x68, 0xb8, 0x7a,
+	0x37, 0xb1, 0x07, 0xbd, 0x82, 0xa3, 0x78, 0xe0, 0x25, 0x10, 0x12, 0xd0, 0x59, 0x72, 0x90, 0x9a,
+	0x5c, 0x48, 0x80, 0x43, 0x3a, 0xbb, 0x7c, 0x05, 0x68, 0xe2, 0xce, 0x33, 0x65, 0xfa, 0xf9, 0x61,
+	0x62, 0x93, 0xd8, 0x26, 0xf2, 0xef, 0xd1, 0x78, 0x4f, 0xfe, 0x9c, 0xff, 0x17, 0x00, 0x00, 0xff,
+	0xff, 0x6b, 0x05, 0xbf, 0x99, 0x35, 0x09, 0x00, 0x00,
+}
diff --git a/cmd/extract_apks/bundle_proto/config.proto b/cmd/extract_apks/bundle_proto/config.proto
new file mode 100644
index 0000000..1c161aa
--- /dev/null
+++ b/cmd/extract_apks/bundle_proto/config.proto
@@ -0,0 +1,162 @@
+// Messages describing APK Set's table of contents (toc.pb entry).
+// Please be advised that the ultimate source is at
+// https://github.com/google/bundletool/tree/master/src/main/proto
+// so you have been warned.
+syntax = "proto3";
+
+package android.bundle;
+
+option go_package = "android_bundle_proto";
+option java_package = "com.android.bundle";
+
+message BundleConfig {
+  Bundletool bundletool = 1;
+  Optimizations optimizations = 2;
+  Compression compression = 3;
+  // Resources to be always kept in the master split.
+  MasterResources master_resources = 4;
+  ApexConfig apex_config = 5;
+  // APKs to be signed with the same key as generated APKs.
+  repeated UnsignedEmbeddedApkConfig unsigned_embedded_apk_config = 6;
+  AssetModulesConfig asset_modules_config = 7;
+
+  enum BundleType {
+    REGULAR = 0;
+    APEX = 1;
+    ASSET_ONLY = 2;
+  }
+  BundleType type = 8;
+}
+
+message Bundletool {
+  reserved 1;
+  // Version of BundleTool used to build the Bundle.
+  string version = 2;
+}
+
+message Compression {
+  // Glob matching the list of files to leave uncompressed in the APKs.
+  // The matching is done against the path of files in the APK, thus excluding
+  // the name of the modules, and using forward slash ("/") as a name separator.
+  // Examples: "res/raw/**", "assets/**/*.uncompressed", etc.
+  repeated string uncompressed_glob = 1;
+}
+
+// Resources to keep in the master split.
+message MasterResources {
+  // Resource IDs to be kept in master split.
+  repeated int32 resource_ids = 1;
+  // Resource names to be kept in master split.
+  repeated string resource_names = 2;
+}
+
+message Optimizations {
+  SplitsConfig splits_config = 1;
+  // This is for uncompressing native libraries on M+ devices (L+ devices on
+  // instant apps).
+  UncompressNativeLibraries uncompress_native_libraries = 2;
+  // This is for uncompressing dex files on P+ devices.
+  UncompressDexFiles uncompress_dex_files = 3;
+  // Configuration for the generation of standalone APKs.
+  // If no StandaloneConfig is set, the configuration is inherited from
+  // splits_config.
+  StandaloneConfig standalone_config = 4;
+}
+
+message UncompressNativeLibraries {
+  bool enabled = 1;
+}
+
+message UncompressDexFiles {
+  bool enabled = 1;
+}
+
+// Optimization configuration used to generate Split APKs.
+message SplitsConfig {
+  repeated SplitDimension split_dimension = 1;
+}
+
+// Optimization configuration used to generate Standalone APKs.
+message StandaloneConfig {
+  // Device targeting dimensions to shard.
+  repeated SplitDimension split_dimension = 1;
+  // Whether 64 bit libraries should be stripped from Standalone APKs.
+  bool strip_64_bit_libraries = 2;
+}
+
+message SplitDimension {
+  enum Value {
+    UNSPECIFIED_VALUE = 0;
+    ABI = 1;
+    SCREEN_DENSITY = 2;
+    LANGUAGE = 3;
+    TEXTURE_COMPRESSION_FORMAT = 4;
+    // BEGIN-INTERNAL
+    GRAPHICS_API = 5;
+    // END-INTERNAL
+  }
+  Value value = 1;
+
+  // If set to 'true', indicates that APKs should *not* be split by this
+  // dimension.
+  bool negate = 2;
+
+  // Optional transformation to be applied to asset directories where
+  // the targeting is encoded in the directory name (e.g: assets/foo#tcf_etc1)
+  SuffixStripping suffix_stripping = 3;
+}
+
+message SuffixStripping {
+  // If set to 'true', indicates that the targeting suffix should be removed
+  // from assets paths for this dimension when splits (or asset slices) are
+  // generated.
+  // This only applies to assets.
+  // For example a folder with path "assets/level1_textures#tcf_etc1"
+  // would be outputted to "assets/level1_textures". File contents are
+  // unchanged.
+  bool enabled = 1;
+
+  // The default suffix to be used for the cases where separate slices can't
+  // be generated for this dimension. In the case of standalone/universal APKs
+  // generation, stripping the suffix can lead to file name collisions. This
+  // default suffix defines the directories to retain. The others are
+  // discarded: standalone/universal APKs will contain only directories
+  // targeted at this value for the dimension.
+  //
+  // If not set or empty, the fallback directory in each directory group will be
+  // used (for example, if both "assets/level1_textures#tcf_etc1" and
+  // "assets/level1_textures" are present and the default suffix is empty,
+  // then only "assets/level1_textures" will be used).
+  string default_suffix = 2;
+}
+
+// Configuration for processing APEX bundles.
+// https://source.android.com/devices/tech/ota/apex
+message ApexConfig {
+  // Configuration for processing of APKs embedded in an APEX image.
+  repeated ApexEmbeddedApkConfig apex_embedded_apk_config = 1;
+}
+
+message ApexEmbeddedApkConfig {
+  // Android package name of the APK.
+  string package_name = 1;
+
+  // Path to the APK within the APEX system image.
+  string path = 2;
+}
+
+message UnsignedEmbeddedApkConfig {
+  // Path to the APK inside the module (e.g. if the path inside the bundle
+  // is split/assets/example.apk, this will be assets/example.apk).
+  string path = 1;
+}
+
+message AssetModulesConfig {
+  // App versionCodes that will be updated with these asset modules.
+  // Only relevant for asset-only bundles.
+  repeated int64 app_version = 1;
+
+  // Version tag for the asset upload.
+  // Only relevant for asset-only bundles.
+  string asset_version_tag = 2;
+}
diff --git a/cmd/extract_apks/bundle_proto/regen.sh b/cmd/extract_apks/bundle_proto/regen.sh
new file mode 100755
index 0000000..89fb655
--- /dev/null
+++ b/cmd/extract_apks/bundle_proto/regen.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# Generates the golang source file of protos file describing APK set table of
+# contents (toc.pb file).
+
+set -e
+function die() { echo "ERROR: $1" >&2; exit 1; }
+
+readonly error_msg="Maybe you need to run 'lunch aosp_arm-eng && m aprotoc blueprint_tools'?"
+
+hash aprotoc &>/dev/null || die "could not find aprotoc. ${error_msg}"
+# TODO(asmundak): maybe have the paths relative to repo top?
+(cd "${0%/*}" && aprotoc --go_out=paths=source_relative:. commands.proto config.proto targeting.proto ) || die "build failed. ${error_msg}"
diff --git a/cmd/extract_apks/bundle_proto/targeting.pb.go b/cmd/extract_apks/bundle_proto/targeting.pb.go
new file mode 100644
index 0000000..187bc44
--- /dev/null
+++ b/cmd/extract_apks/bundle_proto/targeting.pb.go
@@ -0,0 +1,1734 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: targeting.proto
+
+package android_bundle_proto
+
+import (
+	fmt "fmt"
+	proto "github.com/golang/protobuf/proto"
+	math "math"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+type ScreenDensity_DensityAlias int32
+
+const (
+	ScreenDensity_DENSITY_UNSPECIFIED ScreenDensity_DensityAlias = 0
+	ScreenDensity_NODPI               ScreenDensity_DensityAlias = 1
+	ScreenDensity_LDPI                ScreenDensity_DensityAlias = 2
+	ScreenDensity_MDPI                ScreenDensity_DensityAlias = 3
+	ScreenDensity_TVDPI               ScreenDensity_DensityAlias = 4
+	ScreenDensity_HDPI                ScreenDensity_DensityAlias = 5
+	ScreenDensity_XHDPI               ScreenDensity_DensityAlias = 6
+	ScreenDensity_XXHDPI              ScreenDensity_DensityAlias = 7
+	ScreenDensity_XXXHDPI             ScreenDensity_DensityAlias = 8
+)
+
+var ScreenDensity_DensityAlias_name = map[int32]string{
+	0: "DENSITY_UNSPECIFIED",
+	1: "NODPI",
+	2: "LDPI",
+	3: "MDPI",
+	4: "TVDPI",
+	5: "HDPI",
+	6: "XHDPI",
+	7: "XXHDPI",
+	8: "XXXHDPI",
+}
+
+var ScreenDensity_DensityAlias_value = map[string]int32{
+	"DENSITY_UNSPECIFIED": 0,
+	"NODPI":               1,
+	"LDPI":                2,
+	"MDPI":                3,
+	"TVDPI":               4,
+	"HDPI":                5,
+	"XHDPI":               6,
+	"XXHDPI":              7,
+	"XXXHDPI":             8,
+}
+
+func (x ScreenDensity_DensityAlias) String() string {
+	return proto.EnumName(ScreenDensity_DensityAlias_name, int32(x))
+}
+
+func (ScreenDensity_DensityAlias) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{4, 0}
+}
+
+type TextureCompressionFormat_TextureCompressionFormatAlias int32
+
+const (
+	TextureCompressionFormat_UNSPECIFIED_TEXTURE_COMPRESSION_FORMAT TextureCompressionFormat_TextureCompressionFormatAlias = 0
+	TextureCompressionFormat_ETC1_RGB8                              TextureCompressionFormat_TextureCompressionFormatAlias = 1
+	TextureCompressionFormat_PALETTED                               TextureCompressionFormat_TextureCompressionFormatAlias = 2
+	TextureCompressionFormat_THREE_DC                               TextureCompressionFormat_TextureCompressionFormatAlias = 3
+	TextureCompressionFormat_ATC                                    TextureCompressionFormat_TextureCompressionFormatAlias = 4
+	TextureCompressionFormat_LATC                                   TextureCompressionFormat_TextureCompressionFormatAlias = 5
+	TextureCompressionFormat_DXT1                                   TextureCompressionFormat_TextureCompressionFormatAlias = 6
+	TextureCompressionFormat_S3TC                                   TextureCompressionFormat_TextureCompressionFormatAlias = 7
+	TextureCompressionFormat_PVRTC                                  TextureCompressionFormat_TextureCompressionFormatAlias = 8
+	TextureCompressionFormat_ASTC                                   TextureCompressionFormat_TextureCompressionFormatAlias = 9
+	TextureCompressionFormat_ETC2                                   TextureCompressionFormat_TextureCompressionFormatAlias = 10
+)
+
+var TextureCompressionFormat_TextureCompressionFormatAlias_name = map[int32]string{
+	0:  "UNSPECIFIED_TEXTURE_COMPRESSION_FORMAT",
+	1:  "ETC1_RGB8",
+	2:  "PALETTED",
+	3:  "THREE_DC",
+	4:  "ATC",
+	5:  "LATC",
+	6:  "DXT1",
+	7:  "S3TC",
+	8:  "PVRTC",
+	9:  "ASTC",
+	10: "ETC2",
+}
+
+var TextureCompressionFormat_TextureCompressionFormatAlias_value = map[string]int32{
+	"UNSPECIFIED_TEXTURE_COMPRESSION_FORMAT": 0,
+	"ETC1_RGB8":                              1,
+	"PALETTED":                               2,
+	"THREE_DC":                               3,
+	"ATC":                                    4,
+	"LATC":                                   5,
+	"DXT1":                                   6,
+	"S3TC":                                   7,
+	"PVRTC":                                  8,
+	"ASTC":                                   9,
+	"ETC2":                                   10,
+}
+
+func (x TextureCompressionFormat_TextureCompressionFormatAlias) String() string {
+	return proto.EnumName(TextureCompressionFormat_TextureCompressionFormatAlias_name, int32(x))
+}
+
+func (TextureCompressionFormat_TextureCompressionFormatAlias) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{10, 0}
+}
+
+type Abi_AbiAlias int32
+
+const (
+	Abi_UNSPECIFIED_CPU_ARCHITECTURE Abi_AbiAlias = 0
+	Abi_ARMEABI                      Abi_AbiAlias = 1
+	Abi_ARMEABI_V7A                  Abi_AbiAlias = 2
+	Abi_ARM64_V8A                    Abi_AbiAlias = 3
+	Abi_X86                          Abi_AbiAlias = 4
+	Abi_X86_64                       Abi_AbiAlias = 5
+	Abi_MIPS                         Abi_AbiAlias = 6
+	Abi_MIPS64                       Abi_AbiAlias = 7
+)
+
+var Abi_AbiAlias_name = map[int32]string{
+	0: "UNSPECIFIED_CPU_ARCHITECTURE",
+	1: "ARMEABI",
+	2: "ARMEABI_V7A",
+	3: "ARM64_V8A",
+	4: "X86",
+	5: "X86_64",
+	6: "MIPS",
+	7: "MIPS64",
+}
+
+var Abi_AbiAlias_value = map[string]int32{
+	"UNSPECIFIED_CPU_ARCHITECTURE": 0,
+	"ARMEABI":                      1,
+	"ARMEABI_V7A":                  2,
+	"ARM64_V8A":                    3,
+	"X86":                          4,
+	"X86_64":                       5,
+	"MIPS":                         6,
+	"MIPS64":                       7,
+}
+
+func (x Abi_AbiAlias) String() string {
+	return proto.EnumName(Abi_AbiAlias_name, int32(x))
+}
+
+func (Abi_AbiAlias) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{11, 0}
+}
+
+type Sanitizer_SanitizerAlias int32
+
+const (
+	Sanitizer_NONE      Sanitizer_SanitizerAlias = 0
+	Sanitizer_HWADDRESS Sanitizer_SanitizerAlias = 1
+)
+
+var Sanitizer_SanitizerAlias_name = map[int32]string{
+	0: "NONE",
+	1: "HWADDRESS",
+}
+
+var Sanitizer_SanitizerAlias_value = map[string]int32{
+	"NONE":      0,
+	"HWADDRESS": 1,
+}
+
+func (x Sanitizer_SanitizerAlias) String() string {
+	return proto.EnumName(Sanitizer_SanitizerAlias_name, int32(x))
+}
+
+func (Sanitizer_SanitizerAlias) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{13, 0}
+}
+
+// Targeting on the level of variants.
+type VariantTargeting struct {
+	SdkVersionTargeting               *SdkVersionTargeting               `protobuf:"bytes,1,opt,name=sdk_version_targeting,json=sdkVersionTargeting,proto3" json:"sdk_version_targeting,omitempty"`
+	AbiTargeting                      *AbiTargeting                      `protobuf:"bytes,2,opt,name=abi_targeting,json=abiTargeting,proto3" json:"abi_targeting,omitempty"`
+	ScreenDensityTargeting            *ScreenDensityTargeting            `protobuf:"bytes,3,opt,name=screen_density_targeting,json=screenDensityTargeting,proto3" json:"screen_density_targeting,omitempty"`
+	MultiAbiTargeting                 *MultiAbiTargeting                 `protobuf:"bytes,4,opt,name=multi_abi_targeting,json=multiAbiTargeting,proto3" json:"multi_abi_targeting,omitempty"`
+	TextureCompressionFormatTargeting *TextureCompressionFormatTargeting `protobuf:"bytes,5,opt,name=texture_compression_format_targeting,json=textureCompressionFormatTargeting,proto3" json:"texture_compression_format_targeting,omitempty"`
+	XXX_NoUnkeyedLiteral              struct{}                           `json:"-"`
+	XXX_unrecognized                  []byte                             `json:"-"`
+	XXX_sizecache                     int32                              `json:"-"`
+}
+
+func (m *VariantTargeting) Reset()         { *m = VariantTargeting{} }
+func (m *VariantTargeting) String() string { return proto.CompactTextString(m) }
+func (*VariantTargeting) ProtoMessage()    {}
+func (*VariantTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{0}
+}
+
+func (m *VariantTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_VariantTargeting.Unmarshal(m, b)
+}
+func (m *VariantTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_VariantTargeting.Marshal(b, m, deterministic)
+}
+func (m *VariantTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_VariantTargeting.Merge(m, src)
+}
+func (m *VariantTargeting) XXX_Size() int {
+	return xxx_messageInfo_VariantTargeting.Size(m)
+}
+func (m *VariantTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_VariantTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_VariantTargeting proto.InternalMessageInfo
+
+func (m *VariantTargeting) GetSdkVersionTargeting() *SdkVersionTargeting {
+	if m != nil {
+		return m.SdkVersionTargeting
+	}
+	return nil
+}
+
+func (m *VariantTargeting) GetAbiTargeting() *AbiTargeting {
+	if m != nil {
+		return m.AbiTargeting
+	}
+	return nil
+}
+
+func (m *VariantTargeting) GetScreenDensityTargeting() *ScreenDensityTargeting {
+	if m != nil {
+		return m.ScreenDensityTargeting
+	}
+	return nil
+}
+
+func (m *VariantTargeting) GetMultiAbiTargeting() *MultiAbiTargeting {
+	if m != nil {
+		return m.MultiAbiTargeting
+	}
+	return nil
+}
+
+func (m *VariantTargeting) GetTextureCompressionFormatTargeting() *TextureCompressionFormatTargeting {
+	if m != nil {
+		return m.TextureCompressionFormatTargeting
+	}
+	return nil
+}
+
+// Targeting on the level of individual APKs.
+type ApkTargeting struct {
+	AbiTargeting                      *AbiTargeting                      `protobuf:"bytes,1,opt,name=abi_targeting,json=abiTargeting,proto3" json:"abi_targeting,omitempty"`
+	GraphicsApiTargeting              *GraphicsApiTargeting              `protobuf:"bytes,2,opt,name=graphics_api_targeting,json=graphicsApiTargeting,proto3" json:"graphics_api_targeting,omitempty"`
+	LanguageTargeting                 *LanguageTargeting                 `protobuf:"bytes,3,opt,name=language_targeting,json=languageTargeting,proto3" json:"language_targeting,omitempty"`
+	ScreenDensityTargeting            *ScreenDensityTargeting            `protobuf:"bytes,4,opt,name=screen_density_targeting,json=screenDensityTargeting,proto3" json:"screen_density_targeting,omitempty"`
+	SdkVersionTargeting               *SdkVersionTargeting               `protobuf:"bytes,5,opt,name=sdk_version_targeting,json=sdkVersionTargeting,proto3" json:"sdk_version_targeting,omitempty"`
+	TextureCompressionFormatTargeting *TextureCompressionFormatTargeting `protobuf:"bytes,6,opt,name=texture_compression_format_targeting,json=textureCompressionFormatTargeting,proto3" json:"texture_compression_format_targeting,omitempty"`
+	MultiAbiTargeting                 *MultiAbiTargeting                 `protobuf:"bytes,7,opt,name=multi_abi_targeting,json=multiAbiTargeting,proto3" json:"multi_abi_targeting,omitempty"`
+	SanitizerTargeting                *SanitizerTargeting                `protobuf:"bytes,8,opt,name=sanitizer_targeting,json=sanitizerTargeting,proto3" json:"sanitizer_targeting,omitempty"`
+	XXX_NoUnkeyedLiteral              struct{}                           `json:"-"`
+	XXX_unrecognized                  []byte                             `json:"-"`
+	XXX_sizecache                     int32                              `json:"-"`
+}
+
+func (m *ApkTargeting) Reset()         { *m = ApkTargeting{} }
+func (m *ApkTargeting) String() string { return proto.CompactTextString(m) }
+func (*ApkTargeting) ProtoMessage()    {}
+func (*ApkTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{1}
+}
+
+func (m *ApkTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ApkTargeting.Unmarshal(m, b)
+}
+func (m *ApkTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ApkTargeting.Marshal(b, m, deterministic)
+}
+func (m *ApkTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ApkTargeting.Merge(m, src)
+}
+func (m *ApkTargeting) XXX_Size() int {
+	return xxx_messageInfo_ApkTargeting.Size(m)
+}
+func (m *ApkTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_ApkTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApkTargeting proto.InternalMessageInfo
+
+func (m *ApkTargeting) GetAbiTargeting() *AbiTargeting {
+	if m != nil {
+		return m.AbiTargeting
+	}
+	return nil
+}
+
+func (m *ApkTargeting) GetGraphicsApiTargeting() *GraphicsApiTargeting {
+	if m != nil {
+		return m.GraphicsApiTargeting
+	}
+	return nil
+}
+
+func (m *ApkTargeting) GetLanguageTargeting() *LanguageTargeting {
+	if m != nil {
+		return m.LanguageTargeting
+	}
+	return nil
+}
+
+func (m *ApkTargeting) GetScreenDensityTargeting() *ScreenDensityTargeting {
+	if m != nil {
+		return m.ScreenDensityTargeting
+	}
+	return nil
+}
+
+func (m *ApkTargeting) GetSdkVersionTargeting() *SdkVersionTargeting {
+	if m != nil {
+		return m.SdkVersionTargeting
+	}
+	return nil
+}
+
+func (m *ApkTargeting) GetTextureCompressionFormatTargeting() *TextureCompressionFormatTargeting {
+	if m != nil {
+		return m.TextureCompressionFormatTargeting
+	}
+	return nil
+}
+
+func (m *ApkTargeting) GetMultiAbiTargeting() *MultiAbiTargeting {
+	if m != nil {
+		return m.MultiAbiTargeting
+	}
+	return nil
+}
+
+func (m *ApkTargeting) GetSanitizerTargeting() *SanitizerTargeting {
+	if m != nil {
+		return m.SanitizerTargeting
+	}
+	return nil
+}
+
+// Targeting on the module level.
+// The semantic of the targeting is the "AND" rule on all immediate values.
+type ModuleTargeting struct {
+	SdkVersionTargeting    *SdkVersionTargeting      `protobuf:"bytes,1,opt,name=sdk_version_targeting,json=sdkVersionTargeting,proto3" json:"sdk_version_targeting,omitempty"`
+	DeviceFeatureTargeting []*DeviceFeatureTargeting `protobuf:"bytes,2,rep,name=device_feature_targeting,json=deviceFeatureTargeting,proto3" json:"device_feature_targeting,omitempty"`
+	UserCountriesTargeting *UserCountriesTargeting   `protobuf:"bytes,3,opt,name=user_countries_targeting,json=userCountriesTargeting,proto3" json:"user_countries_targeting,omitempty"`
+	XXX_NoUnkeyedLiteral   struct{}                  `json:"-"`
+	XXX_unrecognized       []byte                    `json:"-"`
+	XXX_sizecache          int32                     `json:"-"`
+}
+
+func (m *ModuleTargeting) Reset()         { *m = ModuleTargeting{} }
+func (m *ModuleTargeting) String() string { return proto.CompactTextString(m) }
+func (*ModuleTargeting) ProtoMessage()    {}
+func (*ModuleTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{2}
+}
+
+func (m *ModuleTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ModuleTargeting.Unmarshal(m, b)
+}
+func (m *ModuleTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ModuleTargeting.Marshal(b, m, deterministic)
+}
+func (m *ModuleTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ModuleTargeting.Merge(m, src)
+}
+func (m *ModuleTargeting) XXX_Size() int {
+	return xxx_messageInfo_ModuleTargeting.Size(m)
+}
+func (m *ModuleTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_ModuleTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ModuleTargeting proto.InternalMessageInfo
+
+func (m *ModuleTargeting) GetSdkVersionTargeting() *SdkVersionTargeting {
+	if m != nil {
+		return m.SdkVersionTargeting
+	}
+	return nil
+}
+
+func (m *ModuleTargeting) GetDeviceFeatureTargeting() []*DeviceFeatureTargeting {
+	if m != nil {
+		return m.DeviceFeatureTargeting
+	}
+	return nil
+}
+
+func (m *ModuleTargeting) GetUserCountriesTargeting() *UserCountriesTargeting {
+	if m != nil {
+		return m.UserCountriesTargeting
+	}
+	return nil
+}
+
+// User Countries targeting describing an inclusive/exclusive list of country
+// codes that module targets.
+type UserCountriesTargeting struct {
+	// List of country codes in the two-letter CLDR territory format.
+	CountryCodes []string `protobuf:"bytes,1,rep,name=country_codes,json=countryCodes,proto3" json:"country_codes,omitempty"`
+	// Indicates if the list above is exclusive.
+	Exclude              bool     `protobuf:"varint,2,opt,name=exclude,proto3" json:"exclude,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *UserCountriesTargeting) Reset()         { *m = UserCountriesTargeting{} }
+func (m *UserCountriesTargeting) String() string { return proto.CompactTextString(m) }
+func (*UserCountriesTargeting) ProtoMessage()    {}
+func (*UserCountriesTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{3}
+}
+
+func (m *UserCountriesTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_UserCountriesTargeting.Unmarshal(m, b)
+}
+func (m *UserCountriesTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_UserCountriesTargeting.Marshal(b, m, deterministic)
+}
+func (m *UserCountriesTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_UserCountriesTargeting.Merge(m, src)
+}
+func (m *UserCountriesTargeting) XXX_Size() int {
+	return xxx_messageInfo_UserCountriesTargeting.Size(m)
+}
+func (m *UserCountriesTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_UserCountriesTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_UserCountriesTargeting proto.InternalMessageInfo
+
+func (m *UserCountriesTargeting) GetCountryCodes() []string {
+	if m != nil {
+		return m.CountryCodes
+	}
+	return nil
+}
+
+func (m *UserCountriesTargeting) GetExclude() bool {
+	if m != nil {
+		return m.Exclude
+	}
+	return false
+}
+
+type ScreenDensity struct {
+	// Types that are valid to be assigned to DensityOneof:
+	//	*ScreenDensity_DensityAlias_
+	//	*ScreenDensity_DensityDpi
+	DensityOneof         isScreenDensity_DensityOneof `protobuf_oneof:"density_oneof"`
+	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
+	XXX_unrecognized     []byte                       `json:"-"`
+	XXX_sizecache        int32                        `json:"-"`
+}
+
+func (m *ScreenDensity) Reset()         { *m = ScreenDensity{} }
+func (m *ScreenDensity) String() string { return proto.CompactTextString(m) }
+func (*ScreenDensity) ProtoMessage()    {}
+func (*ScreenDensity) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{4}
+}
+
+func (m *ScreenDensity) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ScreenDensity.Unmarshal(m, b)
+}
+func (m *ScreenDensity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ScreenDensity.Marshal(b, m, deterministic)
+}
+func (m *ScreenDensity) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ScreenDensity.Merge(m, src)
+}
+func (m *ScreenDensity) XXX_Size() int {
+	return xxx_messageInfo_ScreenDensity.Size(m)
+}
+func (m *ScreenDensity) XXX_DiscardUnknown() {
+	xxx_messageInfo_ScreenDensity.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ScreenDensity proto.InternalMessageInfo
+
+type isScreenDensity_DensityOneof interface {
+	isScreenDensity_DensityOneof()
+}
+
+type ScreenDensity_DensityAlias_ struct {
+	DensityAlias ScreenDensity_DensityAlias `protobuf:"varint,1,opt,name=density_alias,json=densityAlias,proto3,enum=android.bundle.ScreenDensity_DensityAlias,oneof"`
+}
+
+type ScreenDensity_DensityDpi struct {
+	DensityDpi int32 `protobuf:"varint,2,opt,name=density_dpi,json=densityDpi,proto3,oneof"`
+}
+
+func (*ScreenDensity_DensityAlias_) isScreenDensity_DensityOneof() {}
+
+func (*ScreenDensity_DensityDpi) isScreenDensity_DensityOneof() {}
+
+func (m *ScreenDensity) GetDensityOneof() isScreenDensity_DensityOneof {
+	if m != nil {
+		return m.DensityOneof
+	}
+	return nil
+}
+
+func (m *ScreenDensity) GetDensityAlias() ScreenDensity_DensityAlias {
+	if x, ok := m.GetDensityOneof().(*ScreenDensity_DensityAlias_); ok {
+		return x.DensityAlias
+	}
+	return ScreenDensity_DENSITY_UNSPECIFIED
+}
+
+func (m *ScreenDensity) GetDensityDpi() int32 {
+	if x, ok := m.GetDensityOneof().(*ScreenDensity_DensityDpi); ok {
+		return x.DensityDpi
+	}
+	return 0
+}
+
+// XXX_OneofWrappers is for the internal use of the proto package.
+func (*ScreenDensity) XXX_OneofWrappers() []interface{} {
+	return []interface{}{
+		(*ScreenDensity_DensityAlias_)(nil),
+		(*ScreenDensity_DensityDpi)(nil),
+	}
+}
+
+// Wrapper message for `int32`.
+//
+// The JSON representation for `Int32Value` is JSON number.
+type Int32Value struct {
+	// The int32 value.
+	Value                int32    `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *Int32Value) Reset()         { *m = Int32Value{} }
+func (m *Int32Value) String() string { return proto.CompactTextString(m) }
+func (*Int32Value) ProtoMessage()    {}
+func (*Int32Value) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{5}
+}
+
+func (m *Int32Value) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Int32Value.Unmarshal(m, b)
+}
+func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic)
+}
+func (m *Int32Value) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Int32Value.Merge(m, src)
+}
+func (m *Int32Value) XXX_Size() int {
+	return xxx_messageInfo_Int32Value.Size(m)
+}
+func (m *Int32Value) XXX_DiscardUnknown() {
+	xxx_messageInfo_Int32Value.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Int32Value proto.InternalMessageInfo
+
+func (m *Int32Value) GetValue() int32 {
+	if m != nil {
+		return m.Value
+	}
+	return 0
+}
+
+type SdkVersion struct {
+	// Inclusive.
+	Min                  *Int32Value `protobuf:"bytes,1,opt,name=min,proto3" json:"min,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
+	XXX_unrecognized     []byte      `json:"-"`
+	XXX_sizecache        int32       `json:"-"`
+}
+
+func (m *SdkVersion) Reset()         { *m = SdkVersion{} }
+func (m *SdkVersion) String() string { return proto.CompactTextString(m) }
+func (*SdkVersion) ProtoMessage()    {}
+func (*SdkVersion) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{6}
+}
+
+func (m *SdkVersion) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SdkVersion.Unmarshal(m, b)
+}
+func (m *SdkVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SdkVersion.Marshal(b, m, deterministic)
+}
+func (m *SdkVersion) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SdkVersion.Merge(m, src)
+}
+func (m *SdkVersion) XXX_Size() int {
+	return xxx_messageInfo_SdkVersion.Size(m)
+}
+func (m *SdkVersion) XXX_DiscardUnknown() {
+	xxx_messageInfo_SdkVersion.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SdkVersion proto.InternalMessageInfo
+
+func (m *SdkVersion) GetMin() *Int32Value {
+	if m != nil {
+		return m.Min
+	}
+	return nil
+}
+
+type GraphicsApi struct {
+	// Types that are valid to be assigned to ApiOneof:
+	//	*GraphicsApi_MinOpenGlVersion
+	//	*GraphicsApi_MinVulkanVersion
+	ApiOneof             isGraphicsApi_ApiOneof `protobuf_oneof:"api_oneof"`
+	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
+	XXX_unrecognized     []byte                 `json:"-"`
+	XXX_sizecache        int32                  `json:"-"`
+}
+
+func (m *GraphicsApi) Reset()         { *m = GraphicsApi{} }
+func (m *GraphicsApi) String() string { return proto.CompactTextString(m) }
+func (*GraphicsApi) ProtoMessage()    {}
+func (*GraphicsApi) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{7}
+}
+
+func (m *GraphicsApi) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_GraphicsApi.Unmarshal(m, b)
+}
+func (m *GraphicsApi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_GraphicsApi.Marshal(b, m, deterministic)
+}
+func (m *GraphicsApi) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_GraphicsApi.Merge(m, src)
+}
+func (m *GraphicsApi) XXX_Size() int {
+	return xxx_messageInfo_GraphicsApi.Size(m)
+}
+func (m *GraphicsApi) XXX_DiscardUnknown() {
+	xxx_messageInfo_GraphicsApi.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_GraphicsApi proto.InternalMessageInfo
+
+type isGraphicsApi_ApiOneof interface {
+	isGraphicsApi_ApiOneof()
+}
+
+type GraphicsApi_MinOpenGlVersion struct {
+	MinOpenGlVersion *OpenGlVersion `protobuf:"bytes,1,opt,name=min_open_gl_version,json=minOpenGlVersion,proto3,oneof"`
+}
+
+type GraphicsApi_MinVulkanVersion struct {
+	MinVulkanVersion *VulkanVersion `protobuf:"bytes,2,opt,name=min_vulkan_version,json=minVulkanVersion,proto3,oneof"`
+}
+
+func (*GraphicsApi_MinOpenGlVersion) isGraphicsApi_ApiOneof() {}
+
+func (*GraphicsApi_MinVulkanVersion) isGraphicsApi_ApiOneof() {}
+
+func (m *GraphicsApi) GetApiOneof() isGraphicsApi_ApiOneof {
+	if m != nil {
+		return m.ApiOneof
+	}
+	return nil
+}
+
+func (m *GraphicsApi) GetMinOpenGlVersion() *OpenGlVersion {
+	if x, ok := m.GetApiOneof().(*GraphicsApi_MinOpenGlVersion); ok {
+		return x.MinOpenGlVersion
+	}
+	return nil
+}
+
+func (m *GraphicsApi) GetMinVulkanVersion() *VulkanVersion {
+	if x, ok := m.GetApiOneof().(*GraphicsApi_MinVulkanVersion); ok {
+		return x.MinVulkanVersion
+	}
+	return nil
+}
+
+// XXX_OneofWrappers is for the internal use of the proto package.
+func (*GraphicsApi) XXX_OneofWrappers() []interface{} {
+	return []interface{}{
+		(*GraphicsApi_MinOpenGlVersion)(nil),
+		(*GraphicsApi_MinVulkanVersion)(nil),
+	}
+}
+
+type VulkanVersion struct {
+	Major                int32    `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
+	Minor                int32    `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *VulkanVersion) Reset()         { *m = VulkanVersion{} }
+func (m *VulkanVersion) String() string { return proto.CompactTextString(m) }
+func (*VulkanVersion) ProtoMessage()    {}
+func (*VulkanVersion) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{8}
+}
+
+func (m *VulkanVersion) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_VulkanVersion.Unmarshal(m, b)
+}
+func (m *VulkanVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_VulkanVersion.Marshal(b, m, deterministic)
+}
+func (m *VulkanVersion) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_VulkanVersion.Merge(m, src)
+}
+func (m *VulkanVersion) XXX_Size() int {
+	return xxx_messageInfo_VulkanVersion.Size(m)
+}
+func (m *VulkanVersion) XXX_DiscardUnknown() {
+	xxx_messageInfo_VulkanVersion.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_VulkanVersion proto.InternalMessageInfo
+
+func (m *VulkanVersion) GetMajor() int32 {
+	if m != nil {
+		return m.Major
+	}
+	return 0
+}
+
+func (m *VulkanVersion) GetMinor() int32 {
+	if m != nil {
+		return m.Minor
+	}
+	return 0
+}
+
+type OpenGlVersion struct {
+	// e.g. OpenGL ES 3.2 is represented as { major: 3, minor: 2 }
+	Major                int32    `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
+	Minor                int32    `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *OpenGlVersion) Reset()         { *m = OpenGlVersion{} }
+func (m *OpenGlVersion) String() string { return proto.CompactTextString(m) }
+func (*OpenGlVersion) ProtoMessage()    {}
+func (*OpenGlVersion) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{9}
+}
+
+func (m *OpenGlVersion) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_OpenGlVersion.Unmarshal(m, b)
+}
+func (m *OpenGlVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_OpenGlVersion.Marshal(b, m, deterministic)
+}
+func (m *OpenGlVersion) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_OpenGlVersion.Merge(m, src)
+}
+func (m *OpenGlVersion) XXX_Size() int {
+	return xxx_messageInfo_OpenGlVersion.Size(m)
+}
+func (m *OpenGlVersion) XXX_DiscardUnknown() {
+	xxx_messageInfo_OpenGlVersion.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_OpenGlVersion proto.InternalMessageInfo
+
+func (m *OpenGlVersion) GetMajor() int32 {
+	if m != nil {
+		return m.Major
+	}
+	return 0
+}
+
+func (m *OpenGlVersion) GetMinor() int32 {
+	if m != nil {
+		return m.Minor
+	}
+	return 0
+}
+
+type TextureCompressionFormat struct {
+	Alias                TextureCompressionFormat_TextureCompressionFormatAlias `protobuf:"varint,1,opt,name=alias,proto3,enum=android.bundle.TextureCompressionFormat_TextureCompressionFormatAlias" json:"alias,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}                                               `json:"-"`
+	XXX_unrecognized     []byte                                                 `json:"-"`
+	XXX_sizecache        int32                                                  `json:"-"`
+}
+
+func (m *TextureCompressionFormat) Reset()         { *m = TextureCompressionFormat{} }
+func (m *TextureCompressionFormat) String() string { return proto.CompactTextString(m) }
+func (*TextureCompressionFormat) ProtoMessage()    {}
+func (*TextureCompressionFormat) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{10}
+}
+
+func (m *TextureCompressionFormat) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_TextureCompressionFormat.Unmarshal(m, b)
+}
+func (m *TextureCompressionFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_TextureCompressionFormat.Marshal(b, m, deterministic)
+}
+func (m *TextureCompressionFormat) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_TextureCompressionFormat.Merge(m, src)
+}
+func (m *TextureCompressionFormat) XXX_Size() int {
+	return xxx_messageInfo_TextureCompressionFormat.Size(m)
+}
+func (m *TextureCompressionFormat) XXX_DiscardUnknown() {
+	xxx_messageInfo_TextureCompressionFormat.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_TextureCompressionFormat proto.InternalMessageInfo
+
+func (m *TextureCompressionFormat) GetAlias() TextureCompressionFormat_TextureCompressionFormatAlias {
+	if m != nil {
+		return m.Alias
+	}
+	return TextureCompressionFormat_UNSPECIFIED_TEXTURE_COMPRESSION_FORMAT
+}
+
+type Abi struct {
+	Alias                Abi_AbiAlias `protobuf:"varint,1,opt,name=alias,proto3,enum=android.bundle.Abi_AbiAlias" json:"alias,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
+	XXX_unrecognized     []byte       `json:"-"`
+	XXX_sizecache        int32        `json:"-"`
+}
+
+func (m *Abi) Reset()         { *m = Abi{} }
+func (m *Abi) String() string { return proto.CompactTextString(m) }
+func (*Abi) ProtoMessage()    {}
+func (*Abi) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{11}
+}
+
+func (m *Abi) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Abi.Unmarshal(m, b)
+}
+func (m *Abi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Abi.Marshal(b, m, deterministic)
+}
+func (m *Abi) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Abi.Merge(m, src)
+}
+func (m *Abi) XXX_Size() int {
+	return xxx_messageInfo_Abi.Size(m)
+}
+func (m *Abi) XXX_DiscardUnknown() {
+	xxx_messageInfo_Abi.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Abi proto.InternalMessageInfo
+
+func (m *Abi) GetAlias() Abi_AbiAlias {
+	if m != nil {
+		return m.Alias
+	}
+	return Abi_UNSPECIFIED_CPU_ARCHITECTURE
+}
+
+type MultiAbi struct {
+	Abi                  []*Abi   `protobuf:"bytes,1,rep,name=abi,proto3" json:"abi,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *MultiAbi) Reset()         { *m = MultiAbi{} }
+func (m *MultiAbi) String() string { return proto.CompactTextString(m) }
+func (*MultiAbi) ProtoMessage()    {}
+func (*MultiAbi) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{12}
+}
+
+func (m *MultiAbi) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_MultiAbi.Unmarshal(m, b)
+}
+func (m *MultiAbi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_MultiAbi.Marshal(b, m, deterministic)
+}
+func (m *MultiAbi) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_MultiAbi.Merge(m, src)
+}
+func (m *MultiAbi) XXX_Size() int {
+	return xxx_messageInfo_MultiAbi.Size(m)
+}
+func (m *MultiAbi) XXX_DiscardUnknown() {
+	xxx_messageInfo_MultiAbi.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MultiAbi proto.InternalMessageInfo
+
+func (m *MultiAbi) GetAbi() []*Abi {
+	if m != nil {
+		return m.Abi
+	}
+	return nil
+}
+
+type Sanitizer struct {
+	Alias                Sanitizer_SanitizerAlias `protobuf:"varint,1,opt,name=alias,proto3,enum=android.bundle.Sanitizer_SanitizerAlias" json:"alias,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}                 `json:"-"`
+	XXX_unrecognized     []byte                   `json:"-"`
+	XXX_sizecache        int32                    `json:"-"`
+}
+
+func (m *Sanitizer) Reset()         { *m = Sanitizer{} }
+func (m *Sanitizer) String() string { return proto.CompactTextString(m) }
+func (*Sanitizer) ProtoMessage()    {}
+func (*Sanitizer) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{13}
+}
+
+func (m *Sanitizer) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Sanitizer.Unmarshal(m, b)
+}
+func (m *Sanitizer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Sanitizer.Marshal(b, m, deterministic)
+}
+func (m *Sanitizer) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Sanitizer.Merge(m, src)
+}
+func (m *Sanitizer) XXX_Size() int {
+	return xxx_messageInfo_Sanitizer.Size(m)
+}
+func (m *Sanitizer) XXX_DiscardUnknown() {
+	xxx_messageInfo_Sanitizer.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Sanitizer proto.InternalMessageInfo
+
+func (m *Sanitizer) GetAlias() Sanitizer_SanitizerAlias {
+	if m != nil {
+		return m.Alias
+	}
+	return Sanitizer_NONE
+}
+
+type DeviceFeature struct {
+	FeatureName string `protobuf:"bytes,1,opt,name=feature_name,json=featureName,proto3" json:"feature_name,omitempty"`
+	// Equivalent of android:glEsVersion or android:version in <uses-feature>.
+	FeatureVersion       int32    `protobuf:"varint,2,opt,name=feature_version,json=featureVersion,proto3" json:"feature_version,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *DeviceFeature) Reset()         { *m = DeviceFeature{} }
+func (m *DeviceFeature) String() string { return proto.CompactTextString(m) }
+func (*DeviceFeature) ProtoMessage()    {}
+func (*DeviceFeature) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{14}
+}
+
+func (m *DeviceFeature) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_DeviceFeature.Unmarshal(m, b)
+}
+func (m *DeviceFeature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_DeviceFeature.Marshal(b, m, deterministic)
+}
+func (m *DeviceFeature) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_DeviceFeature.Merge(m, src)
+}
+func (m *DeviceFeature) XXX_Size() int {
+	return xxx_messageInfo_DeviceFeature.Size(m)
+}
+func (m *DeviceFeature) XXX_DiscardUnknown() {
+	xxx_messageInfo_DeviceFeature.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_DeviceFeature proto.InternalMessageInfo
+
+func (m *DeviceFeature) GetFeatureName() string {
+	if m != nil {
+		return m.FeatureName
+	}
+	return ""
+}
+
+func (m *DeviceFeature) GetFeatureVersion() int32 {
+	if m != nil {
+		return m.FeatureVersion
+	}
+	return 0
+}
+
+// Targeting specific for directories under assets/.
+type AssetsDirectoryTargeting struct {
+	Abi                      *AbiTargeting                      `protobuf:"bytes,1,opt,name=abi,proto3" json:"abi,omitempty"`
+	GraphicsApi              *GraphicsApiTargeting              `protobuf:"bytes,2,opt,name=graphics_api,json=graphicsApi,proto3" json:"graphics_api,omitempty"`
+	TextureCompressionFormat *TextureCompressionFormatTargeting `protobuf:"bytes,3,opt,name=texture_compression_format,json=textureCompressionFormat,proto3" json:"texture_compression_format,omitempty"`
+	Language                 *LanguageTargeting                 `protobuf:"bytes,4,opt,name=language,proto3" json:"language,omitempty"`
+	XXX_NoUnkeyedLiteral     struct{}                           `json:"-"`
+	XXX_unrecognized         []byte                             `json:"-"`
+	XXX_sizecache            int32                              `json:"-"`
+}
+
+func (m *AssetsDirectoryTargeting) Reset()         { *m = AssetsDirectoryTargeting{} }
+func (m *AssetsDirectoryTargeting) String() string { return proto.CompactTextString(m) }
+func (*AssetsDirectoryTargeting) ProtoMessage()    {}
+func (*AssetsDirectoryTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{15}
+}
+
+func (m *AssetsDirectoryTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_AssetsDirectoryTargeting.Unmarshal(m, b)
+}
+func (m *AssetsDirectoryTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_AssetsDirectoryTargeting.Marshal(b, m, deterministic)
+}
+func (m *AssetsDirectoryTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_AssetsDirectoryTargeting.Merge(m, src)
+}
+func (m *AssetsDirectoryTargeting) XXX_Size() int {
+	return xxx_messageInfo_AssetsDirectoryTargeting.Size(m)
+}
+func (m *AssetsDirectoryTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_AssetsDirectoryTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AssetsDirectoryTargeting proto.InternalMessageInfo
+
+func (m *AssetsDirectoryTargeting) GetAbi() *AbiTargeting {
+	if m != nil {
+		return m.Abi
+	}
+	return nil
+}
+
+func (m *AssetsDirectoryTargeting) GetGraphicsApi() *GraphicsApiTargeting {
+	if m != nil {
+		return m.GraphicsApi
+	}
+	return nil
+}
+
+func (m *AssetsDirectoryTargeting) GetTextureCompressionFormat() *TextureCompressionFormatTargeting {
+	if m != nil {
+		return m.TextureCompressionFormat
+	}
+	return nil
+}
+
+func (m *AssetsDirectoryTargeting) GetLanguage() *LanguageTargeting {
+	if m != nil {
+		return m.Language
+	}
+	return nil
+}
+
+// Targeting specific for directories under lib/.
+type NativeDirectoryTargeting struct {
+	Abi                      *Abi                      `protobuf:"bytes,1,opt,name=abi,proto3" json:"abi,omitempty"`
+	GraphicsApi              *GraphicsApi              `protobuf:"bytes,2,opt,name=graphics_api,json=graphicsApi,proto3" json:"graphics_api,omitempty"`
+	TextureCompressionFormat *TextureCompressionFormat `protobuf:"bytes,3,opt,name=texture_compression_format,json=textureCompressionFormat,proto3" json:"texture_compression_format,omitempty"`
+	Sanitizer                *Sanitizer                `protobuf:"bytes,4,opt,name=sanitizer,proto3" json:"sanitizer,omitempty"`
+	XXX_NoUnkeyedLiteral     struct{}                  `json:"-"`
+	XXX_unrecognized         []byte                    `json:"-"`
+	XXX_sizecache            int32                     `json:"-"`
+}
+
+func (m *NativeDirectoryTargeting) Reset()         { *m = NativeDirectoryTargeting{} }
+func (m *NativeDirectoryTargeting) String() string { return proto.CompactTextString(m) }
+func (*NativeDirectoryTargeting) ProtoMessage()    {}
+func (*NativeDirectoryTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{16}
+}
+
+func (m *NativeDirectoryTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_NativeDirectoryTargeting.Unmarshal(m, b)
+}
+func (m *NativeDirectoryTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_NativeDirectoryTargeting.Marshal(b, m, deterministic)
+}
+func (m *NativeDirectoryTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_NativeDirectoryTargeting.Merge(m, src)
+}
+func (m *NativeDirectoryTargeting) XXX_Size() int {
+	return xxx_messageInfo_NativeDirectoryTargeting.Size(m)
+}
+func (m *NativeDirectoryTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_NativeDirectoryTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_NativeDirectoryTargeting proto.InternalMessageInfo
+
+func (m *NativeDirectoryTargeting) GetAbi() *Abi {
+	if m != nil {
+		return m.Abi
+	}
+	return nil
+}
+
+func (m *NativeDirectoryTargeting) GetGraphicsApi() *GraphicsApi {
+	if m != nil {
+		return m.GraphicsApi
+	}
+	return nil
+}
+
+func (m *NativeDirectoryTargeting) GetTextureCompressionFormat() *TextureCompressionFormat {
+	if m != nil {
+		return m.TextureCompressionFormat
+	}
+	return nil
+}
+
+func (m *NativeDirectoryTargeting) GetSanitizer() *Sanitizer {
+	if m != nil {
+		return m.Sanitizer
+	}
+	return nil
+}
+
+// Targeting specific for image files under apex/.
+type ApexImageTargeting struct {
+	MultiAbi             *MultiAbiTargeting `protobuf:"bytes,1,opt,name=multi_abi,json=multiAbi,proto3" json:"multi_abi,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
+	XXX_unrecognized     []byte             `json:"-"`
+	XXX_sizecache        int32              `json:"-"`
+}
+
+func (m *ApexImageTargeting) Reset()         { *m = ApexImageTargeting{} }
+func (m *ApexImageTargeting) String() string { return proto.CompactTextString(m) }
+func (*ApexImageTargeting) ProtoMessage()    {}
+func (*ApexImageTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{17}
+}
+
+func (m *ApexImageTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ApexImageTargeting.Unmarshal(m, b)
+}
+func (m *ApexImageTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ApexImageTargeting.Marshal(b, m, deterministic)
+}
+func (m *ApexImageTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ApexImageTargeting.Merge(m, src)
+}
+func (m *ApexImageTargeting) XXX_Size() int {
+	return xxx_messageInfo_ApexImageTargeting.Size(m)
+}
+func (m *ApexImageTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_ApexImageTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApexImageTargeting proto.InternalMessageInfo
+
+func (m *ApexImageTargeting) GetMultiAbi() *MultiAbiTargeting {
+	if m != nil {
+		return m.MultiAbi
+	}
+	return nil
+}
+
+type AbiTargeting struct {
+	Value []*Abi `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	// Targeting of other sibling directories that were in the Bundle.
+	// For master splits this is targeting of other master splits.
+	Alternatives         []*Abi   `protobuf:"bytes,2,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *AbiTargeting) Reset()         { *m = AbiTargeting{} }
+func (m *AbiTargeting) String() string { return proto.CompactTextString(m) }
+func (*AbiTargeting) ProtoMessage()    {}
+func (*AbiTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{18}
+}
+
+func (m *AbiTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_AbiTargeting.Unmarshal(m, b)
+}
+func (m *AbiTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_AbiTargeting.Marshal(b, m, deterministic)
+}
+func (m *AbiTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_AbiTargeting.Merge(m, src)
+}
+func (m *AbiTargeting) XXX_Size() int {
+	return xxx_messageInfo_AbiTargeting.Size(m)
+}
+func (m *AbiTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_AbiTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AbiTargeting proto.InternalMessageInfo
+
+func (m *AbiTargeting) GetValue() []*Abi {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+func (m *AbiTargeting) GetAlternatives() []*Abi {
+	if m != nil {
+		return m.Alternatives
+	}
+	return nil
+}
+
+type MultiAbiTargeting struct {
+	Value []*MultiAbi `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	// Targeting of other sibling directories that were in the Bundle.
+	// For master splits this is targeting of other master splits.
+	Alternatives         []*MultiAbi `protobuf:"bytes,2,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
+	XXX_unrecognized     []byte      `json:"-"`
+	XXX_sizecache        int32       `json:"-"`
+}
+
+func (m *MultiAbiTargeting) Reset()         { *m = MultiAbiTargeting{} }
+func (m *MultiAbiTargeting) String() string { return proto.CompactTextString(m) }
+func (*MultiAbiTargeting) ProtoMessage()    {}
+func (*MultiAbiTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{19}
+}
+
+func (m *MultiAbiTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_MultiAbiTargeting.Unmarshal(m, b)
+}
+func (m *MultiAbiTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_MultiAbiTargeting.Marshal(b, m, deterministic)
+}
+func (m *MultiAbiTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_MultiAbiTargeting.Merge(m, src)
+}
+func (m *MultiAbiTargeting) XXX_Size() int {
+	return xxx_messageInfo_MultiAbiTargeting.Size(m)
+}
+func (m *MultiAbiTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_MultiAbiTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MultiAbiTargeting proto.InternalMessageInfo
+
+func (m *MultiAbiTargeting) GetValue() []*MultiAbi {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+func (m *MultiAbiTargeting) GetAlternatives() []*MultiAbi {
+	if m != nil {
+		return m.Alternatives
+	}
+	return nil
+}
+
+type ScreenDensityTargeting struct {
+	Value []*ScreenDensity `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	// Targeting of other sibling directories that were in the Bundle.
+	// For master splits this is targeting of other master splits.
+	Alternatives         []*ScreenDensity `protobuf:"bytes,2,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
+	XXX_unrecognized     []byte           `json:"-"`
+	XXX_sizecache        int32            `json:"-"`
+}
+
+func (m *ScreenDensityTargeting) Reset()         { *m = ScreenDensityTargeting{} }
+func (m *ScreenDensityTargeting) String() string { return proto.CompactTextString(m) }
+func (*ScreenDensityTargeting) ProtoMessage()    {}
+func (*ScreenDensityTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{20}
+}
+
+func (m *ScreenDensityTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_ScreenDensityTargeting.Unmarshal(m, b)
+}
+func (m *ScreenDensityTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_ScreenDensityTargeting.Marshal(b, m, deterministic)
+}
+func (m *ScreenDensityTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_ScreenDensityTargeting.Merge(m, src)
+}
+func (m *ScreenDensityTargeting) XXX_Size() int {
+	return xxx_messageInfo_ScreenDensityTargeting.Size(m)
+}
+func (m *ScreenDensityTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_ScreenDensityTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ScreenDensityTargeting proto.InternalMessageInfo
+
+func (m *ScreenDensityTargeting) GetValue() []*ScreenDensity {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+func (m *ScreenDensityTargeting) GetAlternatives() []*ScreenDensity {
+	if m != nil {
+		return m.Alternatives
+	}
+	return nil
+}
+
+type LanguageTargeting struct {
+	// ISO-639: 2 or 3 letter language code.
+	Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	// Targeting of other sibling directories that were in the Bundle.
+	// For master splits this is targeting of other master splits.
+	Alternatives         []string `protobuf:"bytes,2,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *LanguageTargeting) Reset()         { *m = LanguageTargeting{} }
+func (m *LanguageTargeting) String() string { return proto.CompactTextString(m) }
+func (*LanguageTargeting) ProtoMessage()    {}
+func (*LanguageTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{21}
+}
+
+func (m *LanguageTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_LanguageTargeting.Unmarshal(m, b)
+}
+func (m *LanguageTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_LanguageTargeting.Marshal(b, m, deterministic)
+}
+func (m *LanguageTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_LanguageTargeting.Merge(m, src)
+}
+func (m *LanguageTargeting) XXX_Size() int {
+	return xxx_messageInfo_LanguageTargeting.Size(m)
+}
+func (m *LanguageTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_LanguageTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_LanguageTargeting proto.InternalMessageInfo
+
+func (m *LanguageTargeting) GetValue() []string {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+func (m *LanguageTargeting) GetAlternatives() []string {
+	if m != nil {
+		return m.Alternatives
+	}
+	return nil
+}
+
+type GraphicsApiTargeting struct {
+	Value []*GraphicsApi `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	// Targeting of other sibling directories that were in the Bundle.
+	// For master splits this is targeting of other master splits.
+	Alternatives         []*GraphicsApi `protobuf:"bytes,2,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
+	XXX_unrecognized     []byte         `json:"-"`
+	XXX_sizecache        int32          `json:"-"`
+}
+
+func (m *GraphicsApiTargeting) Reset()         { *m = GraphicsApiTargeting{} }
+func (m *GraphicsApiTargeting) String() string { return proto.CompactTextString(m) }
+func (*GraphicsApiTargeting) ProtoMessage()    {}
+func (*GraphicsApiTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{22}
+}
+
+func (m *GraphicsApiTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_GraphicsApiTargeting.Unmarshal(m, b)
+}
+func (m *GraphicsApiTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_GraphicsApiTargeting.Marshal(b, m, deterministic)
+}
+func (m *GraphicsApiTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_GraphicsApiTargeting.Merge(m, src)
+}
+func (m *GraphicsApiTargeting) XXX_Size() int {
+	return xxx_messageInfo_GraphicsApiTargeting.Size(m)
+}
+func (m *GraphicsApiTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_GraphicsApiTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_GraphicsApiTargeting proto.InternalMessageInfo
+
+func (m *GraphicsApiTargeting) GetValue() []*GraphicsApi {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+func (m *GraphicsApiTargeting) GetAlternatives() []*GraphicsApi {
+	if m != nil {
+		return m.Alternatives
+	}
+	return nil
+}
+
+type SdkVersionTargeting struct {
+	Value []*SdkVersion `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	// Targeting of other sibling directories that were in the Bundle.
+	// For master splits this is targeting of other master splits.
+	Alternatives         []*SdkVersion `protobuf:"bytes,2,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
+	XXX_unrecognized     []byte        `json:"-"`
+	XXX_sizecache        int32         `json:"-"`
+}
+
+func (m *SdkVersionTargeting) Reset()         { *m = SdkVersionTargeting{} }
+func (m *SdkVersionTargeting) String() string { return proto.CompactTextString(m) }
+func (*SdkVersionTargeting) ProtoMessage()    {}
+func (*SdkVersionTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{23}
+}
+
+func (m *SdkVersionTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SdkVersionTargeting.Unmarshal(m, b)
+}
+func (m *SdkVersionTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SdkVersionTargeting.Marshal(b, m, deterministic)
+}
+func (m *SdkVersionTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SdkVersionTargeting.Merge(m, src)
+}
+func (m *SdkVersionTargeting) XXX_Size() int {
+	return xxx_messageInfo_SdkVersionTargeting.Size(m)
+}
+func (m *SdkVersionTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_SdkVersionTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SdkVersionTargeting proto.InternalMessageInfo
+
+func (m *SdkVersionTargeting) GetValue() []*SdkVersion {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+func (m *SdkVersionTargeting) GetAlternatives() []*SdkVersion {
+	if m != nil {
+		return m.Alternatives
+	}
+	return nil
+}
+
+type TextureCompressionFormatTargeting struct {
+	Value []*TextureCompressionFormat `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	// Targeting of other sibling directories that were in the Bundle.
+	// For master splits this is targeting of other master splits.
+	Alternatives         []*TextureCompressionFormat `protobuf:"bytes,2,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}                    `json:"-"`
+	XXX_unrecognized     []byte                      `json:"-"`
+	XXX_sizecache        int32                       `json:"-"`
+}
+
+func (m *TextureCompressionFormatTargeting) Reset()         { *m = TextureCompressionFormatTargeting{} }
+func (m *TextureCompressionFormatTargeting) String() string { return proto.CompactTextString(m) }
+func (*TextureCompressionFormatTargeting) ProtoMessage()    {}
+func (*TextureCompressionFormatTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{24}
+}
+
+func (m *TextureCompressionFormatTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_TextureCompressionFormatTargeting.Unmarshal(m, b)
+}
+func (m *TextureCompressionFormatTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_TextureCompressionFormatTargeting.Marshal(b, m, deterministic)
+}
+func (m *TextureCompressionFormatTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_TextureCompressionFormatTargeting.Merge(m, src)
+}
+func (m *TextureCompressionFormatTargeting) XXX_Size() int {
+	return xxx_messageInfo_TextureCompressionFormatTargeting.Size(m)
+}
+func (m *TextureCompressionFormatTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_TextureCompressionFormatTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_TextureCompressionFormatTargeting proto.InternalMessageInfo
+
+func (m *TextureCompressionFormatTargeting) GetValue() []*TextureCompressionFormat {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+func (m *TextureCompressionFormatTargeting) GetAlternatives() []*TextureCompressionFormat {
+	if m != nil {
+		return m.Alternatives
+	}
+	return nil
+}
+
+type SanitizerTargeting struct {
+	Value                []*Sanitizer `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
+	XXX_unrecognized     []byte       `json:"-"`
+	XXX_sizecache        int32        `json:"-"`
+}
+
+func (m *SanitizerTargeting) Reset()         { *m = SanitizerTargeting{} }
+func (m *SanitizerTargeting) String() string { return proto.CompactTextString(m) }
+func (*SanitizerTargeting) ProtoMessage()    {}
+func (*SanitizerTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{25}
+}
+
+func (m *SanitizerTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_SanitizerTargeting.Unmarshal(m, b)
+}
+func (m *SanitizerTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_SanitizerTargeting.Marshal(b, m, deterministic)
+}
+func (m *SanitizerTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_SanitizerTargeting.Merge(m, src)
+}
+func (m *SanitizerTargeting) XXX_Size() int {
+	return xxx_messageInfo_SanitizerTargeting.Size(m)
+}
+func (m *SanitizerTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_SanitizerTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SanitizerTargeting proto.InternalMessageInfo
+
+func (m *SanitizerTargeting) GetValue() []*Sanitizer {
+	if m != nil {
+		return m.Value
+	}
+	return nil
+}
+
+// Since other atom targeting messages have the "OR" semantic on values
+// the DeviceFeatureTargeting represents only one device feature to retain
+// that convention.
+type DeviceFeatureTargeting struct {
+	RequiredFeature      *DeviceFeature `protobuf:"bytes,1,opt,name=required_feature,json=requiredFeature,proto3" json:"required_feature,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
+	XXX_unrecognized     []byte         `json:"-"`
+	XXX_sizecache        int32          `json:"-"`
+}
+
+func (m *DeviceFeatureTargeting) Reset()         { *m = DeviceFeatureTargeting{} }
+func (m *DeviceFeatureTargeting) String() string { return proto.CompactTextString(m) }
+func (*DeviceFeatureTargeting) ProtoMessage()    {}
+func (*DeviceFeatureTargeting) Descriptor() ([]byte, []int) {
+	return fileDescriptor_df45b505afdf471e, []int{26}
+}
+
+func (m *DeviceFeatureTargeting) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_DeviceFeatureTargeting.Unmarshal(m, b)
+}
+func (m *DeviceFeatureTargeting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_DeviceFeatureTargeting.Marshal(b, m, deterministic)
+}
+func (m *DeviceFeatureTargeting) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_DeviceFeatureTargeting.Merge(m, src)
+}
+func (m *DeviceFeatureTargeting) XXX_Size() int {
+	return xxx_messageInfo_DeviceFeatureTargeting.Size(m)
+}
+func (m *DeviceFeatureTargeting) XXX_DiscardUnknown() {
+	xxx_messageInfo_DeviceFeatureTargeting.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_DeviceFeatureTargeting proto.InternalMessageInfo
+
+func (m *DeviceFeatureTargeting) GetRequiredFeature() *DeviceFeature {
+	if m != nil {
+		return m.RequiredFeature
+	}
+	return nil
+}
+
+func init() {
+	proto.RegisterEnum("android.bundle.ScreenDensity_DensityAlias", ScreenDensity_DensityAlias_name, ScreenDensity_DensityAlias_value)
+	proto.RegisterEnum("android.bundle.TextureCompressionFormat_TextureCompressionFormatAlias", TextureCompressionFormat_TextureCompressionFormatAlias_name, TextureCompressionFormat_TextureCompressionFormatAlias_value)
+	proto.RegisterEnum("android.bundle.Abi_AbiAlias", Abi_AbiAlias_name, Abi_AbiAlias_value)
+	proto.RegisterEnum("android.bundle.Sanitizer_SanitizerAlias", Sanitizer_SanitizerAlias_name, Sanitizer_SanitizerAlias_value)
+	proto.RegisterType((*VariantTargeting)(nil), "android.bundle.VariantTargeting")
+	proto.RegisterType((*ApkTargeting)(nil), "android.bundle.ApkTargeting")
+	proto.RegisterType((*ModuleTargeting)(nil), "android.bundle.ModuleTargeting")
+	proto.RegisterType((*UserCountriesTargeting)(nil), "android.bundle.UserCountriesTargeting")
+	proto.RegisterType((*ScreenDensity)(nil), "android.bundle.ScreenDensity")
+	proto.RegisterType((*Int32Value)(nil), "android.bundle.Int32Value")
+	proto.RegisterType((*SdkVersion)(nil), "android.bundle.SdkVersion")
+	proto.RegisterType((*GraphicsApi)(nil), "android.bundle.GraphicsApi")
+	proto.RegisterType((*VulkanVersion)(nil), "android.bundle.VulkanVersion")
+	proto.RegisterType((*OpenGlVersion)(nil), "android.bundle.OpenGlVersion")
+	proto.RegisterType((*TextureCompressionFormat)(nil), "android.bundle.TextureCompressionFormat")
+	proto.RegisterType((*Abi)(nil), "android.bundle.Abi")
+	proto.RegisterType((*MultiAbi)(nil), "android.bundle.MultiAbi")
+	proto.RegisterType((*Sanitizer)(nil), "android.bundle.Sanitizer")
+	proto.RegisterType((*DeviceFeature)(nil), "android.bundle.DeviceFeature")
+	proto.RegisterType((*AssetsDirectoryTargeting)(nil), "android.bundle.AssetsDirectoryTargeting")
+	proto.RegisterType((*NativeDirectoryTargeting)(nil), "android.bundle.NativeDirectoryTargeting")
+	proto.RegisterType((*ApexImageTargeting)(nil), "android.bundle.ApexImageTargeting")
+	proto.RegisterType((*AbiTargeting)(nil), "android.bundle.AbiTargeting")
+	proto.RegisterType((*MultiAbiTargeting)(nil), "android.bundle.MultiAbiTargeting")
+	proto.RegisterType((*ScreenDensityTargeting)(nil), "android.bundle.ScreenDensityTargeting")
+	proto.RegisterType((*LanguageTargeting)(nil), "android.bundle.LanguageTargeting")
+	proto.RegisterType((*GraphicsApiTargeting)(nil), "android.bundle.GraphicsApiTargeting")
+	proto.RegisterType((*SdkVersionTargeting)(nil), "android.bundle.SdkVersionTargeting")
+	proto.RegisterType((*TextureCompressionFormatTargeting)(nil), "android.bundle.TextureCompressionFormatTargeting")
+	proto.RegisterType((*SanitizerTargeting)(nil), "android.bundle.SanitizerTargeting")
+	proto.RegisterType((*DeviceFeatureTargeting)(nil), "android.bundle.DeviceFeatureTargeting")
+}
+
+func init() {
+	proto.RegisterFile("targeting.proto", fileDescriptor_df45b505afdf471e)
+}
+
+var fileDescriptor_df45b505afdf471e = []byte{
+	// 1504 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5b, 0x6f, 0xe3, 0xc4,
+	0x17, 0xaf, 0x93, 0xa6, 0x4d, 0x4e, 0x92, 0xd6, 0x3b, 0xe9, 0xbf, 0xff, 0xb0, 0xec, 0x4a, 0x5b,
+	0xef, 0x85, 0xee, 0x0a, 0x05, 0xda, 0xae, 0xba, 0x15, 0x97, 0x22, 0xd7, 0x71, 0x9b, 0x48, 0x4d,
+	0x9a, 0x75, 0xdc, 0x6c, 0x59, 0x90, 0xbc, 0x4e, 0x3c, 0x0d, 0xa6, 0x89, 0x1d, 0x6c, 0xa7, 0xda,
+	0xe5, 0x05, 0x81, 0x90, 0x90, 0x78, 0xe2, 0x8d, 0x77, 0x3e, 0x00, 0x12,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d2, 0x9b, 0x2b, 0x74, 0x69, 0x97, 0x6a, 0x70, 0x6d, 0xaa,
+	0x49, 0xc2, 0xd3, 0x0e, 0x19, 0x26, 0x7d, 0x6b, 0x5c, 0x84, 0xb5, 0xcc, 0x04, 0xdc, 0xb7, 0x0c,
+	0xac, 0x45, 0x1d, 0x15, 0x68, 0x8b, 0x8e, 0x6f, 0x66, 0x8b, 0xf8, 0xf6, 0x3e, 0x88, 0x8c, 0x6e,
+	0xa6, 0x26, 0xed, 0xcc, 0x37, 0x0c, 0x14, 0x22, 0x9e, 0x09, 0xe8, 0x6d, 0xda, 0x97, 0xeb, 0xf1,
+	0x4f, 0x8b, 0xc0, 0x95, 0xfd, 0x48, 0x57, 0x66, 0x29, 0xd2, 0x9e, 0xfc, 0xc4, 0xc0, 0xc6, 0x95,
+	0x47, 0x1d, 0xb9, 0x9f, 0xc2, 0x7e, 0xcd, 0xdf, 0xf8, 0xbe, 0x97, 0xc7, 0x91, 0x5e, 0xce, 0x0f,
+	0x43, 0xfb, 0x2c, 0x02, 0x9a, 0x7e, 0xce, 0xa1, 0xb7, 0x68, 0x1f, 0x67, 0x9c, 0x22, 0xfe, 0x8c,
+	0xdc, 0x86, 0xf5, 0xe8, 0xe7, 0x14, 0xaa, 0x00, 0x6b, 0xe1, 0xcf, 0x86, 0xba, 0x85, 0xb5, 0xe0,
+	0x69, 0x16, 0x37, 0xee, 0x52, 0x08, 0xd2, 0x6a, 0xa0, 0xe6, 0x33, 0x0e, 0x1e, 0x00, 0xea, 0x98,
+	0xfd, 0x09, 0xa5, 0xa7, 0x6b, 0xfe, 0x5a, 0xf1, 0xd6, 0x8a, 0xfb, 0x0f, 0xb6, 0xf6, 0x92, 0xfb,
+	0xb3, 0xf3, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x47, 0xe0, 0x85, 0xa8, 0x7a, 0x13, 0x00, 0x00,
+}
diff --git a/cmd/extract_apks/bundle_proto/targeting.proto b/cmd/extract_apks/bundle_proto/targeting.proto
new file mode 100644
index 0000000..cdc910b
--- /dev/null
+++ b/cmd/extract_apks/bundle_proto/targeting.proto
@@ -0,0 +1,232 @@
+// Messages describing APK Set's table of contents (toc.pb entry).
+// Please be advised that the ultimate source is at
+// https://github.com/google/bundletool/tree/master/src/main/proto
+// so you have been warned.
+syntax = "proto3";
+
+package android.bundle;
+
+option go_package = "android_bundle_proto";
+option java_package = "com.android.bundle";
+
+// Targeting on the level of variants.
+message VariantTargeting {
+  SdkVersionTargeting sdk_version_targeting = 1;
+  AbiTargeting abi_targeting = 2;
+  ScreenDensityTargeting screen_density_targeting = 3;
+  MultiAbiTargeting multi_abi_targeting = 4;
+  TextureCompressionFormatTargeting texture_compression_format_targeting = 5;
+}
+
+// Targeting on the level of individual APKs.
+message ApkTargeting {
+  AbiTargeting abi_targeting = 1;
+  GraphicsApiTargeting graphics_api_targeting = 2;
+  LanguageTargeting language_targeting = 3;
+  ScreenDensityTargeting screen_density_targeting = 4;
+  SdkVersionTargeting sdk_version_targeting = 5;
+  TextureCompressionFormatTargeting texture_compression_format_targeting = 6;
+  MultiAbiTargeting multi_abi_targeting = 7;
+  SanitizerTargeting sanitizer_targeting = 8;
+}
+
+// Targeting on the module level.
+// The semantic of the targeting is the "AND" rule on all immediate values.
+message ModuleTargeting {
+  SdkVersionTargeting sdk_version_targeting = 1;
+  repeated DeviceFeatureTargeting device_feature_targeting = 2;
+  UserCountriesTargeting user_countries_targeting = 3;
+}
+
+// User Countries targeting describing an inclusive/exclusive list of country
+// codes that module targets.
+message UserCountriesTargeting {
+  // List of country codes in the two-letter CLDR territory format.
+  repeated string country_codes = 1;
+
+  // Indicates if the list above is exclusive.
+  bool exclude = 2;
+}
+
+message ScreenDensity {
+  enum DensityAlias {
+    DENSITY_UNSPECIFIED = 0;
+    NODPI = 1;
+    LDPI = 2;
+    MDPI = 3;
+    TVDPI = 4;
+    HDPI = 5;
+    XHDPI = 6;
+    XXHDPI = 7;
+    XXXHDPI = 8;
+  }
+
+  oneof density_oneof {
+    DensityAlias density_alias = 1;
+    int32 density_dpi = 2;
+  }
+}
+
+// Wrapper message for `int32`.
+//
+// The JSON representation for `Int32Value` is JSON number.
+message Int32Value {
+  // The int32 value.
+  int32 value = 1;
+}
+
+message SdkVersion {
+  // Inclusive.
+  Int32Value min = 1;
+}
+
+message GraphicsApi {
+  oneof api_oneof {
+    // Inclusive.
+    OpenGlVersion min_open_gl_version = 1;
+    // Inclusive.
+    VulkanVersion min_vulkan_version = 2;
+  }
+}
+
+message VulkanVersion {
+  int32 major = 1;  // VK_VERSION_MAJOR
+  int32 minor = 2;  // VK_VERSION_MINOR
+}
+
+message OpenGlVersion {
+  // e.g. OpenGL ES 3.2 is represented as { major: 3, minor: 2 }
+  int32 major = 1;  // GL_MAJOR_VERSION
+  int32 minor = 2;  // GL_MINOR_VERSION
+}
+
+message TextureCompressionFormat {
+  enum TextureCompressionFormatAlias {
+    UNSPECIFIED_TEXTURE_COMPRESSION_FORMAT = 0;
+    ETC1_RGB8 = 1;
+    PALETTED = 2;
+    THREE_DC = 3;
+    ATC = 4;
+    LATC = 5;
+    DXT1 = 6;
+    S3TC = 7;
+    PVRTC = 8;
+    ASTC = 9;
+    ETC2 = 10;
+  }
+  TextureCompressionFormatAlias alias = 1;
+}
+
+message Abi {
+  enum AbiAlias {
+    UNSPECIFIED_CPU_ARCHITECTURE = 0;
+    ARMEABI = 1;
+    ARMEABI_V7A = 2;
+    ARM64_V8A = 3;
+    X86 = 4;
+    X86_64 = 5;
+    MIPS = 6;
+    MIPS64 = 7;
+  }
+  AbiAlias alias = 1;
+}
+
+message MultiAbi {
+  repeated Abi abi = 1;
+}
+
+message Sanitizer {
+  enum SanitizerAlias {
+    NONE = 0;
+    HWADDRESS = 1;
+  }
+  SanitizerAlias alias = 1;
+}
+
+message DeviceFeature {
+  string feature_name = 1;
+  // Equivalent of android:glEsVersion or android:version in <uses-feature>.
+  int32 feature_version = 2;
+}
+
+// Targeting specific for directories under assets/.
+message AssetsDirectoryTargeting {
+  AbiTargeting abi = 1;
+  GraphicsApiTargeting graphics_api = 2;
+  TextureCompressionFormatTargeting texture_compression_format = 3;
+  LanguageTargeting language = 4;
+}
+
+// Targeting specific for directories under lib/.
+message NativeDirectoryTargeting {
+  Abi abi = 1;
+  GraphicsApi graphics_api = 2;
+  TextureCompressionFormat texture_compression_format = 3;
+  Sanitizer sanitizer = 4;
+}
+
+// Targeting specific for image files under apex/.
+message ApexImageTargeting {
+  MultiAbiTargeting multi_abi = 1;
+}
+
+message AbiTargeting {
+  repeated Abi value = 1;
+  // Targeting of other sibling directories that were in the Bundle.
+  // For master splits this is targeting of other master splits.
+  repeated Abi alternatives = 2;
+}
+
+message MultiAbiTargeting {
+  repeated MultiAbi value = 1;
+  // Targeting of other sibling directories that were in the Bundle.
+  // For master splits this is targeting of other master splits.
+  repeated MultiAbi alternatives = 2;
+}
+
+message ScreenDensityTargeting {
+  repeated ScreenDensity value = 1;
+  // Targeting of other sibling directories that were in the Bundle.
+  // For master splits this is targeting of other master splits.
+  repeated ScreenDensity alternatives = 2;
+}
+
+message LanguageTargeting {
+  // ISO-639: 2 or 3 letter language code.
+  repeated string value = 1;
+  // Targeting of other sibling directories that were in the Bundle.
+  // For master splits this is targeting of other master splits.
+  repeated string alternatives = 2;
+}
+
+message GraphicsApiTargeting {
+  repeated GraphicsApi value = 1;
+  // Targeting of other sibling directories that were in the Bundle.
+  // For master splits this is targeting of other master splits.
+  repeated GraphicsApi alternatives = 2;
+}
+
+message SdkVersionTargeting {
+  repeated SdkVersion value = 1;
+  // Targeting of other sibling directories that were in the Bundle.
+  // For master splits this is targeting of other master splits.
+  repeated SdkVersion alternatives = 2;
+}
+
+message TextureCompressionFormatTargeting {
+  repeated TextureCompressionFormat value = 1;
+  // Targeting of other sibling directories that were in the Bundle.
+  // For master splits this is targeting of other master splits.
+  repeated TextureCompressionFormat alternatives = 2;
+}
+
+message SanitizerTargeting {
+  repeated Sanitizer value = 1;
+}
+
+// Since other atom targeting messages have the "OR" semantic on values
+// the DeviceFeatureTargeting represents only one device feature to retain
+// that convention.
+message DeviceFeatureTargeting {
+  DeviceFeature required_feature = 1;
+}
diff --git a/cmd/extract_apks/main.go b/cmd/extract_apks/main.go
new file mode 100644
index 0000000..a638db2
--- /dev/null
+++ b/cmd/extract_apks/main.go
@@ -0,0 +1,540 @@
+// Copyright 2020 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.
+
+// Copies all the entries (APKs/APEXes) matching the target configuration from the given
+// APK set into a zip file. Run it without arguments to see usage details.
+package main
+
+import (
+	"flag"
+	"fmt"
+	"io"
+	"log"
+	"math"
+	"os"
+	"regexp"
+	"strings"
+
+	"github.com/golang/protobuf/proto"
+
+	"android/soong/cmd/extract_apks/bundle_proto"
+	"android/soong/third_party/zip"
+)
+
+type TargetConfig struct {
+	sdkVersion int32
+	screenDpi  map[android_bundle_proto.ScreenDensity_DensityAlias]bool
+	// Map holding <ABI alias>:<its sequence number in the flag> info.
+	abis             map[android_bundle_proto.Abi_AbiAlias]int
+	allowPrereleased bool
+	stem             string
+}
+
+// An APK set is a zip archive. An entry 'toc.pb' describes its contents.
+// It is a protobuf message BuildApkResult.
+type Toc *android_bundle_proto.BuildApksResult
+
+type ApkSet struct {
+	path    string
+	reader  *zip.ReadCloser
+	entries map[string]*zip.File
+}
+
+func newApkSet(path string) (*ApkSet, error) {
+	apkSet := &ApkSet{path: path, entries: make(map[string]*zip.File)}
+	var err error
+	if apkSet.reader, err = zip.OpenReader(apkSet.path); err != nil {
+		return nil, err
+	}
+	for _, f := range apkSet.reader.File {
+		apkSet.entries[f.Name] = f
+	}
+	return apkSet, nil
+}
+
+func (apkSet *ApkSet) getToc() (Toc, error) {
+	var err error
+	tocFile, ok := apkSet.entries["toc.pb"]
+	if !ok {
+		return nil, fmt.Errorf("%s: APK set should have toc.pb entry", apkSet.path)
+	}
+	rc, err := tocFile.Open()
+	if err != nil {
+		return nil, err
+	}
+	bytes := make([]byte, tocFile.FileHeader.UncompressedSize64)
+	if _, err := rc.Read(bytes); err != io.EOF {
+		return nil, err
+	}
+	rc.Close()
+	buildApksResult := new(android_bundle_proto.BuildApksResult)
+	if err = proto.Unmarshal(bytes, buildApksResult); err != nil {
+		return nil, err
+	}
+	return buildApksResult, nil
+}
+
+func (apkSet *ApkSet) close() {
+	apkSet.reader.Close()
+}
+
+// Matchers for selection criteria
+
+type abiTargetingMatcher struct {
+	*android_bundle_proto.AbiTargeting
+}
+
+func (m abiTargetingMatcher) matches(config TargetConfig) bool {
+	if m.AbiTargeting == nil {
+		return true
+	}
+	if _, ok := config.abis[android_bundle_proto.Abi_UNSPECIFIED_CPU_ARCHITECTURE]; ok {
+		return true
+	}
+	// Find the one that appears first in the abis flags.
+	abiIdx := math.MaxInt32
+	for _, v := range m.GetValue() {
+		if i, ok := config.abis[v.Alias]; ok {
+			if i < abiIdx {
+				abiIdx = i
+			}
+		}
+	}
+	if abiIdx == math.MaxInt32 {
+		return false
+	}
+	// See if any alternatives appear before the above one.
+	for _, a := range m.GetAlternatives() {
+		if i, ok := config.abis[a.Alias]; ok {
+			if i < abiIdx {
+				// There is a better alternative. Skip this one.
+				return false
+			}
+		}
+	}
+	return true
+}
+
+type apkDescriptionMatcher struct {
+	*android_bundle_proto.ApkDescription
+}
+
+func (m apkDescriptionMatcher) matches(config TargetConfig) bool {
+	return m.ApkDescription == nil || (apkTargetingMatcher{m.Targeting}).matches(config)
+}
+
+type apkTargetingMatcher struct {
+	*android_bundle_proto.ApkTargeting
+}
+
+func (m apkTargetingMatcher) matches(config TargetConfig) bool {
+	return m.ApkTargeting == nil ||
+		(abiTargetingMatcher{m.AbiTargeting}.matches(config) &&
+			languageTargetingMatcher{m.LanguageTargeting}.matches(config) &&
+			screenDensityTargetingMatcher{m.ScreenDensityTargeting}.matches(config) &&
+			sdkVersionTargetingMatcher{m.SdkVersionTargeting}.matches(config) &&
+			multiAbiTargetingMatcher{m.MultiAbiTargeting}.matches(config))
+}
+
+type languageTargetingMatcher struct {
+	*android_bundle_proto.LanguageTargeting
+}
+
+func (m languageTargetingMatcher) matches(_ TargetConfig) bool {
+	if m.LanguageTargeting == nil {
+		return true
+	}
+	log.Fatal("language based entry selection is not implemented")
+	return false
+}
+
+type moduleMetadataMatcher struct {
+	*android_bundle_proto.ModuleMetadata
+}
+
+func (m moduleMetadataMatcher) matches(config TargetConfig) bool {
+	return m.ModuleMetadata == nil ||
+		(m.GetDeliveryType() == android_bundle_proto.DeliveryType_INSTALL_TIME &&
+			moduleTargetingMatcher{m.Targeting}.matches(config) &&
+			!m.IsInstant)
+}
+
+type moduleTargetingMatcher struct {
+	*android_bundle_proto.ModuleTargeting
+}
+
+func (m moduleTargetingMatcher) matches(config TargetConfig) bool {
+	return m.ModuleTargeting == nil ||
+		(sdkVersionTargetingMatcher{m.SdkVersionTargeting}.matches(config) &&
+			userCountriesTargetingMatcher{m.UserCountriesTargeting}.matches(config))
+}
+
+// A higher number means a higher priority.
+// This order must be kept identical to bundletool's.
+var multiAbiPriorities = map[android_bundle_proto.Abi_AbiAlias]int{
+	android_bundle_proto.Abi_ARMEABI:     1,
+	android_bundle_proto.Abi_ARMEABI_V7A: 2,
+	android_bundle_proto.Abi_ARM64_V8A:   3,
+	android_bundle_proto.Abi_X86:         4,
+	android_bundle_proto.Abi_X86_64:      5,
+	android_bundle_proto.Abi_MIPS:        6,
+	android_bundle_proto.Abi_MIPS64:      7,
+}
+
+type multiAbiTargetingMatcher struct {
+	*android_bundle_proto.MultiAbiTargeting
+}
+
+func (t multiAbiTargetingMatcher) matches(config TargetConfig) bool {
+	if t.MultiAbiTargeting == nil {
+		return true
+	}
+	if _, ok := config.abis[android_bundle_proto.Abi_UNSPECIFIED_CPU_ARCHITECTURE]; ok {
+		return true
+	}
+	// Find the one with the highest priority.
+	highestPriority := 0
+	for _, v := range t.GetValue() {
+		for _, a := range v.GetAbi() {
+			if _, ok := config.abis[a.Alias]; ok {
+				if highestPriority < multiAbiPriorities[a.Alias] {
+					highestPriority = multiAbiPriorities[a.Alias]
+				}
+			}
+		}
+	}
+	if highestPriority == 0 {
+		return false
+	}
+	// See if there are any matching alternatives with a higher priority.
+	for _, v := range t.GetAlternatives() {
+		for _, a := range v.GetAbi() {
+			if _, ok := config.abis[a.Alias]; ok {
+				if highestPriority < multiAbiPriorities[a.Alias] {
+					// There's a better one. Skip this one.
+					return false
+				}
+			}
+		}
+	}
+	return true
+}
+
+type screenDensityTargetingMatcher struct {
+	*android_bundle_proto.ScreenDensityTargeting
+}
+
+func (m screenDensityTargetingMatcher) matches(config TargetConfig) bool {
+	if m.ScreenDensityTargeting == nil {
+		return true
+	}
+	if _, ok := config.screenDpi[android_bundle_proto.ScreenDensity_DENSITY_UNSPECIFIED]; ok {
+		return true
+	}
+	for _, v := range m.GetValue() {
+		switch x := v.GetDensityOneof().(type) {
+		case *android_bundle_proto.ScreenDensity_DensityAlias_:
+			if _, ok := config.screenDpi[x.DensityAlias]; ok {
+				return true
+			}
+		default:
+			log.Fatal("For screen density, only DPI name based entry selection (e.g. HDPI, XHDPI) is implemented")
+		}
+	}
+	return false
+}
+
+type sdkVersionTargetingMatcher struct {
+	*android_bundle_proto.SdkVersionTargeting
+}
+
+func (m sdkVersionTargetingMatcher) matches(config TargetConfig) bool {
+	const preReleaseVersion = 10000
+	if m.SdkVersionTargeting == nil {
+		return true
+	}
+	if len(m.Value) > 1 {
+		log.Fatal(fmt.Sprintf("sdk_version_targeting should not have multiple values:%#v", m.Value))
+	}
+	// Inspect only sdkVersionTargeting.Value.
+	// Even though one of the SdkVersionTargeting.Alternatives values may be
+	// better matching, we will select all of them
+	return m.Value[0].Min == nil ||
+		m.Value[0].Min.Value <= config.sdkVersion ||
+		(config.allowPrereleased && m.Value[0].Min.Value == preReleaseVersion)
+}
+
+type textureCompressionFormatTargetingMatcher struct {
+	*android_bundle_proto.TextureCompressionFormatTargeting
+}
+
+func (m textureCompressionFormatTargetingMatcher) matches(_ TargetConfig) bool {
+	if m.TextureCompressionFormatTargeting == nil {
+		return true
+	}
+	log.Fatal("texture based entry selection is not implemented")
+	return false
+}
+
+type userCountriesTargetingMatcher struct {
+	*android_bundle_proto.UserCountriesTargeting
+}
+
+func (m userCountriesTargetingMatcher) matches(_ TargetConfig) bool {
+	if m.UserCountriesTargeting == nil {
+		return true
+	}
+	log.Fatal("country based entry selection is not implemented")
+	return false
+}
+
+type variantTargetingMatcher struct {
+	*android_bundle_proto.VariantTargeting
+}
+
+func (m variantTargetingMatcher) matches(config TargetConfig) bool {
+	if m.VariantTargeting == nil {
+		return true
+	}
+	return sdkVersionTargetingMatcher{m.SdkVersionTargeting}.matches(config) &&
+		abiTargetingMatcher{m.AbiTargeting}.matches(config) &&
+		multiAbiTargetingMatcher{m.MultiAbiTargeting}.matches(config) &&
+		screenDensityTargetingMatcher{m.ScreenDensityTargeting}.matches(config) &&
+		textureCompressionFormatTargetingMatcher{m.TextureCompressionFormatTargeting}.matches(config)
+}
+
+type SelectionResult struct {
+	moduleName string
+	entries    []string
+}
+
+// Return all entries matching target configuration
+func selectApks(toc Toc, targetConfig TargetConfig) SelectionResult {
+	var result SelectionResult
+	for _, variant := range (*toc).GetVariant() {
+		if !(variantTargetingMatcher{variant.GetTargeting()}.matches(targetConfig)) {
+			continue
+		}
+		for _, as := range variant.GetApkSet() {
+			if !(moduleMetadataMatcher{as.ModuleMetadata}.matches(targetConfig)) {
+				continue
+			}
+			for _, apkdesc := range as.GetApkDescription() {
+				if (apkDescriptionMatcher{apkdesc}).matches(targetConfig) {
+					result.entries = append(result.entries, apkdesc.GetPath())
+					// TODO(asmundak): As it turns out, moduleName which we get from
+					// the ModuleMetadata matches the module names of the generated
+					// entry paths just by coincidence, only for the split APKs. We
+					// need to discuss this with bundletool folks.
+					result.moduleName = as.GetModuleMetadata().GetName()
+				}
+			}
+			// we allow only a single module, so bail out here if we found one
+			if result.moduleName != "" {
+				return result
+			}
+		}
+	}
+	return result
+}
+
+type Zip2ZipWriter interface {
+	CopyFrom(file *zip.File, name string) error
+}
+
+// Writes out selected entries, renaming them as needed
+func (apkSet *ApkSet) writeApks(selected SelectionResult, config TargetConfig,
+	writer Zip2ZipWriter) error {
+	// Renaming rules:
+	//  splits/MODULE-master.apk to STEM.apk
+	// else
+	//  splits/MODULE-*.apk to STEM>-$1.apk
+	// TODO(asmundak):
+	//  add more rules, for .apex files
+	renameRules := []struct {
+		rex  *regexp.Regexp
+		repl string
+	}{
+		{
+			regexp.MustCompile(`^.*/` + selected.moduleName + `-master\.apk$`),
+			config.stem + `.apk`,
+		},
+		{
+			regexp.MustCompile(`^.*/` + selected.moduleName + `(-.*\.apk)$`),
+			config.stem + `$1`,
+		},
+	}
+	renamer := func(path string) (string, bool) {
+		for _, rr := range renameRules {
+			if rr.rex.MatchString(path) {
+				return rr.rex.ReplaceAllString(path, rr.repl), true
+			}
+		}
+		return "", false
+	}
+
+	entryOrigin := make(map[string]string) // output entry to input entry
+	for _, apk := range selected.entries {
+		apkFile, ok := apkSet.entries[apk]
+		if !ok {
+			return fmt.Errorf("TOC refers to an entry %s which does not exist", apk)
+		}
+		inName := apkFile.Name
+		outName, ok := renamer(inName)
+		if !ok {
+			log.Fatalf("selected an entry with unexpected name %s", inName)
+		}
+		if origin, ok := entryOrigin[inName]; ok {
+			log.Fatalf("selected entries %s and %s will have the same output name %s",
+				origin, inName, outName)
+		}
+		entryOrigin[outName] = inName
+		if err := writer.CopyFrom(apkFile, outName); err != nil {
+			return err
+		}
+	}
+	return nil
+}
+
+func (apkSet *ApkSet) extractAndCopySingle(selected SelectionResult, outFile *os.File) error {
+	if len(selected.entries) != 1 {
+		return fmt.Errorf("Too many matching entries for extract-single:\n%v", selected.entries)
+	}
+	apk, ok := apkSet.entries[selected.entries[0]]
+	if !ok {
+		return fmt.Errorf("Couldn't find apk path %s", selected.entries[0])
+	}
+	inputReader, _ := apk.Open()
+	_, err := io.Copy(outFile, inputReader)
+	return err
+}
+
+// Arguments parsing
+var (
+	outputFile   = flag.String("o", "", "output file containing extracted entries")
+	targetConfig = TargetConfig{
+		screenDpi: map[android_bundle_proto.ScreenDensity_DensityAlias]bool{},
+		abis:      map[android_bundle_proto.Abi_AbiAlias]int{},
+	}
+	extractSingle = flag.Bool("extract-single", false,
+		"extract a single target and output it uncompressed. only available for standalone apks and apexes.")
+)
+
+// Parse abi values
+type abiFlagValue struct {
+	targetConfig *TargetConfig
+}
+
+func (a abiFlagValue) String() string {
+	return "all"
+}
+
+func (a abiFlagValue) Set(abiList string) error {
+	for i, abi := range strings.Split(abiList, ",") {
+		v, ok := android_bundle_proto.Abi_AbiAlias_value[abi]
+		if !ok {
+			return fmt.Errorf("bad ABI value: %q", abi)
+		}
+		targetConfig.abis[android_bundle_proto.Abi_AbiAlias(v)] = i
+	}
+	return nil
+}
+
+// Parse screen density values
+type screenDensityFlagValue struct {
+	targetConfig *TargetConfig
+}
+
+func (s screenDensityFlagValue) String() string {
+	return "none"
+}
+
+func (s screenDensityFlagValue) Set(densityList string) error {
+	if densityList == "none" {
+		return nil
+	}
+	if densityList == "all" {
+		targetConfig.screenDpi[android_bundle_proto.ScreenDensity_DENSITY_UNSPECIFIED] = true
+		return nil
+	}
+	for _, density := range strings.Split(densityList, ",") {
+		v, found := android_bundle_proto.ScreenDensity_DensityAlias_value[density]
+		if !found {
+			return fmt.Errorf("bad screen density value: %q", density)
+		}
+		targetConfig.screenDpi[android_bundle_proto.ScreenDensity_DensityAlias(v)] = true
+	}
+	return nil
+}
+
+func processArgs() {
+	flag.Usage = func() {
+		fmt.Fprintln(os.Stderr, `usage: extract_apks -o <output-file> -sdk-version value -abis value `+
+			`-screen-densities value {-stem value | -extract-single} [-allow-prereleased] <APK set>`)
+		flag.PrintDefaults()
+		os.Exit(2)
+	}
+	version := flag.Uint("sdk-version", 0, "SDK version")
+	flag.Var(abiFlagValue{&targetConfig}, "abis",
+		"comma-separated ABIs list of ARMEABI ARMEABI_V7A ARM64_V8A X86 X86_64 MIPS MIPS64")
+	flag.Var(screenDensityFlagValue{&targetConfig}, "screen-densities",
+		"'all' or comma-separated list of screen density names (NODPI LDPI MDPI TVDPI HDPI XHDPI XXHDPI XXXHDPI)")
+	flag.BoolVar(&targetConfig.allowPrereleased, "allow-prereleased", false,
+		"allow prereleased")
+	flag.StringVar(&targetConfig.stem, "stem", "", "output entries base name in the output zip file")
+	flag.Parse()
+	if (*outputFile == "") || len(flag.Args()) != 1 || *version == 0 || (targetConfig.stem == "" && !*extractSingle) {
+		flag.Usage()
+	}
+	targetConfig.sdkVersion = int32(*version)
+
+}
+
+func main() {
+	processArgs()
+	var toc Toc
+	apkSet, err := newApkSet(flag.Arg(0))
+	if err == nil {
+		defer apkSet.close()
+		toc, err = apkSet.getToc()
+	}
+	if err != nil {
+		log.Fatal(err)
+	}
+	sel := selectApks(toc, targetConfig)
+	if len(sel.entries) == 0 {
+		log.Fatalf("there are no entries for the target configuration: %#v", targetConfig)
+	}
+
+	outFile, err := os.Create(*outputFile)
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer outFile.Close()
+
+	if *extractSingle {
+		err = apkSet.extractAndCopySingle(sel, outFile)
+	} else {
+		writer := zip.NewWriter(outFile)
+		defer func() {
+			if err := writer.Close(); err != nil {
+				log.Fatal(err)
+			}
+		}()
+		err = apkSet.writeApks(sel, targetConfig, writer)
+	}
+	if err != nil {
+		log.Fatal(err)
+	}
+}
diff --git a/cmd/extract_apks/main_test.go b/cmd/extract_apks/main_test.go
new file mode 100644
index 0000000..bc4d377
--- /dev/null
+++ b/cmd/extract_apks/main_test.go
@@ -0,0 +1,429 @@
+// Copyright 2020 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 main
+
+import (
+	"fmt"
+	"github.com/golang/protobuf/proto"
+	"reflect"
+	"testing"
+
+	bp "android/soong/cmd/extract_apks/bundle_proto"
+	"android/soong/third_party/zip"
+)
+
+type TestConfigDesc struct {
+	name         string
+	targetConfig TargetConfig
+	expected     SelectionResult
+}
+
+type TestDesc struct {
+	protoText string
+	configs   []TestConfigDesc
+}
+
+func TestSelectApks_ApkSet(t *testing.T) {
+	testCases := []TestDesc{
+		{
+			protoText: `
+variant {
+  targeting {
+    sdk_version_targeting {
+      value { min { value: 29 } } } }
+  apk_set {
+    module_metadata {
+      name: "base" targeting {} delivery_type: INSTALL_TIME }
+    apk_description {
+      targeting {
+        screen_density_targeting {
+          value { density_alias: LDPI } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-ldpi.apk"
+      split_apk_metadata { split_id: "config.ldpi" } }
+    apk_description {
+      targeting {
+        screen_density_targeting {
+          value { density_alias: MDPI } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-mdpi.apk"
+      split_apk_metadata { split_id: "config.mdpi" } }
+    apk_description {
+      targeting {
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-master.apk"
+      split_apk_metadata { is_master_split: true } }
+    apk_description {
+      targeting {
+        abi_targeting {
+          value { alias: ARMEABI_V7A }
+          alternatives { alias: ARM64_V8A }
+          alternatives { alias: X86 }
+          alternatives { alias: X86_64 } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-armeabi_v7a.apk"
+      split_apk_metadata { split_id: "config.armeabi_v7a" } }
+    apk_description {
+      targeting {
+        abi_targeting {
+          value { alias: ARM64_V8A }
+          alternatives { alias: ARMEABI_V7A }
+          alternatives { alias: X86 }
+          alternatives { alias: X86_64 } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-arm64_v8a.apk"
+      split_apk_metadata { split_id: "config.arm64_v8a" } }
+    apk_description {
+      targeting {
+        abi_targeting {
+          value { alias: X86 }
+          alternatives { alias: ARMEABI_V7A }
+          alternatives { alias: ARM64_V8A }
+          alternatives { alias: X86_64 } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-x86.apk"
+      split_apk_metadata { split_id: "config.x86" } }
+    apk_description {
+      targeting {
+        abi_targeting {
+          value { alias: X86_64 }
+          alternatives { alias: ARMEABI_V7A }
+          alternatives { alias: ARM64_V8A }
+          alternatives { alias: X86 } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-x86_64.apk"
+      split_apk_metadata { split_id: "config.x86_64" } } }
+}
+bundletool {
+  version: "0.10.3" }
+
+`,
+			configs: []TestConfigDesc{
+				{
+					name: "one",
+					targetConfig: TargetConfig{
+						sdkVersion: 29,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_DENSITY_UNSPECIFIED: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{
+							bp.Abi_ARMEABI_V7A: 0,
+							bp.Abi_ARM64_V8A:   1,
+						},
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{
+							"splits/base-ldpi.apk",
+							"splits/base-mdpi.apk",
+							"splits/base-master.apk",
+							"splits/base-armeabi_v7a.apk",
+						},
+					},
+				},
+				{
+					name: "two",
+					targetConfig: TargetConfig{
+						sdkVersion: 29,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_LDPI: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{},
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{
+							"splits/base-ldpi.apk",
+							"splits/base-master.apk",
+						},
+					},
+				},
+				{
+					name: "three",
+					targetConfig: TargetConfig{
+						sdkVersion: 20,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_LDPI: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{},
+					},
+					expected: SelectionResult{
+						"",
+						nil,
+					},
+				},
+				{
+					name: "four",
+					targetConfig: TargetConfig{
+						sdkVersion: 29,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_MDPI: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{
+							bp.Abi_ARM64_V8A:   0,
+							bp.Abi_ARMEABI_V7A: 1,
+						},
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{
+							"splits/base-mdpi.apk",
+							"splits/base-master.apk",
+							"splits/base-arm64_v8a.apk",
+						},
+					},
+				},
+			},
+		},
+		{
+			protoText: `
+variant {
+  targeting {
+    sdk_version_targeting {
+      value { min { value: 10000 } } } }
+  apk_set {
+    module_metadata {
+      name: "base" targeting {} delivery_type: INSTALL_TIME }
+    apk_description {
+      targeting {
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "splits/base-master.apk"
+      split_apk_metadata { is_master_split: true } } } }`,
+			configs: []TestConfigDesc{
+				{
+					name: "Prerelease",
+					targetConfig: TargetConfig{
+						sdkVersion:       30,
+						screenDpi:        map[bp.ScreenDensity_DensityAlias]bool{},
+						abis:             map[bp.Abi_AbiAlias]int{},
+						allowPrereleased: true,
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{"splits/base-master.apk"},
+					},
+				},
+			},
+		},
+	}
+	for _, testCase := range testCases {
+		var toc bp.BuildApksResult
+		if err := proto.UnmarshalText(testCase.protoText, &toc); err != nil {
+			t.Fatal(err)
+		}
+		for _, config := range testCase.configs {
+			actual := selectApks(&toc, config.targetConfig)
+			if !reflect.DeepEqual(config.expected, actual) {
+				t.Errorf("%s: expected %v, got %v", config.name, config.expected, actual)
+			}
+		}
+	}
+}
+
+func TestSelectApks_ApexSet(t *testing.T) {
+	testCases := []TestDesc{
+		{
+			protoText: `
+variant {
+  targeting {
+    sdk_version_targeting {
+      value { min { value: 29 } } } }
+  apk_set {
+    module_metadata {
+      name: "base" targeting {} delivery_type: INSTALL_TIME }
+    apk_description {
+      targeting {
+        multi_abi_targeting {
+          value { abi { alias: ARMEABI_V7A } }
+          alternatives { abi { alias: ARM64_V8A } }
+          alternatives { abi { alias: X86 } }
+          alternatives { abi { alias: X86_64 } } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "standalones/standalone-armeabi_v7a.apex"
+      apex_apk_metadata { } }
+    apk_description {
+      targeting {
+        multi_abi_targeting {
+          value { abi { alias: ARM64_V8A } }
+          alternatives { abi { alias: ARMEABI_V7A } }
+          alternatives { abi { alias: X86 } }
+          alternatives { abi { alias: X86_64 } } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "standalones/standalone-arm64_v8a.apex"
+      apex_apk_metadata { } }
+    apk_description {
+      targeting {
+        multi_abi_targeting {
+          value { abi { alias: X86 } }
+          alternatives { abi { alias: ARMEABI_V7A } }
+          alternatives { abi { alias: ARM64_V8A } }
+          alternatives { abi { alias: X86_64 } } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "standalones/standalone-x86.apex"
+      apex_apk_metadata { } }
+    apk_description {
+      targeting {
+        multi_abi_targeting {
+          value { abi { alias: X86_64 } }
+          alternatives { abi { alias: ARMEABI_V7A } }
+          alternatives { abi { alias: ARM64_V8A } }
+          alternatives { abi { alias: X86 } } }
+        sdk_version_targeting {
+          value { min { value: 21 } } } }
+      path: "standalones/standalone-x86_64.apex"
+      apex_apk_metadata { } } }
+}
+bundletool {
+  version: "0.10.3" }
+
+`,
+			configs: []TestConfigDesc{
+				{
+					name: "order matches priorities",
+					targetConfig: TargetConfig{
+						sdkVersion: 29,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_DENSITY_UNSPECIFIED: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{
+							bp.Abi_ARM64_V8A:   0,
+							bp.Abi_ARMEABI_V7A: 1,
+						},
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{
+							"standalones/standalone-arm64_v8a.apex",
+						},
+					},
+				},
+				{
+					name: "order doesn't match priorities",
+					targetConfig: TargetConfig{
+						sdkVersion: 29,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_DENSITY_UNSPECIFIED: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{
+							bp.Abi_ARMEABI_V7A: 0,
+							bp.Abi_ARM64_V8A:   1,
+						},
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{
+							"standalones/standalone-arm64_v8a.apex",
+						},
+					},
+				},
+				{
+					name: "single choice",
+					targetConfig: TargetConfig{
+						sdkVersion: 29,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_DENSITY_UNSPECIFIED: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{
+							bp.Abi_ARMEABI_V7A: 0,
+						},
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{
+							"standalones/standalone-armeabi_v7a.apex",
+						},
+					},
+				},
+				{
+					name: "cross platform",
+					targetConfig: TargetConfig{
+						sdkVersion: 29,
+						screenDpi: map[bp.ScreenDensity_DensityAlias]bool{
+							bp.ScreenDensity_DENSITY_UNSPECIFIED: true,
+						},
+						abis: map[bp.Abi_AbiAlias]int{
+							bp.Abi_ARM64_V8A: 0,
+							bp.Abi_MIPS64:    1,
+							bp.Abi_X86:       2,
+						},
+					},
+					expected: SelectionResult{
+						"base",
+						[]string{
+							"standalones/standalone-x86.apex",
+						},
+					},
+				},
+			},
+		},
+	}
+	for _, testCase := range testCases {
+		var toc bp.BuildApksResult
+		if err := proto.UnmarshalText(testCase.protoText, &toc); err != nil {
+			t.Fatal(err)
+		}
+		for _, config := range testCase.configs {
+			actual := selectApks(&toc, config.targetConfig)
+			if !reflect.DeepEqual(config.expected, actual) {
+				t.Errorf("%s: expected %v, got %v", config.name, config.expected, actual)
+			}
+		}
+	}
+}
+
+type testZip2ZipWriter struct {
+	entries map[string]string
+}
+
+func (w testZip2ZipWriter) CopyFrom(file *zip.File, out string) error {
+	if x, ok := w.entries[out]; ok {
+		return fmt.Errorf("%s and %s both write to %s", x, file.Name, out)
+	}
+	w.entries[out] = file.Name
+	return nil
+}
+
+func TestWriteZip(t *testing.T) {
+	// what we write from what
+	expected := map[string]string{
+		"Foo.apk":       "splits/mybase-master.apk",
+		"Foo-xhdpi.apk": "splits/mybase-xhdpi.apk",
+	}
+	apkSet := ApkSet{entries: make(map[string]*zip.File)}
+	sel := SelectionResult{moduleName: "mybase"}
+	for _, in := range expected {
+		apkSet.entries[in] = &zip.File{FileHeader: zip.FileHeader{Name: in}}
+		sel.entries = append(sel.entries, in)
+	}
+	writer := testZip2ZipWriter{make(map[string]string)}
+	config := TargetConfig{stem: "Foo"}
+	if err := apkSet.writeApks(sel, config, writer); err != nil {
+		t.Error(err)
+	}
+	if !reflect.DeepEqual(expected, writer.entries) {
+		t.Errorf("expected %v, got %v", expected, writer.entries)
+	}
+}
diff --git a/java/androidmk.go b/java/androidmk.go
index 2c29192..ba1af0d 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -681,3 +681,20 @@
 		},
 	}}
 }
+
+func (apkSet *AndroidAppSet) AndroidMkEntries() []android.AndroidMkEntries {
+	return []android.AndroidMkEntries{
+		android.AndroidMkEntries{
+			Class:      "APPS",
+			OutputFile: android.OptionalPathForPath(apkSet.packedOutput),
+			Include:    "$(BUILD_SYSTEM)/soong_android_app_set.mk",
+			ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+				func(entries *android.AndroidMkEntries) {
+					entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged())
+					entries.SetString("LOCAL_APK_SET_MASTER_FILE", apkSet.masterFile)
+					entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", apkSet.properties.Overrides...)
+				},
+			},
+		},
+	}
+}
diff --git a/java/app.go b/java/app.go
index f1af2ad..215b07b 100755
--- a/java/app.go
+++ b/java/app.go
@@ -20,6 +20,7 @@
 	"path/filepath"
 	"reflect"
 	"sort"
+	"strconv"
 	"strings"
 
 	"github.com/google/blueprint"
@@ -49,6 +50,127 @@
 	ctx.RegisterModuleType("android_app_import", AndroidAppImportFactory)
 	ctx.RegisterModuleType("android_test_import", AndroidTestImportFactory)
 	ctx.RegisterModuleType("runtime_resource_overlay", RuntimeResourceOverlayFactory)
+	ctx.RegisterModuleType("android_app_set", AndroidApkSetFactory)
+}
+
+type AndroidAppSetProperties struct {
+	// APK Set path
+	Set *string
+
+	// Specifies that this app should be installed to the priv-app directory,
+	// where the system will grant it additional privileges not available to
+	// normal apps.
+	Privileged *bool
+
+	// APKs in this set use prerelease SDK version
+	Prerelease *bool
+
+	// Names of modules to be overridden. Listed modules can only be other apps
+	//	(in Make or Soong).
+	Overrides []string
+}
+
+type AndroidAppSet struct {
+	android.ModuleBase
+	android.DefaultableModuleBase
+	prebuilt android.Prebuilt
+
+	properties   AndroidAppSetProperties
+	packedOutput android.WritablePath
+	masterFile   string
+}
+
+func (as *AndroidAppSet) Name() string {
+	return as.prebuilt.Name(as.ModuleBase.Name())
+}
+
+func (as *AndroidAppSet) IsInstallable() bool {
+	return true
+}
+
+func (as *AndroidAppSet) Prebuilt() *android.Prebuilt {
+	return &as.prebuilt
+}
+
+func (as *AndroidAppSet) Privileged() bool {
+	return Bool(as.properties.Privileged)
+}
+
+var TargetCpuAbi = map[string]string{
+	"arm":    "ARMEABI_V7A",
+	"arm64":  "ARM64_V8A",
+	"x86":    "X86",
+	"x86_64": "X86_64",
+}
+
+func SupportedAbis(ctx android.ModuleContext) []string {
+	abiName := func(archVar string, deviceArch string) string {
+		if abi, found := TargetCpuAbi[deviceArch]; found {
+			return abi
+		}
+		ctx.ModuleErrorf("Invalid %s: %s", archVar, deviceArch)
+		return "BAD_ABI"
+	}
+
+	result := []string{abiName("TARGET_ARCH", ctx.DeviceConfig().DeviceArch())}
+	if s := ctx.DeviceConfig().DeviceSecondaryArch(); s != "" {
+		result = append(result, abiName("TARGET_2ND_ARCH", s))
+	}
+	return result
+}
+
+func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+	as.packedOutput = android.PathForModuleOut(ctx, "extracted.zip")
+	// We are assuming here that the master file in the APK
+	// set has `.apk` suffix. If it doesn't the build will fail.
+	// APK sets containing APEX files are handled elsewhere.
+	as.masterFile = ctx.ModuleName() + ".apk"
+	screenDensities := "all"
+	if dpis := ctx.Config().ProductAAPTPrebuiltDPI(); len(dpis) > 0 {
+		screenDensities = strings.ToUpper(strings.Join(dpis, ","))
+	}
+	// TODO(asmundak): handle locales.
+	// TODO(asmundak): do we support device features
+	ctx.Build(pctx,
+		android.BuildParams{
+			Rule:        extractMatchingApks,
+			Description: "Extract APKs from APK set",
+			Output:      as.packedOutput,
+			Inputs:      android.Paths{as.prebuilt.SingleSourcePath(ctx)},
+			Args: map[string]string{
+				"abis":              strings.Join(SupportedAbis(ctx), ","),
+				"allow-prereleased": strconv.FormatBool(proptools.Bool(as.properties.Prerelease)),
+				"screen-densities":  screenDensities,
+				"sdk-version":       ctx.Config().PlatformSdkVersion(),
+				"stem":              ctx.ModuleName(),
+			},
+		})
+	// TODO(asmundak): add this (it's wrong now, will cause copying extracted.zip)
+	/*
+		var installDir android.InstallPath
+		if Bool(as.properties.Privileged) {
+			installDir = android.PathForModuleInstall(ctx, "priv-app", as.BaseModuleName())
+		} else if ctx.InstallInTestcases() {
+			installDir = android.PathForModuleInstall(ctx, as.BaseModuleName(), ctx.DeviceConfig().DeviceArch())
+		} else {
+			installDir = android.PathForModuleInstall(ctx, "app", as.BaseModuleName())
+		}
+		ctx.InstallFile(installDir, as.masterFile", as.packedOutput)
+	*/
+}
+
+// android_app_set extracts a set of APKs based on the target device
+// configuration and installs this set as "split APKs".
+// The set will always contain `base-master.apk` and every APK built
+// to the target device. All density-specific APK will be included, too,
+// unless PRODUCT_APPT_PREBUILT_DPI is defined (should contain comma-sepearated
+// list of density names (LDPI, MDPI, HDPI, etc.)
+func AndroidApkSetFactory() android.Module {
+	module := &AndroidAppSet{}
+	module.AddProperties(&module.properties)
+	InitJavaModule(module, android.DeviceSupported)
+	android.InitSingleSourcePrebuiltModule(module, &module.properties, "Set")
+	return module
 }
 
 // AndroidManifest.xml merging
@@ -129,6 +251,9 @@
 	// or an android_app_certificate module name in the form ":module".
 	Certificate *string
 
+	// Name of the signing certificate lineage file.
+	Lineage *string
+
 	// the package name of this app. The package name in the manifest file is used if one was not given.
 	Package_name *string
 
@@ -249,7 +374,10 @@
 
 		// If the app builds against an Android SDK use the SDK variant of JNI dependencies
 		// unless jni_uses_platform_apis is set.
-		if (usesSDK && !Bool(a.appProperties.Jni_uses_platform_apis)) ||
+		// Don't require the SDK variant for apps that are shipped on vendor, etc., as they already
+		// have stable APIs through the VNDK.
+		if (usesSDK && !a.RequiresStableAPIs(ctx) &&
+			!Bool(a.appProperties.Jni_uses_platform_apis)) ||
 			Bool(a.appProperties.Jni_uses_sdk_apis) {
 			variation = append(variation, blueprint.Variation{Mutator: "sdk", Variation: "sdk"})
 		}
@@ -286,19 +414,47 @@
 }
 
 func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) {
-	if Bool(a.appProperties.Updatable) {
+	if Bool(a.appProperties.Updatable) || a.ApexModuleBase.Updatable() {
 		if !a.sdkVersion().stable() {
 			ctx.PropertyErrorf("sdk_version", "Updatable apps must use stable SDKs, found %v", a.sdkVersion())
 		}
 		if String(a.deviceProperties.Min_sdk_version) == "" {
 			ctx.PropertyErrorf("updatable", "updatable apps must set min_sdk_version.")
 		}
+		if minSdkVersion, err := a.minSdkVersion().effectiveVersion(ctx); err == nil {
+			a.checkJniLibsSdkVersion(ctx, minSdkVersion)
+		} else {
+			ctx.PropertyErrorf("min_sdk_version", "%s", err.Error())
+		}
 	}
 
 	a.checkPlatformAPI(ctx)
 	a.checkSdkVersions(ctx)
 }
 
+// If an updatable APK sets min_sdk_version, min_sdk_vesion of JNI libs should match with it.
+// This check is enforced for "updatable" APKs (including APK-in-APEX).
+// b/155209650: until min_sdk_version is properly supported, use sdk_version instead.
+// because, sdk_version is overridden by min_sdk_version (if set as smaller)
+// and linkType is checked with dependencies so we can be sure that the whole dependency tree
+// will meet the requirements.
+func (a *AndroidApp) checkJniLibsSdkVersion(ctx android.ModuleContext, minSdkVersion sdkVersion) {
+	// It's enough to check direct JNI deps' sdk_version because all transitive deps from JNI deps are checked in cc.checkLinkType()
+	ctx.VisitDirectDeps(func(m android.Module) {
+		if !IsJniDepTag(ctx.OtherModuleDependencyTag(m)) {
+			return
+		}
+		dep, _ := m.(*cc.Module)
+		jniSdkVersion, err := android.ApiStrToNum(ctx, dep.SdkVersion())
+		if err != nil || int(minSdkVersion) < jniSdkVersion {
+			ctx.OtherModuleErrorf(dep, "sdk_version(%v) is higher than min_sdk_version(%v) of the containing android_app(%v)",
+				dep.SdkVersion(), minSdkVersion, ctx.ModuleName())
+			return
+		}
+
+	})
+}
+
 // Returns true if the native libraries should be stored in the APK uncompressed and the
 // extractNativeLibs application flag should be set to false in the manifest.
 func (a *AndroidApp) useEmbeddedNativeLibs(ctx android.ModuleContext) bool {
@@ -584,7 +740,7 @@
 
 	dexJarFile := a.dexBuildActions(ctx)
 
-	jniLibs, certificateDeps := collectAppDeps(ctx, a.shouldEmbedJnis(ctx), !Bool(a.appProperties.Jni_uses_platform_apis))
+	jniLibs, certificateDeps := collectAppDeps(ctx, a, a.shouldEmbedJnis(ctx), !Bool(a.appProperties.Jni_uses_platform_apis))
 	jniJarFile := a.jniBuildActions(jniLibs, ctx)
 
 	if ctx.Failed() {
@@ -596,13 +752,17 @@
 
 	// Build a final signed app package.
 	packageFile := android.PathForModuleOut(ctx, a.installApkName+".apk")
-	CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps)
+	var lineageFile android.Path
+	if lineage := String(a.overridableAppProperties.Lineage); lineage != "" {
+		lineageFile = android.PathForModuleSrc(ctx, lineage)
+	}
+	CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps, lineageFile)
 	a.outputFile = packageFile
 
 	for _, split := range a.aapt.splits {
 		// Sign the split APKs
 		packageFile := android.PathForModuleOut(ctx, a.installApkName+"_"+split.suffix+".apk")
-		CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps)
+		CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps, lineageFile)
 		a.extraOutputFiles = append(a.extraOutputFiles, packageFile)
 	}
 
@@ -622,12 +782,25 @@
 	a.buildAppDependencyInfo(ctx)
 }
 
-func collectAppDeps(ctx android.ModuleContext, shouldCollectRecursiveNativeDeps bool,
+type appDepsInterface interface {
+	sdkVersion() sdkSpec
+	minSdkVersion() sdkSpec
+	RequiresStableAPIs(ctx android.BaseModuleContext) bool
+}
+
+func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
+	shouldCollectRecursiveNativeDeps bool,
 	checkNativeSdkVersion bool) ([]jniLib, []Certificate) {
+
 	var jniLibs []jniLib
 	var certificates []Certificate
 	seenModulePaths := make(map[string]bool)
 
+	if checkNativeSdkVersion {
+		checkNativeSdkVersion = app.sdkVersion().specified() &&
+			app.sdkVersion().kind != sdkCorePlatform && !app.RequiresStableAPIs(ctx)
+	}
+
 	ctx.WalkDeps(func(module android.Module, parent android.Module) bool {
 		otherName := ctx.OtherModuleName(module)
 		tag := ctx.OtherModuleDependencyTag(module)
@@ -645,16 +818,9 @@
 				}
 				seenModulePaths[path.String()] = true
 
-				if checkNativeSdkVersion {
-					if app, ok := ctx.Module().(interface{ sdkVersion() sdkSpec }); ok {
-						if app.sdkVersion().specified() &&
-							app.sdkVersion().kind != sdkCorePlatform &&
-							dep.SdkVersion() == "" {
-							ctx.PropertyErrorf("jni_libs",
-								"JNI dependency %q uses platform APIs, but this module does not",
-								otherName)
-						}
-					}
+				if checkNativeSdkVersion && dep.SdkVersion() == "" {
+					ctx.PropertyErrorf("jni_libs", "JNI dependency %q uses platform APIs, but this module does not",
+						otherName)
 				}
 
 				if lib.Valid() {
@@ -835,6 +1001,7 @@
 }
 
 func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+	var configs []tradefed.Config
 	if a.appTestProperties.Instrumentation_target_package != nil {
 		a.additionalAaptFlags = append(a.additionalAaptFlags,
 			"--rename-instrumentation-target-package "+*a.appTestProperties.Instrumentation_target_package)
@@ -847,8 +1014,12 @@
 	}
 	a.generateAndroidBuildActions(ctx)
 
+	for _, module := range a.testProperties.Test_mainline_modules {
+		configs = append(configs, tradefed.Option{Name: "config-descriptor:metadata", Key: "mainline-param", Value: module})
+	}
+
 	testConfig := tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config,
-		a.testProperties.Test_config_template, a.manifestPath, a.testProperties.Test_suites, a.testProperties.Auto_gen_config)
+		a.testProperties.Test_config_template, a.manifestPath, a.testProperties.Test_suites, a.testProperties.Auto_gen_config, configs)
 	a.testConfig = a.FixTestConfig(ctx, testConfig)
 	a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data)
 }
@@ -1244,7 +1415,7 @@
 		ctx.ModuleErrorf("One and only one of certficate, presigned, and default_dev_cert properties must be set")
 	}
 
-	_, certificates := collectAppDeps(ctx, false, false)
+	_, certificates := collectAppDeps(ctx, a, false, false)
 
 	// TODO: LOCAL_EXTRACT_APK/LOCAL_EXTRACT_DPI_APK
 	// TODO: LOCAL_PACKAGE_SPLITS
@@ -1299,7 +1470,7 @@
 		}
 		a.certificate = certificates[0]
 		signed := android.PathForModuleOut(ctx, "signed", apkFilename)
-		SignAppPackage(ctx, signed, dexOutput, certificates)
+		SignAppPackage(ctx, signed, dexOutput, certificates, nil)
 		a.outputFile = signed
 	} else {
 		alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename)
@@ -1370,6 +1541,14 @@
 	return false
 }
 
+func (a *AndroidAppImport) sdkVersion() sdkSpec {
+	return sdkSpecFrom("")
+}
+
+func (a *AndroidAppImport) minSdkVersion() sdkSpec {
+	return sdkSpecFrom("")
+}
+
 func createVariantGroupType(variants []string, variantGroupName string) reflect.Type {
 	props := reflect.TypeOf((*AndroidAppImportProperties)(nil))
 
@@ -1555,10 +1734,10 @@
 	r.aapt.buildActions(ctx, r, aaptLinkFlags...)
 
 	// Sign the built package
-	_, certificates := collectAppDeps(ctx, false, false)
+	_, certificates := collectAppDeps(ctx, r, false, false)
 	certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx)
 	signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk")
-	SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates)
+	SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil)
 	r.certificate = certificates[0]
 
 	r.outputFile = signed
diff --git a/java/app_builder.go b/java/app_builder.go
index 5e7fbe6..fb9ab42 100644
--- a/java/app_builder.go
+++ b/java/app_builder.go
@@ -45,7 +45,7 @@
 	})
 
 func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.WritablePath,
-	packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths) {
+	packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, lineageFile android.Path) {
 
 	unsignedApkName := strings.TrimSuffix(outputFile.Base(), ".apk") + "-unsigned.apk"
 	unsignedApk := android.PathForModuleOut(ctx, unsignedApkName)
@@ -66,10 +66,10 @@
 		Implicits: deps,
 	})
 
-	SignAppPackage(ctx, outputFile, unsignedApk, certificates)
+	SignAppPackage(ctx, outputFile, unsignedApk, certificates, lineageFile)
 }
 
-func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate) {
+func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate, lineageFile android.Path) {
 
 	var certificateArgs []string
 	var deps android.Paths
@@ -78,6 +78,12 @@
 		deps = append(deps, c.Pem, c.Key)
 	}
 
+	var flags []string
+	if lineageFile != nil {
+		flags = append(flags, "--lineage", lineageFile.String())
+		deps = append(deps, lineageFile)
+	}
+
 	ctx.Build(pctx, android.BuildParams{
 		Rule:        Signapk,
 		Description: "signapk",
@@ -86,6 +92,7 @@
 		Implicits:   deps,
 		Args: map[string]string{
 			"certificates": strings.Join(certificateArgs, " "),
+			"flags":        strings.Join(flags, " "),
 		},
 	})
 }
diff --git a/java/app_test.go b/java/app_test.go
index 4bcfa5a..2195afd 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -141,6 +141,94 @@
 	}
 }
 
+func TestAndroidAppSet(t *testing.T) {
+	ctx, config := testJava(t, `
+		android_app_set {
+			name: "foo",
+			set: "prebuilts/apks/app.apks",
+			prerelease: true,
+        }`)
+	module := ctx.ModuleForTests("foo", "android_common")
+	const packedSplitApks = "extracted.zip"
+	params := module.Output(packedSplitApks)
+	if params.Rule == nil {
+		t.Errorf("expected output %s is missing", packedSplitApks)
+	}
+	if s := params.Args["allow-prereleased"]; s != "true" {
+		t.Errorf("wrong allow-prereleased value: '%s', expected 'true'", s)
+	}
+	mkEntries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0]
+	actualMaster := mkEntries.EntryMap["LOCAL_APK_SET_MASTER_FILE"]
+	expectedMaster := []string{"foo.apk"}
+	if !reflect.DeepEqual(actualMaster, expectedMaster) {
+		t.Errorf("Unexpected LOCAL_APK_SET_MASTER_FILE value: '%s', expected: '%s',",
+			actualMaster, expectedMaster)
+	}
+}
+
+func TestAndroidAppSet_Variants(t *testing.T) {
+	bp := `
+		android_app_set {
+			name: "foo",
+			set: "prebuilts/apks/app.apks",
+		}`
+	testCases := []struct {
+		name                string
+		deviceArch          *string
+		deviceSecondaryArch *string
+		aaptPrebuiltDPI     []string
+		sdkVersion          int
+		expected            map[string]string
+	}{
+		{
+			name:            "One",
+			deviceArch:      proptools.StringPtr("x86"),
+			aaptPrebuiltDPI: []string{"ldpi", "xxhdpi"},
+			sdkVersion:      29,
+			expected: map[string]string{
+				"abis":              "X86",
+				"allow-prereleased": "false",
+				"screen-densities":  "LDPI,XXHDPI",
+				"sdk-version":       "29",
+				"stem":              "foo",
+			},
+		},
+		{
+			name:                "Two",
+			deviceArch:          proptools.StringPtr("x86_64"),
+			deviceSecondaryArch: proptools.StringPtr("x86"),
+			aaptPrebuiltDPI:     nil,
+			sdkVersion:          30,
+			expected: map[string]string{
+				"abis":              "X86_64,X86",
+				"allow-prereleased": "false",
+				"screen-densities":  "all",
+				"sdk-version":       "30",
+				"stem":              "foo",
+			},
+		},
+	}
+
+	for _, test := range testCases {
+		config := testAppConfig(nil, bp, nil)
+		config.TestProductVariables.AAPTPrebuiltDPI = test.aaptPrebuiltDPI
+		config.TestProductVariables.Platform_sdk_version = &test.sdkVersion
+		config.TestProductVariables.DeviceArch = test.deviceArch
+		config.TestProductVariables.DeviceSecondaryArch = test.deviceSecondaryArch
+		ctx := testContext()
+		run(t, ctx, config)
+		module := ctx.ModuleForTests("foo", "android_common")
+		const packedSplitApks = "extracted.zip"
+		params := module.Output(packedSplitApks)
+		for k, v := range test.expected {
+			if actual := params.Args[k]; actual != v {
+				t.Errorf("%s: bad build arg value for '%s': '%s', expected '%s'",
+					test.name, k, actual, v)
+			}
+		}
+	}
+}
+
 func TestPlatformAPIs(t *testing.T) {
 	testJava(t, `
 		android_app {
@@ -385,6 +473,127 @@
 	}
 }
 
+func TestUpdatableApps_JniLibsShouldShouldSupportMinSdkVersion(t *testing.T) {
+	testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
+		android_app {
+			name: "foo",
+			srcs: ["a.java"],
+			updatable: true,
+			sdk_version: "current",
+			min_sdk_version: "current",
+			jni_libs: ["libjni"],
+		}
+
+		cc_library {
+			name: "libjni",
+			stl: "none",
+			system_shared_libs: [],
+			sdk_version: "current",
+		}
+	`)
+}
+
+func TestUpdatableApps_JniLibShouldBeBuiltAgainstMinSdkVersion(t *testing.T) {
+	bp := cc.GatherRequiredDepsForTest(android.Android) + `
+		android_app {
+			name: "foo",
+			srcs: ["a.java"],
+			updatable: true,
+			sdk_version: "current",
+			min_sdk_version: "29",
+			jni_libs: ["libjni"],
+		}
+
+		cc_library {
+			name: "libjni",
+			stl: "none",
+			system_shared_libs: [],
+			sdk_version: "29",
+		}
+
+		ndk_prebuilt_object {
+			name: "ndk_crtbegin_so.29",
+			sdk_version: "29",
+		}
+
+		ndk_prebuilt_object {
+			name: "ndk_crtend_so.29",
+			sdk_version: "29",
+		}
+	`
+	fs := map[string][]byte{
+		"prebuilts/ndk/current/platforms/android-29/arch-arm64/usr/lib/crtbegin_so.o": nil,
+		"prebuilts/ndk/current/platforms/android-29/arch-arm64/usr/lib/crtend_so.o":   nil,
+		"prebuilts/ndk/current/platforms/android-29/arch-arm/usr/lib/crtbegin_so.o":   nil,
+		"prebuilts/ndk/current/platforms/android-29/arch-arm/usr/lib/crtend_so.o":     nil,
+	}
+
+	ctx, _ := testJavaWithConfig(t, testConfig(nil, bp, fs))
+
+	inputs := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_sdk_shared").Description("link").Implicits
+	var crtbeginFound, crtendFound bool
+	for _, input := range inputs {
+		switch input.String() {
+		case "prebuilts/ndk/current/platforms/android-29/arch-arm64/usr/lib/crtbegin_so.o":
+			crtbeginFound = true
+		case "prebuilts/ndk/current/platforms/android-29/arch-arm64/usr/lib/crtend_so.o":
+			crtendFound = true
+		}
+	}
+	if !crtbeginFound || !crtendFound {
+		t.Error("should link with ndk_crtbegin_so.29 and ndk_crtend_so.29")
+	}
+}
+
+func TestUpdatableApps_ErrorIfJniLibDoesntSupportMinSdkVersion(t *testing.T) {
+	bp := cc.GatherRequiredDepsForTest(android.Android) + `
+		android_app {
+			name: "foo",
+			srcs: ["a.java"],
+			updatable: true,
+			sdk_version: "current",
+			min_sdk_version: "29",  // this APK should support 29
+			jni_libs: ["libjni"],
+		}
+
+		cc_library {
+			name: "libjni",
+			stl: "none",
+			sdk_version: "current",
+		}
+	`
+	testJavaError(t, `"libjni" .*: sdk_version\(current\) is higher than min_sdk_version\(29\)`, bp)
+}
+
+func TestUpdatableApps_ErrorIfDepSdkVersionIsHigher(t *testing.T) {
+	bp := cc.GatherRequiredDepsForTest(android.Android) + `
+		android_app {
+			name: "foo",
+			srcs: ["a.java"],
+			updatable: true,
+			sdk_version: "current",
+			min_sdk_version: "29",  // this APK should support 29
+			jni_libs: ["libjni"],
+		}
+
+		cc_library {
+			name: "libjni",
+			stl: "none",
+			shared_libs: ["libbar"],
+			system_shared_libs: [],
+			sdk_version: "27",
+		}
+
+		cc_library {
+			name: "libbar",
+			stl: "none",
+			system_shared_libs: [],
+			sdk_version: "current",
+		}
+	`
+	testJavaError(t, `"libjni" .*: links "libbar" built against newer API version "current"`, bp)
+}
+
 func TestResourceDirs(t *testing.T) {
 	testCases := []struct {
 		name      string
@@ -1144,25 +1353,44 @@
 			platform_apis: true,
 			jni_uses_sdk_apis: true,
 		}
+
+		cc_library {
+			name: "libvendorjni",
+			system_shared_libs: [],
+			stl: "none",
+			vendor: true,
+		}
+
+		android_test {
+			name: "app_vendor",
+			jni_libs: ["libvendorjni"],
+			sdk_version: "current",
+			vendor: true,
+		}
 	`)
 
 	testCases := []struct {
-		name   string
-		sdkJNI bool
+		name      string
+		sdkJNI    bool
+		vendorJNI bool
 	}{
-		{"app_platform", false},
-		{"app_sdk", true},
-		{"app_force_platform", false},
-		{"app_force_sdk", true},
+		{name: "app_platform"},
+		{name: "app_sdk", sdkJNI: true},
+		{name: "app_force_platform"},
+		{name: "app_force_sdk", sdkJNI: true},
+		{name: "app_vendor", vendorJNI: true},
 	}
 
+	platformJNI := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_shared").
+		Output("libjni.so").Output.String()
+	sdkJNI := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_sdk_shared").
+		Output("libjni.so").Output.String()
+	vendorJNI := ctx.ModuleForTests("libvendorjni", "android_arm64_armv8-a_shared").
+		Output("libvendorjni.so").Output.String()
+
 	for _, test := range testCases {
 		t.Run(test.name, func(t *testing.T) {
 			app := ctx.ModuleForTests(test.name, "android_common")
-			platformJNI := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_shared").
-				Output("libjni.so").Output.String()
-			sdkJNI := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_sdk_shared").
-				Output("libjni.so").Output.String()
 
 			jniLibZip := app.MaybeOutput("jnilibs.zip")
 			if len(jniLibZip.Implicits) != 1 {
@@ -1174,6 +1402,10 @@
 				if gotJNI != sdkJNI {
 					t.Errorf("expected SDK JNI library %q, got %q", sdkJNI, gotJNI)
 				}
+			} else if test.vendorJNI {
+				if gotJNI != vendorJNI {
+					t.Errorf("expected platform JNI library %q, got %q", vendorJNI, gotJNI)
+				}
 			} else {
 				if gotJNI != platformJNI {
 					t.Errorf("expected platform JNI library %q, got %q", platformJNI, gotJNI)
@@ -1209,7 +1441,8 @@
 		name                string
 		bp                  string
 		certificateOverride string
-		expected            string
+		expectedLineage     string
+		expectedCertificate string
 	}{
 		{
 			name: "default",
@@ -1221,7 +1454,8 @@
 				}
 			`,
 			certificateOverride: "",
-			expected:            "build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8",
+			expectedLineage:     "",
+			expectedCertificate: "build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8",
 		},
 		{
 			name: "module certificate property",
@@ -1239,7 +1473,8 @@
 				}
 			`,
 			certificateOverride: "",
-			expected:            "cert/new_cert.x509.pem cert/new_cert.pk8",
+			expectedLineage:     "",
+			expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
 		},
 		{
 			name: "path certificate property",
@@ -1252,7 +1487,8 @@
 				}
 			`,
 			certificateOverride: "",
-			expected:            "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+			expectedLineage:     "",
+			expectedCertificate: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
 		},
 		{
 			name: "certificate overrides",
@@ -1270,7 +1506,28 @@
 				}
 			`,
 			certificateOverride: "foo:new_certificate",
-			expected:            "cert/new_cert.x509.pem cert/new_cert.pk8",
+			expectedLineage:     "",
+			expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
+		},
+		{
+			name: "certificate lineage",
+			bp: `
+				android_app {
+					name: "foo",
+					srcs: ["a.java"],
+					certificate: ":new_certificate",
+					lineage: "lineage.bin",
+					sdk_version: "current",
+				}
+
+				android_app_certificate {
+					name: "new_certificate",
+					certificate: "cert/new_cert",
+				}
+			`,
+			certificateOverride: "",
+			expectedLineage:     "--lineage lineage.bin",
+			expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
 		},
 	}
 
@@ -1286,9 +1543,14 @@
 			foo := ctx.ModuleForTests("foo", "android_common")
 
 			signapk := foo.Output("foo.apk")
-			signFlags := signapk.Args["certificates"]
-			if test.expected != signFlags {
-				t.Errorf("Incorrect signing flags, expected: %q, got: %q", test.expected, signFlags)
+			signCertificateFlags := signapk.Args["certificates"]
+			if test.expectedCertificate != signCertificateFlags {
+				t.Errorf("Incorrect signing flags, expected: %q, got: %q", test.expectedCertificate, signCertificateFlags)
+			}
+
+			signFlags := signapk.Args["flags"]
+			if test.expectedLineage != signFlags {
+				t.Errorf("Incorrect signing flags, expected: %q, got: %q", test.expectedLineage, signFlags)
 			}
 		})
 	}
@@ -1402,6 +1664,7 @@
 			name: "bar",
 			base: "foo",
 			certificate: ":new_certificate",
+			lineage: "lineage.bin",
 			logging_parent: "bah",
 		}
 
@@ -1422,7 +1685,8 @@
 		variantName    string
 		apkName        string
 		apkPath        string
-		signFlag       string
+		certFlag       string
+		lineageFlag    string
 		overrides      []string
 		aaptFlag       string
 		logging_parent string
@@ -1431,7 +1695,8 @@
 			moduleName:     "foo",
 			variantName:    "android_common",
 			apkPath:        "/target/product/test_device/system/app/foo/foo.apk",
-			signFlag:       "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+			certFlag:       "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+			lineageFlag:    "",
 			overrides:      []string{"qux"},
 			aaptFlag:       "",
 			logging_parent: "",
@@ -1440,7 +1705,8 @@
 			moduleName:     "bar",
 			variantName:    "android_common_bar",
 			apkPath:        "/target/product/test_device/system/app/bar/bar.apk",
-			signFlag:       "cert/new_cert.x509.pem cert/new_cert.pk8",
+			certFlag:       "cert/new_cert.x509.pem cert/new_cert.pk8",
+			lineageFlag:    "--lineage lineage.bin",
 			overrides:      []string{"qux", "foo"},
 			aaptFlag:       "",
 			logging_parent: "bah",
@@ -1449,7 +1715,8 @@
 			moduleName:     "baz",
 			variantName:    "android_common_baz",
 			apkPath:        "/target/product/test_device/system/app/baz/baz.apk",
-			signFlag:       "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+			certFlag:       "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+			lineageFlag:    "",
 			overrides:      []string{"qux", "foo"},
 			aaptFlag:       "--rename-manifest-package org.dandroid.bp",
 			logging_parent: "",
@@ -1474,9 +1741,15 @@
 
 		// Check the certificate paths
 		signapk := variant.Output(expected.moduleName + ".apk")
-		signFlag := signapk.Args["certificates"]
-		if expected.signFlag != signFlag {
-			t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected.signFlag, signFlag)
+		certFlag := signapk.Args["certificates"]
+		if expected.certFlag != certFlag {
+			t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected.certFlag, certFlag)
+		}
+
+		// Check the lineage flags
+		lineageFlag := signapk.Args["flags"]
+		if expected.lineageFlag != lineageFlag {
+			t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected.lineageFlag, lineageFlag)
 		}
 
 		// Check if the overrides field values are correctly aggregated.
diff --git a/java/builder.go b/java/builder.go
index 3a4a10d..b834029 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -104,6 +104,18 @@
 		"javacFlags", "bootClasspath", "classpath", "processorpath", "processor", "srcJars", "srcJarDir",
 		"outDir", "annoDir", "javaVersion")
 
+	extractMatchingApks = pctx.StaticRule(
+		"extractMatchingApks",
+		blueprint.RuleParams{
+			Command: `rm -rf "$out" && ` +
+				`${config.ExtractApksCmd} -o "${out}" -allow-prereleased=${allow-prereleased} ` +
+				`-sdk-version=${sdk-version} -abis=${abis} ` +
+				`--screen-densities=${screen-densities} --stem=${stem} ` +
+				`${in}`,
+			CommandDeps: []string{"${config.ExtractApksCmd}"},
+		},
+		"abis", "allow-prereleased", "screen-densities", "sdk-version", "stem")
+
 	turbine = pctx.AndroidStaticRule("turbine",
 		blueprint.RuleParams{
 			Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
diff --git a/java/config/config.go b/java/config/config.go
index c4f2363..1344ceb 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -122,7 +122,7 @@
 	pctx.HostBinToolVariable("D8Cmd", "d8")
 	pctx.HostBinToolVariable("R8Cmd", "r8-compat-proguard")
 	pctx.HostBinToolVariable("HiddenAPICmd", "hiddenapi")
-
+	pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
 	pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
 		turbine := "turbine.jar"
 		if ctx.Config().UnbundledBuild() {
diff --git a/java/java.go b/java/java.go
index a8c104e..5b1dcd7 100644
--- a/java/java.go
+++ b/java/java.go
@@ -95,8 +95,7 @@
 }
 
 func (j *Module) checkSdkVersions(ctx android.ModuleContext) {
-	if j.SocSpecific() || j.DeviceSpecific() ||
-		(j.ProductSpecific() && ctx.Config().EnforceProductPartitionInterface()) {
+	if j.RequiresStableAPIs(ctx) {
 		if sc, ok := ctx.Module().(sdkContext); ok {
 			if !sc.sdkVersion().specified() {
 				ctx.PropertyErrorf("sdk_version",
@@ -351,6 +350,22 @@
 	return BoolDefault(me.Optimize.Enabled, me.Optimize.EnabledByDefault)
 }
 
+// Functionality common to Module and Import
+type embeddableInModuleAndImport struct {
+}
+
+// Module/Import's DepIsInSameApex(...) delegates to this method.
+//
+// This cannot implement DepIsInSameApex(...) directly as that leads to ambiguity with
+// the one provided by ApexModuleBase.
+func (e *embeddableInModuleAndImport) depIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
+	// dependencies other than the static linkage are all considered crossing APEX boundary
+	if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
+		return true
+	}
+	return false
+}
+
 // Module contains the properties and members used by all java module types
 type Module struct {
 	android.ModuleBase
@@ -358,6 +373,9 @@
 	android.ApexModuleBase
 	android.SdkBase
 
+	// Functionality common to Module and Import.
+	embeddableInModuleAndImport
+
 	properties       CompilerProperties
 	protoProperties  android.ProtoProperties
 	deviceProperties CompilerDeviceProperties
@@ -1762,11 +1780,7 @@
 }
 
 func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
-	// Dependencies other than the static linkage are all considered crossing APEX boundary
-	if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
-		return true
-	}
-	return false
+	return j.depIsInSameApex(ctx, dep)
 }
 
 func (j *Module) Stem() string {
@@ -2026,6 +2040,10 @@
 	// doesn't exist next to the Android.bp, this attribute doesn't need to be set to true
 	// explicitly.
 	Auto_gen_config *bool
+
+	// Add parameterized mainline modules to auto generated test config. The options will be
+	// handled by TradeFed to do downloading and installing the specified modules on the device.
+	Test_mainline_modules []string
 }
 
 type testHelperLibraryProperties struct {
@@ -2380,6 +2398,9 @@
 	prebuilt android.Prebuilt
 	android.SdkBase
 
+	// Functionality common to Module and Import.
+	embeddableInModuleAndImport
+
 	properties ImportProperties
 
 	combinedClasspathFile android.Path
@@ -2514,11 +2535,7 @@
 }
 
 func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
-	// dependencies other than the static linkage are all considered crossing APEX boundary
-	if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
-		return true
-	}
-	return false
+	return j.depIsInSameApex(ctx, dep)
 }
 
 // Add compile time check for interface implementation
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 2650ab3..61bb106 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -92,6 +92,9 @@
 	// The name of the field in the dynamically created structure.
 	fieldName string
 
+	// The name of the property in the java_sdk_library_import
+	propertyName string
+
 	// The tag to use to depend on the stubs library module.
 	stubsTag scopeDependencyTag
 
@@ -142,7 +145,8 @@
 // Initialize a scope, creating and adding appropriate dependency tags
 func initApiScope(scope *apiScope) *apiScope {
 	name := scope.name
-	scope.fieldName = proptools.FieldNameForProperty(name)
+	scope.propertyName = strings.ReplaceAll(name, "-", "_")
+	scope.fieldName = proptools.FieldNameForProperty(scope.propertyName)
 	scope.stubsTag = scopeDependencyTag{
 		name:             name + "-stubs",
 		apiScope:         scope,
@@ -253,7 +257,7 @@
 		unstable:       true,
 	})
 	apiScopeModuleLib = initApiScope(&apiScope{
-		name:    "module_lib",
+		name:    "module-lib",
 		extends: apiScopeSystem,
 		// Module_lib scope is disabled by default in legacy mode.
 		//
@@ -743,21 +747,17 @@
 // Creates a static java library that has API stubs
 func (module *SdkLibrary) createStubsLibrary(mctx android.DefaultableHookContext, apiScope *apiScope) {
 	props := struct {
-		Name                *string
-		Visibility          []string
-		Srcs                []string
-		Installable         *bool
-		Sdk_version         *string
-		System_modules      *string
-		Patch_module        *string
-		Libs                []string
-		Soc_specific        *bool
-		Device_specific     *bool
-		Product_specific    *bool
-		System_ext_specific *bool
-		Compile_dex         *bool
-		Java_version        *string
-		Product_variables   struct {
+		Name              *string
+		Visibility        []string
+		Srcs              []string
+		Installable       *bool
+		Sdk_version       *string
+		System_modules    *string
+		Patch_module      *string
+		Libs              []string
+		Compile_dex       *bool
+		Java_version      *string
+		Product_variables struct {
 			Pdk struct {
 				Enabled *bool
 			}
@@ -785,27 +785,18 @@
 	props.Srcs = []string{":" + module.stubsSourceModuleName(apiScope)}
 	sdkVersion := module.sdkVersionForStubsLibrary(mctx, apiScope)
 	props.Sdk_version = proptools.StringPtr(sdkVersion)
-	props.System_modules = module.Library.Module.deviceProperties.System_modules
-	props.Patch_module = module.Library.Module.properties.Patch_module
+	props.System_modules = module.deviceProperties.System_modules
+	props.Patch_module = module.properties.Patch_module
 	props.Installable = proptools.BoolPtr(false)
 	props.Libs = module.sdkLibraryProperties.Stub_only_libs
 	props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false)
-	props.Openjdk9.Srcs = module.Library.Module.properties.Openjdk9.Srcs
-	props.Openjdk9.Javacflags = module.Library.Module.properties.Openjdk9.Javacflags
-	props.Java_version = module.Library.Module.properties.Java_version
-	if module.Library.Module.deviceProperties.Compile_dex != nil {
-		props.Compile_dex = module.Library.Module.deviceProperties.Compile_dex
+	props.Openjdk9.Srcs = module.properties.Openjdk9.Srcs
+	props.Openjdk9.Javacflags = module.properties.Openjdk9.Javacflags
+	props.Java_version = module.properties.Java_version
+	if module.deviceProperties.Compile_dex != nil {
+		props.Compile_dex = module.deviceProperties.Compile_dex
 	}
 
-	if module.SocSpecific() {
-		props.Soc_specific = proptools.BoolPtr(true)
-	} else if module.DeviceSpecific() {
-		props.Device_specific = proptools.BoolPtr(true)
-	} else if module.ProductSpecific() {
-		props.Product_specific = proptools.BoolPtr(true)
-	} else if module.SystemExtSpecific() {
-		props.System_ext_specific = proptools.BoolPtr(true)
-	}
 	// Dist the class jar artifact for sdk builds.
 	if !Bool(module.sdkLibraryProperties.No_dist) {
 		props.Dist.Targets = []string{"sdk", "win_sdk"}
@@ -869,17 +860,17 @@
 	visibility := module.sdkLibraryProperties.Stubs_source_visibility
 	props.Visibility = visibility
 
-	props.Srcs = append(props.Srcs, module.Library.Module.properties.Srcs...)
-	props.Sdk_version = module.Library.Module.deviceProperties.Sdk_version
-	props.System_modules = module.Library.Module.deviceProperties.System_modules
+	props.Srcs = append(props.Srcs, module.properties.Srcs...)
+	props.Sdk_version = module.deviceProperties.Sdk_version
+	props.System_modules = module.deviceProperties.System_modules
 	props.Installable = proptools.BoolPtr(false)
 	// A droiddoc module has only one Libs property and doesn't distinguish between
 	// shared libs and static libs. So we need to add both of these libs to Libs property.
-	props.Libs = module.Library.Module.properties.Libs
-	props.Libs = append(props.Libs, module.Library.Module.properties.Static_libs...)
-	props.Aidl.Include_dirs = module.Library.Module.deviceProperties.Aidl.Include_dirs
-	props.Aidl.Local_include_dirs = module.Library.Module.deviceProperties.Aidl.Local_include_dirs
-	props.Java_version = module.Library.Module.properties.Java_version
+	props.Libs = module.properties.Libs
+	props.Libs = append(props.Libs, module.properties.Static_libs...)
+	props.Aidl.Include_dirs = module.deviceProperties.Aidl.Include_dirs
+	props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs
+	props.Java_version = module.properties.Java_version
 
 	props.Merge_annotations_dirs = module.sdkLibraryProperties.Merge_annotations_dirs
 	props.Merge_inclusion_annotations_dirs = module.sdkLibraryProperties.Merge_inclusion_annotations_dirs
@@ -980,29 +971,15 @@
 // Creates the xml file that publicizes the runtime library
 func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
 	props := struct {
-		Name                *string
-		Lib_name            *string
-		Soc_specific        *bool
-		Device_specific     *bool
-		Product_specific    *bool
-		System_ext_specific *bool
-		Apex_available      []string
+		Name           *string
+		Lib_name       *string
+		Apex_available []string
 	}{
 		Name:           proptools.StringPtr(module.xmlFileName()),
 		Lib_name:       proptools.StringPtr(module.BaseModuleName()),
 		Apex_available: module.ApexProperties.Apex_available,
 	}
 
-	if module.SocSpecific() {
-		props.Soc_specific = proptools.BoolPtr(true)
-	} else if module.DeviceSpecific() {
-		props.Device_specific = proptools.BoolPtr(true)
-	} else if module.ProductSpecific() {
-		props.Product_specific = proptools.BoolPtr(true)
-	} else if module.SystemExtSpecific() {
-		props.System_ext_specific = proptools.BoolPtr(true)
-	}
-
 	mctx.CreateModule(sdkLibraryXmlFactory, &props)
 }
 
@@ -1044,9 +1021,9 @@
 	} else {
 		if !sdkVersion.specified() {
 			if headerJars {
-				return module.Library.HeaderJars()
+				return module.HeaderJars()
 			} else {
-				return module.Library.ImplementationJars()
+				return module.ImplementationJars()
 			}
 		}
 		var apiScope *apiScope
@@ -1056,7 +1033,7 @@
 		case sdkTest:
 			apiScope = apiScopeTest
 		case sdkPrivate:
-			return module.Library.HeaderJars()
+			return module.HeaderJars()
 		default:
 			apiScope = apiScopePublic
 		}
@@ -1105,7 +1082,7 @@
 		return
 	}
 
-	if len(module.Library.Module.properties.Srcs) == 0 {
+	if len(module.properties.Srcs) == 0 {
 		mctx.PropertyErrorf("srcs", "java_sdk_library must specify srcs")
 		return
 	}
@@ -1186,14 +1163,14 @@
 func (module *SdkLibrary) InitSdkLibraryProperties() {
 	module.AddProperties(
 		&module.sdkLibraryProperties,
-		&module.Library.Module.properties,
-		&module.Library.Module.dexpreoptProperties,
-		&module.Library.Module.deviceProperties,
-		&module.Library.Module.protoProperties,
+		&module.properties,
+		&module.dexpreoptProperties,
+		&module.deviceProperties,
+		&module.protoProperties,
 	)
 
-	module.Library.Module.properties.Installable = proptools.BoolPtr(true)
-	module.Library.Module.deviceProperties.IsSDKLibrary = true
+	module.properties.Installable = proptools.BoolPtr(true)
+	module.deviceProperties.IsSDKLibrary = true
 }
 
 // Defines how to name the individual component modules the sdk library creates.
@@ -1423,15 +1400,11 @@
 func (module *sdkLibraryImport) createJavaImportForStubs(mctx android.DefaultableHookContext, apiScope *apiScope, scopeProperties *sdkLibraryScopeProperties) {
 	// Creates a java import for the jar with ".stubs" suffix
 	props := struct {
-		Name                *string
-		Soc_specific        *bool
-		Device_specific     *bool
-		Product_specific    *bool
-		System_ext_specific *bool
-		Sdk_version         *string
-		Libs                []string
-		Jars                []string
-		Prefer              *bool
+		Name        *string
+		Sdk_version *string
+		Libs        []string
+		Jars        []string
+		Prefer      *bool
 	}{}
 	props.Name = proptools.StringPtr(module.stubsLibraryModuleName(apiScope))
 	props.Sdk_version = scopeProperties.Sdk_version
@@ -1439,31 +1412,24 @@
 	// scopes to avoid having to duplicate them in each scope.
 	props.Libs = append(module.properties.Libs, scopeProperties.Libs...)
 	props.Jars = scopeProperties.Jars
-	if module.SocSpecific() {
-		props.Soc_specific = proptools.BoolPtr(true)
-	} else if module.DeviceSpecific() {
-		props.Device_specific = proptools.BoolPtr(true)
-	} else if module.ProductSpecific() {
-		props.Product_specific = proptools.BoolPtr(true)
-	} else if module.SystemExtSpecific() {
-		props.System_ext_specific = proptools.BoolPtr(true)
-	}
-	// If the build should use prebuilt sdks then set prefer to true on the stubs library.
-	// That will cause the prebuilt version of the stubs to override the source version.
-	if mctx.Config().UnbundledBuildUsePrebuiltSdks() {
-		props.Prefer = proptools.BoolPtr(true)
-	}
+
+	// The imports are preferred if the java_sdk_library_import is preferred.
+	props.Prefer = proptools.BoolPtr(module.prebuilt.Prefer())
 	mctx.CreateModule(ImportFactory, &props)
 }
 
 func (module *sdkLibraryImport) createPrebuiltStubsSources(mctx android.DefaultableHookContext, apiScope *apiScope, scopeProperties *sdkLibraryScopeProperties) {
 	props := struct {
-		Name *string
-		Srcs []string
+		Name   *string
+		Srcs   []string
+		Prefer *bool
 	}{}
 	props.Name = proptools.StringPtr(module.stubsSourceModuleName(apiScope))
 	props.Srcs = scopeProperties.Stub_srcs
 	mctx.CreateModule(PrebuiltStubsSourcesFactory, &props)
+
+	// The stubs source is preferred if the java_sdk_library_import is preferred.
+	props.Prefer = proptools.BoolPtr(module.prebuilt.Prefer())
 }
 
 func (module *sdkLibraryImport) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -1667,6 +1633,9 @@
 
 	// The Java stubs source files.
 	Stub_srcs []string
+
+	// The naming scheme.
+	Naming_scheme *string
 }
 
 type scopeProperties struct {
@@ -1696,12 +1665,17 @@
 	}
 
 	s.Libs = sdk.properties.Libs
+	s.Naming_scheme = sdk.commonProperties.Naming_scheme
 }
 
 func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
+	if s.Naming_scheme != nil {
+		propertySet.AddProperty("naming_scheme", proptools.String(s.Naming_scheme))
+	}
+
 	for _, apiScope := range allApiScopes {
 		if properties, ok := s.Scopes[apiScope]; ok {
-			scopeSet := propertySet.AddPropertySet(apiScope.name)
+			scopeSet := propertySet.AddPropertySet(apiScope.propertyName)
 
 			scopeDir := filepath.Join("sdk_library", s.OsPrefix(), apiScope.name)
 
diff --git a/java/testing.go b/java/testing.go
index 0bb0c10..1967148 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -110,6 +110,8 @@
 		"prebuilts/apk/app_xhdpi.apk":  nil,
 		"prebuilts/apk/app_xxhdpi.apk": nil,
 
+		"prebuilts/apks/app.apks": nil,
+
 		// For framework-res, which is an implicit dependency for framework
 		"AndroidManifest.xml":                        nil,
 		"build/make/target/product/security/testkey": nil,
@@ -134,6 +136,7 @@
 
 		"cert/new_cert.x509.pem": nil,
 		"cert/new_cert.pk8":      nil,
+		"lineage.bin":            nil,
 
 		"testdata/data": nil,
 
diff --git a/scripts/build-mainline-modules.sh b/scripts/build-mainline-modules.sh
index 770adc9..f836ea9 100755
--- a/scripts/build-mainline-modules.sh
+++ b/scripts/build-mainline-modules.sh
@@ -19,6 +19,7 @@
   conscrypt-module-sdk
   conscrypt-module-test-exports
   conscrypt-module-host-exports
+  runtime-module-sdk
 )
 
 # We want to create apex modules for all supported architectures.
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 436fd9d..bbd6384 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -1328,10 +1328,10 @@
         sdk_version: "system_current",
     },
     module_lib: {
-        jars: ["sdk_library/module_lib/myjavalib-stubs.jar"],
-        stub_srcs: ["sdk_library/module_lib/myjavalib_stub_sources"],
-        current_api: "sdk_library/module_lib/myjavalib.txt",
-        removed_api: "sdk_library/module_lib/myjavalib-removed.txt",
+        jars: ["sdk_library/module-lib/myjavalib-stubs.jar"],
+        stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"],
+        current_api: "sdk_library/module-lib/myjavalib.txt",
+        removed_api: "sdk_library/module-lib/myjavalib-removed.txt",
         sdk_version: "module_current",
     },
 }
@@ -1355,10 +1355,10 @@
         sdk_version: "system_current",
     },
     module_lib: {
-        jars: ["sdk_library/module_lib/myjavalib-stubs.jar"],
-        stub_srcs: ["sdk_library/module_lib/myjavalib_stub_sources"],
-        current_api: "sdk_library/module_lib/myjavalib.txt",
-        removed_api: "sdk_library/module_lib/myjavalib-removed.txt",
+        jars: ["sdk_library/module-lib/myjavalib-stubs.jar"],
+        stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"],
+        current_api: "sdk_library/module-lib/myjavalib.txt",
+        removed_api: "sdk_library/module-lib/myjavalib-removed.txt",
         sdk_version: "module_current",
     },
 }
@@ -1375,14 +1375,81 @@
 .intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
 .intermediates/myjavalib.stubs.source.system/android_common/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
 .intermediates/myjavalib.stubs.source.system/android_common/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.module_lib/android_common/javac/myjavalib.stubs.module_lib.jar -> sdk_library/module_lib/myjavalib-stubs.jar
-.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module_lib/myjavalib.txt
-.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module_lib/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.module_lib/android_common/javac/myjavalib.stubs.module_lib.jar -> sdk_library/module-lib/myjavalib-stubs.jar
+.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module-lib/myjavalib.txt
+.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module-lib/myjavalib-removed.txt
 `),
 		checkMergeZips(
 			".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
 			".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip",
-			".intermediates/mysdk/common_os/tmp/sdk_library/module_lib/myjavalib_stub_sources.zip",
+			".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip",
+		),
+	)
+}
+
+func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
+	result := testSdkWithJava(t, `
+		sdk {
+			name: "mysdk",
+			java_sdk_libs: ["myjavalib"],
+		}
+
+		java_sdk_library {
+			name: "myjavalib",
+			apex_available: ["//apex_available:anyapex"],
+			srcs: ["Test.java"],
+			sdk_version: "current",
+			naming_scheme: "framework-modules",
+			public: {
+				enabled: true,
+			},
+		}
+	`)
+
+	result.CheckSnapshot("mysdk", "",
+		checkAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+java_sdk_library_import {
+    name: "mysdk_myjavalib@current",
+    sdk_member_name: "myjavalib",
+    apex_available: ["//apex_available:anyapex"],
+    naming_scheme: "framework-modules",
+    public: {
+        jars: ["sdk_library/public/myjavalib-stubs.jar"],
+        stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+        current_api: "sdk_library/public/myjavalib.txt",
+        removed_api: "sdk_library/public/myjavalib-removed.txt",
+        sdk_version: "current",
+    },
+}
+
+java_sdk_library_import {
+    name: "myjavalib",
+    prefer: false,
+    apex_available: ["//apex_available:anyapex"],
+    naming_scheme: "framework-modules",
+    public: {
+        jars: ["sdk_library/public/myjavalib-stubs.jar"],
+        stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+        current_api: "sdk_library/public/myjavalib.txt",
+        removed_api: "sdk_library/public/myjavalib-removed.txt",
+        sdk_version: "current",
+    },
+}
+
+sdk_snapshot {
+    name: "mysdk@current",
+    java_sdk_libs: ["mysdk_myjavalib@current"],
+}
+`),
+		checkAllCopyRules(`
+.intermediates/myjavalib-stubs-publicapi/android_common/javac/myjavalib-stubs-publicapi.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib-stubs-srcs-publicapi/android_common/myjavalib-stubs-srcs-publicapi_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib-stubs-srcs-publicapi/android_common/myjavalib-stubs-srcs-publicapi_api.txt -> sdk_library/public/myjavalib-removed.txt
+`),
+		checkMergeZips(
+			".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
 		),
 	)
 }
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index ae1a492..56be741 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -103,6 +103,7 @@
 				"myjavalib",
 				"mypublicjavalib",
 				"mydefaultedjavalib",
+				"myprivatejavalib",
 			],
 		}
 
@@ -140,6 +141,14 @@
 			system_modules: "none",
 			sdk_version: "none",
 		}
+
+		java_library {
+			name: "myprivatejavalib",
+			srcs: ["Test.java"],
+			visibility: ["//visibility:private"],
+			system_modules: "none",
+			sdk_version: "none",
+		}
 	`
 
 	result := testSdkWithFs(t, ``,
@@ -155,14 +164,20 @@
 java_import {
     name: "mysdk_myjavalib@current",
     sdk_member_name: "myjavalib",
-    visibility: ["//other/foo:__pkg__"],
+    visibility: [
+        "//other/foo",
+        "//package",
+    ],
     jars: ["java/myjavalib.jar"],
 }
 
 java_import {
     name: "myjavalib",
     prefer: false,
-    visibility: ["//other/foo:__pkg__"],
+    visibility: [
+        "//other/foo",
+        "//package",
+    ],
     jars: ["java/myjavalib.jar"],
 }
 
@@ -183,27 +198,48 @@
 java_import {
     name: "mysdk_mydefaultedjavalib@current",
     sdk_member_name: "mydefaultedjavalib",
-    visibility: ["//other/bar:__pkg__"],
+    visibility: [
+        "//other/bar",
+        "//package",
+    ],
     jars: ["java/mydefaultedjavalib.jar"],
 }
 
 java_import {
     name: "mydefaultedjavalib",
     prefer: false,
-    visibility: ["//other/bar:__pkg__"],
+    visibility: [
+        "//other/bar",
+        "//package",
+    ],
     jars: ["java/mydefaultedjavalib.jar"],
 }
 
+java_import {
+    name: "mysdk_myprivatejavalib@current",
+    sdk_member_name: "myprivatejavalib",
+    visibility: ["//package"],
+    jars: ["java/myprivatejavalib.jar"],
+}
+
+java_import {
+    name: "myprivatejavalib",
+    prefer: false,
+    visibility: ["//package"],
+    jars: ["java/myprivatejavalib.jar"],
+}
+
 sdk_snapshot {
     name: "mysdk@current",
     visibility: [
-        "//other/foo:__pkg__",
+        "//other/foo",
         "//package:__subpackages__",
     ],
     java_header_libs: [
         "mysdk_myjavalib@current",
         "mysdk_mypublicjavalib@current",
         "mysdk_mydefaultedjavalib@current",
+        "mysdk_myprivatejavalib@current",
     ],
 }
 `))
diff --git a/tradefed/autogen.go b/tradefed/autogen.go
index 596284b..be44cac 100644
--- a/tradefed/autogen.go
+++ b/tradefed/autogen.go
@@ -219,31 +219,39 @@
 }
 
 var autogenInstrumentationTest = pctx.StaticRule("autogenInstrumentationTest", blueprint.RuleParams{
-	Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} $template",
+	Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} $template ${extraConfigs}",
 	CommandDeps: []string{
 		"${AutoGenTestConfigScript}",
 		"${EmptyTestConfig}",
 		"$template",
 	},
-}, "name", "template")
+}, "name", "template", "extraConfigs")
 
 func AutoGenInstrumentationTestConfig(ctx android.ModuleContext, testConfigProp *string,
-	testConfigTemplateProp *string, manifest android.Path, testSuites []string, autoGenConfig *bool) android.Path {
+	testConfigTemplateProp *string, manifest android.Path, testSuites []string, autoGenConfig *bool, configs []Config) android.Path {
 	path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
+	var configStrings []string
 	if autogenPath != nil {
 		template := "${InstrumentationTestConfigTemplate}"
 		moduleTemplate := getTestConfigTemplate(ctx, testConfigTemplateProp)
 		if moduleTemplate.Valid() {
 			template = moduleTemplate.String()
 		}
+		for _, config := range configs {
+			configStrings = append(configStrings, config.Config())
+		}
+		extraConfigs := strings.Join(configStrings, fmt.Sprintf("\\n%s", test_xml_indent))
+		extraConfigs = fmt.Sprintf("--extra-configs '%s'", extraConfigs)
+
 		ctx.Build(pctx, android.BuildParams{
 			Rule:        autogenInstrumentationTest,
 			Description: "test config",
 			Input:       manifest,
 			Output:      autogenPath,
 			Args: map[string]string{
-				"name":     ctx.ModuleName(),
-				"template": template,
+				"name":         ctx.ModuleName(),
+				"template":     template,
+				"extraConfigs": extraConfigs,
 			},
 		})
 		return autogenPath