Repository navigation
App: opt-in Network setting for QEMU (declares ACCESS_NETWORK_STATE, off by default) - #148
Merged
Merged
Conversation
Settings > Advanced > Network (QEMU), per install. Off, the QEMU command line is the one from before: the inferno uplink on the unix socket and no -netdev (QemuCommandTest compares it with the old command line). On, a normal boot gets -netdev user,id=n0 and usb-uplink-type=net,usb-uplink-addr=n0; restore boots (a ramdisk in vm.properties) always keep the inferno uplink. With the setting on, the default network's DNS servers from LinkProperties go to files/run/<id>/resolv.conf, replaced atomically when they change, and QEMU gets its path in SLIRP_RESOLV_CONF (the interface of the libslirp DNS fix, #82). The status card shows "Network: off / waiting for guest / guest has 10.0.2.15", from Inferno's usb-net-uplink link line and slirp's info usernet. Declares ACCESS_NETWORK_STATE (INTERNET was already declared for AVF's Network setting). README, ETHICS and PHONE-QUICKSTART now say the app doesn't use the network unless Network is turned on. AppPaths gets a constructor from plain directories so the command line can be unit-tested; the install fingerprint (InstallMigration.seen) is built from the legacy keys alone so a new per-install key can't reorder it.
Collaborator
Author
|
Emulator check (shared AVD "iop", sdk_gphone64_arm64), with this PR's CI APK installed fresh after an uninstall:
Not done here, so left for Dylan: the Pixel 10 test with PR 146 (a lease, and Safari loading a page with the setting on), and |
…he Network resolver env)
dylanneve1
force-pushed
the
app/network-setting
branch
from
November 8, 2026 02:35
39738fe to
b91f568
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The app side of networking milestone 2 (docs/NETWORKING.md).
What it does:
qemu_networkin the install list; lists written before it read as off).infernouplink on the unix socket and no-netdev.QemuCommandTestcompares it with a hand-written copy of the old command line. That test passed against main'sQemuCommand.buildbefore any change.-netdev user,id=n0andusb-uplink-type=net,usb-uplink-addr=n0. Restore boots (aramdisk=in vm.properties) always keep theinfernouplink. I left outhostfwd(it would open a listening TCP port on the phone); it can be added when something needs SSH.QemuNet.Resolverwrites the default network'sLinkProperties.getDnsServers()tofiles/run/<id>/resolv.conf(nameserver ...lines,%ifnameon link-local IPv6). It replaces the file with a rename when the network changes and deletes it when there is no server. QEMU gets the path inSLIRP_RESOLV_CONF, in the child's environment or via Os.setenv in the:vmprocess. This is the interface of PR 146 (Android build: enable libslirp (-netdev user) and fix DNS on Android #82, libslirp in the Android build).usb-net-uplink: guest reports network connectedline. The address comes from slirp'sinfo userneton the monitor, polled every 3 s until it is found.ACCESS_NETWORK_STATE.INTERNETwas already declared for AVF's Network setting; its comment now covers both.AppPathshas a constructor from plain directories so the command line can be tested on the JVM; existingAppPaths(ctx, id)callers are unchanged.InstallMigration.seenis now built from the legacy keys alone. With a 13th key, org.json's JVM HashMap reorders, which brokeInstallMigrationTest(on Android, where org.json keeps insertion order, the string is the same as before).Depends on PR 146 for the network to work: without libslirp, QEMU with the setting on exits at once on
-netdev user. With the setting off, nothing depends on it, so this can land before or after PR 146.The AVF backend and native/build-android.sh are untouched.
Tested:
./gradlew lint testDebugUnitTestlocally: 42 tests pass (8 new in QemuCommandTest), and lint reports only warnings that were already there.Not tested (left for Dylan, needs a Pixel 10 and PR 146):
ss -tuanp/lsof -i).Closes #83