Merge "Make globs compatible with hash-based ninja semantics" into main
diff --git a/aconfig/codegen/cc_aconfig_library.go b/aconfig/codegen/cc_aconfig_library.go
index ec0a6b6..b5cf687 100644
--- a/aconfig/codegen/cc_aconfig_library.go
+++ b/aconfig/codegen/cc_aconfig_library.go
@@ -156,7 +156,7 @@
 		Args: map[string]string{
 			"gendir": this.generatedDir.String(),
 			"mode":   mode,
-			"debug":  strconv.FormatBool(ctx.Config().ReleaseReadFromNewStorageCc()),
+			"debug":  strconv.FormatBool(ctx.Config().ReleaseReadFromNewStorage()),
 		},
 	})
 
diff --git a/aconfig/codegen/init.go b/aconfig/codegen/init.go
index 6182e14..98d288f 100644
--- a/aconfig/codegen/init.go
+++ b/aconfig/codegen/init.go
@@ -64,11 +64,12 @@
 				` && ${aconfig} create-rust-lib` +
 				`    --mode ${mode}` +
 				`    --cache ${in}` +
+				`    --allow-instrumentation ${debug}` +
 				`    --out ${gendir}`,
 			CommandDeps: []string{
 				"$aconfig",
 			},
-		}, "gendir", "mode")
+		}, "gendir", "mode", "debug")
 )
 
 func init() {
diff --git a/aconfig/codegen/rust_aconfig_library.go b/aconfig/codegen/rust_aconfig_library.go
index ad8d632..4b896c3 100644
--- a/aconfig/codegen/rust_aconfig_library.go
+++ b/aconfig/codegen/rust_aconfig_library.go
@@ -2,6 +2,7 @@
 
 import (
 	"fmt"
+	"strconv"
 
 	"android/soong/android"
 	"android/soong/rust"
@@ -82,6 +83,7 @@
 		Args: map[string]string{
 			"gendir": generatedDir.String(),
 			"mode":   mode,
+			"debug":  strconv.FormatBool(ctx.Config().ReleaseReadFromNewStorage()),
 		},
 	})
 	a.BaseSourceProvider.OutputFiles = android.Paths{generatedSource}
diff --git a/android/api_levels.go b/android/api_levels.go
index dc17238..2b1d01d 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -444,26 +444,27 @@
 
 func getApiLevelsMapReleasedVersions() (map[string]int, error) {
 	return map[string]int{
-		"G":              9,
-		"I":              14,
-		"J":              16,
-		"J-MR1":          17,
-		"J-MR2":          18,
-		"K":              19,
-		"L":              21,
-		"L-MR1":          22,
-		"M":              23,
-		"N":              24,
-		"N-MR1":          25,
-		"O":              26,
-		"O-MR1":          27,
-		"P":              28,
-		"Q":              29,
-		"R":              30,
-		"S":              31,
-		"S-V2":           32,
-		"Tiramisu":       33,
-		"UpsideDownCake": 34,
+		"G":               9,
+		"I":               14,
+		"J":               16,
+		"J-MR1":           17,
+		"J-MR2":           18,
+		"K":               19,
+		"L":               21,
+		"L-MR1":           22,
+		"M":               23,
+		"N":               24,
+		"N-MR1":           25,
+		"O":               26,
+		"O-MR1":           27,
+		"P":               28,
+		"Q":               29,
+		"R":               30,
+		"S":               31,
+		"S-V2":            32,
+		"Tiramisu":        33,
+		"UpsideDownCake":  34,
+		"VanillaIceCream": 35,
 	}, nil
 }
 
diff --git a/android/config.go b/android/config.go
index 8f6d740..b682c2e 100644
--- a/android/config.go
+++ b/android/config.go
@@ -270,6 +270,11 @@
 		Bool(c.config.productVariables.HiddenapiExportableStubs)
 }
 
