OSDN Git Service

Merge "Displays frequency on connected WiFi network info. Bug: 12767819"
authorFelipe Leme <felipeal@google.com>
Fri, 14 Mar 2014 22:42:05 +0000 (22:42 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 14 Mar 2014 22:42:05 +0000 (22:42 +0000)
res/values/strings.xml
src/com/android/settings/wifi/WifiConfigController.java

index 5b4bf28..1d6c751 100644 (file)
     <string name="wifi_status">Status</string>
     <!-- Label for the link speed of the connection -->
     <string name="wifi_speed">Link speed</string>
+    <!-- Label for the frequency band of the connection -->
+    <string name="wifi_frequency">Frequency</string>
     <!-- Label for the IP address of the connection -->
     <string name="wifi_ip_address">IP address</string>
     <!-- Hint text for the IP address -->
index 55dc033..8dc5c91 100644 (file)
@@ -218,6 +218,22 @@ public class WifiConfigController implements TextWatcher,
             if (info != null && info.getLinkSpeed() != -1) {
                 addRow(group, R.string.wifi_speed, info.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS);
             }
+            if (info != null && info.getFrequency() != -1) {
+              // Since the frequency is defined on MHz, we need to simplify it
+              // to just 2.4GHz (regardless of the locale) or 5GHz.
+              int frequency = info.getFrequency();
+              String band = null;
+              if (frequency >= 2400 && frequency < 2500) {
+                band = "2.4GHz";
+              } else if (frequency >= 5000 && frequency < 6000) {
+                band = "5GHz";
+              } else {
+                Log.e(TAG, "Unexpected frequency " + frequency);
+              }
+              if (band != null) {
+                addRow(group, R.string.wifi_frequency, band);
+              }
+            }
 
             addRow(group, R.string.wifi_security, mAccessPoint.getSecurityString(false));