WiFi connection established via RepWifi not correctly reported by the Android Framework to user-space apps
|Assignee:||Fil Bergamo||% Done:||
|Target version:||Replicant 6.0|
It is a suggested best practice for Android apps to check for the connectivity status of the device before performing any network-related task.
To do so, the Android Framework exposes some methods that apps can use to retrieve the available network connections, and their status.
When a WiFi connection is established via RepWifi app, although perfectly working (ping, dns resolution, web browsing), the framework still presents the WiFi connection as disabled or disconnected to the user-space apps.
This misleads apps that rely on this mechanism, so that they prevent the user from doing network-related tasks.
E.g. F-Droid prevents the user from updating the repos while connected to WiFi via RepWifi app, because it detects the WiFi connection as inactive.
A possible solution is to modify the designated system service in the Android Framework that reports the connection status to client apps.
Some research has already been done in this field.
A promising approach seems to properly modify the class "com.android.ConnectivityService.java" to read the ip routing tables, and detect the route established by RepWifi, and if present, modify the status of the corresponding "NetworkInfo" instance returned to calling applications.
Updated by Wolfgang Wiedmeyer 11 days ago
Thanks for summarizing the issue!
The same issue affects USB networking (reverse tethering) and it's likely that a fix for this can be used to fix the issue for USB networking as well.
Updated by Wolfgang Wiedmeyer 5 days ago
Just collecting some links you sent me that came up during the research:
ConnectivityManager (class apps are using to query network states):
uses IConnectivityManager: https://git.replicant.us/replicant/frameworks_base/blob/replicant-6.0/core/java/android/net/IConnectivityManager.aidl
getSystemService is used to query the system service "connectivity":