+// Enable read flag from new storage
+func (c Config) ReleaseReadFromNewStorage() bool {
+	return c.config.productVariables.GetBuildFlagBool("RELEASE_READ_FROM_NEW_STORAGE")
+}
+
 // A DeviceConfig object represents the configuration for a particular device
 // being built. For now there will only be one of these, but in the future there
 // may be multiple devices being built.
@@ -1823,10 +1828,6 @@
 	return c.config.productVariables.BuildBrokenTrebleSyspropNeverallow
 }
 
-func (c *deviceConfig) BuildBrokenUsesSoongPython2Modules() bool {
-	return c.config.productVariables.BuildBrokenUsesSoongPython2Modules
-}
-
 func (c *deviceConfig) BuildDebugfsRestrictionsEnabled() bool {
 	return c.config.productVariables.BuildDebugfsRestrictionsEnabled
 }
diff --git a/android/container_violations.go b/android/container_violations.go
index e67533d..4251484 100644
--- a/android/container_violations.go
+++ b/android/container_violations.go
@@ -169,6 +169,10 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsAppStartTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsAppTestStubsApp2": {
 		"framework", // cts -> unstable
 	},
@@ -273,6 +277,10 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsDocumentContentTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsDreamsTestCases": {
 		"framework", // cts -> unstable
 	},
@@ -281,6 +289,10 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsEmptyTestApp_RejectedByVerifier": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsEphemeralTestsEphemeralApp1": {
 		"framework", // cts -> unstable
 	},
@@ -301,10 +313,18 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsFgsTimeoutTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsFileDescriptorTestCases": {
 		"framework", // cts -> unstable
 	},
 
+	"CtsFingerprintTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsHostsideCompatChangeTestsApp": {
 		"framework", // cts -> unstable
 	},
@@ -433,6 +453,10 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsMediaProviderTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsMediaProviderTranscodeTests": {
 		"framework", // cts -> unstable
 	},
@@ -501,6 +525,10 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsOnDeviceIntelligenceServiceTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsOnDevicePersonalizationTestCases": {
 		"framework", // cts -> unstable
 	},
@@ -521,6 +549,10 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsPackageWatchdogTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsPermissionsSyncTestApp": {
 		"framework", // cts -> unstable
 	},
@@ -669,6 +701,10 @@
 		"framework", // cts -> unstable
 	},
 
+	"CtsTvTunerTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"CtsUsageStatsTestCases": {
 		"framework", // cts -> unstable
 	},
@@ -799,6 +835,11 @@
 		"ondevicepersonalization_flags_lib", // apex [com.android.ondevicepersonalization] -> system
 	},
 
+	"framework-pdf-v.impl": {
+		"app-compat-annotations",      // apex [com.android.mediaprovider, test_com.android.mediaprovider] -> system
+		"modules-utils-preconditions", // apex [com.android.mediaprovider, test_com.android.mediaprovider] -> apex [com.android.adservices, com.android.appsearch, com.android.cellbroadcast, com.android.extservices, com.android.ondevicepersonalization, com.android.tethering, com.android.uwb, com.android.wifi, test_com.android.cellbroadcast, test_com.android.wifi]
+	},
+
 	"framework-pdf.impl": {
 		"modules-utils-preconditions", // apex [com.android.mediaprovider, test_com.android.mediaprovider] -> apex [com.android.adservices, com.android.appsearch, com.android.cellbroadcast, com.android.extservices, com.android.ondevicepersonalization, com.android.tethering, com.android.uwb, com.android.wifi, test_com.android.cellbroadcast, test_com.android.wifi]
 	},
@@ -837,14 +878,54 @@
 		"libnativeloader_vendor_shared_lib", // system -> vendor
 	},
 
+	"MctsMediaBetterTogetherTestCases": {
+		"framework", // cts -> unstable
+	},
+
+	"MctsMediaCodecTestCases": {
+		"framework", // cts -> unstable
+	},
+
+	"MctsMediaDecoderTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"MctsMediaDrmFrameworkTestCases": {
 		"framework", // cts -> unstable
 	},
 
