diff options
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) { |