Merge "wifi: add basic support for 60GHz band" into q-keystone-qcom-dev
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 9167746..6bfb1d5 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -106,6 +106,16 @@
      */
     public static final int HIGHER_FREQ_5GHZ = 5900;
 
+    /**
+     * Lower bound on the 60 GHz (802.11ad) WIGIG channels
+     */
+    public static final int LOWER_FREQ_60GHZ = 58320;
+
+    /**
+     * Upper bound on the 60 GHz (802.11ad) WIGIG channels
+     */
+    public static final int HIGHER_FREQ_60GHZ = 70200;
+
     /** The key which identifies this AccessPoint grouping. */
     private String mKey;
 
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
index 4e6c005..30c06ce 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiUtils.java
@@ -86,6 +86,7 @@
         StringBuilder visibility = new StringBuilder();
         StringBuilder scans24GHz = new StringBuilder();
         StringBuilder scans5GHz = new StringBuilder();
+        StringBuilder scans60GHz = new StringBuilder();
         String bssid = null;
 
         if (accessPoint.isActive() && info != null) {
@@ -107,9 +108,11 @@
 
         int maxRssi5 = WifiConfiguration.INVALID_RSSI;
         int maxRssi24 = WifiConfiguration.INVALID_RSSI;
+        int maxRssi60 = WifiConfiguration.INVALID_RSSI;
         final int maxDisplayedScans = 4;
         int num5 = 0; // number of scanned BSSID on 5GHz band
         int num24 = 0; // number of scanned BSSID on 2.4Ghz band
+        int num60 = 0; // number of scanned BSSID on 60Ghz band
         int numBlackListed = 0;
 
         // TODO: sort list by RSSI or age
@@ -144,6 +147,19 @@
                             verboseScanResultSummary(accessPoint, result, bssid,
                                     nowMs));
                 }
+            } else if (result.frequency >= AccessPoint.LOWER_FREQ_60GHZ
+                    && result.frequency <= AccessPoint.HIGHER_FREQ_60GHZ) {
+                // Strictly speaking: [60000, 61000]
+                num60++;
+
+                if (result.level > maxRssi60) {
+                    maxRssi60 = result.level;
+                }
+                if (num60 <= maxDisplayedScans) {
+                    scans60GHz.append(
+                            verboseScanResultSummary(accessPoint, result, bssid,
+                                    nowMs));
+                }
             }
         }
         visibility.append(" [");
@@ -162,6 +178,14 @@
             }
             visibility.append(scans5GHz.toString());
         }
+        visibility.append(";");
+        if (num60 > 0) {
+            visibility.append("(").append(num60).append(")");
+            if (num60 > maxDisplayedScans) {
+                visibility.append("max=").append(maxRssi60).append(",");
+            }
+            visibility.append(scans60GHz.toString());
+        }
         if (numBlackListed > 0) {
             visibility.append("!").append(numBlackListed);
         }
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index 103d4a8..0761400 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -442,6 +442,21 @@
     }
 
     /**
+     * @hide
+     */
+    public boolean is60GHz() {
+        return ScanResult.is60GHz(frequency);
+    }
+
+    /**
+     * @hide
+     * TODO: makes real freq boundaries
+     */
+    public static boolean is60GHz(int freq) {
+        return freq >= 58320 && freq <= 70200;
+    }
+
+    /**
      *  @hide
      * anqp lines from supplicant BSS response
      */
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 48c572b..e1e6814 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -512,6 +512,12 @@
     public static final int AP_BAND_DUAL = 2;
 
     /**
+     * 60GHz band
+     * @hide
+     */
+    public static final int AP_BAND_60GHZ = 3;
+
+    /**
      * Device is allowed to choose the optimal band (2Ghz or 5Ghz) based on device capability,
      * operating country code and current radio conditions.
      * @hide