Merge "Hide entire hidden field for non-hidden networks" into pi-dev am: 2c793dfeff
am: 1a2153e6ab

Change-Id: Id5dc0b1855520c9071ce3b8c2897f2b69d3b3791
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index fe891e1..2330727 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -604,6 +604,7 @@
             <LinearLayout android:id="@+id/hidden_settings_field"
                           android:layout_width="match_parent"
                           android:layout_height="wrap_content"
+                          android:visibility="gone"
                           style="@style/wifi_item">
 
                 <TextView android:id="@+id/hidden_settings_title"
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 95f7e9c..22de20c 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -220,8 +220,6 @@
         mMeteredSettingsSpinner = mView.findViewById(R.id.metered_settings);
         mHiddenSettingsSpinner = mView.findViewById(R.id.hidden_settings);
         mHiddenSettingsSpinner.setOnItemSelectedListener(this);
-        mHiddenSettingsSpinner.setVisibility(View.GONE);
-        mHiddenSettingsSpinner.setEnabled(false);
         mHiddenWarningView = mView.findViewById(R.id.hidden_settings_warning);
         mHiddenWarningView.setVisibility(
                 mHiddenSettingsSpinner.getSelectedItemPosition() == NOT_HIDDEN_NETWORK
@@ -241,8 +239,7 @@
             showProxyFields();
             mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
             // Hidden option can be changed only when the user adds a network manually.
-            mHiddenSettingsSpinner.setVisibility(View.VISIBLE);
-            mHiddenSettingsSpinner.setEnabled(true);
+            mView.findViewById(R.id.hidden_settings_field).setVisibility(View.VISIBLE);
             ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
                     .setOnCheckedChangeListener(this);
 
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
index ddbc851..43e87d8 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
@@ -259,26 +259,13 @@
     }
 
     @Test
-    public void hiddenView_isDisabledWhenAppropriate() {
-        View hiddenSpinner = mView.findViewById(R.id.hidden_settings);
-        assertThat(hiddenSpinner.isEnabled()).isFalse();
+    public void hiddenField_visibilityUpdatesCorrectly() {
+        View hiddenField = mView.findViewById(R.id.hidden_settings_field);
+        assertThat(hiddenField.getVisibility()).isEqualTo(View.GONE);
 
         mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
                 WifiConfigUiBase.MODE_CONNECT);
-        assertThat(hiddenSpinner.isEnabled()).isTrue();
-    }
-
-
-    @Test
-    public void hiddenSpinner_visibilityUpdatesCorrectly() {
-        View hiddenSpinner = mView.findViewById(R.id.hidden_settings);
-        assertThat(hiddenSpinner.isEnabled()).isFalse();
-        assertThat(hiddenSpinner.getVisibility()).isEqualTo(View.GONE);
-
-        mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
-                WifiConfigUiBase.MODE_CONNECT);
-        assertThat(hiddenSpinner.isEnabled()).isTrue();
-        assertThat(hiddenSpinner.getVisibility()).isEqualTo(View.VISIBLE);
+        assertThat(hiddenField.getVisibility()).isEqualTo(View.VISIBLE);
     }
 
     public class TestWifiConfigController extends WifiConfigController {