+	"MctsMediaEncoderTestCases": {
+		"framework", // cts -> unstable
+	},
+
+	"MctsMediaExtractorTestCases": {
+		"framework", // cts -> unstable
+	},
+
+	"MctsMediaMiscTestCases": {
+		"framework", // cts -> unstable
+	},
+
+	"MctsMediaMuxerTestCases": {
+		"framework", // cts -> unstable
+	},
+
+	"MctsMediaPlayerTestCases": {
+		"framework", // cts -> unstable
+	},
+
+	"MctsMediaRecorderTestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"MctsMediaTranscodingTestCases": {
 		"framework", // cts -> unstable
 	},
 
+	"MctsMediaV2TestCases": {
+		"framework", // cts -> unstable
+	},
+
 	"MediaProvider": {
 		"app-compat-annotations", // apex [com.android.mediaprovider, test_com.android.mediaprovider] -> system
 	},
diff --git a/android/singleton_module.go b/android/singleton_module.go
index 2351738..43028e8 100644
--- a/android/singleton_module.go
+++ b/android/singleton_module.go
@@ -68,7 +68,7 @@
 func (smb *SingletonModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) {
 	smb.lock.Lock()
 	if smb.variant != "" {
-		ctx.ModuleErrorf("GenerateAndroidBuildActions already called for variant %q, SingletonModules can only  have one variant", smb.variant)
+		ctx.ModuleErrorf("GenerateAndroidBuildActions already called for variant %q, SingletonModules can only have one variant", smb.variant)
 	}
 	smb.variant = ctx.ModuleSubDir()
 	smb.lock.Unlock()
diff --git a/android/updatable_modules.go b/android/updatable_modules.go
index dd7dc2c..d2595ed 100644
--- a/android/updatable_modules.go
+++ b/android/updatable_modules.go
@@ -33,4 +33,4 @@
 // * AOSP            - xx9990000
 // * x-mainline-prod - xx9990000
 // * master          - 990090000
-const DefaultUpdatableModuleVersion = "350090000"
+const DefaultUpdatableModuleVersion = "352090000"
diff --git a/android/variable.go b/android/variable.go
index 9026f93..8ca75ee 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -445,7 +445,6 @@
 	GenruleSandboxing                   *bool    `json:",omitempty"`
 	BuildBrokenEnforceSyspropOwner      bool     `json:",omitempty"`
 	BuildBrokenTrebleSyspropNeverallow  bool     `json:",omitempty"`
-	BuildBrokenUsesSoongPython2Modules  bool     `json:",omitempty"`
 	BuildBrokenVendorPropertyNamespace  bool     `json:",omitempty"`
 	BuildBrokenIncorrectPartitionImages bool     `json:",omitempty"`
 	BuildBrokenInputDirModules          []string `json:",omitempty"`
diff --git a/cc/check.go b/cc/check.go
index e3af3b2..fa1926d 100644
--- a/cc/check.go
+++ b/cc/check.go
@@ -40,6 +40,8 @@
 			ctx.PropertyErrorf(prop, "Bad flag: `%s`, use native_coverage instead", flag)
 		} else if flag == "-fwhole-program-vtables" {
 			ctx.PropertyErrorf(prop, "Bad flag: `%s`, use whole_program_vtables instead", flag)
+		} else if flag == "-fno-integrated-as" {
+			ctx.PropertyErrorf("Bad flag: `%s` is disallowed as it may invoke the `as` from the build host", flag)
 		} else if flag == "-Weverything" {
 			if !ctx.Config().IsEnvTrue("ANDROID_TEMPORARILY_ALLOW_WEVERYTHING") {
 				ctx.PropertyErrorf(prop, "-Weverything is not allowed in Android.bp files.  "+
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 5c7ef43..a8f97e3 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -136,6 +136,9 @@
 	// Install aconfig_flags.pb file for the modules installed in this partition.
 	Gen_aconfig_flags_pb *bool
 
+	// Update the Base_dir of the $PRODUCT_OUT directory with the packaging files.
+	Update_product_out *bool
+
 	Fsverity fsverityProperties
 }
 
@@ -331,6 +334,14 @@
 	return f.CopySpecsToDirs(ctx, builder, dirsToSpecs)
 }
 
+func (f *filesystem) copyFilesToProductOut(ctx android.ModuleContext, builder *android.RuleBuilder, rebasedDir android.OutputPath) {
+	if !proptools.Bool(f.properties.Update_product_out) {
+		return
+	}
+	installPath := android.PathForModuleInPartitionInstall(ctx, f.partitionName())
+	builder.Command().Textf("cp -prf %s/* %s", rebasedDir, installPath)
+}
+
 func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) android.OutputPath {
 	rootDir := android.PathForModuleOut(ctx, "root").OutputPath
 	rebasedDir := rootDir
@@ -348,6 +359,7 @@
 	f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
 	f.buildEventLogtagsFile(ctx, builder, rebasedDir)
 	f.buildAconfigFlagsFiles(ctx, builder, specs, rebasedDir)
+	f.copyFilesToProductOut(ctx, builder, rebasedDir)
 
 	// run host_init_verifier
 	// Ideally we should have a concept of pluggable linters that verify the generated image.
@@ -490,6 +502,7 @@
 	f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
 	f.buildEventLogtagsFile(ctx, builder, rebasedDir)
 	f.buildAconfigFlagsFiles(ctx, builder, specs, rebasedDir)
+	f.copyFilesToProductOut(ctx, builder, rebasedDir)
 
 	output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
 	cmd := builder.Command().
diff --git a/genrule/allowlists.go b/genrule/allowlists.go
index 4f1b320..45a7f72 100644
--- a/genrule/allowlists.go
+++ b/genrule/allowlists.go
@@ -17,7 +17,6 @@
 var (
 	SandboxingDenyModuleList = []string{
 		// go/keep-sorted start
-		"com.google.pixel.camera.hal.manifest",
 		// go/keep-sorted end
 	}
 )
diff --git a/java/base.go b/java/base.go
index 050b5e2..ef299b2 100644
--- a/java/base.go
+++ b/java/base.go
@@ -99,9 +99,6 @@
 	// if not blank, used as prefix to generate repackage rule
 	Jarjar_prefix *string
 
-	// if set to true, skip the jarjar repackaging
-	Skip_jarjar_repackage *bool
-
 	// If not blank, set the java version passed to javac as -source and -target
 	Java_version *string
 
@@ -1159,13 +1156,11 @@
 	jarjarProviderData := j.collectJarJarRules(ctx)
 	if jarjarProviderData != nil {
 		android.SetProvider(ctx, JarJarProvider, *jarjarProviderData)
-		if !proptools.Bool(j.properties.Skip_jarjar_repackage) {
-			text := getJarJarRuleText(jarjarProviderData)
-			if text != "" {
-				ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt")
-				android.WriteFileRule(ctx, ruleTextFile, text)
-				j.repackageJarjarRules = ruleTextFile
-			}
+		text := getJarJarRuleText(jarjarProviderData)
+		if text != "" {
+			ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt")
+			android.WriteFileRule(ctx, ruleTextFile, text)
+			j.repackageJarjarRules = ruleTextFile
 		}
 	}
 
@@ -1668,6 +1663,8 @@
 			Output:      ravenizerOutput,
 		})
 		outputFile = ravenizerOutput
