Merge "Add a config to hide "Enable wireless display" menu" into main am: 6a04355cb3 am: 919149ceee

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

Change-Id: Ibadb5404e51cf60c5f0e6336772e6ccafc29e996
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 d6f7c08..59d5cbf 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -754,6 +754,9 @@
         <item></item>
     </string-array>
 
+    <!-- Whether to display the "Enable wireless display" menu -->
+    <bool name="config_show_wifi_display_enable_menu">true</bool>
+
     <!-- List of packages that should be hidden for MVNO. Do not translate -->
     <string-array name="datausage_hiding_carrier_service_package_names" translatable="false"/>
 
diff --git a/src/com/android/settings/wfd/WifiDisplaySettings.java b/src/com/android/settings/wfd/WifiDisplaySettings.java
index 8562e5f..cb515e3 100755
--- a/src/com/android/settings/wfd/WifiDisplaySettings.java
+++ b/src/com/android/settings/wfd/WifiDisplaySettings.java
@@ -139,7 +139,6 @@
         mWifiP2pChannel = mWifiP2pManager.initialize(context, Looper.getMainLooper(), null);
 
         addPreferencesFromResource(R.xml.wifi_display_settings);
-        setHasOptionsMenu(true);
     }
 
     @Override
@@ -196,8 +195,9 @@
 
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        if (mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState()
-                != WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
+        if (getResources().getBoolean(R.bool.config_show_wifi_display_enable_menu)
+                && mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState()
+                        != WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
             MenuItem item = menu.add(Menu.NONE, MENU_ID_ENABLE_WIFI_DISPLAY, 0,
                     R.string.wifi_display_enable_menu_item);
             item.setCheckable(true);