The WiFi Scan Throttle
Why Indoor GPS Lags
Users often notice that while outdoor GPS updates at 5-10Hz, the indoor "Network Fusion" position sometimes stutters or updates slowly (e.g., once every 30 seconds). This is not a sensor failure; it is an Android battery preservation feature.
The "4 Scans per 2 Minutes" Rule
Starting with Android 9 (Pie), Google introduced strict limits on how often an app can trigger a WiFi scan, even when in the foreground.
The Source Code
The logic is enforced in the system's ScanRequestProxy.java.
- Foreground Apps: Limited to 4 scans every 120 seconds.
- Background Apps: Limited to 1 scan every 30 minutes.
// From com.android.server.wifi.ScanRequestProxy.java
public static final int SCAN_REQUEST_THROTTLE_TIME_WINDOW_FG_APPS_MS = 120 * 1000;
public static final int SCAN_REQUEST_THROTTLE_MAX_IN_TIME_WINDOW_FG_APPS = 4;
public static final int SCAN_REQUEST_THROTTLE_INTERVAL_BG_APPS_MS = 30 * 60 * 1000;
The Impact on Flight
If you are flying indoors using WiFi RTT or standard WiFi triangulation:
- The app requests a scan. Position updates.
- App requests another. Position updates.
- App requests a fifth scan. Blocked.
- The drone's position "freezes" for the next ~110 seconds until the throttle window resets.
The Fix: Developer Options
For reliable indoor flight, you MUST disable this throttling.
- Enable Developer Options (Tap Build Number 7 times).
- Find "WiFi scan throttling" (under Networking).
- Turn it OFF.
This allows MAVLink GPS to scan as fast as the WiFi chip allows (typically 1-2Hz), ensuring smooth position updates.
Source Code Reference
- Throttling Logic:
packages/modules/Wifi/service/java/com/android/server/wifi/ScanRequestProxy.java- Search forSCAN_REQUEST_THROTTLE_MAX_IN_TIME_WINDOW_FG_APPS.