+		localImplementationJars = android.Paths{ravenizerOutput}
+		completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil)
 	}
 
 	if j.shouldApiMapper() {
@@ -1680,6 +1677,8 @@
 			Output:      apiMapperFile,
 		})
 		outputFile = apiMapperFile
+		localImplementationJars = android.Paths{apiMapperFile}
+		completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil)
 	}
 
 	// Check package restrictions if necessary.
@@ -1701,6 +1700,8 @@
 			Validation: pkgckFile,
 		})
 		outputFile = packageCheckOutputFile
+		localImplementationJars = android.Paths{packageCheckOutputFile}
+		completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil)
 
 		// Check packages and create a timestamp file when complete.
 		CheckJarPackages(ctx, pkgckFile, outputFile, j.properties.Permitted_packages)
diff --git a/java/config/config.go b/java/config/config.go
index a50c1b4..c28e070 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -52,6 +52,7 @@
 		"core-icu4j",
 		"core-oj",
 		"core-libart",
+		"wear-sdk.impl",
 	}
 )
 
diff --git a/python/python.go b/python/python.go
index 8726f02..01ac86c 100644
--- a/python/python.go
+++ b/python/python.go
@@ -264,10 +264,9 @@
 			variants = append(variants, pyVersion3)
 		}
 		if proptools.BoolDefault(props.Version.Py2.Enabled, false) {
-			if !ctx.DeviceConfig().BuildBrokenUsesSoongPython2Modules() &&
-				ctx.ModuleName() != "py2-cmd" &&
+			if ctx.ModuleName() != "py2-cmd" &&
 				ctx.ModuleName() != "py2-stdlib" {
-				ctx.PropertyErrorf("version.py2.enabled", "Python 2 is no longer supported, please convert to python 3. This error can be temporarily overridden by setting BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES := true in the product configuration")
+				ctx.PropertyErrorf("version.py2.enabled", "Python 2 is no longer supported, please convert to python 3.")
 			}
 			variants = append(variants, pyVersion2)
 		}
