Merge 4205f2f06b03463e0fc99edf8c8576a2631417bd on remote branch

Change-Id: I39f9a2c17d08b9a1125a171c21789d7ca3e741df
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index 793b284..feab828 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -339,6 +339,11 @@
             }
 
             @Override
+            public void onReachabilityLost(String logMsg) {
+                mHandler.post(() -> updateNeighborLostEvent(logMsg));
+            }
+
+            @Override
             public void onQuit() {
                 mIpClient = null;
                 mIpClientShutdownCv.open();
@@ -502,6 +507,17 @@
             }
         }
 
+        void updateNeighborLostEvent(String logMsg) {
+            Log.d(TAG, "updateNeighborLostEvent " + logMsg);
+            // Reachability lost will be seen only if the gateway is not reachable.
+            // Since etherert 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;