使用 NETWORK_SETTINGS 权限防止 Android 9 (Pie) 上的 wifi 扫描节流
Prevent wifi scan throttling on Android 9 (Pie) with NETWORK_SETTINGS permission
正如一些 noted、Android 9 (Pie) 严格限制 wifi 扫描,从而削弱任何以类似于 GPS 的频率进行 wifi 日志记录或基于 wifi 的位置查找的应用程序。
如上面链接的票证中所述:
- 每个前台应用每 2 分钟限制为 4 次扫描
- 所有后台应用合并限制为每 30 分钟扫描一次
- 持有
android.Manifest.permission.NETWORK_SETTINGS
权限的应用免于扫描限制(参见docs)
但是,我没有在文档中的任何地方找到 android.Manifest.permission.NETWORK_SETTINGS
的描述(我希望它在 android.manifest.permission 中有记录)。
如果我简单地声明
在清单中,应用程序构建正常,安装正常,但我没有看到任何额外的权限(即使我选择显示全部),至少在 Oreo 上是这样(不幸的是我还没有 Pie 设备可以测试)。
android.Manifest.permission.NETWORK_SETTINGS
是普通用户(即非系统)应用程序可用的常规权限吗?
不幸的是,这是只为系统应用程序保留的 signature
级别权限:
<!-- 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" />
来源:https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml
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" 而不是 "signature".
正如一些 noted、Android 9 (Pie) 严格限制 wifi 扫描,从而削弱任何以类似于 GPS 的频率进行 wifi 日志记录或基于 wifi 的位置查找的应用程序。
如上面链接的票证中所述:
- 每个前台应用每 2 分钟限制为 4 次扫描
- 所有后台应用合并限制为每 30 分钟扫描一次
- 持有
android.Manifest.permission.NETWORK_SETTINGS
权限的应用免于扫描限制(参见docs)
但是,我没有在文档中的任何地方找到 android.Manifest.permission.NETWORK_SETTINGS
的描述(我希望它在 android.manifest.permission 中有记录)。
如果我简单地声明 在清单中,应用程序构建正常,安装正常,但我没有看到任何额外的权限(即使我选择显示全部),至少在 Oreo 上是这样(不幸的是我还没有 Pie 设备可以测试)。
android.Manifest.permission.NETWORK_SETTINGS
是普通用户(即非系统)应用程序可用的常规权限吗?
不幸的是,这是只为系统应用程序保留的 signature
级别权限:
<!-- 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" />
来源:https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml
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" 而不是 "signature".