From f8d798631b862ec25a8c04962de23d80e881c813 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Mon, 3 Feb 2014 11:29:02 -0800 Subject: [PATCH] Displays frequency on connected WiFi network info. Bug: 12767819 Change-Id: Ia71b28b1dd77bdabc53a3e91bd54375bdaebfe4a --- res/values/strings.xml | 2 ++ .../settings/wifi/WifiConfigController.java | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index f95f881fa21..882ae55b42f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1437,6 +1437,8 @@ Status Link speed + + Frequency IP address diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index 55dc0337566..8dc5c91aeda 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -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));