Add support for carrier wifi in UI.
Make changes to the UI, so that it does not ask for additional information while connecting to Carrier Wifi. Also, indicate in wifi picker if the wifi is a carrier network. Bug:30988281 Test: make RunSettingsRoboTests -j40 ROBOTEST_FILTER=WifiConfigControllerTest Test: manual Change-Id: Iecbcd77d400264aaaa16a6a95a2093d58f2748f9
This commit is contained in:
@@ -281,11 +281,17 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
showProxyFields();
|
showProxyFields();
|
||||||
final CheckBox advancedTogglebox =
|
final CheckBox advancedTogglebox =
|
||||||
(CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
|
(CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
|
||||||
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(
|
||||||
|
mAccessPoint.isCarrierAp() ? View.GONE : View.VISIBLE);
|
||||||
advancedTogglebox.setOnCheckedChangeListener(this);
|
advancedTogglebox.setOnCheckedChangeListener(this);
|
||||||
advancedTogglebox.setChecked(showAdvancedFields);
|
advancedTogglebox.setChecked(showAdvancedFields);
|
||||||
mView.findViewById(R.id.wifi_advanced_fields)
|
mView.findViewById(R.id.wifi_advanced_fields)
|
||||||
.setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
|
.setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
|
||||||
|
if (mAccessPoint.isCarrierAp()) {
|
||||||
|
addRow(group, R.string.wifi_carrier_connect,
|
||||||
|
String.format(mContext.getString(R.string.wifi_carrier_content),
|
||||||
|
mAccessPoint.getCarrierName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMode == WifiConfigUiBase.MODE_MODIFY) {
|
if (mMode == WifiConfigUiBase.MODE_MODIFY) {
|
||||||
@@ -845,6 +851,10 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mEapIdentityView = (TextView) mView.findViewById(R.id.identity);
|
mEapIdentityView = (TextView) mView.findViewById(R.id.identity);
|
||||||
mEapAnonymousView = (TextView) mView.findViewById(R.id.anonymous);
|
mEapAnonymousView = (TextView) mView.findViewById(R.id.anonymous);
|
||||||
|
|
||||||
|
if (mAccessPoint.isCarrierAp()) {
|
||||||
|
mEapMethodSpinner.setSelection(mAccessPoint.getCarrierApEapType());
|
||||||
|
}
|
||||||
|
|
||||||
loadCertificates(
|
loadCertificates(
|
||||||
mEapCaCertSpinner,
|
mEapCaCertSpinner,
|
||||||
Credentials.CA_CERTIFICATE,
|
Credentials.CA_CERTIFICATE,
|
||||||
@@ -1012,6 +1022,9 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
setUserCertInvisible();
|
setUserCertInvisible();
|
||||||
setPasswordInvisible();
|
setPasswordInvisible();
|
||||||
setIdentityInvisible();
|
setIdentityInvisible();
|
||||||
|
if (mAccessPoint.isCarrierAp()) {
|
||||||
|
setEapMethodInvisible();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,6 +1090,10 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mView.findViewById(R.id.show_password_layout).setVisibility(View.GONE);
|
mView.findViewById(R.id.show_password_layout).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setEapMethodInvisible() {
|
||||||
|
mView.findViewById(R.id.eap).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
private void showIpConfigFields() {
|
private void showIpConfigFields() {
|
||||||
WifiConfiguration config = null;
|
WifiConfiguration config = null;
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.wifi;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
|
||||||
@@ -161,6 +162,34 @@ public class WifiConfigControllerTest {
|
|||||||
assertThat(mController.getSignalString()).isNull();
|
assertThat(mController.getSignalString()).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void showForCarrierAp() {
|
||||||
|
// Setup the mock view for wifi dialog.
|
||||||
|
View view = mock(View.class);
|
||||||
|
TextView nameText = mock(TextView.class);
|
||||||
|
TextView valueText = mock(TextView.class);
|
||||||
|
when(view.findViewById(R.id.name)).thenReturn(nameText);
|
||||||
|
when(view.findViewById(R.id.value)).thenReturn(valueText);
|
||||||
|
LayoutInflater inflater = mock(LayoutInflater.class);
|
||||||
|
when(inflater.inflate(anyInt(), any(ViewGroup.class), anyBoolean())).thenReturn(view);
|
||||||
|
when(mConfigUiBase.getLayoutInflater()).thenReturn(inflater);
|
||||||
|
|
||||||
|
String carrierName = "Test Carrier";
|
||||||
|
when(mAccessPoint.isCarrierAp()).thenReturn(true);
|
||||||
|
when(mAccessPoint.getCarrierName()).thenReturn(carrierName);
|
||||||
|
mController = new TestWifiConfigController(mConfigUiBase, mView, mAccessPoint,
|
||||||
|
WifiConfigUiBase.MODE_CONNECT);
|
||||||
|
// Verify the content of the text fields.
|
||||||
|
verify(nameText).setText(R.string.wifi_carrier_connect);
|
||||||
|
verify(valueText).setText(
|
||||||
|
String.format(mContext.getString(R.string.wifi_carrier_content), carrierName));
|
||||||
|
// Verify that the advance toggle is not visible.
|
||||||
|
assertThat(mView.findViewById(R.id.wifi_advanced_toggle).getVisibility())
|
||||||
|
.isEqualTo(View.GONE);
|
||||||
|
// Verify that the EAP method menu is not visible.
|
||||||
|
assertThat(mView.findViewById(R.id.eap).getVisibility()).isEqualTo(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
public class TestWifiConfigController extends WifiConfigController {
|
public class TestWifiConfigController extends WifiConfigController {
|
||||||
|
|
||||||
public TestWifiConfigController(WifiConfigUiBase parent, View view,
|
public TestWifiConfigController(WifiConfigUiBase parent, View view,
|
||||||
|
Reference in New Issue
Block a user