From 808070ccbb721ffb6e6aafb540a229c3888b60f4 Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Tue, 31 Dec 2019 14:54:31 +0800 Subject: [PATCH] [Wi-Fi] Show link speed for WifiDialog2 MODE_VIEW Now there is no WifiDialog2 MODE_VIEW use case since they are replaced by WifiNetworkDetailsFragment2. Should think about removing MODE_VIEW in the future, however, we should let it work before phase out it. Bug: 146407136 Test: build Change-Id: I7cd470c74cea846046975b8c65fd2604702cc136 --- res/values/strings.xml | 5 ++++- .../settings/wifi/WifiConfigController2.java | 16 +++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 03b52b49225..b8311a72ad1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1765,7 +1765,8 @@ %1$d Mbps %1$d Mbps - + + %1$d Mbps %s wants to turn on Wi-Fi @@ -1976,6 +1977,8 @@ Transmit link speed Receive link speed + + Link speed Frequency diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java index 3e8a42cfc6a..c6b4702bbc3 100644 --- a/src/com/android/settings/wifi/WifiConfigController2.java +++ b/src/com/android/settings/wifi/WifiConfigController2.java @@ -366,7 +366,7 @@ public class WifiConfigController2 implements TextWatcher, } else { final String signalLevel = getSignalString(); - if (mWifiEntry.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED + if (mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED && signalLevel != null) { mConfigUi.setSubmitButton(res.getString(R.string.wifi_connect)); } else { @@ -388,16 +388,10 @@ public class WifiConfigController2 implements TextWatcher, } final ConnectedInfo info = mWifiEntry.getConnectedInfo(); - // TODO(b/143326832): Replace it with ConnectedInfo#linkSpeedMbps. - //if (info != null && info.getTxLinkSpeedMbps() != WifiInfo.LINK_SPEED_UNKNOWN) { - // addRow(group, R.string.tx_wifi_speed, String.format( - // res.getString(R.string.tx_link_speed), info.getTxLinkSpeedMbps())); - //} - - //if (info != null && info.getRxLinkSpeedMbps() != WifiInfo.LINK_SPEED_UNKNOWN) { - // addRow(group, R.string.rx_wifi_speed, String.format( - // res.getString(R.string.rx_link_speed), info.getRxLinkSpeedMbps())); - //} + if (info != null && info.linkSpeedMbps >= 0) { + addRow(group, R.string.wifi_speed, String.format( + res.getString(R.string.link_speed), info.linkSpeedMbps)); + } if (info != null && info.frequencyMhz != WifiEntry.FREQUENCY_UNKNOWN) { final int frequency = info.frequencyMhz;