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