Add link speed to Wifi details page.
Also make detail items unselectable. Bug: 36444504 Test: make RunSettingsRoboTests Change-Id: I393a3a25c8c036da1df1dc2788accfecb3563e14
This commit is contained in:
@@ -34,40 +34,52 @@
|
||||
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="signal_strength"
|
||||
android:title="@string/wifi_signal" />
|
||||
android:title="@string/wifi_signal"
|
||||
android:selectable="false"/>
|
||||
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="frequency"
|
||||
android:icon="@drawable/ic_frequency_antenna"
|
||||
android:title="@string/wifi_frequency" />
|
||||
android:title="@string/wifi_frequency"
|
||||
android:selectable="false"/>
|
||||
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="security"
|
||||
android:icon="@drawable/ic_security_lock_24dp"
|
||||
android:title="@string/wifi_security" />
|
||||
android:title="@string/wifi_security"
|
||||
android:selectable="false"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<!-- IP Details -->
|
||||
<!-- Network Details -->
|
||||
<PreferenceCategory
|
||||
android:key="ip_details_category"
|
||||
android:title="@string/wifi_ip_address">
|
||||
android:title="@string/wifi_setup_detail">
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="ip_address"
|
||||
android:title="@string/wifi_ip_address" />
|
||||
android:title="@string/wifi_ip_address"
|
||||
android:selectable="false"/>
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="router"
|
||||
android:title="@string/wifi_gateway" />
|
||||
android:title="@string/wifi_gateway"
|
||||
android:selectable="false"/>
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="subnet_mask"
|
||||
android:title="@string/wifi_details_subnet_mask" />
|
||||
android:title="@string/wifi_details_subnet_mask"
|
||||
android:selectable="false"/>
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="dns"
|
||||
android:title="@string/wifi_details_dns" />
|
||||
android:title="@string/wifi_details_dns"
|
||||
android:selectable="false"/>
|
||||
<com.android.settings.wifi.WifiDetailPreference
|
||||
android:key="link_speed"
|
||||
android:title="@string/wifi_speed"
|
||||
android:selectable="false"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<!-- IPv6 Details -->
|
||||
<PreferenceCategory
|
||||
android:key="ipv6_details_category"
|
||||
android:title="@string/wifi_details_ipv6_address_header" />
|
||||
android:title="@string/wifi_details_ipv6_address_header"
|
||||
android:selectable="false"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -59,6 +59,8 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
|
||||
@VisibleForTesting
|
||||
static final String KEY_SIGNAL_STRENGTH_PREF = "signal_strength";
|
||||
@VisibleForTesting
|
||||
static final String KEY_LINK_SPEED = "link_speed";
|
||||
@VisibleForTesting
|
||||
static final String KEY_FREQUENCY_PREF = "frequency";
|
||||
@VisibleForTesting
|
||||
static final String KEY_SECURITY_PREF = "security";
|
||||
@@ -85,6 +87,7 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
|
||||
// Preferences - in order of appearance
|
||||
private Preference mConnectionDetailPref;
|
||||
private WifiDetailPreference mSignalStrengthPref;
|
||||
private WifiDetailPreference mLinkSpeedPref;
|
||||
private WifiDetailPreference mFrequencyPref;
|
||||
private WifiDetailPreference mSecurityPref;
|
||||
private WifiDetailPreference mIpAddressPref;
|
||||
@@ -128,6 +131,7 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
|
||||
|
||||
mSignalStrengthPref =
|
||||
(WifiDetailPreference) screen.findPreference(KEY_SIGNAL_STRENGTH_PREF);
|
||||
mLinkSpeedPref = (WifiDetailPreference) screen.findPreference(KEY_LINK_SPEED);
|
||||
mFrequencyPref = (WifiDetailPreference) screen.findPreference(KEY_FREQUENCY_PREF);
|
||||
mSecurityPref = (WifiDetailPreference) screen.findPreference(KEY_SECURITY_PREF);
|
||||
|
||||
@@ -178,6 +182,10 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
|
||||
int summarySignalLevel = mAccessPoint.getLevel();
|
||||
mSignalStrengthPref.setDetailText(mSignalStr[summarySignalLevel]);
|
||||
|
||||
// Link Speed Pref
|
||||
mLinkSpeedPref.setDetailText(mContext.getString(
|
||||
R.string.link_speed, mWifiInfo.getLinkSpeed()));
|
||||
|
||||
// Frequency Pref
|
||||
final int frequency = mWifiInfo.getFrequency();
|
||||
String band = null;
|
||||
|
@@ -54,6 +54,7 @@ public class WifiDetailPreferenceControllerTest {
|
||||
|
||||
private static final int LEVEL = 1;
|
||||
private static final int RSSI = -55;
|
||||
private static final int LINK_SPEED = 123;
|
||||
private static final String SECURITY = "None";
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
@@ -67,6 +68,7 @@ public class WifiDetailPreferenceControllerTest {
|
||||
|
||||
@Mock private Preference mockConnectionDetailPref;
|
||||
@Mock private WifiDetailPreference mockSignalStrengthPref;
|
||||
@Mock private WifiDetailPreference mockLinkSpeedPref;
|
||||
@Mock private WifiDetailPreference mockFrequencyPref;
|
||||
@Mock private WifiDetailPreference mockSecurityPref;
|
||||
@Mock private WifiDetailPreference mockIpAddressPref;
|
||||
@@ -97,6 +99,7 @@ public class WifiDetailPreferenceControllerTest {
|
||||
setupMockedPreferenceScreen();
|
||||
|
||||
when(mockWifiInfo.getRssi()).thenReturn(RSSI);
|
||||
when(mockWifiInfo.getLinkSpeed()).thenReturn(LINK_SPEED);
|
||||
when(mockWifiManager.getConnectionInfo()).thenReturn(mockWifiInfo);
|
||||
}
|
||||
|
||||
@@ -106,6 +109,8 @@ public class WifiDetailPreferenceControllerTest {
|
||||
.thenReturn(mockConnectionDetailPref);
|
||||
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_SIGNAL_STRENGTH_PREF))
|
||||
.thenReturn(mockSignalStrengthPref);
|
||||
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_LINK_SPEED))
|
||||
.thenReturn(mockLinkSpeedPref);
|
||||
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_FREQUENCY_PREF))
|
||||
.thenReturn(mockFrequencyPref);
|
||||
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_SECURITY_PREF))
|
||||
@@ -178,6 +183,15 @@ public class WifiDetailPreferenceControllerTest {
|
||||
verify(mockSignalStrengthPref).setDetailText(expectedStrength);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void linkSpeedPref_shouldHaveDetailTextSet() {
|
||||
String expectedLinkSpeed = mContext.getString(R.string.link_speed, LINK_SPEED);
|
||||
|
||||
mController.onResume();
|
||||
|
||||
verify(mockLinkSpeedPref).setDetailText(expectedLinkSpeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forgetNetwork_ephemeral() {
|
||||
WifiConfiguration wifiConfiguration = new WifiConfiguration();
|
||||
|
Reference in New Issue
Block a user