Home » Android » Prevent wifi scan throttling on Android 9 (Pie) with NETWORK_SETTINGS permission

Prevent wifi scan throttling on Android 9 (Pie) with NETWORK_SETTINGS permission

Posted by: admin June 15, 2020 Leave a comment

Questions:

As some have noted, Android 9 (Pie) severely restricts wifi scans, thus crippling any apps that do wifi logging or wifi-based location lookups with a frequency similar to a GPS.

As described in the ticket linked above:

  • Each foreground app is restricted to 4 scans every 2 minutes
  • All background apps combined are restricted to one scan every 30 minutes
  • Apps holding android.Manifest.permission.NETWORK_SETTINGS permission are exempted from scan throttling (cf. docs)

However, I don’t find android.Manifest.permission.NETWORK_SETTINGS described anywhere in the docs (I would expect it to be documented at android.manifest.permission).

If I simply declare

in the manifest, the app builds OK, installs OK but I don’t see any extra permissions (even when I choose to show all), at least on Oreo (unfortunately I don’t have a Pie device to test on yet).

Is android.Manifest.permission.NETWORK_SETTINGS a regular permission that’s available to regular user (i.e. non-system) apps?

How to&Answers:

Unfortunately that’s a signature level permission reserved only for system applications:

<!-- Allows Settings and SystemUI to call methods in Networking services
     <p>Not for use by third-party or privileged applications.
     @hide This should only be used by Settings and SystemUI.
-->
<permission android:name="android.permission.NETWORK_SETTINGS"
    android:protectionLevel="signature" />

Source: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml

Answer:

It is rumoured that Android Q will have a new permission android.permission.ACCESS_BACKGROUND_LOCATION that allows background scanning. The docs say it “Allows an app to access location in the background.” The protection level is “dangerous” rather than “signature”.