diff options
author | Sohani Rao <sohanirao@google.com> | 2017-08-17 15:08:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-08-17 15:08:13 +0000 |
commit | 73c4fead1c47e82431d117bffed6ea6c843b7980 (patch) | |
tree | 3aab6591a6670ad31acb351ce21600826dd716c0 /service | |
parent | df083b113b3c07274507fd66ed87b2caffb070a4 (diff) | |
parent | 71c4c2a898a827a867564159ce78e41aedd2295b (diff) |
Merge "Introduce new API for retrieving PNO scan results" into oc-mr1-dev
Diffstat (limited to 'service')
3 files changed, 25 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index 973b659d2..1d6c9d4af 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -227,7 +227,16 @@ public class WifiNative { * Returns an empty ArrayList on failure. */ public ArrayList<ScanDetail> getScanResults() { - return mWificondControl.getScanResults(); + return mWificondControl.getScanResults(WificondControl.SCAN_TYPE_SINGLE_SCAN); + } + + /** + * Fetch the latest scan result from kernel via wificond. + * @return Returns an ArrayList of ScanDetail. + * Returns an empty ArrayList on failure. + */ + public ArrayList<ScanDetail> getPnoScanResults() { + return mWificondControl.getScanResults(WificondControl.SCAN_TYPE_PNO_SCAN); } /** diff --git a/service/java/com/android/server/wifi/WificondControl.java b/service/java/com/android/server/wifi/WificondControl.java index 005f36042..70ecabccf 100644 --- a/service/java/com/android/server/wifi/WificondControl.java +++ b/service/java/com/android/server/wifi/WificondControl.java @@ -51,6 +51,13 @@ public class WificondControl { private boolean mVerboseLoggingEnabled = false; private static final String TAG = "WificondControl"; + + /* Get scan results for a single scan */ + public static final int SCAN_TYPE_SINGLE_SCAN = 0; + + /* Get scan results for Pno Scan */ + public static final int SCAN_TYPE_PNO_SCAN = 1; + private WifiInjector mWifiInjector; private WifiMonitor mWifiMonitor; private final CarrierNetworkConfig mCarrierNetworkConfig; @@ -334,14 +341,19 @@ public class WificondControl { * @return Returns an ArrayList of ScanDetail. * Returns an empty ArrayList on failure. */ - public ArrayList<ScanDetail> getScanResults() { + public ArrayList<ScanDetail> getScanResults(int scanType) { ArrayList<ScanDetail> results = new ArrayList<>(); if (mWificondScanner == null) { Log.e(TAG, "No valid wificond scanner interface handler"); return results; } try { - NativeScanResult[] nativeResults = mWificondScanner.getScanResults(); + NativeScanResult[] nativeResults; + if (scanType == SCAN_TYPE_SINGLE_SCAN) { + nativeResults = mWificondScanner.getScanResults(); + } else { + nativeResults = mWificondScanner.getPnoScanResults(); + } for (NativeScanResult result : nativeResults) { WifiSsid wifiSsid = WifiSsid.createFromByteArray(result.ssid); String bssid; diff --git a/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java b/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java index 84105ee61..12a0bdee0 100644 --- a/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java +++ b/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java @@ -538,7 +538,7 @@ public class WificondScannerImpl extends WifiScannerImpl implements Handler.Call // got a scan before we started scanning or after scan was canceled return; } - mNativeScanResults = mWifiNative.getScanResults(); + mNativeScanResults = mWifiNative.getPnoScanResults(); List<ScanResult> hwPnoScanResults = new ArrayList<>(); int numFilteredScanResults = 0; for (int i = 0; i < mNativeScanResults.size(); ++i) { |