diff options
5 files changed, 43 insertions, 44 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index 134a90cd5..d8df0da72 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -1346,8 +1346,8 @@ public class WifiNative { * @param capabilities object to be filled in * @return true for success. false for failure */ - public boolean getScanCapabilities(ScanCapabilities capabilities) { - return mWifiVendorHal.getScanCapabilities(capabilities); + public boolean getBgScanCapabilities(ScanCapabilities capabilities) { + return mWifiVendorHal.getBgScanCapabilities(capabilities); } public static class ChannelSettings { @@ -1496,36 +1496,36 @@ public class WifiNative { * @param eventHandler to call with the results * @return true for success */ - public boolean startScan(ScanSettings settings, ScanEventHandler eventHandler) { - return mWifiVendorHal.startScan(settings, eventHandler); + public boolean startBgScan(ScanSettings settings, ScanEventHandler eventHandler) { + return mWifiVendorHal.startBgScan(settings, eventHandler); } /** * Stops any ongoing backgound scan */ - public void stopScan() { - mWifiVendorHal.stopScan(); + public void stopBgScan() { + mWifiVendorHal.stopBgScan(); } /** * Pauses an ongoing backgound scan */ - public void pauseScan() { - mWifiVendorHal.pauseScan(); + public void pauseBgScan() { + mWifiVendorHal.pauseBgScan(); } /** * Restarts a paused scan */ - public void restartScan() { - mWifiVendorHal.restartScan(); + public void restartBgScan() { + mWifiVendorHal.restartBgScan(); } /** * Gets the latest scan results received. */ - public WifiScanner.ScanData[] getScanResults(boolean flush) { - return mWifiVendorHal.getScanResults(); + public WifiScanner.ScanData[] getBgScanResults() { + return mWifiVendorHal.getBgScanResults(); } public static interface HotlistEventHandler { diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java index 0c1a56c46..36e1f3aec 100644 --- a/service/java/com/android/server/wifi/WifiVendorHal.java +++ b/service/java/com/android/server/wifi/WifiVendorHal.java @@ -394,9 +394,9 @@ public class WifiVendorHal { * Gets the scan capabilities * * @param capabilities object to be filled in - * @return true for success. false for failure + * @return true for success, false for failure */ - public boolean getScanCapabilities(WifiNative.ScanCapabilities capabilities) { + public boolean getBgScanCapabilities(WifiNative.ScanCapabilities capabilities) { synchronized (sLock) { if (mIWifiStaIface == null) return boolResult(false); try { @@ -540,15 +540,15 @@ public class WifiVendorHal { /** * Starts a background scan - * <p> + * * Any ongoing scan will be stopped first * * @param settings to control the scan * @param eventHandler to call with the results * @return true for success */ - public boolean startScan(WifiNative.ScanSettings settings, - WifiNative.ScanEventHandler eventHandler) { + public boolean startBgScan(WifiNative.ScanSettings settings, + WifiNative.ScanEventHandler eventHandler) { WifiStatus status; if (eventHandler == null) return boolResult(false); synchronized (sLock) { @@ -576,7 +576,7 @@ public class WifiVendorHal { /** * Stops any ongoing backgound scan */ - public void stopScan() { + public void stopBgScan() { WifiStatus status; synchronized (sLock) { if (mIWifiStaIface == null) return; @@ -594,7 +594,7 @@ public class WifiVendorHal { /** * Pauses an ongoing backgound scan */ - public void pauseScan() { + public void pauseBgScan() { WifiStatus status; synchronized (sLock) { try { @@ -611,9 +611,9 @@ public class WifiVendorHal { } /** - * Restarts a paused scan + * Restarts a paused background scan */ - public void restartScan() { + public void restartBgScan() { WifiStatus status; synchronized (sLock) { if (mIWifiStaIface == null) return; @@ -634,7 +634,7 @@ public class WifiVendorHal { * TODO(b/35754840): This hop to fetch scan results after callback is unnecessary. Refactor * WifiScanner to use the scan results from the callback. */ - public WifiScanner.ScanData[] getScanResults() { + public WifiScanner.ScanData[] getBgScanResults() { synchronized (sLock) { if (mIWifiStaIface == null) return null; if (mScan == null) return null; @@ -803,9 +803,8 @@ public class WifiVendorHal { /** * Get the supported features - * <p> - * Note that not all the WifiManager.WIFI_FEATURE_* bits are supplied through - * this call. //TODO(b/34900537) fix this + * + * The result may differ depending on the mode (STA or AP) * * @return bitmask defined by WifiManager.WIFI_FEATURE_* */ @@ -923,7 +922,7 @@ public class WifiVendorHal { ans.measurementFrameNumber = result.measurementNumber; ans.successMeasurementFrameNumber = result.successNumber; ans.frameNumberPerBurstPeer = result.numberPerBurstPeer; - ans.status = result.status; //TODO(b/34901744) - don't assume identity translation + ans.status = result.status; //TODO(b/35138520) - don't assume identity translation ans.retryAfterDuration = result.retryAfterDuration; ans.measurementType = result.type; ans.rssi = result.rssi; @@ -1488,7 +1487,7 @@ public class WifiVendorHal { * @return true for success */ public boolean installPacketFilter(byte[] filter) { - int cmdId = 0; //TODO(b/34901818) We only aspire to support one program at a time + int cmdId = 0; // We only aspire to support one program at a time if (filter == null) return boolResult(false); // Copy the program before taking the lock. ArrayList<Byte> program = NativeUtil.byteArrayToArrayList(filter); diff --git a/service/java/com/android/server/wifi/scanner/HalWifiScannerImpl.java b/service/java/com/android/server/wifi/scanner/HalWifiScannerImpl.java index 95528e252..3fb491ae5 100644 --- a/service/java/com/android/server/wifi/scanner/HalWifiScannerImpl.java +++ b/service/java/com/android/server/wifi/scanner/HalWifiScannerImpl.java @@ -66,7 +66,7 @@ public class HalWifiScannerImpl extends WifiScannerImpl implements Handler.Callb @Override public boolean getScanCapabilities(WifiNative.ScanCapabilities capabilities) { - return mWifiNative.getScanCapabilities(capabilities); + return mWifiNative.getBgScanCapabilities(capabilities); } @Override @@ -92,27 +92,27 @@ public class HalWifiScannerImpl extends WifiScannerImpl implements Handler.Callb + ",eventHandler=" + eventHandler); return false; } - return mWifiNative.startScan(settings, eventHandler); + return mWifiNative.startBgScan(settings, eventHandler); } @Override public void stopBatchedScan() { - mWifiNative.stopScan(); + mWifiNative.stopBgScan(); } @Override public void pauseBatchedScan() { - mWifiNative.pauseScan(); + mWifiNative.pauseBgScan(); } @Override public void restartBatchedScan() { - mWifiNative.restartScan(); + mWifiNative.restartBgScan(); } @Override public WifiScanner.ScanData[] getLatestBatchedScanResults(boolean flush) { - return mWifiNative.getScanResults(flush); + return mWifiNative.getBgScanResults(); } @Override diff --git a/service/java/com/android/server/wifi/scanner/WifiScannerImpl.java b/service/java/com/android/server/wifi/scanner/WifiScannerImpl.java index 98e87902a..5e1de30ef 100644 --- a/service/java/com/android/server/wifi/scanner/WifiScannerImpl.java +++ b/service/java/com/android/server/wifi/scanner/WifiScannerImpl.java @@ -48,7 +48,7 @@ public abstract class WifiScannerImpl { public WifiScannerImpl create(Context context, Looper looper, Clock clock) { WifiNative wifiNative = WifiInjector.getInstance().getWifiNative(); WifiMonitor wifiMonitor = WifiInjector.getInstance().getWifiMonitor(); - if (wifiNative.getScanCapabilities(new WifiNative.ScanCapabilities())) { + if (wifiNative.getBgScanCapabilities(new WifiNative.ScanCapabilities())) { return new HalWifiScannerImpl(context, wifiNative, wifiMonitor, looper, clock); } else { return new WificondScannerImpl(context, wifiNative, wifiMonitor, looper, diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java index 000f5866e..6f1d69c69 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java @@ -449,19 +449,19 @@ public class WifiVendorHalTest { mWifiLog = spy(mWifiLog); mWifiVendorHal.mLog = mWifiLog; mWifiVendorHal.mVerboseLog = mWifiLog; - assertFalse(mWifiVendorHal.getScanCapabilities(new WifiNative.ScanCapabilities())); + assertFalse(mWifiVendorHal.getBgScanCapabilities(new WifiNative.ScanCapabilities())); verify(mWifiLog).err("% returns %"); } /** - * Test that getApfCapabilities is hooked up to the HAL correctly + * Test that getBgScanCapabilities is hooked up to the HAL correctly * * A call before the vendor HAL is started should return a non-null result with version 0 * * A call after the HAL is started should return the mocked values. */ @Test - public void testGetScanCapabilities() throws Exception { + public void testGetBgScanCapabilities() throws Exception { StaBackgroundScanCapabilities capabilities = new StaBackgroundScanCapabilities(); capabilities.maxCacheSize = 12; capabilities.maxBuckets = 34; @@ -478,9 +478,9 @@ public class WifiVendorHalTest { WifiNative.ScanCapabilities result = new WifiNative.ScanCapabilities(); - assertFalse(mWifiVendorHal.getScanCapabilities(result)); // should fail - not started + assertFalse(mWifiVendorHal.getBgScanCapabilities(result)); // should fail - not started assertTrue(mWifiVendorHal.startVendorHalSta()); // Start the vendor hal - assertTrue(mWifiVendorHal.getScanCapabilities(result)); // should succeed + assertTrue(mWifiVendorHal.getBgScanCapabilities(result)); // should succeed assertEquals(12, result.max_scan_cache_size); assertEquals(34, result.max_scan_buckets); @@ -1578,8 +1578,8 @@ public class WifiVendorHalTest { int cmdId = mWifiVendorHal.mScan.cmdId; - mWifiVendorHal.stopScan(); - mWifiVendorHal.stopScan(); // second call should not do anything + mWifiVendorHal.stopBgScan(); + mWifiVendorHal.stopBgScan(); // second call should not do anything verify(mIWifiStaIface).stopBackgroundScan(cmdId); // Should be called just once } @@ -1596,8 +1596,8 @@ public class WifiVendorHalTest { int cmdId = mWifiVendorHal.mScan.cmdId; - mWifiVendorHal.pauseScan(); - mWifiVendorHal.restartScan(); + mWifiVendorHal.pauseBgScan(); + mWifiVendorHal.restartBgScan(); verify(mIWifiStaIface).stopBackgroundScan(cmdId); // Should be called just once verify(mIWifiStaIface, times(2)).startBackgroundScan(eq(cmdId), any()); } @@ -1741,7 +1741,7 @@ public class WifiVendorHalTest { bucketSettings.period_ms = 16000; bucketSettings.report_events = WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN; settings.buckets = new WifiNative.BucketSettings[] {bucketSettings}; - assertTrue(mWifiVendorHal.startScan(settings, eventHandler)); + assertTrue(mWifiVendorHal.startBgScan(settings, eventHandler)); } // Create a pair of HIDL scan result and its corresponding framework scan result for |