diff options
author | Fil Bergamo <fil.bergamo@riseup.net> | 2017-08-04 22:44:51 +0000 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2017-08-13 01:57:36 +0200 |
commit | 9971175ea84fdbaf2d4671e30460792385b28859 (patch) | |
tree | 32c923c0adb7f93a2d2d995e7040c9791d2cb56b /services/midi/java | |
parent | a0ce80942766948d4cd1036b97e2ee721ed8ecce (diff) | |
download | frameworks_base-9971175ea84fdbaf2d4671e30460792385b28859.tar.gz frameworks_base-9971175ea84fdbaf2d4671e30460792385b28859.tar.bz2 frameworks_base-9971175ea84fdbaf2d4671e30460792385b28859.zip |
Fix "RepWifi connection not correctly reported to userspace apps" Issue #1792.
When a WiFi connection is established using an external dongle via the
RepWifi app, although it's perfectly working, 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.
This patch solves the issue by modifying getActiveNetworkInfo() method
in ConnectivityService.java, adding a basic mechanism to check if the
WiFi interface is connected.
java.net.NetworkInterface.getByName() is used to look for either
"wlan0" (RepWifi) or "rndis0"(Tethering).
If any one of the two interfaces is present, getInetAddresses() is
called on it, to see if it has any IP address.
If the interface has an IP address in the "local" range
(e.g. 192.168.x.x), then it is considered to be connected. So an
instance of android.net.NetworkInfo is created, and its state is set
as "Connected".
Finally, that instance gets returned to the caller. The result should
be so that user-space apps are now able to "see" the internet
connection made via RepWifi or via reverse tethering.
Signed-off-by: Fil Bergamo <fil.bergamo@riseup.net>
Reviewed-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'services/midi/java')
0 files changed, 0 insertions, 0 deletions