RemoteISO: Add (untested) support for the local network permission on Android 17

Part of #21585
This commit is contained in:
Henrik Rydgård
2026-06-15 09:59:35 +02:00
parent 697179c8cd
commit 26c208c41e
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -32,6 +32,7 @@
#include "Common/Net/Resolve.h"
#include "Common/Net/URL.h"
#include "Common/Thread/ThreadUtil.h"
#include "Common/System/System.h"
#include "Common/System/Request.h"
#include "Common/File/PathBrowser.h"
@@ -313,12 +314,34 @@ void RemoteISOScreen::update() {
serverRunning_ = nowRunning;
}
void RemoteISOScreen::sendMessage(UIMessage message, const char *value) {
UITabbedBaseDialogScreen::sendMessage(message, value);
switch (message) {
case UIMessage::PERMISSION_GRANTED:
if (equals(value, "local_network")) {
RecreateViews();
} else {
ERROR_LOG(Log::UI, "Unknown permission granted: %s", value);
}
break;
}
}
void RemoteISOScreen::CreateConnectTab(UI::ViewGroup *tab) {
auto di = GetI18NCategory(I18NCat::DIALOG);
auto ri = GetI18NCategory(I18NCat::REMOTEISO);
using namespace UI;
PermissionStatus status = System_GetPermissionStatus(SYSTEM_PERMISSION_LOCAL_NETWORK);
if (status != PERMISSION_STATUS_GRANTED) {
// Proceed with local network functionality
tab->Add(new Choice(ri->T("Ask for network permission")))->OnClick.Add([this](UI::EventParams &e) {
System_AskForPermission(SYSTEM_PERMISSION_LOCAL_NETWORK);
});
return;
}
if (serverRunning_) {
tab->Add(new NoticeView(NoticeLevel::SUCCESS, ri->T("Currently sharing"), "", new LinearLayoutParams(Margins(12, 5, 0, 5))));
} else {
+2
View File
@@ -46,6 +46,8 @@ protected:
void HandleStopServer(UI::EventParams &e);
void HandleBrowse(UI::EventParams &e);
void sendMessage(UIMessage message, const char *value) override;
UI::TextView *firewallWarning_ = nullptr;
bool serverRunning_ = false;
bool serverStopping_ = false;