feat(android): add configurable network access setting#144
Open
lucletoffe wants to merge 3 commits intoActivityWatch:masterfrom
Open
feat(android): add configurable network access setting#144lucletoffe wants to merge 3 commits intoActivityWatch:masterfrom
lucletoffe wants to merge 3 commits intoActivityWatch:masterfrom
Conversation
Add a Settings screen with a toggle to allow network access to the embedded ActivityWatch server. When enabled, the server binds to 0.0.0.0 instead of 127.0.0.1, allowing other devices on the local network to connect. The setting is off by default. Enabling it shows a security warning dialog explaining the risks (no authentication on the API, data exposed to the network). The change takes effect on app restart. This also wires up the previously-unimplemented Settings action bar button to open the new Settings screen. The aw-server-rust submodule is updated to accept a host parameter in the JNI startServer() call instead of using a hardcoded address. Closes ActivityWatch#121, closes ActivityWatch#107
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to c68cd3d in 10 seconds. Click for details.
- Reviewed
222lines of code in8files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_KwTYz1tLqtlRe2VO
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Greptile SummaryThis PR adds a user-configurable "Allow network access" setting that enables the embedded ActivityWatch server to bind to Key changes:
Implementation quality:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Settings button] --> B[SettingsActivity opens]
B --> C{Network access<br/>switch toggled?}
C -->|Enable| D[Show security warning dialog]
C -->|Disable| E[Save preference: false]
D -->|User clicks Enable| F[Save preference: true]
D -->|User cancels| G[Revert switch to off]
F --> H[Show restart notice toast]
E --> H
H --> I[User restarts app]
I --> J[MainActivity.onCreate]
J --> K{Check preference:<br/>isNetworkAccessEnabled?}
K -->|true| L[host = 0.0.0.0]
K -->|false| M[host = 127.0.0.1]
L --> N[RustInterface.startServerTask]
M --> N
N --> O[Native startServer called<br/>with host parameter]
O --> P{Binding address}
P -->|0.0.0.0| Q[Server accepts<br/>external connections]
P -->|127.0.0.1| R[Server localhost only]
Last reviewed commit: c68cd3d |
j-standfast
added a commit
to j-standfast/aw-android
that referenced
this pull request
May 7, 2026
…led upstream PR ActivityWatch#144 wired R.id.action_settings (action-bar overflow) to launch SettingsActivity. But the action bar's Toolbar is commented out in app_bar_main.xml (the AppBarLayout block at lines 10-22 is wrapped in an XML comment), so R.menu.main never displays. The Settings entry point we cherry-picked is unreachable in the running app — confirmed by sideload test on the Pixel 10 Pro. The original PR author admitted to never building the APK, which explains why this slipped past review. Fix: surface SettingsActivity through the existing navigation drawer instead. Repoint "Misc → Settings" at SettingsActivity (the natural spot for Android-native app settings), and add a separate "Server settings" item to preserve the old web-UI route to http://127.0.0.1:5600/#/settings/. Leaves R.menu.main wired to SettingsActivity too — if someone ever re-enables the toolbar, the action-bar entry point lights up for free. No reason to remove it. Refs QLI-555.
j-standfast
added a commit
to j-standfast/aw-android
that referenced
this pull request
May 7, 2026
… nav Upstream commented out the Toolbar in app_bar_main.xml (lines 10-22 of the file were wrapped in <!-- -->). With no toolbar there's no system action bar, no hamburger button, and no R.menu.main display surface. On modern Android (11+, especially GrapheneOS) the gesture-nav left-edge swipe is intercepted as the system back gesture, so the DrawerLayout's edge-pull is unreachable too — the navigation drawer becomes effectively invisible. Confirmed on Pixel 10 Pro / GrapheneOS: even with our SettingsActivity correctly registered and routed from R.id.nav_settings, the user had no way to reach the drawer at all. Fix: uncomment the AppBarLayout/Toolbar block, switch the toolbar background from hardcoded #FFFFFF to ?attr/colorPrimary so it picks up the theme, and wire it up in MainActivity.onCreate via setSupportActionBar + ActionBarDrawerToggle. Reuses the existing navigation_drawer_open/close strings already in strings.xml. Now: hamburger top-left opens the drawer, drawer shows Home/Activity/Raw Data + Misc → Settings/Server settings/Share/ Report bugs. Action bar overflow also lights up R.menu.main, so the PR-ActivityWatch#144 action_settings entry point becomes reachable as a bonus. Refs QLI-555.
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.
Summary
Adds a user-facing "Allow network access" toggle so the embedded server can optionally bind to
0.0.0.0instead of127.0.0.1, letting other devices on the local network connect to the ActivityWatch API.Off by default. Enabling shows a security warning dialog.
Changes
Settings UI:
SettingsActivitywith a Material switch, accessible from the action bar Settings button (which previously showed a "not yet implemented" snackbar)Plumbing:
AWPreferences: newisNetworkAccessEnabled/setNetworkAccessEnabledmethodsRustInterface:startServer()andstartServerTask()now accept ahostparameterMainActivity: reads the preference on startup, passes"0.0.0.0"or"127.0.0.1"to the serverstrings.xml: setting labels and warning textAndroidManifest.xml: registeredSettingsActivityaw-server-rust submodule:
Security
The toggle is opt-in with a clear warning dialog. The warning mentions:
Notes
onCreate). I kept it simple rather than adding server restart logic.Closes #121, relates to #107
This is my first PR on the project. If there's anything I should do differently (commit structure, code style, approach), let me know — happy to adjust.
Important
Adds a user-configurable network access setting to allow the embedded server to bind to all network interfaces, with a security warning and requiring app restart.
SettingsActivityto allow network access, binding the server to0.0.0.0instead of127.0.0.1.AWPreferences: AddsisNetworkAccessEnabledandsetNetworkAccessEnabledmethods.MainActivity: Reads network access preference and starts server with appropriate host.RustInterface: UpdatesstartServer()andstartServerTask()to accept ahostparameter.SettingsActivitytoAndroidManifest.xml.strings.xmlwith new labels and warning messages.activity_settings.xmllayout for settings UI.aw-server-rustsubmodule to include JNI changes for host parameter.This description was created by
for c68cd3d. You can customize this summary. It will automatically update as commits are pushed.