Merge changes from topic 'revert_mutator_changes'

* changes:
  Revert "Fix ASAN mutator."
  Revert "Don't apply sanitizer mutators to host modules."
diff --git a/cc/sanitize.go b/cc/sanitize.go
index c585f6a..1fcb32c 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -457,6 +457,23 @@
 	return sanitize.Properties.InSanitizerDir
 }
 
+func (sanitize *sanitize) Sanitizer(t sanitizerType) bool {
+	if sanitize == nil {
+		return false
+	}
+
+	switch t {
+	case asan:
+		return Bool(sanitize.Properties.Sanitize.Address)
+	case tsan:
+		return Bool(sanitize.Properties.Sanitize.Thread)
+	case intOverflow:
+		return Bool(sanitize.Properties.Sanitize.Integer_overflow)
+	default:
+		panic(fmt.Errorf("unknown sanitizerType %d", t))
+	}
+}
+
 func (sanitize *sanitize) SetSanitizer(t sanitizerType, b bool) {
 	switch t {
 	case asan:
@@ -476,47 +493,13 @@
 	}
 }
 
-func (sanitize *sanitize) getSanitizerBoolPtr(t sanitizerType) *bool {
-	switch t {
-	case asan:
-		return sanitize.Properties.Sanitize.Address
-	case tsan:
-		return sanitize.Properties.Sanitize.Thread
-	case intOverflow:
-		return sanitize.Properties.Sanitize.Integer_overflow
-	default:
-		panic(fmt.Errorf("unknown sanitizerType %d", t))
-	}
-}
-
-// Check if the sanitizer is explicitly disabled (as opposed to nil by
-// virtue of not being set).
-func (sanitize *sanitize) isSanitizerExplicitlyDisabled(t sanitizerType) bool {
-	if sanitize == nil {
-		return false
-	}
-
-	sanitizerVal := sanitize.getSanitizerBoolPtr(t)
-	return sanitizerVal != nil && *sanitizerVal == false
-}
-
-func (sanitize *sanitize) isSanitizerExplicitlyEnabled(t sanitizerType) bool {
-	if sanitize == nil {
-		return false
-	}
-
-	sanitizerVal := sanitize.getSanitizerBoolPtr(t)
-	return sanitizerVal != nil && *sanitizerVal == true
-}
-
 // Propagate asan requirements down from binaries
 func sanitizerDepsMutator(t sanitizerType) func(android.TopDownMutatorContext) {
 	return func(mctx android.TopDownMutatorContext) {
-		if c, ok := mctx.Module().(*Module); ok && c.sanitize.isSanitizerExplicitlyEnabled(t) {
+		if c, ok := mctx.Module().(*Module); ok && c.sanitize.Sanitizer(t) {
 			mctx.VisitDepsDepthFirst(func(module blueprint.Module) {
-				if d, ok := module.(*Module); ok && d.sanitize != nil &&
-					!d.sanitize.Properties.Sanitize.Never &&
-					!d.sanitize.isSanitizerExplicitlyDisabled(t) {
+				if d, ok := mctx.Module().(*Module); ok && c.sanitize != nil &&
+					!c.sanitize.Properties.Sanitize.Never {
 					d.sanitize.Properties.SanitizeDep = true
 				}
 			})
@@ -527,24 +510,23 @@
 // Create asan variants for modules that need them
 func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) {
 	return func(mctx android.BottomUpMutatorContext) {
-		if c, ok := mctx.Module().(*Module); ok && c.sanitize != nil && !c.Host() {
-			if c.isDependencyRoot() && c.sanitize.isSanitizerExplicitlyEnabled(t) {
+		if c, ok := mctx.Module().(*Module); ok && c.sanitize != nil {
+			if c.isDependencyRoot() && c.sanitize.Sanitizer(t) {
 				modules := mctx.CreateVariations(t.String())
 				modules[0].(*Module).sanitize.SetSanitizer(t, true)
-			} else if c.sanitize.isSanitizerExplicitlyEnabled(t) || c.sanitize.Properties.SanitizeDep {
+			} else if c.sanitize.Properties.SanitizeDep {
 				modules := mctx.CreateVariations("", t.String())
 				modules[0].(*Module).sanitize.SetSanitizer(t, false)
 				modules[1].(*Module).sanitize.SetSanitizer(t, true)
 				modules[0].(*Module).sanitize.Properties.SanitizeDep = false
 				modules[1].(*Module).sanitize.Properties.SanitizeDep = false
-				modules[1].(*Module).sanitize.Properties.InSanitizerDir = true
-
+				if mctx.Device() {
+					modules[1].(*Module).sanitize.Properties.InSanitizerDir = true
+				} else {
+					modules[0].(*Module).Properties.PreventInstall = true
+				}
 				if mctx.AConfig().EmbeddedInMake() {
-					if c.sanitize.isSanitizerExplicitlyEnabled(t) {
-						modules[0].(*Module).Properties.HideFromMake = true
-					} else {
-						modules[1].(*Module).Properties.HideFromMake = true
-					}
+					modules[0].(*Module).Properties.HideFromMake = true
 				}
 			}
 			c.sanitize.Properties.SanitizeDep = false