Only write appcompat properties if flag is defined

Only writes the appcompat properties if the
WRITE_APPCOMPAT_OVERRIDE_SYSTEM_PROPERTIES cflag is defined

Fixes: 331307495
Test: manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f04f6bae4314e01111045ba231010ba7067477a0)
Merged-In: Ie99b5027a9704c0f4f7fe4d3a6a6cf49f4bb8176
Change-Id: Ie99b5027a9704c0f4f7fe4d3a6a6cf49f4bb8176
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 58a0a7f..5a1b63b 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1308,12 +1308,14 @@
     }
     selinux_android_restorecon(PROP_TREE_FILE, 0);
 
+#ifdef WRITE_APPCOMPAT_OVERRIDE_SYSTEM_PROPERTIES
     mkdir(APPCOMPAT_OVERRIDE_PROP_FOLDERNAME, S_IRWXU | S_IXGRP | S_IXOTH);
     if (!WriteStringToFile(serialized_contexts, APPCOMPAT_OVERRIDE_PROP_TREE_FILE, 0444, 0, 0,
                            false)) {
         PLOG(ERROR) << "Unable to write appcompat override property infos to file";
     }
     selinux_android_restorecon(APPCOMPAT_OVERRIDE_PROP_TREE_FILE, 0);
+#endif
 }
 
 static void ExportKernelBootProps() {