Persist Change Bundle Location host setting (#57425)

Summary:
Persist `Change Bundle Location` updates to the same `debug_http_host` preference used by the Android Dev Settings screen.

Previously, `Change Bundle Location` only updated the in-memory `PackagerConnectionSettings` host override. After killing and restarting the app process, the host was read again from `SharedPreferences`, so the change was lost.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[ANDROID] [FIXED] - Persist Change Bundle Location debug server host changes

Pull Request resolved: https://github.com/react/react-native/pull/57425

Test Plan:
Verified with RNTester `debugOptimized` on Android:

1. Installed and launched RNTester on a physical Android device.
2. Opened the React Native Dev Menu.
3. Changed the bundle location using `Change Bundle Location`.
4. Killed and restarted the app process.
5. Confirmed the updated host is still used after restart.

Reviewed By: cortinico

Differential Revision: D110990504

Pulled By: Abbondanzo

fbshipit-source-id: c5fa7ed011872df7f0f14a8a45a0a7a0e4d8658d
This commit is contained in:
Phecda authored and meta-codesync[bot] committed 2026-07-08 08:51:45 -07:00
1 parent 0df0be24ef
commit d2ac190411
1 file changed
+4 -1
@@ -21,7 +21,7 @@ public open class PackagerConnectionSettings(private val appContext: Context) {
public val packageName: String = appContext.packageName
init {
resetDebugServerHost()
_cachedOrOverrideHost = null
}
public open var debugServerHost: String
@@ -50,13 +50,16 @@ public open class PackagerConnectionSettings(private val appContext: Context) {
}
set(host) {
if (host.isEmpty()) {
preferences.edit().remove(PREFS_DEBUG_SERVER_HOST_KEY).apply()
_cachedOrOverrideHost = null
} else {
preferences.edit().putString(PREFS_DEBUG_SERVER_HOST_KEY, host).apply()
_cachedOrOverrideHost = host
}
}
public open fun resetDebugServerHost() {
preferences.edit().remove(PREFS_DEBUG_SERVER_HOST_KEY).apply()
_cachedOrOverrideHost = null
}