Android: Ask for the local network permission before starting file upload

Part of #21585

Android 17 apps need ACCESS_LOCAL_NETWORK to serve other devices on the LAN.
The upload screen now asks for it when it opens, starts the web server once
it's granted, and shows a warning and a retry button if it's denied.

The permission only exists from API 37, so check for that rather than 35.
On Android 15 and 16 it reads as denied, which left Remote ISO's connect tab
stuck behind a permission request that could never succeed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-16 20:44:04 +02:00
1 parent 62b2eaa3fd
commit d2e9e87242
4 files changed
+42 -6

No files matched your search

@@ -249,7 +249,8 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
NativeApp.sendMessageFromJava("permission_denied", "storage");
}
if (Build.VERSION.SDK_INT >= 35) {
// ACCESS_LOCAL_NETWORK exists from Android 17 (API 37). Earlier versions report it as denied.
if (Build.VERSION.SDK_INT >= 37) {
if (this.checkSelfPermission("android.permission.ACCESS_LOCAL_NETWORK") == PackageManager.PERMISSION_GRANTED) {
NativeApp.sendMessageFromJava("permission_granted", "local_network");
} else {
@@ -1828,7 +1829,7 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
}
return true;
} else if (command.equals("ask_permission") && params.equals("local_network")) {
if (Build.VERSION.SDK_INT >= 35) {
if (Build.VERSION.SDK_INT >= 37) {
if (askForPermissions(permissionsForLocalNetwork, REQUEST_CODE_LOCAL_NETWORK_PERMISSION)) {
NativeApp.sendMessageFromJava("permission_pending", "local_network");
} else {