docs: correct ACCESS_LOCAL_NETWORK permission-group claim

Device testing on Android 17 (API 37) disproved the earlier claim that
ACCESS_LOCAL_NETWORK is effectively free because it shares the NEARBY_DEVICES
group with NEARBY_WIFI_DEVICES.

Granting NEARBY_WIFI_DEVICES alone leaves ACCESS_LOCAL_NETWORK denied:

  pm grant ... NEARBY_WIFI_DEVICES
  -> NEARBY_WIFI_DEVICES:  granted=true
  -> ACCESS_LOCAL_NETWORK: granted=false

The two are tracked and granted independently, so ACCESS_LOCAL_NETWORK has to
be requested explicitly. That is exactly what the wifiAwarePermissions() list
already does, so no behavioural change is needed — only the comments were
wrong. Whether the runtime dialog bundles the two into a single prompt remains
unverified, since enabling Wi-Fi Aware from Debug Settings after onboarding
never triggers a permission request at all (pre-existing, unrelated to this
branch).

Comment-only change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Moe HamadeandClaude Opus 5 committed 2026-07-26 15:43:43 +03:00
1 parent c643c90c59
commit e35fac3c67
2 files changed
+9 -4

No files matched your search

+2 -2
View File
@@ -31,8 +31,8 @@
Android 17 (API 37) makes local network protection mandatory for apps targeting it.
The Wi‑Fi Aware transport reaches peers over link-local IPv6 TCP sockets
(WifiAwareMeshService.connectAwareClientSocket), so declare this defensively.
It belongs to the NEARBY_DEVICES group, so it does not add a prompt for users
who have already granted NEARBY_WIFI_DEVICES.
It belongs to the NEARBY_DEVICES group, but is granted independently of
NEARBY_WIFI_DEVICES, so it must be requested explicitly (see PermissionManager).
-->
<uses-permission android:name="android.permission.ACCESS_LOCAL_NETWORK" />
<!-- Signature permission for internal UI shutdown broadcasts -->
@@ -45,8 +45,13 @@ class PermissionManager(private val context: Context) {
* Android 17 (API 37) makes local network protection mandatory for apps that target it.
* WifiAwareMeshService reaches peers over link-local IPv6 TCP sockets
* (connectAwareClientSocket), so ACCESS_LOCAL_NETWORK is requested defensively there.
* It shares the NEARBY_DEVICES group with NEARBY_WIFI_DEVICES, so granting it does not
* cost the user an extra prompt.
*
* Note that although ACCESS_LOCAL_NETWORK shares the NEARBY_DEVICES group with
* NEARBY_WIFI_DEVICES, the two are tracked and granted independently: granting
* NEARBY_WIFI_DEVICES alone leaves ACCESS_LOCAL_NETWORK denied (verified on an
* Android 17 device). It must therefore be requested explicitly, which is what this
* list is for. Whether the runtime dialog bundles the two into a single prompt has
* not been verified.
*/
private fun wifiAwarePermissions(): List<String> {
val permissions = mutableListOf(Manifest.permission.NEARBY_WIFI_DEVICES)