diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
index 94fdbb0082a..f17455b519e 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
@@ -1423,22 +1423,11 @@ class SettingsFragmentPresenter(
}
}, R.string.real_balance_board, 0))
- sl.add(SwitchSetting(context, object : AbstractBooleanSetting {
- override val isOverridden: Boolean = BooleanSetting.SERVERS_ENABLED.isOverridden
-
- override val isRuntimeEditable: Boolean =
- BooleanSetting.SERVERS_ENABLED.isRuntimeEditable
-
- override fun delete(settings: Settings): Boolean {
- return BooleanSetting.SERVERS_ENABLED.delete(settings)
- }
-
- override val boolean: Boolean get() = BooleanSetting.SERVERS_ENABLED.boolean;
-
- override fun setBoolean(settings: Settings, newValue: Boolean) {
- BooleanSetting.SERVERS_ENABLED.setBoolean(settings, if (newValue) true else false);
- }
- }, R.string.dualshockudp_client, R.string.dualshockudp_client_description))
+ sl.add(SwitchSetting(context,
+ BooleanSetting.SERVERS_ENABLED,
+ R.string.dualshockudp_client,
+ R.string.dualshockudp_client_description)
+ )
sl.add(
InputStringSetting(
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index 7a99f00ef2d..ed915f38de2 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -24,7 +24,7 @@
Wii Remote Extension 4
Real Balance Board
- DualshockUDP Client (Background Input)
+ DSU Input
DualshockUDP Server Info (Alternate Input Source)
Description:IP:Port;
diff --git a/Source/Android/jni/ActivityTracker.cpp b/Source/Android/jni/ActivityTracker.cpp
index b8718905769..52d53f848af 100644
--- a/Source/Android/jni/ActivityTracker.cpp
+++ b/Source/Android/jni/ActivityTracker.cpp
@@ -6,6 +6,9 @@
#include "Common/Logging/Log.h"
#include "Core/AchievementManager.h"
+// Minimal bridge to notify native code to pause/resume background input updates.
+extern "C" void SetBackgroundInputExecutionAllowed(bool allowed);
+
extern "C" {
JNIEXPORT void JNICALL
@@ -17,5 +20,6 @@ Java_org_dolphinemu_dolphinemu_utils_ActivityTracker_setBackgroundExecutionAllow
INFO_LOG_FMT(CORE, "SetBackgroundExecutionAllowed {}", allowed);
AchievementManager::GetInstance().SetBackgroundExecutionAllowed(allowed);
+ SetBackgroundInputExecutionAllowed(static_cast(allowed));
}
}
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp
index 5564c46de26..518f9a901fe 100644
--- a/Source/Android/jni/MainAndroid.cpp
+++ b/Source/Android/jni/MainAndroid.cpp
@@ -9,6 +9,7 @@
#include
#include
#include
+#include
#include
#include
@@ -59,7 +60,6 @@
#include "InputCommon/GCAdapter.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
-
#include "UICommon/GameFile.h"
#include "UICommon/UICommon.h"
@@ -88,6 +88,8 @@ bool s_need_nonblocking_alert_msg;
Common::Flag s_is_booting;
bool s_game_metadata_is_valid = false;
+// When false, the controller-update thread will pause updates to save battery.
+std::atomic s_background_execution_allowed{true};
} // Anonymous namespace
void UpdatePointer()
@@ -566,10 +568,17 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Initialize(J
AchievementManager::GetInstance().Init(nullptr);
// Start a background thread to periodically update controller input (every 10ms).
- // This ensures Android keeps controller state updated even without a dedicated input loop.
+ // The thread checks `s_background_execution_allowed` and pauses updates when
+ // background execution is disallowed (to save battery).
std::thread([]() {
while (true)
{
+ if (!s_background_execution_allowed.load())
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ continue;
+ }
+
g_controller_interface.SetCurrentInputChannel(ciface::InputChannel::Host);
g_controller_interface.UpdateInput();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
@@ -589,6 +598,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GenerateNewS
DolphinAnalytics::Instance().GenerateNewIdentity();
}
+// Called from Java-side ActivityTracker native shim to allow/disable background
+// controller updates. Kept minimal: just flip the flag the thread checks.
+extern "C" void SetBackgroundInputExecutionAllowed(bool allowed)
+{
+ s_background_execution_allowed.store(allowed);
+}
+
// Returns the scale factor for imgui rendering.
// Based on the scaledDensity of the device's display metrics.
static float GetRenderSurfaceScale(JNIEnv* env)