Merge changes from topic "uses-libs-5" am: 8fab5bcce3 am: a4cdcd3796 am: 21b5ffa966 am: 41b3324afb am: 0efd65bc46

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1353554

Change-Id: Id33aa91e2da8c5521380cfe5a75882f349829164
diff --git a/apex/apex.go b/apex/apex.go
index da344cc..306da3b 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -189,7 +189,6 @@
 		"ExtServices-core",
 		"ExtServices",
 		"libtextclassifier-java",
-		"libz_current",
 		"textclassifier-statsd",
 		"TextClassifierNotificationLibNoManifest",
 		"TextClassifierServiceLibNoManifest",
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 794799e..bf574dc 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -21,7 +21,6 @@
 
 	"android/soong/android"
 	"android/soong/java"
-
 	"github.com/google/blueprint"
 
 	"github.com/google/blueprint/proptools"
@@ -239,9 +238,6 @@
 	// list of commands to create symlinks for backward compatibility.
 	// these commands will be attached as LOCAL_POST_INSTALL_CMD
 	compatSymlinks []string
-
-	hostRequired        []string
-	postInstallCommands []string
 }
 
 type ApexSetProperties struct {
@@ -326,43 +322,21 @@
 	for _, overridden := range a.properties.Overrides {
 		a.compatSymlinks = append(a.compatSymlinks, makeCompatSymlinks(overridden, ctx)...)
 	}
-
-	if ctx.Config().InstallExtraFlattenedApexes() {
-		// flattened apex should be in /system_ext/apex
-		flattenedApexDir := android.PathForModuleInstall(&systemExtContext{ctx}, "apex", a.BaseModuleName())
-		a.postInstallCommands = append(a.postInstallCommands,
-			fmt.Sprintf("$(HOST_OUT_EXECUTABLES)/deapexer --debugfs_path $(HOST_OUT_EXECUTABLES)/debugfs extract %s %s",
-				a.outputApex.String(),
-				flattenedApexDir.ToMakePath().String(),
-			))
-		a.hostRequired = []string{"deapexer", "debugfs"}
-	}
-}
-
-type systemExtContext struct {
-	android.ModuleContext
-}
-
-func (*systemExtContext) SystemExtSpecific() bool {
-	return true
 }
 
 func (a *ApexSet) AndroidMkEntries() []android.AndroidMkEntries {
 	return []android.AndroidMkEntries{android.AndroidMkEntries{
-		Class:         "ETC",
-		OutputFile:    android.OptionalPathForPath(a.outputApex),
-		Include:       "$(BUILD_PREBUILT)",
-		Host_required: a.hostRequired,
+		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...)
-				postInstallCommands := append([]string{}, a.postInstallCommands...)
-				postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
-				if len(postInstallCommands) > 0 {
-					entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(postInstallCommands, " && "))
+				if len(a.compatSymlinks) > 0 {
+					entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(a.compatSymlinks, " && "))
 				}
 			},
 		},
diff --git a/cc/compiler.go b/cc/compiler.go
index b5f297c..08ce133 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -300,7 +300,8 @@
 	if !(ctx.useSdk() || ctx.useVndk()) || ctx.Host() {
 		flags.SystemIncludeFlags = append(flags.SystemIncludeFlags,
 			"${config.CommonGlobalIncludes}",
-			tc.IncludeFlags())
+			tc.IncludeFlags(),
+			"${config.CommonNativehelperInclude}")
 	}
 
 	if ctx.useSdk() {