Revert "Dexpreopt soong modules inside soong"

This reverts commit 29ff88741e710b05743dcf347484c31311e81cda.

Test: none
Bug: 119412419
diff --git a/android/config.go b/android/config.go
index a0954b6..54c9da8 100644
--- a/android/config.go
+++ b/android/config.go
@@ -732,18 +732,14 @@
 	return c.productVariables.ModulesLoadedByPrivilegedModules
 }
 
+func (c *config) DefaultStripDex() bool {
+	return Bool(c.productVariables.DefaultStripDex)
+}
+
 func (c *config) DisableDexPreopt(name string) bool {
 	return Bool(c.productVariables.DisableDexPreopt) || InList(name, c.productVariables.DisableDexPreoptModules)
 }
 
-func (c *config) DexpreoptGlobalConfig() string {
-	return String(c.productVariables.DexpreoptGlobalConfig)
-}
-
-func (c *config) DexPreoptProfileDir() string {
-	return String(c.productVariables.DexPreoptProfileDir)
-}
-
 func (c *deviceConfig) Arches() []Arch {
 	var arches []Arch
 	for _, target := range c.config.Targets[Android] {
@@ -858,18 +854,6 @@
 	return c.config.productVariables.BoardPlatPrivateSepolicyDirs
 }
 
-func (c *config) SecondArchIsTranslated() bool {
-	deviceTargets := c.Targets[Android]
-	if len(deviceTargets) < 2 {
-		return false
-	}
-
-	arch := deviceTargets[0].Arch
-
-	return (arch.ArchType == X86 || arch.ArchType == X86_64) &&
-		(hasArmAbi(arch) || hasArmAndroidArch(deviceTargets))
-}
-
 func (c *config) IntegerOverflowDisabledForPath(path string) bool {
 	if c.productVariables.IntegerOverflowExcludePaths == nil {
 		return false
diff --git a/android/paths.go b/android/paths.go
index 20039d4..b22e3c7 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -659,7 +659,11 @@
 	if len(paths) == 0 {
 		return OptionalPath{}
 	}
-	relPath := Rel(ctx, p.config.srcDir, paths[0])
+	relPath, err := filepath.Rel(p.config.srcDir, paths[0])
+	if err != nil {
+		reportPathError(ctx, err)
+		return OptionalPath{}
+	}
 	return OptionalPathForPath(PathForSource(ctx, relPath))
 }
 
@@ -784,7 +788,13 @@
 
 func (p ModuleSrcPath) WithSubDir(ctx ModuleContext, subdir string) ModuleSrcPath {
 	subdir = PathForModuleSrc(ctx, subdir).String()
-	p.rel = Rel(ctx, subdir, p.path)
+	var err error
+	rel, err := filepath.Rel(subdir, p.path)
+	if err != nil {
+		ctx.ModuleErrorf("source file %q is not under path %q", p.path, subdir)
+		return p
+	}
+	p.rel = rel
 	return p
 }
 
@@ -922,7 +932,27 @@
 func PathForModuleInstall(ctx ModuleInstallPathContext, pathComponents ...string) OutputPath {
 	var outPaths []string
 	if ctx.Device() {
-		partition := modulePartition(ctx)
+		var partition string
+		if ctx.InstallInData() {
+			partition = "data"
+		} else if ctx.InstallInRecovery() {
+			// the layout of recovery partion is the same as that of system partition
+			partition = "recovery/root/system"
+		} else if ctx.SocSpecific() {
+			partition = ctx.DeviceConfig().VendorPath()
+		} else if ctx.DeviceSpecific() {
+			partition = ctx.DeviceConfig().OdmPath()
+		} else if ctx.ProductSpecific() {
+			partition = ctx.DeviceConfig().ProductPath()
+		} else if ctx.ProductServicesSpecific() {
+			partition = ctx.DeviceConfig().ProductServicesPath()
+		} else {
+			partition = "system"
+		}
+
+		if ctx.InstallInSanitizerDir() {
+			partition = "data/asan/" + partition
+		}
 		outPaths = []string{"target", "product", ctx.Config().DeviceName(), partition}
 	} else {
 		switch ctx.Os() {
@@ -942,36 +972,6 @@
 	return PathForOutput(ctx, outPaths...)
 }
 
-func InstallPathToOnDevicePath(ctx PathContext, path OutputPath) string {
-	rel := Rel(ctx, PathForOutput(ctx, "target", "product", ctx.Config().DeviceName()).String(), path.String())
-
-	return "/" + rel
-}
-
-func modulePartition(ctx ModuleInstallPathContext) string {
-	var partition string
-	if ctx.InstallInData() {
-		partition = "data"
-	} else if ctx.InstallInRecovery() {
-		// the layout of recovery partion is the same as that of system partition
-		partition = "recovery/root/system"
-	} else if ctx.SocSpecific() {
-		partition = ctx.DeviceConfig().VendorPath()
-	} else if ctx.DeviceSpecific() {
-		partition = ctx.DeviceConfig().OdmPath()
-	} else if ctx.ProductSpecific() {
-		partition = ctx.DeviceConfig().ProductPath()
-	} else if ctx.ProductServicesSpecific() {
-		partition = ctx.DeviceConfig().ProductServicesPath()
-	} else {
-		partition = "system"
-	}
-	if ctx.InstallInSanitizerDir() {
-		partition = "data/asan/" + partition
-	}
-	return partition
-}
-
 // validateSafePath validates a path that we trust (may contain ninja variables).
 // Ensures that each path component does not attempt to leave its component.
 func validateSafePath(pathComponents ...string) (string, error) {
@@ -1039,27 +1039,3 @@
 
 	return p
 }
-
-// Rel performs the same function as filepath.Rel, but reports errors to a PathContext, and reports an error if
-// targetPath is not inside basePath.
-func Rel(ctx PathContext, basePath string, targetPath string) string {
-	rel, isRel := MaybeRel(ctx, basePath, targetPath)
-	if !isRel {
-		reportPathErrorf(ctx, "path %q is not under path %q", targetPath, basePath)
-		return ""
-	}
-	return rel
-}
-
-// MaybeRel performs the same function as filepath.Rel, but reports errors to a PathContext, and returns false if
-// targetPath is not inside basePath.
-func MaybeRel(ctx PathContext, basePath string, targetPath string) (string, bool) {
-	rel, err := filepath.Rel(basePath, targetPath)
-	if err != nil {
-		reportPathError(ctx, err)
-		return "", false
-	} else if rel == ".." || strings.HasPrefix(rel, "../") || strings.HasPrefix(rel, "/") {
-		return "", false
-	}
-	return rel, true
-}
diff --git a/android/variable.go b/android/variable.go
index 85937e3..f496008 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -196,10 +196,9 @@
 
 	UncompressPrivAppDex             *bool    `json:",omitempty"`
 	ModulesLoadedByPrivilegedModules []string `json:",omitempty"`
-
-	DisableDexPreopt        *bool    `json:",omitempty"`
-	DisableDexPreoptModules []string `json:",omitempty"`
-	DexPreoptProfileDir     *string  `json:",omitempty"`
+	DefaultStripDex                  *bool    `json:",omitempty"`
+	DisableDexPreopt                 *bool    `json:",omitempty"`
+	DisableDexPreoptModules          []string `json:",omitempty"`
 
 	IntegerOverflowExcludePaths *[]string `json:",omitempty"`
 
@@ -258,8 +257,6 @@
 	Exclude_draft_ndk_apis *bool `json:",omitempty"`
 
 	FlattenApex *bool `json:",omitempty"`
-
-	DexpreoptGlobalConfig *string `json:",omitempty"`
 }
 
 func boolPtr(v bool) *bool {