summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorPavan Kumar M <quic_rpavan@quicinc.com>2021-02-08 21:17:20 +0530
committerPavan Kumar M <quic_rpavan@quicinc.com>2021-12-15 22:56:06 +0530
commit55044318e59e8feee161e4fc379a7967b7c26d61 (patch)
tree0abd9fcc8c64cab75205244a6003306fae657738 /java
parentd11fb9883bd6c45e9c1955bb11ddb77039aae620 (diff)
downloadethernet-55044318e59e8feee161e4fc379a7967b7c26d61.tar.gz
Handle neighbor lost event
Neighbor lost event is received when gateway is not reachable. Ethernet Factory currently doesn't handle the neighbor lost event and network will not be brought down. This results in loss of connectivity even if there are other networks like WiFi. Restart NetworkInterfaceState when neighbor lost event is received. If there is a better network like WiFi, it will become default and apps will be able to use internet. If ethernet gets connected again, and has backhaul connectivity, it will become default. Bug: 180077540 Tests: Builds, Boots, EthernetServiceTests Change-Id: I26d720994ecb35f6529358a53e115091e7817c2f
Diffstat (limited to 'java')
-rw-r--r--java/com/android/server/ethernet/EthernetNetworkFactory.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index 26532d7..2886cf1 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -347,6 +347,11 @@ public class EthernetNetworkFactory extends NetworkFactory {
}
@Override
+ public void onReachabilityLost(String logMsg) {
+ mHandler.post(() -> updateNeighborLostEvent(logMsg));
+ }
+
+ @Override
public void onQuit() {
mIpClient = null;
mIpClientShutdownCv.open();
@@ -479,6 +484,17 @@ public class EthernetNetworkFactory extends NetworkFactory {
}
}
+ void updateNeighborLostEvent(String logMsg) {
+ Log.i(TAG, "updateNeighborLostEvent " + logMsg);
+ // Reachability lost will be seen only if the gateway is not reachable.
+ // Since ethernet FW doesn't have the mechanism to scan for new networks
+ // like WiFi, simply restart.
+ // If there is a better network, that will become default and apps
+ // will be able to use internet. If ethernet gets connected again,
+ // and has backhaul connectivity, it will become default.
+ restart();
+ }
+
/** Returns true if state has been modified */
boolean updateLinkState(boolean up) {
if (mLinkUp == up) return false;