Revert "Make the enabled property configurable"

Revert submission 27162921-configurable_enabled_property

Reason for revert: Droid-monitor created revert due to Build breakage in b/338253720. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:27162921-configurable_enabled_property

Change-Id: I2d144f9d297373a13a1190b173d10c966181ad84
diff --git a/android/Android.bp b/android/Android.bp
index fa78e15..f130d3a 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -41,7 +41,6 @@
         "buildinfo_prop.go",
         "config.go",
         "test_config.go",
-        "configurable_properties.go",
         "configured_jars.go",
         "csuite_config.go",
         "deapexer.go",
diff --git a/android/androidmk.go b/android/androidmk.go
index 0a366e1..07f7c58 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -849,7 +849,7 @@
 	mod blueprint.Module, provider AndroidMkDataProvider) error {
 
 	amod := mod.(Module).base()
-	if shouldSkipAndroidMkProcessing(ctx, amod) {
+	if shouldSkipAndroidMkProcessing(amod) {
 		return nil
 	}
 
@@ -939,7 +939,7 @@
 
 func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON,
 	mod blueprint.Module, provider AndroidMkEntriesProvider) error {
-	if shouldSkipAndroidMkProcessing(ctx, mod.(Module).base()) {
+	if shouldSkipAndroidMkProcessing(mod.(Module).base()) {
 		return nil
 	}
 
@@ -961,11 +961,11 @@
 	return nil
 }
 
-func ShouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module Module) bool {
-	return shouldSkipAndroidMkProcessing(ctx, module.base())
+func ShouldSkipAndroidMkProcessing(module Module) bool {
+	return shouldSkipAndroidMkProcessing(module.base())
 }
 
-func shouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module *ModuleBase) bool {
+func shouldSkipAndroidMkProcessing(module *ModuleBase) bool {
 	if !module.commonProperties.NamespaceExportedToMake {
 		// TODO(jeffrygaston) do we want to validate that there are no modules being
 		// exported to Kati that depend on this module?
@@ -984,7 +984,7 @@
 		return true
 	}
 
-	return !module.Enabled(ctx) ||
+	return !module.Enabled() ||
 		module.commonProperties.HideFromMake ||
 		// Make does not understand LinuxBionic
 		module.Os() == LinuxBionic ||
diff --git a/android/arch.go b/android/arch.go
index e0c6908..cd8882b 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -486,7 +486,7 @@
 			// dependencies on OsType variants that are explicitly disabled in their
 			// properties. The CommonOS variant will still depend on disabled variants
 			// if they are disabled afterwards, e.g. in archMutator if
-			if module.Enabled(mctx) {
+			if module.Enabled() {
 				mctx.AddInterVariantDependency(commonOsToOsSpecificVariantTag, commonOSVariant, module)
 			}
 		}
@@ -511,7 +511,7 @@
 	var variants []Module
 	mctx.VisitDirectDeps(func(m Module) {
 		if mctx.OtherModuleDependencyTag(m) == commonOsToOsSpecificVariantTag {
-			if m.Enabled(mctx) {
+			if m.Enabled() {
 				variants = append(variants, m)
 			}
 		}
diff --git a/android/arch_test.go b/android/arch_test.go
index f0a58a9..5021a67 100644
--- a/android/arch_test.go
+++ b/android/arch_test.go
@@ -423,7 +423,7 @@
 		variants := ctx.ModuleVariantsForTests(name)
 		for _, variant := range variants {
 			m := ctx.ModuleForTests(name, variant)
-			if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) {
+			if m.Module().Enabled() {
 				ret = append(ret, variant)
 			}
 		}
@@ -533,7 +533,7 @@
 		variants := ctx.ModuleVariantsForTests(name)
 		for _, variant := range variants {
 			m := ctx.ModuleForTests(name, variant)
-			if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) {
+			if m.Module().Enabled() {
 				ret = append(ret, variant)
 			}
 		}
diff --git a/android/base_module_context.go b/android/base_module_context.go
index 2963520..c5fe585 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -325,7 +325,7 @@
 		return nil
 	}
 
-	if !aModule.Enabled(b) {
+	if !aModule.Enabled() {
 		if t, ok := tag.(AllowDisabledModuleDependency); !ok || !t.AllowDisabledModuleDependency(aModule) {
 			if b.Config().AllowMissingDependencies() {
 				b.AddMissingDependencies([]string{b.OtherModuleName(aModule)})
diff --git a/android/configurable_properties.go b/android/configurable_properties.go
deleted file mode 100644
index dad42fa..0000000
--- a/android/configurable_properties.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package android
-
-import "github.com/google/blueprint/proptools"
-
-// CreateSelectOsToBool is a utility function that makes it easy to create a
-// Configurable property value that maps from os to a bool. Use an empty string
-// to indicate a "default" case.
-func CreateSelectOsToBool(cases map[string]*bool) proptools.Configurable[bool] {
-	var resultCases []proptools.ConfigurableCase[bool]
-	for pattern, value := range cases {
-		if pattern == "" {
-			resultCases = append(resultCases, proptools.NewConfigurableCase(
-				[]proptools.ConfigurablePattern{proptools.NewDefaultConfigurablePattern()},
-				value,
-			))
-		} else {
-			resultCases = append(resultCases, proptools.NewConfigurableCase(
-				[]proptools.ConfigurablePattern{proptools.NewStringConfigurablePattern(pattern)},
-				value,
-			))
-		}
-	}
-
-	return proptools.NewConfigurable(
-		[]proptools.ConfigurableCondition{proptools.NewConfigurableCondition("os", nil)},
-		resultCases,
-	)
-}
diff --git a/android/early_module_context.go b/android/early_module_context.go
index 23f4c90..cf1b5fc 100644
--- a/android/early_module_context.go
+++ b/android/early_module_context.go
@@ -173,5 +173,5 @@
 }
 
 func (e *earlyModuleContext) OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{}) {
-	e.EarlyModuleContext.OtherModulePropertyErrorf(module, property, fmt, args...)
+	e.EarlyModuleContext.OtherModulePropertyErrorf(module, property, fmt, args)
 }
diff --git a/android/gen_notice.go b/android/gen_notice.go
index 6815f64..1acc638 100644
--- a/android/gen_notice.go
+++ b/android/gen_notice.go
@@ -62,7 +62,7 @@
 				if mod == nil {
 					continue
 				}
-				if !mod.Enabled(ctx) { // don't depend on variants without build rules
+				if !mod.Enabled() { // don't depend on variants without build rules
 					continue
 				}
 				modules = append(modules, mod)
diff --git a/android/license_metadata.go b/android/license_metadata.go
index d515cdd..eabb1b1 100644
--- a/android/license_metadata.go
+++ b/android/license_metadata.go
@@ -36,7 +36,7 @@
 func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) {
 	base := ctx.Module().base()
 
-	if !base.Enabled(ctx) {
+	if !base.Enabled() {
 		return
 	}
 
@@ -69,7 +69,7 @@
 		if dep == nil {
 			return
 		}
-		if !dep.Enabled(ctx) {
+		if !dep.Enabled() {
 			return
 		}
 
diff --git a/android/makevars.go b/android/makevars.go
index e73645f..4039e7e 100644
--- a/android/makevars.go
+++ b/android/makevars.go
@@ -98,7 +98,6 @@
 	BlueprintFile(module blueprint.Module) string
 
 	ModuleErrorf(module blueprint.Module, format string, args ...interface{})
-	OtherModulePropertyErrorf(module Module, property, format string, args ...interface{})
 	Errorf(format string, args ...interface{})
 
 	VisitAllModules(visit func(Module))
@@ -266,7 +265,7 @@
 	}
 
 	ctx.VisitAllModules(func(m Module) {
-		if provider, ok := m.(ModuleMakeVarsProvider); ok && m.Enabled(ctx) {
+		if provider, ok := m.(ModuleMakeVarsProvider); ok && m.Enabled() {
 			mctx := &makeVarsContext{
 				SingletonContext: ctx,
 			}
diff --git a/android/module.go b/android/module.go
index 5d69ba1..effca03 100644
--- a/android/module.go
+++ b/android/module.go
@@ -60,7 +60,7 @@
 
 	base() *ModuleBase
 	Disable()
-	Enabled(ctx ConfigAndErrorContext) bool
+	Enabled() bool
 	Target() Target
 	MultiTargets() []Target
 
@@ -287,7 +287,7 @@
 	// but are not usually required (e.g. superceded by a prebuilt) should not be
 	// disabled as that will prevent them from being built by the checkbuild target
 	// and so prevent early detection of changes that have broken those modules.
-	Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
+	Enabled *bool `android:"arch_variant"`
 
 	// Controls the visibility of this module to other modules. Allowable values are one or more of
 	// these formats:
@@ -1392,11 +1392,14 @@
 	return partition
 }
 
-func (m *ModuleBase) Enabled(ctx ConfigAndErrorContext) bool {
+func (m *ModuleBase) Enabled() bool {
 	if m.commonProperties.ForcedDisabled {
 		return false
 	}
-	return m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled)
+	if m.commonProperties.Enabled == nil {
+		return !m.Os().DefaultDisabled
+	}
+	return *m.commonProperties.Enabled
 }
 
 func (m *ModuleBase) Disable() {
@@ -1640,7 +1643,7 @@
 		// not be created if the module is not exported to make.
 		// Those could depend on the build target and fail to compile
 		// for the current build target.
-		if !ctx.Config().KatiEnabled() || !shouldSkipAndroidMkProcessing(ctx, a) {
+		if !ctx.Config().KatiEnabled() || !shouldSkipAndroidMkProcessing(a) {
 			allCheckbuildFiles = append(allCheckbuildFiles, a.checkbuildFiles...)
 		}
 	})
@@ -1832,7 +1835,7 @@
 		checkDistProperties(ctx, fmt.Sprintf("dists[%d]", i), &m.distProperties.Dists[i])
 	}
 
-	if m.Enabled(ctx) {
+	if m.Enabled() {
 		// ensure all direct android.Module deps are enabled
 		ctx.VisitDirectDepsBlueprint(func(bm blueprint.Module) {
 			if m, ok := bm.(Module); ok {
@@ -2133,7 +2136,7 @@
 }
 
 func (e configurationEvalutor) PropertyErrorf(property string, fmt string, args ...interface{}) {
-	e.ctx.OtherModulePropertyErrorf(e.m, property, fmt, args...)
+	e.ctx.OtherModulePropertyErrorf(e.m, property, fmt, args)
 }
 
 func (e configurationEvalutor) EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue {
@@ -2532,7 +2535,7 @@
 	}
 	osDeps := map[osAndCross]Paths{}
 	ctx.VisitAllModules(func(module Module) {
-		if module.Enabled(ctx) {
+		if module.Enabled() {
 			key := osAndCross{os: module.Target().Os, hostCross: module.Target().HostCross}
 			osDeps[key] = append(osDeps[key], module.base().checkbuildFiles...)
 		}
diff --git a/android/mutator.go b/android/mutator.go
index 5abb05d..75ba650 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -674,11 +674,13 @@
 // on component modules to be added so that they can depend directly on a prebuilt
 // module.
 func componentDepsMutator(ctx BottomUpMutatorContext) {
-	ctx.Module().ComponentDepsMutator(ctx)
+	if m := ctx.Module(); m.Enabled() {
+		m.ComponentDepsMutator(ctx)
+	}
 }
 
 func depsMutator(ctx BottomUpMutatorContext) {
-	if m := ctx.Module(); m.Enabled(ctx) {
+	if m := ctx.Module(); m.Enabled() {
 		m.base().baseDepsMutator(ctx)
 		m.DepsMutator(ctx)
 	}
diff --git a/android/override_module.go b/android/override_module.go
index 21cf381..1341f53 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -322,7 +322,7 @@
 }
 
 func overridableModuleDepsMutator(ctx BottomUpMutatorContext) {
-	if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled(ctx) {
+	if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled() {
 		b.OverridablePropertiesDepsMutator(ctx)
 	}
 }
diff --git a/android/paths.go b/android/paths.go
index f5bdb38..2b33f67 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -60,7 +60,6 @@
 
 	ModuleDir() string
 	ModuleErrorf(fmt string, args ...interface{})
-	OtherModulePropertyErrorf(module Module, property, fmt string, args ...interface{})
 }
 
 var _ EarlyModulePathContext = ModuleContext(nil)
@@ -551,7 +550,7 @@
 	if module == nil {
 		return nil, missingDependencyError{[]string{moduleName}}
 	}
-	if aModule, ok := module.(Module); ok && !aModule.Enabled(ctx) {
+	if aModule, ok := module.(Module); ok && !aModule.Enabled() {
 		return nil, missingDependencyError{[]string{moduleName}}
 	}
 	if outProducer, ok := module.(OutputFileProducer); ok {
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 1f9b331..2b7b55b 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -275,7 +275,7 @@
 	srcPropertyName := proptools.PropertyNameForField(srcField)
 
 	srcsSupplier := func(ctx BaseModuleContext, _ Module) []string {
-		if !module.Enabled(ctx) {
+		if !module.Enabled() {
 			return nil
 		}
 		value := srcPropsValue.FieldByIndex(srcFieldIndex)
@@ -425,7 +425,7 @@
 	m := ctx.Module()
 	// If this module is a prebuilt, is enabled and has not been renamed to source then add a
 	// dependency onto the source if it is present.
-	if p := GetEmbeddedPrebuilt(m); p != nil && m.Enabled(ctx) && !p.properties.PrebuiltRenamedToSource {
+	if p := GetEmbeddedPrebuilt(m); p != nil && m.Enabled() && !p.properties.PrebuiltRenamedToSource {
 		bmn, _ := m.(baseModuleName)
 		name := bmn.BaseModuleName()
 		if ctx.OtherModuleReverseDependencyVariantExists(name) {
@@ -702,7 +702,7 @@
 	}
 
 	// If source is not available or is disabled then always use the prebuilt.
-	if source == nil || !source.Enabled(ctx) {
+	if source == nil || !source.Enabled() {
 		return true
 	}
 
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index 5e1431c..2574ed4 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -351,7 +351,7 @@
 						}
 					})
 
-					moduleIsDisabled := !foo.Module().Enabled(PanickingConfigAndErrorContext(result.TestContext))
+					moduleIsDisabled := !foo.Module().Enabled()
 					deps := foo.Module().(*sourceModule).deps
 					if moduleIsDisabled {
 						if len(deps) > 0 {
diff --git a/android/register.go b/android/register.go
index aeb3b4c..d00c15f 100644
--- a/android/register.go
+++ b/android/register.go
@@ -16,9 +16,8 @@
 
 import (
 	"fmt"
-	"reflect"
-
 	"github.com/google/blueprint"
+	"reflect"
 )
 
 // A sortable component is one whose registration order affects the order in which it is executed
diff --git a/android/singleton.go b/android/singleton.go
index d364384..76df1eb 100644
--- a/android/singleton.go
+++ b/android/singleton.go
@@ -284,5 +284,5 @@
 }
 
 func (s *singletonContextAdaptor) OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{}) {
-	s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args...)
+	s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args)
 }
diff --git a/android/testing.go b/android/testing.go
index c692c72..7b4411e 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -1287,21 +1287,3 @@
 		t.Errorf("%q is not found in %v", expected, result)
 	}
 }
-
-type panickingConfigAndErrorContext struct {
-	ctx *TestContext
-}
-
-func (ctx *panickingConfigAndErrorContext) OtherModulePropertyErrorf(module Module, property, fmt string, args ...interface{}) {
-	panic(ctx.ctx.PropertyErrorf(module, property, fmt, args...).Error())
-}
-
-func (ctx *panickingConfigAndErrorContext) Config() Config {
-	return ctx.ctx.Config()
-}
-
-func PanickingConfigAndErrorContext(ctx *TestContext) ConfigAndErrorContext {
-	return &panickingConfigAndErrorContext{
-		ctx: ctx,
-	}
-}
diff --git a/android/variable.go b/android/variable.go
index 309824f..599f88e 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -58,13 +58,13 @@
 		// unbundled_build is a catch-all property to annotate modules that don't build in one or
 		// more unbundled branches, usually due to dependencies missing from the manifest.
 		Unbundled_build struct {
-			Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
+			Enabled *bool `android:"arch_variant"`
 		} `android:"arch_variant"`
 
 		// similar to `Unbundled_build`, but `Always_use_prebuilt_sdks` means that it uses prebuilt
 		// sdk specifically.
 		Always_use_prebuilt_sdks struct {
-			Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
+			Enabled *bool `android:"arch_variant"`
 		} `android:"arch_variant"`
 
 		Malloc_not_svelte struct {