From 1f4a28b159805d58f85279444d84a54c19836027 Mon Sep 17 00:00:00 2001
From: Tri Vo <trong@google.com>
Date: Tue, 8 May 2018 18:52:11 -0700
Subject: [PATCH] Always build system and vendor policies (and related
 artifacts).

Part of an effort to remove Treble-specifics from the way be build
sepolicy.

Bug: 70851112
Test: build and boot bullhead.
Change-Id: I236f031e1b017875fb1afcc4f1b201699139516a
---
 Android.mk | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/Android.mk b/Android.mk
index ffdc5c453..d0daff401 100644
--- a/Android.mk
+++ b/Android.mk
@@ -195,9 +195,25 @@ LOCAL_MODULE_TAGS := optional
 # as build/target/product/embedded.mk.
 # This conditional inclusion closely mimics the conditional logic
 # inside init/init.cpp for loading SELinux policy from files.
-ifeq ($(PRODUCT_SEPOLICY_SPLIT),true)
 
-# Use split SELinux policy
+# Include precompiled policy, unless told otherwise.
+ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
+LOCAL_REQUIRED_MODULES += \
+    precompiled_sepolicy \
+    precompiled_sepolicy.plat_and_mapping.sha256 \
+
+endif # ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
+
+ifneq ($(PRODUCT_SEPOLICY_SPLIT),true)
+# The following files are only allowed for non-Treble devices.
+LOCAL_REQUIRED_MODULES += \
+    sepolicy \
+    vendor_service_contexts \
+
+endif # ($(PRODUCT_SEPOLICY_SPLIT),true)
+
+# These build targets are not used on non-Treble devices. However, we build these to avoid
+# divergence between Treble and non-Treble devices.
 LOCAL_REQUIRED_MODULES += \
     $(platform_mapping_file) \
     $(addsuffix .cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS)) \
@@ -208,17 +224,6 @@ LOCAL_REQUIRED_MODULES += \
     secilc \
     plat_sepolicy_vers.txt \
 
-# Include precompiled policy, unless told otherwise
-ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
-LOCAL_REQUIRED_MODULES += precompiled_sepolicy precompiled_sepolicy.plat_and_mapping.sha256
-endif
-else
-# The following files are only allowed for non-Treble devices.
-LOCAL_REQUIRED_MODULES += \
-    sepolicy \
-    vendor_service_contexts
-endif
-
 LOCAL_REQUIRED_MODULES += \
     build_sepolicy \
     vendor_file_contexts \
-- 
GitLab