Merge "Add a config to show the Vpn options menu." into main am: 5abd3420c4 am: 16e99c187f

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2685406

Change-Id: I25a47d376b7fa31a144cdc74bee6c9a99a6b2525
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/res/values/config.xml b/res/values/config.xml
index 17c3398..d6f7c08 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -689,6 +689,9 @@
     <!-- Whether to enable the advanced vpn feature. The default is not to. -->
     <bool name="config_advanced_vpn_enabled">false</bool>
 
+    <!-- Whether to show the VPN options menu. The default is to show it. -->
+    <bool name="config_show_vpn_options">true</bool>
+
     <!-- An array of uid name for which packages exempt from Wi-Fi permission check. -->
     <string-array name="config_exempt_wifi_permission_uid_name" translatable="false">
         <item>@string/config_settingsintelligence_package_name</item>
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 8cec2f4..0389ecd 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -141,6 +141,11 @@
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
+
+        if (!getContext().getResources().getBoolean(R.bool.config_show_vpn_options)) {
+            return;
+        }
+
         // Although FEATURE_IPSEC_TUNNELS should always be present in android S and beyond,
         // keep this check here just to be safe.
         if (!getContext().getPackageManager().hasSystemFeature(