diff --git a/scripts/check_boot_jars/package_allowed_list.txt b/scripts/check_boot_jars/package_allowed_list.txt
index bb88cce..1d2fc64 100644
--- a/scripts/check_boot_jars/package_allowed_list.txt
+++ b/scripts/check_boot_jars/package_allowed_list.txt
@@ -3,7 +3,52 @@
 
 ###################################################
 # core-libart.jar & core-oj.jar
-java(\..*)?
+java\.awt\.font
+java\.beans
+java\.io
+java\.lang
+java\.lang\.annotation
+java\.lang\.constant
+java\.lang\.invoke
+java\.lang\.ref
+java\.lang\.reflect
+java\.lang\.runtime
+java\.math
+java\.net
+java\.nio
+java\.nio\.file
+java\.nio\.file\.spi
+java\.nio\.file\.attribute
+java\.nio\.channels
+java\.nio\.channels\.spi
+java\.nio\.charset
+java\.nio\.charset\.spi
+java\.security
+java\.security\.acl
+java\.security\.cert
+java\.security\.interfaces
+java\.security\.spec
+java\.sql
+java\.text
+java\.text\.spi
+java\.time
+java\.time\.chrono
+java\.time\.format
+java\.time\.temporal
+java\.time\.zone
+java\.util
+java\.util\.concurrent
+java\.util\.concurrent\.atomic
+java\.util\.concurrent\.locks
+java\.util\.function
+java\.util\.jar
+java\.util\.logging
+java\.util\.prefs
+java\.util\.random
+java\.util\.regex
+java\.util\.spi
+java\.util\.stream
+java\.util\.zip
 # TODO: Remove javax.annotation.processing if possible, see http://b/132338110:
 javax\.annotation\.processing
 javax\.crypto
@@ -27,7 +72,20 @@
 javax\.xml\.transform\.stream
 javax\.xml\.validation
 javax\.xml\.xpath
