Merge "Remove flatten_apex: property"
diff --git a/apex/Android.bp b/apex/Android.bp
index 22de5d4..7203d9d 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -24,11 +24,6 @@
 // TODO(b/236681553): Remove com.android.bluetooth-file_contexts
 
 filegroup {
-  name: "apex_file_contexts_files",
-  srcs: ["*-file_contexts"],
-}
-
-filegroup {
   name: "apex.test-file_contexts",
   srcs: [
     "apex.test-file_contexts",
diff --git a/build/soong/selinux_contexts.go b/build/soong/selinux_contexts.go
index 587fe91..2416dc9 100644
--- a/build/soong/selinux_contexts.go
+++ b/build/soong/selinux_contexts.go
@@ -18,7 +18,6 @@
 	"fmt"
 	"io"
 	"os"
-	"strings"
 
 	"github.com/google/blueprint"
 	"github.com/google/blueprint/proptools"
@@ -50,15 +49,6 @@
 	Recovery_available *bool
 }
 
-type fileContextsProperties struct {
-	// flatten_apex can be used to specify additional sources of file_contexts.
-	// Apex paths, /system/apex/{apex_name}, will be amended to the paths of file_contexts
-	// entries.
-	Flatten_apex struct {
-		Srcs []string `android:"path"`
-	}
-}
-
 type seappProperties struct {
 	// Files containing neverallow rules.
 	Neverallow_files []string `android:"path"`
@@ -70,13 +60,12 @@
 type selinuxContextsModule struct {
 	android.ModuleBase
 
-	properties             selinuxContextsProperties
-	fileContextsProperties fileContextsProperties
-	seappProperties        seappProperties
-	build                  func(ctx android.ModuleContext, inputs android.Paths) android.Path
-	deps                   func(ctx android.BottomUpMutatorContext)
-	outputPath             android.Path
-	installPath            android.InstallPath
+	properties      selinuxContextsProperties
+	seappProperties seappProperties
+	build           func(ctx android.ModuleContext, inputs android.Paths) android.Path
+	deps            func(ctx android.BottomUpMutatorContext)
+	outputPath      android.Path
+	installPath     android.InstallPath
 }
 
 var (
@@ -164,7 +153,6 @@
 	m := &selinuxContextsModule{}
 	m.AddProperties(
 		&m.properties,
-		&m.fileContextsProperties,
 		&m.seappProperties,
 	)
 	android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
@@ -304,26 +292,6 @@
 	if m.properties.Fc_sort == nil {
 		m.properties.Fc_sort = proptools.BoolPtr(true)
 	}
-
-	rule := android.NewRuleBuilder(pctx, ctx)
-
-	if ctx.Config().FlattenApex() {
-		for _, path := range android.PathsForModuleSrc(ctx, m.fileContextsProperties.Flatten_apex.Srcs) {
-			out := pathForModuleOut(ctx, "flattened_apex", path.Rel())
-			apex_path := "/system/apex/" + strings.Replace(
-				strings.TrimSuffix(path.Base(), "-file_contexts"),
-				".", "\\\\.", -1)
-
-			rule.Command().
-				Text("awk '/object_r/{printf(\""+apex_path+"%s\\n\",$0)}'").
-				Input(path).
-				FlagWithOutput("> ", out)
-
-			inputs = append(inputs, out)
-		}
-	}
-
-	rule.Build(m.Name(), "flattened_apex_file_contexts")
 	return m.buildGeneralContexts(ctx, inputs)
 }
 
diff --git a/contexts/Android.bp b/contexts/Android.bp
index d5cd8ae..5982ae6 100644
--- a/contexts/Android.bp
+++ b/contexts/Android.bp
@@ -79,10 +79,6 @@
             srcs: [":file_contexts_overlayfs_files{.plat_private}"],
         },
     },
-
-    flatten_apex: {
-        srcs: [":apex_file_contexts_files"],
-    },
 }
 
 file_contexts {
@@ -97,11 +93,6 @@
             srcs: [":file_contexts_overlayfs_files{.plat_private}"],
         },
     },
-
-    flatten_apex: {
-        srcs: [":apex_file_contexts_files"],
-    },
-
     recovery: true,
 }