Repository navigation
1.4.6: find the server on any network, follow it to a new IP, Quick Settings tile, custom cursor colour - #83
Conversation
A phone on Wi-Fi that also hosts a hotspot for the PC (wlan0 + wlan1 on OnePlus) only swept wlan0's subnet, so a server reachable only over the hotspot never showed up. Return one address per /24 from every Wi-Fi, hotspot or private non-cellular interface and sweep them in parallel.
With auto-connect on, the saved server's IP goes stale after a PC reboot, a hotspot restart or airplane mode. If it doesn't answer at launch, search the local networks for the server presenting the same trusted certificate, move the saved server (fingerprint, name, star, transport) to its new IP and connect there. Servers without a saved fingerprint keep the old behaviour.
Check the servers the launch scan finds as they arrive and stop at the first certificate match, instead of waiting out a second full sweep of every network. Also give up on the old IP after 0.7 s, not 1.5 s. Finding the moved server dropped from ~8 s to ~4 s after launch.
…Deskflow Input Leap and Deskflow send function keys as 0xEFxx; the Back check only compared 0xFFxx, so it never matched (#73).
The menu is drawn upside down there, so Open is the last row, not the first; accept either as the pre-selected row (#74).
Android's virtual keyboard starts with Num Lock off, so keypad digits read as Home/End/arrows. The server only sends KP digits while its Num Lock is on, so type the character in both the Shizuku/root and Accessibility paths (#82).
A Custom swatch next to the six presets opens a hex-code field (#81). Presets still work and clear the custom colour.
Tapped while connected it disconnects from the shade. Tapped while not connected it opens the app, which connects to the last server (following it to a new IP) and returns to the background (#81).
What's new covers the multi-network scan, following the PC to a new IP, the Quick Settings tile, custom cursor colour, keypad digits and the Back-key and TV launcher fixes.
Hue, saturation and brightness bars with a live preview replace the hex field (#81).
…on moves Black has no hue, so starting from the default black cursor made the first two bars do nothing visible and look like they reset brightness.
Moving hue or saturation no longer changes brightness.
The drag handlers kept the first-composition lambdas, so every drag wrote back the initial values of the other two bars. Read the current state.
The system can't load a framework drawable for a tile and hid it. The new icon is a pointer with a leaf (#81).
A rounded leaf head with one connected vein, a stick tail like a pointer and two waves, centred on the tile (#81).
The state watcher fired after disconnect() removed the foreground notification and posted it again, leaving a stale Disconnect button with nothing connected. Stay quiet from the disconnect until the next connect.
The notification kept a Disconnect action when nothing was connected. It now shows only while connected or connecting, and a connection that fails for good or is rejected takes the notification down.
Reviewer's GuideData structuresReview the persisted cursor-colour preference and server-migration logic that moves saved servers, favourites, names, fingerprints, transport settings, and the last-server address to a new IP.
Review the cursor-look model and hex conversion helpers that define how custom colours are represented and formatted.
APIReview the network-address selection API and TLS fingerprint probe used to find a moved, previously trusted server.
Review the keypad-text resolution and Back-key policy interfaces that callers use for the updated input behavior.
Review the tile action and service declaration that expose Quick Settings connect and disconnect behavior.
Uses of the APIReview the keypad injection callers to ensure keypad characters bypass raw HID injection in both Shizuku and root paths.
Review launch auto-connect and network scanning callers, including reuse of the scan to match a trusted certificate and migrate the server address.
Review how MainActivity handles tile launches, connects to the last server, and returns the task to the background after connection.
ImplementationReview foreground-service shutdown and notification watcher coordination for user disconnects, rejected connections, and terminal failures.
Review cursor rendering to confirm the custom fill colour is applied while the outline and leaf cursor remain unchanged.
Review the TV launcher menu selection rule for menus opened above the app tile.
Review F-Droid update detection and the release version metadata kept in the update service.
UIReview the Settings cursor-colour swatch, custom-colour dialog integration, and picker controls and preview.
Review the app-owned Quick Settings tile icon used to make the tile visible in the system shade.
ConfigurationReview release versioning, optional signing, shrinking, native-library packaging, dependency metadata, ABI split controls, and removal of the unused device-names dependency.
Review the F-Droid build recipe and fastlane store metadata added for the 1.4.6 release.
DocumentationReview the F-Droid maintainer guide for submission, build, signing, and local verification instructions.
TestsReview tests covering keypad resolution, Back-key variants, and TV launcher menu selection.
Review tests for network interface selection, WifiManager fallback, and TLS fingerprint probing.
Review tests for cursor colour parsing and persistence, server-address migration, and F-Droid update behavior.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 10 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="app/src/main/java/com/inputleaf/android/ui/MainActivity.kt" line_range="98-101" />
<code_context>
+ * the user was doing once it's up. On failure the app stays so the error is visible.
+ */
+ private fun handleQuickConnect(intent: Intent?) {
+ if (intent?.action != ACTION_QUICK_CONNECT) return
+ intent.action = null
+ lifecycleScope.launch {
+ if (!viewModel.connectToLastServer()) return@launch
+ withTimeoutOrNull(30_000) {
+ viewModel.connectionState.first { it is ConnectionState.Idle || it is ConnectionState.Active }
</code_context>
<issue_to_address>
**Forged intent reconnects saved server**
When another installed app explicitly launches the exported activity with `ACTION_QUICK_CONNECT` while a last server is saved and the connection is disconnected, `MainActivity` accepts the action without checking its caller, then `connectToLastServer()` launches `autoConnect()` for the saved IP; a previously trusted server reconnects without a Quick Settings tile tap and can resume sending remote input.
Require an unforgeable tile-origin authorization for this action, or route the tile through a non-exported entry point that performs the connect.
</issue_to_address>
### Comment 2
<location path="app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt" line_range="671" />
<code_context>
+ .firstOrNull()
+ ?: return@withContext lastIp
+ Log.i("InputLeaf", "Last server moved from $lastIp to ${match.ip} (same certificate)")
+ prefs.moveServer(lastIp, match.ip)
+ match.ip
+ }
</code_context>
<issue_to_address>
**Removed server is re-added**
When the user removes the old server entry while auto-connect is searching for its new address, the auto-connect job does not check whether the user removed the saved server while certificate discovery was running. It can move the entry to the new IP and then call `connect`, whose `saveLastServer` write remembers that IP again, undoing the user's removal and reconnecting to the server.
Cancel or invalidate the in-flight auto-connect when the user removes that server, and recheck the user's current saved/last-server choice before moving or reconnecting it.
Also at `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt:642`.
</issue_to_address>
### Comment 3
<location path="app/src/main/java/com/inputleaf/android/service/QuickConnectTileService.kt" line_range="56" />
<code_context>
+
+ override fun onStartListening() {
+ // No BIND_AUTO_CREATE: a tile must not start the service just to read its state.
+ bound = bindService(Intent(this, ConnectionService::class.java), connection, 0)
+ if (!bound) state = ConnectionState.Disconnected
+ render()
</code_context>
<issue_to_address>
**Active connection stays connected**
When the tile is tapped before the asynchronous service binding delivers the active state, `onStartListening` renders the initial `Disconnected` state, and `onClick` opens the app instead of sending `ACTION_DISCONNECT`; the active connection remains connected.
Avoid treating the initial state as authoritative while binding is pending, and disconnect when the bound service reports an active connection.
Also at `app/src/main/java/com/inputleaf/android/service/QuickConnectTileService.kt:73-74`.
</issue_to_address>
### Comment 4
<location path="app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt" line_range="654" />
<code_context>
+ * fingerprint (plain connection) there's nothing safe to match on, so keep [lastIp].
+ */
+ private suspend fun autoConnectAddress(lastIp: String): String = withContext(Dispatchers.IO) {
+ if (isReachable(lastIp)) return@withContext lastIp
+ val trusted = prefs.fingerprintFor(lastIp).first()?.replace(":", "")?.lowercase()
+ ?: return@withContext lastIp
</code_context>
<issue_to_address>
**Occupied old address blocks recovery**
When the old IP has been reassigned to a different host that accepts TCP connections on the default server port, `isReachable` treats any TCP listener on the default port as the saved server, so auto-connect skips the certificate search when another host has taken the old address. `connect` then targets that host instead of finding the trusted server at its new IP, and the user cannot reconnect through the recovery path.
Before skipping recovery, verify that the old endpoint presents the saved fingerprint rather than treating an open TCP port as proof of identity.
</issue_to_address>
### Comment 5
<location path="app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt" line_range="605" />
<code_context>
- if (ip != null) {
- scanner.scan(ip) { server ->
- if (server.name.isNotBlank() && server.name != server.ip) {
- viewModelScope.launch { prefs.saveServerName(server.ip, server.name) }
- }
- _discoveredServers.update { currentServers ->
</code_context>
<issue_to_address>
**Stale server entry returns**
When a scan callback for the old IP is still pending when relocation commits, `saveServerName` calls `rememberServer`, so a pending name save after `moveServer` adds the old IP back to saved servers; the user sees both the relocated server and its stale entry.
Prevent a pending name save for the old IP from re-adding it after relocation.
Also at `app/src/main/java/com/inputleaf/android/storage/AppPreferences.kt:298`, `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt:672`.
</issue_to_address>
### Comment 6
<location path="app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt" line_range="631" />
<code_context>
+ if (state !is ConnectionState.Disconnected) return true
+ userRequestedDisconnect = false
+ // The connect itself needs the bound service; the tile can beat the binding.
+ withTimeoutOrNull(3000) { while (service == null) delay(50) }
+ autoConnect(lastIp)
+ return true
</code_context>
<issue_to_address>
**Tile connect is lost on slow binding**
When the service binding takes longer than three seconds and auto-connect is disabled, `connectToLastServer` continues after its 3-second wait expires, so `autoConnect` can reach `connect` while `service` is still null. `connect` then reports that the service is not ready and returns; with auto-connect disabled, the later service bind does not retry, so the tile tap never connects.
Do not report the tile request as handled until the service is available; retry the requested connection after binding or surface a definitive failure to the caller.
</issue_to_address>
### Comment 7
<location path="app/src/main/java/com/inputleaf/android/network/NetworkUtils.kt" line_range="25" />
<code_context>
- }
+ val candidates = interfaces
+ .filter { it.isUp && !it.isLoopback }
+ .map { iface -> iface.name to listOfNotNull(getIPv4FromInterface(iface)) }
+ candidates.filter { it.second.isNotEmpty() }
+ .forEach { (name, addrs) -> Log.d(TAG, "Interface $name: $addrs") }
</code_context>
<issue_to_address>
**Servers on secondary subnets are missed**
When an eligible interface has IPv4 addresses on more than one subnet, `getIPv4FromInterface` returns only the first IPv4 address, and the caller passes that single address to `scanAddresses`; servers reachable through the interface's other subnet are never discovered.
Collect and pass every IPv4 address on each eligible interface to `scanAddresses`.
</issue_to_address>
### Comment 8
<location path="app/src/main/java/com/inputleaf/android/network/NetworkUtils.kt" line_range="25-58" />
<code_context>
+ .map { iface -> iface.name to listOfNotNull(getIPv4FromInterface(iface)) }
</code_context>
<issue_to_address>
**Servers on overlapping networks are missed**
When separate interfaces use the same /24 prefix but reach different networks, `distinctBy` keeps only one address for that /24, so the scanner does not probe the other interface's network and misses servers reachable only there.
Deduplicate scan addresses without collapsing addresses from separate interfaces that share a /24 prefix.
</issue_to_address>
### Comment 9
<location path="app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt" line_range="663" />
<code_context>
+ val checked = mutableSetOf(lastIp)
+ val match = combine(_discoveredServers, _isScanning, ::Pair)
+ .transformWhile { (servers, scanning) ->
+ val hit = servers.filter { checked.add(it.ip) }
+ .firstOrNull { scanner.fingerprintOf(it.ip) == trusted }
+ if (hit != null) emit(hit)
</code_context>
<issue_to_address>
**Stale discovery moves the saved server**
When a rescan follows an earlier scan and an old discovered address still presents the saved certificate, `autoConnectAddress` checks every address already in `_discoveredServers` before the new scan has refreshed it. A stale entry presenting the trusted certificate is accepted and passed to `moveServer`, so the saved server is moved to an address that no longer hosts it.
Clear or generation-tag discovered results when starting a scan, and only match addresses reported by that scan.
</issue_to_address>
### Comment 10
<location path="app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt" line_range="663-664" />
<code_context>
+ val checked = mutableSetOf(lastIp)
+ val match = combine(_discoveredServers, _isScanning, ::Pair)
+ .transformWhile { (servers, scanning) ->
+ val hit = servers.filter { checked.add(it.ip) }
+ .firstOrNull { scanner.fingerprintOf(it.ip) == trusted }
+ if (hit != null) emit(hit)
+ hit == null && scanning
</code_context>
<issue_to_address>
**Moved server can be skipped**
When multiple servers are discovered while a fingerprint check is in progress and the trusted server is not the first candidate in the next conflated emission, `filter` adds every newly observed server IP to `checked` before `firstOrNull` tests only the first candidate. If `StateFlow` conflates scan updates while a fingerprint check is blocking, later candidates in that emission are marked checked without being tested, so relocation can miss the trusted server and fall back to the stale IP.
Mark each address checked only as it is actually fingerprint-tested, and continue testing every candidate in each emission until a match is found.
</issue_to_address>| if (intent?.action != ACTION_QUICK_CONNECT) return | ||
| intent.action = null | ||
| lifecycleScope.launch { | ||
| if (!viewModel.connectToLastServer()) return@launch |
There was a problem hiding this comment.
🟡 Medium · Forged intent reconnects saved server
When another installed app explicitly launches the exported activity with ACTION_QUICK_CONNECT while a last server is saved and the connection is disconnected, MainActivity accepts the action without checking its caller, then connectToLastServer() launches autoConnect() for the saved IP; a previously trusted server reconnects without a Quick Settings tile tap and can resume sending remote input.
Require an unforgeable tile-origin authorization for this action, or route the tile through a non-exported entry point that performs the connect.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/ui/MainActivity.kt` at lines 98-101:
**Forged intent reconnects saved server**
When another installed app explicitly launches the exported activity with `ACTION_QUICK_CONNECT` while a last server is saved and the connection is disconnected, `MainActivity` accepts the action without checking its caller, then `connectToLastServer()` launches `autoConnect()` for the saved IP; a previously trusted server reconnects without a Quick Settings tile tap and can resume sending remote input.
Require an unforgeable tile-origin authorization for this action, or route the tile through a non-exported entry point that performs the connect.| .firstOrNull() | ||
| ?: return@withContext lastIp | ||
| Log.i("InputLeaf", "Last server moved from $lastIp to ${match.ip} (same certificate)") | ||
| prefs.moveServer(lastIp, match.ip) |
There was a problem hiding this comment.
🟡 Medium · Removed server is re-added
When the user removes the old server entry while auto-connect is searching for its new address, the auto-connect job does not check whether the user removed the saved server while certificate discovery was running. It can move the entry to the new IP and then call connect, whose saveLastServer write remembers that IP again, undoing the user's removal and reconnecting to the server.
Cancel or invalidate the in-flight auto-connect when the user removes that server, and recheck the user's current saved/last-server choice before moving or reconnecting it.
Also at app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt:642.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt` at line 671:
**Removed server is re-added**
When the user removes the old server entry while auto-connect is searching for its new address, the auto-connect job does not check whether the user removed the saved server while certificate discovery was running. It can move the entry to the new IP and then call `connect`, whose `saveLastServer` write remembers that IP again, undoing the user's removal and reconnecting to the server.
Cancel or invalidate the in-flight auto-connect when the user removes that server, and recheck the user's current saved/last-server choice before moving or reconnecting it.
Also at `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt:642`.|
|
||
| override fun onStartListening() { | ||
| // No BIND_AUTO_CREATE: a tile must not start the service just to read its state. | ||
| bound = bindService(Intent(this, ConnectionService::class.java), connection, 0) |
There was a problem hiding this comment.
🟡 Medium · Active connection stays connected
When the tile is tapped before the asynchronous service binding delivers the active state, onStartListening renders the initial Disconnected state, and onClick opens the app instead of sending ACTION_DISCONNECT; the active connection remains connected.
Avoid treating the initial state as authoritative while binding is pending, and disconnect when the bound service reports an active connection.
Also at app/src/main/java/com/inputleaf/android/service/QuickConnectTileService.kt:73-74.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/service/QuickConnectTileService.kt` at line 56:
**Active connection stays connected**
When the tile is tapped before the asynchronous service binding delivers the active state, `onStartListening` renders the initial `Disconnected` state, and `onClick` opens the app instead of sending `ACTION_DISCONNECT`; the active connection remains connected.
Avoid treating the initial state as authoritative while binding is pending, and disconnect when the bound service reports an active connection.
Also at `app/src/main/java/com/inputleaf/android/service/QuickConnectTileService.kt:73-74`.| * fingerprint (plain connection) there's nothing safe to match on, so keep [lastIp]. | ||
| */ | ||
| private suspend fun autoConnectAddress(lastIp: String): String = withContext(Dispatchers.IO) { | ||
| if (isReachable(lastIp)) return@withContext lastIp |
There was a problem hiding this comment.
🟡 Medium · Occupied old address blocks recovery
When the old IP has been reassigned to a different host that accepts TCP connections on the default server port, isReachable treats any TCP listener on the default port as the saved server, so auto-connect skips the certificate search when another host has taken the old address. connect then targets that host instead of finding the trusted server at its new IP, and the user cannot reconnect through the recovery path.
Before skipping recovery, verify that the old endpoint presents the saved fingerprint rather than treating an open TCP port as proof of identity.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt` at line 654:
**Occupied old address blocks recovery**
When the old IP has been reassigned to a different host that accepts TCP connections on the default server port, `isReachable` treats any TCP listener on the default port as the saved server, so auto-connect skips the certificate search when another host has taken the old address. `connect` then targets that host instead of finding the trusted server at its new IP, and the user cannot reconnect through the recovery path.
Before skipping recovery, verify that the old endpoint presents the saved fingerprint rather than treating an open TCP port as proof of identity.| async { | ||
| scanner.scan(ip) { server -> | ||
| if (server.name.isNotBlank() && server.name != server.ip) { | ||
| viewModelScope.launch { prefs.saveServerName(server.ip, server.name) } |
There was a problem hiding this comment.
🟡 Medium · Stale server entry returns
When a scan callback for the old IP is still pending when relocation commits, saveServerName calls rememberServer, so a pending name save after moveServer adds the old IP back to saved servers; the user sees both the relocated server and its stale entry.
Prevent a pending name save for the old IP from re-adding it after relocation.
Also at app/src/main/java/com/inputleaf/android/storage/AppPreferences.kt:298, app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt:672.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt` at line 605:
**Stale server entry returns**
When a scan callback for the old IP is still pending when relocation commits, `saveServerName` calls `rememberServer`, so a pending name save after `moveServer` adds the old IP back to saved servers; the user sees both the relocated server and its stale entry.
Prevent a pending name save for the old IP from re-adding it after relocation.
Also at `app/src/main/java/com/inputleaf/android/storage/AppPreferences.kt:298`, `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt:672`.| if (state !is ConnectionState.Disconnected) return true | ||
| userRequestedDisconnect = false | ||
| // The connect itself needs the bound service; the tile can beat the binding. | ||
| withTimeoutOrNull(3000) { while (service == null) delay(50) } |
There was a problem hiding this comment.
🟡 Medium · Tile connect is lost on slow binding
When the service binding takes longer than three seconds and auto-connect is disabled, connectToLastServer continues after its 3-second wait expires, so autoConnect can reach connect while service is still null. connect then reports that the service is not ready and returns; with auto-connect disabled, the later service bind does not retry, so the tile tap never connects.
Do not report the tile request as handled until the service is available; retry the requested connection after binding or surface a definitive failure to the caller.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt` at line 631:
**Tile connect is lost on slow binding**
When the service binding takes longer than three seconds and auto-connect is disabled, `connectToLastServer` continues after its 3-second wait expires, so `autoConnect` can reach `connect` while `service` is still null. `connect` then reports that the service is not ready and returns; with auto-connect disabled, the later service bind does not retry, so the tile tap never connects.
Do not report the tile request as handled until the service is available; retry the requested connection after binding or surface a definitive failure to the caller.| } | ||
| val candidates = interfaces | ||
| .filter { it.isUp && !it.isLoopback } | ||
| .map { iface -> iface.name to listOfNotNull(getIPv4FromInterface(iface)) } |
There was a problem hiding this comment.
🟡 Medium · Servers on secondary subnets are missed
When an eligible interface has IPv4 addresses on more than one subnet, getIPv4FromInterface returns only the first IPv4 address, and the caller passes that single address to scanAddresses; servers reachable through the interface's other subnet are never discovered.
Collect and pass every IPv4 address on each eligible interface to scanAddresses.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/network/NetworkUtils.kt` at line 25:
**Servers on secondary subnets are missed**
When an eligible interface has IPv4 addresses on more than one subnet, `getIPv4FromInterface` returns only the first IPv4 address, and the caller passes that single address to `scanAddresses`; servers reachable through the interface's other subnet are never discovered.
Collect and pass every IPv4 address on each eligible interface to `scanAddresses`.| .map { iface -> iface.name to listOfNotNull(getIPv4FromInterface(iface)) } | ||
| candidates.filter { it.second.isNotEmpty() } | ||
| .forEach { (name, addrs) -> Log.d(TAG, "Interface $name: $addrs") } | ||
| val ips = scanAddresses(candidates) | ||
| if (ips.isNotEmpty()) { | ||
| Log.d(TAG, "Scanning from $ips") | ||
| return ips | ||
| } | ||
| } catch (e: Exception) { | ||
| Log.e(TAG, "Error getting IP address: ${e.message}", e) | ||
| } | ||
|
|
||
|
|
||
| // WifiManager fallback for older Android or edge cases | ||
| val wifiIp = getWifiManagerIp(app) | ||
| if (wifiIp != null && wifiIp != "0.0.0.0") { | ||
| Log.d(TAG, "Using WifiManager IP: $wifiIp") | ||
| return listOf(wifiIp) | ||
| } | ||
| Log.e(TAG, "Could not determine local IP address") | ||
| return null | ||
| return emptyList() | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Picks the addresses to scan from (interface name, IPv4 addresses) pairs: known | ||
| * Wi-Fi/hotspot interfaces first and with any address, other non-cellular | ||
| * interfaces only with a private one. One address per /24, since that's what | ||
| * [ServerScanner] sweeps. | ||
| */ | ||
| internal fun scanAddresses(interfaces: List<Pair<String, List<String>>>): List<String> = | ||
| interfaces | ||
| .filterNot { (name, _) -> CELLULAR_PREFIXES.any { name.startsWith(it) } } | ||
| .sortedBy { (name, _) -> WIFI_INTERFACE_NAMES.indexOf(name).let { if (it < 0) Int.MAX_VALUE else it } } | ||
| .flatMap { (name, addrs) -> addrs.filter { name in WIFI_INTERFACE_NAMES || isPrivateIP(it) } } | ||
| .distinctBy { it.substringBeforeLast('.') } |
There was a problem hiding this comment.
🟡 Medium · Servers on overlapping networks are missed
When separate interfaces use the same /24 prefix but reach different networks, distinctBy keeps only one address for that /24, so the scanner does not probe the other interface's network and misses servers reachable only there.
Deduplicate scan addresses without collapsing addresses from separate interfaces that share a /24 prefix.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/network/NetworkUtils.kt` at lines 25-58:
**Servers on overlapping networks are missed**
When separate interfaces use the same /24 prefix but reach different networks, `distinctBy` keeps only one address for that /24, so the scanner does not probe the other interface's network and misses servers reachable only there.
Deduplicate scan addresses without collapsing addresses from separate interfaces that share a /24 prefix.| val checked = mutableSetOf(lastIp) | ||
| val match = combine(_discoveredServers, _isScanning, ::Pair) | ||
| .transformWhile { (servers, scanning) -> | ||
| val hit = servers.filter { checked.add(it.ip) } |
There was a problem hiding this comment.
🟡 Medium · Stale discovery moves the saved server
When a rescan follows an earlier scan and an old discovered address still presents the saved certificate, autoConnectAddress checks every address already in _discoveredServers before the new scan has refreshed it. A stale entry presenting the trusted certificate is accepted and passed to moveServer, so the saved server is moved to an address that no longer hosts it.
Clear or generation-tag discovered results when starting a scan, and only match addresses reported by that scan.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt` at line 663:
**Stale discovery moves the saved server**
When a rescan follows an earlier scan and an old discovered address still presents the saved certificate, `autoConnectAddress` checks every address already in `_discoveredServers` before the new scan has refreshed it. A stale entry presenting the trusted certificate is accepted and passed to `moveServer`, so the saved server is moved to an address that no longer hosts it.
Clear or generation-tag discovered results when starting a scan, and only match addresses reported by that scan.| val hit = servers.filter { checked.add(it.ip) } | ||
| .firstOrNull { scanner.fingerprintOf(it.ip) == trusted } |
There was a problem hiding this comment.
🟡 Medium · Moved server can be skipped
When multiple servers are discovered while a fingerprint check is in progress and the trusted server is not the first candidate in the next conflated emission, filter adds every newly observed server IP to checked before firstOrNull tests only the first candidate. If StateFlow conflates scan updates while a fingerprint check is blocking, later candidates in that emission are marked checked without being tested, so relocation can miss the trusted server and fall back to the stale IP.
Mark each address checked only as it is actually fingerprint-tested, and continue testing every candidate in each emission until a match is found.
Prompt for AI agents
In `app/src/main/java/com/inputleaf/android/ui/MainViewModel.kt` at lines 663-664:
**Moved server can be skipped**
When multiple servers are discovered while a fingerprint check is in progress and the trusted server is not the first candidate in the next conflated emission, `filter` adds every newly observed server IP to `checked` before `firstOrNull` tests only the first candidate. If `StateFlow` conflates scan updates while a fingerprint check is blocking, later candidates in that emission are marked checked without being tested, so relocation can miss the trusted server and fall back to the stale IP.
Mark each address checked only as it is actually fingerprint-tested, and continue testing every candidate in each emission until a match is found.Sign only when the gitignored keystore exists, leave Google's dependency list out of the APK, and build one universal APK under -PnoAbiSplits (F-Droid wants one APK per versionCode). The normal release build is unchanged: same five APKs, same signing certificate.
F-Droid delivers its own updates, so the in-app check now stops at the install source instead of querying the GitHub API.
Title, descriptions, icon, feature graphic, screenshots and the 1.4.6 changelog under fastlane/, plus the fdroiddata recipe and a maintainer note. fdroid lint passes on the recipe.
F-Droid asked for R8. Release builds now minify and shrink resources: the universal APK goes from 15.8 MB to 2.7 MB. proguard-rules.pro was never applied (no proguardFiles) and kept every class, so it is replaced by rules for what is only reached by name: the app_process entry points, the Shizuku UserService and libsu RootService constructors, the private Shizuku.newProcess, and libsu's RootServerMain, which its root launcher loads by its literal name. Native libraries are kept unstripped so the APK is the same on any build machine (F-Droid patches this in for 1.4.6), and the unused android-device-names library, which shipped a 1.4 MB database, is dropped.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…be defaults Codecov flagged 7 uncovered lines on #83. getLocalIpAddresses takes the interface list so a test can reach the WifiManager fallback, which now looks WifiManager up by WIFI_SERVICE (Robolectric can't resolve getSystemService(Class) on Application).
Stable 1.4.6 (versionCode 16): finding the server on any network, following it when its address changes, a Quick Settings tile, a custom cursor colour, and a few input fixes.
Finding the server
wlan0+wlan1on OnePlus) only swept the first network's subnet, so a server reachable only over the hotspot never showed up. The scan now covers one address per /24 from every Wi-Fi, hotspot or private non-cellular interface, in parallel..localnames and Deskflow advertises no mDNS service.Quick Settings tile (#81)
Cursor colour (#81)
Input fixes
0xEFxx; the Back check only compared0xFFxx.Notification
Checks
.sent from the PC through Deskflow typed789.in a text field.Refs #73, #74, #81, #82
Summary by Sourcery
Release version 1.4.6 with resilient multi-network server discovery, Quick Settings connectivity controls, customizable cursor colours, input fixes, and F-Droid distribution support.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: