WiFi: Add Tx and rx link speed in network details
current "link speed" in UI is renamed to "Transmit link speed". Also Added Receive link speed in network details. Bug: 120497598 Test: Connected to AP and verified the Rx link speed in Network details. Change-Id: I01cf7362a27ad78ddfaef68efae4d07cbd14fc55
This commit is contained in:
@@ -90,10 +90,16 @@
|
|||||||
<TextView android:id="@+id/networkid" style="@style/info_value" />
|
<TextView android:id="@+id/networkid" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!--Link Speed Value-->
|
<!--Transmit Link Speed Value-->
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/link_speed_label" style="@style/info_label" />
|
<TextView android:text="@string/tx_link_speed_label" style="@style/info_label" />
|
||||||
<TextView android:id="@+id/link_speed" style="@style/info_value" />
|
<TextView android:id="@+id/tx_link_speed" style="@style/info_value" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!--Receive Link Speed Value-->
|
||||||
|
<LinearLayout style="@style/entry_layout">
|
||||||
|
<TextView android:text="@string/rx_link_speed_label" style="@style/info_label" />
|
||||||
|
<TextView android:id="@+id/rx_link_speed" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
|
@@ -1832,8 +1832,10 @@
|
|||||||
<string name="wifi_sign_in_button_text">Sign in</string>
|
<string name="wifi_sign_in_button_text">Sign in</string>
|
||||||
<!-- Wifi Sign in CTA for wifi settings when captive portal auth is required [CHAR LIMIT = 50] -->
|
<!-- Wifi Sign in CTA for wifi settings when captive portal auth is required [CHAR LIMIT = 50] -->
|
||||||
<string name="wifi_tap_to_sign_in">Tap here to sign in to network</string>
|
<string name="wifi_tap_to_sign_in">Tap here to sign in to network</string>
|
||||||
<!-- Link speed on Wifi Status screen -->
|
<!-- Transmit Link speed on Wifi Status screen [CHAR LIMIT=32] -->
|
||||||
<string name="link_speed">%1$d Mbps</string>
|
<string name="tx_link_speed"><xliff:g id="Transmit link speed" example="150 Mbps">%1$d</xliff:g> Mbps</string>
|
||||||
|
<!-- Receive Link speed on Wifi Status screen [CHAR LIMIT=32] -->
|
||||||
|
<string name="rx_link_speed"><xliff:g id="Receive link speed" example="54 Mbps">%1$d</xliff:g> Mbps</string>
|
||||||
|
|
||||||
<!-- This string asks the user whether or not to allow an app to enable WiFi. [CHAR LIMIT=NONE] -->
|
<!-- This string asks the user whether or not to allow an app to enable WiFi. [CHAR LIMIT=NONE] -->
|
||||||
<string name="wifi_ask_enable"><xliff:g id="requester" example="FancyApp">%s</xliff:g> wants to turn on Wi-Fi</string>
|
<string name="wifi_ask_enable"><xliff:g id="requester" example="FancyApp">%s</xliff:g> wants to turn on Wi-Fi</string>
|
||||||
@@ -2028,8 +2030,10 @@
|
|||||||
<string name="wifi_signal">Signal strength</string>
|
<string name="wifi_signal">Signal strength</string>
|
||||||
<!-- Label for the status of the connection -->
|
<!-- Label for the status of the connection -->
|
||||||
<string name="wifi_status">Status</string>
|
<string name="wifi_status">Status</string>
|
||||||
<!-- Label for the link speed of the connection -->
|
<!-- Label for the transmit link speed of the connection. [CHAR LIMIT=32] -->
|
||||||
<string name="wifi_speed">Link speed</string>
|
<string name="tx_wifi_speed">Transmit link speed</string>
|
||||||
|
<!-- Label for the receive link speed of the connection. [CHAR LIMIT=32] -->
|
||||||
|
<string name="rx_wifi_speed">Receive link speed</string>
|
||||||
<!-- Label for the frequency band of the connection -->
|
<!-- Label for the frequency band of the connection -->
|
||||||
<string name="wifi_frequency">Frequency</string>
|
<string name="wifi_frequency">Frequency</string>
|
||||||
<!-- Label for the IP address of the connection -->
|
<!-- Label for the IP address of the connection -->
|
||||||
@@ -2381,7 +2385,10 @@
|
|||||||
<string name="networkid_label" translatable="false">Network ID:</string>
|
<string name="networkid_label" translatable="false">Network ID:</string>
|
||||||
<!-- Do not translate. Used for diagnostic screens, precise translation is not necessary
|
<!-- Do not translate. Used for diagnostic screens, precise translation is not necessary
|
||||||
Label on Wifi Status screen-->
|
Label on Wifi Status screen-->
|
||||||
<string name="link_speed_label" translatable="false">Link speed:</string>
|
<string name="tx_link_speed_label" translatable="false">Transmit link speed:</string>
|
||||||
|
<!-- Do not translate. Used for diagnostic screens, precise translation is not necessary
|
||||||
|
Label on Wifi Status screen-->
|
||||||
|
<string name="rx_link_speed_label" translatable="false">Receive link speed:</string>
|
||||||
<!-- Do not translate. Used for diagnostic screens, precise translation is not necessary
|
<!-- Do not translate. Used for diagnostic screens, precise translation is not necessary
|
||||||
Label on Wifi Status screen-->
|
Label on Wifi Status screen-->
|
||||||
<string name="scan_list_label" translatable="false">Scan results:</string>
|
<string name="scan_list_label" translatable="false">Scan results:</string>
|
||||||
|
@@ -96,8 +96,13 @@
|
|||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
settings:enableCopying="true"/>
|
settings:enableCopying="true"/>
|
||||||
<Preference
|
<Preference
|
||||||
android:key="link_speed"
|
android:key="tx_link_speed"
|
||||||
android:title="@string/wifi_speed"
|
android:title="@string/tx_wifi_speed"
|
||||||
|
android:selectable="false"
|
||||||
|
settings:enableCopying="true"/>
|
||||||
|
<Preference
|
||||||
|
android:key="rx_link_speed"
|
||||||
|
android:title="@string/rx_wifi_speed"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
settings:enableCopying="true"/>
|
settings:enableCopying="true"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
@@ -363,9 +363,14 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
}
|
}
|
||||||
|
|
||||||
WifiInfo info = mAccessPoint.getInfo();
|
WifiInfo info = mAccessPoint.getInfo();
|
||||||
if (info != null && info.getLinkSpeed() != -1) {
|
if (info != null && info.getTxLinkSpeedMbps() != -1) {
|
||||||
addRow(group, R.string.wifi_speed, String.format(
|
addRow(group, R.string.tx_wifi_speed, String.format(
|
||||||
res.getString(R.string.link_speed), info.getLinkSpeed()));
|
res.getString(R.string.tx_link_speed), info.getTxLinkSpeedMbps()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info != null && info.getRxLinkSpeedMbps() != -1) {
|
||||||
|
addRow(group, R.string.rx_wifi_speed, String.format(
|
||||||
|
res.getString(R.string.rx_link_speed), info.getRxLinkSpeedMbps()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info != null && info.getFrequency() != -1) {
|
if (info != null && info.getFrequency() != -1) {
|
||||||
|
@@ -64,7 +64,8 @@ public class WifiStatusTest extends Activity {
|
|||||||
private TextView mIPAddr;
|
private TextView mIPAddr;
|
||||||
private TextView mMACAddr;
|
private TextView mMACAddr;
|
||||||
private TextView mNetworkId;
|
private TextView mNetworkId;
|
||||||
private TextView mLinkSpeed;
|
private TextView mTxLinkSpeed;
|
||||||
|
private TextView mRxLinkSpeed;
|
||||||
private TextView mScanList;
|
private TextView mScanList;
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +143,8 @@ public class WifiStatusTest extends Activity {
|
|||||||
mIPAddr = (TextView) findViewById(R.id.ipaddr);
|
mIPAddr = (TextView) findViewById(R.id.ipaddr);
|
||||||
mMACAddr = (TextView) findViewById(R.id.macaddr);
|
mMACAddr = (TextView) findViewById(R.id.macaddr);
|
||||||
mNetworkId = (TextView) findViewById(R.id.networkid);
|
mNetworkId = (TextView) findViewById(R.id.networkid);
|
||||||
mLinkSpeed = (TextView) findViewById(R.id.link_speed);
|
mTxLinkSpeed = (TextView) findViewById(R.id.tx_link_speed);
|
||||||
|
mRxLinkSpeed = (TextView) findViewById(R.id.rx_link_speed);
|
||||||
mScanList = (TextView) findViewById(R.id.scan_list);
|
mScanList = (TextView) findViewById(R.id.scan_list);
|
||||||
|
|
||||||
|
|
||||||
@@ -186,7 +188,8 @@ public class WifiStatusTest extends Activity {
|
|||||||
append((ipAddr >>>= 8) & 0xff);
|
append((ipAddr >>>= 8) & 0xff);
|
||||||
|
|
||||||
mIPAddr.setText(ipBuf);
|
mIPAddr.setText(ipBuf);
|
||||||
mLinkSpeed.setText(String.valueOf(wifiInfo.getLinkSpeed())+" Mbps");
|
mTxLinkSpeed.setText(String.valueOf(wifiInfo.getTxLinkSpeedMbps())+" Mbps");
|
||||||
|
mRxLinkSpeed.setText(String.valueOf(wifiInfo.getRxLinkSpeedMbps())+" Mbps");
|
||||||
mMACAddr.setText(wifiInfo.getMacAddress());
|
mMACAddr.setText(wifiInfo.getMacAddress());
|
||||||
mNetworkId.setText(String.valueOf(wifiInfo.getNetworkId()));
|
mNetworkId.setText(String.valueOf(wifiInfo.getNetworkId()));
|
||||||
mRSSI.setText(String.valueOf(wifiInfo.getRssi()));
|
mRSSI.setText(String.valueOf(wifiInfo.getRssi()));
|
||||||
|
@@ -99,7 +99,9 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
|||||||
@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";
|
static final String KEY_TX_LINK_SPEED = "tx_link_speed";
|
||||||
|
@VisibleForTesting
|
||||||
|
static final String KEY_RX_LINK_SPEED = "rx_link_speed";
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final String KEY_FREQUENCY_PREF = "frequency";
|
static final String KEY_FREQUENCY_PREF = "frequency";
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -138,7 +140,8 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
|||||||
private ActionButtonsPreference mButtonsPref;
|
private ActionButtonsPreference mButtonsPref;
|
||||||
private EntityHeaderController mEntityHeaderController;
|
private EntityHeaderController mEntityHeaderController;
|
||||||
private Preference mSignalStrengthPref;
|
private Preference mSignalStrengthPref;
|
||||||
private Preference mLinkSpeedPref;
|
private Preference mTxLinkSpeedPref;
|
||||||
|
private Preference mRxLinkSpeedPref;
|
||||||
private Preference mFrequencyPref;
|
private Preference mFrequencyPref;
|
||||||
private Preference mSecurityPref;
|
private Preference mSecurityPref;
|
||||||
private Preference mMacAddressPref;
|
private Preference mMacAddressPref;
|
||||||
@@ -291,7 +294,8 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
|||||||
.setButton3OnClickListener(view -> shareNetwork());
|
.setButton3OnClickListener(view -> shareNetwork());
|
||||||
|
|
||||||
mSignalStrengthPref = screen.findPreference(KEY_SIGNAL_STRENGTH_PREF);
|
mSignalStrengthPref = screen.findPreference(KEY_SIGNAL_STRENGTH_PREF);
|
||||||
mLinkSpeedPref = screen.findPreference(KEY_LINK_SPEED);
|
mTxLinkSpeedPref = screen.findPreference(KEY_TX_LINK_SPEED);
|
||||||
|
mRxLinkSpeedPref = screen.findPreference(KEY_RX_LINK_SPEED);
|
||||||
mFrequencyPref = screen.findPreference(KEY_FREQUENCY_PREF);
|
mFrequencyPref = screen.findPreference(KEY_FREQUENCY_PREF);
|
||||||
mSecurityPref = screen.findPreference(KEY_SECURITY_PREF);
|
mSecurityPref = screen.findPreference(KEY_SECURITY_PREF);
|
||||||
|
|
||||||
@@ -367,11 +371,17 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
|||||||
// MAC Address Pref
|
// MAC Address Pref
|
||||||
mMacAddressPref.setSummary(mWifiInfo.getMacAddress());
|
mMacAddressPref.setSummary(mWifiInfo.getMacAddress());
|
||||||
|
|
||||||
// Link Speed Pref
|
// Transmit Link Speed Pref
|
||||||
int linkSpeedMbps = mWifiInfo.getLinkSpeed();
|
int txLinkSpeedMbps = mWifiInfo.getTxLinkSpeedMbps();
|
||||||
mLinkSpeedPref.setVisible(linkSpeedMbps >= 0);
|
mTxLinkSpeedPref.setVisible(txLinkSpeedMbps >= 0);
|
||||||
mLinkSpeedPref.setSummary(mContext.getString(
|
mTxLinkSpeedPref.setSummary(mContext.getString(
|
||||||
R.string.link_speed, mWifiInfo.getLinkSpeed()));
|
R.string.tx_link_speed, mWifiInfo.getTxLinkSpeedMbps()));
|
||||||
|
|
||||||
|
// Receive Link Speed Pref
|
||||||
|
int rxLinkSpeedMbps = mWifiInfo.getRxLinkSpeedMbps();
|
||||||
|
mRxLinkSpeedPref.setVisible(rxLinkSpeedMbps >= 0);
|
||||||
|
mRxLinkSpeedPref.setSummary(mContext.getString(
|
||||||
|
R.string.rx_link_speed, mWifiInfo.getRxLinkSpeedMbps()));
|
||||||
|
|
||||||
// Frequency Pref
|
// Frequency Pref
|
||||||
final int frequency = mWifiInfo.getFrequency();
|
final int frequency = mWifiInfo.getFrequency();
|
||||||
|
@@ -100,7 +100,8 @@ 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 int TX_LINK_SPEED = 123;
|
||||||
|
private static final int RX_LINK_SPEED = 54;
|
||||||
private static final String MAC_ADDRESS = WifiInfo.DEFAULT_MAC_ADDRESS;
|
private static final String MAC_ADDRESS = WifiInfo.DEFAULT_MAC_ADDRESS;
|
||||||
private static final String SECURITY = "None";
|
private static final String SECURITY = "None";
|
||||||
|
|
||||||
@@ -142,7 +143,9 @@ public class WifiDetailPreferenceControllerTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private Preference mockSignalStrengthPref;
|
private Preference mockSignalStrengthPref;
|
||||||
@Mock
|
@Mock
|
||||||
private Preference mockLinkSpeedPref;
|
private Preference mockTxLinkSpeedPref;
|
||||||
|
@Mock
|
||||||
|
private Preference mockRxLinkSpeedPref;
|
||||||
@Mock
|
@Mock
|
||||||
private Preference mockFrequencyPref;
|
private Preference mockFrequencyPref;
|
||||||
@Mock
|
@Mock
|
||||||
@@ -247,7 +250,8 @@ public class WifiDetailPreferenceControllerTest {
|
|||||||
when(mockButtonsPref.setButton1OnClickListener(mForgetClickListener.capture()))
|
when(mockButtonsPref.setButton1OnClickListener(mForgetClickListener.capture()))
|
||||||
.thenReturn(mockButtonsPref);
|
.thenReturn(mockButtonsPref);
|
||||||
|
|
||||||
when(mockWifiInfo.getLinkSpeed()).thenReturn(LINK_SPEED);
|
when(mockWifiInfo.getTxLinkSpeedMbps()).thenReturn(TX_LINK_SPEED);
|
||||||
|
when(mockWifiInfo.getRxLinkSpeedMbps()).thenReturn(RX_LINK_SPEED);
|
||||||
when(mockWifiInfo.getRssi()).thenReturn(RSSI);
|
when(mockWifiInfo.getRssi()).thenReturn(RSSI);
|
||||||
when(mockWifiInfo.getMacAddress()).thenReturn(MAC_ADDRESS);
|
when(mockWifiInfo.getMacAddress()).thenReturn(MAC_ADDRESS);
|
||||||
when(mockWifiManager.getConnectionInfo()).thenReturn(mockWifiInfo);
|
when(mockWifiManager.getConnectionInfo()).thenReturn(mockWifiInfo);
|
||||||
@@ -294,8 +298,10 @@ public class WifiDetailPreferenceControllerTest {
|
|||||||
.thenReturn(mockButtonsPref);
|
.thenReturn(mockButtonsPref);
|
||||||
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))
|
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_TX_LINK_SPEED))
|
||||||
.thenReturn(mockLinkSpeedPref);
|
.thenReturn(mockTxLinkSpeedPref);
|
||||||
|
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_RX_LINK_SPEED))
|
||||||
|
.thenReturn(mockRxLinkSpeedPref);
|
||||||
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))
|
||||||
@@ -414,20 +420,38 @@ public class WifiDetailPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void linkSpeedPref_shouldHaveDetailTextSet() {
|
public void linkSpeedPref_shouldHaveDetailTextSet() {
|
||||||
String expectedLinkSpeed = mContext.getString(R.string.link_speed, LINK_SPEED);
|
String expectedLinkSpeed = mContext.getString(R.string.tx_link_speed, TX_LINK_SPEED);
|
||||||
|
|
||||||
displayAndResume();
|
displayAndResume();
|
||||||
|
|
||||||
verify(mockLinkSpeedPref).setSummary(expectedLinkSpeed);
|
verify(mockTxLinkSpeedPref).setSummary(expectedLinkSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void linkSpeedPref_shouldNotShowIfNotSet() {
|
public void linkSpeedPref_shouldNotShowIfNotSet() {
|
||||||
when(mockWifiInfo.getLinkSpeed()).thenReturn(-1);
|
when(mockWifiInfo.getTxLinkSpeedMbps()).thenReturn(-1);
|
||||||
|
|
||||||
displayAndResume();
|
displayAndResume();
|
||||||
|
|
||||||
verify(mockLinkSpeedPref).setVisible(false);
|
verify(mockTxLinkSpeedPref).setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void rxLinkSpeedPref_shouldHaveDetailTextSet() {
|
||||||
|
String expectedLinkSpeed = mContext.getString(R.string.rx_link_speed, RX_LINK_SPEED);
|
||||||
|
|
||||||
|
displayAndResume();
|
||||||
|
|
||||||
|
verify(mockRxLinkSpeedPref).setSummary(expectedLinkSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void rxLinkSpeedPref_shouldNotShowIfNotSet() {
|
||||||
|
when(mockWifiInfo.getRxLinkSpeedMbps()).thenReturn(-1);
|
||||||
|
|
||||||
|
displayAndResume();
|
||||||
|
|
||||||
|
verify(mockRxLinkSpeedPref).setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user