-jdk\..*
+jdk\.internal
+jdk\.internal\.access
+jdk\.internal\.event
+jdk\.internal\.math
+jdk\.internal\.misc
+jdk\.internal\.ref
+jdk\.internal\.reflect
+jdk\.internal\.util
+jdk\.internal\.util\.jar
+jdk\.internal\.util\.random
+jdk\.internal\.vm
+jdk\.internal\.vm\.annotation
+jdk\.net
+jdk\.random
 org\.w3c\.dom
 org\.w3c\.dom\.ls
 org\.w3c\.dom\.traversal
diff --git a/sdk/update.go b/sdk/update.go
index 9379f36..93bb861 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -1118,12 +1118,14 @@
 		// Since module sdks are generated from release branches and dropped to development
 		// branches, there might be a visibility skew between the sources and prebuilts
 		// of a specific module.
-		// To reconcile this potential skew, change the visibility to public
+		// To reconcile this potential skew, change the visibility to public.
 		//
-		// This is safe for (1) since these are stub libraries.
-		// This is ok for (2) since these are host and test exports and are intended for
-		// ART development.
-		// TODO (b/361303067): This can be removed if ART uses full manifests.
+		// This means dependencies can bypass visibility restrictions when prebuilts are used, so we rely
+		// on source builds in CI to check them.
+		//
+		// TODO (b/361303067): This special case for category (2) can be removed if existing usages
+		// of host/test prebuilts of modules like conscrypt,tzdata,i18n are switched to source builds.
+		// It will also require ART switching to full manifests.
 		m.AddProperty("visibility", []string{"//visibility:public"})
 	}
 
diff --git a/ui/build/build.go b/ui/build/build.go
index 49ac791..28c3284 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -80,7 +80,7 @@
 		if username, ok = config.environ.Get("BUILD_USERNAME"); !ok {
 			ctx.Fatalln("Missing BUILD_USERNAME")
 		}
-		buildNumber = fmt.Sprintf("eng.%.6s.00000000.000000", username)
+		buildNumber = fmt.Sprintf("eng.%.6s", username)
 		writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", username)
 	}
 	// Write the build number to a file so it can be read back in
diff --git a/ui/build/path.go b/ui/build/path.go
index 075bf2e..cc1d7e9 100644
--- a/ui/build/path.go
+++ b/ui/build/path.go
@@ -125,15 +125,6 @@
 	prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86")
 	myPath = prebuiltsPath + string(os.PathListSeparator) + myPath
 
-	if value, _ := config.Environment().Get("BUILD_BROKEN_PYTHON_IS_PYTHON2"); value == "true" {
-		py2Path, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86/py2")
-		if info, err := os.Stat(py2Path); err == nil && info.IsDir() {
-			myPath = py2Path + string(os.PathListSeparator) + myPath
-		}
-	} else if value != "" {
-		ctx.Fatalf("BUILD_BROKEN_PYTHON_IS_PYTHON2 can only be set to 'true' or an empty string, but got %s\n", value)
-	}
-
 	// Set $PATH to be the directories containing the host tool symlinks, and
 	// the prebuilts directory for the current host OS.
 	config.Environment().Set("PATH", myPath)
@@ -270,15 +261,6 @@
 	prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86")
 	myPath = prebuiltsPath + string(os.PathListSeparator) + myPath
 
-	if value, _ := config.Environment().Get("BUILD_BROKEN_PYTHON_IS_PYTHON2"); value == "true" {
-		py2Path, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86/py2")
-		if info, err := os.Stat(py2Path); err == nil && info.IsDir() {
-			myPath = py2Path + string(os.PathListSeparator) + myPath
-		}
-	} else if value != "" {
-		ctx.Fatalf("BUILD_BROKEN_PYTHON_IS_PYTHON2 can only be set to 'true' or an empty string, but got %s\n", value)
-	}
-
 	// Replace the $PATH variable with the path_interposer symlinks, and
 	// checked-in prebuilts.
 	config.Environment().Set("PATH", myPath)