Commit 901cff4
fix(permissions): proactively request ACCESS_LOCAL_NETWORK to suppress NSD picker
On Android 17 (API 37) with targetSdk=37, the platform falls back to the
system 'Choose a device to connect' picker on every NsdManager.discoverServices()
call when ACCESS_LOCAL_NETWORK isn't granted. Removing the manifest entry in
the previous commit only suppressed the runtime grant flavor of the prompt —
the picker still fired as the platform's mediated fallback.
This restores the manifest declaration and wires a runtime permission request
into ConnectionsScreen so users get a proper one-time grant prompt instead of
a per-scan picker. Because ACCESS_LOCAL_NETWORK is in the NEARBY_DEVICES
permission group, users who have already granted Bluetooth permissions are
silently auto-granted with no UI shown.
- Re-add ACCESS_LOCAL_NETWORK to AndroidManifest.xml with comment explaining
the Android 17 LNP enforcement and dual TAK/NSD use case.
- Add isLocalNetworkPermissionGranted() expect/actual helper to core/ui.
- Gate ConnectionsScreen network auto-start on the runtime grant so a
previously-persisted networkAutoScan=true does not surface the picker for
users who haven't granted the permission.
- Manual scan toggle now requests the permission before starting and persists
the user's intent so the launcher's onGranted callback can start the scan.
- Add ScannerViewModel.persistNetworkAutoScanIntent for the deferred-start path.
- Update TakPermissionUtil comment — pre-existing comment claimed the
permission was 'NOT required for NSD', which was true on Android 16 but
false on Android 17 with targetSdk=37.
Verified on Pixel 6a / Android 17 / API 37: NSD discovery now runs without
the picker, and the permission is silently auto-granted via the NEARBY_DEVICES
group when Bluetooth perms are already held.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent be7c008 commit 901cff4
8 files changed
Lines changed: 77 additions & 9 deletions
File tree
- app/src/main
- core/ui/src
- androidMain/kotlin/org/meshtastic/core/ui/util
- commonMain/kotlin/org/meshtastic/core/ui/util
- iosMain/kotlin/org/meshtastic/core/ui/util
- jvmMain/kotlin/org/meshtastic/core/ui/util
- feature
- connections/src/commonMain/kotlin/org/meshtastic/feature/connections
- ui
- settings/src/androidMain/kotlin/org/meshtastic/feature/settings/tak
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
274 | 289 | | |
275 | 290 | | |
276 | 291 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
268 | 277 | | |
269 | 278 | | |
270 | 279 | | |
| |||
Lines changed: 28 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
121 | 133 | | |
122 | 134 | | |
123 | | - | |
124 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
125 | 138 | | |
126 | | - | |
| 139 | + | |
127 | 140 | | |
128 | 141 | | |
129 | 142 | | |
| |||
263 | 276 | | |
264 | 277 | | |
265 | 278 | | |
266 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
267 | 291 | | |
268 | 292 | | |
269 | 293 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments