Symlink file_contexts --> file_contexts.bin

The presence of /file_contexts is still important to TWRP:
- files written while in adb shell only pick up contexts if
  /file_contexts is present
- fixContexts looks for /file_contexts
- if !USE_EXT4 (is this possible), then make_ext4fs looks for
  /file_contexts when wiping

In the event than file_contexts.bin also becomes more important in the
future, leave it in place and create a symlink to it.

Change-Id: Ic87852248d42d5ea6bf936df160efa41294b6520
diff --git a/Android.mk b/Android.mk
index d6a318b..2b7c2d1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -478,12 +478,27 @@
 endif
 endif
 
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 25; echo $$?),0)
+    LOCAL_ADDITIONAL_DEPENDENCIES += file_contexts_symlink
+endif
+
 ifeq ($(BOARD_CACHEIMAGE_PARTITION_SIZE),)
 LOCAL_REQUIRED_MODULES := recovery-persist recovery-refresh
 endif
 
 include $(BUILD_EXECUTABLE)
 
+# Symlink for file_contexts
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := file_contexts_symlink
+LOCAL_MODULE_TAGS := optional
+LOCAL_POST_INSTALL_CMD := \
+    $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin && \
+    ln -sf /file_contexts.bin $(TARGET_RECOVERY_ROOT_OUT)/file_contexts
+
+include $(BUILD_PHONY_PACKAGE)
+
 ifneq ($(TW_USE_TOOLBOX), true)
 include $(CLEAR_VARS)
 # Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead