Merge "Copy the 464xlat vendor property to an AOSP property." am: 1934063f20 am: 1886366e64 am: 10a3cf41c3

Original change: https://android-review.googlesource.com/c/platform/external/android-clat/+/1553819

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7d097f5eedc54b363f0c5fdd3a3fe273d3b22623
diff --git a/Android.bp b/Android.bp
index adc36e7..4eda2ad 100644
--- a/Android.bp
+++ b/Android.bp
@@ -86,6 +86,10 @@
     tidy_flags: [
         "-warnings-as-errors=clang-analyzer-security*,cert-*,android-*",
     ],
+    // Actually not required for clatd itself. See comments in the rc file.
+    init_rc: [
+        "vendor-464xlat.rc",
+    ],
 }
 
 // Unit tests.
diff --git a/vendor-464xlat.rc b/vendor-464xlat.rc
new file mode 100644
index 0000000..609531d
--- /dev/null
+++ b/vendor-464xlat.rc
@@ -0,0 +1,15 @@
+# Certain vendors disable 464xlat by setting a vendor property.
+# The connectivity code in the Tethering APEX needs to disable
+# 464xlat when the property is set, but it is only allowed to
+# access non-vendor system properties. So copy the property to
+# a property available to system APIs in android.sysprop.
+#
+# Arguably this script should live close to the code that uses
+# it, but scrips in APEXes are not allowed to use "on property".
+# So put it here close to clatd, which is at least related to
+# 464xlat.
+on property:persist.vendor.net.doxlat=true
+    setprop net.464xlat.cellular.enabled true
+
+on property:persist.vendor.net.doxlat=false
+    setprop net.464xlat.cellular.enabled false