Don't create nonplat_service_contexts on full_treble devices

On full Treble devices, servicemanager should only host services
served from processes on /system; nonplat_service_contexts
should not be created at all in this case.

Bug: 36866029
Test: Build marlin and make sure nonplat_service_contexts is not
      created.

Change-Id: Id02c314abbb98fc69884198779488c52231d22c3
Merged-In: Id02c314abbb98fc69884198779488c52231d22c3
diff --git a/Android.mk b/Android.mk
index 41926f4..93ce6b8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -211,7 +211,6 @@
     nonplat_mac_permissions.xml \
     nonplat_property_contexts \
     nonplat_seapp_contexts \
-    nonplat_service_contexts \
     nonplat_hwservice_contexts \
     plat_file_contexts \
     plat_mac_permissions.xml \
@@ -221,6 +220,10 @@
     plat_hwservice_contexts \
     vndservice_contexts \
 
+ifneq ($(PRODUCT_FULL_TREBLE),true)
+LOCAL_REQUIRED_MODULES += nonplat_service_contexts
+endif
+
 include $(BUILD_PHONY_PACKAGE)
 
 ##################################
@@ -942,16 +945,15 @@
 plat_service_contexts.tmp :=
 
 ##################################
+# nonplat_service_contexts is only allowed on non-full-treble devices
+ifneq ($(PRODUCT_FULL_TREBLE),true)
+
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := nonplat_service_contexts
 LOCAL_MODULE_CLASS := ETC
 LOCAL_MODULE_TAGS := optional
-ifeq ($(PRODUCT_FULL_TREBLE),true)
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
-else
 LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
-endif
 
 include $(BUILD_SYSTEM)/base_rules.mk
 
@@ -974,6 +976,8 @@
 nonplat_svcfiles :=
 nonplat_service_contexts.tmp :=
 
+endif
+
 ##################################
 include $(CLEAR_VARS)